diff --git a/CHANGES b/CHANGES index 82295970..1d32945c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,41 @@ +Refresh 13 + +- No more nonmatchings remain for US, JP, or EU builds. Three(!!!) remain for Shindou (SH). + +*) SHINDOU MATCHING (#1081) +*) Makefile gcc fixes (#1114) + +1.) Update diff.py (#1113) +2.) Add support for generating C arrays from n64graphics and add Texture typedef (#1032) +3.) Update README and Dockerfile with recomp info (#1105) +4.) Support building tools with MSYS2 (#1112) +5.) Support building tools with clang and macOS (#1106) +6.) Clean tools directory when running distclean target (#1104) +7.) Make build output cleaner (#1095) +8.) Added 2 surface defines to bowser.inc.c (#1111) +9.) fix fake matchings (#1108) +10.) Use statically recompiled IDO instead of qemu-irix (#1099) +11.) Add VERBOSE=1 to Jenkinsfile +12.) updated intro_geo to use layer defines for geo flags (#1090) +13.) Fix F3DZEX (#1097) +14.) layer_transpose should take an s8 (#1093) +15.) Fix tools/ build (#1082) +16.) Relabel and document fish.inc.c (#1077) +17.) Ensure all calls to .py files use $(PYTHON) (#1080) +18.) Name Mario, Peach, and instrument sound files (#1078) +19.) Goddard labeling, part 2 (#1076) +20.) Fix envfx_snow and envfx_bubbles fake matches (#1075) +21.) Use array subscripts instead of pointer math in 2 files (#1074) +22.) refactor Makefile a bit (#1068) +23.) Further improvements on field names (#1059) +24.) Label and document manta_ray.inc.c (#1073) +25.) Fix level_script and behavior fake matches (#1072) +26.) Proper cell defines and more floor lower limit values. (#1065) +27.) Document and re-label some goddard/intro code (#1069) +28.) Match remaining functions (#1070) +29.) match 'spawn_special_objects' (#1071) +30.) Document parts of external.c and format sound defines (#1067) + Refresh 12 1.) Debug box improvements (#1066) diff --git a/Dockerfile b/Dockerfile index b3200018..f36f10e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,20 +5,13 @@ RUN apt-get update && \ binutils-mips-linux-gnu \ bsdmainutils \ build-essential \ - libaudiofile-dev \ - python3 \ - wget - -RUN wget \ - https://github.com/n64decomp/qemu-irix/releases/download/v2.11-deb/qemu-irix-2.11.0-2169-g32ab296eef_amd64.deb \ - -O qemu.deb && \ - echo 8170f37cf03a08cc2d7c1c58f10d650ea0d158f711f6916da9364f6d8c85f741 qemu.deb | sha256sum --check && \ - dpkg -i qemu.deb && \ - rm qemu.deb + libcapstone-dev \ + pkgconf \ + python3 RUN mkdir /sm64 WORKDIR /sm64 ENV PATH="/sm64/tools:${PATH}" -CMD echo 'usage: docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 sm64 make VERSION=${VERSION:-us} -j4\n' \ +CMD echo 'usage: docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 sm64 make VERSION=us -j4\n' \ 'see https://github.com/n64decomp/sm64/blob/master/README.md for advanced usage' diff --git a/Jenkinsfile b/Jenkinsfile index eee93a9f..c31671ca 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,25 +11,31 @@ pipeline { sh 'ln -s "$ROMS_DIR/Super Mario 64 (J) [!].z64" baserom.jp.z64' sh 'ln -s "$ROMS_DIR/Super Mario 64 (U) [!].z64" baserom.us.z64' sh 'ln -s "$ROMS_DIR/Super Mario 64 (E) (M3) [!].z64" baserom.eu.z64' + sh 'ln -s "$ROMS_DIR/Super Mario 64 - Shindou Edition (J) [!].z64" baserom.sh.z64' // verify no assets were committed to repo sh '[ -z "$(find {actors,levels,textures}/ -name \'*.png\')" ]' sh '[ -z "$(find assets/ -name \'*.m64\' -or \'*.bin\')" ]' - sh './extract_assets.py jp us eu' + sh './extract_assets.py jp us eu sh' } } stage('Build U Source') { steps { - sh 'make -j4 VERSION=us' + sh 'make -j4 VERSION=us VERBOSE=1 COLOR=0' + } + } + stage('Build S Source') { + steps { + sh 'make -j4 VERSION=sh VERBOSE=1 COLOR=0' } } stage('Build E Source') { steps { - sh 'make -j4 VERSION=eu' + sh 'make -j4 VERSION=eu VERBOSE=1 COLOR=0' } } stage('Build J Source') { steps { - sh 'make -j4 VERSION=jp' + sh 'make -j4 VERSION=jp VERBOSE=1 COLOR=0' } } stage('Test Enhancements') { @@ -41,7 +47,7 @@ pipeline { git clean -fd . git checkout -- . echo 'y' | tools/apply_patch.sh "$f" - make -j4 VERSION=us COMPARE=0 + make -j4 VERSION=us COMPARE=0 VERBOSE=1 done ''' } diff --git a/Makefile b/Makefile index 319c5c21..f89e6909 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,31 @@ - # Makefile to rebuild SM64 split image -### Default target ### +include util.mk +# Dynos +include dynos.mk + +# Default target default: all -### Build Options ### +# Preprocessor definitions +DEFINES := -# These options can either be changed by modifying the makefile, or -# by building with 'make SETTING=value'. 'make clean' may be required. +#==============================================================================# +# Build Options # +#==============================================================================# + +# These options can either be set by building with 'make SETTING=value'. +# 'make clean' may be required first. # Build debug version DEBUG ?= 0 -# Version of the game to build -VERSION ?= us -# Graphics microcode used -GRUCODE ?= f3dex2e -# If COMPARE is 1, check the output sha1sum when building 'all' -COMPARE ?= 1 -# If NON_MATCHING is 1, define the NON_MATCHING and AVOID_UB macros when building (recommended) -NON_MATCHING ?= 1 + +# Enable development/testing flags +DEVELOPMENT ?= 0 + +# Build for the N64 (turn this off for ports) +TARGET_N64 = 0 # Build and optimize for Raspberry Pi(s) TARGET_RPI ?= 0 @@ -54,8 +60,6 @@ DISCORDRPC ?= 0 DISCORD_SDK ?= 1 # Enable docker build workarounds DOCKERBUILD ?= 0 -# Enable development/testing flags -DEVELOPMENT ?= 0 # Various workarounds for weird toolchains @@ -85,17 +89,17 @@ WINDOWS_BUILD ?= 0 WINDOWS_AUTO_BUILDER ?= 0 -################### coop-compiler settings ################### - -PYTHON := python3 -TOOLS_DIR := tools +# COMPILER - selects the C compiler to use +# gcc - uses the GNU C Compiler +COMPILER = gcc +$(eval $(call validate-option,COMPILER,ido gcc)) ifeq ($(WINDOWS_AUTO_BUILDER),1) export SHELL=sh.exe - EXTRA_INCLUDES := -I ../include/1 -I ../include/2 -I ../include/3 -I ../include/4 + EXTRA_INCLUDES := ../include/1 ../include/2 ../include/3 ../include/4 EXTRA_CFLAGS := -Wno-expansion-to-defined - EXTRA_CPP_INCLUDES := -I ../include/cpp + EXTRA_CPP_INCLUDES := ../include/cpp EXTRA_CPP_FLAGS := -Wno-class-conversion -Wno-packed-not-aligned else EXTRA_INCLUDES ?= @@ -105,14 +109,6 @@ else EXTRA_CPP_FLAGS ?= endif -EXTRACT_ASSETS := $(PYTHON) ./extract_assets.py -OUTPUT_LEVEL_HEADERS := $(PYTHON) $(TOOLS_DIR)/output_level_headers.py -ZEROTERM := $(PYTHON) $(TOOLS_DIR)/zeroterm.py -MKZIP := $(PYTHON) $(TOOLS_DIR)/mkzip.py -ASSEMBLE_SOUND := $(PYTHON) $(TOOLS_DIR)/assemble_sound.py -MARIO_ANIMS_CONVERTER := $(PYTHON) $(TOOLS_DIR)/mario_anims_converter.py -DEMO_DATA_CONVERTER := $(PYTHON) $(TOOLS_DIR)/demo_data_converter.py - # Attempt to detect OS ifeq ($(OS),Windows_NT) @@ -164,99 +160,124 @@ ifeq ($(WINDOWS_BUILD), 1) endif endif -# Release (version) flag defs -ifeq ($(VERSION),jp) - //VERSION_DEF := VERSION_JP - $(error JP ROM is incompatible with sm64ex-coop at this time) -else -ifeq ($(VERSION),us) - VERSION_DEF := VERSION_US -else -ifeq ($(VERSION),eu) - //VERSION_DEF := VERSION_EU - $(error EU ROM is incompatible with sm64ex-coop at this time) -else -ifeq ($(VERSION),sh) - //$(warning Building SH is experimental and is prone to breaking. Try at your own risk.) - //VERSION_DEF := VERSION_SH -# TODO: GET RID OF THIS!!! We should mandate assets for Shindou like EU but we dont have the addresses extracted yet so we'll just pretend you have everything extracted for now. - //NOEXTRACT := 1 - $(error Shindou ROM is incompatible with sm64ex-coop at this time) -else - $(error unknown version "$(VERSION)") -endif +# VERSION - selects the version of the game to build +# jp - builds the 1996 Japanese version +# us - builds the 1996 North American version +# eu - builds the 1997 PAL version +# sh - builds the 1997 Japanese Shindou version, with rumble pak support +VERSION ?= us +$(eval $(call validate-option,VERSION,jp us eu sh)) + +# Graphics microcode used +GRUCODE ?= f3dex2e + +ifeq ($(VERSION),jp) + DEFINES += VERSION_JP=1 + OPT_FLAGS := -g + #GRUCODE ?= f3d_old + VERSION_JP_US ?= true +else ifeq ($(VERSION),us) + DEFINES += VERSION_US=1 + OPT_FLAGS := -g + #GRUCODE ?= f3d_old + VERSION_JP_US ?= true +else ifeq ($(VERSION),eu) + DEFINES += VERSION_EU=1 + OPT_FLAGS := -O2 + #GRUCODE ?= f3d_new + VERSION_JP_US ?= false +else ifeq ($(VERSION),sh) + DEFINES += VERSION_SH=1 + OPT_FLAGS := -O2 + #GRUCODE ?= f3d_new + VERSION_JP_US ?= false endif + +ifeq ($(TARGET_WEB),1) + OPT_FLAGS := -O2 -g4 --source-map-base http://localhost:8080/ endif + +ifeq ($(TARGET_RPI),1) + machine = $(shell sh -c 'uname -m 2>/dev/null || echo unknown') + + # Raspberry Pi B+, Zero, etc + ifneq (,$(findstring armv6l,$(machine))) + OPT_FLAGS := -march=armv6zk+fp -mfpu=vfp -Ofast + endif + + # Raspberry Pi 2 and 3 in ARM 32bit mode + ifneq (,$(findstring armv7l,$(machine))) + model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown') + ifneq (,$(findstring 3,$(model))) + OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -O3 + else + OPT_FLAGS := -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -O3 + endif + endif + + # RPi3 or RPi4, in ARM64 (aarch64) mode. NEEDS TESTING 32BIT. + # DO NOT pass -mfpu stuff here, thats for 32bit ARM only and will fail for 64bit ARM. + ifneq (,$(findstring aarch64,$(machine))) + model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown') + ifneq (,$(findstring 3,$(model))) + OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -O3 + else ifneq (,$(findstring 4,$(model))) + OPT_FLAGS := -march=armv8-a+crc+simd -mtune=cortex-a72 -O3 + endif + endif endif +# Set BITS (32/64) to compile for +OPT_FLAGS += $(BITS) + TARGET := sm64.$(VERSION) -VERSION_CFLAGS := -D$(VERSION_DEF) -D_LANGUAGE_C -VERSION_ASFLAGS := --defsym $(VERSION_DEF)=1 # Stuff for showing the git hash in the intro on nightly builds # From https://stackoverflow.com/questions/44038428/include-git-commit-hash-and-or-branch-name-in-c-c-source #ifeq ($(shell git rev-parse --abbrev-ref HEAD),nightly) - GIT_HASH=`git rev-parse --short HEAD` - COMPILE_TIME=`date -u +'%Y-%m-%d %H:%M:%S UTC'` - VERSION_CFLAGS += -DNIGHTLY -DGIT_HASH="\"$(GIT_HASH)\"" -DCOMPILE_TIME="\"$(COMPILE_TIME)\"" +# GIT_HASH=`git rev-parse --short HEAD` +# COMPILE_TIME=`date -u +'%Y-%m-%d %H:%M:%S UTC'` +# DEFINES += -DNIGHTLY -DGIT_HASH="\"$(GIT_HASH)\"" -DCOMPILE_TIME="\"$(COMPILE_TIME)\"" #endif -# Microcode -ifeq ($(GRUCODE),f3dex) # Fast3DEX - GRUCODE_DEF := F3DEX_GBI - GRUCODE_ASFLAGS := --defsym F3DEX_GBI_SHARED=1 - TARGET := $(TARGET).f3dex - COMPARE := 0 -else -ifeq ($(GRUCODE),f3dex2) # Fast3DEX2 - GRUCODE_DEF := F3DEX_GBI_2 - GRUCODE_ASFLAGS := --defsym F3DEX_GBI_SHARED=1 - TARGET := $(TARGET).f3dex2 - COMPARE := 0 -else -ifeq ($(GRUCODE),f3dex2e) # Fast3DEX2 Extended (PC default) - GRUCODE_DEF := F3DEX_GBI_2E - TARGET := $(TARGET).f3dex2e - COMPARE := 0 -else -ifeq ($(GRUCODE),f3d_new) # Fast3D 2.0H (Shindou) - GRUCODE_DEF := F3D_NEW - TARGET := $(TARGET).f3d_new - COMPARE := 0 -else -ifeq ($(GRUCODE),f3dzex) # Fast3DZEX (2.0J / Animal Forest - Dōbutsu no Mori) +# GRUCODE - selects which RSP microcode to use. +# f3d_old - default for JP and US versions +# f3d_new - default for EU and Shindou versions +# f3dex - +# f3dex2 - +# f3dex2e - +# f3dzex - newer, experimental microcode used in Animal Crossing +$(eval $(call validate-option,GRUCODE,f3d_old f3dex f3dex2 f3dex2e f3d_new f3dzex)) + +ifeq ($(GRUCODE),f3d_old) + DEFINES += F3D_OLD=1 +else ifeq ($(GRUCODE),f3d_new) # Fast3D 2.0H + DEFINES += F3D_NEW=1 +else ifeq ($(GRUCODE),f3dex) # Fast3DEX + DEFINES += F3DEX_GBI=1 F3DEX_GBI_SHARED=1 +else ifeq ($(GRUCODE), f3dex2) # Fast3DEX2 + DEFINES += F3DEX_GBI_2=1 F3DEX_GBI_SHARED=1 +else ifeq ($(GRUCODE), f3dex2e) # Fast3DEX2 Extended (PC default) + DEFINES += F3DEX_GBI_2E=1 F3DEX_GBI_SHARED=1 +else ifeq ($(GRUCODE),f3dzex) # Fast3DZEX (2.0J / Animal Forest - Dōbutsu no Mori) $(warning Fast3DZEX is experimental. Try at your own risk.) - GRUCODE_DEF := F3DEX_GBI_2 - GRUCODE_ASFLAGS := --defsym F3DEX_GBI_SHARED=1 - TARGET := $(TARGET).f3dzex - COMPARE := 0 -endif -endif -endif -endif + DEFINES += F3DZEX_GBI_2=1 F3DEX_GBI_2=1 F3DEX_GBI_SHARED=1 endif -GRUCODE_CFLAGS := -D$(GRUCODE_DEF) -GRUCODE_ASFLAGS := $(GRUCODE_ASFLAGS) --defsym $(GRUCODE_DEF)=1 - -# Default build is for PC now -VERSION_CFLAGS := $(VERSION_CFLAGS) -DNON_MATCHING -DAVOID_UB +# Check for certain target types. ifeq ($(TARGET_RPI),1) # Define RPi to change SDL2 title & GLES2 hints - VERSION_CFLAGS += -DUSE_GLES + DEFINES += -DUSE_GLES endif ifeq ($(OSX_BUILD),1) # Modify GFX & SDL2 for OSX GL - VERSION_CFLAGS += -DOSX_BUILD + DEFINES += -DOSX_BUILD endif -VERSION_ASFLAGS := --defsym AVOID_UB=1 -COMPARE := 0 - ifeq ($(TARGET_WEB),1) - VERSION_CFLAGS := $(VERSION_CFLAGS) -DTARGET_WEB -DUSE_GLES + DEFINES := $(DEFINES) -DTARGET_WEB -DUSE_GLES endif # Check backends @@ -286,24 +307,102 @@ else endif endif -################### Universal Dependencies ################### + +# NON_MATCHING - whether to build a matching, identical copy of the ROM +# 1 - enable some alternate, more portable code that does not produce a matching ROM +# 0 - build a matching ROM +NON_MATCHING ?= 0 +$(eval $(call validate-option,NON_MATCHING,0 1)) + +ifeq ($(TARGET_N64),0) + NON_MATCHING := 1 +endif + +ifeq ($(NON_MATCHING),1) + DEFINES += NON_MATCHING=1 AVOID_UB=1 + COMPARE := 0 +endif + + +# COMPARE - whether to verify the SHA-1 hash of the ROM after building +# 1 - verifies the SHA-1 hash of the selected version of the game +# 0 - does not verify the hash +COMPARE ?= 1 +$(eval $(call validate-option,COMPARE,0 1)) + +TARGET_STRING := sm64.$(VERSION).$(GRUCODE) +# If non-default settings were chosen, disable COMPARE +ifeq ($(filter $(TARGET_STRING), sm64.jp.f3d_old sm64.us.f3d_old sm64.eu.f3d_new sm64.sh.f3d_new),) + COMPARE := 0 +endif + +# Whether to hide commands or not +VERBOSE ?= 0 +ifeq ($(VERBOSE),0) + V := @ +endif + +# Whether to colorize build messages +COLOR ?= 1 + +# display selected options unless 'make clean' or 'make distclean' is run +ifeq ($(filter clean distclean,$(MAKECMDGOALS)),) + $(info ==== Build Options ====) + $(info Version: $(VERSION)) + $(info Microcode: $(GRUCODE)) + $(info Target: $(TARGET)) + ifeq ($(COMPARE),1) + $(info Compare ROM: yes) + else + $(info Compare ROM: no) + endif + ifeq ($(NON_MATCHING),1) + $(info Build Matching: no) + else + $(info Build Matching: yes) + endif + $(info =======================) +endif + + +#==============================================================================# +# Universal Dependencies # +#==============================================================================# + +TOOLS_DIR := tools # (This is a bit hacky, but a lot of rules implicitly depend # on tools and assets, and we use directory globs further down # in the makefile that we want should cover assets.) -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),distclean) +PYTHON := python3 -# Make sure assets exist -NOEXTRACT ?= 0 -ifeq ($(NOEXTRACT),0) - DUMMY != $(EXTRACT_ASSETS) $(VERSION) >&2 || echo FAIL - ifeq ($(DUMMY),FAIL) - $(error Failed to extract assets) +ifeq ($(filter clean distclean print-%,$(MAKECMDGOALS)),) + + # Make sure assets exist + NOEXTRACT ?= 0 + ifeq ($(NOEXTRACT),0) + DUMMY != $(PYTHON) extract_assets.py $(VERSION) >&2 || echo FAIL + ifeq ($(DUMMY),FAIL) + $(error Failed to extract assets) + endif endif + + # Make tools if out of date + $(info Building tools...) + #DUMMY != $(MAKE) -s -C $(TOOLS_DIR) $(if $(filter-out ido0,$(COMPILER)$(USE_QEMU_IRIX)),all-except-recomp,) >&2 || echo FAIL + DUMMY != $(MAKE) -C $(TOOLS_DIR) >&2 || echo FAIL + ifeq ($(DUMMY),FAIL) + $(error Failed to build tools) + endif + $(info Building Game...) + endif +#==============================================================================# +# Extra Source Files # +#==============================================================================# + # Luigi and wario sounds don't work on 32-bit right now # And the audio code is so terrible I don't care enough to figure it out at the moment ifeq ($(TARGET_BITS), 32) @@ -314,68 +413,57 @@ ifeq ($(TARGET_BITS), 32) endif # Copy missing luigi sounds from mario sound banks -$(shell mkdir -p sound/samples/sfx_custom_luigi sound/samples/sfx_custom_luigi_peach ) -$(shell cp -n sound/samples/sfx_mario/*.aiff sound/samples/sfx_custom_luigi/ ) -$(shell cp -n sound/samples/sfx_mario_peach/*.aiff sound/samples/sfx_custom_luigi_peach/ ) +#$(shell mkdir -p sound/samples/sfx_custom_luigi sound/samples/sfx_custom_luigi_peach ) +#$(shell cp -n sound/samples/sfx_mario/*.aiff sound/samples/sfx_custom_luigi/ ) +#$(shell cp -n sound/samples/sfx_mario_peach/*.aiff sound/samples/sfx_custom_luigi_peach/ ) # Copy missing wario sounds from mario sound banks -$(shell mkdir -p sound/samples/sfx_custom_wario sound/samples/sfx_custom_wario_peach ) -$(shell cp -n sound/samples/sfx_mario/*.aiff sound/samples/sfx_custom_wario/ ) -$(shell cp -n sound/samples/sfx_mario_peach/*.aiff sound/samples/sfx_custom_wario_peach/ ) +#$(shell mkdir -p sound/samples/sfx_custom_wario sound/samples/sfx_custom_wario_peach ) +#$(shell cp -n sound/samples/sfx_mario/*.aiff sound/samples/sfx_custom_wario/ ) +#$(shell cp -n sound/samples/sfx_mario_peach/*.aiff sound/samples/sfx_custom_wario_peach/ ) -# Make tools if out of date -ifneq ($(WINDOWS_AUTO_BUILDER),1) - DUMMY != make -C tools >&2 || echo FAIL - ifeq ($(DUMMY),FAIL) - $(error Failed to build tools) - endif -endif -endif -endif +#==============================================================================# +# Target Executable and Sources # +#==============================================================================# -################ Target Executable and Sources ############### - -# BUILD_DIR is location where all build artifacts are placed BUILD_DIR_BASE := build - +# BUILD_DIR is the location where all build artifacts are placed ifeq ($(TARGET_WEB),1) BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_web else BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_pc endif -LIBULTRA := $(BUILD_DIR)/libultra.a - ifeq ($(TARGET_WEB),1) -EXE := $(BUILD_DIR)/$(TARGET).html - else + EXE := $(BUILD_DIR)/$(TARGET_STRING).html +else ifeq ($(WINDOWS_BUILD),1) - EXE := $(BUILD_DIR)/$(TARGET).exe - - else # Linux builds/binary namer + EXE := $(BUILD_DIR)/$(TARGET_STRING).exe + else # Linux builds/binary namer ifeq ($(TARGET_RPI),1) - EXE := $(BUILD_DIR)/$(TARGET).arm + EXE := $(BUILD_DIR)/$(TARGET_STRING).arm else - EXE := $(BUILD_DIR)/$(TARGET) + EXE := $(BUILD_DIR)/$(TARGET_STRING) endif endif endif -ELF := $(BUILD_DIR)/$(TARGET).elf -LD_SCRIPT := sm64.ld -MIO0_DIR := $(BUILD_DIR)/bin -SOUND_BIN_DIR := $(BUILD_DIR)/sound -TEXTURE_DIR := textures -ACTOR_DIR := actors -LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h))) +ELF := $(BUILD_DIR)/$(TARGET).elf +LIBULTRA := $(BUILD_DIR)/libultra.a +LD_SCRIPT := sm64.ld +MIO0_DIR := $(BUILD_DIR)/bin +SOUND_BIN_DIR := $(BUILD_DIR)/sound +TEXTURE_DIR := textures +ACTOR_DIR := actors +LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h))) # Directories containing source files +SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets asm lib sound +BIN_DIRS := bin bin/$(VERSION) -# Hi, I'm a PC -SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets src/pc src/pc/gfx src/pc/audio src/pc/controller src/pc/fs src/pc/fs/packtypes -SRC_DIRS += src/pc/network src/pc/network/packets src/pc/network/socket src/pc/utils src/pc/djui src/pc/lua src/pc/lua/utils -ASM_DIRS := +# PC files +SRC_DIRS += src/pc src/pc/gfx src/pc/audio src/pc/controller src/pc/fs src/pc/fs/packtypes src/pc/network src/pc/network/packets src/pc/network/socket src/pc/utils src/pc/djui src/pc/lua src/pc/lua/utils #ifeq ($(DISCORDRPC),1) # SRC_DIRS += src/pc/discord @@ -385,117 +473,63 @@ ifeq ($(DISCORD_SDK),1) SRC_DIRS += src/pc/network/discord endif -BIN_DIRS := bin bin/$(VERSION) - -ULTRA_SRC_DIRS := lib/src lib/src/math -ULTRA_ASM_DIRS := lib/asm lib/data +ULTRA_SRC_DIRS := lib/src lib/src/math lib/asm lib/data ULTRA_BIN_DIRS := lib/bin GODDARD_SRC_DIRS := src/goddard src/goddard/dynlists -MIPSISET := -mips2 -MIPSBIT := -32 - -ifeq ($(DEBUG),1) - OPT_FLAGS := -g -else - # can't use O2 right now, coop-compiler produces strange graphical errors - # likely due to undefined behavior somewhere - #OPT_FLAGS := -O2 - OPT_FLAGS := -O1 -endif - -# Set BITS (32/64) to compile for -OPT_FLAGS += $(BITS) - -ifeq ($(TARGET_WEB),1) - OPT_FLAGS := -O2 -g4 --source-map-base http://localhost:8080/ -endif - -ifeq ($(TARGET_RPI),1) - machine = $(shell sh -c 'uname -m 2>/dev/null || echo unknown') -# Raspberry Pi B+, Zero, etc - ifneq (,$(findstring armv6l,$(machine))) - OPT_FLAGS := -march=armv6zk+fp -mfpu=vfp -Ofast - endif - -# Raspberry Pi 2 and 3 in ARM 32bit mode - ifneq (,$(findstring armv7l,$(machine))) - model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown') - - ifneq (,$(findstring 3,$(model))) - OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -O3 - else - OPT_FLAGS := -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -O3 - endif - endif - -# RPi3 or RPi4, in ARM64 (aarch64) mode. NEEDS TESTING 32BIT. -# DO NOT pass -mfpu stuff here, thats for 32bit ARM only and will fail for 64bit ARM. - ifneq (,$(findstring aarch64,$(machine))) - model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown') - ifneq (,$(findstring 3,$(model))) - OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -O3 - else ifneq (,$(findstring 4,$(model))) - OPT_FLAGS := -march=armv8-a+crc+simd -mtune=cortex-a72 -O3 - endif - - endif -endif - # File dependencies and variables for specific files include Makefile.split # Source code files -LEVEL_C_FILES := $(wildcard levels/*/leveldata.c) $(wildcard levels/*/script.c) $(wildcard levels/*/geo.c) -C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) $(LEVEL_C_FILES) -CXX_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp)) -S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s)) -GODDARD_C_FILES := $(foreach dir,$(GODDARD_SRC_DIRS),$(wildcard $(dir)/*.c)) +LEVEL_C_FILES := $(wildcard levels/*/leveldata.c) $(wildcard levels/*/script.c) $(wildcard levels/*/geo.c) +C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) $(LEVEL_C_FILES) +CPP_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.cpp)) +S_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.s)) +ULTRA_C_FILES := $(foreach dir,$(ULTRA_SRC_DIRS),$(wildcard $(dir)/*.c)) +GODDARD_C_FILES := $(foreach dir,$(GODDARD_SRC_DIRS),$(wildcard $(dir)/*.c)) +ULTRA_S_FILES := $(foreach dir,$(ULTRA_SRC_DIRS),$(wildcard $(dir)/*.s)) +GENERATED_C_FILES := $(BUILD_DIR)/assets/mario_anim_data.c $(BUILD_DIR)/assets/demo_data.c -GENERATED_C_FILES := $(BUILD_DIR)/assets/mario_anim_data.c $(BUILD_DIR)/assets/demo_data.c \ - $(addprefix $(BUILD_DIR)/bin/,$(addsuffix _skybox.c,$(notdir $(basename $(wildcard textures/skyboxes/*.png))))) - -ULTRA_C_FILES := \ - alBnkfNew.c \ - guLookAtRef.c \ - guMtxF2L.c \ - guNormalize.c \ - guOrthoF.c \ - guPerspectiveF.c \ - guRotateF.c \ - guScaleF.c \ - guTranslateF.c \ - ldiv.c - -C_FILES := $(filter-out src/game/main.c,$(C_FILES)) -ULTRA_C_FILES := $(addprefix lib/src/,$(ULTRA_C_FILES)) - -# "If we're not N64, use the above" - -ifeq ($(VERSION),sh) -SOUND_BANK_FILES := $(wildcard sound/sound_banks/*.json) -SOUND_SEQUENCE_FILES := $(wildcard sound/sequences/jp/*.m64) \ - $(wildcard sound/sequences/*.m64) \ - $(foreach file,$(wildcard sound/sequences/jp/*.s),$(BUILD_DIR)/$(file:.s=.m64)) \ - $(foreach file,$(wildcard sound/sequences/*.s),$(BUILD_DIR)/$(file:.s=.m64)) -else -SOUND_BANK_FILES := $(wildcard sound/sound_banks/*.json) -SOUND_SEQUENCE_FILES := $(wildcard sound/sequences/$(VERSION)/*.m64) \ - $(wildcard sound/sequences/*.m64) \ - $(foreach file,$(wildcard sound/sequences/$(VERSION)/*.s),$(BUILD_DIR)/$(file:.s=.m64)) \ - $(foreach file,$(wildcard sound/sequences/*.s),$(BUILD_DIR)/$(file:.s=.m64)) +ifeq ($(TARGET_N64),0) + GENERATED_C_FILES += $(addprefix $(BUILD_DIR)/bin/,$(addsuffix _skybox.c,$(notdir $(basename $(wildcard textures/skyboxes/*.png))))) endif -SOUND_SAMPLE_DIRS := $(wildcard sound/samples/*) -SOUND_SAMPLE_AIFFS := $(foreach dir,$(SOUND_SAMPLE_DIRS),$(wildcard $(dir)/*.aiff)) +# "If we're N64, use the above" +ifeq ($(TARGET_N64),0) + ULTRA_C_FILES := \ + alBnkfNew.c \ + guLookAtRef.c \ + guMtxF2L.c \ + guNormalize.c \ + guOrthoF.c \ + guPerspectiveF.c \ + guRotateF.c \ + guScaleF.c \ + guTranslateF.c \ + ldiv.c + + C_FILES := $(filter-out src/game/main.c,$(C_FILES)) + ULTRA_C_FILES := $(addprefix lib/src/,$(ULTRA_C_FILES)) +endif + +# Sound files +SOUND_BANK_FILES := $(wildcard sound/sound_banks/*.json) +SOUND_SAMPLE_DIRS := $(wildcard sound/samples/*) +SOUND_SAMPLE_AIFFS := $(foreach dir,$(SOUND_SAMPLE_DIRS),$(wildcard $(dir)/*.aiff)) SOUND_SAMPLE_TABLES := $(foreach file,$(SOUND_SAMPLE_AIFFS),$(BUILD_DIR)/$(file:.aiff=.table)) -SOUND_SAMPLE_AIFCS := $(foreach file,$(SOUND_SAMPLE_AIFFS),$(BUILD_DIR)/$(file:.aiff=.aifc)) -SOUND_OBJ_FILES := $(SOUND_BIN_DIR)/sound_data.o +SOUND_SAMPLE_AIFCS := $(foreach file,$(SOUND_SAMPLE_AIFFS),$(BUILD_DIR)/$(file:.aiff=.aifc)) +SOUND_SEQUENCE_DIRS := sound/sequences sound/sequences/$(VERSION) +# all .m64 files in SOUND_SEQUENCE_DIRS, plus all .m64 files that are generated from .s files in SOUND_SEQUENCE_DIRS +SOUND_SEQUENCE_FILES := \ + $(foreach dir,$(SOUND_SEQUENCE_DIRS),\ + $(wildcard $(dir)/*.m64) \ + $(foreach file,$(wildcard $(dir)/*.s),$(BUILD_DIR)/$(file:.s=.m64)) \ + ) # Object files O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \ - $(foreach file,$(CXX_FILES),$(BUILD_DIR)/$(file:.cpp=.o)) \ + $(foreach file,$(CPP_FILES),$(BUILD_DIR)/$(file:.cpp=.o)) \ $(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o)) \ $(foreach file,$(GENERATED_C_FILES),$(file:.c=.o)) @@ -543,30 +577,76 @@ DEP_FILES := $(O_FILES:.o=.d) $(ULTRA_O_FILES:.o=.d) $(GODDARD_O_FILES:.o=.d) $( # Segment elf files SEG_FILES := $(SEGMENT_ELF_FILES) $(ACTOR_ELF_FILES) $(LEVEL_ELF_FILES) -# Dynos -include dynos.mk - -##################### Compiler Options ####################### -INCLUDE_CFLAGS := -I include -I $(BUILD_DIR) -I $(BUILD_DIR)/include -I src -I . $(EXTRA_INCLUDES) -ENDIAN_BITWIDTH := $(BUILD_DIR)/endian-and-bitwidth - -# coop-specific includes -INCLUDE_CFLAGS += -I lib/lua/include - -# Huge deleted N64 section was here - -AS := $(CROSS)as - -ifeq ($(OSX_BUILD),1) -AS := i686-w64-mingw32-as +# Files with GLOBAL_ASM blocks +ifeq ($(NON_MATCHING),0) + ifeq ($(VERSION),sh) + GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/**/*.c) $(wildcard lib/src/*.c) + else + GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/**/*.c) + endif +GLOBAL_ASM_O_FILES = $(foreach file,$(GLOBAL_ASM_C_FILES),$(BUILD_DIR)/$(file:.c=.o)) +GLOBAL_ASM_DEP = $(BUILD_DIR)/src/audio/non_matching_dep endif -ifneq ($(TARGET_WEB),1) # As in, not-web PC port - CC ?= $(CROSS)gcc - CXX ?= $(CROSS)g++ + +#==============================================================================# +# Compiler Options # +#==============================================================================# + +AS := $(CROSS)as + +ifeq ($(OSX_BUILD),1) + AS := i686-w64-mingw32-as +endif + +ifeq ($(COMPILER),gcc) + CC := $(CROSS)gcc + CXX := $(CROSS)g++ +else ifeq ($(TARGET_WEB),1) # As in, web PC port + CC := emcc + CXX := emcc else - CC := emcc - CXX := emcc + ifeq ($(USE_QEMU_IRIX),1) + IRIX_ROOT := $(TOOLS_DIR)/ido5.3_compiler + CC := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc + ACPP := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/acpp + COPT := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/copt + else + IDO_ROOT := $(TOOLS_DIR)/ido5.3_recomp + CC := $(IDO_ROOT)/cc + ACPP := $(IDO_ROOT)/acpp + COPT := $(IDO_ROOT)/copt + endif +endif + +ifeq ($(WINDOWS_BUILD),1) # fixes compilation in MXE on Linux and WSL + CPP := cpp -P + OBJCOPY := objcopy + OBJDUMP := $(CROSS)objdump +else ifeq ($(OSX_BUILD),1) + CPP := cpp-9 -P + OBJDUMP := i686-w64-mingw32-objdump + OBJCOPY := i686-w64-mingw32-objcopy +else ifeq ($(TARGET_N64),0) # Linux & other builds + CPP := $(CROSS)cpp -P + OBJCOPY := $(CROSS)objcopy + OBJDUMP := $(CROSS)objdump +else + # Prefer gcc's cpp if installed on the system + ifneq (,$(call find-command,cpp-10)) + CPP := cpp-10 + else + CPP := cpp + endif + OBJDUMP := $(CROSS)objdump + OBJCOPY := $(CROSS)objcopy +endif + +# thank you apple very cool +ifeq ($(HOST_OS),Darwin) + CP := gcp +else + CP := cp endif #ifeq ($(DISCORDRPC),1) @@ -580,26 +660,30 @@ else ifeq ($(WINDOWS_BUILD),1) else LD := $(CXX) endif +else + LD := $(CROSS)ld endif -ifeq ($(WINDOWS_BUILD),1) # fixes compilation in MXE on Linux and WSL - CPP := cpp -P - OBJCOPY := objcopy - OBJDUMP := $(CROSS)objdump -else ifeq ($(OSX_BUILD),1) - CPP := cpp-9 -P - OBJDUMP := i686-w64-mingw32-objdump - OBJCOPY := i686-w64-mingw32-objcopy -else # Linux & other builds - CPP := $(CROSS)cpp -P - OBJCOPY := $(CROSS)objcopy - OBJDUMP := $(CROSS)objdump +AR := $(CROSS)ar + +ifeq ($(TARGET_N64),1) + TARGET_CFLAGS := -nostdinc -DTARGET_N64 -D_LANGUAGE_C + CC_CFLAGS := -fno-builtin +else + TARGET_CFLAGS := -D_LANGUAGE_C endif +INCLUDE_DIRS := include $(BUILD_DIR) $(BUILD_DIR)/include src . +ifeq ($(TARGET_N64),1) + INCLUDE_DIRS += include/libc +else + INCLUDE_DIRS += sound lib/lua/include $(EXTRA_INCLUDES) +endif + +# Connfigure backend flags + SDLCONFIG := $(CROSS)sdl2-config -# configure backend flags - BACKEND_CFLAGS := -DRAPI_$(RENDER_API)=1 -DWAPI_$(WINDOW_API)=1 -DAAPI_$(AUDIO_API)=1 # can have multiple controller APIs BACKEND_CFLAGS += $(foreach capi,$(CONTROLLER_API),-DCAPI_$(capi)=1) @@ -630,7 +714,7 @@ else ifeq ($(findstring SDL,$(WINDOW_API)),SDL) EXTRA_CPP_FLAGS += -stdlib=libc++ -std=c++0x else BACKEND_LDFLAGS += -lGL - endif + endif endif ifneq (,$(findstring SDL2,$(AUDIO_API)$(WINDOW_API)$(CONTROLLER_API))) @@ -646,7 +730,7 @@ ifeq ($(SDL1_USED)$(SDL2_USED),11) endif # SDL can be used by different systems, so we consolidate all of that shit into this - + ifeq ($(SDL2_USED),1) SDLCONFIG := $(CROSS)sdl2-config BACKEND_CFLAGS += -DHAVE_SDL2=1 @@ -663,6 +747,7 @@ ifneq ($(SDL1_USED)$(SDL2_USED),00) else BACKEND_CFLAGS += `$(SDLCONFIG) --cflags` endif + ifeq ($(WINDOWS_BUILD),1) BACKEND_LDFLAGS += `$(SDLCONFIG) --static-libs` -lsetupapi -luser32 -limm32 -lole32 -loleaut32 -lshell32 -lwinmm -lversion else @@ -670,135 +755,58 @@ ifneq ($(SDL1_USED)$(SDL2_USED),00) endif endif +C_DEFINES := $(foreach d,$(DEFINES),-D$(d)) +DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES) + +# Check code syntax with host compiler +CC_CHECK := $(CC) + ifeq ($(WINDOWS_BUILD),1) - CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(BACKEND_CFLAGS) $(INCLUDE_CFLAGS) -Wall -Wextra $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -DWINSOCK - CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(BACKEND_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv -DWINSOCK + CC_CHECK_CFLAGS := -fsyntax-only -fsigned-char $(BACKEND_CFLAGS) $(DEF_INC_CFLAGS) -Wall -Wextra $(TARGET_CFLAGS) -DWINSOCK + CFLAGS := $(OPT_FLAGS) $(DEF_INC_CFLAGS) $(BACKEND_CFLAGS) $(TARGET_CFLAGS) -fno-strict-aliasing -fwrapv -DWINSOCK ifeq ($(TARGET_BITS), 32) BACKEND_LDFLAGS += -ldbghelp endif else ifeq ($(TARGET_WEB),1) - CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(BACKEND_CFLAGS) $(INCLUDE_CFLAGS) -Wall -Wextra $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -s USE_SDL=2 - CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(BACKEND_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv -s USE_SDL=2 + CC_CHECK_CFLAGS := -fsyntax-only -fsigned-char $(BACKEND_CFLAGS) $(DEF_INC_CFLAGS) -Wall -Wextra -Wno-format-security $(TARGET_CFLAGS) -s USE_SDL=2 + CFLAGS := $(OPT_FLAGS) $(DEF_INC_CFLAGS) $(BACKEND_CFLAGS) $(TARGET_CFLAGS) -fno-strict-aliasing -fwrapv -s USE_SDL=2 +else ifeq ($(TARGET_N64),0) # Linux / Other builds below + CC_CHECK_CFLAGS := -fsyntax-only -fsigned-char $(BACKEND_CFLAGS) $(DEF_INC_CFLAGS) -Wall -Wextra $(TARGET_CFLAGS) + CFLAGS := $(OPT_FLAGS) $(DEF_INC_CFLAGS) $(BACKEND_CFLAGS) $(TARGET_CFLAGS) -fno-strict-aliasing -fwrapv +else # C compiler options for N64 + CC_CHECK_CFLAGS := -fsyntax-only -fsigned-char $(CC_CFLAGS) $(TARGET_CFLAGS) -std=gnu90 -Wall -Wextra -Wno-main -DNON_MATCHING -DAVOID_UB $(DEF_INC_CFLAGS) + CFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS) + ifeq ($(COMPILER),gcc) + CFLAGS += -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra + else + CFLAGS += -non_shared -Wab,-r4300_mul -Xcpluscomm -Xfullwarn -signed -32 + endif +endif -# Linux / Other builds below +ifeq ($(TARGET_N64),1) + ASFLAGS := -march=vr4300 -mabi=32 $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(foreach d,$(DEFINES),--defsym $(d)) + RSPASMFLAGS := $(foreach d,$(DEFINES),-definelabel $(subst =, ,$(d))) else - CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(BACKEND_CFLAGS) $(INCLUDE_CFLAGS) -Wall -Wextra $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) - CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) $(BACKEND_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -fno-strict-aliasing -fwrapv - + ASFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(foreach d,$(DEFINES),--defsym $(d)) + RSPASMFLAGS := endif -# Identify that this is a coop build so that one patch can be applied to EX -# and/or COOP. They can choose to ifdef entity synchronization out. -CC_CHECK += -DCOOP -CFLAGS += -DCOOP +# C preprocessor flags +CPPFLAGS := -P -Wno-trigraphs $(DEF_INC_CFLAGS) -# Enforce -Werror in strict mode -ifeq ($(STRICT),1) - CC_CHECK += -Werror - CFLAGS += -Werror +ifeq ($(TARGET_N64),1) + ifeq ($(shell getconf LONG_BIT), 32) + # Work around memory allocation bug in QEMU + export QEMU_GUEST_BASE := 1 + else + # Ensure that gcc treats the code as 32-bit + CC_CHECK_CFLAGS += -m32 + endif endif -# Check for debug option -ifeq ($(DEBUG),1) - CC_CHECK += -DDEBUG - CFLAGS += -DDEBUG -endif - -# Check for enhancement options - -# Check for immediate load option -ifeq ($(IMMEDIATELOAD),1) - CC_CHECK += -DIMMEDIATELOAD - CFLAGS += -DIMMEDIATELOAD -endif - -# Check for docker build workaround option -ifeq ($(DOCKERBUILD),1) - CC_CHECK += -DDOCKERBUILD - CFLAGS += -DDOCKERBUILD -endif - -# Check for Puppycam option -ifeq ($(BETTERCAMERA),1) - CC_CHECK += -DBETTERCAMERA - CFLAGS += -DBETTERCAMERA - EXT_OPTIONS_MENU := 1 -endif - -#ifeq ($(TEXTSAVES),1) -# CC_CHECK += -DTEXTSAVES -# CFLAGS += -DTEXTSAVES -#endif - -# Check for no drawing distance option -#ifeq ($(NODRAWINGDISTANCE),1) - CC_CHECK += -DNODRAWINGDISTANCE - CFLAGS += -DNODRAWINGDISTANCE -#endif - -# Check for Discord Rich Presence option -#ifeq ($(DISCORDRPC),1) -# CC_CHECK += -DDISCORDRPC -# CFLAGS += -DDISCORDRPC -#endif - -# Check for Discord SDK option -ifeq ($(DISCORD_SDK),1) - CC_CHECK += -DDISCORD_SDK - CFLAGS += -DDISCORD_SDK -endif - -# Check for development option -ifeq ($(DEVELOPMENT),1) - CC_CHECK += -DDEVELOPMENT - CFLAGS += -DDEVELOPMENT -endif - -# Check for texture fix option -ifeq ($(TEXTURE_FIX),1) - CC_CHECK += -DTEXTURE_FIX - CFLAGS += -DTEXTURE_FIX -endif - -# Check for extended options menu option -ifeq ($(EXT_OPTIONS_MENU),1) - CC_CHECK += -DEXT_OPTIONS_MENU - CFLAGS += -DEXT_OPTIONS_MENU -endif - -# Check for no bzero/bcopy workaround option -ifeq ($(NO_BZERO_BCOPY),1) - CC_CHECK += -DNO_BZERO_BCOPY - CFLAGS += -DNO_BZERO_BCOPY -endif - -# Use internal ldiv()/lldiv() -ifeq ($(NO_LDIV),1) - CC_CHECK += -DNO_LDIV - CFLAGS += -DNO_LDIV -endif - -# Use OpenGL 1.3 -ifeq ($(LEGACY_GL),1) - CC_CHECK += -DLEGACY_GL - CFLAGS += -DLEGACY_GL -endif - -# Load external textures -ifeq ($(EXTERNAL_DATA),1) - CC_CHECK += -DEXTERNAL_DATA -DFS_BASEDIR="\"$(BASEDIR)\"" - CFLAGS += -DEXTERNAL_DATA -DFS_BASEDIR="\"$(BASEDIR)\"" - # tell skyconv to write names instead of actual texture data and save the split tiles so we can use them later - SKYTILE_DIR := $(BUILD_DIR)/textures/skybox_tiles - SKYCONV_ARGS := --store-names --write-tiles "$(SKYTILE_DIR)" -endif - -ASFLAGS := -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS) - ifeq ($(TARGET_WEB),1) -LDFLAGS := -lm -lGL -lSDL2 -no-pie -s TOTAL_MEMORY=20MB -g4 --source-map-base http://localhost:8080/ -s "EXTRA_EXPORTED_RUNTIME_METHODS=['callMain']" - + LDFLAGS := -lm -lGL -lSDL2 -no-pie -s TOTAL_MEMORY=20MB -g4 --source-map-base http://localhost:8080/ -s "EXTRA_EXPORTED_RUNTIME_METHODS=['callMain']" else ifeq ($(WINDOWS_BUILD),1) LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -Llib -lpthread $(BACKEND_LDFLAGS) -static ifeq ($(CROSS),) @@ -807,24 +815,20 @@ else ifeq ($(WINDOWS_BUILD),1) ifeq ($(WINDOWS_CONSOLE),1) LDFLAGS += -mconsole endif - else ifeq ($(TARGET_RPI),1) LDFLAGS := $(OPT_FLAGS) -lm $(BACKEND_LDFLAGS) -no-pie - else ifeq ($(OSX_BUILD),1) LDFLAGS := -lm $(BACKEND_LDFLAGS) -lpthread - else LDFLAGS := $(BITS) -march=$(TARGET_ARCH) -lm $(BACKEND_LDFLAGS) -no-pie -lpthread # ifeq ($(DISCORDRPC),1) # LDFLAGS += -ldl -Wl,-rpath . # endif - endif -# coop specific libraries +# Coop specific libraries -# lua +# Lua ifeq ($(WINDOWS_BUILD),1) ifeq ($(TARGET_BITS), 32) LDFLAGS += -Llib/lua/win32 -l:liblua53.a @@ -837,7 +841,7 @@ else LDFLAGS += -Llib/lua/linux -l:liblua53.a endif -# network +# Network ifeq ($(WINDOWS_BUILD),1) LDFLAGS += -L"ws2_32" -lwsock32 ifeq ($(DISCORD_SDK),1) @@ -849,44 +853,171 @@ else endif endif -# End of LDFLAGS - # Prevent a crash with -sopt export LANG := C -####################### Other Tools ######################### +#==============================================================================# +# Extra CC Flags # +#==============================================================================# -# N64 conversion tools -MIO0TOOL = $(TOOLS_DIR)/mio0 -N64CKSUM = $(TOOLS_DIR)/n64cksum -N64GRAPHICS = $(TOOLS_DIR)/n64graphics -N64GRAPHICS_CI = $(TOOLS_DIR)/n64graphics_ci -TEXTCONV = $(TOOLS_DIR)/textconv -AIFF_EXTRACT_CODEBOOK = $(TOOLS_DIR)/aiff_extract_codebook -VADPCM_ENC = $(TOOLS_DIR)/vadpcm_enc -EXTRACT_DATA_FOR_MIO = $(TOOLS_DIR)/extract_data_for_mio -SKYCONV = $(TOOLS_DIR)/skyconv +# Identify that this is a coop build so that one patch can be applied to EX +# and/or COOP. They can choose to ifdef entity synchronization out. +CC_CHECK_CFLAGS += -DCOOP +CFLAGS += -DCOOP + +# Enforce -Werror in strict mode +ifeq ($(STRICT),1) + CC_CHECK_CFLAGS += -Werror + CFLAGS += -Werror +endif + +# Check for debug option +ifeq ($(DEBUG),1) + CC_CHECK_CFLAGS += -DDEBUG + CFLAGS += -DDEBUG +endif + +# Check for enhancement options + +# Check for immediate load option +ifeq ($(IMMEDIATELOAD),1) + CC_CHECK_CFLAGS += -DIMMEDIATELOAD + CFLAGS += -DIMMEDIATELOAD +endif + +# Check for docker build workaround option +ifeq ($(DOCKERBUILD),1) + CC_CHECK_CFLAGS += -DDOCKERBUILD + CFLAGS += -DDOCKERBUILD +endif + +# Check for Puppycam option +ifeq ($(BETTERCAMERA),1) + CC_CHECK_CFLAGS += -DBETTERCAMERA + CFLAGS += -DBETTERCAMERA + EXT_OPTIONS_MENU := 1 +endif + +#ifeq ($(TEXTSAVES),1) +# CC_CHECK_CFLAGS += -DTEXTSAVES +# CFLAGS += -DTEXTSAVES +#endif + +# Check for no drawing distance option +#ifeq ($(NODRAWINGDISTANCE),1) + CC_CHECK_CFLAGS += -DNODRAWINGDISTANCE + CFLAGS += -DNODRAWINGDISTANCE +#endif + +# Check for Discord Rich Presence option +#ifeq ($(DISCORDRPC),1) +# CC_CHECK_CFLAGS += -DDISCORDRPC +# CFLAGS += -DDISCORDRPC +#endif + +# Check for Discord SDK option +ifeq ($(DISCORD_SDK),1) + CC_CHECK_CFLAGS += -DDISCORD_SDK + CFLAGS += -DDISCORD_SDK +endif + +# Check for development option +ifeq ($(DEVELOPMENT),1) + CC_CHECK_CFLAGS += -DDEVELOPMENT + CFLAGS += -DDEVELOPMENT +endif + +# Check for texture fix option +ifeq ($(TEXTURE_FIX),1) + CC_CHECK_CFLAGS += -DTEXTURE_FIX + CFLAGS += -DTEXTURE_FIX +endif + +# Check for extended options menu option +ifeq ($(EXT_OPTIONS_MENU),1) + CC_CHECK_CFLAGS += -DEXT_OPTIONS_MENU + CFLAGS += -DEXT_OPTIONS_MENU +endif + +# Check for no bzero/bcopy workaround option +ifeq ($(NO_BZERO_BCOPY),1) + CC_CHECK_CFLAGS += -DNO_BZERO_BCOPY + CFLAGS += -DNO_BZERO_BCOPY +endif + +# Use internal ldiv()/lldiv() +ifeq ($(NO_LDIV),1) + CC_CHECK_CFLAGS += -DNO_LDIV + CFLAGS += -DNO_LDIV +endif + +# Use OpenGL 1.3 +ifeq ($(LEGACY_GL),1) + CC_CHECK_CFLAGS += -DLEGACY_GL + CFLAGS += -DLEGACY_GL +endif + +# Load external textures +ifeq ($(EXTERNAL_DATA),1) + CC_CHECK_CFLAGS += -DEXTERNAL_DATA -DFS_BASEDIR="\"$(BASEDIR)\"" + CFLAGS += -DEXTERNAL_DATA -DFS_BASEDIR="\"$(BASEDIR)\"" + # tell skyconv to write names instead of actual texture data and save the split tiles so we can use them later + SKYTILE_DIR := $(BUILD_DIR)/textures/skybox_tiles + SKYCONV_ARGS := --store-names --write-tiles "$(SKYTILE_DIR)" + $(shell mkdir -p $(SKYTILE_DIR)) +endif + +#==============================================================================# +# Miscellaneous Tools # +#==============================================================================# + +# N64 tools +MIO0TOOL := $(TOOLS_DIR)/mio0 +N64CKSUM := $(TOOLS_DIR)/n64cksum +N64GRAPHICS := $(TOOLS_DIR)/n64graphics +N64GRAPHICS_CI := $(TOOLS_DIR)/n64graphics_ci +TEXTCONV := $(TOOLS_DIR)/textconv +AIFF_EXTRACT_CODEBOOK := $(TOOLS_DIR)/aiff_extract_codebook +VADPCM_ENC := $(TOOLS_DIR)/vadpcm_enc +EXTRACT_DATA_FOR_MIO := $(TOOLS_DIR)/extract_data_for_mio +SKYCONV := $(TOOLS_DIR)/skyconv +# Use the system installed armips if available. Otherwise use the one provided with this repository. +ifneq (,$(call find-command,armips)) + RSPASM := armips +else + RSPASM := $(TOOLS_DIR)/armips +endif +ENDIAN_BITWIDTH := $(BUILD_DIR)/endian-and-bitwidth EMULATOR = mupen64plus EMU_FLAGS = --noosd LOADER = loader64 LOADER_FLAGS = -vwf SHA1SUM = sha1sum +PRINT = printf -###################### Dependency Check ##################### - -# Stubbed - -######################## Targets ############################# - -all: $(EXE) - -# thank you apple very cool -ifeq ($(HOST_OS),Darwin) - CP := gcp -else - CP := cp +ifeq ($(COLOR),1) + NO_COL := \033[0m + RED := \033[0;31m + GREEN := \033[0;32m + BLUE := \033[0;34m + YELLOW := \033[0;33m + BLINK := \033[33;5m endif +# Use Objcopy instead of extract_data_for_mio +ifeq ($(COMPILER),gcc) + EXTRACT_DATA_FOR_MIO := $(OBJCOPY) -O binary --only-section=.data +endif + +# Common build print status function +define print + @$(PRINT) "$(GREEN)$(1) $(YELLOW)$(2)$(GREEN) -> $(BLUE)$(3)$(NO_COL)\n" +endef + +#==============================================================================# +# Main Targets # +#==============================================================================# + ifeq ($(EXTERNAL_DATA),1) BASEPACK_PATH := $(BUILD_DIR)/$(BASEDIR)/$(BASEPACK) @@ -900,6 +1031,7 @@ res: $(BASEPACK_PATH) # prepares the basepack.lst $(BASEPACK_LST): $(EXE) + @$(PRINT) "$(GREEN)Making basepack list.$(NO_COL)\n" @mkdir -p $(BUILD_DIR)/$(BASEDIR) @echo -n > $(BASEPACK_LST) @echo "$(BUILD_DIR)/sound/bank_sets sound/bank_sets" >> $(BASEPACK_LST) @@ -913,19 +1045,28 @@ $(BASEPACK_LST): $(EXE) # prepares the resource ZIP with base data $(BASEPACK_PATH): $(BASEPACK_LST) - @$(MKZIP) $(BASEPACK_LST) $(BASEPACK_PATH) + @$(PRINT) "$(GREEN)Packing basepack zip file.$(NO_COL)\n" + $(V)$(PYTHON) $(TOOLS_DIR)/mkzip.py $(BASEPACK_LST) $(BASEPACK_PATH) endif +#all: $(ROM) +all: $(EXE) + +ifeq ($(COMPARE),1) + @$(PRINT) "$(GREEN)Checking if ROM matches.. $(NO_COL)\n" + @$(SHA1SUM) --quiet -c $(TARGET).sha1 && $(PRINT) "$(TARGET): $(GREEN)OK$(NO_COL)\n" || ($(PRINT) "$(YELLOW)Building the ROM file has succeeded, but does not match the original ROM.\nThis is expected, and not an error, if you are making modifications.\nTo silence this message, use 'make COMPARE=0.' $(NO_COL)\n" && false) +endif + clean: $(RM) -r $(BUILD_DIR_BASE) - + cleantools: - $(MAKE) -s -C tools clean + $(MAKE) -s -C $(TOOLS_DIR) clean -distclean: - $(RM) -r $(BUILD_DIR_BASE) - $(EXTRACT_ASSETS) --clean +distclean: clean + $(PYTHON) extract_assets.py --clean + cleantools test: $(ROM) $(EMULATOR) $(EMU_FLAGS) $< @@ -933,284 +1074,390 @@ test: $(ROM) load: $(ROM) $(LOADER) $(LOADER_FLAGS) $< +libultra: $(BUILD_DIR)/libultra.a + $(BUILD_DIR)/$(RPC_LIBS): @$(CP) -f $(RPC_LIBS) $(BUILD_DIR) - + $(BUILD_DIR)/$(DISCORD_SDK_LIBS): @$(CP) -f $(DISCORD_SDK_LIBS) $(BUILD_DIR) $(BUILD_DIR)/$(MOD_DIR): @$(CP) -f -r $(MOD_DIR) $(BUILD_DIR) -libultra: $(BUILD_DIR)/libultra.a +# Extra object file dependencies -$(BUILD_DIR)/asm/boot.o: $(IPL3_RAW_FILES) -$(BUILD_DIR)/src/game/crash_screen.o: $(CRASH_TEXTURE_C_FILES) +ifeq ($(TARGET_N64),1) + $(BUILD_DIR)/asm/boot.o: $(IPL3_RAW_FILES) + $(BUILD_DIR)/src/game/crash_screen.o: $(CRASH_TEXTURE_C_FILES) + $(BUILD_DIR)/lib/rsp.o: $(BUILD_DIR)/rsp/rspboot.bin $(BUILD_DIR)/rsp/fast3d.bin $(BUILD_DIR)/rsp/audio.bin +endif -$(BUILD_DIR)/lib/rsp.o: $(BUILD_DIR)/rsp/rspboot.bin $(BUILD_DIR)/rsp/fast3d.bin $(BUILD_DIR)/rsp/audio.bin +$(SOUND_BIN_DIR)/sound_data.o: $(SOUND_BIN_DIR)/sound_data.ctl.inc.c $(SOUND_BIN_DIR)/sound_data.tbl.inc.c $(SOUND_BIN_DIR)/sequences.bin.inc.c $(SOUND_BIN_DIR)/bank_sets.inc.c +$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h -#Required so the compiler doesn't complain about this not existing. -$(BUILD_DIR)/src/game/camera.o: $(BUILD_DIR)/include/text_strings.h +ifeq ($(VERSION),sh) + $(BUILD_DIR)/src/audio/load.o: $(SOUND_BIN_DIR)/bank_sets.inc.c $(SOUND_BIN_DIR)/sequences_header.inc.c $(SOUND_BIN_DIR)/ctl_header.inc.c $(SOUND_BIN_DIR)/tbl_header.inc.c +endif -$(BUILD_DIR)/include/text_strings.h: include/text_strings.h.in - $(TEXTCONV) charmap.txt $< $@ +$(CRASH_TEXTURE_C_FILES): TEXTURE_ENCODING := u32 -$(BUILD_DIR)/include/text_menu_strings.h: include/text_menu_strings.h.in - $(TEXTCONV) charmap_menu.txt $< $@ +ifeq ($(COMPILER),gcc) + $(BUILD_DIR)/lib/src/math/%.o: CFLAGS += -fno-builtin +endif ifeq ($(VERSION),eu) -TEXT_DIRS := text/de text/us text/fr - -# EU encoded text inserted into individual segment 0x19 files, -# and course data also duplicated in leveldata.c -$(BUILD_DIR)/bin/eu/translation_en.o: $(BUILD_DIR)/text/us/define_text.inc.c -$(BUILD_DIR)/bin/eu/translation_de.o: $(BUILD_DIR)/text/de/define_text.inc.c -$(BUILD_DIR)/bin/eu/translation_fr.o: $(BUILD_DIR)/text/fr/define_text.inc.c -$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/us/define_courses.inc.c -$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/de/define_courses.inc.c -$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/fr/define_courses.inc.c + TEXT_DIRS := text/de text/us text/fr + # EU encoded text inserted into individual segment 0x19 files, + # and course data also duplicated in leveldata.c + $(BUILD_DIR)/bin/eu/translation_en.o: $(BUILD_DIR)/text/us/define_text.inc.c + $(BUILD_DIR)/bin/eu/translation_de.o: $(BUILD_DIR)/text/de/define_text.inc.c + $(BUILD_DIR)/bin/eu/translation_fr.o: $(BUILD_DIR)/text/fr/define_text.inc.c + $(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/include/text_strings.h + $(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/us/define_courses.inc.c + $(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/de/define_courses.inc.c + $(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/fr/define_courses.inc.c else -ifeq ($(VERSION),sh) -TEXT_DIRS := text/jp -$(BUILD_DIR)/bin/segment2.o: $(BUILD_DIR)/text/jp/define_text.inc.c - -else -TEXT_DIRS := text/$(VERSION) - -# non-EU encoded text inserted into segment 0x02 -$(BUILD_DIR)/bin/segment2.o: $(BUILD_DIR)/text/$(VERSION)/define_text.inc.c -endif + ifeq ($(VERSION),sh) + TEXT_DIRS := text/jp + $(BUILD_DIR)/bin/segment2.o: $(BUILD_DIR)/text/jp/define_text.inc.c + else + TEXT_DIRS := text/$(VERSION) + # non-EU encoded text inserted into segment 0x02 + $(BUILD_DIR)/bin/segment2.o: $(BUILD_DIR)/text/$(VERSION)/define_text.inc.c + endif endif -$(BUILD_DIR)/text/%/define_courses.inc.c: text/define_courses.inc.c text/%/courses.h - $(CPP) $(VERSION_CFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) charmap.txt - $@ - -$(BUILD_DIR)/text/%/define_text.inc.c: text/define_text.inc.c text/%/courses.h text/%/dialogs.h - $(CPP) $(VERSION_CFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) charmap.txt - $@ - -RSP_DIRS := $(BUILD_DIR)/rsp -ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(GODDARD_SRC_DIRS) $(ULTRA_SRC_DIRS) $(ULTRA_ASM_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) include) $(MIO0_DIR) $(addprefix $(MIO0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION) $(RSP_DIRS) +ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(GODDARD_SRC_DIRS) $(ULTRA_SRC_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) rsp include) $(MIO0_DIR) $(addprefix $(MIO0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION) # Make sure build directory exists before compiling anything DUMMY != mkdir -p $(ALL_DIRS) $(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h - -ifeq ($(VERSION),eu) -$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o -$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o -$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o -$(BUILD_DIR)/src/game/options_menu.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o -O_FILES += $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o -#ifeq ($(DISCORDRPC),1) -# $(BUILD_DIR)/src/pc/discord/discordrpc.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o -#endif -else $(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h +$(BUILD_DIR)/src/game/camera.o: $(BUILD_DIR)/include/text_strings.h $(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h -$(BUILD_DIR)/src/game/options_menu.o: $(BUILD_DIR)/include/text_strings.h -#ifeq ($(DISCORDRPC),1) -# $(BUILD_DIR)/src/pc/discord/discordrpc.o: $(BUILD_DIR)/include/text_strings.h -#endif -endif -################################################################ -# TEXTURE GENERATION # -################################################################ -# RGBA32, RGBA16, IA16, IA8, IA4, IA1, I8, I4 +#==============================================================================# +# Texture Generation # +#==============================================================================# +TEXTURE_ENCODING := u8 ifeq ($(EXTERNAL_DATA),1) - -$(BUILD_DIR)/%: %.png - $(ZEROTERM) "$(patsubst %.png,%,$^)" > $@ - + $(BUILD_DIR)/%: %.png + $(call print,Dummying:,$<,$@) + $(V)$(PYTHON) $(TOOLS_DIR)/zeroterm.py "$(patsubst %.png,%,$^)" > $@ else - -$(BUILD_DIR)/%: %.png - $(N64GRAPHICS) -i $@ -g $< -f $(lastword $(subst ., ,$@)) - + # Convert PNGs to RGBA32, RGBA16, IA16, IA8, IA4, IA1, I8, I4 binary files + $(BUILD_DIR)/%: %.png + $(call print,Converting:,$<,$@) + $(V)$(N64GRAPHICS) -s raw -i $@ -g $< -f $(lastword $(subst ., ,$@)) + + $(BUILD_DIR)/%.inc.c: %.png + $(call print,Converting:,$<,$@) + $(V)$(N64GRAPHICS) -s $(TEXTURE_ENCODING) -i $@ -g $< -f $(lastword ,$(subst ., ,$(basename $<))) endif -$(BUILD_DIR)/%.inc.c: $(BUILD_DIR)/% %.png - hexdump -v -e '1/1 "0x%X,"' $< > $@ - echo >> $@ ifeq ($(EXTERNAL_DATA),0) + # Color Index CI8 + $(BUILD_DIR)/%.ci8: %.ci8.png + $(call print,Converting:,$<,$@) + $(V)$(N64GRAPHICS_CI) -i $@ -g $< -f ci8 -# Color Index CI8 -$(BUILD_DIR)/%.ci8: %.ci8.png - $(N64GRAPHICS_CI) -i $@ -g $< -f ci8 - -# Color Index CI4 -$(BUILD_DIR)/%.ci4: %.ci4.png - $(N64GRAPHICS_CI) -i $@ -g $< -f ci4 - + # Color Index CI4 + $(BUILD_DIR)/%.ci4: %.ci4.png + $(call print,Converting:,$<,$@) + $(V)$(N64GRAPHICS_CI) -i $@ -g $< -f ci4 endif -################################################################ +#==============================================================================# +# Compressed Segment Generation # +#==============================================================================# -# compressed segment generation +ifeq ($(TARGET_N64),1) + +# Link segment file to resolve external labels +# TODO: ideally this would be `-Trodata-segment=0x07000000` but that doesn't set the address +$(BUILD_DIR)/%.elf: $(BUILD_DIR)/%.o + $(call print,Linking ELF file:,$<,$@) + $(V)$(LD) -e 0 -Ttext=$(SEGMENT_ADDRESS) -Map $@.map -o $@ $< + +# Override for leveldata.elf, which otherwise matches the above pattern +.SECONDEXPANSION: +$(BUILD_DIR)/levels/%/leveldata.elf: $(BUILD_DIR)/levels/%/leveldata.o $(BUILD_DIR)/bin/$$(TEXTURE_BIN).elf + $(call print,Linking ELF file:,$<,$@) + $(V)$(LD) -e 0 -Ttext=$(SEGMENT_ADDRESS) -Map $@.map --just-symbols=$(BUILD_DIR)/bin/$(TEXTURE_BIN).elf -o $@ $< + +$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf + $(call print,Extracting compressionable data from:,$<,$@) + $(V)$(EXTRACT_DATA_FOR_MIO) $< $@ + +$(BUILD_DIR)/levels/%/leveldata.bin: $(BUILD_DIR)/levels/%/leveldata.elf + $(call print,Extracting compressionable data from:,$<,$@) + $(V)$(EXTRACT_DATA_FOR_MIO) $< $@ + +# Compress binary file +$(BUILD_DIR)/%.mio0: $(BUILD_DIR)/%.bin + $(call print,Compressing:,$<,$@) + $(V)$(MIO0TOOL) $< $@ + +# convert binary mio0 to object file +$(BUILD_DIR)/%.mio0.o: $(BUILD_DIR)/%.mio0 + $(call print,Converting MIO0 to ELF:,$<,$@) + $(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@ + +endif + + +#==============================================================================# +# Sound File Generation # +#==============================================================================# -# PC Area $(BUILD_DIR)/%.table: %.aiff - $(AIFF_EXTRACT_CODEBOOK) $< >$@ + $(call print,Extracting codebook:,$<,$@) + $(V)$(AIFF_EXTRACT_CODEBOOK) $< >$@ $(BUILD_DIR)/%.aifc: $(BUILD_DIR)/%.table %.aiff - $(VADPCM_ENC) -c $^ $@ + $(call print,Encoding VADPCM:,$<,$@) + $(V)$(VADPCM_ENC) -c $^ $@ -$(BUILD_DIR)/rsp/%.bin $(BUILD_DIR)/rsp/%_data.bin: rsp/%.s - $(RSPASM) -sym $@.sym -definelabel $(VERSION_DEF) 1 -definelabel $(GRUCODE_DEF) 1 -strequ CODE_FILE $(BUILD_DIR)/rsp/$*.bin -strequ DATA_FILE $(BUILD_DIR)/rsp/$*_data.bin $< - -$(ENDIAN_BITWIDTH): tools/determine-endian-bitwidth.c - $(CC) -c $(CFLAGS) -o $@.dummy2 $< 2>$@.dummy1; true - grep -o 'msgbegin --endian .* --bitwidth .* msgend' $@.dummy1 > $@.dummy2 - head -n1 <$@.dummy2 | cut -d' ' -f2-5 > $@ - @rm $@.dummy1 - @rm $@.dummy2 +$(ENDIAN_BITWIDTH): $(TOOLS_DIR)/determine-endian-bitwidth.c + @$(PRINT) "$(GREEN)Generating endian-bitwidth $(NO_COL)\n" + $(V)$(CC) -c $(CFLAGS) -o $@.dummy2 $< 2>$@.dummy1; true + $(V)grep -o 'msgbegin --endian .* --bitwidth .* msgend' $@.dummy1 > $@.dummy2 + $(V)head -n1 <$@.dummy2 | cut -d' ' -f2-5 > $@ + @$(RM) $@.dummy1 + @$(RM) $@.dummy2 $(SOUND_BIN_DIR)/sound_data.ctl: sound/sound_banks/ $(SOUND_BANK_FILES) $(SOUND_SAMPLE_AIFCS) $(ENDIAN_BITWIDTH) - $(ASSEMBLE_SOUND) $(BUILD_DIR)/sound/samples/ sound/sound_banks/ $(SOUND_BIN_DIR)/sound_data.ctl $(SOUND_BIN_DIR)/sound_data.tbl $(VERSION_CFLAGS) $$(cat $(ENDIAN_BITWIDTH)) + @$(PRINT) "$(GREEN)Generating: $(BLUE)$@ $(NO_COL)\n" + $(V)$(PYTHON) $(TOOLS_DIR)/assemble_sound.py $(BUILD_DIR)/sound/samples/ sound/sound_banks/ $(SOUND_BIN_DIR)/sound_data.ctl $(SOUND_BIN_DIR)/ctl_header $(SOUND_BIN_DIR)/sound_data.tbl $(SOUND_BIN_DIR)/tbl_header $(C_DEFINES) $$(cat $(ENDIAN_BITWIDTH)) $(SOUND_BIN_DIR)/sound_data.tbl: $(SOUND_BIN_DIR)/sound_data.ctl @true -ifeq ($(VERSION),sh) -$(SOUND_BIN_DIR)/sequences.bin: $(SOUND_BANK_FILES) sound/sequences.json sound/sequences/ sound/sequences/jp/ $(SOUND_SEQUENCE_FILES) $(ENDIAN_BITWIDTH) - $(ASSEMBLE_SOUND) --sequences $@ $(SOUND_BIN_DIR)/bank_sets sound/sound_banks/ sound/sequences.json $(SOUND_SEQUENCE_FILES) $(VERSION_CFLAGS) $$(cat $(ENDIAN_BITWIDTH)) -else -$(SOUND_BIN_DIR)/sequences.bin: $(SOUND_BANK_FILES) sound/sequences.json sound/sequences/ sound/sequences/$(VERSION)/ $(SOUND_SEQUENCE_FILES) $(ENDIAN_BITWIDTH) - $(ASSEMBLE_SOUND) --sequences $@ $(SOUND_BIN_DIR)/bank_sets sound/sound_banks/ sound/sequences.json $(SOUND_SEQUENCE_FILES) $(VERSION_CFLAGS) $$(cat $(ENDIAN_BITWIDTH)) -endif +$(SOUND_BIN_DIR)/ctl_header: $(SOUND_BIN_DIR)/sound_data.ctl + @true + +$(SOUND_BIN_DIR)/tbl_header: $(SOUND_BIN_DIR)/sound_data.ctl + @true + +$(SOUND_BIN_DIR)/sequences.bin: $(SOUND_BANK_FILES) sound/sequences.json $(SOUND_SEQUENCE_DIRS) $(SOUND_SEQUENCE_FILES) $(ENDIAN_BITWIDTH) + @$(PRINT) "$(GREEN)Generating: $(BLUE)$@ $(NO_COL)\n" + $(V)$(PYTHON) $(TOOLS_DIR)/assemble_sound.py --sequences $@ $(SOUND_BIN_DIR)/sequences_header $(SOUND_BIN_DIR)/bank_sets sound/sound_banks/ sound/sequences.json $(SOUND_SEQUENCE_FILES) $(C_DEFINES) $$(cat $(ENDIAN_BITWIDTH)) $(SOUND_BIN_DIR)/bank_sets: $(SOUND_BIN_DIR)/sequences.bin @true -$(SOUND_BIN_DIR)/%.m64: $(SOUND_BIN_DIR)/%.o - $(OBJCOPY) -j .rodata $< -O binary $@ +$(SOUND_BIN_DIR)/sequences_header: $(SOUND_BIN_DIR)/sequences.bin + @true -$(SOUND_BIN_DIR)/%.o: $(SOUND_BIN_DIR)/%.s - $(AS) $(ASFLAGS) -o $@ $< +$(SOUND_BIN_DIR)/%.m64: $(SOUND_BIN_DIR)/%.o + $(call print,Converting to M64:,$<,$@) + $(V)$(OBJCOPY) -j .rodata $< -O binary $@ + + +#==============================================================================# +# Generated Source Code Files # +#==============================================================================# ifeq ($(EXTERNAL_DATA),1) - -$(SOUND_BIN_DIR)/%.inc.c: $(SOUND_BIN_DIR)/% - $(ZEROTERM) "$(patsubst $(BUILD_DIR)/%,%,$^)" | hexdump -v -e '1/1 "0x%X,"' > $@ - -else - -$(SOUND_BIN_DIR)/%.inc.c: $(SOUND_BIN_DIR)/% - hexdump -v -e '1/1 "0x%X,"' $< > $@ - echo >> $@ - + $(SOUND_BIN_DIR)/%.inc.c: $(SOUND_BIN_DIR)/% + $(call print,Dummying:,$<,$@) + $(V)$(PYTHON) $(TOOLS_DIR)/zeroterm.py "$(patsubst $(BUILD_DIR)/%,%,$^)" | hexdump -v -e '1/1 "0x%X,"' > $@ endif -$(SOUND_BIN_DIR)/sound_data.o: $(SOUND_BIN_DIR)/sound_data.ctl.inc.c $(SOUND_BIN_DIR)/sound_data.tbl.inc.c $(SOUND_BIN_DIR)/sequences.bin.inc.c $(SOUND_BIN_DIR)/bank_sets.inc.c - -$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h - -$(BUILD_DIR)/include/level_headers.h: levels/level_headers.h.in - $(CPP) -I . levels/level_headers.h.in | $(OUTPUT_LEVEL_HEADERS) > $(BUILD_DIR)/include/level_headers.h +# Convert binary file to a comma-separated list of byte values for inclusion in C code +$(BUILD_DIR)/%.inc.c: $(BUILD_DIR)/% + $(call print,Piping:,$<,$@) + $(V)hexdump -v -e '1/1 "0x%X,"' $< > $@ + $(V)echo >> $@ +# Generate animation data $(BUILD_DIR)/assets/mario_anim_data.c: $(wildcard assets/anims/*.inc.c) - $(MARIO_ANIMS_CONVERTER) > $@ + @$(PRINT) "$(GREEN)Generating animation data $(NO_COL)\n" + $(V)$(PYTHON) $(TOOLS_DIR)/mario_anims_converter.py > $@ +# Generate demo input data $(BUILD_DIR)/assets/demo_data.c: assets/demo_data.json $(wildcard assets/demos/*.bin) - $(DEMO_DATA_CONVERTER) assets/demo_data.json $(VERSION_CFLAGS) > $@ + @$(PRINT) "$(GREEN)Generating demo data $(NO_COL)\n" + $(V)$(PYTHON) $(TOOLS_DIR)/demo_data_converter.py assets/demo_data.json $(DEF_INC_CFLAGS) > $@ -# Source code -$(BUILD_DIR)/levels/%/leveldata.o: OPT_FLAGS := -g -$(BUILD_DIR)/actors/%.o: OPT_FLAGS := -g -$(BUILD_DIR)/bin/%.o: OPT_FLAGS := -g -$(BUILD_DIR)/src/goddard/%.o: OPT_FLAGS := -g -$(BUILD_DIR)/src/goddard/%.o: MIPSISET := -mips1 -$(BUILD_DIR)/lib/src/%.o: OPT_FLAGS := -$(BUILD_DIR)/lib/src/math/ll%.o: MIPSISET := -mips3 -32 -$(BUILD_DIR)/lib/src/math/%.o: OPT_FLAGS := -O2 -$(BUILD_DIR)/lib/src/math/ll%.o: OPT_FLAGS := -$(BUILD_DIR)/lib/src/ldiv.o: OPT_FLAGS := -O2 -$(BUILD_DIR)/lib/src/string.o: OPT_FLAGS := -O2 -$(BUILD_DIR)/lib/src/gu%.o: OPT_FLAGS := -O3 -$(BUILD_DIR)/lib/src/al%.o: OPT_FLAGS := -O3 +# Encode in-game text strings +$(BUILD_DIR)/include/text_strings.h: include/text_strings.h.in + $(call print,Encoding:,$<,$@) + $(V)$(TEXTCONV) charmap.txt $< $@ +$(BUILD_DIR)/include/text_menu_strings.h: include/text_menu_strings.h.in + $(call print,Encoding:,$<,$@) + $(V)$(TEXTCONV) charmap_menu.txt $< $@ +$(BUILD_DIR)/text/%/define_courses.inc.c: text/define_courses.inc.c text/%/courses.h + @$(PRINT) "$(GREEN)Preprocessing: $(BLUE)$@ $(NO_COL)\n" + $(V)$(CPP) $(CPPFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) charmap.txt - $@ +$(BUILD_DIR)/text/%/define_text.inc.c: text/define_text.inc.c text/%/courses.h text/%/dialogs.h + @$(PRINT) "$(GREEN)Preprocessing: $(BLUE)$@ $(NO_COL)\n" + $(V)$(CPP) $(CPPFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) charmap.txt - $@ -ifeq ($(VERSION),eu) -$(BUILD_DIR)/lib/src/_Litob.o: OPT_FLAGS := -O3 -$(BUILD_DIR)/lib/src/_Ldtob.o: OPT_FLAGS := -O3 -$(BUILD_DIR)/lib/src/_Printf.o: OPT_FLAGS := -O3 -$(BUILD_DIR)/lib/src/sprintf.o: OPT_FLAGS := -O3 - -# Enable loop unrolling except for external.c (external.c might also have used -# unrolling, but it makes one loop harder to match). -# For all audio files other than external.c and port_eu.c, put string literals -# in .data. (In Shindou, the port_eu.c string literals also moved to .data.) -$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -use_readwrite_const -$(BUILD_DIR)/src/audio/port_eu.o: OPT_FLAGS := -O2 -$(BUILD_DIR)/src/audio/external.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 -else - -$(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 -$(BUILD_DIR)/src/audio/load.o: OPT_FLAGS := -O2 -framepointer -Wo,-loopunroll,0 - -# The source-to-source optimizer copt is enabled for audio. This makes it use -# acpp, which needs -Wp,-+ to handle C++-style comments. -# All other files than external.c should really use copt, but only a few have -# been matched so far. -$(BUILD_DIR)/src/audio/effects.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 -sopt,-inline=sequence_channel_process_sound,-scalaroptimize=1 -Wp,-+ -$(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -O2 -sopt,-scalaroptimize=1 -Wp,-+ -#$(BUILD_DIR)/src/audio/seqplayer.o: OPT_FLAGS := -O2 -sopt,-inline_manual,-scalaroptimize=1 -Wp,-+ #-Wo,-v,-bb,-l,seqplayer_list.txt - -# Add a target for build/eu/src/audio/*.copt to make it easier to see debug -$(BUILD_DIR)/src/audio/%.acpp: src/audio/%.c - $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/acpp $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(MATCH_CFLAGS) $(GRUCODE_CFLAGS) -D__sgi -+ $< > $@ - -$(BUILD_DIR)/src/audio/seqplayer.copt: $(BUILD_DIR)/src/audio/seqplayer.acpp - $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/copt -signed -I=$< -CMP=$@ -cp=i -scalaroptimize=1 -inline_manual - -$(BUILD_DIR)/src/audio/%.copt: $(BUILD_DIR)/src/audio/%.acpp - $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/copt -signed -I=$< -CMP=$@ -cp=i -scalaroptimize=1 +# Level headers +$(BUILD_DIR)/include/level_headers.h: levels/level_headers.h.in + $(call print,Preprocessing level headers:,$<,$@) + $(V)$(CPP) $(CPPFLAGS) -I . levels/level_headers.h.in | $(PYTHON) $(TOOLS_DIR)/output_level_headers.py > $(BUILD_DIR)/include/level_headers.h +# Run asm_processor on files that have NON_MATCHING code +ifeq ($(NON_MATCHING),0) +$(GLOBAL_ASM_O_FILES): CC := $(V)$(PYTHON) $(TOOLS_DIR)/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) -- endif # Rebuild files with 'GLOBAL_ASM' if the NON_MATCHING flag changes. $(GLOBAL_ASM_O_FILES): $(GLOBAL_ASM_DEP).$(NON_MATCHING) $(GLOBAL_ASM_DEP).$(NON_MATCHING): - @rm -f $(GLOBAL_ASM_DEP).* - touch $@ + @$(RM) $(GLOBAL_ASM_DEP).* + $(V)touch $@ + +#==============================================================================# +# Compilation Recipes # +#==============================================================================# + +# Compile C++ code $(BUILD_DIR)/%.o: %.cpp + $(call print,Compiling:,$<,$@) @$(CXX) -fsyntax-only $(EXTRA_CPP_FLAGS) $(EXTRA_CPP_INCLUDES) $(CFLAGS) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $< - $(CXX) -c $(EXTRA_CPP_FLAGS) $(EXTRA_CPP_INCLUDES) $(CFLAGS) -o $@ $< + $(V)$(CXX) -c $(EXTRA_CPP_FLAGS) $(EXTRA_CPP_INCLUDES) $(CFLAGS) -o $@ $< +# Compile C code $(BUILD_DIR)/%.o: %.c + $(call print,Compiling:,$<,$@) @$(CC_CHECK) $(CC_CHECK_CFLAGS) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $< - $(CC) -c $(CFLAGS) -o $@ $< - - + $(V)$(CC) -c $(CFLAGS) -o $@ $< $(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c + $(call print,Compiling:,$<,$@) @$(CC_CHECK) $(CC_CHECK_CFLAGS) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $< - $(CC) -c $(CFLAGS) -o $@ $< + $(V)$(CC) -c $(CFLAGS) -o $@ $< -$(BUILD_DIR)/%.o: %.s - $(AS) $(ASFLAGS) -MD $(BUILD_DIR)/$*.d -o $@ $< +# Alternate compiler flags needed for matching +ifeq ($(COMPILER),ido) + $(BUILD_DIR)/levels/%/leveldata.o: OPT_FLAGS := -g + $(BUILD_DIR)/actors/%.o: OPT_FLAGS := -g + $(BUILD_DIR)/bin/%.o: OPT_FLAGS := -g + $(BUILD_DIR)/src/goddard/%.o: OPT_FLAGS := -g + $(BUILD_DIR)/src/goddard/%.o: MIPSISET := -mips1 + $(BUILD_DIR)/lib/src/%.o: OPT_FLAGS := + $(BUILD_DIR)/lib/src/math/%.o: OPT_FLAGS := -O2 + $(BUILD_DIR)/lib/src/math/ll%.o: OPT_FLAGS := + $(BUILD_DIR)/lib/src/math/ll%.o: MIPSISET := -mips3 -32 + $(BUILD_DIR)/lib/src/ldiv.o: OPT_FLAGS := -O2 + $(BUILD_DIR)/lib/src/string.o: OPT_FLAGS := -O2 + $(BUILD_DIR)/lib/src/gu%.o: OPT_FLAGS := -O3 + $(BUILD_DIR)/lib/src/al%.o: OPT_FLAGS := -O3 + # For the asm-processor, since it doesn't support -O3. Probably not actually compiled with these flags. + ifeq ($(VERSION),sh) + $(BUILD_DIR)/lib/src/unk_shindou_file.o: OPT_FLAGS := -O1 + $(BUILD_DIR)/lib/src/func_sh_80304D20.o: OPT_FLAGS := -O1 + $(BUILD_DIR)/lib/src/_Printf.o: OPT_FLAGS := -O3 + $(BUILD_DIR)/lib/src/contramread.o: OPT_FLAGS := -O1 + $(BUILD_DIR)/lib/src/osPfsIsPlug.o: OPT_FLAGS := -O1 + $(BUILD_DIR)/lib/src/osAiSetFrequency.o: OPT_FLAGS := -O1 + $(BUILD_DIR)/lib/src/contramwrite.o: OPT_FLAGS := -O1 + $(BUILD_DIR)/lib/src/sprintf.o: OPT_FLAGS := -O3 + $(BUILD_DIR)/lib/src/_Litob.o: OPT_FLAGS := -O3 + $(BUILD_DIR)/lib/src/_Ldtob.o: OPT_FLAGS := -O3 + $(BUILD_DIR)/lib/src/osDriveRomInit.o: OPT_FLAGS := -g + endif + ifeq ($(VERSION),eu) + $(BUILD_DIR)/lib/src/_Litob.o: OPT_FLAGS := -O3 + $(BUILD_DIR)/lib/src/_Ldtob.o: OPT_FLAGS := -O3 + $(BUILD_DIR)/lib/src/_Printf.o: OPT_FLAGS := -O3 + $(BUILD_DIR)/lib/src/sprintf.o: OPT_FLAGS := -O3 + + # Enable loop unrolling except for external.c (external.c might also have used + # unrolling, but it makes one loop harder to match). + # For all audio files other than external.c and port_eu.c, put string literals + # in .data. (In Shindou, the port_eu.c string literals also moved to .data.) + $(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -use_readwrite_const + $(BUILD_DIR)/src/audio/port_eu.o: OPT_FLAGS := -O2 + $(BUILD_DIR)/src/audio/external.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 + endif + ifeq ($(VERSION_JP_US),true) + $(BUILD_DIR)/src/audio/%.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 + $(BUILD_DIR)/src/audio/load.o: OPT_FLAGS := -O2 -framepointer -Wo,-loopunroll,0 + endif + ifeq ($(VERSION_JP_US),true) + # The source-to-source optimizer copt is enabled for audio. This makes it use + # acpp, which needs -Wp,-+ to handle C++-style comments. + # All other files than external.c should really use copt, but only a few have + # been matched so far. + $(BUILD_DIR)/src/audio/effects.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 -sopt,-inline=sequence_channel_process_sound,-scalaroptimize=1 -Wp,-+ + $(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -O2 -sopt,-scalaroptimize=1 -Wp,-+ + endif + +# Add a target for build/eu/src/audio/*.copt to make it easier to see debug +$(BUILD_DIR)/src/audio/%.acpp: src/audio/%.c + $(ACPP) $(TARGET_CFLAGS) $(DEF_INC_CFLAGS) -D__sgi -+ $< > $@ +$(BUILD_DIR)/src/audio/%.copt: $(BUILD_DIR)/src/audio/%.acpp + $(COPT) -signed -I=$< -CMP=$@ -cp=i -scalaroptimize=1 $(COPTFLAGS) +$(BUILD_DIR)/src/audio/seqplayer.copt: COPTFLAGS := -inline_manual -ifeq ($(WINDOWS_BUILD),1) -all: COOP_EXE_MAP -COOP_EXE_MAP: $(EXE) - @objdump -t $(EXE) > $(BUILD_DIR)/coop.map endif -$(EXE): $(O_FILES) $(MIO0_FILES:.mio0=.o) $(SOUND_OBJ_FILES) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(BUILD_DIR)/$(RPC_LIBS) $(BUILD_DIR)/$(DISCORD_SDK_LIBS) $(BUILD_DIR)/$(MOD_DIR) - $(LD) -L $(BUILD_DIR) -o $@ $(O_FILES) $(SOUND_OBJ_FILES) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(LDFLAGS) $(EXTRA_INCLUDES) +# Run linker script through the C preprocessor +$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) + $(call print,Preprocessing linker script:,$<,$@) + $(V)$(CPP) $(CPPFLAGS) -DBUILD_DIR=$(BUILD_DIR) -MMD -MP -MT $@ -MF $@.d -o $@ $< + +# Assemble assembly code +$(BUILD_DIR)/%.o: %.s + $(call print,Assembling:,$<,$@) + $(V)$(AS) $(ASFLAGS) -MD $(BUILD_DIR)/$*.d -o $@ $< + +ifeq ($(TARGET_N64),1) + # Assemble RSP assembly code + $(BUILD_DIR)/rsp/%.bin $(BUILD_DIR)/rsp/%_data.bin: rsp/%.s + $(call print,Assembling:,$<,$@) + $(V)$(RSPASM) -sym $@.sym $(RSPASMFLAGS) -strequ CODE_FILE $(BUILD_DIR)/rsp/$*.bin -strequ DATA_FILE $(BUILD_DIR)/rsp/$*_data.bin $< + + # Link libultra + $(BUILD_DIR)/libultra.a: $(ULTRA_O_FILES) + @$(PRINT) "$(GREEN)Linking libultra: $(BLUE)$@ $(NO_COL)\n" + $(V)$(AR) rcs -o $@ $(ULTRA_O_FILES) + $(V)$(TOOLS_DIR)/patch_libultra_math $@ + + # Link libgoddard + $(BUILD_DIR)/libgoddard.a: $(GODDARD_O_FILES) + @$(PRINT) "$(GREEN)Linking libgoddard: $(BLUE)$@ $(NO_COL)\n" + $(V)$(AR) rcs -o $@ $(GODDARD_O_FILES) + + # Link SM64 ELF file + $(ELF): $(O_FILES) $(MIO0_OBJ_FILES) $(SEG_FILES) $(BUILD_DIR)/$(LD_SCRIPT) undefined_syms.txt $(BUILD_DIR)/libultra.a $(BUILD_DIR)/libgoddard.a + @$(PRINT) "$(GREEN)Linking ELF file: $(BLUE)$@ $(NO_COL)\n" + $(V)$(LD) -L $(BUILD_DIR) -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(addprefix -R ,$(SEG_FILES)) -o $@ $(O_FILES) -lultra -lgoddard + + # Build ROM + $(ROM): $(ELF) + $(call print,Building ROM:,$<,$@) + $(V)$(OBJCOPY) --pad-to=0x800000 --gap-fill=0xFF $< $(@:.z64=.bin) -O binary + $(V)$(N64CKSUM) $(@:.z64=.bin) $@ + + $(BUILD_DIR)/$(TARGET).objdump: $(ELF) + $(OBJDUMP) -D $< > $@ +else + $(EXE): $(O_FILES) $(MIO0_FILES:.mio0=.o) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(BUILD_DIR)/$(RPC_LIBS) $(BUILD_DIR)/$(DISCORD_SDK_LIBS) $(BUILD_DIR)/$(MOD_DIR) + $(LD) -L $(BUILD_DIR) -o $@ $(O_FILES) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(LDFLAGS) $(EXTRA_INCLUDES) +endif + + .PHONY: all clean distclean default diff test load libultra res .PRECIOUS: $(BUILD_DIR)/bin/%.elf $(SOUND_BIN_DIR)/%.ctl $(SOUND_BIN_DIR)/%.tbl $(SOUND_SAMPLE_TABLES) $(SOUND_BIN_DIR)/%.s $(BUILD_DIR)/% -.DELETE_ON_ERROR: +# with no prerequisites, .SECONDARY causes no intermediate target to be removed +.SECONDARY: # Remove built-in rules, to improve performance MAKEFLAGS += --no-builtin-rules -include $(DEP_FILES) -print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true +print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true \ No newline at end of file diff --git a/Makefile.split b/Makefile.split index 1367f3d1..fbd54694 100644 --- a/Makefile.split +++ b/Makefile.split @@ -3,9 +3,16 @@ # -------------------------------------- # obtain a list of segments from the *.c files in bin directory -SEGMENTS := $(notdir $(basename $(wildcard bin/*.c))) $(addprefix $(VERSION)/,$(notdir $(basename $(wildcard bin/$(VERSION)/*.c)))) $(addsuffix _skybox,$(notdir $(basename $(wildcard textures/skyboxes/*.png)))) -ACTORS := $(filter %/,$(wildcard actors/*/)) -TEXTURE_DIRS := $(addprefix textures/,$(SEGMENTS)) $(ACTORS) textures/crash_screen textures/intro_raw textures/ipl3_raw textures/skybox_tiles + +SEGMENTS := \ + $(notdir $(basename $(wildcard bin/*.c))) \ + $(addprefix $(VERSION)/,$(notdir $(basename $(wildcard bin/$(VERSION)/*.c)))) \ + $(addsuffix _skybox,$(notdir $(basename $(wildcard textures/skyboxes/*.png)))) + +# Directories containing PNG files +TEXTURE_DIRS := \ + $(wildcard textures/*/) \ + $(filter %/,$(wildcard actors/*/)) # NOTE: textures assume naming convention "texture..png" generates "texture." @@ -34,12 +41,19 @@ ACTOR_GROUPS := \ zcustom0 LEVEL_FILES := $(addsuffix leveldata,$(LEVEL_DIRS)) -MIO0_FILES := $(addprefix $(MIO0_DIR)/,$(addsuffix .mio0,$(SEGMENTS))) $(addprefix $(BUILD_DIR)/actors/,$(addsuffix .mio0,$(ACTOR_GROUPS))) $(addprefix $(BUILD_DIR)/levels/,$(addsuffix .mio0,$(LEVEL_FILES))) + +SEG_FILES := \ + $(SEGMENTS:%=$(BUILD_DIR)/bin/%.elf) \ + $(ACTOR_GROUPS:%=$(BUILD_DIR)/actors/%.elf) \ + $(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.elf) + +MIO0_FILES := \ + $(SEGMENTS:%=$(BUILD_DIR)/bin/%.mio0) \ + $(ACTOR_GROUPS:%=$(BUILD_DIR)/actors/%.mio0) \ + $(LEVEL_FILES:%=$(BUILD_DIR)/levels/%.mio0) + MIO0_OBJ_FILES := $(MIO0_FILES:.mio0=.mio0.o) -SEGMENT_ELF_FILES := $(addprefix $(BUILD_DIR)/bin/,$(addsuffix .elf,$(SEGMENTS))) -ACTOR_ELF_FILES := $(addprefix $(BUILD_DIR)/actors/,$(addsuffix .elf,$(ACTOR_GROUPS))) -LEVEL_ELF_FILES := $(addprefix $(BUILD_DIR)/levels/,$(addsuffix .elf,$(LEVEL_FILES))) # -------------------------------------- # Actor Rules @@ -83,65 +97,65 @@ ZCUSTOM_DIRS += waluigi CUSTOM_DIRS += wario_cap ZCUSTOM_DIRS += wario -# Actor Files -CUSTOM_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(CUSTOM_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -AMP_CHUCKYA_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(AMP_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -BOBOMBS_BUBBLE_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(KING_BOBOMB_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -BOO_BOOKEND_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(BOO_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -CAPSWITCH_SPRINGBOARD_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(CAPSWITCH_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -COINS_PIPE_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(COINS_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -BOWSER_FLAMES_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(BOWSER_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -BUBBA_WIGGLER_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(BUBBA_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -BULLY_BLARGG_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(BULLY_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -CHILLYCHIEF_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(CHILLYCHIEF_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -HOOT_THWOMP_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(HOOT_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -KOOPA_LOG_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(KOOPA_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -KLEPTO_EYEROK_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(KLEPTO_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -LAKITU_TOAD_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(LAKITU_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -MARIO_WATER_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(MARIO_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -MOLE_UKIKI_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(MOLE_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -MR_I_SWOOP_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(MR_I_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -PEACH_TOADSTOOL_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(PEACH_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -SEA_CREATURES_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(SEA_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -SKEETER_FISH_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(SKEETER_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -SPINDRIFT_PENGUIN_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(SPINDRIFT_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) -ZCUSTOM_FILES := $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(ZCUSTOM_DIRS)),$(patsubst %.png,%.inc.c,$(wildcard $(dir)/*.png))) +# Actor Textures +CUSTOM_TEXTURES := $(foreach dir,$(CUSTOM_DIRS), $(wildcard actors/$(dir)/*.png)) +AMP_CHUCKYA_TEXTURES := $(foreach dir,$(AMP_DIRS), $(wildcard actors/$(dir)/*.png)) +BOBOMBS_BUBBLE_TEXTURES := $(foreach dir,$(KING_BOBOMB_DIRS),$(wildcard actors/$(dir)/*.png)) +BOO_BOOKEND_TEXTURES := $(foreach dir,$(BOO_DIRS), $(wildcard actors/$(dir)/*.png)) +CAPSWITCH_SPRINGBOARD_TEXTURES := $(foreach dir,$(CAPSWITCH_DIRS), $(wildcard actors/$(dir)/*.png)) +COINS_PIPE_TEXTURES := $(foreach dir,$(COINS_DIRS), $(wildcard actors/$(dir)/*.png)) +BOWSER_FLAMES_TEXTURES := $(foreach dir,$(BOWSER_DIRS), $(wildcard actors/$(dir)/*.png)) +BUBBA_WIGGLER_TEXTURES := $(foreach dir,$(BUBBA_DIRS), $(wildcard actors/$(dir)/*.png)) +BULLY_BLARGG_TEXTURES := $(foreach dir,$(BULLY_DIRS), $(wildcard actors/$(dir)/*.png)) +CHILLYCHIEF_TEXTURES := $(foreach dir,$(CHILLYCHIEF_DIRS),$(wildcard actors/$(dir)/*.png)) +HOOT_THWOMP_TEXTURES := $(foreach dir,$(HOOT_DIRS), $(wildcard actors/$(dir)/*.png)) +KOOPA_LOG_TEXTURES := $(foreach dir,$(KOOPA_DIRS), $(wildcard actors/$(dir)/*.png)) +KLEPTO_EYEROK_TEXTURES := $(foreach dir,$(KLEPTO_DIRS), $(wildcard actors/$(dir)/*.png)) +LAKITU_TOAD_TEXTURES := $(foreach dir,$(LAKITU_DIRS), $(wildcard actors/$(dir)/*.png)) +MARIO_WATER_TEXTURES := $(foreach dir,$(MARIO_DIRS), $(wildcard actors/$(dir)/*.png)) +MOLE_UKIKI_TEXTURES := $(foreach dir,$(MOLE_DIRS), $(wildcard actors/$(dir)/*.png)) +MR_I_SWOOP_TEXTURES := $(foreach dir,$(MR_I_DIRS), $(wildcard actors/$(dir)/*.png)) +PEACH_TOADSTOOL_TEXTURES := $(foreach dir,$(PEACH_DIRS), $(wildcard actors/$(dir)/*.png)) +SEA_CREATURES_TEXTURES := $(foreach dir,$(SEA_DIRS), $(wildcard actors/$(dir)/*.png)) +SKEETER_FISH_TEXTURES := $(foreach dir,$(SKEETER_DIRS), $(wildcard actors/$(dir)/*.png)) +SPINDRIFT_PENGUIN_TEXTURES := $(foreach dir,$(SPINDRIFT_DIRS), $(wildcard actors/$(dir)/*.png)) +ZCUSTOM_TEXTURES := $(foreach dir,$(ZCUSTOM_DIRS), $(wildcard actors/$(dir)/*.png)) # Actor dependencies -$(BUILD_DIR)/actors/group0.o: $(addprefix $(BUILD_DIR)/,$(MARIO_WATER_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(MARIO_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group1.o: $(addprefix $(BUILD_DIR)/,$(HOOT_THWOMP_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(HOOT_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group2.o: $(addprefix $(BUILD_DIR)/,$(BULLY_BLARGG_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(BULLY_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group3.o: $(addprefix $(BUILD_DIR)/,$(BOBOMBS_BUBBLE_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(KING_BOBOMB_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group4.o: $(addprefix $(BUILD_DIR)/,$(SEA_CREATURES_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(SEA_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group5.o: $(addprefix $(BUILD_DIR)/,$(KLEPTO_EYEROK_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(KLEPTO_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group6.o: $(addprefix $(BUILD_DIR)/,$(MOLE_UKIKI_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(MOLE_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group7.o: $(addprefix $(BUILD_DIR)/,$(SPINDRIFT_PENGUIN_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(SPINDRIFT_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group8.o: $(addprefix $(BUILD_DIR)/,$(CAPSWITCH_SPRINGBOARD_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(CAPSWITCH_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group9.o: $(addprefix $(BUILD_DIR)/,$(BOO_BOOKEND_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(BOO_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group10.o: $(addprefix $(BUILD_DIR)/,$(PEACH_TOADSTOOL_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(PEACH_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group11.o: $(addprefix $(BUILD_DIR)/,$(BUBBA_WIGGLER_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(BUBBA_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group12.o: $(addprefix $(BUILD_DIR)/,$(BOWSER_FLAMES_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(BOWSER_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group13.o: $(addprefix $(BUILD_DIR)/,$(SKEETER_FISH_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(SKEETER_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group14.o: $(addprefix $(BUILD_DIR)/,$(KOOPA_LOG_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(KOOPA_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group15.o: $(addprefix $(BUILD_DIR)/,$(LAKITU_TOAD_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(LAKITU_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group16.o: $(addprefix $(BUILD_DIR)/,$(CHILLYCHIEF_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(CHILLYCHIEF_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/group17.o: $(addprefix $(BUILD_DIR)/,$(MR_I_SWOOP_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(MR_I_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/common0.o: $(addprefix $(BUILD_DIR)/,$(AMP_CHUCKYA_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(AMP_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/common1.o: $(addprefix $(BUILD_DIR)/,$(COINS_PIPE_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(COINS_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/custom0.o: | $(BUILD_DIR)/actors/common1.o $(addprefix $(BUILD_DIR)/,$(CUSTOM_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(CUSTOM_DIRS)),$(wildcard $(dir)/*.c)) -$(BUILD_DIR)/actors/zcustom0.o:| $(BUILD_DIR)/actors/group0.o $(addprefix $(BUILD_DIR)/,$(ZCUSTOM_FILES)) $(foreach dir,$(addprefix $(ACTOR_DIR)/,$(ZCUSTOM_DIRS)),$(wildcard $(dir)/*.c)) +$(BUILD_DIR)/actors/group0.o: $(MARIO_WATER_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group1.o: $(HOOT_THWOMP_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group2.o: $(BULLY_BLARGG_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group3.o: $(BOBOMBS_BUBBLE_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group4.o: $(SEA_CREATURES_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group5.o: $(KLEPTO_EYEROK_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group6.o: $(MOLE_UKIKI_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group7.o: $(SPINDRIFT_PENGUIN_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group8.o: $(CAPSWITCH_SPRINGBOARD_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group9.o: $(BOO_BOOKEND_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group10.o: $(PEACH_TOADSTOOL_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group11.o: $(BUBBA_WIGGLER_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group12.o: $(BOWSER_FLAMES_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group13.o: $(SKEETER_FISH_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group14.o: $(KOOPA_LOG_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group15.o: $(LAKITU_TOAD_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group16.o: $(CHILLYCHIEF_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/group17.o: $(MR_I_SWOOP_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/common0.o: $(AMP_CHUCKYA_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/common1.o: $(COINS_PIPE_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/custom0.o: $(CUSTOM_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/actors/zcustom0.o: $(ZCUSTOM_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) # Actor Elf Files -$(BUILD_DIR)/actors/group0.elf: SEGMENT_ADDRESS := 0x04000000 -$(BUILD_DIR)/actors/group1.elf: SEGMENT_ADDRESS := 0x05000000 -$(BUILD_DIR)/actors/group2.elf: SEGMENT_ADDRESS := 0x05000000 -$(BUILD_DIR)/actors/group3.elf: SEGMENT_ADDRESS := 0x05000000 -$(BUILD_DIR)/actors/group4.elf: SEGMENT_ADDRESS := 0x05000000 -$(BUILD_DIR)/actors/group5.elf: SEGMENT_ADDRESS := 0x05000000 -$(BUILD_DIR)/actors/group6.elf: SEGMENT_ADDRESS := 0x05000000 -$(BUILD_DIR)/actors/group7.elf: SEGMENT_ADDRESS := 0x05000000 -$(BUILD_DIR)/actors/group8.elf: SEGMENT_ADDRESS := 0x05000000 -$(BUILD_DIR)/actors/group9.elf: SEGMENT_ADDRESS := 0x05000000 +$(BUILD_DIR)/actors/group0.elf: SEGMENT_ADDRESS := 0x04000000 +$(BUILD_DIR)/actors/group1.elf: SEGMENT_ADDRESS := 0x05000000 +$(BUILD_DIR)/actors/group2.elf: SEGMENT_ADDRESS := 0x05000000 +$(BUILD_DIR)/actors/group3.elf: SEGMENT_ADDRESS := 0x05000000 +$(BUILD_DIR)/actors/group4.elf: SEGMENT_ADDRESS := 0x05000000 +$(BUILD_DIR)/actors/group5.elf: SEGMENT_ADDRESS := 0x05000000 +$(BUILD_DIR)/actors/group6.elf: SEGMENT_ADDRESS := 0x05000000 +$(BUILD_DIR)/actors/group7.elf: SEGMENT_ADDRESS := 0x05000000 +$(BUILD_DIR)/actors/group8.elf: SEGMENT_ADDRESS := 0x05000000 +$(BUILD_DIR)/actors/group9.elf: SEGMENT_ADDRESS := 0x05000000 $(BUILD_DIR)/actors/group10.elf: SEGMENT_ADDRESS := 0x05000000 $(BUILD_DIR)/actors/group11.elf: SEGMENT_ADDRESS := 0x05000000 $(BUILD_DIR)/actors/group12.elf: SEGMENT_ADDRESS := 0x06000000 @@ -172,7 +186,8 @@ endef ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),distclean) $(BUILD_DIR)/level_rules.mk: levels/level_rules.mk levels/level_defines.h - $(CPP) $(VERSION_CFLAGS) -I . $(EXTRA_INCLUDES) -o $@ $< + @$(PRINT) "$(GREEN)Preprocessing level make rules: $(BLUE)$@ $(NO_COL)\n" + @$(CPP) $(VERSION_CFLAGS) -I . $(EXTRA_INCLUDES) -o $@ $< include $(BUILD_DIR)/level_rules.mk endif endif @@ -189,80 +204,83 @@ $(eval $(call level_rules,menu,generic)) # Menu (File Select) # Ending cake textures are generated in a special way $(BUILD_DIR)/levels/ending/cake_eu.inc.c: levels/ending/cake_eu.png - $(SKYCONV) $(SKYCONV_ARGS) --type cake-eu --split $^ $(BUILD_DIR)/levels/ending + @$(PRINT) "$(GREEN)Splitting $(YELLOW)$< $(GREEN)to: $(BLUE)$@ $(NO_COL)\n" + $(V)$(SKYCONV) $(SKYCONV_ARGS) --type cake-eu --split $^ $(BUILD_DIR)/levels/ending $(BUILD_DIR)/levels/ending/cake.inc.c: levels/ending/cake.png - $(SKYCONV) $(SKYCONV_ARGS) --type cake --split $^ $(BUILD_DIR)/levels/ending + @$(PRINT) "$(GREEN)Splitting $(YELLOW)$< $(GREEN)to: $(BLUE)$@ $(NO_COL)\n" + $(V)$(SKYCONV) $(SKYCONV_ARGS) --type cake --split $^ $(BUILD_DIR)/levels/ending # -------------------------------------- # Texture Bin Rules # -------------------------------------- # Others -SEGMENT2_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/segment2/*.png)) -TITLE_SCREEN_BG_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/title_screen_bg/*.png)) -SPOOKY_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/spooky/*.png)) -GENERIC_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/generic/*.png)) -OUTSIDE_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/outside/*.png)) -SNOW_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/snow/*.png)) -EFFECT_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/effect/*.png)) -CAVE_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/cave/*.png)) -INSIDE_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/inside/*.png)) -WATER_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/water/*.png)) -FIRE_TEXTURES_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/fire/*.png)) -SKY_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/sky/*.png)) -MACHINE_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/machine/*.png)) -MOUNTAIN_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/mountain/*.png)) -GRASS_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/grass/*.png)) -CUSTOM_FONT_TITLE_FILES := $(patsubst %.png,%.inc.c,$(wildcard $(TEXTURE_DIR)/custom_font_title/*.png)) +SEGMENT2_TEXTURES := $(wildcard $(TEXTURE_DIR)/segment2/*.png) +TITLE_SCREEN_BG_TEXTURES := $(wildcard $(TEXTURE_DIR)/title_screen_bg/*.png) +SPOOKY_TEXTURES := $(wildcard $(TEXTURE_DIR)/spooky/*.png) +GENERIC_TEXTURES := $(wildcard $(TEXTURE_DIR)/generic/*.png) +OUTSIDE_TEXTURES := $(wildcard $(TEXTURE_DIR)/outside/*.png) +SNOW_TEXTURES := $(wildcard $(TEXTURE_DIR)/snow/*.png) +EFFECT_TEXTURES := $(wildcard $(TEXTURE_DIR)/effect/*.png) +CAVE_TEXTURES := $(wildcard $(TEXTURE_DIR)/cave/*.png) +INSIDE_TEXTURES := $(wildcard $(TEXTURE_DIR)/inside/*.png) +WATER_TEXTURES := $(wildcard $(TEXTURE_DIR)/water/*.png) +FIRE_TEXTURES_TEXTURES := $(wildcard $(TEXTURE_DIR)/fire/*.png) +SKY_TEXTURES := $(wildcard $(TEXTURE_DIR)/sky/*.png) +MACHINE_TEXTURES := $(wildcard $(TEXTURE_DIR)/machine/*.png) +MOUNTAIN_TEXTURES := $(wildcard $(TEXTURE_DIR)/mountain/*.png) +GRASS_TEXTURES := $(wildcard $(TEXTURE_DIR)/grass/*.png) +CUSTOM_FONT_TITLE_TEXTURES := $(wildcard $(TEXTURE_DIR)/custom_font_title/*.png) # Texture Files -$(BUILD_DIR)/bin/segment2.o: $(addprefix $(BUILD_DIR)/,$(SEGMENT2_FILES)) -$(BUILD_DIR)/bin/title_screen_bg.o: $(addprefix $(BUILD_DIR)/,$(TITLE_SCREEN_BG_FILES)) -$(BUILD_DIR)/bin/spooky.o: $(addprefix $(BUILD_DIR)/,$(SPOOKY_FILES)) -$(BUILD_DIR)/bin/generic.o: $(addprefix $(BUILD_DIR)/,$(GENERIC_FILES)) -$(BUILD_DIR)/bin/outside.o: $(addprefix $(BUILD_DIR)/,$(OUTSIDE_FILES)) -$(BUILD_DIR)/bin/snow.o: $(addprefix $(BUILD_DIR)/,$(SNOW_FILES)) -$(BUILD_DIR)/bin/effect.o: $(addprefix $(BUILD_DIR)/,$(EFFECT_FILES)) -$(BUILD_DIR)/bin/cave.o: $(addprefix $(BUILD_DIR)/,$(CAVE_FILES)) -$(BUILD_DIR)/bin/inside.o: $(addprefix $(BUILD_DIR)/,$(INSIDE_FILES)) -$(BUILD_DIR)/bin/water.o: $(addprefix $(BUILD_DIR)/,$(WATER_FILES)) -$(BUILD_DIR)/bin/fire.o: $(addprefix $(BUILD_DIR)/,$(FIRE_TEXTURES_FILES)) -$(BUILD_DIR)/bin/sky.o: $(addprefix $(BUILD_DIR)/,$(SKY_FILES)) -$(BUILD_DIR)/bin/machine.o: $(addprefix $(BUILD_DIR)/,$(MACHINE_FILES)) -$(BUILD_DIR)/bin/mountain.o: $(addprefix $(BUILD_DIR)/,$(MOUNTAIN_FILES)) -$(BUILD_DIR)/bin/grass.o: $(addprefix $(BUILD_DIR)/,$(GRASS_FILES)) -$(BUILD_DIR)/bin/custom_font_title.o: $(addprefix $(BUILD_DIR)/,$(CUSTOM_FONT_TITLE_FILES)) +$(BUILD_DIR)/bin/segment2.o: $(SEGMENT2_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/title_screen_bg.o: $(TITLE_SCREEN_BG_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/spooky.o: $(SPOOKY_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/generic.o: $(GENERIC_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/outside.o: $(OUTSIDE_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/snow.o: $(SNOW_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/effect.o: $(EFFECT_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/cave.o: $(CAVE_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/inside.o: $(INSIDE_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/water.o: $(WATER_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/fire.o: $(FIRE_TEXTURES_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/sky.o: $(SKY_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/machine.o: $(MACHINE_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/mountain.o: $(MOUNTAIN_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/grass.o: $(GRASS_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) +$(BUILD_DIR)/bin/custom_font_title.o: $(CUSTOM_FONT_TITLE_TEXTURES:%.png=$(BUILD_DIR)/%.inc.c) # Others -$(BUILD_DIR)/bin/segment2.elf: SEGMENT_ADDRESS := 0x02000000 -$(BUILD_DIR)/bin/title_screen_bg.elf: SEGMENT_ADDRESS := 0x0A000000 +$(BUILD_DIR)/bin/segment2.elf: SEGMENT_ADDRESS := 0x02000000 +$(BUILD_DIR)/bin/title_screen_bg.elf: SEGMENT_ADDRESS := 0x0A000000 $(BUILD_DIR)/bin/debug_level_select.elf: SEGMENT_ADDRESS := 0x07000000 -$(BUILD_DIR)/bin/effect.elf: SEGMENT_ADDRESS := 0x0B000000 -$(BUILD_DIR)/bin/spooky.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/generic.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/outside.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/snow.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/cave.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/inside.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/water.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/fire.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/sky.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/machine.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/mountain.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/grass.elf: SEGMENT_ADDRESS := 0x09000000 -$(BUILD_DIR)/bin/custom_font_title.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/effect.elf: SEGMENT_ADDRESS := 0x0B000000 +$(BUILD_DIR)/bin/spooky.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/generic.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/outside.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/snow.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/cave.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/inside.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/water.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/fire.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/sky.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/machine.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/mountain.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/grass.elf: SEGMENT_ADDRESS := 0x09000000 +$(BUILD_DIR)/bin/custom_font_title.elf: SEGMENT_ADDRESS := 0x09000000 # EU segment 19 translations -$(BUILD_DIR)/bin/eu/translation_de.elf: SEGMENT_ADDRESS := 0x19000000 -$(BUILD_DIR)/bin/eu/translation_en.elf: SEGMENT_ADDRESS := 0x19000000 -$(BUILD_DIR)/bin/eu/translation_fr.elf: SEGMENT_ADDRESS := 0x19000000 +$(BUILD_DIR)/bin/eu/translation_de.elf: SEGMENT_ADDRESS := 0x19000000 +$(BUILD_DIR)/bin/eu/translation_en.elf: SEGMENT_ADDRESS := 0x19000000 +$(BUILD_DIR)/bin/eu/translation_fr.elf: SEGMENT_ADDRESS := 0x19000000 # -------------------------------------- # Skybox Rules # -------------------------------------- $(BUILD_DIR)/bin/%_skybox.c: textures/skyboxes/%.png - $(SKYCONV) $(SKYCONV_ARGS) --type sky --split $^ $(BUILD_DIR)/bin + @$(PRINT) "$(GREEN)Splitting $(YELLOW)$< $(GREEN)to: $(BLUE)$@ $(NO_COL)\n" + $(V)$(SKYCONV) $(SKYCONV_ARGS) --type sky --split $^ $(BUILD_DIR)/bin $(BUILD_DIR)/bin/%_skybox.elf: SEGMENT_ADDRESS := 0x0A000000 diff --git a/README.md b/README.md index 3bc4b136..02b1604a 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,4 @@ Create a mod for the PC port where multiple people can play online together. Unlike previous online attempts, this one synchronized enemies and events. This allows player to be interacting with the same world at the same time. ## Discord -[https://discord.gg/TJVKHS4](https://discord.gg/TJVKHS4) \ No newline at end of file +[https://discord.gg/TJVKHS4](https://discord.gg/TJVKHS4) diff --git a/actors/amp/model.inc.c b/actors/amp/model.inc.c index 094a6f12..15745bd0 100644 --- a/actors/amp/model.inc.c +++ b/actors/amp/model.inc.c @@ -1,22 +1,22 @@ // Amp // 0x08000F18 -ALIGNED8 static const u8 amp_seg8_texture_08000F18[] = { +ALIGNED8 static const Texture amp_seg8_texture_08000F18[] = { #include "actors/amp/amp_electricity.rgba16.inc.c" }; // 0x08001318 -ALIGNED8 static const u8 amp_seg8_texture_08001318[] = { +ALIGNED8 static const Texture amp_seg8_texture_08001318[] = { #include "actors/amp/amp_eyes.rgba16.inc.c" }; // 0x08001B18 -ALIGNED8 static const u8 amp_seg8_texture_08001B18[] = { +ALIGNED8 static const Texture amp_seg8_texture_08001B18[] = { #include "actors/amp/amp_body.rgba16.inc.c" }; // 0x08002318 -ALIGNED8 static const u8 amp_seg8_texture_08002318[] = { +ALIGNED8 static const Texture amp_seg8_texture_08002318[] = { #include "actors/amp/amp_mouth.rgba16.inc.c" }; diff --git a/actors/blue_coin_switch/model.inc.c b/actors/blue_coin_switch/model.inc.c index f83d5a2a..bb5c89fd 100644 --- a/actors/blue_coin_switch/model.inc.c +++ b/actors/blue_coin_switch/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 blue_coin_switch_seg8_lights_08000000 = gdSPDefLights1( ); // 0x08000018 -ALIGNED8 static const u8 blue_coin_switch_seg8_texture_08000018[] = { +ALIGNED8 static const Texture blue_coin_switch_seg8_texture_08000018[] = { #include "actors/blue_coin_switch/blue_coin_switch_side.rgba16.inc.c" }; // 0x08000418 -ALIGNED8 static const u8 blue_coin_switch_seg8_texture_08000418[] = { +ALIGNED8 static const Texture blue_coin_switch_seg8_texture_08000418[] = { #include "actors/blue_coin_switch/blue_coin_switch_top.rgba16.inc.c" }; diff --git a/actors/blue_fish/model.inc.c b/actors/blue_fish/model.inc.c index a1a7da13..3545358a 100644 --- a/actors/blue_fish/model.inc.c +++ b/actors/blue_fish/model.inc.c @@ -7,7 +7,7 @@ static const Lights1 blue_fish_seg3_lights_0301B5C8 = gdSPDefLights1( ); // 0x0301B5E0 -ALIGNED8 static const u8 blue_fish_seg3_texture_0301B5E0[] = { +ALIGNED8 static const Texture blue_fish_seg3_texture_0301B5E0[] = { #include "actors/blue_fish/blue_fish.rgba16.inc.c" }; diff --git a/actors/bobomb/model.inc.c b/actors/bobomb/model.inc.c index 27aea98f..b4f56adb 100644 --- a/actors/bobomb/model.inc.c +++ b/actors/bobomb/model.inc.c @@ -1,32 +1,32 @@ // Bobomb // 0x0801DA60 -ALIGNED8 static const u8 bobomb_seg8_texture_0801DA60[] = { +ALIGNED8 static const Texture bobomb_seg8_texture_0801DA60[] = { #include "actors/bobomb/bob-omb_left_side.rgba16.inc.c" }; // 0x0801EA60 -ALIGNED8 static const u8 bobomb_seg8_texture_0801EA60[] = { +ALIGNED8 static const Texture bobomb_seg8_texture_0801EA60[] = { #include "actors/bobomb/bob-omb_right_side.rgba16.inc.c" }; // 0x0801FA60 -ALIGNED8 static const u8 bobomb_seg8_texture_0801FA60[] = { +ALIGNED8 static const Texture bobomb_seg8_texture_0801FA60[] = { #include "actors/bobomb/bob-omb_buddy_left_side.rgba16.inc.c" }; // 0x08020A60 -ALIGNED8 static const u8 bobomb_seg8_texture_08020A60[] = { +ALIGNED8 static const Texture bobomb_seg8_texture_08020A60[] = { #include "actors/bobomb/bob-omb_buddy_right_side.rgba16.inc.c" }; // 0x08021A60 -ALIGNED8 static const u8 bobomb_seg8_texture_08021A60[] = { +ALIGNED8 static const Texture bobomb_seg8_texture_08021A60[] = { #include "actors/bobomb/bob-omb_eyes.rgba16.inc.c" }; // 0x08022260 -ALIGNED8 static const u8 bobomb_seg8_texture_08022260[] = { +ALIGNED8 static const Texture bobomb_seg8_texture_08022260[] = { #include "actors/bobomb/bob-omb_eyes_blink.rgba16.inc.c" }; diff --git a/actors/bomb/model.inc.c b/actors/bomb/model.inc.c index 14e15a35..9ccb342a 100644 --- a/actors/bomb/model.inc.c +++ b/actors/bomb/model.inc.c @@ -7,17 +7,17 @@ static const Lights1 bomb_seg6_lights_06057AA8 = gdSPDefLights1( ); // 0x06057AC0 -ALIGNED8 static const u8 bomb_seg6_texture_06057AC0[] = { +ALIGNED8 static const Texture bomb_seg6_texture_06057AC0[] = { #include "actors/bomb/bomb_left_side.rgba16.inc.c" }; // 0x06058AC0 -ALIGNED8 static const u8 bomb_seg6_texture_06058AC0[] = { +ALIGNED8 static const Texture bomb_seg6_texture_06058AC0[] = { #include "actors/bomb/bomb_right_side.rgba16.inc.c" }; // 0x06059AC0 -ALIGNED8 static const u8 bomb_seg6_texture_06059AC0[] = { +ALIGNED8 static const Texture bomb_seg6_texture_06059AC0[] = { #include "actors/bomb/bomb_spike.rgba16.inc.c" }; diff --git a/actors/boo/model.inc.c b/actors/boo/model.inc.c index 40ce7824..8d77221e 100644 --- a/actors/boo/model.inc.c +++ b/actors/boo/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 boo_seg5_lights_05009B28 = gdSPDefLights1( ); // 0x05009B40 -ALIGNED8 static const u8 boo_seg5_texture_05009B40[] = { +ALIGNED8 static const Texture boo_seg5_texture_05009B40[] = { #include "actors/boo/boo_eyes.rgba16.inc.c" }; // 0x0500AB40 -ALIGNED8 static const u8 boo_seg5_texture_0500AB40[] = { +ALIGNED8 static const Texture boo_seg5_texture_0500AB40[] = { #include "actors/boo/boo_mouth.rgba16.inc.c" }; diff --git a/actors/boo_castle/model.inc.c b/actors/boo_castle/model.inc.c index 68c3a460..24506c4b 100644 --- a/actors/boo_castle/model.inc.c +++ b/actors/boo_castle/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 boo_castle_seg6_lights_06015658 = gdSPDefLights1( ); // 0x06015670 -ALIGNED8 static const u8 boo_castle_seg6_texture_06015670[] = { +ALIGNED8 static const Texture boo_castle_seg6_texture_06015670[] = { #include "actors/boo_castle/bbh_boo_eyes.rgba16.inc.c" }; // 0x06016670 -ALIGNED8 static const u8 boo_castle_seg6_texture_06016670[] = { +ALIGNED8 static const Texture boo_castle_seg6_texture_06016670[] = { #include "actors/boo_castle/bbh_boo_mouth.rgba16.inc.c" }; diff --git a/actors/book/model.inc.c b/actors/book/model.inc.c index 80b4f23d..309d7f7e 100644 --- a/actors/book/model.inc.c +++ b/actors/book/model.inc.c @@ -9,7 +9,7 @@ static const Lights1 book_seg5_lights_05002558 = gdSPDefLights1( ); // 0x05002570 -ALIGNED8 static const u8 book_seg5_texture_05002570[] = { +ALIGNED8 static const Texture book_seg5_texture_05002570[] = { #include "actors/book/book_cover.rgba16.inc.c" }; diff --git a/actors/bookend/model.inc.c b/actors/bookend/model.inc.c index 3796ec0d..02d862e8 100644 --- a/actors/bookend/model.inc.c +++ b/actors/bookend/model.inc.c @@ -25,27 +25,27 @@ UNUSED static const Lights1 bookend_lights_unused4 = gdSPDefLights1( ); // 0x05000060 -ALIGNED8 static const u8 bookend_seg5_texture_05000060[] = { +ALIGNED8 static const Texture bookend_seg5_texture_05000060[] = { #include "actors/bookend/bookend_spine.rgba16.inc.c" }; // 0x05000460 -ALIGNED8 static const u8 bookend_seg5_texture_05000460[] = { +ALIGNED8 static const Texture bookend_seg5_texture_05000460[] = { #include "actors/bookend/bookend_tooth.rgba16.inc.c" }; // 0x05000860 -ALIGNED8 static const u8 bookend_seg5_texture_05000860[] = { +ALIGNED8 static const Texture bookend_seg5_texture_05000860[] = { #include "actors/bookend/bookend_mouth.rgba16.inc.c" }; // 0x05000C60 -ALIGNED8 static const u8 bookend_seg5_texture_05000C60[] = { +ALIGNED8 static const Texture bookend_seg5_texture_05000C60[] = { #include "actors/bookend/bookend_pages.rgba16.inc.c" }; // 0x05001060 -ALIGNED8 static const u8 bookend_seg5_texture_05001060[] = { +ALIGNED8 static const Texture bookend_seg5_texture_05001060[] = { #include "actors/bookend/bookend_cover.rgba16.inc.c" }; diff --git a/actors/bowser/model.inc.c b/actors/bowser/model.inc.c index c4f78399..69a0b083 100644 --- a/actors/bowser/model.inc.c +++ b/actors/bowser/model.inc.c @@ -1,149 +1,149 @@ // Bowser (King Koopa) // 0x0601F438 -ALIGNED8 static const u8 bowser_seg6_texture_0601F438[] = { +ALIGNED8 static const Texture bowser_seg6_texture_0601F438[] = { #include "actors/bowser/bowser_shell.rgba16.inc.c" }; // 0x0601FC38 -ALIGNED8 static const u8 bowser_seg6_texture_0601FC38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_0601FC38[] = { #include "actors/bowser/bowser_eyebrow.rgba16.inc.c" }; // 0x06020C38 -ALIGNED8 static const u8 bowser_seg6_texture_06020C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06020C38[] = { #include "actors/bowser/bowser_muzzle.rgba16.inc.c" }; // 0x06021438 -ALIGNED8 static const u8 bowser_seg6_texture_06021438[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06021438[] = { #include "actors/bowser/bowser_nostrils.rgba16.inc.c" }; // 0x06022438 -ALIGNED8 static const u8 bowser_seg6_texture_06022438[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06022438[] = { #include "actors/bowser/bowser_body.rgba16.inc.c" }; // 0x06022C38 -ALIGNED8 static const u8 bowser_seg6_texture_06022C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06022C38[] = { #include "actors/bowser/bowser_armband_spike.rgba16.inc.c" }; // 0x06023C38 -ALIGNED8 static const u8 bowser_seg6_texture_06023C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06023C38[] = { #include "actors/bowser/bowser_armband.rgba16.inc.c" }; // 0x06024438 -ALIGNED8 static const u8 bowser_seg6_texture_06024438[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06024438[] = { #include "actors/bowser/bowser_tongue.rgba16.inc.c" }; // 0x06025438 -ALIGNED8 static const u8 bowser_seg6_texture_06025438[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06025438[] = { #include "actors/bowser/bowser_chest.rgba16.inc.c" }; // 0x06025C38 -ALIGNED8 static const u8 bowser_seg6_texture_06025C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06025C38[] = { #include "actors/bowser/bowser_shell_edge.rgba16.inc.c" }; // unreferenced, seen in pre-Spaceworld 1995 B-roll footage build // 0x06026438 -ALIGNED8 static const u8 bowser_seg6_texture_06026438[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06026438[] = { #include "actors/bowser/bowser_blue_eye_unused.rgba16.inc.c" }; // unreferenced (stubbed texture? possibly original texture for mouth) // 0x06027438 -ALIGNED8 static const u8 bowser_seg6_texture_06027438[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06027438[] = { #include "actors/bowser/bowser_mouth_unused.rgba16.inc.c" }; // 0x06028438 -ALIGNED8 static const u8 bowser_seg6_texture_06028438[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06028438[] = { #include "actors/bowser/bowser_upper_face.rgba16.inc.c" }; // 0x06028C38 -ALIGNED8 static const u8 bowser_seg6_texture_06028C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06028C38[] = { #include "actors/bowser/bowser_hair.rgba16.inc.c" }; // 0x06029C38 -ALIGNED8 static const u8 bowser_seg6_texture_06029C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06029C38[] = { #include "actors/bowser/bowser_claw_edge.rgba16.inc.c" }; // 0x0602AC38 -ALIGNED8 static const u8 bowser_seg6_texture_0602AC38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_0602AC38[] = { #include "actors/bowser/bowser_claw_horn_tooth.rgba16.inc.c" }; // 0x0602BC38 -ALIGNED8 static const u8 bowser_seg6_texture_0602BC38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_0602BC38[] = { #include "actors/bowser/bowser_claw_horn_angle.rgba16.inc.c" }; // 0x0602CC38 -ALIGNED8 static const u8 bowser_seg6_texture_0602CC38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_0602CC38[] = { #include "actors/bowser/bowser_eye_left_0.rgba16.inc.c" }; // 0x0602DC38 -ALIGNED8 static const u8 bowser_seg6_texture_0602DC38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_0602DC38[] = { #include "actors/bowser/bowser_eye_half_closed_0.rgba16.inc.c" }; // 0x0602EC38 -ALIGNED8 static const u8 bowser_seg6_texture_0602EC38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_0602EC38[] = { #include "actors/bowser/bowser_eye_closed_0.rgba16.inc.c" }; // 0x0602FC38 -ALIGNED8 static const u8 bowser_seg6_texture_0602FC38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_0602FC38[] = { #include "actors/bowser/bowser_eye_center_0.rgba16.inc.c" }; // 0x06030C38 -ALIGNED8 static const u8 bowser_seg6_texture_06030C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06030C38[] = { #include "actors/bowser/bowser_eye_right_0.rgba16.inc.c" }; // 0x06031C38 -ALIGNED8 static const u8 bowser_seg6_texture_06031C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06031C38[] = { #include "actors/bowser/bowser_eye_far_left_0.rgba16.inc.c" }; // 0x06032C38 -ALIGNED8 static const u8 bowser_seg6_texture_06032C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06032C38[] = { #include "actors/bowser/bowser_eye_left_1.rgba16.inc.c" }; // 0x06033C38 -ALIGNED8 static const u8 bowser_seg6_texture_06033C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06033C38[] = { #include "actors/bowser/bowser_eye_half_closed_1.rgba16.inc.c" }; // 0x06034C38 -ALIGNED8 static const u8 bowser_seg6_texture_06034C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06034C38[] = { #include "actors/bowser/bowser_eye_closed_1.rgba16.inc.c" }; // 0x06035C38 -ALIGNED8 static const u8 bowser_seg6_texture_06035C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06035C38[] = { #include "actors/bowser/bowser_eye_center_1.rgba16.inc.c" }; // 0x06036C38 -ALIGNED8 static const u8 bowser_seg6_texture_06036C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06036C38[] = { #include "actors/bowser/bowser_eye_right_1.rgba16.inc.c" }; // 0x06037C38 -ALIGNED8 static const u8 bowser_seg6_texture_06037C38[] = { +ALIGNED8 static const Texture bowser_seg6_texture_06037C38[] = { #include "actors/bowser/bowser_eye_far_left_1.rgba16.inc.c" }; diff --git a/actors/bowser_flame/model.inc.c b/actors/bowser_flame/model.inc.c index 2551342e..d93d733c 100644 --- a/actors/bowser_flame/model.inc.c +++ b/actors/bowser_flame/model.inc.c @@ -1,74 +1,74 @@ // Bowser Flame -// TODO: Are these seperate textures or unified 64x64 ones? +// TODO: These 64x64 textures are referenced as two different texture addresses in the DLs // 0x06000000 -ALIGNED8 static const u8 flame_seg6_texture_06000000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06000000[] = { #include "actors/bowser_flame/bowser_flame_0.rgba16.inc.c" }; // 0x06002000 -ALIGNED8 static const u8 flame_seg6_texture_06002000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06002000[] = { #include "actors/bowser_flame/bowser_flame_1.rgba16.inc.c" }; // 0x06004000 -ALIGNED8 static const u8 flame_seg6_texture_06004000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06004000[] = { #include "actors/bowser_flame/bowser_flame_2.rgba16.inc.c" }; // 0x06006000 -ALIGNED8 static const u8 flame_seg6_texture_06006000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06006000[] = { #include "actors/bowser_flame/bowser_flame_3.rgba16.inc.c" }; // 0x06008000 -ALIGNED8 static const u8 flame_seg6_texture_06008000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06008000[] = { #include "actors/bowser_flame/bowser_flame_4.rgba16.inc.c" }; // 0x0600A000 -ALIGNED8 static const u8 flame_seg6_texture_0600A000[] = { +ALIGNED8 static const Texture flame_seg6_texture_0600A000[] = { #include "actors/bowser_flame/bowser_flame_5.rgba16.inc.c" }; // 0x0600C000 -ALIGNED8 static const u8 flame_seg6_texture_0600C000[] = { +ALIGNED8 static const Texture flame_seg6_texture_0600C000[] = { #include "actors/bowser_flame/bowser_flame_6.rgba16.inc.c" }; // 0x0600E000 -ALIGNED8 static const u8 flame_seg6_texture_0600E000[] = { +ALIGNED8 static const Texture flame_seg6_texture_0600E000[] = { #include "actors/bowser_flame/bowser_flame_7.rgba16.inc.c" }; // 0x06010000 -ALIGNED8 static const u8 flame_seg6_texture_06010000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06010000[] = { #include "actors/bowser_flame/bowser_flame_8.rgba16.inc.c" }; // 0x06012000 -ALIGNED8 static const u8 flame_seg6_texture_06012000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06012000[] = { #include "actors/bowser_flame/bowser_flame_9.rgba16.inc.c" }; // 0x06014000 -ALIGNED8 static const u8 flame_seg6_texture_06014000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06014000[] = { #include "actors/bowser_flame/bowser_flame_10.rgba16.inc.c" }; // 0x06016000 -ALIGNED8 static const u8 flame_seg6_texture_06016000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06016000[] = { #include "actors/bowser_flame/bowser_flame_11.rgba16.inc.c" }; // 0x06018000 -ALIGNED8 static const u8 flame_seg6_texture_06018000[] = { +ALIGNED8 static const Texture flame_seg6_texture_06018000[] = { #include "actors/bowser_flame/bowser_flame_12.rgba16.inc.c" }; // 0x0601A000 -ALIGNED8 static const u8 flame_seg6_texture_0601A000[] = { +ALIGNED8 static const Texture flame_seg6_texture_0601A000[] = { #include "actors/bowser_flame/bowser_flame_13.rgba16.inc.c" }; @@ -120,6 +120,7 @@ const Gfx flame_seg6_dl_0601C108[] = { gsDPLoadTextureBlock(flame_seg6_texture_06000000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06000000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -131,6 +132,7 @@ const Gfx flame_seg6_dl_0601C1A8[] = { gsDPLoadTextureBlock(flame_seg6_texture_06002000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06002000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -142,6 +144,7 @@ const Gfx flame_seg6_dl_0601C248[] = { gsDPLoadTextureBlock(flame_seg6_texture_06004000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06004000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -153,6 +156,7 @@ const Gfx flame_seg6_dl_0601C2E8[] = { gsDPLoadTextureBlock(flame_seg6_texture_06006000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06006000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -164,6 +168,7 @@ const Gfx flame_seg6_dl_0601C388[] = { gsDPLoadTextureBlock(flame_seg6_texture_06008000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06008000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -175,6 +180,7 @@ const Gfx flame_seg6_dl_0601C428[] = { gsDPLoadTextureBlock(flame_seg6_texture_0600A000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_0600A000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -185,6 +191,8 @@ const Gfx flame_seg6_dl_0601C4C8[] = { gsSPDisplayList(flame_seg6_dl_0601C080), gsDPLoadTextureBlock(flame_seg6_texture_0600C000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), + gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_0600C000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -196,6 +204,7 @@ const Gfx flame_seg6_dl_0601C568[] = { gsDPLoadTextureBlock(flame_seg6_texture_0600E000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_0600E000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -207,6 +216,7 @@ const Gfx flame_seg6_dl_0601C608[] = { gsDPLoadTextureBlock(flame_seg6_texture_06010000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06010000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -218,6 +228,7 @@ const Gfx flame_seg6_dl_0601C6A8[] = { gsDPLoadTextureBlock(flame_seg6_texture_06012000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06012000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -229,6 +240,7 @@ const Gfx flame_seg6_dl_0601C748[] = { gsDPLoadTextureBlock(flame_seg6_texture_06014000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06014000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -240,6 +252,7 @@ const Gfx flame_seg6_dl_0601C7E8[] = { gsDPLoadTextureBlock(flame_seg6_texture_06016000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06016000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -251,6 +264,7 @@ const Gfx flame_seg6_dl_0601C888[] = { gsDPLoadTextureBlock(flame_seg6_texture_06018000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_06018000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), @@ -262,6 +276,7 @@ const Gfx flame_seg6_dl_0601C928[] = { gsDPLoadTextureBlock(flame_seg6_texture_0601A000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(flame_seg6_vertex_0601C000, 8, 0), gsSPDisplayList(flame_seg6_dl_0601C0B0), + //gsDPLoadTextureBlock((u8*)flame_seg6_texture_0601A000 + 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(flame_seg6_dl_0601C0C8), gsSPDisplayList(flame_seg6_dl_0601C0E0), gsSPEndDisplayList(), diff --git a/actors/breakable_box/model.inc.c b/actors/breakable_box/model.inc.c index a4517715..c319b300 100644 --- a/actors/breakable_box/model.inc.c +++ b/actors/breakable_box/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 breakable_box_seg8_lights_08011A80 = gdSPDefLights1( ); // 0x08011A90 -ALIGNED8 static const u8 breakable_box_seg8_texture_08011A90[] = { +ALIGNED8 static const Texture breakable_box_seg8_texture_08011A90[] = { #include "actors/breakable_box/crazy_box_surface.rgba16.inc.c" }; // 0x08012290 -ALIGNED8 static const u8 breakable_box_seg8_texture_08012290[] = { +ALIGNED8 static const Texture breakable_box_seg8_texture_08012290[] = { #include "actors/breakable_box/cork_box_surface.rgba16.inc.c" }; diff --git a/actors/bub/model.inc.c b/actors/bub/model.inc.c index 12619be5..97d570f3 100644 --- a/actors/bub/model.inc.c +++ b/actors/bub/model.inc.c @@ -13,22 +13,22 @@ static const Lights1 bub_seg6_lights_0600E290 = gdSPDefLights1( ); // 0x0600E2A8 -ALIGNED8 static const u8 bub_seg6_texture_0600E2A8[] = { +ALIGNED8 static const Texture bub_seg6_texture_0600E2A8[] = { #include "actors/bub/bub_eye_border.rgba16.inc.c" }; // 0x0600EAA8 -ALIGNED8 static const u8 bub_seg6_texture_0600EAA8[] = { +ALIGNED8 static const Texture bub_seg6_texture_0600EAA8[] = { #include "actors/bub/bub_fins.rgba16.inc.c" }; // 0x0600F2A8 -ALIGNED8 static const u8 bub_seg6_texture_0600F2A8[] = { +ALIGNED8 static const Texture bub_seg6_texture_0600F2A8[] = { #include "actors/bub/bub_eyes.rgba16.inc.c" }; // 0x060102A8 -ALIGNED8 static const u8 bub_seg6_texture_060102A8[] = { +ALIGNED8 static const Texture bub_seg6_texture_060102A8[] = { #include "actors/bub/bub_scales.rgba16.inc.c" }; diff --git a/actors/bubba/model.inc.c b/actors/bubba/model.inc.c index 1e9f31e5..5775b710 100644 --- a/actors/bubba/model.inc.c +++ b/actors/bubba/model.inc.c @@ -8,28 +8,28 @@ UNUSED static const u64 bubba_unused_1 = 0; // Bubba // 0x05000008 -ALIGNED8 static const u8 bubba_seg5_texture_05000008[] = { +ALIGNED8 static const Texture bubba_seg5_texture_05000008[] = { #include "actors/bubba/bubba_sunglasses.rgba16.inc.c" }; // unused eye texture, assumed leftover from when actor file was copied from bub // 0x05000408 -ALIGNED8 static const u8 bubba_seg5_texture_05000408[] = { +ALIGNED8 static const Texture bubba_seg5_texture_05000408[] = { #include "actors/bubba/bubba_eyes_unused.rgba16.inc.c" }; // 0x05001408 -ALIGNED8 static const u8 bubba_seg5_texture_05001408[] = { +ALIGNED8 static const Texture bubba_seg5_texture_05001408[] = { #include "actors/bubba/bubba_eye_border.rgba16.inc.c" }; // 0x05001C08 -ALIGNED8 static const u8 bubba_seg5_texture_05001C08[] = { +ALIGNED8 static const Texture bubba_seg5_texture_05001C08[] = { #include "actors/bubba/bubba_fins.rgba16.inc.c" }; // 0x05002408 -ALIGNED8 static const u8 bubba_seg5_texture_05002408[] = { +ALIGNED8 static const Texture bubba_seg5_texture_05002408[] = { #include "actors/bubba/bubba_scales.rgba16.inc.c" }; diff --git a/actors/bubble/model.inc.c b/actors/bubble/model.inc.c index 777e312a..150ee15e 100644 --- a/actors/bubble/model.inc.c +++ b/actors/bubble/model.inc.c @@ -9,12 +9,12 @@ static const Vtx bubble_seg4_vertex_0401CD20[] = { }; // 0x0401CD60 -ALIGNED8 static const u8 bubble_seg4_texture_0401CD60[] = { +ALIGNED8 static const Texture bubble_seg4_texture_0401CD60[] = { #include "actors/bubble/bubble.rgba16.inc.c" }; // 0x0401D560 -ALIGNED8 static const u8 bubble_seg4_texture_0401D560[] = { +ALIGNED8 static const Texture bubble_seg4_texture_0401D560[] = { #include "actors/bubble/mr_i_bubble.rgba16.inc.c" }; diff --git a/actors/bullet_bill/model.inc.c b/actors/bullet_bill/model.inc.c index 37635159..e54a9de9 100644 --- a/actors/bullet_bill/model.inc.c +++ b/actors/bullet_bill/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 bullet_bill_seg5_lights_0500BA90 = gdSPDefLights1( ); // 0x0500BAA8 -ALIGNED8 static const u8 bullet_bill_seg5_texture_0500BAA8[] = { +ALIGNED8 static const Texture bullet_bill_seg5_texture_0500BAA8[] = { #include "actors/bullet_bill/bullet_bill_eye.rgba16.inc.c" }; // 0x0500CAA8 -ALIGNED8 static const u8 bullet_bill_seg5_texture_0500CAA8[] = { +ALIGNED8 static const Texture bullet_bill_seg5_texture_0500CAA8[] = { #include "actors/bullet_bill/bullet_bill_mouth.rgba16.inc.c" }; diff --git a/actors/bully/model.inc.c b/actors/bully/model.inc.c index 5573946e..8eaf7e73 100644 --- a/actors/bully/model.inc.c +++ b/actors/bully/model.inc.c @@ -19,7 +19,7 @@ static const Vtx bully_seg5_vertex_05000000[] = { }; // 0x050000E0 -ALIGNED8 static const u8 bully_seg5_texture_050000E0[] = { +ALIGNED8 static const Texture bully_seg5_texture_050000E0[] = { #include "actors/bully/bully_horn.rgba16.inc.c" }; @@ -85,17 +85,17 @@ static const Lights1 bully_seg5_lights_05000450 = gdSPDefLights1( // //! There's another malformed light entry here. // 0x05000468 -ALIGNED8 static const u8 bully_seg5_texture_05000468[] = { +ALIGNED8 static const Texture bully_seg5_texture_05000468[] = { #include "actors/bully/bully_left_side.rgba16.inc.c" }; // 0x05001468 -ALIGNED8 static const u8 bully_seg5_texture_05001468[] = { +ALIGNED8 static const Texture bully_seg5_texture_05001468[] = { #include "actors/bully/bully_right_side.rgba16.inc.c" }; // 0x05002468 -ALIGNED8 static const u8 bully_seg5_texture_05002468[] = { +ALIGNED8 static const Texture bully_seg5_texture_05002468[] = { #include "actors/bully/bully_eye.rgba16.inc.c" }; @@ -355,7 +355,7 @@ const Gfx bully_seg5_dl_050037A0[] = { // 0x05003838 - 0x05003878 const Gfx bully_seg5_dl_05003838[] = { - gsSPLight(bully_seg5_texture_05000468 + 0x8, 1), // yet another malformed light... + gsSPLight((u8*)bully_seg5_texture_05000468 + 0x8, 1), //! yet another malformed light... gsSPLight(bully_seg5_texture_05000468, 2), gsSPVertex(bully_seg5_vertex_05002EA8, 6, 0), gsSP2Triangles( 0, 1, 2, 0x0, 0, 2, 3, 0x0), diff --git a/actors/burn_smoke/model.inc.c b/actors/burn_smoke/model.inc.c index bcf4fd6f..be50055a 100644 --- a/actors/burn_smoke/model.inc.c +++ b/actors/burn_smoke/model.inc.c @@ -15,7 +15,7 @@ static const Vtx burn_smoke_seg4_vertex_040217C0[] = { // said fix is on a compile-time variable. Use TEXTURE_FIX=1 at compile time // to fix this. // 0x04021800 -ALIGNED8 static const u8 burn_smoke_seg4_texture_04021800[] = { +ALIGNED8 static const Texture burn_smoke_seg4_texture_04021800[] = { #include "actors/burn_smoke/burn_smoke.ia16.inc.c" }; diff --git a/actors/butterfly/model.inc.c b/actors/butterfly/model.inc.c index f4d8f133..575f6187 100644 --- a/actors/butterfly/model.inc.c +++ b/actors/butterfly/model.inc.c @@ -11,7 +11,7 @@ static const Vtx butterfly_seg3_vertex_03004348[] = { }; // 0x030043A8 -ALIGNED8 static const u8 butterfly_seg3_texture_030043A8[] = { +ALIGNED8 static const Texture butterfly_seg3_texture_030043A8[] = { #include "actors/butterfly/butterfly_wing.rgba16.inc.c" }; diff --git a/actors/cannon_barrel/model.inc.c b/actors/cannon_barrel/model.inc.c index aee370dc..de69ffff 100644 --- a/actors/cannon_barrel/model.inc.c +++ b/actors/cannon_barrel/model.inc.c @@ -13,7 +13,7 @@ static const Lights1 cannon_barrel_seg8_lights_08005890 = gdSPDefLights1( ); // 0x080058A8 -ALIGNED8 static const u8 cannon_barrel_seg8_texture_080058A8[] = { +ALIGNED8 static const Texture cannon_barrel_seg8_texture_080058A8[] = { #include "actors/cannon_barrel/cannon_barrel.rgba16.inc.c" }; diff --git a/actors/cannon_base/model.inc.c b/actors/cannon_base/model.inc.c index ebf45806..61816de6 100644 --- a/actors/cannon_base/model.inc.c +++ b/actors/cannon_base/model.inc.c @@ -13,7 +13,7 @@ static const Lights1 cannon_base_seg8_lights_080049A0 = gdSPDefLights1( ); // 0x080049B8 -ALIGNED8 static const u8 cannon_base_seg8_texture_080049B8[] = { +ALIGNED8 static const Texture cannon_base_seg8_texture_080049B8[] = { #include "actors/cannon_base/cannon_base.rgba16.inc.c" }; diff --git a/actors/cannon_lid/model.inc.c b/actors/cannon_lid/model.inc.c index 36edb684..96e4ecc9 100644 --- a/actors/cannon_lid/model.inc.c +++ b/actors/cannon_lid/model.inc.c @@ -7,7 +7,7 @@ static const Lights1 cannon_lid_seg8_lights_08004040 = gdSPDefLights1( ); // 0x08004058 -ALIGNED8 static const u8 cannon_lid_seg8_texture_08004058[] = { +ALIGNED8 static const Texture cannon_lid_seg8_texture_08004058[] = { #include "actors/cannon_lid/cannon_lid.rgba16.inc.c" }; diff --git a/actors/capswitch/model.inc.c b/actors/capswitch/model.inc.c index 5adca94a..2f3f0cd5 100644 --- a/actors/capswitch/model.inc.c +++ b/actors/capswitch/model.inc.c @@ -37,12 +37,12 @@ static const Lights1 capswitch_seg5_lights_05001C30 = gdSPDefLights1( ); // 0x05001C48 -ALIGNED8 static const u8 capswitch_seg5_texture_05001C48[] = { +ALIGNED8 static const Texture capswitch_seg5_texture_05001C48[] = { #include "actors/capswitch/cap_switch_head.ia16.inc.c" }; // 0x05002C48 -ALIGNED8 static const u8 capswitch_seg5_texture_05002C48[] = { +ALIGNED8 static const Texture capswitch_seg5_texture_05002C48[] = { #include "actors/capswitch/cap_switch_base.rgba16.inc.c" }; diff --git a/actors/chain_ball/model.inc.c b/actors/chain_ball/model.inc.c index 4754876f..cd0a92bd 100644 --- a/actors/chain_ball/model.inc.c +++ b/actors/chain_ball/model.inc.c @@ -13,7 +13,7 @@ static const Vtx chain_ball_seg6_vertex_06020AA0[] = { UNUSED static const u64 chain_ball_unused_1 = 0; // 0x06020AE8 -ALIGNED8 static const u8 chain_ball_seg6_texture_06020AE8[] = { +ALIGNED8 static const Texture chain_ball_seg6_texture_06020AE8[] = { #include "actors/chain_ball/chain_ball.rgba16.inc.c" }; diff --git a/actors/chain_chomp/model.inc.c b/actors/chain_chomp/model.inc.c index e7e39abf..1f8bab63 100644 --- a/actors/chain_chomp/model.inc.c +++ b/actors/chain_chomp/model.inc.c @@ -19,27 +19,27 @@ UNUSED static const Lights1 chain_chomp_lights_unused3 = gdSPDefLights1( ); // 0x060213D0 -ALIGNED8 static const u8 chain_chomp_seg6_texture_060213D0[] = { +ALIGNED8 static const Texture chain_chomp_seg6_texture_060213D0[] = { #include "actors/chain_chomp/chain_chomp_bright_shine.rgba16.inc.c" }; // 0x06021BD0 -ALIGNED8 static const u8 chain_chomp_seg6_texture_06021BD0[] = { +ALIGNED8 static const Texture chain_chomp_seg6_texture_06021BD0[] = { #include "actors/chain_chomp/chain_chomp_dull_shine.rgba16.inc.c" }; // 0x060223D0 -ALIGNED8 static const u8 chain_chomp_seg6_texture_060223D0[] = { +ALIGNED8 static const Texture chain_chomp_seg6_texture_060223D0[] = { #include "actors/chain_chomp/chain_chomp_tongue.rgba16.inc.c" }; // 0x06022BD0 -ALIGNED8 static const u8 chain_chomp_seg6_texture_06022BD0[] = { +ALIGNED8 static const Texture chain_chomp_seg6_texture_06022BD0[] = { #include "actors/chain_chomp/chain_chomp_tooth.rgba16.inc.c" }; // 0x060233D0 -ALIGNED8 static const u8 chain_chomp_seg6_texture_060233D0[] = { +ALIGNED8 static const Texture chain_chomp_seg6_texture_060233D0[] = { #include "actors/chain_chomp/chain_chomp_eye.rgba16.inc.c" }; diff --git a/actors/chair/model.inc.c b/actors/chair/model.inc.c index ec0ad35d..1a833f5b 100644 --- a/actors/chair/model.inc.c +++ b/actors/chair/model.inc.c @@ -7,23 +7,23 @@ UNUSED static const Lights1 chair_lights_unused = gdSPDefLights1( ); // 0x05003060 -ALIGNED8 static const u8 chair_seg5_texture_05003060[] = { +ALIGNED8 static const Texture chair_seg5_texture_05003060[] = { #include "actors/chair/chair_front.rgba16.inc.c" }; // 0x05003860 -ALIGNED8 static const u8 chair_seg5_texture_05003860[] = { +ALIGNED8 static const Texture chair_seg5_texture_05003860[] = { #include "actors/chair/chair_leg.rgba16.inc.c" }; // 0x05004060 -ALIGNED8 static const u8 chair_seg5_texture_05004060[] = { +ALIGNED8 static const Texture chair_seg5_texture_05004060[] = { #include "actors/chair/chair_bottom.rgba16.inc.c" }; // unreferenced // 0x05004460 -ALIGNED8 static const u8 chair_seg5_texture_05004460[] = { +ALIGNED8 static const Texture chair_seg5_texture_05004460[] = { #include "actors/chair/chair_surface_unused.rgba16.inc.c" }; diff --git a/actors/checkerboard_platform/model.inc.c b/actors/checkerboard_platform/model.inc.c index 9a5685df..3ce6ef3e 100644 --- a/actors/checkerboard_platform/model.inc.c +++ b/actors/checkerboard_platform/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 checkerboard_platform_seg8_lights_0800C828 = gdSPDefLights1 ); // 0x0800C840 -ALIGNED8 static const u8 checkerboard_platform_seg8_texture_0800C840[] = { +ALIGNED8 static const Texture checkerboard_platform_seg8_texture_0800C840[] = { #include "actors/checkerboard_platform/checkerboard_platform_side.rgba16.inc.c" }; // 0x0800CC40 -ALIGNED8 static const u8 checkerboard_platform_seg8_texture_0800CC40[] = { +ALIGNED8 static const Texture checkerboard_platform_seg8_texture_0800CC40[] = { #include "actors/checkerboard_platform/checkerboard_platform.rgba16.inc.c" }; diff --git a/actors/chillychief/model.inc.c b/actors/chillychief/model.inc.c index 1c5f4e4f..415329e2 100644 --- a/actors/chillychief/model.inc.c +++ b/actors/chillychief/model.inc.c @@ -25,17 +25,17 @@ UNUSED static const Lights1 chillychief_lights_unused = gdSPDefLights1( ); // 0x06000060 -ALIGNED8 static const u8 chilly_chief_seg6_texture_06000060[] = { +ALIGNED8 static const Texture chilly_chief_seg6_texture_06000060[] = { #include "actors/chillychief/chill_bully_left_side.rgba16.inc.c" }; // 0x06001060 -ALIGNED8 static const u8 chilly_chief_seg6_texture_06001060[] = { +ALIGNED8 static const Texture chilly_chief_seg6_texture_06001060[] = { #include "actors/chillychief/chill_bully_right_side.rgba16.inc.c" }; // 0x06002060 -ALIGNED8 static const u8 chilly_chief_seg6_texture_06002060[] = { +ALIGNED8 static const Texture chilly_chief_seg6_texture_06002060[] = { #include "actors/chillychief/chill_bully_eye.rgba16.inc.c" }; diff --git a/actors/chuckya/model.inc.c b/actors/chuckya/model.inc.c index 2bc59908..3cbc31b2 100644 --- a/actors/chuckya/model.inc.c +++ b/actors/chuckya/model.inc.c @@ -43,22 +43,22 @@ UNUSED static const Lights1 chuckya_lights_unused7 = gdSPDefLights1( ); // 0x08006778 -ALIGNED8 static const u8 chuckya_seg8_texture_08006778[] = { +ALIGNED8 static const Texture chuckya_seg8_texture_08006778[] = { #include "actors/chuckya/chuckya_eyes.rgba16.inc.c" }; // 0x08007778 -ALIGNED8 static const u8 chuckya_seg8_texture_08007778[] = { +ALIGNED8 static const Texture chuckya_seg8_texture_08007778[] = { #include "actors/chuckya/chuckya_hand_antenna.rgba16.inc.c" }; // 0x08007F78 -ALIGNED8 static const u8 chuckya_seg8_texture_08007F78[] = { +ALIGNED8 static const Texture chuckya_seg8_texture_08007F78[] = { #include "actors/chuckya/chuckya_body_arm_left_side.rgba16.inc.c" }; // 0x08008F78 -ALIGNED8 static const u8 chuckya_seg8_texture_08008F78[] = { +ALIGNED8 static const Texture chuckya_seg8_texture_08008F78[] = { #include "actors/chuckya/chuckya_body_arm_right_side.rgba16.inc.c" }; diff --git a/actors/clam_shell/model.inc.c b/actors/clam_shell/model.inc.c index 4a9e57b7..40ebc6b3 100644 --- a/actors/clam_shell/model.inc.c +++ b/actors/clam_shell/model.inc.c @@ -13,12 +13,12 @@ UNUSED static const Lights1 clam_shell_lights_unused2 = gdSPDefLights1( ); // 0x05000030 -ALIGNED8 static const u8 clam_shell_seg5_texture_05000030[] = { +ALIGNED8 static const Texture clam_shell_seg5_texture_05000030[] = { #include "actors/clam_shell/clam_shell.rgba16.inc.c" }; // 0x05000830 -ALIGNED8 static const u8 clam_shell_seg5_texture_05000830[] = { +ALIGNED8 static const Texture clam_shell_seg5_texture_05000830[] = { #include "actors/clam_shell/clam_shell_mouth.rgba16.inc.c" }; diff --git a/actors/coin/model.inc.c b/actors/coin/model.inc.c index 482a4e5c..dcb637de 100644 --- a/actors/coin/model.inc.c +++ b/actors/coin/model.inc.c @@ -25,22 +25,22 @@ static const Vtx coin_seg3_vertex_03005740[] = { }; // 0x03005780 -ALIGNED8 static const u8 coin_seg3_texture_03005780[] = { +ALIGNED8 static const Texture coin_seg3_texture_03005780[] = { #include "actors/coin/coin_front.ia16.inc.c" }; // 0x03005F80 -ALIGNED8 static const u8 coin_seg3_texture_03005F80[] = { +ALIGNED8 static const Texture coin_seg3_texture_03005F80[] = { #include "actors/coin/coin_tilt_right.ia16.inc.c" }; // 0x03006780 -ALIGNED8 static const u8 coin_seg3_texture_03006780[] = { +ALIGNED8 static const Texture coin_seg3_texture_03006780[] = { #include "actors/coin/coin_side.ia16.inc.c" }; // 0x03006F80 -ALIGNED8 static const u8 coin_seg3_texture_03006F80[] = { +ALIGNED8 static const Texture coin_seg3_texture_03006F80[] = { #include "actors/coin/coin_tilt_left.ia16.inc.c" }; diff --git a/actors/common0.c b/actors/common0.c index 77c82412..d31a6b28 100644 --- a/actors/common0.c +++ b/actors/common0.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "blue_coin_switch/model.inc.c" diff --git a/actors/common1.c b/actors/common1.c index c197ca6a..0bf22754 100644 --- a/actors/common1.c +++ b/actors/common1.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "mist/model.inc.c" diff --git a/actors/cyan_fish/model.inc.c b/actors/cyan_fish/model.inc.c index 3e646dae..9dff09c9 100644 --- a/actors/cyan_fish/model.inc.c +++ b/actors/cyan_fish/model.inc.c @@ -4,7 +4,7 @@ UNUSED static const u64 cyan_fish_unused_1 = 0; // 0x0600D468 -ALIGNED8 static const u8 cyan_fish_seg6_texture_0600D468[] = { +ALIGNED8 static const Texture cyan_fish_seg6_texture_0600D468[] = { #include "actors/cyan_fish/cyan_fish.rgba16.inc.c" }; diff --git a/actors/dirt/model.inc.c b/actors/dirt/model.inc.c index 7f646cfa..d630615f 100644 --- a/actors/dirt/model.inc.c +++ b/actors/dirt/model.inc.c @@ -32,7 +32,7 @@ static const Vtx dirt_seg3_vertex_0302BDC8[] = { }; // 0x0302BDF8 -ALIGNED8 static const u8 dirt_seg3_texture_0302BDF8[] = { +ALIGNED8 static const Texture dirt_seg3_texture_0302BDF8[] = { #include "actors/dirt/dirt_particle.rgba16.inc.c" }; diff --git a/actors/door/model.inc.c b/actors/door/model.inc.c index 0b39b7df..a4059d85 100644 --- a/actors/door/model.inc.c +++ b/actors/door/model.inc.c @@ -13,72 +13,72 @@ static const Lights1 door_seg3_lights_03009CF8 = gdSPDefLights1( ); // 0x03009D10 -ALIGNED8 static const u8 door_seg3_texture_03009D10[] = { +ALIGNED8 static const Texture door_seg3_texture_03009D10[] = { #include "actors/door/polished_wooden_door.rgba16.inc.c" }; // 0x0300AD10 -ALIGNED8 static const u8 door_seg3_texture_0300AD10[] = { +ALIGNED8 static const Texture door_seg3_texture_0300AD10[] = { #include "actors/door/polished_wooden_door_overlay.rgba16.inc.c" }; // 0x0300BD10 -ALIGNED8 static const u8 door_seg3_texture_0300BD10[] = { +ALIGNED8 static const Texture door_seg3_texture_0300BD10[] = { #include "actors/door/rough_wooden_door.rgba16.inc.c" }; // 0x0300CD10 -ALIGNED8 static const u8 door_seg3_texture_0300CD10[] = { +ALIGNED8 static const Texture door_seg3_texture_0300CD10[] = { #include "actors/door/rough_wooden_door_overlay.rgba16.inc.c" }; // 0x0300D510 -ALIGNED8 static const u8 door_seg3_texture_0300D510[] = { +ALIGNED8 static const Texture door_seg3_texture_0300D510[] = { #include "actors/door/metal_door.rgba16.inc.c" }; // 0x0300E510 -ALIGNED8 static const u8 door_seg3_texture_0300E510[] = { +ALIGNED8 static const Texture door_seg3_texture_0300E510[] = { #include "actors/door/metal_door_overlay.rgba16.inc.c" }; // 0x0300ED10 -ALIGNED8 static const u8 door_seg3_texture_0300ED10[] = { +ALIGNED8 static const Texture door_seg3_texture_0300ED10[] = { #include "actors/door/hmc_mural_door.rgba16.inc.c" }; // 0x0300FD10 -ALIGNED8 static const u8 door_seg3_texture_0300FD10[] = { +ALIGNED8 static const Texture door_seg3_texture_0300FD10[] = { #include "actors/door/hmc_mural_door_overlay.rgba16.inc.c" }; // 0x03010510 -ALIGNED8 static const u8 door_seg3_texture_03010510[] = { +ALIGNED8 static const Texture door_seg3_texture_03010510[] = { #include "actors/door/bbh_door.rgba16.inc.c" }; // 0x03011510 -ALIGNED8 static const u8 door_seg3_texture_03011510[] = { +ALIGNED8 static const Texture door_seg3_texture_03011510[] = { #include "actors/door/bbh_door_overlay.rgba16.inc.c" }; // 0x03011D10 -ALIGNED8 static const u8 door_seg3_texture_03011D10[] = { +ALIGNED8 static const Texture door_seg3_texture_03011D10[] = { #include "actors/door/zero_star_door_sign.rgba16.inc.c" }; // 0x03012510 -ALIGNED8 static const u8 door_seg3_texture_03012510[] = { +ALIGNED8 static const Texture door_seg3_texture_03012510[] = { #include "actors/door/one_star_door_sign.rgba16.inc.c" }; // 0x03012D10 -ALIGNED8 static const u8 door_seg3_texture_03012D10[] = { +ALIGNED8 static const Texture door_seg3_texture_03012D10[] = { #include "actors/door/three_star_door_sign.rgba16.inc.c" }; // 0x03013510 -ALIGNED8 static const u8 door_seg3_texture_03013510[] = { +ALIGNED8 static const Texture door_seg3_texture_03013510[] = { #include "actors/door/door_lock.rgba16.inc.c" }; diff --git a/actors/dorrie/model.inc.c b/actors/dorrie/model.inc.c index 6c9044d6..b2097a5d 100644 --- a/actors/dorrie/model.inc.c +++ b/actors/dorrie/model.inc.c @@ -1,17 +1,17 @@ // Dorrie // 0x06009BA0 -ALIGNED8 static const u8 dorrie_seg6_texture_06009BA0[] = { +ALIGNED8 static const Texture dorrie_seg6_texture_06009BA0[] = { #include "actors/dorrie/dorrie_eye.rgba16.inc.c" }; // 0x06009DA0 -ALIGNED8 static const u8 dorrie_seg6_texture_06009DA0[] = { +ALIGNED8 static const Texture dorrie_seg6_texture_06009DA0[] = { #include "actors/dorrie/dorrie_skin.rgba16.inc.c" }; // 0x0600ADA0 -ALIGNED8 static const u8 dorrie_seg6_texture_0600ADA0[] = { +ALIGNED8 static const Texture dorrie_seg6_texture_0600ADA0[] = { #include "actors/dorrie/dorrie_tongue.rgba16.inc.c" }; diff --git a/actors/exclamation_box/model.inc.c b/actors/exclamation_box/model.inc.c index 70dd506d..a59b2280 100644 --- a/actors/exclamation_box/model.inc.c +++ b/actors/exclamation_box/model.inc.c @@ -7,42 +7,42 @@ static const Lights1 exclamation_box_seg8_lights_08012E10 = gdSPDefLights1( ); // 0x08012E28 -ALIGNED8 static const u8 exclamation_box_seg8_texture_08012E28[] = { +ALIGNED8 static const Texture exclamation_box_seg8_texture_08012E28[] = { #include "actors/exclamation_box/vanish_cap_box_front.rgba16.inc.c" }; // 0x08013628 -ALIGNED8 static const u8 exclamation_box_seg8_texture_08013628[] = { +ALIGNED8 static const Texture exclamation_box_seg8_texture_08013628[] = { #include "actors/exclamation_box/vanish_cap_box_side.rgba16.inc.c" }; // 0x08014628 -ALIGNED8 static const u8 exclamation_box_seg8_texture_08014628[] = { +ALIGNED8 static const Texture exclamation_box_seg8_texture_08014628[] = { #include "actors/exclamation_box/metal_cap_box_front.rgba16.inc.c" }; // 0x08014E28 -ALIGNED8 static const u8 exclamation_box_seg8_texture_08014E28[] = { +ALIGNED8 static const Texture exclamation_box_seg8_texture_08014E28[] = { #include "actors/exclamation_box/metal_cap_box_side.rgba16.inc.c" }; // 0x08015E28 -ALIGNED8 static const u8 exclamation_box_seg8_texture_08015E28[] = { +ALIGNED8 static const Texture exclamation_box_seg8_texture_08015E28[] = { #include "actors/exclamation_box/wing_cap_box_front.rgba16.inc.c" }; // 0x08016628 -ALIGNED8 static const u8 exclamation_box_seg8_texture_08016628[] = { +ALIGNED8 static const Texture exclamation_box_seg8_texture_08016628[] = { #include "actors/exclamation_box/wing_cap_box_side.rgba16.inc.c" }; // 0x08017628 -ALIGNED8 static const u8 exclamation_box_seg8_texture_08017628[] = { +ALIGNED8 static const Texture exclamation_box_seg8_texture_08017628[] = { #include "actors/exclamation_box/exclamation_box_front.rgba16.inc.c" }; // 0x08017E28 -ALIGNED8 static const u8 exclamation_box_seg8_texture_08017E28[] = { +ALIGNED8 static const Texture exclamation_box_seg8_texture_08017E28[] = { #include "actors/exclamation_box/exclamation_box_side.rgba16.inc.c" }; diff --git a/actors/exclamation_box_outline/model.inc.c b/actors/exclamation_box_outline/model.inc.c index f0f2d4a9..61b5ecd1 100644 --- a/actors/exclamation_box_outline/model.inc.c +++ b/actors/exclamation_box_outline/model.inc.c @@ -154,7 +154,7 @@ static const Vtx exclamation_box_outline_seg8_vertex_080250E8[] = { }; // 0x08025168 -ALIGNED8 static const u8 exclamation_box_outline_seg8_texture_08025168[] = { +ALIGNED8 static const Texture exclamation_box_outline_seg8_texture_08025168[] = { #include "actors/exclamation_box_outline/exclamation_box_outline.rgba16.inc.c" }; @@ -199,7 +199,7 @@ static const Lights1 exclamation_box_outline_seg8_lights_08025A68 = gdSPDefLight ); // 0x08025A80 -ALIGNED8 static const u8 exclamation_box_outline_seg8_texture_08025A80[] = { +ALIGNED8 static const Texture exclamation_box_outline_seg8_texture_08025A80[] = { #include "actors/exclamation_box_outline/exclamation_point.rgba16.inc.c" }; diff --git a/actors/explosion/model.inc.c b/actors/explosion/model.inc.c index 8f41b8fa..8bc4b447 100644 --- a/actors/explosion/model.inc.c +++ b/actors/explosion/model.inc.c @@ -9,37 +9,37 @@ static const Vtx explosion_seg3_vertex_030009C8[] = { }; // 0x03000A08 -ALIGNED8 static const u8 explosion_seg3_texture_03000A08[] = { +ALIGNED8 static const Texture explosion_seg3_texture_03000A08[] = { #include "actors/explosion/explosion_0.rgba16.inc.c" }; // 0x03001208 -ALIGNED8 static const u8 explosion_seg3_texture_03001208[] = { +ALIGNED8 static const Texture explosion_seg3_texture_03001208[] = { #include "actors/explosion/explosion_1.rgba16.inc.c" }; // 0x03001A08 -ALIGNED8 static const u8 explosion_seg3_texture_03001A08[] = { +ALIGNED8 static const Texture explosion_seg3_texture_03001A08[] = { #include "actors/explosion/explosion_2.rgba16.inc.c" }; // 0x03002208 -ALIGNED8 static const u8 explosion_seg3_texture_03002208[] = { +ALIGNED8 static const Texture explosion_seg3_texture_03002208[] = { #include "actors/explosion/explosion_3.rgba16.inc.c" }; // 0x03002A08 -ALIGNED8 static const u8 explosion_seg3_texture_03002A08[] = { +ALIGNED8 static const Texture explosion_seg3_texture_03002A08[] = { #include "actors/explosion/explosion_4.rgba16.inc.c" }; // 0x03003208 -ALIGNED8 static const u8 explosion_seg3_texture_03003208[] = { +ALIGNED8 static const Texture explosion_seg3_texture_03003208[] = { #include "actors/explosion/explosion_5.rgba16.inc.c" }; // 0x03003A08 -ALIGNED8 static const u8 explosion_seg3_texture_03003A08[] = { +ALIGNED8 static const Texture explosion_seg3_texture_03003A08[] = { #include "actors/explosion/explosion_6.rgba16.inc.c" }; diff --git a/actors/eyerok/model.inc.c b/actors/eyerok/model.inc.c index 0b684c4c..629b3cda 100644 --- a/actors/eyerok/model.inc.c +++ b/actors/eyerok/model.inc.c @@ -7,27 +7,27 @@ UNUSED static const Lights1 eyerok_lights_unused = gdSPDefLights1( ); // 0x05008D40 -ALIGNED8 static const u8 eyerok_seg5_texture_05008D40[] = { +ALIGNED8 static const Texture eyerok_seg5_texture_05008D40[] = { #include "actors/eyerok/eyerok_bricks.rgba16.inc.c" }; // 0x05009540 -ALIGNED8 static const u8 eyerok_seg5_texture_05009540[] = { +ALIGNED8 static const Texture eyerok_seg5_texture_05009540[] = { #include "actors/eyerok/eyerok_eye_open.rgba16.inc.c" }; // 0x05009D40 -ALIGNED8 static const u8 eyerok_seg5_texture_05009D40[] = { +ALIGNED8 static const Texture eyerok_seg5_texture_05009D40[] = { #include "actors/eyerok/eyerok_eye_mostly_open.rgba16.inc.c" }; // 0x0500A540 -ALIGNED8 static const u8 eyerok_seg5_texture_0500A540[] = { +ALIGNED8 static const Texture eyerok_seg5_texture_0500A540[] = { #include "actors/eyerok/eyerok_eye_mostly_closed.rgba16.inc.c" }; // 0x0500AD40 -ALIGNED8 static const u8 eyerok_seg5_texture_0500AD40[] = { +ALIGNED8 static const Texture eyerok_seg5_texture_0500AD40[] = { #include "actors/eyerok/eyerok_eye_closed.rgba16.inc.c" }; diff --git a/actors/flame/model.inc.c b/actors/flame/model.inc.c index 6f2d277c..09226058 100644 --- a/actors/flame/model.inc.c +++ b/actors/flame/model.inc.c @@ -9,42 +9,42 @@ static const Vtx flame_seg3_vertex_030172E0[] = { }; // 0x03017320 -ALIGNED8 static const u8 flame_seg3_texture_03017320[] = { +ALIGNED8 static const Texture flame_seg3_texture_03017320[] = { #include "actors/flame/flame_0.ia16.inc.c" }; // 0x03017B20 -ALIGNED8 static const u8 flame_seg3_texture_03017B20[] = { +ALIGNED8 static const Texture flame_seg3_texture_03017B20[] = { #include "actors/flame/flame_1.ia16.inc.c" }; // 0x03018320 -ALIGNED8 static const u8 flame_seg3_texture_03018320[] = { +ALIGNED8 static const Texture flame_seg3_texture_03018320[] = { #include "actors/flame/flame_2.ia16.inc.c" }; // 0x03018B20 -ALIGNED8 static const u8 flame_seg3_texture_03018B20[] = { +ALIGNED8 static const Texture flame_seg3_texture_03018B20[] = { #include "actors/flame/flame_3.ia16.inc.c" }; // 0x03019320 -ALIGNED8 static const u8 flame_seg3_texture_03019320[] = { +ALIGNED8 static const Texture flame_seg3_texture_03019320[] = { #include "actors/flame/flame_4.ia16.inc.c" }; // 0x03019B20 -ALIGNED8 static const u8 flame_seg3_texture_03019B20[] = { +ALIGNED8 static const Texture flame_seg3_texture_03019B20[] = { #include "actors/flame/flame_5.ia16.inc.c" }; // 0x0301A320 -ALIGNED8 static const u8 flame_seg3_texture_0301A320[] = { +ALIGNED8 static const Texture flame_seg3_texture_0301A320[] = { #include "actors/flame/flame_6.ia16.inc.c" }; // 0x0301AB20 -ALIGNED8 static const u8 flame_seg3_texture_0301AB20[] = { +ALIGNED8 static const Texture flame_seg3_texture_0301AB20[] = { #include "actors/flame/flame_7.ia16.inc.c" }; diff --git a/actors/flyguy/model.inc.c b/actors/flyguy/model.inc.c index 05e38248..c9fc0648 100644 --- a/actors/flyguy/model.inc.c +++ b/actors/flyguy/model.inc.c @@ -4,17 +4,17 @@ UNUSED static const u64 flyguy_unused_1 = 0; // 0x0800E088 -ALIGNED8 static const u8 flyguy_seg8_texture_0800E088[] = { +ALIGNED8 static const Texture flyguy_seg8_texture_0800E088[] = { #include "actors/flyguy/flyguy_cloth_wrinkle.rgba16.inc.c" }; // 0x0800F088 -ALIGNED8 static const u8 flyguy_seg8_texture_0800F088[] = { +ALIGNED8 static const Texture flyguy_seg8_texture_0800F088[] = { #include "actors/flyguy/flyguy_face.rgba16.inc.c" }; // 0x0800F888 -ALIGNED8 static const u8 flyguy_seg8_texture_0800F888[] = { +ALIGNED8 static const Texture flyguy_seg8_texture_0800F888[] = { #include "actors/flyguy/flyguy_propeller.ia16.inc.c" }; diff --git a/actors/fwoosh/model.inc.c b/actors/fwoosh/model.inc.c index 3767cd8e..a6aa202c 100644 --- a/actors/fwoosh/model.inc.c +++ b/actors/fwoosh/model.inc.c @@ -9,7 +9,7 @@ static const Vtx fwoosh_seg5_vertex_050157C8[] = { }; // 0x05015808 -ALIGNED8 static const u8 fwoosh_seg5_texture_05015808[] = { +ALIGNED8 static const Texture fwoosh_seg5_texture_05015808[] = { #include "actors/fwoosh/fwoosh_face.ia16.inc.c" }; diff --git a/actors/goomba/model.inc.c b/actors/goomba/model.inc.c index a68a9bff..f45d3918 100644 --- a/actors/goomba/model.inc.c +++ b/actors/goomba/model.inc.c @@ -37,17 +37,17 @@ static const Lights1 goomba_seg8_lights_08019518 = gdSPDefLights1( ); // 0x08019530 -ALIGNED8 static const u8 goomba_seg8_texture_08019530[] = { +ALIGNED8 static const Texture goomba_seg8_texture_08019530[] = { #include "actors/goomba/goomba_body.rgba16.inc.c" }; // 0x08019D30 -ALIGNED8 static const u8 goomba_seg8_texture_08019D30[] = { +ALIGNED8 static const Texture goomba_seg8_texture_08019D30[] = { #include "actors/goomba/goomba_face.rgba16.inc.c" }; // 0x0801A530 -ALIGNED8 static const u8 goomba_seg8_texture_0801A530[] = { +ALIGNED8 static const Texture goomba_seg8_texture_0801A530[] = { #include "actors/goomba/goomba_face_blink.rgba16.inc.c" }; diff --git a/actors/group1.c b/actors/group1.c index bad06393..2f01454e 100644 --- a/actors/group1.c +++ b/actors/group1.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "yellow_sphere_small/model.inc.c" diff --git a/actors/group10.c b/actors/group10.c index cad529c4..5ab6a7c1 100644 --- a/actors/group10.c +++ b/actors/group10.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "bird/model.inc.c" diff --git a/actors/group11.c b/actors/group11.c index d6f1ebf7..2dddacb5 100644 --- a/actors/group11.c +++ b/actors/group11.c @@ -1,8 +1,11 @@ -#include +#include +#include + +#include "geo_commands.h" +#include "macros.h" #include "sm64.h" #include "surface_terrains.h" -#include "geo_commands.h" - +#include "types.h" #include "make_const_nonconst.h" #include "bubba/model.inc.c" diff --git a/actors/group12.c b/actors/group12.c index d4382442..b6ed0af7 100644 --- a/actors/group12.c +++ b/actors/group12.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "bowser_flame/model.inc.c" diff --git a/actors/group13.c b/actors/group13.c index 21382999..cbd01aa3 100644 --- a/actors/group13.c +++ b/actors/group13.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "skeeter/model.inc.c" diff --git a/actors/group14.c b/actors/group14.c index b4e695f4..640dd729 100644 --- a/actors/group14.c +++ b/actors/group14.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "koopa_flag/model.inc.c" diff --git a/actors/group15.c b/actors/group15.c index 54a4885f..2f415ce2 100644 --- a/actors/group15.c +++ b/actors/group15.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "lakitu_cameraman/model.inc.c" diff --git a/actors/group16.c b/actors/group16.c index 064506d0..5435ac0f 100644 --- a/actors/group16.c +++ b/actors/group16.c @@ -1,8 +1,11 @@ -#include +#include +#include + +#include "geo_commands.h" +#include "macros.h" #include "sm64.h" #include "surface_terrains.h" -#include "geo_commands.h" - +#include "types.h" #include "make_const_nonconst.h" #include "chillychief/model.inc.c" diff --git a/actors/group17.c b/actors/group17.c index b63d9a17..10eede1d 100644 --- a/actors/group17.c +++ b/actors/group17.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "mr_i_eyeball/model.inc.c" diff --git a/actors/group2.c b/actors/group2.c index 2d4de879..e1c831c4 100644 --- a/actors/group2.c +++ b/actors/group2.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "bully/model.inc.c" diff --git a/actors/group3.c b/actors/group3.c index 481b3271..c8ffc5be 100644 --- a/actors/group3.c +++ b/actors/group3.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "king_bobomb/model.inc.c" diff --git a/actors/group4.c b/actors/group4.c index ac128a4b..080a026d 100644 --- a/actors/group4.c +++ b/actors/group4.c @@ -1,8 +1,10 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "geo_commands.h" +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "clam_shell/model.inc.c" diff --git a/actors/group5.c b/actors/group5.c index 2e80dfb2..899aef7c 100644 --- a/actors/group5.c +++ b/actors/group5.c @@ -1,8 +1,11 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "geo_commands.h" +#include "macros.h" +#include "surface_terrains.h" +#include "sm64.h" +#include "types.h" #include "make_const_nonconst.h" #include "klepto/model.inc.c" diff --git a/actors/group6.c b/actors/group6.c index f5e61373..c0a5e0a5 100644 --- a/actors/group6.c +++ b/actors/group6.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "monty_mole_hole/model.inc.c" diff --git a/actors/group7.c b/actors/group7.c index cccb1e27..b87dbd17 100644 --- a/actors/group7.c +++ b/actors/group7.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "spindrift/model.inc.c" diff --git a/actors/group8.c b/actors/group8.c index e999ba7e..1291abac 100644 --- a/actors/group8.c +++ b/actors/group8.c @@ -1,8 +1,8 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "springboard/model.inc.c" diff --git a/actors/group9.c b/actors/group9.c index c6c379be..1270f9bd 100644 --- a/actors/group9.c +++ b/actors/group9.c @@ -1,8 +1,9 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "geo_commands.h" +#include +#include +#include "macros.h" +#include "surface_terrains.h" +#include "types.h" #include "make_const_nonconst.h" #include "bookend/model.inc.c" diff --git a/actors/haunted_cage/model.inc.c b/actors/haunted_cage/model.inc.c index d763de20..0f221d98 100644 --- a/actors/haunted_cage/model.inc.c +++ b/actors/haunted_cage/model.inc.c @@ -13,27 +13,27 @@ static const Lights1 haunted_cage_seg5_lights_0500C270 = gdSPDefLights1( ); // 0x0500C288 -ALIGNED8 static const u8 haunted_cage_seg5_texture_0500C288[] = { +ALIGNED8 static const Texture haunted_cage_seg5_texture_0500C288[] = { #include "actors/haunted_cage/bbh_cage_floor.rgba16.inc.c" }; // 0x0500CA88 -ALIGNED8 static const u8 haunted_cage_seg5_texture_0500CA88[] = { +ALIGNED8 static const Texture haunted_cage_seg5_texture_0500CA88[] = { #include "actors/haunted_cage/bbh_cage_double_ornament.rgba16.inc.c" }; // 0x0500D288 -ALIGNED8 static const u8 haunted_cage_seg5_texture_0500D288[] = { +ALIGNED8 static const Texture haunted_cage_seg5_texture_0500D288[] = { #include "actors/haunted_cage/bbh_cage_ornament.rgba16.inc.c" }; // 0x0500D688 -ALIGNED8 static const u8 haunted_cage_seg5_texture_0500D688[] = { +ALIGNED8 static const Texture haunted_cage_seg5_texture_0500D688[] = { #include "actors/haunted_cage/bbh_cage_wooden_base.rgba16.inc.c" }; // 0x0500DA88 -ALIGNED8 static const u8 haunted_cage_seg5_texture_0500DA88[] = { +ALIGNED8 static const Texture haunted_cage_seg5_texture_0500DA88[] = { #include "actors/haunted_cage/bbh_cage_bars.rgba16.inc.c" }; @@ -41,7 +41,7 @@ ALIGNED8 static const u8 haunted_cage_seg5_texture_0500DA88[] = { // also could be some sort of shader mask from much earlier in development, considering // Big Boo's Haunt was a very very early level. // 0x0500E288 -ALIGNED8 static const u8 haunted_cage_seg5_texture_0500E288[] = { +ALIGNED8 static const Texture haunted_cage_seg5_texture_0500E288[] = { #include "actors/haunted_cage/bbh_cage_garbage.rgba16.inc.c" }; diff --git a/actors/heart/model.inc.c b/actors/heart/model.inc.c index 0a79c76d..b5962946 100644 --- a/actors/heart/model.inc.c +++ b/actors/heart/model.inc.c @@ -9,7 +9,7 @@ static const Vtx heart_seg8_vertex_0800D7A0[] = { }; // 0x0800D7E0 -ALIGNED8 static const u8 heart_seg8_texture_0800D7E0[] = { +ALIGNED8 static const Texture heart_seg8_texture_0800D7E0[] = { #include "actors/heart/spinning_heart.rgba16.inc.c" }; diff --git a/actors/heave_ho/model.inc.c b/actors/heave_ho/model.inc.c index 7007ab0c..3868cd1d 100644 --- a/actors/heave_ho/model.inc.c +++ b/actors/heave_ho/model.inc.c @@ -43,32 +43,32 @@ static const Lights1 heave_ho_lights_unused5 = gdSPDefLights1( ); // 0x0500E9C8 -ALIGNED8 static const u8 heave_ho_seg5_texture_0500E9C8[] = { +ALIGNED8 static const Texture heave_ho_seg5_texture_0500E9C8[] = { #include "actors/heave_ho/heave-ho_face.rgba16.inc.c" }; // 0x0500F1C8 -ALIGNED8 static const u8 heave_ho_seg5_texture_0500F1C8[] = { +ALIGNED8 static const Texture heave_ho_seg5_texture_0500F1C8[] = { #include "actors/heave_ho/heave-ho_platform.rgba16.inc.c" }; // 0x0500F9C8 -ALIGNED8 static const u8 heave_ho_seg5_texture_0500F9C8[] = { +ALIGNED8 static const Texture heave_ho_seg5_texture_0500F9C8[] = { #include "actors/heave_ho/heave-ho_logo.rgba16.inc.c" }; // 0x050109C8 -ALIGNED8 static const u8 heave_ho_seg5_texture_050109C8[] = { +ALIGNED8 static const Texture heave_ho_seg5_texture_050109C8[] = { #include "actors/heave_ho/heave-ho_arm_ornament.rgba16.inc.c" }; // 0x050111C8 -ALIGNED8 static const u8 heave_ho_seg5_texture_050111C8[] = { +ALIGNED8 static const Texture heave_ho_seg5_texture_050111C8[] = { #include "actors/heave_ho/heave-ho_roller.rgba16.inc.c" }; // 0x050113C8 -ALIGNED8 static const u8 heave_ho_seg5_texture_050113C8[] = { +ALIGNED8 static const Texture heave_ho_seg5_texture_050113C8[] = { #include "actors/heave_ho/heave-ho_turnkey.rgba16.inc.c" }; diff --git a/actors/hoot/model.inc.c b/actors/hoot/model.inc.c index ebffc2a6..02b814d4 100644 --- a/actors/hoot/model.inc.c +++ b/actors/hoot/model.inc.c @@ -73,7 +73,7 @@ static const Lights1 hoot_seg5_lights_05000A08 = gdSPDefLights1( ); // 0x05000A20 -ALIGNED8 static const u8 hoot_seg5_texture_05000A20[] = { +ALIGNED8 static const Texture hoot_seg5_texture_05000A20[] = { #include "actors/hoot/hoot_eyes.rgba16.inc.c" }; @@ -351,12 +351,12 @@ static const Lights1 hoot_seg5_lights_05001E38 = gdSPDefLights1( ); // 0x05001E50 -ALIGNED8 static const u8 hoot_seg5_texture_05001E50[] = { +ALIGNED8 static const Texture hoot_seg5_texture_05001E50[] = { #include "actors/hoot/hoot_wing.rgba16.inc.c" }; // 0x05002650 -ALIGNED8 static const u8 hoot_seg5_texture_05002650[] = { +ALIGNED8 static const Texture hoot_seg5_texture_05002650[] = { #include "actors/hoot/hoot_wing_tip.rgba16.inc.c" }; diff --git a/actors/impact_ring/model.inc.c b/actors/impact_ring/model.inc.c index 64258252..075f12da 100644 --- a/actors/impact_ring/model.inc.c +++ b/actors/impact_ring/model.inc.c @@ -17,12 +17,12 @@ static const Vtx impact_ring_seg6_vertex_0601CA10[] = { }; // 0x0601CA50 -ALIGNED8 static const u8 impact_ring_seg6_texture_0601CA50[] = { +ALIGNED8 static const Texture impact_ring_seg6_texture_0601CA50[] = { #include "actors/impact_ring/impact_ring_left_side.ia16.inc.c" }; // 0x0601DA50 -ALIGNED8 static const u8 impact_ring_seg6_texture_0601DA50[] = { +ALIGNED8 static const Texture impact_ring_seg6_texture_0601DA50[] = { #include "actors/impact_ring/impact_ring_right_side.ia16.inc.c" }; diff --git a/actors/impact_smoke/model.inc.c b/actors/impact_smoke/model.inc.c index 012cf6f6..ebee5a98 100644 --- a/actors/impact_smoke/model.inc.c +++ b/actors/impact_smoke/model.inc.c @@ -1,6 +1,6 @@ // Impact Smoke -// TODO: Are these seperate textures or unified 64x64 ones? +// TODO: These 64x64 textures are referenced as two different texture addresses in the DLs // 0x0605AA28 ALIGNED8 static const u8 impact_smoke_seg6_texture_0605AA28[] = { @@ -71,6 +71,7 @@ const Gfx impact_smoke_seg6_dl_06062B38[] = { gsDPLoadTextureBlock(impact_smoke_seg6_texture_0605AA28, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(impact_smoke_seg6_vertex_06062A28, 8, 0), gsSPDisplayList(impact_smoke_seg6_dl_06062AD8), + //gsDPLoadTextureBlock((u8*)impact_smoke_seg6_texture_0605AA28 + 0x1000, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(impact_smoke_seg6_dl_06062AF0), gsSPDisplayList(impact_smoke_seg6_dl_06062B08), gsSPEndDisplayList(), @@ -82,6 +83,7 @@ const Gfx impact_smoke_seg6_dl_06062BD8[] = { gsDPLoadTextureBlock(impact_smoke_seg6_texture_0605CA28, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(impact_smoke_seg6_vertex_06062A28, 8, 0), gsSPDisplayList(impact_smoke_seg6_dl_06062AD8), + //gsDPLoadTextureBlock((u8*)impact_smoke_seg6_texture_0605CA28 + 0x1000, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(impact_smoke_seg6_dl_06062AF0), gsSPDisplayList(impact_smoke_seg6_dl_06062B08), gsSPEndDisplayList(), @@ -93,6 +95,7 @@ const Gfx impact_smoke_seg6_dl_06062C78[] = { gsDPLoadTextureBlock(impact_smoke_seg6_texture_0605EA28, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(impact_smoke_seg6_vertex_06062A28, 8, 0), gsSPDisplayList(impact_smoke_seg6_dl_06062AD8), + //gsDPLoadTextureBlock((u8*)impact_smoke_seg6_texture_0605EA28 + 0x1000, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(impact_smoke_seg6_dl_06062AF0), gsSPDisplayList(impact_smoke_seg6_dl_06062B08), gsSPEndDisplayList(), @@ -104,6 +107,7 @@ const Gfx impact_smoke_seg6_dl_06062D18[] = { gsDPLoadTextureBlock(impact_smoke_seg6_texture_06060A28, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD), gsSPVertex(impact_smoke_seg6_vertex_06062A28, 8, 0), gsSPDisplayList(impact_smoke_seg6_dl_06062AD8), + //gsDPLoadTextureBlock((u8*)impact_smoke_seg6_texture_06060A28 + 0x1000, G_IM_FMT_IA, G_IM_SIZ_16b, 64, 32, 0, G_TX_CLAMP, G_TX_CLAMP, 6, 5, G_TX_NOLOD, G_TX_NOLOD), gsSPDisplayList(impact_smoke_seg6_dl_06062AF0), gsSPDisplayList(impact_smoke_seg6_dl_06062B08), gsSPEndDisplayList(), diff --git a/actors/king_bobomb/model.inc.c b/actors/king_bobomb/model.inc.c index dc1171a8..9b947c05 100644 --- a/actors/king_bobomb/model.inc.c +++ b/actors/king_bobomb/model.inc.c @@ -31,52 +31,52 @@ UNUSED static const Lights1 king_bobomb_lights_unused5 = gdSPDefLights1( ); // 0x05000078 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05000078[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05000078[] = { #include "actors/king_bobomb/bob-omb_buddy_left_side_unused.rgba16.inc.c" }; // 0x05001078 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05001078[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05001078[] = { #include "actors/king_bobomb/bob-omb_buddy_right_side_unused.rgba16.inc.c" }; // 0x05002078 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05002078[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05002078[] = { #include "actors/king_bobomb/king_bob-omb_arm.rgba16.inc.c" }; // 0x05002878 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05002878[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05002878[] = { #include "actors/king_bobomb/king_bob-omb_body_unused.rgba16.inc.c" }; // 0x05004878 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05004878[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05004878[] = { #include "actors/king_bobomb/king_bob-omb_eyes.rgba16.inc.c" }; // 0x05005878 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05005878[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05005878[] = { #include "actors/king_bobomb/king_bob-omb_hand.rgba16.inc.c" }; // 0x05006078 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05006078[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05006078[] = { #include "actors/king_bobomb/king_bob-omb_crown_rim.rgba16.inc.c" }; // 0x05006478 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05006478[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05006478[] = { #include "actors/king_bobomb/bob-omb_buddy_body_unused.rgba16.inc.c" }; // 0x05008478 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05008478[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05008478[] = { #include "actors/king_bobomb/king_bob-omb_left_side.rgba16.inc.c" }; // 0x05009478 -ALIGNED8 static const u8 king_bobomb_seg5_texture_05009478[] = { +ALIGNED8 static const Texture king_bobomb_seg5_texture_05009478[] = { #include "actors/king_bobomb/king_bob-omb_right_side.rgba16.inc.c" }; diff --git a/actors/klepto/model.inc.c b/actors/klepto/model.inc.c index 9f83b07a..3b2eec96 100644 --- a/actors/klepto/model.inc.c +++ b/actors/klepto/model.inc.c @@ -6,27 +6,27 @@ UNUSED static const u64 klepto_unused_1 = 0; // Klepto // 0x05000008 -ALIGNED8 static const u8 klepto_seg5_texture_05000008[] = { +ALIGNED8 static const Texture klepto_seg5_texture_05000008[] = { #include "actors/klepto/klepto_chest_tuft.rgba16.inc.c" }; // 0x05000808 -ALIGNED8 static const u8 klepto_seg5_texture_05000808[] = { +ALIGNED8 static const Texture klepto_seg5_texture_05000808[] = { #include "actors/klepto/klepto_eye.rgba16.inc.c" }; // 0x05001008 -ALIGNED8 static const u8 klepto_seg5_texture_05001008[] = { +ALIGNED8 static const Texture klepto_seg5_texture_05001008[] = { #include "actors/klepto/klepto_beak.rgba16.inc.c" }; // 0x05002008 -ALIGNED8 static const u8 klepto_seg5_texture_05002008[] = { +ALIGNED8 static const Texture klepto_seg5_texture_05002008[] = { #include "actors/klepto/klepto_wing.rgba16.inc.c" }; // 0x05003008 -ALIGNED8 static const u8 klepto_seg5_texture_05003008[] = { +ALIGNED8 static const Texture klepto_seg5_texture_05003008[] = { #include "actors/klepto/klepto_wing_flap.rgba16.inc.c" }; diff --git a/actors/koopa/model.inc.c b/actors/koopa/model.inc.c index 6bf24187..16bacf09 100644 --- a/actors/koopa/model.inc.c +++ b/actors/koopa/model.inc.c @@ -57,42 +57,42 @@ static const Lights1 koopa_seg6_lights_06002630 = gdSPDefLights1( // Due to debate in the PR surrounding the fix to this, said fix is on // a compile-time variable. Use TEXTURE_FIX=1 at compile time to fix this. // 0x06002648 -ALIGNED8 static const u8 koopa_seg6_texture_06002648[] = { +ALIGNED8 static const Texture koopa_seg6_texture_06002648[] = { #include "actors/koopa/koopa_shell_front.rgba16.inc.c" }; // 0x06002E48 -ALIGNED8 static const u8 koopa_seg6_texture_06002E48[] = { +ALIGNED8 static const Texture koopa_seg6_texture_06002E48[] = { #include "actors/koopa/koopa_shell_back.rgba16.inc.c" }; // 0x06003648 -ALIGNED8 static const u8 koopa_seg6_texture_06003648[] = { +ALIGNED8 static const Texture koopa_seg6_texture_06003648[] = { #include "actors/koopa/koopa_shoe.rgba16.inc.c" }; // 0x06003E48 -ALIGNED8 static const u8 koopa_seg6_texture_06003E48[] = { +ALIGNED8 static const Texture koopa_seg6_texture_06003E48[] = { #include "actors/koopa/koopa_shell_front_top.rgba16.inc.c" }; // 0x06004648 -ALIGNED8 static const u8 koopa_seg6_texture_06004648[] = { +ALIGNED8 static const Texture koopa_seg6_texture_06004648[] = { #include "actors/koopa/koopa_eyes_open.rgba16.inc.c" }; // 0x06004E48 -ALIGNED8 static const u8 koopa_seg6_texture_06004E48[] = { +ALIGNED8 static const Texture koopa_seg6_texture_06004E48[] = { #include "actors/koopa/koopa_eyes_closed.rgba16.inc.c" }; // 0x06005648 -ALIGNED8 static const u8 koopa_seg6_texture_06005648[] = { +ALIGNED8 static const Texture koopa_seg6_texture_06005648[] = { #include "actors/koopa/koopa_eye_border.rgba16.inc.c" }; // 0x06005E48 -ALIGNED8 static const u8 koopa_seg6_texture_06005E48[] = { +ALIGNED8 static const Texture koopa_seg6_texture_06005E48[] = { #include "actors/koopa/koopa_nostrils.rgba16.inc.c" }; @@ -2083,8 +2083,8 @@ const Gfx koopa_seg6_dl_0600C498[] = { gsSPLight(&koopa_seg6_lights_06002630.l, 1), gsSPLight(&koopa_seg6_lights_06002630.a, 2), #else - gsSPLight(koopa_seg6_texture_06002648 + 0x20, 1), // this malformed light results in a - gsSPLight(koopa_seg6_texture_06002648 + 0x18, 2), // koopa appearing to wear pink shorts. + gsSPLight((u8*)koopa_seg6_texture_06002648 + 0x20, 1), //! this malformed light results in a + gsSPLight((u8*)koopa_seg6_texture_06002648 + 0x18, 2), //! koopa appearing to wear pink shorts. #endif gsSPVertex(koopa_seg6_vertex_0600B5F0, 15, 0), gsSP2Triangles( 0, 1, 2, 0x0, 3, 4, 5, 0x0), diff --git a/actors/koopa_flag/model.inc.c b/actors/koopa_flag/model.inc.c index a706dee2..d56af4be 100644 --- a/actors/koopa_flag/model.inc.c +++ b/actors/koopa_flag/model.inc.c @@ -19,7 +19,7 @@ static const Lights1 koopa_flag_seg6_lights_06000030 = gdSPDefLights1( ); // 0x06000048 -ALIGNED8 static const u8 koopa_flag_seg6_texture_06000048[] = { +ALIGNED8 static const Texture koopa_flag_seg6_texture_06000048[] = { #include "actors/koopa_flag/koopa_flag_banner.rgba16.inc.c" }; diff --git a/actors/koopa_shell/model.inc.c b/actors/koopa_shell/model.inc.c index 7e4042e2..15ab72e8 100644 --- a/actors/koopa_shell/model.inc.c +++ b/actors/koopa_shell/model.inc.c @@ -408,12 +408,12 @@ static const Lights1 koopa_shell_seg8_lights_08027488 = gdSPDefLights1( ); // 0x080274A0 -ALIGNED8 static const u8 koopa_shell_seg8_texture_080274A0[] = { +ALIGNED8 static const Texture koopa_shell_seg8_texture_080274A0[] = { #include "actors/koopa_shell/koopa_shell_front.rgba16.inc.c" }; // 0x08027CA0 -ALIGNED8 static const u8 koopa_shell_seg8_texture_08027CA0[] = { +ALIGNED8 static const Texture koopa_shell_seg8_texture_08027CA0[] = { #include "actors/koopa_shell/koopa_shell_back.rgba16.inc.c" }; diff --git a/actors/lakitu_cameraman/model.inc.c b/actors/lakitu_cameraman/model.inc.c index 8db4d268..7392743b 100644 --- a/actors/lakitu_cameraman/model.inc.c +++ b/actors/lakitu_cameraman/model.inc.c @@ -1,32 +1,32 @@ // Lakitu (Cameraman) // 0x06000000 -ALIGNED8 static const u8 lakitu_seg6_texture_06000000[] = { +ALIGNED8 static const Texture lakitu_seg6_texture_06000000[] = { #include "actors/lakitu_cameraman/lakitu_cameraman_cloud_face_unused.rgba16.inc.c" }; // 0x06000800 -ALIGNED8 static const u8 lakitu_seg6_texture_06000800[] = { +ALIGNED8 static const Texture lakitu_seg6_texture_06000800[] = { #include "actors/lakitu_cameraman/lakitu_cameraman_eyes_open.rgba16.inc.c" }; // 0x06001800 -ALIGNED8 static const u8 lakitu_seg6_texture_06001800[] = { +ALIGNED8 static const Texture lakitu_seg6_texture_06001800[] = { #include "actors/lakitu_cameraman/lakitu_cameraman_eyes_closed.rgba16.inc.c" }; // 0x06002800 -ALIGNED8 static const u8 lakitu_seg6_texture_06002800[] = { +ALIGNED8 static const Texture lakitu_seg6_texture_06002800[] = { #include "actors/lakitu_cameraman/lakitu_cameraman_shell.rgba16.inc.c" }; // 0x06003000 -ALIGNED8 static const u8 lakitu_seg6_texture_06003000[] = { +ALIGNED8 static const Texture lakitu_seg6_texture_06003000[] = { #include "actors/lakitu_cameraman/lakitu_cameraman_frown.rgba16.inc.c" }; // 0x06003800 -ALIGNED8 static const u8 lakitu_seg6_texture_06003800[] = { +ALIGNED8 static const Texture lakitu_seg6_texture_06003800[] = { #include "actors/lakitu_cameraman/lakitu_camera_lens.rgba16.inc.c" }; diff --git a/actors/lakitu_enemy/model.inc.c b/actors/lakitu_enemy/model.inc.c index 0cc41831..669f917f 100644 --- a/actors/lakitu_enemy/model.inc.c +++ b/actors/lakitu_enemy/model.inc.c @@ -2,58 +2,58 @@ // Unreferenced light group UNUSED static const Lights1 lakitu_enemy_lights_unused1 = gdSPDefLights1( - 0x33, 0x1f, 0x0c, - 0xcc, 0x7f, 0x33, 0x28, 0x28, 0x28 + 0x33, 0x1f, 0x0c, + 0xcc, 0x7f, 0x33, 0x28, 0x28, 0x28 ); // 0x0500ECB0 static const Lights1 lakitu_enemy_seg5_lights_0500ECB0 = gdSPDefLights1( - 0x29, 0x13, 0x06, - 0xa5, 0x4f, 0x1b, 0x28, 0x28, 0x28 + 0x29, 0x13, 0x06, + 0xa5, 0x4f, 0x1b, 0x28, 0x28, 0x28 ); // Unreferenced light group UNUSED static const Lights1 lakitu_enemy_lights_unused2 = gdSPDefLights1( - 0x0d, 0x2c, 0x0b, - 0x34, 0xb2, 0x2c, 0x28, 0x28, 0x28 + 0x0d, 0x2c, 0x0b, + 0x34, 0xb2, 0x2c, 0x28, 0x28, 0x28 ); // Unreferenced texture // 0x0500ECE0 -ALIGNED8 static const u8 lakitu_enemy_seg5_texture_0500ECE0[] = { +ALIGNED8 static const Texture lakitu_enemy_seg5_texture_0500ECE0[] = { #include "actors/lakitu_enemy/lakitu_enemy_cloud_face_unused.rgba16.inc.c" }; // 0x0500F4E0 -ALIGNED8 static const u8 lakitu_enemy_seg5_texture_0500F4E0[] = { +ALIGNED8 static const Texture lakitu_enemy_seg5_texture_0500F4E0[] = { #include "actors/lakitu_enemy/lakitu_enemy_eyes_open.rgba16.inc.c" }; // 0x050104E0 -ALIGNED8 static const u8 lakitu_enemy_seg5_texture_050104E0[] = { +ALIGNED8 static const Texture lakitu_enemy_seg5_texture_050104E0[] = { #include "actors/lakitu_enemy/lakitu_enemy_eyes_closed.rgba16.inc.c" }; // 0x050114E0 -ALIGNED8 static const u8 lakitu_enemy_seg5_texture_050114E0[] = { +ALIGNED8 static const Texture lakitu_enemy_seg5_texture_050114E0[] = { #include "actors/lakitu_enemy/lakitu_enemy_shell.rgba16.inc.c" }; // 0x05011CE0 -ALIGNED8 static const u8 lakitu_enemy_seg5_texture_05011CE0[] = { +ALIGNED8 static const Texture lakitu_enemy_seg5_texture_05011CE0[] = { #include "actors/lakitu_enemy/lakitu_enemy_frown.rgba16.inc.c" }; // 0x050124E0 static const Lights1 lakitu_enemy_seg5_lights_050124E0 = gdSPDefLights1( - 0x7f, 0x7f, 0x7f, - 0xff, 0xff, 0xff, 0x28, 0x28, 0x28 + 0x7f, 0x7f, 0x7f, + 0xff, 0xff, 0xff, 0x28, 0x28, 0x28 ); // 0x050124F8 static const Lights1 lakitu_enemy_seg5_lights_050124F8 = gdSPDefLights1( - 0x79, 0x55, 0x00, - 0xf2, 0xab, 0x00, 0x28, 0x28, 0x28 + 0x79, 0x55, 0x00, + 0xf2, 0xab, 0x00, 0x28, 0x28, 0x28 ); // 0x05012510 diff --git a/actors/leaves/model.inc.c b/actors/leaves/model.inc.c index fb5727f7..72c52331 100644 --- a/actors/leaves/model.inc.c +++ b/actors/leaves/model.inc.c @@ -9,7 +9,7 @@ static const Vtx leaves_seg3_vertex_0301CBA0[] = { }; // 0x0301CBE0 -ALIGNED8 static const u8 leaves_seg3_texture_0301CBE0[] = { +ALIGNED8 static const Texture leaves_seg3_texture_0301CBE0[] = { #include "actors/leaves/leaf.rgba16.inc.c" }; diff --git a/actors/mad_piano/model.inc.c b/actors/mad_piano/model.inc.c index 8240963e..da3c9fd4 100644 --- a/actors/mad_piano/model.inc.c +++ b/actors/mad_piano/model.inc.c @@ -25,32 +25,32 @@ UNUSED static const Lights1 mad_piano_lights_unused4 = gdSPDefLights1( ); // 0x05006AF0 -ALIGNED8 static const u8 mad_piano_seg5_texture_05006AF0[] = { +ALIGNED8 static const Texture mad_piano_seg5_texture_05006AF0[] = { #include "actors/mad_piano/mad_piano_tooth.rgba16.inc.c" }; // 0x050072F0 -ALIGNED8 static const u8 mad_piano_seg5_texture_050072F0[] = { +ALIGNED8 static const Texture mad_piano_seg5_texture_050072F0[] = { #include "actors/mad_piano/mad_piano_body.rgba16.inc.c" }; // 0x050076F0 -ALIGNED8 static const u8 mad_piano_seg5_texture_050076F0[] = { +ALIGNED8 static const Texture mad_piano_seg5_texture_050076F0[] = { #include "actors/mad_piano/mad_piano_keys_corner.rgba16.inc.c" }; // 0x05007AF0 -ALIGNED8 static const u8 mad_piano_seg5_texture_05007AF0[] = { +ALIGNED8 static const Texture mad_piano_seg5_texture_05007AF0[] = { #include "actors/mad_piano/mad_piano_mouth.rgba16.inc.c" }; // 0x05007EF0 -ALIGNED8 static const u8 mad_piano_seg5_texture_05007EF0[] = { +ALIGNED8 static const Texture mad_piano_seg5_texture_05007EF0[] = { #include "actors/mad_piano/mad_piano_keys.rgba16.inc.c" }; // 0x050082F0 -ALIGNED8 static const u8 mad_piano_seg5_texture_050082F0[] = { +ALIGNED8 static const Texture mad_piano_seg5_texture_050082F0[] = { #include "actors/mad_piano/mad_piano_keys_edge.rgba16.inc.c" }; diff --git a/actors/manta/model.inc.c b/actors/manta/model.inc.c index 72462304..dc5c6519 100644 --- a/actors/manta/model.inc.c +++ b/actors/manta/model.inc.c @@ -19,22 +19,22 @@ static const Lights1 manta_lights_unused = gdSPDefLights1( ); // 0x050017A0 -ALIGNED8 static const u8 manta_seg5_texture_050017A0[] = { +ALIGNED8 static const Texture manta_seg5_texture_050017A0[] = { #include "actors/manta/manta_fin_corner.rgba16.inc.c" }; // 0x05001FA0 -ALIGNED8 static const u8 manta_seg5_texture_05001FA0[] = { +ALIGNED8 static const Texture manta_seg5_texture_05001FA0[] = { #include "actors/manta/manta_gills.rgba16.inc.c" }; // 0x05002FA0 -ALIGNED8 static const u8 manta_seg5_texture_05002FA0[] = { +ALIGNED8 static const Texture manta_seg5_texture_05002FA0[] = { #include "actors/manta/manta_eye.rgba16.inc.c" }; // 0x050037A0 -ALIGNED8 static const u8 manta_seg5_texture_050037A0[] = { +ALIGNED8 static const Texture manta_seg5_texture_050037A0[] = { #include "actors/manta/manta_fin_edge.rgba16.inc.c" }; diff --git a/actors/mario/model.inc.c b/actors/mario/model.inc.c index 7a37b734..a9591336 100644 --- a/actors/mario/model.inc.c +++ b/actors/mario/model.inc.c @@ -37,99 +37,99 @@ static const Lights1 mario_brown2_lights_group = gdSPDefLights1( ); // 0x04000090 -ALIGNED8 static const u8 mario_texture_metal[] = { +ALIGNED8 static const Texture mario_texture_metal[] = { #include "actors/mario/mario_metal.rgba16.inc.c" }; // 0x04001090 -ALIGNED8 static const u8 mario_texture_yellow_button[] = { +ALIGNED8 static const Texture mario_texture_yellow_button[] = { #include "actors/mario/mario_overalls_button.rgba16.inc.c" }; // 0x04001890 -ALIGNED8 static const u8 mario_texture_m_logo[] = { +ALIGNED8 static const Texture mario_texture_m_logo[] = { #include "actors/mario/custom_mario_logo.rgba16.inc.c" }; // 0x04002090 -ALIGNED8 static const u8 mario_texture_hair_sideburn[] = { +ALIGNED8 static const Texture mario_texture_hair_sideburn[] = { #include "actors/mario/mario_sideburn.rgba16.inc.c" }; // 0x04002890 -ALIGNED8 static const u8 mario_texture_mustache[] = { +ALIGNED8 static const Texture mario_texture_mustache[] = { #include "actors/mario/mario_mustache.rgba16.inc.c" }; // 0x04003090 -ALIGNED8 static const u8 mario_texture_eyes_front[] = { +ALIGNED8 static const Texture mario_texture_eyes_front[] = { #include "actors/mario/mario_eyes_center.rgba16.inc.c" }; // 0x04003890 -ALIGNED8 static const u8 mario_texture_eyes_half_closed[] = { +ALIGNED8 static const Texture mario_texture_eyes_half_closed[] = { #include "actors/mario/mario_eyes_half_closed.rgba16.inc.c" }; // 0x04004090 -ALIGNED8 static const u8 mario_texture_eyes_closed[] = { +ALIGNED8 static const Texture mario_texture_eyes_closed[] = { #include "actors/mario/mario_eyes_closed.rgba16.inc.c" }; // Unreferenced // 0x04004890 -ALIGNED8 static const u8 mario_texture_eyes_closed_unused1[] = { +ALIGNED8 static const Texture mario_texture_eyes_closed_unused1[] = { #include "actors/mario/mario_eyes_closed_unused_0.rgba16.inc.c" }; // Unreferenced // 0x04005090 -ALIGNED8 static const u8 mario_texture_eyes_closed_unused2[] = { +ALIGNED8 static const Texture mario_texture_eyes_closed_unused2[] = { #include "actors/mario/mario_eyes_closed_unused_1.rgba16.inc.c" }; // 0x04005890 -ALIGNED8 static const u8 mario_texture_eyes_right[] = { +ALIGNED8 static const Texture mario_texture_eyes_right[] = { #include "actors/mario/mario_eyes_left_unused.rgba16.inc.c" }; // 0x04006090 -ALIGNED8 static const u8 mario_texture_eyes_left[] = { +ALIGNED8 static const Texture mario_texture_eyes_left[] = { #include "actors/mario/mario_eyes_right_unused.rgba16.inc.c" }; // 0x04006890 -ALIGNED8 static const u8 mario_texture_eyes_up[] = { +ALIGNED8 static const Texture mario_texture_eyes_up[] = { #include "actors/mario/mario_eyes_up_unused.rgba16.inc.c" }; // 0x04007090 -ALIGNED8 static const u8 mario_texture_eyes_down[] = { +ALIGNED8 static const Texture mario_texture_eyes_down[] = { #include "actors/mario/mario_eyes_down_unused.rgba16.inc.c" }; // 0x04007890 -ALIGNED8 static const u8 mario_texture_eyes_dead[] = { +ALIGNED8 static const Texture mario_texture_eyes_dead[] = { #include "actors/mario/mario_eyes_dead.rgba16.inc.c" }; // 0x04008090 -ALIGNED8 static const u8 mario_texture_wings_half_1[] = { +ALIGNED8 static const Texture mario_texture_wings_half_1[] = { #include "actors/mario/mario_wing.rgba16.inc.c" }; // 0x04009090 -ALIGNED8 static const u8 mario_texture_wings_half_2[] = { +ALIGNED8 static const Texture mario_texture_wings_half_2[] = { #include "actors/mario/mario_wing_tip.rgba16.inc.c" }; // 0x0400A090 -ALIGNED8 static const u8 mario_texture_metal_wings_half_1[] = { +ALIGNED8 static const Texture mario_texture_metal_wings_half_1[] = { #include "actors/mario/mario_metal_wing_unused.rgba16.inc.c" }; // 0x0400B090 -ALIGNED8 static const u8 mario_texture_metal_wings_half_2[] = { +ALIGNED8 static const Texture mario_texture_metal_wings_half_2[] = { #include "actors/mario/mario_metal_wing_tip_unused.rgba16.inc.c" }; diff --git a/actors/mario_cap/model.inc.c b/actors/mario_cap/model.inc.c index 3a2e964a..78fe8a39 100644 --- a/actors/mario_cap/model.inc.c +++ b/actors/mario_cap/model.inc.c @@ -19,32 +19,32 @@ static const Lights1 mario_cap_seg3_lights_0301CF38 = gdSPDefLights1( ); // 0x0301CF50 -ALIGNED8 static const u8 mario_cap_seg3_texture_0301CF50[] = { +ALIGNED8 static const Texture mario_cap_seg3_texture_0301CF50[] = { #include "actors/mario_cap/mario_cap_metal.rgba16.inc.c" }; // 0x0301DF50 -ALIGNED8 static const u8 mario_cap_seg3_texture_0301DF50[] = { +ALIGNED8 static const Texture mario_cap_seg3_texture_0301DF50[] = { #include "actors/mario_cap/custom_mario_cap_logo.rgba16.inc.c" }; // 0x0301E750 -ALIGNED8 static const u8 mario_cap_seg3_texture_0301E750[] = { +ALIGNED8 static const Texture mario_cap_seg3_texture_0301E750[] = { #include "actors/mario_cap/mario_cap_wing.rgba16.inc.c" }; // 0x0301F750 -ALIGNED8 static const u8 mario_cap_seg3_texture_0301F750[] = { +ALIGNED8 static const Texture mario_cap_seg3_texture_0301F750[] = { #include "actors/mario_cap/mario_cap_wing_tip.rgba16.inc.c" }; // 0x03020750 -ALIGNED8 static const u8 mario_cap_seg3_texture_03020750[] = { +ALIGNED8 static const Texture mario_cap_seg3_texture_03020750[] = { #include "actors/mario_cap/mario_cap_metal_wing_unused.rgba16.inc.c" }; // 0x03021750 -ALIGNED8 static const u8 mario_cap_seg3_texture_03021750[] = { +ALIGNED8 static const Texture mario_cap_seg3_texture_03021750[] = { #include "actors/mario_cap/mario_cap_metal_wing_tip_unused.rgba16.inc.c" }; diff --git a/actors/metal_box/model.inc.c b/actors/metal_box/model.inc.c index 29589223..a19761a4 100644 --- a/actors/metal_box/model.inc.c +++ b/actors/metal_box/model.inc.c @@ -7,7 +7,7 @@ static const Lights1 metal_box_seg8_lights_08023980 = gdSPDefLights1( ); // 0x08023998 -ALIGNED8 static const u8 metal_box_seg8_texture_08023998[] = { +ALIGNED8 static const Texture metal_box_seg8_texture_08023998[] = { #include "actors/metal_box/metal_box_side.rgba16.inc.c" }; diff --git a/actors/mips/model.inc.c b/actors/mips/model.inc.c index acbefd2f..de120fb0 100644 --- a/actors/mips/model.inc.c +++ b/actors/mips/model.inc.c @@ -1,7 +1,7 @@ // Mips // 0x0600FB80 -ALIGNED8 static const u8 mips_seg6_texture_0600FB80[] = { +ALIGNED8 static const Texture mips_seg6_texture_0600FB80[] = { #include "actors/mips/mips_eyes.rgba16.inc.c" }; diff --git a/actors/mist/model.inc.c b/actors/mist/model.inc.c index ef4d4bab..4407457b 100644 --- a/actors/mist/model.inc.c +++ b/actors/mist/model.inc.c @@ -17,7 +17,7 @@ static const Vtx mist_seg3_vertex_03000040[] = { }; // 0x03000080 -ALIGNED8 static const u8 mist_seg3_texture_03000080[] = { +ALIGNED8 static const Texture mist_seg3_texture_03000080[] = { #include "actors/mist/mist.ia16.inc.c" }; diff --git a/actors/moneybag/model.inc.c b/actors/moneybag/model.inc.c index 935aa123..fa3505bc 100644 --- a/actors/moneybag/model.inc.c +++ b/actors/moneybag/model.inc.c @@ -1,12 +1,12 @@ // Moneybag // 0x060039B0 -ALIGNED8 static const u8 moneybag_seg6_texture_060039B0[] = { +ALIGNED8 static const Texture moneybag_seg6_texture_060039B0[] = { #include "actors/moneybag/moneybag_mouth.rgba16.inc.c" }; // 0x060049B0 -ALIGNED8 static const u8 moneybag_seg6_texture_060049B0[] = { +ALIGNED8 static const Texture moneybag_seg6_texture_060049B0[] = { #include "actors/moneybag/moneybag_eyes.rgba16.inc.c" }; diff --git a/actors/monty_mole/model.inc.c b/actors/monty_mole/model.inc.c index 6998aee0..c9f0c129 100644 --- a/actors/monty_mole/model.inc.c +++ b/actors/monty_mole/model.inc.c @@ -37,27 +37,27 @@ UNUSED static const Lights1 monty_mole_lights_unused6 = gdSPDefLights1( ); // 0x05000970 -ALIGNED8 static const u8 monty_mole_seg5_texture_05000970[] = { +ALIGNED8 static const Texture monty_mole_seg5_texture_05000970[] = { #include "actors/monty_mole/monty_mole_cheek.rgba16.inc.c" }; // 0x05001170 -ALIGNED8 static const u8 monty_mole_seg5_texture_05001170[] = { +ALIGNED8 static const Texture monty_mole_seg5_texture_05001170[] = { #include "actors/monty_mole/monty_mole_eye.rgba16.inc.c" }; // 0x05001970 -ALIGNED8 static const u8 monty_mole_seg5_texture_05001970[] = { +ALIGNED8 static const Texture monty_mole_seg5_texture_05001970[] = { #include "actors/monty_mole/monty_mole_nose.rgba16.inc.c" }; // 0x05002170 -ALIGNED8 static const u8 monty_mole_seg5_texture_05002170[] = { +ALIGNED8 static const Texture monty_mole_seg5_texture_05002170[] = { #include "actors/monty_mole/monty_mole_tooth.rgba16.inc.c" }; // 0x05002970 -ALIGNED8 static const u8 monty_mole_seg5_texture_05002970[] = { +ALIGNED8 static const Texture monty_mole_seg5_texture_05002970[] = { #include "actors/monty_mole/monty_mole_claw.rgba16.inc.c" }; diff --git a/actors/monty_mole_hole/model.inc.c b/actors/monty_mole_hole/model.inc.c index 8b4fe744..23f7fc63 100644 --- a/actors/monty_mole_hole/model.inc.c +++ b/actors/monty_mole_hole/model.inc.c @@ -9,7 +9,7 @@ static const Vtx monty_mole_hole_seg5_vertex_05000000[] = { }; // 0x05000040 -ALIGNED8 static const u8 monty_mole_hole_seg5_texture_05000040[] = { +ALIGNED8 static const Texture monty_mole_hole_seg5_texture_05000040[] = { #include "actors/monty_mole_hole/monty_mole_hole.ia16.inc.c" }; diff --git a/actors/mr_i_eyeball/model.inc.c b/actors/mr_i_eyeball/model.inc.c index 2798aff8..0ddd68be 100644 --- a/actors/mr_i_eyeball/model.inc.c +++ b/actors/mr_i_eyeball/model.inc.c @@ -13,12 +13,12 @@ static const Vtx mr_i_eyeball_seg6_vertex_06000000[] = { }; // 0x06000080 -ALIGNED8 static const u8 mr_i_eyeball_seg6_texture_06000080[] = { +ALIGNED8 static const Texture mr_i_eyeball_seg6_texture_06000080[] = { #include "actors/mr_i_eyeball/mr_i_eyeball_left_side.rgba16.inc.c" }; // 0x06001080 -ALIGNED8 static const u8 mr_i_eyeball_seg6_texture_06001080[] = { +ALIGNED8 static const Texture mr_i_eyeball_seg6_texture_06001080[] = { #include "actors/mr_i_eyeball/mr_i_eyeball_right_side.rgba16.inc.c" }; diff --git a/actors/mr_i_iris/model.inc.c b/actors/mr_i_iris/model.inc.c index b617e879..17368e9b 100644 --- a/actors/mr_i_iris/model.inc.c +++ b/actors/mr_i_iris/model.inc.c @@ -9,22 +9,22 @@ static const Vtx mr_i_iris_seg6_vertex_06002130[] = { }; // 0x06002170 -ALIGNED8 static const u8 mr_i_iris_seg6_texture_06002170[] = { +ALIGNED8 static const Texture mr_i_iris_seg6_texture_06002170[] = { #include "actors/mr_i_iris/mr_i_iris_open.rgba16.inc.c" }; // 0x06002970 -ALIGNED8 static const u8 mr_i_iris_seg6_texture_06002970[] = { +ALIGNED8 static const Texture mr_i_iris_seg6_texture_06002970[] = { #include "actors/mr_i_iris/mr_i_iris_mostly_open.rgba16.inc.c" }; // 0x06003170 -ALIGNED8 static const u8 mr_i_iris_seg6_texture_06003170[] = { +ALIGNED8 static const Texture mr_i_iris_seg6_texture_06003170[] = { #include "actors/mr_i_iris/mr_i_iris_mostly_closed.rgba16.inc.c" }; // 0x06003970 -ALIGNED8 static const u8 mr_i_iris_seg6_texture_06003970[] = { +ALIGNED8 static const Texture mr_i_iris_seg6_texture_06003970[] = { #include "actors/mr_i_iris/mr_i_iris_closed.rgba16.inc.c" }; diff --git a/actors/mushroom_1up/model.inc.c b/actors/mushroom_1up/model.inc.c index 86f1a6de..eaaa1d13 100644 --- a/actors/mushroom_1up/model.inc.c +++ b/actors/mushroom_1up/model.inc.c @@ -9,7 +9,7 @@ static const Vtx mushroom_1up_seg3_vertex_030295E8[] = { }; // 0x03029628 -ALIGNED8 static const u8 mushroom_1up_seg3_texture_03029628[] = { +ALIGNED8 static const Texture mushroom_1up_seg3_texture_03029628[] = { #include "actors/mushroom_1up/1-up_mushroom.rgba16.inc.c" }; diff --git a/actors/peach/model.inc.c b/actors/peach/model.inc.c index 0514802f..05ad2cba 100644 --- a/actors/peach/model.inc.c +++ b/actors/peach/model.inc.c @@ -13,52 +13,52 @@ static const Lights1 peach_seg5_lights_05000A10 = gdSPDefLights1( ); // 0x05000A28 -ALIGNED8 static const u8 peach_seg5_texture_05000A28[] = { +ALIGNED8 static const Texture peach_seg5_texture_05000A28[] = { #include "actors/peach/peach_eye_open.rgba16.inc.c" }; // 0x05001228 -ALIGNED8 static const u8 peach_seg5_texture_05001228[] = { +ALIGNED8 static const Texture peach_seg5_texture_05001228[] = { #include "actors/peach/peach_eye_mostly_open.rgba16.inc.c" }; // 0x05001A28 -ALIGNED8 static const u8 peach_seg5_texture_05001A28[] = { +ALIGNED8 static const Texture peach_seg5_texture_05001A28[] = { #include "actors/peach/peach_eye_mostly_closed.rgba16.inc.c" }; // 0x05002228 -ALIGNED8 static const u8 peach_seg5_texture_05002228[] = { +ALIGNED8 static const Texture peach_seg5_texture_05002228[] = { #include "actors/peach/peach_eye_closed.rgba16.inc.c" }; // 0x05002A28 -ALIGNED8 static const u8 peach_seg5_texture_05002A28[] = { +ALIGNED8 static const Texture peach_seg5_texture_05002A28[] = { #include "actors/peach/peach_crown_jewel.rgba16.inc.c" }; // 0x05002C28 -ALIGNED8 static const u8 peach_seg5_texture_05002C28[] = { +ALIGNED8 static const Texture peach_seg5_texture_05002C28[] = { #include "actors/peach/peach_chest_jewel.rgba16.inc.c" }; // 0x05002E28 -ALIGNED8 static const u8 peach_seg5_texture_05002E28[] = { +ALIGNED8 static const Texture peach_seg5_texture_05002E28[] = { #include "actors/peach/peach_lips_scrunched.rgba16.inc.c" }; // 0x05003628 -ALIGNED8 static const u8 peach_seg5_texture_05003628[] = { +ALIGNED8 static const Texture peach_seg5_texture_05003628[] = { #include "actors/peach/peach_lips.rgba16.inc.c" }; // 0x05003E28 -ALIGNED8 static const u8 peach_seg5_texture_05003E28[] = { +ALIGNED8 static const Texture peach_seg5_texture_05003E28[] = { #include "actors/peach/peach_nostril.rgba16.inc.c" }; // 0x05004028 -ALIGNED8 static const u8 peach_seg5_texture_05004028[] = { +ALIGNED8 static const Texture peach_seg5_texture_05004028[] = { #include "actors/peach/peach_dress.rgba16.inc.c" }; diff --git a/actors/pebble/model.inc.c b/actors/pebble/model.inc.c index 725501a2..7a72ff3d 100644 --- a/actors/pebble/model.inc.c +++ b/actors/pebble/model.inc.c @@ -9,7 +9,7 @@ static const Vtx pebble_seg3_vertex_0301C2C0[] = { }; // 0x0301C300 -ALIGNED8 static const u8 pebble_seg3_texture_0301C300[] = { +ALIGNED8 static const Texture pebble_seg3_texture_0301C300[] = { #include "actors/pebble/pebble.rgba16.inc.c" }; diff --git a/actors/penguin/geo.inc.c b/actors/penguin/geo.inc.c index 29fb5af2..aea40dd9 100644 --- a/actors/penguin/geo.inc.c +++ b/actors/penguin/geo.inc.c @@ -1,6 +1,6 @@ // 0x0C000104 const GeoLayout penguin_geo[] = { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) GEO_SHADOW(SHADOW_CIRCLE_9_VERTS, 0x96, 60), #else GEO_SHADOW(SHADOW_CIRCLE_4_VERTS, 0x96, 100), diff --git a/actors/penguin/model.inc.c b/actors/penguin/model.inc.c index ff9eed78..5dcc513e 100644 --- a/actors/penguin/model.inc.c +++ b/actors/penguin/model.inc.c @@ -25,32 +25,32 @@ static const Lights1 penguin_seg5_lights_05002DC8 = gdSPDefLights1( ); // 0x05002DE0 -ALIGNED8 static const u8 penguin_seg5_texture_05002DE0[] = { +ALIGNED8 static const Texture penguin_seg5_texture_05002DE0[] = { #include "actors/penguin/penguin_eye_open.rgba16.inc.c" }; // 0x050035E0 -ALIGNED8 static const u8 penguin_seg5_texture_050035E0[] = { +ALIGNED8 static const Texture penguin_seg5_texture_050035E0[] = { #include "actors/penguin/penguin_eye_half_closed.rgba16.inc.c" }; // 0x05003DE0 -ALIGNED8 static const u8 penguin_seg5_texture_05003DE0[] = { +ALIGNED8 static const Texture penguin_seg5_texture_05003DE0[] = { #include "actors/penguin/penguin_eye_closed.rgba16.inc.c" }; // 0x050045E0 -ALIGNED8 static const u8 penguin_seg5_texture_050045E0[] = { +ALIGNED8 static const Texture penguin_seg5_texture_050045E0[] = { #include "actors/penguin/penguin_eye_angry.rgba16.inc.c" }; // 0x05004DE0 -ALIGNED8 static const u8 penguin_seg5_texture_05004DE0[] = { +ALIGNED8 static const Texture penguin_seg5_texture_05004DE0[] = { #include "actors/penguin/penguin_eye_angry_unused.rgba16.inc.c" }; // 0x050055E0 -ALIGNED8 static const u8 penguin_seg5_texture_050055E0[] = { +ALIGNED8 static const Texture penguin_seg5_texture_050055E0[] = { #include "actors/penguin/penguin_beak.rgba16.inc.c" }; diff --git a/actors/piranha_plant/model.inc.c b/actors/piranha_plant/model.inc.c index 31603f95..9d6a8f46 100644 --- a/actors/piranha_plant/model.inc.c +++ b/actors/piranha_plant/model.inc.c @@ -19,32 +19,32 @@ static const Lights1 piranha_plant_seg6_lights_060113E0 = gdSPDefLights1( ); // 0x060113F8 -ALIGNED8 static const u8 piranha_plant_seg6_texture_060113F8[] = { +ALIGNED8 static const Texture piranha_plant_seg6_texture_060113F8[] = { #include "actors/piranha_plant/piranha_plant_tongue.rgba16.inc.c" }; // 0x060123F8 -ALIGNED8 static const u8 piranha_plant_seg6_texture_060123F8[] = { +ALIGNED8 static const Texture piranha_plant_seg6_texture_060123F8[] = { #include "actors/piranha_plant/piranha_plant_skin.rgba16.inc.c" }; // 0x06012BF8 -ALIGNED8 static const u8 piranha_plant_seg6_texture_06012BF8[] = { +ALIGNED8 static const Texture piranha_plant_seg6_texture_06012BF8[] = { #include "actors/piranha_plant/piranha_plant_stem.rgba16.inc.c" }; // 0x060133F8 -ALIGNED8 static const u8 piranha_plant_seg6_texture_060133F8[] = { +ALIGNED8 static const Texture piranha_plant_seg6_texture_060133F8[] = { #include "actors/piranha_plant/piranha_plant_bottom_lip.rgba16.inc.c" }; // 0x06013BF8 -ALIGNED8 static const u8 piranha_plant_seg6_texture_06013BF8[] = { +ALIGNED8 static const Texture piranha_plant_seg6_texture_06013BF8[] = { #include "actors/piranha_plant/piranha_plant_tooth.rgba16.inc.c" }; // 0x060143F8 -ALIGNED8 static const u8 piranha_plant_seg6_texture_060143F8[] = { +ALIGNED8 static const Texture piranha_plant_seg6_texture_060143F8[] = { #include "actors/piranha_plant/piranha_plant_leaf.rgba16.inc.c" }; diff --git a/actors/pokey/model.inc.c b/actors/pokey/model.inc.c index 995c6a19..c91d515c 100644 --- a/actors/pokey/model.inc.c +++ b/actors/pokey/model.inc.c @@ -9,12 +9,12 @@ static const Vtx pokey_seg5_vertex_05011710[] = { }; // 0x05011750 -ALIGNED8 static const u8 pokey_seg5_texture_05011750[] = { +ALIGNED8 static const Texture pokey_seg5_texture_05011750[] = { #include "actors/pokey/pokey_face.rgba16.inc.c" }; // 0x05011F50 -ALIGNED8 static const u8 pokey_seg5_texture_05011F50[] = { +ALIGNED8 static const Texture pokey_seg5_texture_05011F50[] = { #include "actors/pokey/pokey_face_blink.rgba16.inc.c" }; @@ -71,7 +71,7 @@ static const Vtx pokey_seg5_vertex_05012838[] = { }; // 0x05012878 -ALIGNED8 static const u8 pokey_seg5_texture_05012878[] = { +ALIGNED8 static const Texture pokey_seg5_texture_05012878[] = { #include "actors/pokey/pokey_body.rgba16.inc.c" }; diff --git a/actors/poundable_pole/model.inc.c b/actors/poundable_pole/model.inc.c index 14f19f8e..2268e858 100644 --- a/actors/poundable_pole/model.inc.c +++ b/actors/poundable_pole/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 poundable_pole_seg6_lights_06001038 = gdSPDefLights1( ); // 0x06001050 -ALIGNED8 static const u8 poundable_pole_seg6_texture_06001050[] = { +ALIGNED8 static const Texture poundable_pole_seg6_texture_06001050[] = { #include "actors/poundable_pole/poundable_pole_top.rgba16.inc.c" }; // 0x06001850 -ALIGNED8 static const u8 poundable_pole_seg6_texture_06001850[] = { +ALIGNED8 static const Texture poundable_pole_seg6_texture_06001850[] = { #include "actors/poundable_pole/poundable_pole_side.rgba16.inc.c" }; diff --git a/actors/power_meter/model.inc.c b/actors/power_meter/model.inc.c index dd30c871..1a2c17f6 100644 --- a/actors/power_meter/model.inc.c +++ b/actors/power_meter/model.inc.c @@ -3,57 +3,57 @@ UNUSED static const u64 power_meter_unused_1 = 0; // 0x030233E0 -ALIGNED8 static const u8 texture_power_meter_left_side[] = { +ALIGNED8 static const Texture texture_power_meter_left_side[] = { #include "actors/power_meter/power_meter_left_side.rgba16.inc.c" }; // 0x030243E0 -ALIGNED8 static const u8 texture_power_meter_right_side[] = { +ALIGNED8 static const Texture texture_power_meter_right_side[] = { #include "actors/power_meter/power_meter_right_side.rgba16.inc.c" }; // 0x030253E0 -ALIGNED8 static const u8 texture_power_meter_full[] = { +ALIGNED8 static const Texture texture_power_meter_full[] = { #include "actors/power_meter/power_meter_full.rgba16.inc.c" }; // 0x03025BE0 -ALIGNED8 static const u8 texture_power_meter_seven_segments[] = { +ALIGNED8 static const Texture texture_power_meter_seven_segments[] = { #include "actors/power_meter/power_meter_seven_segments.rgba16.inc.c" }; // 0x030263E0 -ALIGNED8 static const u8 texture_power_meter_six_segments[] = { +ALIGNED8 static const Texture texture_power_meter_six_segments[] = { #include "actors/power_meter/power_meter_six_segments.rgba16.inc.c" }; // 0x03026BE0 -ALIGNED8 static const u8 texture_power_meter_five_segments[] = { +ALIGNED8 static const Texture texture_power_meter_five_segments[] = { #include "actors/power_meter/power_meter_five_segments.rgba16.inc.c" }; // 0x030273E0 -ALIGNED8 static const u8 texture_power_meter_four_segments[] = { +ALIGNED8 static const Texture texture_power_meter_four_segments[] = { #include "actors/power_meter/power_meter_four_segments.rgba16.inc.c" }; // 0x03027BE0 -ALIGNED8 static const u8 texture_power_meter_three_segments[] = { +ALIGNED8 static const Texture texture_power_meter_three_segments[] = { #include "actors/power_meter/power_meter_three_segments.rgba16.inc.c" }; // 0x030283E0 -ALIGNED8 static const u8 texture_power_meter_two_segments[] = { +ALIGNED8 static const Texture texture_power_meter_two_segments[] = { #include "actors/power_meter/power_meter_two_segments.rgba16.inc.c" }; // 0x03028BE0 -ALIGNED8 static const u8 texture_power_meter_one_segments[] = { +ALIGNED8 static const Texture texture_power_meter_one_segments[] = { #include "actors/power_meter/power_meter_one_segment.rgba16.inc.c" }; // 0x030293E0 -const u8 *const power_meter_health_segments_lut[] = { +const Texture *const power_meter_health_segments_lut[] = { texture_power_meter_one_segments, texture_power_meter_two_segments, texture_power_meter_three_segments, diff --git a/actors/purple_switch/model.inc.c b/actors/purple_switch/model.inc.c index dea765f0..25b41250 100644 --- a/actors/purple_switch/model.inc.c +++ b/actors/purple_switch/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 purple_switch_seg8_lights_0800C090 = gdSPDefLights1( ); // 0x0800C0A8 -ALIGNED8 static const u8 purple_switch_seg8_texture_0800C0A8[] = { +ALIGNED8 static const Texture purple_switch_seg8_texture_0800C0A8[] = { #include "actors/purple_switch/purple_switch_base.rgba16.inc.c" }; // 0x0800C128 -ALIGNED8 static const u8 purple_switch_seg8_texture_0800C128[] = { +ALIGNED8 static const Texture purple_switch_seg8_texture_0800C128[] = { #include "actors/purple_switch/purple_switch_exclamation_point.rgba16.inc.c" }; diff --git a/actors/sand/model.inc.c b/actors/sand/model.inc.c index 0dce0412..d8319165 100644 --- a/actors/sand/model.inc.c +++ b/actors/sand/model.inc.c @@ -9,7 +9,7 @@ static const Vtx sand_seg3_vertex_0302BA90[] = { }; // 0x0302BAD0 -ALIGNED8 static const u8 sand_seg3_texture_0302BAD0[] = { +ALIGNED8 static const Texture sand_seg3_texture_0302BAD0[] = { #include "actors/sand/sand_particle.rgba16.inc.c" }; diff --git a/actors/scuttlebug/model.inc.c b/actors/scuttlebug/model.inc.c index 38fdf271..d53a250e 100644 --- a/actors/scuttlebug/model.inc.c +++ b/actors/scuttlebug/model.inc.c @@ -13,27 +13,27 @@ UNUSED static const Lights1 scuttlebug_lights_unused2 = gdSPDefLights1( ); // 0x06010108 -ALIGNED8 static const u8 scuttlebug_seg6_texture_06010108[] = { +ALIGNED8 static const Texture scuttlebug_seg6_texture_06010108[] = { #include "actors/scuttlebug/scuttlebug_eye.rgba16.inc.c" }; // 0x06010908 -ALIGNED8 static const u8 scuttlebug_seg6_texture_06010908[] = { +ALIGNED8 static const Texture scuttlebug_seg6_texture_06010908[] = { #include "actors/scuttlebug/scuttlebug_left_side.rgba16.inc.c" }; // 0x06011908 -ALIGNED8 static const u8 scuttlebug_seg6_texture_06011908[] = { +ALIGNED8 static const Texture scuttlebug_seg6_texture_06011908[] = { #include "actors/scuttlebug/scuttlebug_right_side.rgba16.inc.c" }; // 0x06012908 -ALIGNED8 static const u8 scuttlebug_seg6_texture_06012908[] = { +ALIGNED8 static const Texture scuttlebug_seg6_texture_06012908[] = { #include "actors/scuttlebug/scuttlebug_iris.rgba16.inc.c" }; // 0x06013108 -ALIGNED8 static const u8 scuttlebug_seg6_texture_06013108[] = { +ALIGNED8 static const Texture scuttlebug_seg6_texture_06013108[] = { #include "actors/scuttlebug/scuttlebug_leg.rgba16.inc.c" }; diff --git a/actors/seaweed/model.inc.c b/actors/seaweed/model.inc.c index 72a50866..c3c074c5 100644 --- a/actors/seaweed/model.inc.c +++ b/actors/seaweed/model.inc.c @@ -7,22 +7,22 @@ static const Lights1 seaweed_seg6_lights_06007DF8 = gdSPDefLights1( ); // 0x06007E10 -ALIGNED8 static const u8 seaweed_seg6_texture_06007E10[] = { +ALIGNED8 static const Texture seaweed_seg6_texture_06007E10[] = { #include "actors/seaweed/seaweed_tip.rgba16.inc.c" }; // 0x06008610 -ALIGNED8 static const u8 seaweed_seg6_texture_06008610[] = { +ALIGNED8 static const Texture seaweed_seg6_texture_06008610[] = { #include "actors/seaweed/seaweed_upper_center.rgba16.inc.c" }; // 0x06008E10 -ALIGNED8 static const u8 seaweed_seg6_texture_06008E10[] = { +ALIGNED8 static const Texture seaweed_seg6_texture_06008E10[] = { #include "actors/seaweed/seaweed_lower_center.rgba16.inc.c" }; // 0x06009610 -ALIGNED8 static const u8 seaweed_seg6_texture_06009610[] = { +ALIGNED8 static const Texture seaweed_seg6_texture_06009610[] = { #include "actors/seaweed/seaweed_base.rgba16.inc.c" }; diff --git a/actors/skeeter/model.inc.c b/actors/skeeter/model.inc.c index 190bb83d..104b3a31 100644 --- a/actors/skeeter/model.inc.c +++ b/actors/skeeter/model.inc.c @@ -37,12 +37,12 @@ UNUSED static const Lights1 skeeter_lights_unused6 = gdSPDefLights1( ); // 0x06000090 -ALIGNED8 static const u8 skeeter_seg6_texture_06000090[] = { +ALIGNED8 static const Texture skeeter_seg6_texture_06000090[] = { #include "actors/skeeter/skeeter_eye.rgba16.inc.c" }; // 0x06000890 -ALIGNED8 static const u8 skeeter_seg6_texture_06000890[] = { +ALIGNED8 static const Texture skeeter_seg6_texture_06000890[] = { #include "actors/skeeter/skeeter_iris.rgba16.inc.c" }; diff --git a/actors/smoke/model.inc.c b/actors/smoke/model.inc.c index 1f581a08..88e25788 100644 --- a/actors/smoke/model.inc.c +++ b/actors/smoke/model.inc.c @@ -9,7 +9,7 @@ static const Vtx smoke_seg5_vertex_05007280[] = { }; // 0x050072C0 -ALIGNED8 static const u8 smoke_seg5_texture_050072C0[] = { +ALIGNED8 static const Texture smoke_seg5_texture_050072C0[] = { #include "actors/smoke/smoke.ia16.inc.c" }; diff --git a/actors/snowman/model.inc.c b/actors/snowman/model.inc.c index 4cc5de38..ada671f0 100644 --- a/actors/snowman/model.inc.c +++ b/actors/snowman/model.inc.c @@ -28,27 +28,27 @@ UNUSED static const Lights1 snowman_lights_unused4 = gdSPDefLights1( ); // 0x05008C70 -ALIGNED8 static const u8 snowman_seg5_texture_05008C70[] = { +ALIGNED8 static const Texture snowman_seg5_texture_05008C70[] = { #include "actors/snowman/mr_blizzard_mitten.rgba16.inc.c" }; // 0x05009470 -ALIGNED8 static const u8 snowman_seg5_texture_05009470[] = { +ALIGNED8 static const Texture snowman_seg5_texture_05009470[] = { #include "actors/snowman/mr_blizzard_left_side.rgba16.inc.c" }; // 0x0500A470 -ALIGNED8 static const u8 snowman_seg5_texture_0500A470[] = { +ALIGNED8 static const Texture snowman_seg5_texture_0500A470[] = { #include "actors/snowman/mr_blizzard_right_side.rgba16.inc.c" }; // 0x0500B470 -ALIGNED8 static const u8 snowman_seg5_texture_0500B470[] = { +ALIGNED8 static const Texture snowman_seg5_texture_0500B470[] = { #include "actors/snowman/mr_blizzard_eye.rgba16.inc.c" }; // 0x0500BC70 -ALIGNED8 static const u8 snowman_seg5_texture_0500BC70[] = { +ALIGNED8 static const Texture snowman_seg5_texture_0500BC70[] = { #include "actors/snowman/mr_blizzard_mouth.rgba16.inc.c" }; diff --git a/actors/snufit/model.inc.c b/actors/snufit/model.inc.c index 6a5dbbef..0a4ea3b2 100644 --- a/actors/snufit/model.inc.c +++ b/actors/snufit/model.inc.c @@ -1,22 +1,22 @@ // Snufit // 0x060070E0 -ALIGNED8 static const u8 snufit_seg6_texture_060070E0[] = { +ALIGNED8 static const Texture snufit_seg6_texture_060070E0[] = { #include "actors/snufit/snufit_body.rgba16.inc.c" }; // 0x060078E0 -ALIGNED8 static const u8 snufit_seg6_texture_060078E0[] = { +ALIGNED8 static const Texture snufit_seg6_texture_060078E0[] = { #include "actors/snufit/snufit_eye.rgba16.inc.c" }; // 0x060080E0 -ALIGNED8 static const u8 snufit_seg6_texture_060080E0[] = { +ALIGNED8 static const Texture snufit_seg6_texture_060080E0[] = { #include "actors/snufit/snufit_mask_strap.rgba16.inc.c" }; // 0x060084E0 -ALIGNED8 static const u8 snufit_seg6_texture_060084E0[] = { +ALIGNED8 static const Texture snufit_seg6_texture_060084E0[] = { #include "actors/snufit/snufit_mouth.rgba16.inc.c" }; diff --git a/actors/sparkle/model.inc.c b/actors/sparkle/model.inc.c index 2ecef672..c863ad45 100644 --- a/actors/sparkle/model.inc.c +++ b/actors/sparkle/model.inc.c @@ -9,32 +9,32 @@ static const Vtx sparkles_seg4_vertex_04027450[] = { }; // 0x04027490 -ALIGNED8 static const u8 sparkles_seg4_texture_04027490[] = { +ALIGNED8 static const Texture sparkles_seg4_texture_04027490[] = { #include "actors/sparkle/sparkle_0.rgba16.inc.c" }; // 0x04027C90 -ALIGNED8 static const u8 sparkles_seg4_texture_04027C90[] = { +ALIGNED8 static const Texture sparkles_seg4_texture_04027C90[] = { #include "actors/sparkle/sparkle_1.rgba16.inc.c" }; // 0x04028490 -ALIGNED8 static const u8 sparkles_seg4_texture_04028490[] = { +ALIGNED8 static const Texture sparkles_seg4_texture_04028490[] = { #include "actors/sparkle/sparkle_2.rgba16.inc.c" }; // 0x04028C90 -ALIGNED8 static const u8 sparkles_seg4_texture_04028C90[] = { +ALIGNED8 static const Texture sparkles_seg4_texture_04028C90[] = { #include "actors/sparkle/sparkle_3.rgba16.inc.c" }; // 0x04029490 -ALIGNED8 static const u8 sparkles_seg4_texture_04029490[] = { +ALIGNED8 static const Texture sparkles_seg4_texture_04029490[] = { #include "actors/sparkle/sparkle_4.rgba16.inc.c" }; // 0x04029C90 -ALIGNED8 static const u8 sparkles_seg4_texture_04029C90[] = { +ALIGNED8 static const Texture sparkles_seg4_texture_04029C90[] = { #include "actors/sparkle/sparkle_5.rgba16.inc.c" }; diff --git a/actors/sparkle_animation/model.inc.c b/actors/sparkle_animation/model.inc.c index 13807216..09ef7947 100644 --- a/actors/sparkle_animation/model.inc.c +++ b/actors/sparkle_animation/model.inc.c @@ -9,27 +9,27 @@ static const Vtx sparkles_animation_seg4_vertex_04032A48[] = { }; // 0x04032A88 -ALIGNED8 static const u8 sparkles_animation_seg4_texture_04032A88[] = { +ALIGNED8 static const Texture sparkles_animation_seg4_texture_04032A88[] = { #include "actors/sparkle_animation/sparkle_animation_0.ia16.inc.c" }; // 0x04033288 -ALIGNED8 static const u8 sparkles_animation_seg4_texture_04033288[] = { +ALIGNED8 static const Texture sparkles_animation_seg4_texture_04033288[] = { #include "actors/sparkle_animation/sparkle_animation_1.ia16.inc.c" }; // 0x04033A88 -ALIGNED8 static const u8 sparkles_animation_seg4_texture_04033A88[] = { +ALIGNED8 static const Texture sparkles_animation_seg4_texture_04033A88[] = { #include "actors/sparkle_animation/sparkle_animation_2.ia16.inc.c" }; // 0x04034288 -ALIGNED8 static const u8 sparkles_animation_seg4_texture_04034288[] = { +ALIGNED8 static const Texture sparkles_animation_seg4_texture_04034288[] = { #include "actors/sparkle_animation/sparkle_animation_3.ia16.inc.c" }; // 0x04034A88 -ALIGNED8 static const u8 sparkles_animation_seg4_texture_04034A88[] = { +ALIGNED8 static const Texture sparkles_animation_seg4_texture_04034A88[] = { #include "actors/sparkle_animation/sparkle_animation_4.ia16.inc.c" }; diff --git a/actors/spindrift/anims/anim_050006AC.inc.c b/actors/spindrift/anims/anim_050006AC.inc.c index 844f2e30..3e65567a 100644 --- a/actors/spindrift/anims/anim_050006AC.inc.c +++ b/actors/spindrift/anims/anim_050006AC.inc.c @@ -72,22 +72,22 @@ static const struct Animation spindrift_seg5_anim_050006AC = { UNUSED static const u64 spindrift_unused_1 = 1; // 0x050006D0 -ALIGNED8 static const u8 spindrift_seg5_texture_050006D0[] = { +ALIGNED8 static const Texture spindrift_seg5_texture_050006D0[] = { #include "actors/spindrift/spindrift_face.rgba16.inc.c" }; // 0x05000ED0 -ALIGNED8 static const u8 spindrift_seg5_texture_05000ED0[] = { +ALIGNED8 static const Texture spindrift_seg5_texture_05000ED0[] = { #include "actors/spindrift/spindrift_petal.rgba16.inc.c" }; // 0x050016D0 -ALIGNED8 static const u8 spindrift_seg5_texture_050016D0[] = { +ALIGNED8 static const Texture spindrift_seg5_texture_050016D0[] = { #include "actors/spindrift/spindrift_leaf.rgba16.inc.c" }; // 0x05001ED0 -ALIGNED8 static const u8 spindrift_seg5_texture_05001ED0[] = { +ALIGNED8 static const Texture spindrift_seg5_texture_05001ED0[] = { #include "actors/spindrift/spindrift_head.rgba16.inc.c" }; diff --git a/actors/spiny/model.inc.c b/actors/spiny/model.inc.c index aedcd62e..b03daf13 100644 --- a/actors/spiny/model.inc.c +++ b/actors/spiny/model.inc.c @@ -2,38 +2,38 @@ // 0x050157F8 static const Lights1 spiny_seg5_lights_050157F8 = gdSPDefLights1( - 0x32, 0x23, 0x0a, - 0xca, 0x8d, 0x29, 0x28, 0x28, 0x28 + 0x32, 0x23, 0x0a, + 0xca, 0x8d, 0x29, 0x28, 0x28, 0x28 ); // 0x05015810 static const Lights1 spiny_seg5_lights_05015810 = gdSPDefLights1( - 0x3a, 0x2c, 0x1f, - 0xeb, 0xb0, 0x7f, 0x28, 0x28, 0x28 + 0x3a, 0x2c, 0x1f, + 0xeb, 0xb0, 0x7f, 0x28, 0x28, 0x28 ); // 0x05015828 static const Lights1 spiny_seg5_lights_05015828 = gdSPDefLights1( - 0x2c, 0x2c, 0x2c, - 0xb2, 0xb2, 0xb2, 0x28, 0x28, 0x28 + 0x2c, 0x2c, 0x2c, + 0xb2, 0xb2, 0xb2, 0x28, 0x28, 0x28 ); // 0x05015840 static const Lights1 spiny_seg5_lights_05015840 = gdSPDefLights1( - 0x3f, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x28, 0x28, 0x28 + 0x3f, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x28, 0x28, 0x28 ); // 0x05015858 static const Lights1 spiny_seg5_lights_05015858 = gdSPDefLights1( - 0x3d, 0x25, 0x01, - 0xf4, 0x96, 0x07, 0x28, 0x28, 0x28 + 0x3d, 0x25, 0x01, + 0xf4, 0x96, 0x07, 0x28, 0x28, 0x28 ); // 0x05015870 static const Lights1 spiny_seg5_lights_05015870 = gdSPDefLights1( - 0x3c, 0x2c, 0x09, - 0xf1, 0xb2, 0x25, 0x28, 0x28, 0x28 + 0x3c, 0x2c, 0x09, + 0xf1, 0xb2, 0x25, 0x28, 0x28, 0x28 ); // 0x05015888 diff --git a/actors/spiny_egg/model.inc.c b/actors/spiny_egg/model.inc.c index 6a60d2de..ddab31bb 100644 --- a/actors/spiny_egg/model.inc.c +++ b/actors/spiny_egg/model.inc.c @@ -2,14 +2,14 @@ // 0x050144F8 static const Lights1 spiny_egg_seg5_lights_050144F8 = gdSPDefLights1( - 0x3f, 0x3f, 0x00, - 0xff, 0xff, 0x00, 0x28, 0x28, 0x28 + 0x3f, 0x3f, 0x00, + 0xff, 0xff, 0x00, 0x28, 0x28, 0x28 ); // 0x05014510 static const Lights1 spiny_egg_seg5_lights_05014510 = gdSPDefLights1( - 0x3f, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x28, 0x28, 0x28 + 0x3f, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x28, 0x28, 0x28 ); // 0x05014528 diff --git a/actors/springboard/model.inc.c b/actors/springboard/model.inc.c index 4297a688..61a7a06c 100644 --- a/actors/springboard/model.inc.c +++ b/actors/springboard/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 springboard_seg5_lights_05000000 = gdSPDefLights1( ); // 0x05000018 -ALIGNED8 static const u8 springboard_seg5_texture_05000018[] = { +ALIGNED8 static const Texture springboard_seg5_texture_05000018[] = { #include "actors/springboard/springboard_top_unused.rgba16.inc.c" }; // 0x05000818 -ALIGNED8 static const u8 springboard_seg5_texture_05000818[] = { +ALIGNED8 static const Texture springboard_seg5_texture_05000818[] = { #include "actors/springboard/springboard_base_unused.rgba16.inc.c" }; diff --git a/actors/star/model.inc.c b/actors/star/model.inc.c index 0a4c9b28..b0a4dfce 100644 --- a/actors/star/model.inc.c +++ b/actors/star/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 star_seg3_lights_0302A6D8 = gdSPDefLights1( ); // 0x0302A6F0 -ALIGNED8 static const u8 star_seg3_texture_0302A6F0[] = { +ALIGNED8 static const Texture star_seg3_texture_0302A6F0[] = { #include "actors/star/star_surface.rgba16.inc.c" }; // 0x0302AEF0 -ALIGNED8 static const u8 star_seg3_texture_0302AEF0[] = { +ALIGNED8 static const Texture star_seg3_texture_0302AEF0[] = { #include "actors/star/star_eye.rgba16.inc.c" }; diff --git a/actors/stomp_smoke/model.inc.c b/actors/stomp_smoke/model.inc.c index cad7c1c4..8f5bcd26 100644 --- a/actors/stomp_smoke/model.inc.c +++ b/actors/stomp_smoke/model.inc.c @@ -17,32 +17,32 @@ static const Vtx stomp_smoke_seg4_vertex_04022108[] = { }; // 0x04022148 -ALIGNED8 static const u8 stomp_smoke_seg4_texture_04022148[] = { +ALIGNED8 static const Texture stomp_smoke_seg4_texture_04022148[] = { #include "actors/stomp_smoke/stomp_smoke_0.ia16.inc.c" }; // 0x04022948 -ALIGNED8 static const u8 stomp_smoke_seg4_texture_04022948[] = { +ALIGNED8 static const Texture stomp_smoke_seg4_texture_04022948[] = { #include "actors/stomp_smoke/stomp_smoke_1.ia16.inc.c" }; // 0x04023148 -ALIGNED8 static const u8 stomp_smoke_seg4_texture_04023148[] = { +ALIGNED8 static const Texture stomp_smoke_seg4_texture_04023148[] = { #include "actors/stomp_smoke/stomp_smoke_2.ia16.inc.c" }; // 0x04023948 -ALIGNED8 static const u8 stomp_smoke_seg4_texture_04023948[] = { +ALIGNED8 static const Texture stomp_smoke_seg4_texture_04023948[] = { #include "actors/stomp_smoke/stomp_smoke_3.ia16.inc.c" }; // 0x04024148 -ALIGNED8 static const u8 stomp_smoke_seg4_texture_04024148[] = { +ALIGNED8 static const Texture stomp_smoke_seg4_texture_04024148[] = { #include "actors/stomp_smoke/stomp_smoke_4.ia16.inc.c" }; // 0x04024948 -ALIGNED8 static const u8 stomp_smoke_seg4_texture_04024948[] = { +ALIGNED8 static const Texture stomp_smoke_seg4_texture_04024948[] = { #include "actors/stomp_smoke/stomp_smoke_5.ia16.inc.c" }; diff --git a/actors/sushi/model.inc.c b/actors/sushi/model.inc.c index f77c2c67..d62bc9e7 100644 --- a/actors/sushi/model.inc.c +++ b/actors/sushi/model.inc.c @@ -6,17 +6,17 @@ UNUSED static const u64 sushi_unused_1 = 1; // 0x05008ED0 -ALIGNED8 static const u8 sushi_seg5_texture_05008ED0[] = { +ALIGNED8 static const Texture sushi_seg5_texture_05008ED0[] = { #include "actors/sushi/sushi_snout.rgba16.inc.c" }; // 0x050096D0 -ALIGNED8 static const u8 sushi_seg5_texture_050096D0[] = { +ALIGNED8 static const Texture sushi_seg5_texture_050096D0[] = { #include "actors/sushi/sushi_eye.rgba16.inc.c" }; // 0x05009AD0 -ALIGNED8 static const u8 sushi_seg5_texture_05009AD0[] = { +ALIGNED8 static const Texture sushi_seg5_texture_05009AD0[] = { #include "actors/sushi/sushi_tooth.rgba16.inc.c" }; diff --git a/actors/swoop/model.inc.c b/actors/swoop/model.inc.c index fc99de1e..d1a3a29c 100644 --- a/actors/swoop/model.inc.c +++ b/actors/swoop/model.inc.c @@ -13,22 +13,22 @@ UNUSED static const Lights1 swoop_lights_unused2 = gdSPDefLights1( ); // 0x06004270 -ALIGNED8 static const u8 swoop_seg6_texture_06004270[] = { +ALIGNED8 static const Texture swoop_seg6_texture_06004270[] = { #include "actors/swoop/swoop_body.rgba16.inc.c" }; // 0x06004A70 -ALIGNED8 static const u8 swoop_seg6_texture_06004A70[] = { +ALIGNED8 static const Texture swoop_seg6_texture_06004A70[] = { #include "actors/swoop/swoop_eye.rgba16.inc.c" }; // 0x06005270 -ALIGNED8 static const u8 swoop_seg6_texture_06005270[] = { +ALIGNED8 static const Texture swoop_seg6_texture_06005270[] = { #include "actors/swoop/swoop_nose.rgba16.inc.c" }; // 0x06005A70 -ALIGNED8 static const u8 swoop_seg6_texture_06005A70[] = { +ALIGNED8 static const Texture swoop_seg6_texture_06005A70[] = { #include "actors/swoop/swoop_wing.rgba16.inc.c" }; diff --git a/actors/test_platform/model.inc.c b/actors/test_platform/model.inc.c index 072138e9..b0111608 100644 --- a/actors/test_platform/model.inc.c +++ b/actors/test_platform/model.inc.c @@ -2,8 +2,8 @@ // 0x08026008 static const Lights1 unknown_seg8_lights_08026008 = gdSPDefLights1( - 0x32, 0x32, 0x07, - 0xc8, 0xc8, 0x1e, 0x28, 0x28, 0x28 + 0x32, 0x32, 0x07, + 0xc8, 0xc8, 0x1e, 0x28, 0x28, 0x28 ); // 0x08026020 diff --git a/actors/thwomp/model.inc.c b/actors/thwomp/model.inc.c index 7871d8cd..2dee226e 100644 --- a/actors/thwomp/model.inc.c +++ b/actors/thwomp/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 thwomp_seg5_lights_050098E8 = gdSPDefLights1( ); // 0x05009900 -ALIGNED8 static const u8 thwomp_seg5_texture_05009900[] = { +ALIGNED8 static const Texture thwomp_seg5_texture_05009900[] = { #include "actors/thwomp/thwomp_face.rgba16.inc.c" }; // 0x0500A900 -ALIGNED8 static const u8 thwomp_seg5_texture_0500A900[] = { +ALIGNED8 static const Texture thwomp_seg5_texture_0500A900[] = { #include "actors/thwomp/thwomp_surface.rgba16.inc.c" }; diff --git a/actors/toad/model.inc.c b/actors/toad/model.inc.c index ecdfbfd1..d58b7400 100644 --- a/actors/toad/model.inc.c +++ b/actors/toad/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 toad_seg6_lights_06005908 = gdSPDefLights1( ); // 0x06005920 -ALIGNED8 static const u8 toad_seg6_texture_06005920[] = { +ALIGNED8 static const Texture toad_seg6_texture_06005920[] = { #include "actors/toad/toad_face.rgba16.inc.c" }; // 0x06006120 -ALIGNED8 static const u8 toad_seg6_texture_06006120[] = { +ALIGNED8 static const Texture toad_seg6_texture_06006120[] = { #include "actors/toad/toad_head.rgba16.inc.c" }; diff --git a/actors/tornado/model.inc.c b/actors/tornado/model.inc.c index afa1b950..42f3dad0 100644 --- a/actors/tornado/model.inc.c +++ b/actors/tornado/model.inc.c @@ -1,7 +1,7 @@ // Tornado // 0x05013128 -ALIGNED8 static const u8 tornado_seg5_texture_05013128[] = { +ALIGNED8 static const Texture tornado_seg5_texture_05013128[] = { #include "actors/tornado/tornado.ia16.inc.c" }; diff --git a/actors/treasure_chest/model.inc.c b/actors/treasure_chest/model.inc.c index f9aaad24..3b0bb9e4 100644 --- a/actors/treasure_chest/model.inc.c +++ b/actors/treasure_chest/model.inc.c @@ -7,22 +7,22 @@ static const Lights1 treasure_chest_seg6_lights_06013F90 = gdSPDefLights1( ); // 0x06013FA8 -ALIGNED8 static const u8 treasure_chest_seg6_texture_06013FA8[] = { +ALIGNED8 static const Texture treasure_chest_seg6_texture_06013FA8[] = { #include "actors/treasure_chest/treasure_chest_lock.rgba16.inc.c" }; // 0x060147A8 -ALIGNED8 static const u8 treasure_chest_seg6_texture_060147A8[] = { +ALIGNED8 static const Texture treasure_chest_seg6_texture_060147A8[] = { #include "actors/treasure_chest/treasure_chest_side.rgba16.inc.c" }; // 0x06014FA8 -ALIGNED8 static const u8 treasure_chest_seg6_texture_06014FA8[] = { +ALIGNED8 static const Texture treasure_chest_seg6_texture_06014FA8[] = { #include "actors/treasure_chest/treasure_chest_lock_top.rgba16.inc.c" }; // 0x060157A8 -ALIGNED8 static const u8 treasure_chest_seg6_texture_060157A8[] = { +ALIGNED8 static const Texture treasure_chest_seg6_texture_060157A8[] = { #include "actors/treasure_chest/treasure_chest_front.rgba16.inc.c" }; diff --git a/actors/tree/model.inc.c b/actors/tree/model.inc.c index a09c3e7f..a4bbf492 100644 --- a/actors/tree/model.inc.c +++ b/actors/tree/model.inc.c @@ -7,12 +7,12 @@ static const Lights1 tree_seg3_lights_0302DE10 = gdSPDefLights1( ); // 0x0302DE28 -ALIGNED8 static const u8 tree_seg3_texture_0302DE28[] = { +ALIGNED8 static const Texture tree_seg3_texture_0302DE28[] = { #include "actors/tree/tree_left_side.rgba16.inc.c" }; // 0x0302EE28 -ALIGNED8 static const u8 tree_seg3_texture_0302EE28[] = { +ALIGNED8 static const Texture tree_seg3_texture_0302EE28[] = { #include "actors/tree/tree_right_side.rgba16.inc.c" }; @@ -70,7 +70,7 @@ const Gfx tree_seg3_dl_0302FEE8[] = { }; // 0x0302FF60 -ALIGNED8 static const u8 tree_seg3_texture_0302FF60[] = { +ALIGNED8 static const Texture tree_seg3_texture_0302FF60[] = { #include "actors/tree/pine_tree.rgba16.inc.c" }; @@ -107,7 +107,7 @@ const Gfx tree_seg3_dl_03030FA0[] = { }; // 0x03031048 -ALIGNED8 static const u8 tree_seg3_texture_03031048[] = { +ALIGNED8 static const Texture tree_seg3_texture_03031048[] = { #include "actors/tree/snowy_pine_tree.rgba16.inc.c" }; @@ -176,7 +176,7 @@ const Gfx tree_seg3_dl_03032170[] = { }; // 0x03032218 -ALIGNED8 static const u8 tree_seg3_texture_03032218[] = { +ALIGNED8 static const Texture tree_seg3_texture_03032218[] = { #include "actors/tree/palm_tree.rgba16.inc.c" }; diff --git a/actors/ukiki/model.inc.c b/actors/ukiki/model.inc.c index a0e37836..fdc22c14 100644 --- a/actors/ukiki/model.inc.c +++ b/actors/ukiki/model.inc.c @@ -22,22 +22,22 @@ static const Lights1 ukiki_seg5_lights_05007BA0 = gdSPDefLights1( UNUSED static const u64 ukiki_unused_1 = 1; // 0x05007BC0 -ALIGNED8 static const u8 ukiki_seg5_texture_05007BC0[] = { +ALIGNED8 static const Texture ukiki_seg5_texture_05007BC0[] = { #include "actors/ukiki/ukiki_face.rgba16.inc.c" }; // 0x05008BC0 -ALIGNED8 static const u8 ukiki_seg5_texture_05008BC0[] = { +ALIGNED8 static const Texture ukiki_seg5_texture_05008BC0[] = { #include "actors/ukiki/ukiki_face_blink.rgba16.inc.c" }; // 0x05009BC0 -ALIGNED8 static const u8 ukiki_seg5_texture_05009BC0[] = { +ALIGNED8 static const Texture ukiki_seg5_texture_05009BC0[] = { #include "actors/ukiki/ukiki_butt.rgba16.inc.c" }; // 0x0500A3C0 -ALIGNED8 static const u8 ukiki_seg5_texture_0500A3C0[] = { +ALIGNED8 static const Texture ukiki_seg5_texture_0500A3C0[] = { #include "actors/ukiki/ukiki_fur.rgba16.inc.c" }; diff --git a/actors/unagi/model.inc.c b/actors/unagi/model.inc.c index a8cb4191..6d0eda36 100644 --- a/actors/unagi/model.inc.c +++ b/actors/unagi/model.inc.c @@ -49,32 +49,32 @@ UNUSED static const Lights1 unagi_lights_unused8 = gdSPDefLights1( ); // 0x0500AF20 -ALIGNED8 static const u8 unagi_seg5_texture_0500AF20[] = { +ALIGNED8 static const Texture unagi_seg5_texture_0500AF20[] = { #include "actors/unagi/unagi_body.rgba16.inc.c" }; // 0x0500B720 -ALIGNED8 static const u8 unagi_seg5_texture_0500B720[] = { +ALIGNED8 static const Texture unagi_seg5_texture_0500B720[] = { #include "actors/unagi/unagi_eye.rgba16.inc.c" }; // 0x0500B920 -ALIGNED8 static const u8 unagi_seg5_texture_0500B920[] = { +ALIGNED8 static const Texture unagi_seg5_texture_0500B920[] = { #include "actors/unagi/unagi_head_base.rgba16.inc.c" }; // 0x0500C120 -ALIGNED8 static const u8 unagi_seg5_texture_0500C120[] = { +ALIGNED8 static const Texture unagi_seg5_texture_0500C120[] = { #include "actors/unagi/unagi_tooth.rgba16.inc.c" }; // 0x0500C320 -ALIGNED8 static const u8 unagi_seg5_texture_0500C320[] = { +ALIGNED8 static const Texture unagi_seg5_texture_0500C320[] = { #include "actors/unagi/unagi_mouth.rgba16.inc.c" }; // 0x0500C3A0 -ALIGNED8 static const u8 unagi_seg5_texture_0500C3A0[] = { +ALIGNED8 static const Texture unagi_seg5_texture_0500C3A0[] = { #include "actors/unagi/unagi_tail.rgba16.inc.c" }; diff --git a/actors/walk_smoke/model.inc.c b/actors/walk_smoke/model.inc.c index af2596bb..1b0452c6 100644 --- a/actors/walk_smoke/model.inc.c +++ b/actors/walk_smoke/model.inc.c @@ -9,37 +9,37 @@ static const Vtx smoke_seg4_vertex_0401DE60[] = { }; // 0x0401DEA0 -ALIGNED8 static const u8 smoke_seg4_texture_0401DEA0[] = { +ALIGNED8 static const Texture smoke_seg4_texture_0401DEA0[] = { #include "actors/walk_smoke/walk_smoke_0.ia16.inc.c" }; // 0x0401E6A0 -ALIGNED8 static const u8 smoke_seg4_texture_0401E6A0[] = { +ALIGNED8 static const Texture smoke_seg4_texture_0401E6A0[] = { #include "actors/walk_smoke/walk_smoke_1.ia16.inc.c" }; // 0x0401EEA0 -ALIGNED8 static const u8 smoke_seg4_texture_0401EEA0[] = { +ALIGNED8 static const Texture smoke_seg4_texture_0401EEA0[] = { #include "actors/walk_smoke/walk_smoke_2.ia16.inc.c" }; // 0x0401F6A0 -ALIGNED8 static const u8 smoke_seg4_texture_0401F6A0[] = { +ALIGNED8 static const Texture smoke_seg4_texture_0401F6A0[] = { #include "actors/walk_smoke/walk_smoke_3.ia16.inc.c" }; // 0x0401FEA0 -ALIGNED8 static const u8 smoke_seg4_texture_0401FEA0[] = { +ALIGNED8 static const Texture smoke_seg4_texture_0401FEA0[] = { #include "actors/walk_smoke/walk_smoke_4.ia16.inc.c" }; // 0x040206A0 -ALIGNED8 static const u8 smoke_seg4_texture_040206A0[] = { +ALIGNED8 static const Texture smoke_seg4_texture_040206A0[] = { #include "actors/walk_smoke/walk_smoke_5.ia16.inc.c" }; // 0x04020EA0 -ALIGNED8 static const u8 smoke_seg4_texture_04020EA0[] = { +ALIGNED8 static const Texture smoke_seg4_texture_04020EA0[] = { #include "actors/walk_smoke/walk_smoke_6.ia16.inc.c" }; diff --git a/actors/warp_pipe/model.inc.c b/actors/warp_pipe/model.inc.c index f428a0b5..418bd7c9 100644 --- a/actors/warp_pipe/model.inc.c +++ b/actors/warp_pipe/model.inc.c @@ -95,7 +95,7 @@ static const Vtx warp_pipe_seg3_vertex_03007DC0[] = { }; // 0x03007E40 -ALIGNED8 static const u8 warp_pipe_seg3_texture_03007E40[] = { +ALIGNED8 static const Texture warp_pipe_seg3_texture_03007E40[] = { #include "actors/warp_pipe/warp_pipe_side.rgba16.inc.c" }; @@ -189,7 +189,7 @@ static const Vtx warp_pipe_seg3_vertex_03009128[] = { }; // 0x03009168 -ALIGNED8 static const u8 warp_pipe_seg3_texture_03009168[] = { +ALIGNED8 static const Texture warp_pipe_seg3_texture_03009168[] = { #include "actors/warp_pipe/warp_pipe_top.rgba16.inc.c" }; diff --git a/actors/water_bubble/model.inc.c b/actors/water_bubble/model.inc.c index 8db7688c..512551f2 100644 --- a/actors/water_bubble/model.inc.c +++ b/actors/water_bubble/model.inc.c @@ -7,7 +7,7 @@ static const Lights1 water_bubble_seg5_lights_0500FE68 = gdSPDefLights1( ); // 0x0500FE80 -ALIGNED8 static const u8 water_bubble_seg5_texture_0500FE80[] = { +ALIGNED8 static const Texture water_bubble_seg5_texture_0500FE80[] = { #include "actors/water_bubble/water_bubble.rgba16.inc.c" }; diff --git a/actors/water_mine/model.inc.c b/actors/water_mine/model.inc.c index a85c7216..182d8e29 100644 --- a/actors/water_mine/model.inc.c +++ b/actors/water_mine/model.inc.c @@ -7,17 +7,17 @@ static const Lights1 water_mine_seg6_lights_0600A4E0 = gdSPDefLights1( ); // 0x0600A4F8 -ALIGNED8 static const u8 water_mine_seg6_texture_0600A4F8[] = { +ALIGNED8 static const Texture water_mine_seg6_texture_0600A4F8[] = { #include "actors/water_mine/water_mine_left_side_unused.rgba16.inc.c" }; // 0x0600B4F8 -ALIGNED8 static const u8 water_mine_seg6_texture_0600B4F8[] = { +ALIGNED8 static const Texture water_mine_seg6_texture_0600B4F8[] = { #include "actors/water_mine/water_mine_right_side_unused.rgba16.inc.c" }; // 0x0600C4F8 -ALIGNED8 static const u8 water_mine_seg6_texture_0600C4F8[] = { +ALIGNED8 static const Texture water_mine_seg6_texture_0600C4F8[] = { #include "actors/water_mine/water_mine_spike_unused.rgba16.inc.c" }; diff --git a/actors/water_ring/model.inc.c b/actors/water_ring/model.inc.c index 9d7e548d..3c772931 100644 --- a/actors/water_ring/model.inc.c +++ b/actors/water_ring/model.inc.c @@ -7,7 +7,7 @@ static const Lights1 water_ring_seg6_lights_06012368 = gdSPDefLights1( ); // 0x06012380 -ALIGNED8 static const u8 water_ring_seg6_texture_06012380[] = { +ALIGNED8 static const Texture water_ring_seg6_texture_06012380[] = { #include "actors/water_ring/water_ring.rgba16.inc.c" }; diff --git a/actors/water_splash/model.inc.c b/actors/water_splash/model.inc.c index 0970d7e7..6b7b2daf 100644 --- a/actors/water_splash/model.inc.c +++ b/actors/water_splash/model.inc.c @@ -9,42 +9,42 @@ static const Vtx water_splash_seg4_vertex_0402A588[] = { }; // 0x0402A5C8 -ALIGNED8 static const u8 water_splash_seg4_texture_0402A5C8[] = { +ALIGNED8 static const Texture water_splash_seg4_texture_0402A5C8[] = { #include "actors/water_splash/water_splash_0.rgba16.inc.c" }; // 0x0402B5C8 -ALIGNED8 static const u8 water_splash_seg4_texture_0402B5C8[] = { +ALIGNED8 static const Texture water_splash_seg4_texture_0402B5C8[] = { #include "actors/water_splash/water_splash_1.rgba16.inc.c" }; // 0x0402C5C8 -ALIGNED8 static const u8 water_splash_seg4_texture_0402C5C8[] = { +ALIGNED8 static const Texture water_splash_seg4_texture_0402C5C8[] = { #include "actors/water_splash/water_splash_2.rgba16.inc.c" }; // 0x0402D5C8 -ALIGNED8 static const u8 water_splash_seg4_texture_0402D5C8[] = { +ALIGNED8 static const Texture water_splash_seg4_texture_0402D5C8[] = { #include "actors/water_splash/water_splash_3.rgba16.inc.c" }; // 0x0402E5C8 -ALIGNED8 static const u8 water_splash_seg4_texture_0402E5C8[] = { +ALIGNED8 static const Texture water_splash_seg4_texture_0402E5C8[] = { #include "actors/water_splash/water_splash_4.rgba16.inc.c" }; // 0x0402F5C8 -ALIGNED8 static const u8 water_splash_seg4_texture_0402F5C8[] = { +ALIGNED8 static const Texture water_splash_seg4_texture_0402F5C8[] = { #include "actors/water_splash/water_splash_5.rgba16.inc.c" }; // 0x040305C8 -ALIGNED8 static const u8 water_splash_seg4_texture_040305C8[] = { +ALIGNED8 static const Texture water_splash_seg4_texture_040305C8[] = { #include "actors/water_splash/water_splash_6.rgba16.inc.c" }; // 0x040315C8 -ALIGNED8 static const u8 water_splash_seg4_texture_040315C8[] = { +ALIGNED8 static const Texture water_splash_seg4_texture_040315C8[] = { #include "actors/water_splash/water_splash_7.rgba16.inc.c" }; diff --git a/actors/water_wave/model.inc.c b/actors/water_wave/model.inc.c index cd5c97cf..bc2653e9 100644 --- a/actors/water_wave/model.inc.c +++ b/actors/water_wave/model.inc.c @@ -9,22 +9,22 @@ static const Vtx water_wave_seg4_vertex_04025318[] = { }; // 0x04025358 -ALIGNED8 static const u8 water_wave_seg4_texture_04025358[] = { +ALIGNED8 static const Texture water_wave_seg4_texture_04025358[] = { #include "actors/water_wave/water_wave_0.ia16.inc.c" }; // 0x04025B58 -ALIGNED8 static const u8 water_wave_seg4_texture_04025B58[] = { +ALIGNED8 static const Texture water_wave_seg4_texture_04025B58[] = { #include "actors/water_wave/water_wave_1.ia16.inc.c" }; // 0x04026358 -ALIGNED8 static const u8 water_wave_seg4_texture_04026358[] = { +ALIGNED8 static const Texture water_wave_seg4_texture_04026358[] = { #include "actors/water_wave/water_wave_2.ia16.inc.c" }; // 0x04026B58 -ALIGNED8 static const u8 water_wave_seg4_texture_04026B58[] = { +ALIGNED8 static const Texture water_wave_seg4_texture_04026B58[] = { #include "actors/water_wave/water_wave_3.ia16.inc.c" }; diff --git a/actors/whirlpool/model.inc.c b/actors/whirlpool/model.inc.c index 92ac7e15..c517a48a 100644 --- a/actors/whirlpool/model.inc.c +++ b/actors/whirlpool/model.inc.c @@ -1,7 +1,7 @@ // Whirlpool // 0x05012848 -ALIGNED8 static const u8 whirlpool_seg5_texture_05012848[] = { +ALIGNED8 static const Texture whirlpool_seg5_texture_05012848[] = { #include "actors/whirlpool/whirlpool.ia16.inc.c" }; diff --git a/actors/white_particle/model.inc.c b/actors/white_particle/model.inc.c index bda6340a..e463bc1d 100644 --- a/actors/white_particle/model.inc.c +++ b/actors/white_particle/model.inc.c @@ -9,7 +9,7 @@ static const Vtx white_particle_vertex[] = { }; // 0x0302C6A0 -ALIGNED8 static const u8 white_particle_texture[] = { +ALIGNED8 static const Texture white_particle_texture[] = { #include "actors/white_particle/snow_particle.rgba16.inc.c" }; diff --git a/actors/white_particle_small/model.inc.c b/actors/white_particle_small/model.inc.c index 1d817710..f780c59a 100644 --- a/actors/white_particle_small/model.inc.c +++ b/actors/white_particle_small/model.inc.c @@ -17,7 +17,7 @@ static const Vtx white_particle_small_unused_vertex[] = { }; // 0x04032780 -ALIGNED8 static const u8 white_particle_small_texture[] = { +ALIGNED8 static const Texture white_particle_small_texture[] = { #include "actors/white_particle_small/small_snow_particle.rgba16.inc.c" }; diff --git a/actors/whomp/model.inc.c b/actors/whomp/model.inc.c index d98c77dd..a359d0f3 100644 --- a/actors/whomp/model.inc.c +++ b/actors/whomp/model.inc.c @@ -5,22 +5,22 @@ UNUSED static const u64 whomp_unused_1 = 2; // 0x0601C360 -ALIGNED8 static const u8 whomp_seg6_texture_0601C360[] = { +ALIGNED8 static const Texture whomp_seg6_texture_0601C360[] = { #include "actors/whomp/whomp_back.rgba16.inc.c" }; // 0x0601D360 -ALIGNED8 static const u8 whomp_seg6_texture_0601D360[] = { +ALIGNED8 static const Texture whomp_seg6_texture_0601D360[] = { #include "actors/whomp/whomp_face.rgba16.inc.c" }; // 0x0601D360 -ALIGNED8 static const u8 whomp_seg6_texture_0601E360[] = { +ALIGNED8 static const Texture whomp_seg6_texture_0601E360[] = { #include "actors/whomp/whomp_hand.rgba16.inc.c" }; // 0x0601EB60 -ALIGNED8 static const u8 whomp_seg6_texture_0601EB60[] = { +ALIGNED8 static const Texture whomp_seg6_texture_0601EB60[] = { #include "actors/whomp/whomp_surface.rgba16.inc.c" }; diff --git a/actors/wiggler_body/model.inc.c b/actors/wiggler_body/model.inc.c index 0b685b25..ed1efc8e 100644 --- a/actors/wiggler_body/model.inc.c +++ b/actors/wiggler_body/model.inc.c @@ -1,37 +1,37 @@ // Wiggler Body // 0x05005A30 -ALIGNED8 static const u8 wiggler_seg5_texture_05005A30[] = { +ALIGNED8 static const Texture wiggler_seg5_texture_05005A30[] = { #include "actors/wiggler/wiggler_segment_left_side.rgba16.inc.c" }; // 0x05006A30 -ALIGNED8 static const u8 wiggler_seg5_texture_05006A30[] = { +ALIGNED8 static const Texture wiggler_seg5_texture_05006A30[] = { #include "actors/wiggler/wiggler_segment_right_side.rgba16.inc.c" }; // 0x05007A30 -ALIGNED8 static const u8 wiggler_seg5_texture_05007A30[] = { +ALIGNED8 static const Texture wiggler_seg5_texture_05007A30[] = { #include "actors/wiggler/wiggler_eye.rgba16.inc.c" }; // 0x05008230 -ALIGNED8 static const u8 wiggler_seg5_texture_05008230[] = { +ALIGNED8 static const Texture wiggler_seg5_texture_05008230[] = { #include "actors/wiggler/wiggler_flower.rgba16.inc.c" }; // 0x05008A30 -ALIGNED8 static const u8 wiggler_seg5_texture_05008A30[] = { +ALIGNED8 static const Texture wiggler_seg5_texture_05008A30[] = { #include "actors/wiggler/wiggler_frown.rgba16.inc.c" }; // 0x05009230 -ALIGNED8 static const u8 wiggler_seg5_texture_05009230[] = { +ALIGNED8 static const Texture wiggler_seg5_texture_05009230[] = { #include "actors/wiggler/wiggler_nose_left_side.rgba16.inc.c" }; // 0x0500A230 -ALIGNED8 static const u8 wiggler_seg5_texture_0500A230[] = { +ALIGNED8 static const Texture wiggler_seg5_texture_0500A230[] = { #include "actors/wiggler/wiggler_nose_right_side.rgba16.inc.c" }; diff --git a/actors/wooden_signpost/model.inc.c b/actors/wooden_signpost/model.inc.c index ec2ebd0b..a0889e81 100644 --- a/actors/wooden_signpost/model.inc.c +++ b/actors/wooden_signpost/model.inc.c @@ -18,12 +18,12 @@ static const Vtx wooden_signpost_seg3_vertex_0302C958[] = { }; // 0x0302C9C8 -ALIGNED8 static const u8 wooden_signpost_seg3_texture_0302C9C8[] = { +ALIGNED8 static const Texture wooden_signpost_seg3_texture_0302C9C8[] = { #include "actors/wooden_signpost/wooden_signpost_back.rgba16.inc.c" }; // 0x0302D1C8 -ALIGNED8 static const u8 wooden_signpost_seg3_texture_0302D1C8[] = { +ALIGNED8 static const Texture wooden_signpost_seg3_texture_0302D1C8[] = { #include "actors/wooden_signpost/wooden_signpost_front.rgba16.inc.c" }; diff --git a/actors/yellow_sphere/model.inc.c b/actors/yellow_sphere/model.inc.c index 99e2b6bb..8c4111f6 100644 --- a/actors/yellow_sphere/model.inc.c +++ b/actors/yellow_sphere/model.inc.c @@ -9,7 +9,7 @@ static const Vtx yellow_sphere_seg6_vertex_0601EB48[] = { }; // 0x0601EB88 -ALIGNED8 static const u8 yellow_sphere_seg6_texture_0601EB88[] = { +ALIGNED8 static const Texture yellow_sphere_seg6_texture_0601EB88[] = { #include "actors/yellow_sphere/yellow_sphere.rgba16.inc.c" }; diff --git a/actors/yellow_sphere_small/model.inc.c b/actors/yellow_sphere_small/model.inc.c index 8b221b23..589d4280 100644 --- a/actors/yellow_sphere_small/model.inc.c +++ b/actors/yellow_sphere_small/model.inc.c @@ -9,7 +9,7 @@ static const Vtx yellow_sphere_seg5_vertex_05000000[] = { }; // 0x05000040 -ALIGNED8 static const u8 yellow_sphere_seg5_texture_05000040[] = { +ALIGNED8 static const Texture yellow_sphere_seg5_texture_05000040[] = { #include "actors/yellow_sphere_small/small_yellow_sphere.rgba16.inc.c" }; diff --git a/actors/yoshi/model.inc.c b/actors/yoshi/model.inc.c index bf6a365b..f5c9514e 100644 --- a/actors/yoshi/model.inc.c +++ b/actors/yoshi/model.inc.c @@ -19,17 +19,17 @@ static const Lights1 yoshi_seg5_lights_0501C488 = gdSPDefLights1( ); // 0x0501C4A0 -ALIGNED8 static const u8 yoshi_seg5_texture_0501C4A0[] = { +ALIGNED8 static const Texture yoshi_seg5_texture_0501C4A0[] = { #include "actors/yoshi/yoshi_eye.rgba16.inc.c" }; // 0x0501C6A0 -ALIGNED8 static const u8 yoshi_seg5_texture_0501C6A0[] = { +ALIGNED8 static const Texture yoshi_seg5_texture_0501C6A0[] = { #include "actors/yoshi/yoshi_eye_blink.rgba16.inc.c" }; // 0x0501C8A0 -ALIGNED8 static const u8 yoshi_seg5_texture_0501C8A0[] = { +ALIGNED8 static const Texture yoshi_seg5_texture_0501C8A0[] = { #include "actors/yoshi/yoshi_nostril.rgba16.inc.c" }; diff --git a/actors/yoshi_egg/model.inc.c b/actors/yoshi_egg/model.inc.c index c76e154d..56cb16c9 100644 --- a/actors/yoshi_egg/model.inc.c +++ b/actors/yoshi_egg/model.inc.c @@ -9,42 +9,42 @@ static const Vtx yoshi_egg_seg5_vertex_05005778[] = { }; // 0x050057B8 -ALIGNED8 static const u8 yoshi_egg_seg5_texture_050057B8[] = { +ALIGNED8 static const Texture yoshi_egg_seg5_texture_050057B8[] = { #include "actors/yoshi_egg/yoshi_egg_0_unused.rgba16.inc.c" }; // 0x05005FB8 -ALIGNED8 static const u8 yoshi_egg_seg5_texture_05005FB8[] = { +ALIGNED8 static const Texture yoshi_egg_seg5_texture_05005FB8[] = { #include "actors/yoshi_egg/yoshi_egg_1_unused.rgba16.inc.c" }; // 0x050067B8 -ALIGNED8 static const u8 yoshi_egg_seg5_texture_050067B8[] = { +ALIGNED8 static const Texture yoshi_egg_seg5_texture_050067B8[] = { #include "actors/yoshi_egg/yoshi_egg_2_unused.rgba16.inc.c" }; // 0x05006FB8 -ALIGNED8 static const u8 yoshi_egg_seg5_texture_05006FB8[] = { +ALIGNED8 static const Texture yoshi_egg_seg5_texture_05006FB8[] = { #include "actors/yoshi_egg/yoshi_egg_3_unused.rgba16.inc.c" }; // 0x050077B8 -ALIGNED8 static const u8 yoshi_egg_seg5_texture_050077B8[] = { +ALIGNED8 static const Texture yoshi_egg_seg5_texture_050077B8[] = { #include "actors/yoshi_egg/yoshi_egg_4_unused.rgba16.inc.c" }; // 0x05007FB8 -ALIGNED8 static const u8 yoshi_egg_seg5_texture_05007FB8[] = { +ALIGNED8 static const Texture yoshi_egg_seg5_texture_05007FB8[] = { #include "actors/yoshi_egg/yoshi_egg_5_unused.rgba16.inc.c" }; // 0x050087B8 -ALIGNED8 static const u8 yoshi_egg_seg5_texture_050087B8[] = { +ALIGNED8 static const Texture yoshi_egg_seg5_texture_050087B8[] = { #include "actors/yoshi_egg/yoshi_egg_6_unused.rgba16.inc.c" }; // 0x05008FB8 -ALIGNED8 static const u8 yoshi_egg_seg5_texture_05008FB8[] = { +ALIGNED8 static const Texture yoshi_egg_seg5_texture_05008FB8[] = { #include "actors/yoshi_egg/yoshi_egg_7_unused.rgba16.inc.c" }; diff --git a/asm/boot.s b/asm/boot.s deleted file mode 100644 index be12ff0a..00000000 --- a/asm/boot.s +++ /dev/null @@ -1,852 +0,0 @@ -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 - -.include "macros.inc" - -# 0xA0000000-0xBFFFFFFF: KSEG1 direct map non-cache mirror of 0x00000000 -# 0xA4000000-0xA4000FFF: RSP DMEM - -# 0xA4000000-0xA400003F: ROM header - -.section .text, "ax" - -# 0xA4000040-0xA4000B6F: IPL3 - -# IPL3 entry point jumped to from IPL2 -glabel ipl3_entry # 0xA4000040 - mtc0 $zero, $13 - mtc0 $zero, $9 - mtc0 $zero, $11 - lui $t0, %hi(RI_MODE_REG) - addiu $t0, %lo(RI_MODE_REG) - lw $t1, 0xc($t0) - bnez $t1, .LA4000410 - nop - addiu $sp, $sp, -0x18 - sw $s3, ($sp) - sw $s4, 4($sp) - sw $s5, 8($sp) - sw $s6, 0xc($sp) - sw $s7, 0x10($sp) - lui $t0, %hi(RI_MODE_REG) - addiu $t0, %lo(RI_MODE_REG) - lui $t2, (0xa3f80000 >> 16) - lui $t3, (0xa3f00000 >> 16) - lui $t4, %hi(MI_MODE_REG) - addiu $t4, %lo(MI_MODE_REG) - ori $t1, $zero, 64 - sw $t1, 4($t0) - li $s1, 8000 -.LA400009C: - nop - addi $s1, $s1, -1 - bnez $s1, .LA400009C - nop - sw $zero, 8($t0) - ori $t1, $zero, 20 - sw $t1, 0xc($t0) - sw $zero, ($t0) - li $s1, 4 -.LA40000C0: - nop - addi $s1, $s1, -1 - bnez $s1, .LA40000C0 - nop - ori $t1, $zero, 14 - sw $t1, ($t0) - li $s1, 32 -.LA40000DC: - addi $s1, $s1, -1 - bnez $s1, .LA40000DC - ori $t1, $zero, 271 - sw $t1, ($t4) - lui $t1, (0x18082838 >> 16) - ori $t1, (0x18082838 & 0xFFFF) - sw $t1, 0x8($t2) - sw $zero, 0x14($t2) - lui $t1, 0x8000 - sw $t1, 0x4($t2) - move $t5, $zero - move $t6, $zero - lui $t7, (0xA3F00000 >> 16) - move $t8, $zero - lui $t9, (0xA3F00000 >> 16) - lui $s6, (0xA0000000 >> 16) - move $s7, $zero - lui $a2, (0xA3F00000 >> 16) - lui $a3, (0xA0000000 >> 16) - move $s2, $zero - lui $s4, (0xA0000000 >> 16) - addiu $sp, $sp, -0x48 - move $fp, $sp - lui $s0, %hi(MI_VERSION_REG) - lw $s0, %lo(MI_VERSION_REG)($s0) - lui $s1, (0x01010101 >> 16) - addiu $s1, (0x01010101 & 0xFFFF) - bne $s0, $s1, .LA4000160 - nop - li $s0, 512 - ori $s1, $t3, 0x4000 - b .LA4000168 - nop -.LA4000160: - li $s0, 1024 - ori $s1, $t3, 0x8000 -.LA4000168: - sw $t6, 4($s1) - addiu $s5, $t7, 0xc - jal func_A4000778 - nop - beqz $v0, .LA400025C - nop - sw $v0, ($sp) - li $t1, 8192 - sw $t1, ($t4) - lw $t3, ($t7) - lui $t0, 0xf0ff - and $t3, $t3, $t0 - sw $t3, 4($sp) - addi $sp, $sp, 8 - li $t1, 4096 - sw $t1, ($t4) - lui $t0, 0xb019 - bne $t3, $t0, .LA40001E0 - nop - lui $t0, 0x800 - add $t8, $t8, $t0 - add $t9, $t9, $s0 - add $t9, $t9, $s0 - lui $t0, 0x20 - add $s6, $s6, $t0 - add $s4, $s4, $t0 - sll $s2, $s2, 1 - addi $s2, $s2, 1 - b .LA40001E8 - nop -.LA40001E0: - lui $t0, 0x10 - add $s4, $s4, $t0 -.LA40001E8: - li $t0, 8192 - sw $t0, ($t4) - lw $t1, 0x24($t7) - lw $k0, ($t7) - li $t0, 4096 - sw $t0, ($t4) - andi $t1, $t1, 0xffff - li $t0, 1280 - bne $t1, $t0, .LA4000230 - nop - lui $k1, 0x100 - and $k0, $k0, $k1 - bnez $k0, .LA4000230 - nop - lui $t0, (0x101C0A04 >> 16) - ori $t0, (0x101C0A04 & 0xFFFF) - sw $t0, 0x18($t7) - b .LA400023C -.LA4000230: - lui $t0, (0x080C1204 >> 16) - ori $t0, (0x080C1204 & 0xFFFF) - sw $t0, 0x18($t7) -.LA400023C: - lui $t0, 0x800 - add $t6, $t6, $t0 - add $t7, $t7, $s0 - add $t7, $t7, $s0 - addiu $t5, $t5, 1 - sltiu $t0, $t5, 8 - bnez $t0, .LA4000168 - nop -.LA400025C: - li $t0, 0xc4000000 - sw $t0, 0xc($t2) - li $t0, 0x80000000 - sw $t0, 0x4($t2) - move $sp, $fp - move $v1, $zero -.LA4000274: - lw $t1, 4($sp) - lui $t0, 0xb009 - bne $t1, $t0, .LA40002D8 - nop - sw $t8, 4($s1) - addiu $s5, $t9, 0xc - lw $a0, ($sp) - addi $sp, $sp, 8 - li $a1, 1 - jal func_A4000A40 - nop - lw $t0, ($s6) - lui $t0, 8 - add $t0, $t0, $s6 - lw $t1, ($t0) - lw $t0, ($s6) - lui $t0, 8 - add $t0, $t0, $s6 - lw $t1, ($t0) - lui $t0, 0x400 - add $t6, $t6, $t0 - add $t9, $t9, $s0 - lui $t0, 0x10 - add $s6, $s6, $t0 - b .LA400035C -.LA40002D8: - sw $s7, 4($s1) - addiu $s5, $a2, 0xc - lw $a0, ($sp) - addi $sp, $sp, 8 - li $a1, 1 - jal func_A4000A40 - nop - lw $t0, ($a3) - lui $t0, 8 - add $t0, $t0, $a3 - lw $t1, ($t0) - lui $t0, 0x10 - add $t0, $t0, $a3 - lw $t1, ($t0) - lui $t0, 0x18 - add $t0, $t0, $a3 - lw $t1, ($t0) - lw $t0, ($a3) - lui $t0, 8 - add $t0, $t0, $a3 - lw $t1, ($t0) - lui $t0, 0x10 - add $t0, $t0, $a3 - lw $t1, ($t0) - lui $t0, 0x18 - add $t0, $t0, $a3 - lw $t1, ($t0) - lui $t0, 0x800 - add $s7, $s7, $t0 - add $a2, $a2, $s0 - add $a2, $a2, $s0 - lui $t0, 0x20 - add $a3, $a3, $t0 -.LA400035C: - addiu $v1, $v1, 1 - slt $t0, $v1, $t5 - bnez $t0, .LA4000274 - nop - lui $t2, %hi(RI_REFRESH_REG) - sll $s2, $s2, 0x13 - lui $t1, (0x00063634 >> 16) - ori $t1, (0x00063634 & 0xFFFF) - or $t1, $t1, $s2 - sw $t1, %lo(RI_REFRESH_REG)($t2) - lw $t1, %lo(RI_REFRESH_REG)($t2) - lui $t0, (0xA0000300 >> 16) - ori $t0, (0xA0000300 & 0xFFFF) - lui $t1, (0x0FFFFFFF >> 16) - ori $t1, (0x0FFFFFFF & 0xFFFF) - and $s6, $s6, $t1 - sw $s6, 0x18($t0) - move $sp, $fp - addiu $sp, $sp, 0x48 - lw $s3, ($sp) - lw $s4, 4($sp) - lw $s5, 8($sp) - lw $s6, 0xc($sp) - lw $s7, 0x10($sp) - addiu $sp, $sp, 0x18 - lui $t0, %hi(EXCEPTION_TLB_MISS) - addiu $t0, $t0, %lo(EXCEPTION_TLB_MISS) - addiu $t1, $t0, 0x4000 - addiu $t1, $t1, -0x20 - mtc0 $zero, $28 - mtc0 $zero, $29 -.LA40003D8: - cache 8, ($t0) - sltu $at, $t0, $t1 - bnez $at, .LA40003D8 - addiu $t0, $t0, 0x20 - lui $t0, %hi(EXCEPTION_TLB_MISS) - addiu $t0, %lo(EXCEPTION_TLB_MISS) - addiu $t1, $t0, 0x2000 - addiu $t1, $t1, -0x10 -.LA40003F8: - cache 9, ($t0) - sltu $at, $t0, $t1 - bnez $at, .LA40003F8 - addiu $t0, $t0, 0x10 - b .LA4000458 - nop -.LA4000410: - lui $t0, %hi(EXCEPTION_TLB_MISS) - addiu $t0, %lo(EXCEPTION_TLB_MISS) - addiu $t1, $t0, 0x4000 - addiu $t1, $t1, -0x20 - mtc0 $zero, $28 - mtc0 $zero, $29 -.LA4000428: - cache 8, ($t0) - sltu $at, $t0, $t1 - bnez $at, .LA4000428 - addiu $t0, $t0, 0x20 - lui $t0, %hi(EXCEPTION_TLB_MISS) - addiu $t0, %lo(EXCEPTION_TLB_MISS) - addiu $t1, $t0, 0x2000 - addiu $t1, $t1, -0x10 -.LA4000448: - cache 1, ($t0) - sltu $at, $t0, $t1 - bnez $at, .LA4000448 - addiu $t0, $t0, 0x10 -.LA4000458: - lui $t2, %hi(SP_DMEM) - addiu $t2, $t2, %lo(SP_DMEM) - lui $t3, 0xfff0 - lui $t1, 0x0010 - and $t2, $t2, $t3 - lui $t0, %hi(SP_DMEM_UNK0) - addiu $t1, -1 - lui $t3, %hi(SP_DMEM_UNK1) - addiu $t0, %lo(SP_DMEM_UNK0) - addiu $t3, %lo(SP_DMEM_UNK1) - and $t0, $t0, $t1 - and $t3, $t3, $t1 - lui $t1, 0xa000 - or $t0, $t0, $t2 - or $t3, $t3, $t2 - addiu $t1, $t1, 0 -.LA4000498: - lw $t5, ($t0) - addiu $t0, $t0, 4 - sltu $at, $t0, $t3 - addiu $t1, $t1, 4 - bnez $at, .LA4000498 - sw $t5, -4($t1) - lui $t4, %hi(EXCEPTION_TLB_MISS) - addiu $t4, %lo(EXCEPTION_TLB_MISS) - jr $t4 - nop - lui $t3, %hi(D_B0000008) - lw $t1, %lo(D_B0000008)($t3) - lui $t2, (0x1FFFFFFF >> 16) - ori $t2, (0x1FFFFFFF & 0xFFFF) - lui $at, %hi(PI_DRAM_ADDR_REG) - and $t1, $t1, $t2 - sw $t1, %lo(PI_DRAM_ADDR_REG)($at) - lui $t0, %hi(PI_STATUS_REG) -.LA40004D0: - lw $t0, %lo(PI_STATUS_REG)($t0) - andi $t0, $t0, 2 - bnezl $t0, .LA40004D0 - lui $t0, %hi(PI_STATUS_REG) - li $t0, 0x1000 - add $t0, $t0, $t3 - and $t0, $t0, $t2 - lui $at, %hi(PI_CART_ADDR_REG) - sw $t0, %lo(PI_CART_ADDR_REG)($at) - lui $t2, 0x0010 - addiu $t2, 0xFFFF - lui $at, %hi(PI_WR_LEN_REG) - sw $t2, %lo(PI_WR_LEN_REG)($at) - -.LA4000514: - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - lui $t3, %hi(PI_STATUS_REG) - lw $t3, %lo(PI_STATUS_REG)($t3) - andi $t3, $t3, 0x1 - bnez $t3, .LA4000514 - nop - lui $t3, %hi(D_B0000008) - lw $a0, %lo(D_B0000008)($t3) - move $a1, $s6 - lui $at, (0x5D588B65 >> 16) - ori $at, (0x5D588B65 & 0xFFFF) - multu $a1, $at - addiu $sp, $sp, -0x20 - sw $ra, 0x1c($sp) - sw $s0, 0x14($sp) - lui $ra, 0x10 - move $v1, $zero - move $t0, $zero - move $t1, $a0 - li $t5, 32 - mflo $v0 - addiu $v0, $v0, 1 - move $a3, $v0 - move $t2, $v0 - move $t3, $v0 - move $s0, $v0 - move $a2, $v0 - move $t4, $v0 -.LA40005F0: - lw $v0, ($t1) - addu $v1, $a3, $v0 - sltu $at, $v1, $a3 - beqz $at, .LA4000608 - move $a1, $v1 - addiu $t2, $t2, 1 -.LA4000608: - andi $v1, $v0, 0x1f - subu $t7, $t5, $v1 - srlv $t8, $v0, $t7 - sllv $t6, $v0, $v1 - or $a0, $t6, $t8 - sltu $at, $a2, $v0 - move $a3, $a1 - xor $t3, $t3, $v0 - beqz $at, .LA400063C - addu $s0, $s0, $a0 - xor $t9, $a3, $v0 - b .LA4000640 - xor $a2, $t9, $a2 -.LA400063C: - xor $a2, $a2, $a0 -.LA4000640: - addiu $t0, $t0, 4 - xor $t7, $v0, $s0 - addiu $t1, $t1, 4 - bne $t0, $ra, .LA40005F0 - addu $t4, $t7, $t4 - xor $t6, $a3, $t2 - xor $a3, $t6, $t3 - xor $t8, $s0, $a2 - xor $s0, $t8, $t4 - lui $t3, %hi(D_B0000010) - lw $t0, %lo(D_B0000010)($t3) - bne $a3, $t0, halt - nop - lw $t0, %lo(D_B0000014)($t3) - bne $s0, $t0, halt - nop - bal func_A4000690 - nop - -halt: - bal halt - nop - -func_A4000690: - lui $t1, %hi(SP_PC) - lw $t1, %lo(SP_PC)($t1) - lw $s0, 0x14($sp) - lw $ra, 0x1c($sp) - beqz $t1, .LA40006BC - addiu $sp, $sp, 0x20 - li $t2, 65 - lui $at, %hi(SP_STATUS_REG) - sw $t2, %lo(SP_STATUS_REG)($at) - lui $at, %hi(SP_PC) - sw $zero, %lo(SP_PC)($at) -.LA40006BC: - lui $t3, (0x00AAAAAE >> 16) - ori $t3, (0x00AAAAAE & 0xFFFF) - lui $at, %hi(SP_STATUS_REG) - sw $t3, %lo(SP_STATUS_REG)($at) - lui $at, %hi(MI_INTR_MASK_REG) - li $t0, 1365 - sw $t0, %lo(MI_INTR_MASK_REG)($at) - lui $at, %hi(SI_STATUS_REG) - sw $zero, %lo(SI_STATUS_REG)($at) - lui $at, %hi(AI_STATUS_REG) - sw $zero, %lo(AI_STATUS_REG)($at) - lui $at, %hi(MI_MODE_REG) - li $t1, 2048 - sw $t1, %lo(MI_MODE_REG)($at) - li $t1, 2 - lui $at, %hi(PI_STATUS_REG) - lui $t0, (0xA0000300 >> 16) - ori $t0, (0xA0000300 & 0xFFFF) - sw $t1, %lo(PI_STATUS_REG)($at) - sw $s7, 0x14($t0) - sw $s5, 0xc($t0) - sw $s3, 0x4($t0) - beqz $s3, .LA4000728 - sw $s4, ($t0) - lui $t1, 0xa600 - b .LA4000730 - addiu $t1, $t1, 0 -.LA4000728: - lui $t1, 0xb000 - addiu $t1, $t1, 0 -.LA4000730: - sw $t1, 0x8($t0) - lui $t0, %hi(SP_DMEM) - addiu $t0, %lo(SP_DMEM) - addi $t1, $t0, 0x1000 -.LA4000740: - addiu $t0, $t0, 4 - bne $t0, $t1, .LA4000740 - sw $zero, -4($t0) - lui $t0, %hi(SP_IMEM) - addiu $t0, %lo(SP_IMEM) - addi $t1, $t0, 0x1000 -.LA4000758: - addiu $t0, $t0, 4 - bne $t0, $t1, .LA4000758 - sw $zero, -4($t0) - lui $t3, %hi(D_B0000008) - lw $t1, %lo(D_B0000008)($t3) - jr $t1 - nop - nop - -func_A4000778: - addiu $sp, $sp, -0xa0 - sw $s0, 0x40($sp) - sw $s1, 0x44($sp) - move $s1, $zero - move $s0, $zero - sw $v0, ($sp) - sw $v1, 4($sp) - sw $a0, 8($sp) - sw $a1, 0xc($sp) - sw $a2, 0x10($sp) - sw $a3, 0x14($sp) - sw $t0, 0x18($sp) - sw $t1, 0x1c($sp) - sw $t2, 0x20($sp) - sw $t3, 0x24($sp) - sw $t4, 0x28($sp) - sw $t5, 0x2c($sp) - sw $t6, 0x30($sp) - sw $t7, 0x34($sp) - sw $t8, 0x38($sp) - sw $t9, 0x3c($sp) - sw $s2, 0x48($sp) - sw $s3, 0x4c($sp) - sw $s4, 0x50($sp) - sw $s5, 0x54($sp) - sw $s6, 0x58($sp) - sw $s7, 0x5c($sp) - sw $fp, 0x60($sp) - sw $ra, 0x64($sp) -.LA40007EC: - jal func_A4000880 - nop - addiu $s0, $s0, 1 - slti $t1, $s0, 4 - bnez $t1, .LA40007EC - addu $s1, $s1, $v0 - srl $a0, $s1, 2 - jal func_A4000A40 - li $a1, 1 - lw $ra, 0x64($sp) - srl $v0, $s1, 2 - lw $s1, 0x44($sp) - lw $v1, 4($sp) - lw $a0, 8($sp) - lw $a1, 0xc($sp) - lw $a2, 0x10($sp) - lw $a3, 0x14($sp) - lw $t0, 0x18($sp) - lw $t1, 0x1c($sp) - lw $t2, 0x20($sp) - lw $t3, 0x24($sp) - lw $t4, 0x28($sp) - lw $t5, 0x2c($sp) - lw $t6, 0x30($sp) - lw $t7, 0x34($sp) - lw $t8, 0x38($sp) - lw $t9, 0x3c($sp) - lw $s0, 0x40($sp) - lw $s2, 0x48($sp) - lw $s3, 0x4c($sp) - lw $s4, 0x50($sp) - lw $s5, 0x54($sp) - lw $s6, 0x58($sp) - lw $s7, 0x5c($sp) - lw $fp, 0x60($sp) - jr $ra - addiu $sp, $sp, 0xa0 - -func_A4000880: - addiu $sp, $sp, -0x20 - sw $ra, 0x1c($sp) - move $t1, $zero - move $t3, $zero - move $t4, $zero -.LA4000894: - slti $k0, $t4, 0x40 - beql $k0, $zero, .LA40008FC - move $v0, $zero - jal func_A400090C - move $a0, $t4 - blezl $v0, .LA40008CC - slti $k0, $t1, 0x50 - subu $k0, $v0, $t1 - multu $k0, $t4 - move $t1, $v0 - mflo $k0 - addu $t3, $t3, $k0 - nop - slti $k0, $t1, 0x50 -.LA40008CC: - bnez $k0, .LA4000894 - addiu $t4, $t4, 1 - sll $a0, $t3, 2 - subu $a0, $a0, $t3 - sll $a0, $a0, 2 - subu $a0, $a0, $t3 - sll $a0, $a0, 1 - jal func_A4000980 - addiu $a0, $a0, -0x370 - b .LA4000900 - lw $ra, 0x1c($sp) - move $v0, $zero -.LA40008FC: - lw $ra, 0x1c($sp) -.LA4000900: - addiu $sp, $sp, 0x20 - jr $ra - nop - -func_A400090C: - addiu $sp, $sp, -0x28 - sw $ra, 0x1c($sp) - move $v0, $zero - jal func_A4000A40 - li $a1, 2 - move $fp, $zero - li $k0, -1 -.LA4000928: - sw $k0, 4($s4) - lw $v1, 4($s4) - sw $k0, ($s4) - sw $k0, ($s4) - move $gp, $zero - srl $v1, $v1, 0x10 -.LA4000940: - andi $k0, $v1, 1 - beql $k0, $zero, .LA4000954 - addiu $gp, $gp, 1 - addiu $v0, $v0, 1 - addiu $gp, $gp, 1 -.LA4000954: - slti $k0, $gp, 8 - bnez $k0, .LA4000940 - srl $v1, $v1, 1 - addiu $fp, $fp, 1 - slti $k0, $fp, 0xa - bnezl $k0, .LA4000928 - li $k0, -1 - lw $ra, 0x1c($sp) - addiu $sp, $sp, 0x28 - jr $ra - nop - -func_A4000980: - addiu $sp, $sp, -0x28 - sw $ra, 0x1c($sp) - sw $a0, 0x20($sp) - sb $zero, 0x27($sp) - move $t0, $zero - move $t2, $zero - li $t5, 51200 - move $t6, $zero - slti $k0, $t6, 0x40 -.LA40009A4: - bnezl $k0, .LA40009B8 - move $a0, $t6 - b .LA4000A30 - move $v0, $zero - move $a0, $t6 -.LA40009B8: - jal func_A4000A40 - li $a1, 1 - jal func_A4000AD0 - addiu $a0, $sp, 0x27 - jal func_A4000AD0 - addiu $a0, $sp, 0x27 - lbu $k0, 0x27($sp) - li $k1, 800 - lw $a0, 0x20($sp) - multu $k0, $k1 - mflo $t0 - subu $k0, $t0, $a0 - bgezl $k0, .LA40009F8 - slt $k1, $k0, $t5 - subu $k0, $a0, $t0 - slt $k1, $k0, $t5 -.LA40009F8: - beql $k1, $zero, .LA4000A0C - lw $a0, 0x20($sp) - move $t5, $k0 - move $t2, $t6 - lw $a0, 0x20($sp) -.LA4000A0C: - slt $k1, $t0, $a0 - beql $k1, $zero, .LA4000A2C - addu $v0, $t2, $t6 - addiu $t6, $t6, 1 - slti $k1, $t6, 0x41 - bnezl $k1, .LA40009A4 - slti $k0, $t6, 0x40 - addu $v0, $t2, $t6 -.LA4000A2C: - srl $v0, $v0, 1 -.LA4000A30: - lw $ra, 0x1c($sp) - addiu $sp, $sp, 0x28 - jr $ra - nop - -func_A4000A40: - addiu $sp, $sp, -0x28 - andi $a0, $a0, 0xff - li $k1, 1 - xori $a0, $a0, 0x3f - sw $ra, 0x1c($sp) - bne $a1, $k1, .LA4000A64 - lui $t7, 0x4600 - lui $k0, 0x8000 - or $t7, $t7, $k0 -.LA4000A64: - andi $k0, $a0, 1 - sll $k0, $k0, 6 - or $t7, $t7, $k0 - andi $k0, $a0, 2 - sll $k0, $k0, 0xd - or $t7, $t7, $k0 - andi $k0, $a0, 4 - sll $k0, $k0, 0x14 - or $t7, $t7, $k0 - andi $k0, $a0, 8 - sll $k0, $k0, 4 - or $t7, $t7, $k0 - andi $k0, $a0, 0x10 - sll $k0, $k0, 0xb - or $t7, $t7, $k0 - andi $k0, $a0, 0x20 - sll $k0, $k0, 0x12 - or $t7, $t7, $k0 - li $k1, 1 - bne $a1, $k1, .LA4000AC0 - sw $t7, ($s5) - lui $k0, %hi(MI_MODE_REG) - sw $zero, %lo(MI_MODE_REG)($k0) -.LA4000AC0: - lw $ra, 0x1c($sp) - addiu $sp, $sp, 0x28 - jr $ra - nop - -func_A4000AD0: - addiu $sp, $sp, -0x28 - sw $ra, 0x1c($sp) - li $k0, 0x2000 - lui $k1, %hi(MI_MODE_REG) - sw $k0, %lo(MI_MODE_REG)($k1) - move $fp, $zero - lw $fp, ($s5) - li $k0, 0x1000 - sw $k0, %lo(MI_MODE_REG)($k1) - li $k1, 0x40 - and $k1, $k1, $fp - srl $k1, $k1, 6 - move $k0, $zero - or $k0, $k0, $k1 - li $k1, 0x4000 - and $k1, $k1, $fp - srl $k1, $k1, 0xd - or $k0, $k0, $k1 - li $k1, 0x400000 - and $k1, $k1, $fp - srl $k1, $k1, 0x14 - or $k0, $k0, $k1 - li $k1, 0x80 - and $k1, $k1, $fp - srl $k1, $k1, 4 - or $k0, $k0, $k1 - li $k1, 0x8000 - and $k1, $k1, $fp - srl $k1, $k1, 0xb - or $k0, $k0, $k1 - li $k1, 0x800000 - and $k1, $k1, $fp - srl $k1, $k1, 0x12 - or $k0, $k0, $k1 - sb $k0, ($a0) - lw $ra, 0x1c($sp) - addiu $sp, $sp, 0x28 - jr $ra - nop - nop - -# 0xA4000B70-0xA4000FFF: IPL3 Font -glabel ipl3_font -.incbin "textures/ipl3_raw/ipl3_font_00.ia1" -.incbin "textures/ipl3_raw/ipl3_font_01.ia1" -.incbin "textures/ipl3_raw/ipl3_font_02.ia1" -.incbin "textures/ipl3_raw/ipl3_font_03.ia1" -.incbin "textures/ipl3_raw/ipl3_font_04.ia1" -.incbin "textures/ipl3_raw/ipl3_font_05.ia1" -.incbin "textures/ipl3_raw/ipl3_font_06.ia1" -.incbin "textures/ipl3_raw/ipl3_font_07.ia1" -.incbin "textures/ipl3_raw/ipl3_font_08.ia1" -.incbin "textures/ipl3_raw/ipl3_font_09.ia1" -.incbin "textures/ipl3_raw/ipl3_font_10.ia1" -.incbin "textures/ipl3_raw/ipl3_font_11.ia1" -.incbin "textures/ipl3_raw/ipl3_font_12.ia1" -.incbin "textures/ipl3_raw/ipl3_font_13.ia1" -.incbin "textures/ipl3_raw/ipl3_font_14.ia1" -.incbin "textures/ipl3_raw/ipl3_font_15.ia1" -.incbin "textures/ipl3_raw/ipl3_font_16.ia1" -.incbin "textures/ipl3_raw/ipl3_font_17.ia1" -.incbin "textures/ipl3_raw/ipl3_font_18.ia1" -.incbin "textures/ipl3_raw/ipl3_font_19.ia1" -.incbin "textures/ipl3_raw/ipl3_font_20.ia1" -.incbin "textures/ipl3_raw/ipl3_font_21.ia1" -.incbin "textures/ipl3_raw/ipl3_font_22.ia1" -.incbin "textures/ipl3_raw/ipl3_font_23.ia1" -.incbin "textures/ipl3_raw/ipl3_font_24.ia1" -.incbin "textures/ipl3_raw/ipl3_font_25.ia1" -.incbin "textures/ipl3_raw/ipl3_font_26.ia1" -.incbin "textures/ipl3_raw/ipl3_font_27.ia1" -.incbin "textures/ipl3_raw/ipl3_font_28.ia1" -.incbin "textures/ipl3_raw/ipl3_font_29.ia1" -.incbin "textures/ipl3_raw/ipl3_font_30.ia1" -.incbin "textures/ipl3_raw/ipl3_font_31.ia1" -.incbin "textures/ipl3_raw/ipl3_font_32.ia1" -.incbin "textures/ipl3_raw/ipl3_font_33.ia1" -.incbin "textures/ipl3_raw/ipl3_font_34.ia1" -.incbin "textures/ipl3_raw/ipl3_font_35.ia1" -.incbin "textures/ipl3_raw/ipl3_font_36.ia1" -.incbin "textures/ipl3_raw/ipl3_font_37.ia1" -.incbin "textures/ipl3_raw/ipl3_font_38.ia1" -.incbin "textures/ipl3_raw/ipl3_font_39.ia1" -.incbin "textures/ipl3_raw/ipl3_font_40.ia1" -.incbin "textures/ipl3_raw/ipl3_font_41.ia1" -.incbin "textures/ipl3_raw/ipl3_font_42.ia1" -.incbin "textures/ipl3_raw/ipl3_font_43.ia1" -.incbin "textures/ipl3_raw/ipl3_font_44.ia1" -.incbin "textures/ipl3_raw/ipl3_font_45.ia1" -.incbin "textures/ipl3_raw/ipl3_font_46.ia1" -.incbin "textures/ipl3_raw/ipl3_font_47.ia1" -.incbin "textures/ipl3_raw/ipl3_font_48.ia1" -.incbin "textures/ipl3_raw/ipl3_font_49.ia1" -.fill 0x12 diff --git a/asm/decompress.s b/asm/decompress.s deleted file mode 100644 index 1399179d..00000000 --- a/asm/decompress.s +++ /dev/null @@ -1,149 +0,0 @@ -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 - -.include "macros.inc" - - -.section .text, "ax" - -# This file is handwritten. - -glabel decompress -.if VERSION_SH == 1 - lw $a3, 8($a0) - lw $t9, 0xc($a0) - lw $t8, 4($a0) - add $a3, $a3, $a0 - add $t9, $t9, $a0 - move $a2, $zero - addi $a0, $a0, 0x10 - add $t8, $t8, $a1 -.L802772C0: - bnel $a2, $zero, .L802772D8 - slt $t1, $t0, $zero - lw $t0, ($a0) - li $a2, 32 - addi $a0, $a0, 4 - slt $t1, $t0, $zero -.L802772D8: - beql $t1, $zero, .L802772F8 - lhu $t2, ($a3) - lb $t2, ($t9) - addi $t9, $t9, 1 - addi $a1, $a1, 1 - b .L80277324 - sb $t2, -1($a1) - lhu $t2, ($a3) -.L802772F8: - addi $a3, $a3, 2 - srl $t3, $t2, 0xc - andi $t2, $t2, 0xfff - sub $t1, $a1, $t2 - addi $t3, $t3, 3 -.L8027730C: - lb $t2, -1($t1) - addi $t3, $t3, -1 - addi $t1, $t1, 1 - addi $a1, $a1, 1 - bnez $t3, .L8027730C - sb $t2, -1($a1) -.L80277324: - sll $t0, $t0, 1 - bne $a1, $t8, .L802772C0 - addi $a2, $a2, -1 - jr $ra - nop -.elseif VERSION_EU == 1 - lw $a3, 8($a0) - lw $t9, 0xc($a0) - lw $t8, 4($a0) - add $a3, $a3, $a0 - add $t9, $t9, $a0 - move $a2, $zero - addi $a0, $a0, 0x10 - add $t8, $t8, $a1 -.L8026ED80: - bnezl $a2, .L8026ED98 - slt $t1, $t0, $zero - lw $t0, ($a0) - li $a2, 32 - addi $a0, $a0, 4 - slt $t1, $t0, $zero -.L8026ED98: - beql $t1, $zero, .L8026EDB8 - lhu $t2, ($a3) - lb $t2, ($t9) - addi $t9, $t9, 1 - addi $a1, $a1, 1 - b .L8026EDE4 - sb $t2, -1($a1) - lhu $t2, ($a3) -.L8026EDB8: - addi $a3, $a3, 2 - srl $t3, $t2, 0xc - andi $t2, $t2, 0xfff - sub $t1, $a1, $t2 - addi $t3, $t3, 3 -.L8026EDCC: - lb $t2, -1($t1) - addi $t3, $t3, -1 - addi $t1, $t1, 1 - addi $a1, $a1, 1 - bnez $t3, .L8026EDCC - sb $t2, -1($a1) -.L8026EDE4: - sll $t0, $t0, 1 - bne $a1, $t8, .L8026ED80 - addi $a2, $a2, -1 - jr $ra - nop -.else - lw $t8, 4($a0) - lw $a3, 8($a0) - lw $t9, 0xc($a0) - move $a2, $zero - add $t8, $t8, $a1 - add $a3, $a3, $a0 - add $t9, $t9, $a0 - addi $a0, $a0, 0x10 -.L8027EF50: - bnez $a2, .L8027EF64 - nop - lw $t0, ($a0) - li $a2, 32 - addi $a0, $a0, 4 -.L8027EF64: - slt $t1, $t0, $zero - beqz $t1, .L8027EF88 - nop - lb $t2, ($t9) - addi $t9, $t9, 1 - sb $t2, ($a1) - addi $a1, $a1, 1 - b .L8027EFBC - nop -.L8027EF88: - lhu $t2, ($a3) - addi $a3, $a3, 2 - srl $t3, $t2, 0xc - andi $t2, $t2, 0xfff - sub $t1, $a1, $t2 - addi $t3, $t3, 3 -.L8027EFA0: - lb $t2, -1($t1) - addi $t3, $t3, -1 - addi $t1, $t1, 1 - sb $t2, ($a1) - addi $a1, $a1, 1 - bnez $t3, .L8027EFA0 - nop -.L8027EFBC: - sll $t0, $t0, 1 - addi $a2, $a2, -1 - bne $a1, $t8, .L8027EF50 - nop - jr $ra - nop -.endif diff --git a/asm/entry.s b/asm/entry.s deleted file mode 100644 index 755e1b4b..00000000 --- a/asm/entry.s +++ /dev/null @@ -1,32 +0,0 @@ -# assembler directives -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches -.set gp=64 - -.include "macros.inc" - - -.section .text, "ax" - -glabel entry_point - lui $t0, %hi(_mainSegmentNoloadStart) # $t0, 0x8034 - lui $t1, %lo(_mainSegmentNoloadSizeHi) # lui $t1, 2 - addiu $t0, %lo(_mainSegmentNoloadStart) # addiu $t0, $t0, -0x6df0 - ori $t1, %lo(_mainSegmentNoloadSizeLo) # ori $t1, $t1, 0xcee0 -.L80246010: - addi $t1, $t1, -8 - sw $zero, ($t0) - sw $zero, 4($t0) - bnez $t1, .L80246010 - addi $t0, $t0, 8 - lui $t2, %hi(main_func) # $t2, 0x8024 - lui $sp, %hi(gIdleThreadStack) # $sp, 0x8020 - addiu $t2, %lo(main_func) # addiu $t2, $t2, 0x6dc4 - jr $t2 - addiu $sp, %lo(gIdleThreadStack) # addiu $sp, $sp, 0xa00 - nop - nop - nop - nop - nop - nop diff --git a/asm/non_matchings/eu/audio/sequence_channel_process_script.s b/asm/non_matchings/eu/audio/sequence_channel_process_script.s deleted file mode 100644 index 4078e3c7..00000000 --- a/asm/non_matchings/eu/audio/sequence_channel_process_script.s +++ /dev/null @@ -1,943 +0,0 @@ -.data - .asciiz "Audio:Track :Call Macro Level Over Error!\n" - .balign 4 - .asciiz "Audio:Track :Loops Macro Level Over Error!\n" - .balign 4 - .asciiz "SUB:ERR:BANK %d NOT CACHED.\n" - .balign 4 - .asciiz "SUB:ERR:BANK %d NOT CACHED.\n" - .balign 4 - .asciiz "Audio:Track: CTBLCALL Macro Level Over Error!\n" - .balign 4 - .asciiz "Err :Sub %x ,address %x:Undefined SubTrack Function %x" - .balign 4 - -.late_rodata -.late_rodata_alignment 4 -glabel jtbl_EU_80306714 - .word L802E8650 - .word L802E85A0, L802E866C - .word L802E867C, L802E85BC - .word L802E8888, L802E88E4 - .word L802E891C, L802E891C - .word L802E8968, L802E8978 - .word L802E891C, L802E8368 - .word L802E8368, L802E8368 - .word L802E8998, L802E89BC - .word L802E89CC, L802E8714 - .word L802E8878, L802E8368 - .word L802E8368, L802E87E0 - .word L802E87C4, L802E87B4 - .word L802E8798, L802E8780 - .word L802E8764, L802E8748 - .word L802E86E0, L802E868C - .word L802E86B0, L802E8830 - .word L802E87FC, L802E8864 - .word L802E89EC, L802E89DC - .word L802E8A48, L802E8A58 - .word L802E8AC0, L802E8B60 - .word L802E83EC, L802E85F8 - .word L802E8B38, L802E8368 - .word L802E8368, L802E8368 - .word L802E8590, L802E8568 - .word L802E8520, L802E8520 - .word L802E8520, L802E84C8 - .word L802E84B8, L802E8470 - .word L802E8438, L802E84C8 - .word L802E84C8, L802E84C8 - .word L802E83FC, L802E83DC - .word L802E8D98, L802E83A4 - -glabel jtbl_EU_80306810 - .word L802E8B9C, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8CFC, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8D2C, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8D48, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8D70, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8C04, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8C20, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8BD4, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8BE4, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8C2C, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8C78, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8368, L802E8368 - .word L802E8C94 - -.text -glabel sequence_channel_process_script -/* 0A7AB8 802E82B8 27BDFFA0 */ addiu $sp, $sp, -0x60 -/* 0A7ABC 802E82BC AFBF002C */ sw $ra, 0x2c($sp) -/* 0A7AC0 802E82C0 AFB40028 */ sw $s4, 0x28($sp) -/* 0A7AC4 802E82C4 AFB30024 */ sw $s3, 0x24($sp) -/* 0A7AC8 802E82C8 AFB20020 */ sw $s2, 0x20($sp) -/* 0A7ACC 802E82CC AFB1001C */ sw $s1, 0x1c($sp) -/* 0A7AD0 802E82D0 AFB00018 */ sw $s0, 0x18($sp) -/* 0A7AD4 802E82D4 8C820000 */ lw $v0, ($a0) -/* 0A7AD8 802E82D8 00809025 */ move $s2, $a0 -/* 0A7ADC 802E82DC 000277C2 */ srl $t6, $v0, 0x1f -/* 0A7AE0 802E82E0 11C002B8 */ beqz $t6, .L80200BC4 -/* 0A7AE4 802E82E4 0002C080 */ sll $t8, $v0, 2 -/* 0A7AE8 802E82E8 0701000D */ bgez $t8, .L80200120 -/* 0A7AEC 802E82EC 00008025 */ move $s0, $zero -/* 0A7AF0 802E82F0 00808825 */ move $s1, $a0 -/* 0A7AF4 802E82F4 24120010 */ li $s2, 16 -.L802000F8: -/* 0A7AF8 802E82F8 8E240048 */ lw $a0, 0x48($s1) -/* 0A7AFC 802E82FC 50800004 */ beql $a0, $zero, .L80200110 -/* 0A7B00 802E8300 26100004 */ addiu $s0, $s0, 4 -/* 0A7B04 802E8304 0C0B9DC2 */ jal seq_channel_layer_process_script -/* 0A7B08 802E8308 00000000 */ nop -/* 0A7B0C 802E830C 26100004 */ addiu $s0, $s0, 4 -.L80200110: -/* 0A7B10 802E8310 1612FFF9 */ bne $s0, $s2, .L802000F8 -/* 0A7B14 802E8314 26310004 */ addiu $s1, $s1, 4 -/* 0A7B18 802E8318 100002AB */ b .L80200BC8 -/* 0A7B1C 802E831C 8FBF002C */ lw $ra, 0x2c($sp) -.L80200120: -/* 0A7B20 802E8320 8E540044 */ lw $s4, 0x44($s2) -/* 0A7B24 802E8324 8E990000 */ lw $t9, ($s4) -/* 0A7B28 802E8328 00195080 */ sll $t2, $t9, 2 -/* 0A7B2C 802E832C 05430006 */ bgezl $t2, .L80200148 -/* 0A7B30 802E8330 9643001A */ lhu $v1, 0x1a($s2) -/* 0A7B34 802E8334 924B0003 */ lbu $t3, 3($s2) -/* 0A7B38 802E8338 316C0080 */ andi $t4, $t3, 0x80 -/* 0A7B3C 802E833C 558002A2 */ bnezl $t4, .L80200BC8 -/* 0A7B40 802E8340 8FBF002C */ lw $ra, 0x2c($sp) -/* 0A7B44 802E8344 9643001A */ lhu $v1, 0x1a($s2) -.L80200148: -/* 0A7B48 802E8348 26510060 */ addiu $s1, $s2, 0x60 -/* 0A7B4C 802E834C 10600004 */ beqz $v1, .L80200160 -/* 0A7B50 802E8350 00601025 */ move $v0, $v1 -/* 0A7B54 802E8354 246DFFFF */ addiu $t5, $v1, -1 -/* 0A7B58 802E8358 A64D001A */ sh $t5, 0x1a($s2) -/* 0A7B5C 802E835C 31A2FFFF */ andi $v0, $t5, 0xffff -.L80200160: -/* 0A7B60 802E8360 1440028D */ bnez $v0, .L802E8D98 -/* 0A7B64 802E8364 83B3004B */ lb $s3, 0x4b($sp) -glabel L802E8368 -.L802E8368: -/* 0A7B68 802E8368 0C0B9DA0 */ jal m64_read_u8 -/* 0A7B6C 802E836C 02202025 */ move $a0, $s1 -/* 0A7B70 802E8370 284100C1 */ slti $at, $v0, 0xc1 -/* 0A7B74 802E8374 305000FF */ andi $s0, $v0, 0xff -/* 0A7B78 802E8378 142001FD */ bnez $at, .L80200970 -/* 0A7B7C 802E837C 00401825 */ move $v1, $v0 -/* 0A7B80 802E8380 244EFF3F */ addiu $t6, $v0, -0xc1 -/* 0A7B84 802E8384 2DC1003F */ sltiu $at, $t6, 0x3f -/* 0A7B88 802E8388 1020FFF7 */ beqz $at, .L802E8368 -/* 0A7B8C 802E838C 000E7080 */ sll $t6, $t6, 2 -/* 0A7B90 802E8390 3C018030 */ lui $at, %hi(jtbl_EU_80306714) -/* 0A7B94 802E8394 002E0821 */ addu $at, $at, $t6 -/* 0A7B98 802E8398 8C2E6714 */ lw $t6, %lo(jtbl_EU_80306714)($at) -/* 0A7B9C 802E839C 01C00008 */ jr $t6 -/* 0A7BA0 802E83A0 00000000 */ nop -glabel L802E83A4 -/* 0A7BA4 802E83A4 92240018 */ lbu $a0, 0x18($s1) -/* 0A7BA8 802E83A8 14800005 */ bnez $a0, .L802001C0 -/* 0A7BAC 802E83AC 2482FFFF */ addiu $v0, $a0, -1 -/* 0A7BB0 802E83B0 0C0B9C41 */ jal sequence_channel_disable -/* 0A7BB4 802E83B4 02402025 */ move $a0, $s2 -/* 0A7BB8 802E83B8 10000278 */ b .L80200B9C -/* 0A7BBC 802E83BC 02408825 */ move $s1, $s2 -.L802001C0: -/* 0A7BC0 802E83C0 304F00FF */ andi $t7, $v0, 0xff -/* 0A7BC4 802E83C4 000FC080 */ sll $t8, $t7, 2 -/* 0A7BC8 802E83C8 0238C821 */ addu $t9, $s1, $t8 -/* 0A7BCC 802E83CC A22F0018 */ sb $t7, 0x18($s1) -/* 0A7BD0 802E83D0 8F290004 */ lw $t1, 4($t9) -/* 0A7BD4 802E83D4 1000FFE4 */ b .L802E8368 -/* 0A7BD8 802E83D8 AE290000 */ sw $t1, ($s1) -glabel L802E83DC -/* 0A7BDC 802E83DC 0C0B9DB1 */ jal m64_read_compressed_u16 -/* 0A7BE0 802E83E0 02202025 */ move $a0, $s1 -/* 0A7BE4 802E83E4 1000026C */ b .L802E8D98 -/* 0A7BE8 802E83E8 A642001A */ sh $v0, 0x1a($s2) -glabel L802E83EC -/* 0A7BEC 802E83EC 924B0000 */ lbu $t3, ($s2) -/* 0A7BF0 802E83F0 356C0020 */ ori $t4, $t3, 0x20 -/* 0A7BF4 802E83F4 10000268 */ b .L802E8D98 -/* 0A7BF8 802E83F8 A24C0000 */ sb $t4, ($s2) -glabel L802E83FC -/* 0A7BFC 802E83FC 0C0B9DA5 */ jal m64_read_s16 -/* 0A7C00 802E8400 02202025 */ move $a0, $s1 -/* 0A7C04 802E8404 922E0018 */ lbu $t6, 0x18($s1) -/* 0A7C08 802E8408 8E2D0000 */ lw $t5, ($s1) -/* 0A7C0C 802E840C 304BFFFF */ andi $t3, $v0, 0xffff -/* 0A7C10 802E8410 000E7880 */ sll $t7, $t6, 2 -/* 0A7C14 802E8414 022FC021 */ addu $t8, $s1, $t7 -/* 0A7C18 802E8418 AF0D0004 */ sw $t5, 4($t8) -/* 0A7C1C 802E841C 92390018 */ lbu $t9, 0x18($s1) -/* 0A7C20 802E8420 27290001 */ addiu $t1, $t9, 1 -/* 0A7C24 802E8424 A2290018 */ sb $t1, 0x18($s1) -/* 0A7C28 802E8428 8E8A0014 */ lw $t2, 0x14($s4) -/* 0A7C2C 802E842C 014B6021 */ addu $t4, $t2, $t3 -/* 0A7C30 802E8430 1000FFCD */ b .L802E8368 -/* 0A7C34 802E8434 AE2C0000 */ sw $t4, ($s1) -glabel L802E8438 -/* 0A7C38 802E8438 0C0B9DA0 */ jal m64_read_u8 -/* 0A7C3C 802E843C 02202025 */ move $a0, $s1 -/* 0A7C40 802E8440 922E0018 */ lbu $t6, 0x18($s1) -/* 0A7C44 802E8444 022E7821 */ addu $t7, $s1, $t6 -/* 0A7C48 802E8448 A1E20014 */ sb $v0, 0x14($t7) -/* 0A7C4C 802E844C 92380018 */ lbu $t8, 0x18($s1) -/* 0A7C50 802E8450 8E2D0000 */ lw $t5, ($s1) -/* 0A7C54 802E8454 0018C880 */ sll $t9, $t8, 2 -/* 0A7C58 802E8458 02394821 */ addu $t1, $s1, $t9 -/* 0A7C5C 802E845C AD2D0004 */ sw $t5, 4($t1) -/* 0A7C60 802E8460 922A0018 */ lbu $t2, 0x18($s1) -/* 0A7C64 802E8464 254B0001 */ addiu $t3, $t2, 1 -/* 0A7C68 802E8468 1000FFBF */ b .L802E8368 -/* 0A7C6C 802E846C A22B0018 */ sb $t3, 0x18($s1) -glabel L802E8470 -/* 0A7C70 802E8470 922C0018 */ lbu $t4, 0x18($s1) -/* 0A7C74 802E8474 022C1021 */ addu $v0, $s1, $t4 -/* 0A7C78 802E8478 904E0013 */ lbu $t6, 0x13($v0) -/* 0A7C7C 802E847C 25CFFFFF */ addiu $t7, $t6, -1 -/* 0A7C80 802E8480 A04F0013 */ sb $t7, 0x13($v0) -/* 0A7C84 802E8484 92240018 */ lbu $a0, 0x18($s1) -/* 0A7C88 802E8488 0224C021 */ addu $t8, $s1, $a0 -/* 0A7C8C 802E848C 93190013 */ lbu $t9, 0x13($t8) -/* 0A7C90 802E8490 00801825 */ move $v1, $a0 -/* 0A7C94 802E8494 00036880 */ sll $t5, $v1, 2 -/* 0A7C98 802E8498 13200005 */ beqz $t9, .L802002B0 -/* 0A7C9C 802E849C 248BFFFF */ addiu $t3, $a0, -1 -/* 0A7CA0 802E84A0 022D4821 */ addu $t1, $s1, $t5 -/* 0A7CA4 802E84A4 8D2A0000 */ lw $t2, ($t1) -/* 0A7CA8 802E84A8 1000FFAF */ b .L802E8368 -/* 0A7CAC 802E84AC AE2A0000 */ sw $t2, ($s1) -.L802002B0: -/* 0A7CB0 802E84B0 1000FFAD */ b .L802E8368 -/* 0A7CB4 802E84B4 A22B0018 */ sb $t3, 0x18($s1) -glabel L802E84B8 -/* 0A7CB8 802E84B8 922C0018 */ lbu $t4, 0x18($s1) -/* 0A7CBC 802E84BC 258EFFFF */ addiu $t6, $t4, -1 -/* 0A7CC0 802E84C0 1000FFA9 */ b .L802E8368 -/* 0A7CC4 802E84C4 A22E0018 */ sb $t6, 0x18($s1) -glabel L802E84C8 -/* 0A7CC8 802E84C8 0C0B9DA5 */ jal m64_read_s16 -/* 0A7CCC 802E84CC 02202025 */ move $a0, $s1 -/* 0A7CD0 802E84D0 240100FA */ li $at, 250 -/* 0A7CD4 802E84D4 16010003 */ bne $s0, $at, .L802002E4 -/* 0A7CD8 802E84D8 02001825 */ move $v1, $s0 -/* 0A7CDC 802E84DC 1660FFA2 */ bnez $s3, .L802E8368 -/* 0A7CE0 802E84E0 00000000 */ nop -.L802002E4: -/* 0A7CE4 802E84E4 240100F9 */ li $at, 249 -/* 0A7CE8 802E84E8 54610004 */ bnel $v1, $at, .L802002FC -/* 0A7CEC 802E84EC 240100F5 */ li $at, 245 -/* 0A7CF0 802E84F0 0661FF9D */ bgez $s3, .L802E8368 -/* 0A7CF4 802E84F4 00000000 */ nop -/* 0A7CF8 802E84F8 240100F5 */ li $at, 245 -.L802002FC: -/* 0A7CFC 802E84FC 54610004 */ bnel $v1, $at, .L80200310 -/* 0A7D00 802E8500 8E8F0014 */ lw $t7, 0x14($s4) -/* 0A7D04 802E8504 0660FF98 */ bltz $s3, .L802E8368 -/* 0A7D08 802E8508 00000000 */ nop -/* 0A7D0C 802E850C 8E8F0014 */ lw $t7, 0x14($s4) -.L80200310: -/* 0A7D10 802E8510 3058FFFF */ andi $t8, $v0, 0xffff -/* 0A7D14 802E8514 01F8C821 */ addu $t9, $t7, $t8 -/* 0A7D18 802E8518 1000FF93 */ b .L802E8368 -/* 0A7D1C 802E851C AE390000 */ sw $t9, ($s1) -glabel L802E8520 -/* 0A7D20 802E8520 0C0B9DA0 */ jal m64_read_u8 -/* 0A7D24 802E8524 02202025 */ move $a0, $s1 -/* 0A7D28 802E8528 240100F3 */ li $at, 243 -/* 0A7D2C 802E852C 16010003 */ bne $s0, $at, .L8020033C -/* 0A7D30 802E8530 02001825 */ move $v1, $s0 -/* 0A7D34 802E8534 1660FF8C */ bnez $s3, .L802E8368 -/* 0A7D38 802E8538 00000000 */ nop -.L8020033C: -/* 0A7D3C 802E853C 240100F2 */ li $at, 242 -/* 0A7D40 802E8540 54610004 */ bnel $v1, $at, .L80200354 -/* 0A7D44 802E8544 8E2D0000 */ lw $t5, ($s1) -/* 0A7D48 802E8548 0661FF87 */ bgez $s3, .L802E8368 -/* 0A7D4C 802E854C 00000000 */ nop -/* 0A7D50 802E8550 8E2D0000 */ lw $t5, ($s1) -.L80200354: -/* 0A7D54 802E8554 00024E00 */ sll $t1, $v0, 0x18 -/* 0A7D58 802E8558 00095603 */ sra $t2, $t1, 0x18 -/* 0A7D5C 802E855C 01AA5821 */ addu $t3, $t5, $t2 -/* 0A7D60 802E8560 1000FF81 */ b .L802E8368 -/* 0A7D64 802E8564 AE2B0000 */ sw $t3, ($s1) -glabel L802E8568 -/* 0A7D68 802E8568 26500084 */ addiu $s0, $s2, 0x84 -/* 0A7D6C 802E856C 0C0B9671 */ jal note_pool_clear -/* 0A7D70 802E8570 02002025 */ move $a0, $s0 -/* 0A7D74 802E8574 0C0B9DA0 */ jal m64_read_u8 -/* 0A7D78 802E8578 02202025 */ move $a0, $s1 -/* 0A7D7C 802E857C 02002025 */ move $a0, $s0 -/* 0A7D80 802E8580 0C0B96C9 */ jal note_pool_fill -/* 0A7D84 802E8584 00402825 */ move $a1, $v0 -/* 0A7D88 802E8588 1000FF77 */ b .L802E8368 -/* 0A7D8C 802E858C 00000000 */ nop -glabel L802E8590 -/* 0A7D90 802E8590 0C0B9671 */ jal note_pool_clear -/* 0A7D94 802E8594 26440084 */ addiu $a0, $s2, 0x84 -/* 0A7D98 802E8598 1000FF73 */ b .L802E8368 -/* 0A7D9C 802E859C 00000000 */ nop -glabel L802E85A0 -/* 0A7DA0 802E85A0 0C0B9DA5 */ jal m64_read_s16 -/* 0A7DA4 802E85A4 02202025 */ move $a0, $s1 -/* 0A7DA8 802E85A8 8E8C0014 */ lw $t4, 0x14($s4) -/* 0A7DAC 802E85AC 304EFFFF */ andi $t6, $v0, 0xffff -/* 0A7DB0 802E85B0 018E7821 */ addu $t7, $t4, $t6 -/* 0A7DB4 802E85B4 1000FF6C */ b .L802E8368 -/* 0A7DB8 802E85B8 AE4F0034 */ sw $t7, 0x34($s2) -glabel L802E85BC -/* 0A7DBC 802E85BC 2401FFFF */ li $at, -1 -/* 0A7DC0 802E85C0 1261FF69 */ beq $s3, $at, .L802E8368 -/* 0A7DC4 802E85C4 00000000 */ nop -/* 0A7DC8 802E85C8 8E580034 */ lw $t8, 0x34($s2) -/* 0A7DCC 802E85CC 0013C840 */ sll $t9, $s3, 1 -/* 0A7DD0 802E85D0 8E8C0014 */ lw $t4, 0x14($s4) -/* 0A7DD4 802E85D4 03191821 */ addu $v1, $t8, $t9 -/* 0A7DD8 802E85D8 906D0000 */ lbu $t5, ($v1) -/* 0A7DDC 802E85DC 90690001 */ lbu $t1, 1($v1) -/* 0A7DE0 802E85E0 000D5200 */ sll $t2, $t5, 8 -/* 0A7DE4 802E85E4 012A3821 */ addu $a3, $t1, $t2 -/* 0A7DE8 802E85E8 30EBFFFF */ andi $t3, $a3, 0xffff -/* 0A7DEC 802E85EC 018B7021 */ addu $t6, $t4, $t3 -/* 0A7DF0 802E85F0 1000FF5D */ b .L802E8368 -/* 0A7DF4 802E85F4 AE4E0034 */ sw $t6, 0x34($s2) -glabel L802E85F8 -/* 0A7DF8 802E85F8 0C0B9DA0 */ jal m64_read_u8 -/* 0A7DFC 802E85FC 02202025 */ move $a0, $s1 -/* 0A7E00 802E8600 928F0004 */ lbu $t7, 4($s4) -/* 0A7E04 802E8604 3C038023 */ lui $v1, %hi(gAlBankSets) # $v1, 0x8023 -/* 0A7E08 802E8608 8C6397D0 */ lw $v1, %lo(gAlBankSets)($v1) -/* 0A7E0C 802E860C 000FC040 */ sll $t8, $t7, 1 -/* 0A7E10 802E8610 3C048022 */ lui $a0, %hi(gBankLoadedPool) # $a0, 0x8022 -/* 0A7E14 802E8614 0078C821 */ addu $t9, $v1, $t8 -/* 0A7E18 802E8618 97270000 */ lhu $a3, ($t9) -/* 0A7E1C 802E861C 24842840 */ addiu $a0, %lo(gBankLoadedPool) # addiu $a0, $a0, 0x2840 -/* 0A7E20 802E8620 24050002 */ li $a1, 2 -/* 0A7E24 802E8624 00E36821 */ addu $t5, $a3, $v1 -/* 0A7E28 802E8628 91A80000 */ lbu $t0, ($t5) -/* 0A7E2C 802E862C 00E84821 */ addu $t1, $a3, $t0 -/* 0A7E30 802E8630 01225023 */ subu $t2, $t1, $v0 -/* 0A7E34 802E8634 01435821 */ addu $t3, $t2, $v1 -/* 0A7E38 802E8638 91700000 */ lbu $s0, ($t3) -/* 0A7E3C 802E863C 0C0B89CF */ jal get_bank_or_seq -/* 0A7E40 802E8640 02003025 */ move $a2, $s0 -/* 0A7E44 802E8644 10400002 */ beqz $v0, .L802E8650 -/* 0A7E48 802E8648 00000000 */ nop -/* 0A7E4C 802E864C A2500006 */ sb $s0, 6($s2) -glabel L802E8650 -.L802E8650: -/* 0A7E50 802E8650 0C0B9DA0 */ jal m64_read_u8 -/* 0A7E54 802E8654 02202025 */ move $a0, $s1 -/* 0A7E58 802E8658 02402025 */ move $a0, $s2 -/* 0A7E5C 802E865C 0C0BA080 */ jal set_instrument -/* 0A7E60 802E8660 304500FF */ andi $a1, $v0, 0xff -/* 0A7E64 802E8664 1000FF40 */ b .L802E8368 -/* 0A7E68 802E8668 00000000 */ nop -glabel L802E866C -/* 0A7E6C 802E866C 924C0000 */ lbu $t4, ($s2) -/* 0A7E70 802E8670 318EFFFD */ andi $t6, $t4, 0xfffd -/* 0A7E74 802E8674 1000FF3C */ b .L802E8368 -/* 0A7E78 802E8678 A24E0000 */ sb $t6, ($s2) -glabel L802E867C -/* 0A7E7C 802E867C 92580000 */ lbu $t8, ($s2) -/* 0A7E80 802E8680 37190002 */ ori $t9, $t8, 2 -/* 0A7E84 802E8684 1000FF38 */ b .L802E8368 -/* 0A7E88 802E8688 A2590000 */ sb $t9, ($s2) -glabel L802E868C -/* 0A7E8C 802E868C 0C0B9DA0 */ jal m64_read_u8 -/* 0A7E90 802E8690 02202025 */ move $a0, $s1 -/* 0A7E94 802E8694 02402025 */ move $a0, $s2 -/* 0A7E98 802E8698 0C0BA0A5 */ jal sequence_channel_set_volume -/* 0A7E9C 802E869C 304500FF */ andi $a1, $v0, 0xff -/* 0A7EA0 802E86A0 92490001 */ lbu $t1, 1($s2) -/* 0A7EA4 802E86A4 352A0040 */ ori $t2, $t1, 0x40 -/* 0A7EA8 802E86A8 1000FF2F */ b .L802E8368 -/* 0A7EAC 802E86AC A24A0001 */ sb $t2, 1($s2) -glabel L802E86B0 -/* 0A7EB0 802E86B0 0C0B9DA0 */ jal m64_read_u8 -/* 0A7EB4 802E86B4 02202025 */ move $a0, $s1 -/* 0A7EB8 802E86B8 44822000 */ mtc1 $v0, $f4 -/* 0A7EBC 802E86BC 3C013C00 */ li $at, 0x3C000000 # 0.007812 -/* 0A7EC0 802E86C0 44814000 */ mtc1 $at, $f8 -/* 0A7EC4 802E86C4 468021A0 */ cvt.s.w $f6, $f4 -/* 0A7EC8 802E86C8 924C0001 */ lbu $t4, 1($s2) -/* 0A7ECC 802E86CC 358E0040 */ ori $t6, $t4, 0x40 -/* 0A7ED0 802E86D0 A24E0001 */ sb $t6, 1($s2) -/* 0A7ED4 802E86D4 46083282 */ mul.s $f10, $f6, $f8 -/* 0A7ED8 802E86D8 1000FF23 */ b .L802E8368 -/* 0A7EDC 802E86DC E64A0020 */ swc1 $f10, 0x20($s2) -glabel L802E86E0 -/* 0A7EE0 802E86E0 0C0B9DA5 */ jal m64_read_s16 -/* 0A7EE4 802E86E4 02202025 */ move $a0, $s1 -/* 0A7EE8 802E86E8 304FFFFF */ andi $t7, $v0, 0xffff -/* 0A7EEC 802E86EC 448F8000 */ mtc1 $t7, $f16 -/* 0A7EF0 802E86F0 3C014700 */ li $at, 0x47000000 # 32768.000000 -/* 0A7EF4 802E86F4 44812000 */ mtc1 $at, $f4 -/* 0A7EF8 802E86F8 468084A0 */ cvt.s.w $f18, $f16 -/* 0A7EFC 802E86FC 92590001 */ lbu $t9, 1($s2) -/* 0A7F00 802E8700 372D0080 */ ori $t5, $t9, 0x80 -/* 0A7F04 802E8704 A24D0001 */ sb $t5, 1($s2) -/* 0A7F08 802E8708 46049183 */ div.s $f6, $f18, $f4 -/* 0A7F0C 802E870C 1000FF16 */ b .L802E8368 -/* 0A7F10 802E8710 E6460030 */ swc1 $f6, 0x30($s2) -glabel L802E8714 -/* 0A7F14 802E8714 0C0B9DA0 */ jal m64_read_u8 -/* 0A7F18 802E8718 02202025 */ move $a0, $s1 -/* 0A7F1C 802E871C 2449007F */ addiu $t1, $v0, 0x7f -/* 0A7F20 802E8720 312A00FF */ andi $t2, $t1, 0xff -/* 0A7F24 802E8724 924E0001 */ lbu $t6, 1($s2) -/* 0A7F28 802E8728 000A5880 */ sll $t3, $t2, 2 -/* 0A7F2C 802E872C 3C018030 */ lui $at, %hi(gPitchBendFrequencyScale) -/* 0A7F30 802E8730 002B0821 */ addu $at, $at, $t3 -/* 0A7F34 802E8734 C42806E8 */ lwc1 $f8, %lo(gPitchBendFrequencyScale)($at) -/* 0A7F38 802E8738 35CF0080 */ ori $t7, $t6, 0x80 -/* 0A7F3C 802E873C A24F0001 */ sb $t7, 1($s2) -/* 0A7F40 802E8740 1000FF09 */ b .L802E8368 -/* 0A7F44 802E8744 E6480030 */ swc1 $f8, 0x30($s2) -glabel L802E8748 -/* 0A7F48 802E8748 0C0B9DA0 */ jal m64_read_u8 -/* 0A7F4C 802E874C 02202025 */ move $a0, $s1 -/* 0A7F50 802E8750 92590001 */ lbu $t9, 1($s2) -/* 0A7F54 802E8754 A2420009 */ sb $v0, 9($s2) -/* 0A7F58 802E8758 372D0020 */ ori $t5, $t9, 0x20 -/* 0A7F5C 802E875C 1000FF02 */ b .L802E8368 -/* 0A7F60 802E8760 A24D0001 */ sb $t5, 1($s2) -glabel L802E8764 -/* 0A7F64 802E8764 0C0B9DA0 */ jal m64_read_u8 -/* 0A7F68 802E8768 02202025 */ move $a0, $s1 -/* 0A7F6C 802E876C 924A0001 */ lbu $t2, 1($s2) -/* 0A7F70 802E8770 A242000A */ sb $v0, 0xa($s2) -/* 0A7F74 802E8774 354B0020 */ ori $t3, $t2, 0x20 -/* 0A7F78 802E8778 1000FEFB */ b .L802E8368 -/* 0A7F7C 802E877C A24B0001 */ sb $t3, 1($s2) -glabel L802E8780 -/* 0A7F80 802E8780 8E220000 */ lw $v0, ($s1) -/* 0A7F84 802E8784 80430000 */ lb $v1, ($v0) -/* 0A7F88 802E8788 244C0001 */ addiu $t4, $v0, 1 -/* 0A7F8C 802E878C AE2C0000 */ sw $t4, ($s1) -/* 0A7F90 802E8790 1000FEF5 */ b .L802E8368 -/* 0A7F94 802E8794 A643001E */ sh $v1, 0x1e($s2) -glabel L802E8798 -/* 0A7F98 802E8798 0C0B9DA5 */ jal m64_read_s16 -/* 0A7F9C 802E879C 02202025 */ move $a0, $s1 -/* 0A7FA0 802E87A0 8E8E0014 */ lw $t6, 0x14($s4) -/* 0A7FA4 802E87A4 304FFFFF */ andi $t7, $v0, 0xffff -/* 0A7FA8 802E87A8 01CFC021 */ addu $t8, $t6, $t7 -/* 0A7FAC 802E87AC 1000FEEE */ b .L802E8368 -/* 0A7FB0 802E87B0 AE580080 */ sw $t8, 0x80($s2) -glabel L802E87B4 -/* 0A7FB4 802E87B4 0C0B9DA0 */ jal m64_read_u8 -/* 0A7FB8 802E87B8 02202025 */ move $a0, $s1 -/* 0A7FBC 802E87BC 1000FEEA */ b .L802E8368 -/* 0A7FC0 802E87C0 A242007C */ sb $v0, 0x7c($s2) -glabel L802E87C4 -/* 0A7FC4 802E87C4 0C0B9DA0 */ jal m64_read_u8 -/* 0A7FC8 802E87C8 02202025 */ move $a0, $s1 -/* 0A7FCC 802E87CC 0002C8C0 */ sll $t9, $v0, 3 -/* 0A7FD0 802E87D0 A6590012 */ sh $t9, 0x12($s2) -/* 0A7FD4 802E87D4 A640000E */ sh $zero, 0xe($s2) -/* 0A7FD8 802E87D8 1000FEE3 */ b .L802E8368 -/* 0A7FDC 802E87DC A6400016 */ sh $zero, 0x16($s2) -glabel L802E87E0 -/* 0A7FE0 802E87E0 0C0B9DA0 */ jal m64_read_u8 -/* 0A7FE4 802E87E4 02202025 */ move $a0, $s1 -/* 0A7FE8 802E87E8 00021940 */ sll $v1, $v0, 5 -/* 0A7FEC 802E87EC A6430010 */ sh $v1, 0x10($s2) -/* 0A7FF0 802E87F0 A643000C */ sh $v1, 0xc($s2) -/* 0A7FF4 802E87F4 1000FEDC */ b .L802E8368 -/* 0A7FF8 802E87F8 A6400014 */ sh $zero, 0x14($s2) -glabel L802E87FC -/* 0A7FFC 802E87FC 0C0B9DA0 */ jal m64_read_u8 -/* 0A8000 802E8800 02202025 */ move $a0, $s1 -/* 0A8004 802E8804 000268C0 */ sll $t5, $v0, 3 -/* 0A8008 802E8808 A64D000E */ sh $t5, 0xe($s2) -/* 0A800C 802E880C 0C0B9DA0 */ jal m64_read_u8 -/* 0A8010 802E8810 02202025 */ move $a0, $s1 -/* 0A8014 802E8814 000248C0 */ sll $t1, $v0, 3 -/* 0A8018 802E8818 A6490012 */ sh $t1, 0x12($s2) -/* 0A801C 802E881C 0C0B9DA0 */ jal m64_read_u8 -/* 0A8020 802E8820 02202025 */ move $a0, $s1 -/* 0A8024 802E8824 00025100 */ sll $t2, $v0, 4 -/* 0A8028 802E8828 1000FECF */ b .L802E8368 -/* 0A802C 802E882C A64A0016 */ sh $t2, 0x16($s2) -glabel L802E8830 -/* 0A8030 802E8830 0C0B9DA0 */ jal m64_read_u8 -/* 0A8034 802E8834 02202025 */ move $a0, $s1 -/* 0A8038 802E8838 00025940 */ sll $t3, $v0, 5 -/* 0A803C 802E883C A64B000C */ sh $t3, 0xc($s2) -/* 0A8040 802E8840 0C0B9DA0 */ jal m64_read_u8 -/* 0A8044 802E8844 02202025 */ move $a0, $s1 -/* 0A8048 802E8848 00026140 */ sll $t4, $v0, 5 -/* 0A804C 802E884C A64C0010 */ sh $t4, 0x10($s2) -/* 0A8050 802E8850 0C0B9DA0 */ jal m64_read_u8 -/* 0A8054 802E8854 02202025 */ move $a0, $s1 -/* 0A8058 802E8858 00027100 */ sll $t6, $v0, 4 -/* 0A805C 802E885C 1000FEC2 */ b .L802E8368 -/* 0A8060 802E8860 A64E0014 */ sh $t6, 0x14($s2) -glabel L802E8864 -/* 0A8064 802E8864 0C0B9DA0 */ jal m64_read_u8 -/* 0A8068 802E8868 02202025 */ move $a0, $s1 -/* 0A806C 802E886C 00027900 */ sll $t7, $v0, 4 -/* 0A8070 802E8870 1000FEBD */ b .L802E8368 -/* 0A8074 802E8874 A64F0018 */ sh $t7, 0x18($s2) -glabel L802E8878 -/* 0A8078 802E8878 0C0B9DA0 */ jal m64_read_u8 -/* 0A807C 802E887C 02202025 */ move $a0, $s1 -/* 0A8080 802E8880 1000FEB9 */ b .L802E8368 -/* 0A8084 802E8884 A2420004 */ sb $v0, 4($s2) -glabel L802E8888 -/* 0A8088 802E8888 0C0B9DA0 */ jal m64_read_u8 -/* 0A808C 802E888C 02202025 */ move $a0, $s1 -/* 0A8090 802E8890 92980004 */ lbu $t8, 4($s4) -/* 0A8094 802E8894 3C038023 */ lui $v1, %hi(gAlBankSets) # $v1, 0x8023 -/* 0A8098 802E8898 8C6397D0 */ lw $v1, %lo(gAlBankSets)($v1) -/* 0A809C 802E889C 0018C840 */ sll $t9, $t8, 1 -/* 0A80A0 802E88A0 3C048022 */ lui $a0, %hi(gBankLoadedPool) # $a0, 0x8022 -/* 0A80A4 802E88A4 00796821 */ addu $t5, $v1, $t9 -/* 0A80A8 802E88A8 95A70000 */ lhu $a3, ($t5) -/* 0A80AC 802E88AC 24842840 */ addiu $a0, %lo(gBankLoadedPool) # addiu $a0, $a0, 0x2840 -/* 0A80B0 802E88B0 24050002 */ li $a1, 2 -/* 0A80B4 802E88B4 00E34821 */ addu $t1, $a3, $v1 -/* 0A80B8 802E88B8 91280000 */ lbu $t0, ($t1) -/* 0A80BC 802E88BC 00E85021 */ addu $t2, $a3, $t0 -/* 0A80C0 802E88C0 01425823 */ subu $t3, $t2, $v0 -/* 0A80C4 802E88C4 01636021 */ addu $t4, $t3, $v1 -/* 0A80C8 802E88C8 91900000 */ lbu $s0, ($t4) -/* 0A80CC 802E88CC 0C0B89CF */ jal get_bank_or_seq -/* 0A80D0 802E88D0 02003025 */ move $a2, $s0 -/* 0A80D4 802E88D4 1040FEA4 */ beqz $v0, .L802E8368 -/* 0A80D8 802E88D8 00000000 */ nop -/* 0A80DC 802E88DC 1000FEA2 */ b .L802E8368 -/* 0A80E0 802E88E0 A2500006 */ sb $s0, 6($s2) -glabel L802E88E4 -/* 0A80E4 802E88E4 326E00FF */ andi $t6, $s3, 0xff -/* 0A80E8 802E88E8 AFAE0034 */ sw $t6, 0x34($sp) -/* 0A80EC 802E88EC 0C0B9DA0 */ jal m64_read_u8 -/* 0A80F0 802E88F0 02202025 */ move $a0, $s1 -/* 0A80F4 802E88F4 305000FF */ andi $s0, $v0, 0xff -/* 0A80F8 802E88F8 0C0B9DA5 */ jal m64_read_s16 -/* 0A80FC 802E88FC 02202025 */ move $a0, $s1 -/* 0A8100 802E8900 8E8F0014 */ lw $t7, 0x14($s4) -/* 0A8104 802E8904 8FB90034 */ lw $t9, 0x34($sp) -/* 0A8108 802E8908 3058FFFF */ andi $t8, $v0, 0xffff -/* 0A810C 802E890C 01F81821 */ addu $v1, $t7, $t8 -/* 0A8110 802E8910 03306821 */ addu $t5, $t9, $s0 -/* 0A8114 802E8914 1000FE94 */ b .L802E8368 -/* 0A8118 802E8918 A06D0000 */ sb $t5, ($v1) -glabel L802E891C -/* 0A811C 802E891C 0C0B9DA0 */ jal m64_read_u8 -/* 0A8120 802E8920 02202025 */ move $a0, $s1 -/* 0A8124 802E8924 240100C8 */ li $at, 200 -/* 0A8128 802E8928 16010005 */ bne $s0, $at, .L80200740 -/* 0A812C 802E892C 02001825 */ move $v1, $s0 -/* 0A8130 802E8930 02629823 */ subu $s3, $s3, $v0 -/* 0A8134 802E8934 00135E00 */ sll $t3, $s3, 0x18 -/* 0A8138 802E8938 1000FE8B */ b .L802E8368 -/* 0A813C 802E893C 000B9E03 */ sra $s3, $t3, 0x18 -.L80200740: -/* 0A8140 802E8940 240100CC */ li $at, 204 -/* 0A8144 802E8944 14610005 */ bne $v1, $at, .L8020075C -/* 0A8148 802E8948 02629824 */ and $s3, $s3, $v0 -/* 0A814C 802E894C 00029E00 */ sll $s3, $v0, 0x18 -/* 0A8150 802E8950 00137603 */ sra $t6, $s3, 0x18 -/* 0A8154 802E8954 1000FE84 */ b .L802E8368 -/* 0A8158 802E8958 01C09825 */ move $s3, $t6 -.L8020075C: -/* 0A815C 802E895C 0013CE00 */ sll $t9, $s3, 0x18 -/* 0A8160 802E8960 1000FE81 */ b .L802E8368 -/* 0A8164 802E8964 00199E03 */ sra $s3, $t9, 0x18 -glabel L802E8968 -/* 0A8168 802E8968 0C0B9DA0 */ jal m64_read_u8 -/* 0A816C 802E896C 02202025 */ move $a0, $s1 -/* 0A8170 802E8970 1000FE7D */ b .L802E8368 -/* 0A8174 802E8974 A2420003 */ sb $v0, 3($s2) -glabel L802E8978 -/* 0A8178 802E8978 0C0B9DA5 */ jal m64_read_s16 -/* 0A817C 802E897C 02202025 */ move $a0, $s1 -/* 0A8180 802E8980 8E890014 */ lw $t1, 0x14($s4) -/* 0A8184 802E8984 304AFFFF */ andi $t2, $v0, 0xffff -/* 0A8188 802E8988 01535821 */ addu $t3, $t2, $s3 -/* 0A818C 802E898C 012B6021 */ addu $t4, $t1, $t3 -/* 0A8190 802E8990 1000FE75 */ b .L802E8368 -/* 0A8194 802E8994 81930000 */ lb $s3, ($t4) -glabel L802E8998 -/* 0A8198 802E8998 0C0B9DA0 */ jal m64_read_u8 -/* 0A819C 802E899C 02202025 */ move $a0, $s1 -/* 0A81A0 802E89A0 92590000 */ lbu $t9, ($s2) -/* 0A81A4 802E89A4 00027880 */ sll $t7, $v0, 2 -/* 0A81A8 802E89A8 31F80004 */ andi $t8, $t7, 4 -/* 0A81AC 802E89AC 332DFFFB */ andi $t5, $t9, 0xfffb -/* 0A81B0 802E89B0 030D5025 */ or $t2, $t8, $t5 -/* 0A81B4 802E89B4 1000FE6C */ b .L802E8368 -/* 0A81B8 802E89B8 A24A0000 */ sb $t2, ($s2) -glabel L802E89BC -/* 0A81BC 802E89BC 0C0B9DA0 */ jal m64_read_u8 -/* 0A81C0 802E89C0 02202025 */ move $a0, $s1 -/* 0A81C4 802E89C4 1000FE68 */ b .L802E8368 -/* 0A81C8 802E89C8 A2420002 */ sb $v0, 2($s2) -glabel L802E89CC -/* 0A81CC 802E89CC 0C0B9DA0 */ jal m64_read_u8 -/* 0A81D0 802E89D0 02202025 */ move $a0, $s1 -/* 0A81D4 802E89D4 1000FE64 */ b .L802E8368 -/* 0A81D8 802E89D8 A242007D */ sb $v0, 0x7d($s2) -glabel L802E89DC -/* 0A81DC 802E89DC 0C0B9DA0 */ jal m64_read_u8 -/* 0A81E0 802E89E0 02202025 */ move $a0, $s1 -/* 0A81E4 802E89E4 1000FE60 */ b .L802E8368 -/* 0A81E8 802E89E8 A2420007 */ sb $v0, 7($s2) -glabel L802E89EC -/* 0A81EC 802E89EC 2401FFFF */ li $at, -1 -/* 0A81F0 802E89F0 1261FE5D */ beq $s3, $at, .L802E8368 -/* 0A81F4 802E89F4 00000000 */ nop -/* 0A81F8 802E89F8 92240018 */ lbu $a0, 0x18($s1) -/* 0A81FC 802E89FC 8E2B0000 */ lw $t3, ($s1) -/* 0A8200 802E8A00 8E490034 */ lw $t1, 0x34($s2) -/* 0A8204 802E8A04 00046080 */ sll $t4, $a0, 2 -/* 0A8208 802E8A08 022C7021 */ addu $t6, $s1, $t4 -/* 0A820C 802E8A0C ADCB0004 */ sw $t3, 4($t6) -/* 0A8210 802E8A10 922F0018 */ lbu $t7, 0x18($s1) -/* 0A8214 802E8A14 00131040 */ sll $v0, $s3, 1 -/* 0A8218 802E8A18 01221821 */ addu $v1, $t1, $v0 -/* 0A821C 802E8A1C 25F90001 */ addiu $t9, $t7, 1 -/* 0A8220 802E8A20 A2390018 */ sb $t9, 0x18($s1) -/* 0A8224 802E8A24 906D0000 */ lbu $t5, ($v1) -/* 0A8228 802E8A28 90780001 */ lbu $t8, 1($v1) -/* 0A822C 802E8A2C 8E8C0014 */ lw $t4, 0x14($s4) -/* 0A8230 802E8A30 000D5200 */ sll $t2, $t5, 8 -/* 0A8234 802E8A34 030A3821 */ addu $a3, $t8, $t2 -/* 0A8238 802E8A38 30E9FFFF */ andi $t1, $a3, 0xffff -/* 0A823C 802E8A3C 01895821 */ addu $t3, $t4, $t1 -/* 0A8240 802E8A40 1000FE49 */ b .L802E8368 -/* 0A8244 802E8A44 AE2B0000 */ sw $t3, ($s1) -glabel L802E8A48 -/* 0A8248 802E8A48 0C0B9DA0 */ jal m64_read_u8 -/* 0A824C 802E8A4C 02202025 */ move $a0, $s1 -/* 0A8250 802E8A50 1000FE45 */ b .L802E8368 -/* 0A8254 802E8A54 A2420008 */ sb $v0, 8($s2) -glabel L802E8A58 -/* 0A8258 802E8A58 0C0B9DA5 */ jal m64_read_s16 -/* 0A825C 802E8A5C 02202025 */ move $a0, $s1 -/* 0A8260 802E8A60 8E8E0014 */ lw $t6, 0x14($s4) -/* 0A8264 802E8A64 304FFFFF */ andi $t7, $v0, 0xffff -/* 0A8268 802E8A68 01CF1821 */ addu $v1, $t6, $t7 -/* 0A826C 802E8A6C 90790000 */ lbu $t9, ($v1) -/* 0A8270 802E8A70 24630007 */ addiu $v1, $v1, 7 -/* 0A8274 802E8A74 A2590003 */ sb $t9, 3($s2) -/* 0A8278 802E8A78 906DFFFA */ lbu $t5, -6($v1) -/* 0A827C 802E8A7C 92590001 */ lbu $t9, 1($s2) -/* 0A8280 802E8A80 A24D0002 */ sb $t5, 2($s2) -/* 0A8284 802E8A84 9078FFFB */ lbu $t8, -5($v1) -/* 0A8288 802E8A88 372D0020 */ ori $t5, $t9, 0x20 -/* 0A828C 802E8A8C A2580005 */ sb $t8, 5($s2) -/* 0A8290 802E8A90 806AFFFC */ lb $t2, -4($v1) -/* 0A8294 802E8A94 A64A001E */ sh $t2, 0x1e($s2) -/* 0A8298 802E8A98 9069FFFD */ lbu $t1, -3($v1) -/* 0A829C 802E8A9C A2490009 */ sb $t1, 9($s2) -/* 0A82A0 802E8AA0 906CFFFE */ lbu $t4, -2($v1) -/* 0A82A4 802E8AA4 A24C000A */ sb $t4, 0xa($s2) -/* 0A82A8 802E8AA8 906BFFFF */ lbu $t3, -1($v1) -/* 0A82AC 802E8AAC A24B0004 */ sb $t3, 4($s2) -/* 0A82B0 802E8AB0 906E0000 */ lbu $t6, ($v1) -/* 0A82B4 802E8AB4 A24D0001 */ sb $t5, 1($s2) -/* 0A82B8 802E8AB8 1000FE2B */ b .L802E8368 -/* 0A82BC 802E8ABC A24E0007 */ sb $t6, 7($s2) -glabel L802E8AC0 -/* 0A82C0 802E8AC0 0C0B9DA0 */ jal m64_read_u8 -/* 0A82C4 802E8AC4 02202025 */ move $a0, $s1 -/* 0A82C8 802E8AC8 A2420003 */ sb $v0, 3($s2) -/* 0A82CC 802E8ACC 0C0B9DA0 */ jal m64_read_u8 -/* 0A82D0 802E8AD0 02202025 */ move $a0, $s1 -/* 0A82D4 802E8AD4 A2420002 */ sb $v0, 2($s2) -/* 0A82D8 802E8AD8 0C0B9DA0 */ jal m64_read_u8 -/* 0A82DC 802E8ADC 02202025 */ move $a0, $s1 -/* 0A82E0 802E8AE0 A2420005 */ sb $v0, 5($s2) -/* 0A82E4 802E8AE4 0C0B9DA0 */ jal m64_read_u8 -/* 0A82E8 802E8AE8 02202025 */ move $a0, $s1 -/* 0A82EC 802E8AEC 0002C600 */ sll $t8, $v0, 0x18 -/* 0A82F0 802E8AF0 00185603 */ sra $t2, $t8, 0x18 -/* 0A82F4 802E8AF4 A64A001E */ sh $t2, 0x1e($s2) -/* 0A82F8 802E8AF8 0C0B9DA0 */ jal m64_read_u8 -/* 0A82FC 802E8AFC 02202025 */ move $a0, $s1 -/* 0A8300 802E8B00 A2420009 */ sb $v0, 9($s2) -/* 0A8304 802E8B04 0C0B9DA0 */ jal m64_read_u8 -/* 0A8308 802E8B08 02202025 */ move $a0, $s1 -/* 0A830C 802E8B0C A242000A */ sb $v0, 0xa($s2) -/* 0A8310 802E8B10 0C0B9DA0 */ jal m64_read_u8 -/* 0A8314 802E8B14 02202025 */ move $a0, $s1 -/* 0A8318 802E8B18 A2420004 */ sb $v0, 4($s2) -/* 0A831C 802E8B1C 0C0B9DA0 */ jal m64_read_u8 -/* 0A8320 802E8B20 02202025 */ move $a0, $s1 -/* 0A8324 802E8B24 924C0001 */ lbu $t4, 1($s2) -/* 0A8328 802E8B28 A2420007 */ sb $v0, 7($s2) -/* 0A832C 802E8B2C 358B0020 */ ori $t3, $t4, 0x20 -/* 0A8330 802E8B30 1000FE0D */ b .L802E8368 -/* 0A8334 802E8B34 A24B0001 */ sb $t3, 1($s2) -glabel L802E8B38 -/* 0A8338 802E8B38 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 0A833C 802E8B3C 44815000 */ mtc1 $at, $f10 -/* 0A8340 802E8B40 A6400012 */ sh $zero, 0x12($s2) -/* 0A8344 802E8B44 A640000E */ sh $zero, 0xe($s2) -/* 0A8348 802E8B48 A6400016 */ sh $zero, 0x16($s2) -/* 0A834C 802E8B4C A6400010 */ sh $zero, 0x10($s2) -/* 0A8350 802E8B50 A640000C */ sh $zero, 0xc($s2) -/* 0A8354 802E8B54 A6400014 */ sh $zero, 0x14($s2) -/* 0A8358 802E8B58 1000FE03 */ b .L802E8368 -/* 0A835C 802E8B5C E64A0030 */ swc1 $f10, 0x30($s2) -glabel L802E8B60 -/* 0A8360 802E8B60 0C0B9DA0 */ jal m64_read_u8 -/* 0A8364 802E8B64 02202025 */ move $a0, $s1 -/* 0A8368 802E8B68 1000FDFF */ b .L802E8368 -/* 0A836C 802E8B6C A2420005 */ sb $v0, 5($s2) -.L80200970: -/* 0A8370 802E8B70 306E00F0 */ andi $t6, $v1, 0xf0 -/* 0A8374 802E8B74 3064000F */ andi $a0, $v1, 0xf -/* 0A8378 802E8B78 2DC100B1 */ sltiu $at, $t6, 0xb1 -/* 0A837C 802E8B7C 1020FDFA */ beqz $at, .L802E8368 -/* 0A8380 802E8B80 308800FF */ andi $t0, $a0, 0xff -/* 0A8384 802E8B84 000E7080 */ sll $t6, $t6, 2 -/* 0A8388 802E8B88 3C018030 */ lui $at, %hi(jtbl_EU_80306810) -/* 0A838C 802E8B8C 002E0821 */ addu $at, $at, $t6 -/* 0A8390 802E8B90 8C2E6810 */ lw $t6, %lo(jtbl_EU_80306810)($at) -/* 0A8394 802E8B94 01C00008 */ jr $t6 -/* 0A8398 802E8B98 00000000 */ nop -glabel L802E8B9C -/* 0A839C 802E8B9C 308F00FF */ andi $t7, $a0, 0xff -/* 0A83A0 802E8BA0 000FC880 */ sll $t9, $t7, 2 -/* 0A83A4 802E8BA4 02596821 */ addu $t5, $s2, $t9 -/* 0A83A8 802E8BA8 8DA30048 */ lw $v1, 0x48($t5) -/* 0A83AC 802E8BAC 10600007 */ beqz $v1, .L802009CC -/* 0A83B0 802E8BB0 00000000 */ nop -/* 0A83B4 802E8BB4 8C730000 */ lw $s3, ($v1) -/* 0A83B8 802E8BB8 0013C040 */ sll $t8, $s3, 1 -/* 0A83BC 802E8BBC 001857C2 */ srl $t2, $t8, 0x1f -/* 0A83C0 802E8BC0 000A4E00 */ sll $t1, $t2, 0x18 -/* 0A83C4 802E8BC4 1000FDE8 */ b .L802E8368 -/* 0A83C8 802E8BC8 00099E03 */ sra $s3, $t1, 0x18 -.L802009CC: -/* 0A83CC 802E8BCC 1000FDE6 */ b .L802E8368 -/* 0A83D0 802E8BD0 2413FFFF */ li $s3, -1 -glabel L802E8BD4 -/* 0A83D4 802E8BD4 308B00FF */ andi $t3, $a0, 0xff -/* 0A83D8 802E8BD8 024B7021 */ addu $t6, $s2, $t3 -/* 0A83DC 802E8BDC 1000FDE2 */ b .L802E8368 -/* 0A83E0 802E8BE0 A1D30058 */ sb $s3, 0x58($t6) -glabel L802E8BE4 -/* 0A83E4 802E8BE4 308300FF */ andi $v1, $a0, 0xff -/* 0A83E8 802E8BE8 02432821 */ addu $a1, $s2, $v1 -/* 0A83EC 802E8BEC 28610004 */ slti $at, $v1, 4 -/* 0A83F0 802E8BF0 1020FDDD */ beqz $at, .L802E8368 -/* 0A83F4 802E8BF4 80B30058 */ lb $s3, 0x58($a1) -/* 0A83F8 802E8BF8 240FFFFF */ li $t7, -1 -/* 0A83FC 802E8BFC 1000FDDA */ b .L802E8368 -/* 0A8400 802E8C00 A0AF0058 */ sb $t7, 0x58($a1) -glabel L802E8C04 -/* 0A8404 802E8C04 309900FF */ andi $t9, $a0, 0xff -/* 0A8408 802E8C08 02596821 */ addu $t5, $s2, $t9 -/* 0A840C 802E8C0C 81B80058 */ lb $t8, 0x58($t5) -/* 0A8410 802E8C10 02789823 */ subu $s3, $s3, $t8 -/* 0A8414 802E8C14 00135600 */ sll $t2, $s3, 0x18 -/* 0A8418 802E8C18 1000FDD3 */ b .L802E8368 -/* 0A841C 802E8C1C 000A9E03 */ sra $s3, $t2, 0x18 -glabel L802E8C20 -/* 0A8420 802E8C20 308C00FF */ andi $t4, $a0, 0xff -/* 0A8424 802E8C24 1000005C */ b .L802E8D98 -/* 0A8428 802E8C28 A64C001A */ sh $t4, 0x1a($s2) -glabel L802E8C2C -/* 0A842C 802E8C2C 0C0B9DA5 */ jal m64_read_s16 -/* 0A8430 802E8C30 02202025 */ move $a0, $s1 -/* 0A8434 802E8C34 02003025 */ move $a2, $s0 -/* 0A8438 802E8C38 30C5000F */ andi $a1, $a2, 0xf -/* 0A843C 802E8C3C 00A03025 */ move $a2, $a1 -/* 0A8440 802E8C40 AFA50034 */ sw $a1, 0x34($sp) -/* 0A8444 802E8C44 02402025 */ move $a0, $s2 -/* 0A8448 802E8C48 0C0B9BDC */ jal seq_channel_set_layer -/* 0A844C 802E8C4C A7A20052 */ sh $v0, 0x52($sp) -/* 0A8450 802E8C50 8FA60034 */ lw $a2, 0x34($sp) -/* 0A8454 802E8C54 1440FDC4 */ bnez $v0, .L802E8368 -/* 0A8458 802E8C58 97A70052 */ lhu $a3, 0x52($sp) -/* 0A845C 802E8C5C 8E8E0014 */ lw $t6, 0x14($s4) -/* 0A8460 802E8C60 0006C880 */ sll $t9, $a2, 2 -/* 0A8464 802E8C64 02596821 */ addu $t5, $s2, $t9 -/* 0A8468 802E8C68 8DB80048 */ lw $t8, 0x48($t5) -/* 0A846C 802E8C6C 01C77821 */ addu $t7, $t6, $a3 -/* 0A8470 802E8C70 1000FDBD */ b .L802E8368 -/* 0A8474 802E8C74 AF0F0050 */ sw $t7, 0x50($t8) -glabel L802E8C78 -/* 0A8478 802E8C78 02002825 */ move $a1, $s0 -/* 0A847C 802E8C7C 30AA000F */ andi $t2, $a1, 0xf -/* 0A8480 802E8C80 01402825 */ move $a1, $t2 -/* 0A8484 802E8C84 0C0B9C2D */ jal seq_channel_layer_free -/* 0A8488 802E8C88 02402025 */ move $a0, $s2 -/* 0A848C 802E8C8C 1000FDB6 */ b .L802E8368 -/* 0A8490 802E8C90 00000000 */ nop -glabel L802E8C94 -/* 0A8494 802E8C94 2401FFFF */ li $at, -1 -/* 0A8498 802E8C98 1261FDB3 */ beq $s3, $at, .L802E8368 -/* 0A849C 802E8C9C 02402025 */ move $a0, $s2 -/* 0A84A0 802E8CA0 02003025 */ move $a2, $s0 -/* 0A84A4 802E8CA4 30C5000F */ andi $a1, $a2, 0xf -/* 0A84A8 802E8CA8 00A03025 */ move $a2, $a1 -/* 0A84AC 802E8CAC 0C0B9BDC */ jal seq_channel_set_layer -/* 0A84B0 802E8CB0 AFA50034 */ sw $a1, 0x34($sp) -/* 0A84B4 802E8CB4 2401FFFF */ li $at, -1 -/* 0A84B8 802E8CB8 1041FDAB */ beq $v0, $at, .L802E8368 -/* 0A84BC 802E8CBC 8FA60034 */ lw $a2, 0x34($sp) -/* 0A84C0 802E8CC0 8E4C0034 */ lw $t4, 0x34($s2) -/* 0A84C4 802E8CC4 00135840 */ sll $t3, $s3, 1 -/* 0A84C8 802E8CC8 8E980014 */ lw $t8, 0x14($s4) -/* 0A84CC 802E8CCC 018B1821 */ addu $v1, $t4, $t3 -/* 0A84D0 802E8CD0 90790000 */ lbu $t9, ($v1) -/* 0A84D4 802E8CD4 906E0001 */ lbu $t6, 1($v1) -/* 0A84D8 802E8CD8 00064880 */ sll $t1, $a2, 2 -/* 0A84DC 802E8CDC 00196A00 */ sll $t5, $t9, 8 -/* 0A84E0 802E8CE0 02496021 */ addu $t4, $s2, $t1 -/* 0A84E4 802E8CE4 01CD3821 */ addu $a3, $t6, $t5 -/* 0A84E8 802E8CE8 8D8B0048 */ lw $t3, 0x48($t4) -/* 0A84EC 802E8CEC 30EFFFFF */ andi $t7, $a3, 0xffff -/* 0A84F0 802E8CF0 030F5021 */ addu $t2, $t8, $t7 -/* 0A84F4 802E8CF4 1000FD9C */ b .L802E8368 -/* 0A84F8 802E8CF8 AD6A0050 */ sw $t2, 0x50($t3) -glabel L802E8CFC -/* 0A84FC 802E8CFC 0C0B9DA5 */ jal m64_read_s16 -/* 0A8500 802E8D00 02202025 */ move $a0, $s1 -/* 0A8504 802E8D04 8E8E0014 */ lw $t6, 0x14($s4) -/* 0A8508 802E8D08 02002825 */ move $a1, $s0 -/* 0A850C 802E8D0C 30B9000F */ andi $t9, $a1, 0xf -/* 0A8510 802E8D10 304DFFFF */ andi $t5, $v0, 0xffff -/* 0A8514 802E8D14 03202825 */ move $a1, $t9 -/* 0A8518 802E8D18 02802025 */ move $a0, $s4 -/* 0A851C 802E8D1C 0C0B9CFA */ jal sequence_channel_enable -/* 0A8520 802E8D20 01CD3021 */ addu $a2, $t6, $t5 -/* 0A8524 802E8D24 1000FD90 */ b .L802E8368 -/* 0A8528 802E8D28 00000000 */ nop -glabel L802E8D2C -/* 0A852C 802E8D2C 3218000F */ andi $t8, $s0, 0xf -/* 0A8530 802E8D30 00184880 */ sll $t1, $t8, 2 -/* 0A8534 802E8D34 02896021 */ addu $t4, $s4, $t1 -/* 0A8538 802E8D38 0C0B9C41 */ jal sequence_channel_disable -/* 0A853C 802E8D3C 8D840030 */ lw $a0, 0x30($t4) -/* 0A8540 802E8D40 1000FD89 */ b .L802E8368 -/* 0A8544 802E8D44 00000000 */ nop -glabel L802E8D48 -/* 0A8548 802E8D48 02202025 */ move $a0, $s1 -/* 0A854C 802E8D4C 0C0B9DA0 */ jal m64_read_u8 -/* 0A8550 802E8D50 A3A80055 */ sb $t0, 0x55($sp) -/* 0A8554 802E8D54 93A80055 */ lbu $t0, 0x55($sp) -/* 0A8558 802E8D58 00085080 */ sll $t2, $t0, 2 -/* 0A855C 802E8D5C 028A5821 */ addu $t3, $s4, $t2 -/* 0A8560 802E8D60 8D790030 */ lw $t9, 0x30($t3) -/* 0A8564 802E8D64 03227021 */ addu $t6, $t9, $v0 -/* 0A8568 802E8D68 1000FD7F */ b .L802E8368 -/* 0A856C 802E8D6C A1D30058 */ sb $s3, 0x58($t6) -glabel L802E8D70 -/* 0A8570 802E8D70 02202025 */ move $a0, $s1 -/* 0A8574 802E8D74 0C0B9DA0 */ jal m64_read_u8 -/* 0A8578 802E8D78 A3A80055 */ sb $t0, 0x55($sp) -/* 0A857C 802E8D7C 93A80055 */ lbu $t0, 0x55($sp) -/* 0A8580 802E8D80 00086880 */ sll $t5, $t0, 2 -/* 0A8584 802E8D84 028D7821 */ addu $t7, $s4, $t5 -/* 0A8588 802E8D88 8DF80030 */ lw $t8, 0x30($t7) -/* 0A858C 802E8D8C 03024821 */ addu $t1, $t8, $v0 -/* 0A8590 802E8D90 1000FD75 */ b .L802E8368 -/* 0A8594 802E8D94 81330058 */ lb $s3, 0x58($t1) -glabel L802E8D98 -.L802E8D98: -/* 0A8598 802E8D98 02408825 */ move $s1, $s2 -.L80200B9C: -/* 0A859C 802E8D9C 24120010 */ li $s2, 16 -/* 0A85A0 802E8DA0 00008025 */ move $s0, $zero -.L80200BA4: -/* 0A85A4 802E8DA4 8E240048 */ lw $a0, 0x48($s1) -/* 0A85A8 802E8DA8 50800004 */ beql $a0, $zero, .L80200BBC -/* 0A85AC 802E8DAC 26100004 */ addiu $s0, $s0, 4 -/* 0A85B0 802E8DB0 0C0B9DC2 */ jal seq_channel_layer_process_script -/* 0A85B4 802E8DB4 00000000 */ nop -/* 0A85B8 802E8DB8 26100004 */ addiu $s0, $s0, 4 -.L80200BBC: -/* 0A85BC 802E8DBC 1612FFF9 */ bne $s0, $s2, .L80200BA4 -/* 0A85C0 802E8DC0 26310004 */ addiu $s1, $s1, 4 -.L80200BC4: -/* 0A85C4 802E8DC4 8FBF002C */ lw $ra, 0x2c($sp) -.L80200BC8: -/* 0A85C8 802E8DC8 8FB00018 */ lw $s0, 0x18($sp) -/* 0A85CC 802E8DCC 8FB1001C */ lw $s1, 0x1c($sp) -/* 0A85D0 802E8DD0 8FB20020 */ lw $s2, 0x20($sp) -/* 0A85D4 802E8DD4 8FB30024 */ lw $s3, 0x24($sp) -/* 0A85D8 802E8DD8 8FB40028 */ lw $s4, 0x28($sp) -/* 0A85DC 802E8DDC 03E00008 */ jr $ra -/* 0A85E0 802E8DE0 27BD0060 */ addiu $sp, $sp, 0x60 diff --git a/asm/non_matchings/process_level_music_dynamics.s b/asm/non_matchings/process_level_music_dynamics.s deleted file mode 100644 index 7defac85..00000000 --- a/asm/non_matchings/process_level_music_dynamics.s +++ /dev/null @@ -1,327 +0,0 @@ -.late_rodata -glabel jtbl_80338418 - .word L8031FBAC - .word L8031FBEC - .word L8031FC2C - .word L8031FC6C - .word L8031FCAC - .word L8031FCEC - .word L8031FD2C - .word L8031FD54 - -.text -glabel process_level_music_dynamics # US: 803208EC -/* 0DAA4C 8031FA4C 27BDFFA0 */ addiu $sp, $sp, -0x60 -/* 0DAA50 8031FA50 AFBF0024 */ sw $ra, 0x24($sp) -/* 0DAA54 8031FA54 AFB20020 */ sw $s2, 0x20($sp) -/* 0DAA58 8031FA58 AFB1001C */ sw $s1, 0x1c($sp) -/* 0DAA5C 8031FA5C AFB00018 */ sw $s0, 0x18($sp) -/* 0DAA60 8031FA60 0C0C7E5B */ jal func_8031F96C -/* 0DAA64 8031FA64 00002025 */ move $a0, $zero -/* 0DAA68 8031FA68 0C0C7E5B */ jal func_8031F96C -/* 0DAA6C 8031FA6C 24040002 */ li $a0, 2 -/* 0DAA70 8031FA70 0C0C83B6 */ jal func_80320ED8 -/* 0DAA74 8031FA74 00000000 */ nop -/* 0DAA78 8031FA78 3C038033 */ lui $v1, %hi(sMusicDynamicDelay) # $v1, 0x8033 -/* 0DAA7C 8031FA7C 246320A0 */ addiu $v1, %lo(sMusicDynamicDelay) # addiu $v1, $v1, 0x20a0 -/* 0DAA80 8031FA80 90620000 */ lbu $v0, ($v1) -/* 0DAA84 8031FA84 10400003 */ beqz $v0, .L8031FA94 -/* 0DAA88 8031FA88 244EFFFF */ addiu $t6, $v0, -1 -/* 0DAA8C 8031FA8C 10000005 */ b .L8031FAA4 -/* 0DAA90 8031FA90 A06E0000 */ sb $t6, ($v1) -.L8031FA94: -/* 0DAA94 8031FA94 3C0F8033 */ lui $t7, %hi(sPlayer0CurSeqId) # $t7, 0x8033 -/* 0DAA98 8031FA98 91EF209C */ lbu $t7, %lo(sPlayer0CurSeqId)($t7) -/* 0DAA9C 8031FA9C 3C018033 */ lui $at, %hi(sBackgroundMusicForDynamics) # $at, 0x8033 -/* 0DAAA0 8031FAA0 A02F1EB0 */ sb $t7, %lo(sBackgroundMusicForDynamics)($at) -.L8031FAA4: -/* 0DAAA4 8031FAA4 3C188033 */ lui $t8, %hi(gCurrLevelNum) # $t8, 0x8033 -/* 0DAAA8 8031FAA8 8718CE98 */ lh $t8, %lo(gCurrLevelNum)($t8) -/* 0DAAAC 8031FAAC 3C098033 */ lui $t1, %hi(sLevelDynamics) -/* 0DAAB0 8031FAB0 3C0C8033 */ lui $t4, %hi(sBackgroundMusicForDynamics) # $t4, 0x8033 -/* 0DAAB4 8031FAB4 0018C880 */ sll $t9, $t8, 2 -/* 0DAAB8 8031FAB8 01394821 */ addu $t1, $t1, $t9 -/* 0DAABC 8031FABC 8D291EB4 */ lw $t1, %lo(sLevelDynamics)($t1) -/* 0DAAC0 8031FAC0 918C1EB0 */ lbu $t4, %lo(sBackgroundMusicForDynamics)($t4) -/* 0DAAC4 8031FAC4 852D0000 */ lh $t5, ($t1) -/* 0DAAC8 8031FAC8 558D00FC */ bnel $t4, $t5, .L8031FEBC -/* 0DAACC 8031FACC 8FBF0024 */ lw $ra, 0x24($sp) -/* 0DAAD0 8031FAD0 852F0002 */ lh $t7, 2($t1) -/* 0DAAD4 8031FAD4 24110002 */ li $s1, 2 -/* 0DAAD8 8031FAD8 3C0B8034 */ lui $t3, %hi(gCurrAreaIndex) # $t3, 0x8034 -/* 0DAADC 8031FADC 31F0FF00 */ andi $s0, $t7, 0xff00 -/* 0DAAE0 8031FAE0 3218FF00 */ andi $t8, $s0, 0xff00 -/* 0DAAE4 8031FAE4 130000B9 */ beqz $t8, .L8031FDCC -/* 0DAAE8 8031FAE8 A3AF0057 */ sb $t7, 0x57($sp) -/* 0DAAEC 8031FAEC 3C0A8036 */ lui $t2, %hi(gMarioCurrentRoom) # $t2, 0x8036 -/* 0DAAF0 8031FAF0 3C078034 */ lui $a3, %hi(gMarioStates) # $a3, 0x8034 -/* 0DAAF4 8031FAF4 24E79E00 */ addiu $a3, %lo(gMarioStates) # addiu $a3, $a3, -0x6200 -/* 0DAAF8 8031FAF8 254AFEE0 */ addiu $t2, %lo(gMarioCurrentRoom) # addiu $t2, $t2, -0x120 -/* 0DAAFC 8031FAFC 256BA75A */ addiu $t3, %lo(gCurrAreaIndex) # addiu $t3, $t3, -0x58a6 -/* 0DAB00 8031FB00 27A8003C */ addiu $t0, $sp, 0x3c -/* 0DAB04 8031FB04 27A60044 */ addiu $a2, $sp, 0x44 -.L8031FB08: -/* 0DAB08 8031FB08 00001025 */ move $v0, $zero -/* 0DAB0C 8031FB0C 00002025 */ move $a0, $zero -/* 0DAB10 8031FB10 34058000 */ li $a1, 32768 -.L8031FB14: -/* 0DAB14 8031FB14 00B0C824 */ and $t9, $a1, $s0 -/* 0DAB18 8031FB18 1320000F */ beqz $t9, .L8031FB58 -/* 0DAB1C 8031FB1C 00A01825 */ move $v1, $a1 -/* 0DAB20 8031FB20 00116040 */ sll $t4, $s1, 1 -/* 0DAB24 8031FB24 012C6821 */ addu $t5, $t1, $t4 -/* 0DAB28 8031FB28 85AE0000 */ lh $t6, ($t5) -/* 0DAB2C 8031FB2C 00047840 */ sll $t7, $a0, 1 -/* 0DAB30 8031FB30 01046021 */ addu $t4, $t0, $a0 -/* 0DAB34 8031FB34 00CFC021 */ addu $t8, $a2, $t7 -/* 0DAB38 8031FB38 26310001 */ addiu $s1, $s1, 1 -/* 0DAB3C 8031FB3C 24840001 */ addiu $a0, $a0, 1 -/* 0DAB40 8031FB40 323900FF */ andi $t9, $s1, 0xff -/* 0DAB44 8031FB44 308D00FF */ andi $t5, $a0, 0xff -/* 0DAB48 8031FB48 A70E0000 */ sh $t6, ($t8) -/* 0DAB4C 8031FB4C 03208825 */ move $s1, $t9 -/* 0DAB50 8031FB50 A1820000 */ sb $v0, ($t4) -/* 0DAB54 8031FB54 01A02025 */ move $a0, $t5 -.L8031FB58: -/* 0DAB58 8031FB58 24420001 */ addiu $v0, $v0, 1 -/* 0DAB5C 8031FB5C 304F00FF */ andi $t7, $v0, 0xff -/* 0DAB60 8031FB60 00032843 */ sra $a1, $v1, 1 -/* 0DAB64 8031FB64 30AEFFFF */ andi $t6, $a1, 0xffff -/* 0DAB68 8031FB68 29E10008 */ slti $at, $t7, 8 -/* 0DAB6C 8031FB6C 01E01025 */ move $v0, $t7 -/* 0DAB70 8031FB70 1420FFE8 */ bnez $at, .L8031FB14 -/* 0DAB74 8031FB74 01C02825 */ move $a1, $t6 -/* 0DAB78 8031FB78 00001025 */ move $v0, $zero -/* 0DAB7C 8031FB7C 18800083 */ blez $a0, .L8031FD8C -/* 0DAB80 8031FB80 00801825 */ move $v1, $a0 -.L8031FB84: -/* 0DAB84 8031FB84 0102C021 */ addu $t8, $t0, $v0 -/* 0DAB88 8031FB88 93190000 */ lbu $t9, ($t8) -/* 0DAB8C 8031FB8C 2F210008 */ sltiu $at, $t9, 8 -/* 0DAB90 8031FB90 10200079 */ beqz $at, .L8031FD78 -/* 0DAB94 8031FB94 0019C880 */ sll $t9, $t9, 2 -/* 0DAB98 8031FB98 3C018034 */ lui $at, %hi(jtbl_80338418) -/* 0DAB9C 8031FB9C 00390821 */ addu $at, $at, $t9 -/* 0DABA0 8031FBA0 8C398418 */ lw $t9, %lo(jtbl_80338418)($at) -/* 0DABA4 8031FBA4 03200008 */ jr $t9 -/* 0DABA8 8031FBA8 00000000 */ nop -glabel L8031FBAC -/* 0DABAC 8031FBAC C4E4003C */ lwc1 $f4, 0x3c($a3) -/* 0DABB0 8031FBB0 0002C040 */ sll $t8, $v0, 1 -/* 0DABB4 8031FBB4 00D8C821 */ addu $t9, $a2, $t8 -/* 0DABB8 8031FBB8 4600218D */ trunc.w.s $f6, $f4 -/* 0DABBC 8031FBBC 872C0000 */ lh $t4, ($t9) -/* 0DABC0 8031FBC0 440D3000 */ mfc1 $t5, $f6 -/* 0DABC4 8031FBC4 00000000 */ nop -/* 0DABC8 8031FBC8 000D7C00 */ sll $t7, $t5, 0x10 -/* 0DABCC 8031FBCC 000F7403 */ sra $t6, $t7, 0x10 -/* 0DABD0 8031FBD0 01CC082A */ slt $at, $t6, $t4 -/* 0DABD4 8031FBD4 50200069 */ beql $at, $zero, .L8031FD7C -/* 0DABD8 8031FBD8 24420001 */ addiu $v0, $v0, 1 -/* 0DABDC 8031FBDC 24620001 */ addiu $v0, $v1, 1 -/* 0DABE0 8031FBE0 304D00FF */ andi $t5, $v0, 0xff -/* 0DABE4 8031FBE4 10000064 */ b .L8031FD78 -/* 0DABE8 8031FBE8 01A01025 */ move $v0, $t5 -glabel L8031FBEC -/* 0DABEC 8031FBEC C4E80040 */ lwc1 $f8, 0x40($a3) -/* 0DABF0 8031FBF0 00026040 */ sll $t4, $v0, 1 -/* 0DABF4 8031FBF4 00CC6821 */ addu $t5, $a2, $t4 -/* 0DABF8 8031FBF8 4600428D */ trunc.w.s $f10, $f8 -/* 0DABFC 8031FBFC 85AF0000 */ lh $t7, ($t5) -/* 0DAC00 8031FC00 44185000 */ mfc1 $t8, $f10 -/* 0DAC04 8031FC04 00000000 */ nop -/* 0DAC08 8031FC08 0018CC00 */ sll $t9, $t8, 0x10 -/* 0DAC0C 8031FC0C 00197403 */ sra $t6, $t9, 0x10 -/* 0DAC10 8031FC10 01CF082A */ slt $at, $t6, $t7 -/* 0DAC14 8031FC14 50200059 */ beql $at, $zero, .L8031FD7C -/* 0DAC18 8031FC18 24420001 */ addiu $v0, $v0, 1 -/* 0DAC1C 8031FC1C 24620001 */ addiu $v0, $v1, 1 -/* 0DAC20 8031FC20 305800FF */ andi $t8, $v0, 0xff -/* 0DAC24 8031FC24 10000054 */ b .L8031FD78 -/* 0DAC28 8031FC28 03001025 */ move $v0, $t8 -glabel L8031FC2C -/* 0DAC2C 8031FC2C C4F00044 */ lwc1 $f16, 0x44($a3) -/* 0DAC30 8031FC30 00027840 */ sll $t7, $v0, 1 -/* 0DAC34 8031FC34 00CFC021 */ addu $t8, $a2, $t7 -/* 0DAC38 8031FC38 4600848D */ trunc.w.s $f18, $f16 -/* 0DAC3C 8031FC3C 87190000 */ lh $t9, ($t8) -/* 0DAC40 8031FC40 440C9000 */ mfc1 $t4, $f18 -/* 0DAC44 8031FC44 00000000 */ nop -/* 0DAC48 8031FC48 000C6C00 */ sll $t5, $t4, 0x10 -/* 0DAC4C 8031FC4C 000D7403 */ sra $t6, $t5, 0x10 -/* 0DAC50 8031FC50 01D9082A */ slt $at, $t6, $t9 -/* 0DAC54 8031FC54 50200049 */ beql $at, $zero, .L8031FD7C -/* 0DAC58 8031FC58 24420001 */ addiu $v0, $v0, 1 -/* 0DAC5C 8031FC5C 24620001 */ addiu $v0, $v1, 1 -/* 0DAC60 8031FC60 304C00FF */ andi $t4, $v0, 0xff -/* 0DAC64 8031FC64 10000044 */ b .L8031FD78 -/* 0DAC68 8031FC68 01801025 */ move $v0, $t4 -glabel L8031FC6C -/* 0DAC6C 8031FC6C C4E4003C */ lwc1 $f4, 0x3c($a3) -/* 0DAC70 8031FC70 0002C840 */ sll $t9, $v0, 1 -/* 0DAC74 8031FC74 00D96021 */ addu $t4, $a2, $t9 -/* 0DAC78 8031FC78 4600218D */ trunc.w.s $f6, $f4 -/* 0DAC7C 8031FC7C 858D0000 */ lh $t5, ($t4) -/* 0DAC80 8031FC80 440F3000 */ mfc1 $t7, $f6 -/* 0DAC84 8031FC84 00000000 */ nop -/* 0DAC88 8031FC88 000FC400 */ sll $t8, $t7, 0x10 -/* 0DAC8C 8031FC8C 00187403 */ sra $t6, $t8, 0x10 -/* 0DAC90 8031FC90 01CD082A */ slt $at, $t6, $t5 -/* 0DAC94 8031FC94 54200039 */ bnezl $at, .L8031FD7C -/* 0DAC98 8031FC98 24420001 */ addiu $v0, $v0, 1 -/* 0DAC9C 8031FC9C 24620001 */ addiu $v0, $v1, 1 -/* 0DACA0 8031FCA0 304F00FF */ andi $t7, $v0, 0xff -/* 0DACA4 8031FCA4 10000034 */ b .L8031FD78 -/* 0DACA8 8031FCA8 01E01025 */ move $v0, $t7 -glabel L8031FCAC -/* 0DACAC 8031FCAC C4E80040 */ lwc1 $f8, 0x40($a3) -/* 0DACB0 8031FCB0 00026840 */ sll $t5, $v0, 1 -/* 0DACB4 8031FCB4 00CD7821 */ addu $t7, $a2, $t5 -/* 0DACB8 8031FCB8 4600428D */ trunc.w.s $f10, $f8 -/* 0DACBC 8031FCBC 85F80000 */ lh $t8, ($t7) -/* 0DACC0 8031FCC0 44195000 */ mfc1 $t9, $f10 -/* 0DACC4 8031FCC4 00000000 */ nop -/* 0DACC8 8031FCC8 00196400 */ sll $t4, $t9, 0x10 -/* 0DACCC 8031FCCC 000C7403 */ sra $t6, $t4, 0x10 -/* 0DACD0 8031FCD0 01D8082A */ slt $at, $t6, $t8 -/* 0DACD4 8031FCD4 54200029 */ bnezl $at, .L8031FD7C -/* 0DACD8 8031FCD8 24420001 */ addiu $v0, $v0, 1 -/* 0DACDC 8031FCDC 24620001 */ addiu $v0, $v1, 1 -/* 0DACE0 8031FCE0 305900FF */ andi $t9, $v0, 0xff -/* 0DACE4 8031FCE4 10000024 */ b .L8031FD78 -/* 0DACE8 8031FCE8 03201025 */ move $v0, $t9 -glabel L8031FCEC -/* 0DACEC 8031FCEC C4F00044 */ lwc1 $f16, 0x44($a3) -/* 0DACF0 8031FCF0 0002C040 */ sll $t8, $v0, 1 -/* 0DACF4 8031FCF4 00D8C821 */ addu $t9, $a2, $t8 -/* 0DACF8 8031FCF8 4600848D */ trunc.w.s $f18, $f16 -/* 0DACFC 8031FCFC 872C0000 */ lh $t4, ($t9) -/* 0DAD00 8031FD00 440D9000 */ mfc1 $t5, $f18 -/* 0DAD04 8031FD04 00000000 */ nop -/* 0DAD08 8031FD08 000D7C00 */ sll $t7, $t5, 0x10 -/* 0DAD0C 8031FD0C 000F7403 */ sra $t6, $t7, 0x10 -/* 0DAD10 8031FD10 01CC082A */ slt $at, $t6, $t4 -/* 0DAD14 8031FD14 54200019 */ bnezl $at, .L8031FD7C -/* 0DAD18 8031FD18 24420001 */ addiu $v0, $v0, 1 -/* 0DAD1C 8031FD1C 24620001 */ addiu $v0, $v1, 1 -/* 0DAD20 8031FD20 304D00FF */ andi $t5, $v0, 0xff -/* 0DAD24 8031FD24 10000014 */ b .L8031FD78 -/* 0DAD28 8031FD28 01A01025 */ move $v0, $t5 -glabel L8031FD2C -/* 0DAD2C 8031FD2C 0002C040 */ sll $t8, $v0, 1 -/* 0DAD30 8031FD30 00D8C821 */ addu $t9, $a2, $t8 -/* 0DAD34 8031FD34 872E0000 */ lh $t6, ($t9) -/* 0DAD38 8031FD38 856F0000 */ lh $t7, ($t3) -/* 0DAD3C 8031FD3C 51EE000F */ beql $t7, $t6, .L8031FD7C -/* 0DAD40 8031FD40 24420001 */ addiu $v0, $v0, 1 -/* 0DAD44 8031FD44 24620001 */ addiu $v0, $v1, 1 -/* 0DAD48 8031FD48 304C00FF */ andi $t4, $v0, 0xff -/* 0DAD4C 8031FD4C 1000000A */ b .L8031FD78 -/* 0DAD50 8031FD50 01801025 */ move $v0, $t4 -glabel L8031FD54 -/* 0DAD54 8031FD54 0002C040 */ sll $t8, $v0, 1 -/* 0DAD58 8031FD58 00D8C821 */ addu $t9, $a2, $t8 -/* 0DAD5C 8031FD5C 872F0000 */ lh $t7, ($t9) -/* 0DAD60 8031FD60 854D0000 */ lh $t5, ($t2) -/* 0DAD64 8031FD64 51AF0005 */ beql $t5, $t7, .L8031FD7C -/* 0DAD68 8031FD68 24420001 */ addiu $v0, $v0, 1 -/* 0DAD6C 8031FD6C 24620001 */ addiu $v0, $v1, 1 -/* 0DAD70 8031FD70 304E00FF */ andi $t6, $v0, 0xff -/* 0DAD74 8031FD74 01C01025 */ move $v0, $t6 -.L8031FD78: -/* 0DAD78 8031FD78 24420001 */ addiu $v0, $v0, 1 -.L8031FD7C: -/* 0DAD7C 8031FD7C 304C00FF */ andi $t4, $v0, 0xff -/* 0DAD80 8031FD80 0183082A */ slt $at, $t4, $v1 -/* 0DAD84 8031FD84 1420FF7F */ bnez $at, .L8031FB84 -/* 0DAD88 8031FD88 01801025 */ move $v0, $t4 -.L8031FD8C: -/* 0DAD8C 8031FD8C 14620003 */ bne $v1, $v0, .L8031FD9C -/* 0DAD90 8031FD90 0011C040 */ sll $t8, $s1, 1 -/* 0DAD94 8031FD94 1000000A */ b .L8031FDC0 -/* 0DAD98 8031FD98 00001825 */ move $v1, $zero -.L8031FD9C: -/* 0DAD9C 8031FD9C 0138C821 */ addu $t9, $t1, $t8 -/* 0DADA0 8031FDA0 872F0000 */ lh $t7, ($t9) -/* 0DADA4 8031FDA4 26310001 */ addiu $s1, $s1, 1 -/* 0DADA8 8031FDA8 322E00FF */ andi $t6, $s1, 0xff -/* 0DADAC 8031FDAC 01E01825 */ move $v1, $t7 -/* 0DADB0 8031FDB0 306DFF00 */ andi $t5, $v1, 0xff00 -/* 0DADB4 8031FDB4 01A01825 */ move $v1, $t5 -/* 0DADB8 8031FDB8 01C08825 */ move $s1, $t6 -/* 0DADBC 8031FDBC A3AF0057 */ sb $t7, 0x57($sp) -.L8031FDC0: -/* 0DADC0 8031FDC0 306CFF00 */ andi $t4, $v1, 0xff00 -/* 0DADC4 8031FDC4 1580FF50 */ bnez $t4, .L8031FB08 -/* 0DADC8 8031FDC8 00608025 */ move $s0, $v1 -.L8031FDCC: -/* 0DADCC 8031FDCC 3C028033 */ lui $v0, %hi(sCurrentMusicDynamic) # $v0, 0x8033 -/* 0DADD0 8031FDD0 90421EAC */ lbu $v0, %lo(sCurrentMusicDynamic)($v0) -/* 0DADD4 8031FDD4 93B80057 */ lbu $t8, 0x57($sp) -/* 0DADD8 8031FDD8 240100FF */ li $at, 255 -/* 0DADDC 8031FDDC 00008825 */ move $s1, $zero -/* 0DADE0 8031FDE0 53020036 */ beql $t8, $v0, .L8031FEBC -/* 0DADE4 8031FDE4 8FBF0024 */ lw $ra, 0x24($sp) -/* 0DADE8 8031FDE8 1441000C */ bne $v0, $at, .L8031FE1C -/* 0DADEC 8031FDEC 24030001 */ li $v1, 1 -/* 0DADF0 8031FDF0 00187880 */ sll $t7, $t8, 2 -/* 0DADF4 8031FDF4 01F87823 */ subu $t7, $t7, $t8 -/* 0DADF8 8031FDF8 3C0E8033 */ lui $t6, %hi(sMusicDynamics) # $t6, 0x8033 -/* 0DADFC 8031FDFC 24190001 */ li $t9, 1 -/* 0DAE00 8031FE00 25CE1F50 */ addiu $t6, %lo(sMusicDynamics) # addiu $t6, $t6, 0x1f50 -/* 0DAE04 8031FE04 000F7880 */ sll $t7, $t7, 2 -/* 0DAE08 8031FE08 240D0001 */ li $t5, 1 -/* 0DAE0C 8031FE0C A7B9003A */ sh $t9, 0x3a($sp) -/* 0DAE10 8031FE10 A7AD0038 */ sh $t5, 0x38($sp) -/* 0DAE14 8031FE14 1000000C */ b .L8031FE48 -/* 0DAE18 8031FE18 01EE9021 */ addu $s2, $t7, $t6 -.L8031FE1C: -/* 0DAE1C 8031FE1C 93AC0057 */ lbu $t4, 0x57($sp) -/* 0DAE20 8031FE20 3C0D8033 */ lui $t5, %hi(sMusicDynamics) # $t5, 0x8033 -/* 0DAE24 8031FE24 25AD1F50 */ addiu $t5, %lo(sMusicDynamics) # addiu $t5, $t5, 0x1f50 -/* 0DAE28 8031FE28 000CC880 */ sll $t9, $t4, 2 -/* 0DAE2C 8031FE2C 032CC823 */ subu $t9, $t9, $t4 -/* 0DAE30 8031FE30 0019C880 */ sll $t9, $t9, 2 -/* 0DAE34 8031FE34 032D9021 */ addu $s2, $t9, $t5 -/* 0DAE38 8031FE38 86580004 */ lh $t8, 4($s2) -/* 0DAE3C 8031FE3C 864F000A */ lh $t7, 0xa($s2) -/* 0DAE40 8031FE40 A7B8003A */ sh $t8, 0x3a($sp) -/* 0DAE44 8031FE44 A7AF0038 */ sh $t7, 0x38($sp) -.L8031FE48: -/* 0DAE48 8031FE48 864E0000 */ lh $t6, ($s2) -/* 0DAE4C 8031FE4C 00608025 */ move $s0, $v1 -/* 0DAE50 8031FE50 00002025 */ move $a0, $zero -/* 0DAE54 8031FE54 01C36024 */ and $t4, $t6, $v1 -/* 0DAE58 8031FE58 11800004 */ beqz $t4, .L8031FE6C -/* 0DAE5C 8031FE5C 322500FF */ andi $a1, $s1, 0xff -/* 0DAE60 8031FE60 92460003 */ lbu $a2, 3($s2) -/* 0DAE64 8031FE64 0C0C7E22 */ jal fade_channel_volume_scale -/* 0DAE68 8031FE68 97A7003A */ lhu $a3, 0x3a($sp) -.L8031FE6C: -/* 0DAE6C 8031FE6C 86590006 */ lh $t9, 6($s2) -/* 0DAE70 8031FE70 00002025 */ move $a0, $zero -/* 0DAE74 8031FE74 322500FF */ andi $a1, $s1, 0xff -/* 0DAE78 8031FE78 03306824 */ and $t5, $t9, $s0 -/* 0DAE7C 8031FE7C 11A00003 */ beqz $t5, .L8031FE8C -/* 0DAE80 8031FE80 97A70038 */ lhu $a3, 0x38($sp) -/* 0DAE84 8031FE84 0C0C7E22 */ jal fade_channel_volume_scale -/* 0DAE88 8031FE88 92460009 */ lbu $a2, 9($s2) -.L8031FE8C: -/* 0DAE8C 8031FE8C 26310001 */ addiu $s1, $s1, 1 -/* 0DAE90 8031FE90 322F00FF */ andi $t7, $s1, 0xff -/* 0DAE94 8031FE94 00101840 */ sll $v1, $s0, 1 -/* 0DAE98 8031FE98 29E10010 */ slti $at, $t7, 0x10 -/* 0DAE9C 8031FE9C 3078FFFF */ andi $t8, $v1, 0xffff -/* 0DAEA0 8031FEA0 01E08825 */ move $s1, $t7 -/* 0DAEA4 8031FEA4 1420FFE8 */ bnez $at, .L8031FE48 -/* 0DAEA8 8031FEA8 03001825 */ move $v1, $t8 -/* 0DAEAC 8031FEAC 93AE0057 */ lbu $t6, 0x57($sp) -/* 0DAEB0 8031FEB0 3C018033 */ lui $at, %hi(sCurrentMusicDynamic) # $at, 0x8033 -/* 0DAEB4 8031FEB4 A02E1EAC */ sb $t6, %lo(sCurrentMusicDynamic)($at) -/* 0DAEB8 8031FEB8 8FBF0024 */ lw $ra, 0x24($sp) -.L8031FEBC: -/* 0DAEBC 8031FEBC 8FB00018 */ lw $s0, 0x18($sp) -/* 0DAEC0 8031FEC0 8FB1001C */ lw $s1, 0x1c($sp) -/* 0DAEC4 8031FEC4 8FB20020 */ lw $s2, 0x20($sp) -/* 0DAEC8 8031FEC8 03E00008 */ jr $ra -/* 0DAECC 8031FECC 27BD0060 */ addiu $sp, $sp, 0x60 diff --git a/asm/non_matchings/seq_channel_layer_process_script_jp.s b/asm/non_matchings/seq_channel_layer_process_script_jp.s deleted file mode 100644 index 48aeb637..00000000 --- a/asm/non_matchings/seq_channel_layer_process_script_jp.s +++ /dev/null @@ -1,1040 +0,0 @@ -.late_rodata -glabel jtbl_80337C90 - .word L8031B2C0 - .word L8031B27C - .word L8031B690 - .word L8031B690 - .word L8031B30C - .word L8031B220 - .word L8031B690 - .word L8031B690 - .word L8031B1E4 - -glabel jtbl_80337CB4 - .word L8031B350 - .word L8031B3A8 - .word L8031B444 - .word L8031B3D4 - .word L8031B3D4 - .word L8031B494 - .word L8031B5B8 - .word L8031B688 - .word L8031B3A8 - .word L8031B350 - -glabel jtbl_80337CDC - .word L8031BBE8 - .word L8031BBF4 - .word L8031BBE8 - .word L8031BBF4 - .word L8031BBE8 - -glabel D_80337CF0 - .double 32512.0 - -glabel D_80337CF8 - .double 127.0 - -.text -glabel seq_channel_layer_process_script -/* 0D60A4 8031B0A4 27BDFFA0 */ addiu $sp, $sp, -0x60 -/* 0D60A8 8031B0A8 240E0001 */ li $t6, 1 -/* 0D60AC 8031B0AC AFBF001C */ sw $ra, 0x1c($sp) -/* 0D60B0 8031B0B0 AFB00018 */ sw $s0, 0x18($sp) -/* 0D60B4 8031B0B4 A3AE003F */ sb $t6, 0x3f($sp) -/* 0D60B8 8031B0B8 8C820000 */ lw $v0, ($a0) -/* 0D60BC 8031B0BC 00808025 */ move $s0, $a0 -/* 0D60C0 8031B0C0 00027FC2 */ srl $t7, $v0, 0x1f -/* 0D60C4 8031B0C4 51E00376 */ beql $t7, $zero, .L8031BEA0 -/* 0D60C8 8031B0C8 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D60CC 8031B0CC 8483003C */ lh $v1, 0x3c($a0) -/* 0D60D0 8031B0D0 00027080 */ sll $t6, $v0, 2 -/* 0D60D4 8031B0D4 0002C8C0 */ sll $t9, $v0, 3 -/* 0D60D8 8031B0D8 28610002 */ slti $at, $v1, 2 -/* 0D60DC 8031B0DC 1420000E */ bnez $at, .L8031B118 -/* 0D60E0 8031B0E0 2478FFFF */ addiu $t8, $v1, -1 -/* 0D60E4 8031B0E4 05C0036D */ bltz $t6, .L8031BE9C -/* 0D60E8 8031B0E8 A498003C */ sh $t8, 0x3c($a0) -/* 0D60EC 8031B0EC 848F003E */ lh $t7, 0x3e($a0) -/* 0D60F0 8031B0F0 8498003C */ lh $t8, 0x3c($a0) -/* 0D60F4 8031B0F4 01F8082A */ slt $at, $t7, $t8 -/* 0D60F8 8031B0F8 54200369 */ bnezl $at, .L8031BEA0 -/* 0D60FC 8031B0FC 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D6100 8031B100 0C0C63B1 */ jal seq_channel_layer_note_decay -/* 0D6104 8031B104 00000000 */ nop -/* 0D6108 8031B108 920E0000 */ lbu $t6, ($s0) -/* 0D610C 8031B10C 35CF0020 */ ori $t7, $t6, 0x20 -/* 0D6110 8031B110 10000362 */ b .L8031BE9C -/* 0D6114 8031B114 A20F0000 */ sb $t7, ($s0) -.L8031B118: -/* 0D6118 8031B118 07220004 */ bltzl $t9, .L8031B12C -/* 0D611C 8031B11C 92020004 */ lbu $v0, 4($s0) -/* 0D6120 8031B120 0C0C63B1 */ jal seq_channel_layer_note_decay -/* 0D6124 8031B124 02002025 */ move $a0, $s0 -/* 0D6128 8031B128 92020004 */ lbu $v0, 4($s0) -.L8031B12C: -/* 0D612C 8031B12C 2401FF7F */ li $at, -129 -/* 0D6130 8031B130 44800000 */ mtc1 $zero, $f0 -/* 0D6134 8031B134 00417024 */ and $t6, $v0, $at -/* 0D6138 8031B138 24010001 */ li $at, 1 -/* 0D613C 8031B13C 11C10004 */ beq $t6, $at, .L8031B150 -/* 0D6140 8031B140 3C1F8022 */ lui $ra, %hi(gCtlEntries) # $ra, 0x8022 -/* 0D6144 8031B144 24010002 */ li $at, 2 -/* 0D6148 8031B148 55C10003 */ bnel $t6, $at, .L8031B158 -/* 0D614C 8031B14C 8E0D0050 */ lw $t5, 0x50($s0) -.L8031B150: -/* 0D6150 8031B150 A2000004 */ sb $zero, 4($s0) -/* 0D6154 8031B154 8E0D0050 */ lw $t5, 0x50($s0) -.L8031B158: -/* 0D6158 8031B158 3C013F80 */ lui $at, 0x3f80 -/* 0D615C 8031B15C 3C0B8022 */ lui $t3, %hi(gBankLoadedPool) -/* 0D6160 8031B160 44810800 */ mtc1 $at, $f1 -/* 0D6164 8031B164 256B14F8 */ addiu $t3, $t3, %lo(gBankLoadedPool) -/* 0D6168 8031B168 27FF6D60 */ addiu $ra, %lo(gCtlEntries) # addiu $ra, $ra, 0x6d60 -/* 0D616C 8031B16C 97AA003A */ lhu $t2, 0x3a($sp) -/* 0D6170 8031B170 240900FF */ li $t1, 255 -/* 0D6174 8031B174 8DAC0040 */ lw $t4, 0x40($t5) -.L8031B178: -/* 0D6178 8031B178 8E020054 */ lw $v0, 0x54($s0) -.L8031B17C: -/* 0D617C 8031B17C 244F0001 */ addiu $t7, $v0, 1 -/* 0D6180 8031B180 AE0F0054 */ sw $t7, 0x54($s0) -/* 0D6184 8031B184 90440000 */ lbu $a0, ($v0) -/* 0D6188 8031B188 288100C1 */ slti $at, $a0, 0xc1 -/* 0D618C 8031B18C 14200159 */ bnez $at, .L8031B6F4 -/* 0D6190 8031B190 00802825 */ move $a1, $a0 -/* 0D6194 8031B194 288100CB */ slti $at, $a0, 0xcb -/* 0D6198 8031B198 1420000A */ bnez $at, .L8031B1C4 -/* 0D619C 8031B19C 24B9FF3F */ addiu $t9, $a1, -0xc1 -/* 0D61A0 8031B1A0 2498FF09 */ addiu $t8, $a0, -0xf7 -/* 0D61A4 8031B1A4 2F010009 */ sltiu $at, $t8, 9 -/* 0D61A8 8031B1A8 10200139 */ beqz $at, .L8031B690 -/* 0D61AC 8031B1AC 0018C080 */ sll $t8, $t8, 2 -/* 0D61B0 8031B1B0 3C018033 */ lui $at, %hi(jtbl_80337C90) -/* 0D61B4 8031B1B4 00380821 */ addu $at, $at, $t8 -/* 0D61B8 8031B1B8 8C387C90 */ lw $t8, %lo(jtbl_80337C90)($at) -/* 0D61BC 8031B1BC 03000008 */ jr $t8 -/* 0D61C0 8031B1C0 00000000 */ nop -.L8031B1C4: -/* 0D61C4 8031B1C4 2F21000A */ sltiu $at, $t9, 0xa -/* 0D61C8 8031B1C8 10200131 */ beqz $at, .L8031B690 -/* 0D61CC 8031B1CC 0019C880 */ sll $t9, $t9, 2 -/* 0D61D0 8031B1D0 3C018033 */ lui $at, %hi(jtbl_80337CB4) -/* 0D61D4 8031B1D4 00390821 */ addu $at, $at, $t9 -/* 0D61D8 8031B1D8 8C397CB4 */ lw $t9, %lo(jtbl_80337CB4)($at) -/* 0D61DC 8031B1DC 03200008 */ jr $t9 -/* 0D61E0 8031B1E0 00000000 */ nop -glabel L8031B1E4 -/* 0D61E4 8031B1E4 26020054 */ addiu $v0, $s0, 0x54 -/* 0D61E8 8031B1E8 90430018 */ lbu $v1, 0x18($v0) -/* 0D61EC 8031B1EC 14600005 */ bnez $v1, .L8031B204 -/* 0D61F0 8031B1F0 246EFFFF */ addiu $t6, $v1, -1 -/* 0D61F4 8031B1F4 0C0C6A84 */ jal seq_channel_layer_disable -/* 0D61F8 8031B1F8 02002025 */ move $a0, $s0 -/* 0D61FC 8031B1FC 10000328 */ b .L8031BEA0 -/* 0D6200 8031B200 8FBF001C */ lw $ra, 0x1c($sp) -.L8031B204: -/* 0D6204 8031B204 31CF00FF */ andi $t7, $t6, 0xff -/* 0D6208 8031B208 000FC080 */ sll $t8, $t7, 2 -/* 0D620C 8031B20C 0058C821 */ addu $t9, $v0, $t8 -/* 0D6210 8031B210 A04E0018 */ sb $t6, 0x18($v0) -/* 0D6214 8031B214 8F2E0004 */ lw $t6, 4($t9) -/* 0D6218 8031B218 1000FFD7 */ b .L8031B178 -/* 0D621C 8031B21C AC4E0000 */ sw $t6, ($v0) -glabel L8031B220 -/* 0D6220 8031B220 26020054 */ addiu $v0, $s0, 0x54 -/* 0D6224 8031B224 8C430000 */ lw $v1, ($v0) -/* 0D6228 8031B228 90640000 */ lbu $a0, ($v1) -/* 0D622C 8031B22C 246E0001 */ addiu $t6, $v1, 1 -/* 0D6230 8031B230 AC4E0000 */ sw $t6, ($v0) -/* 0D6234 8031B234 91CF0000 */ lbu $t7, ($t6) -/* 0D6238 8031B238 0004CA00 */ sll $t9, $a0, 8 -/* 0D623C 8031B23C 01F92825 */ or $a1, $t7, $t9 -/* 0D6240 8031B240 904F0018 */ lbu $t7, 0x18($v0) -/* 0D6244 8031B244 25D90001 */ addiu $t9, $t6, 1 -/* 0D6248 8031B248 AC590000 */ sw $t9, ($v0) -/* 0D624C 8031B24C 25F80001 */ addiu $t8, $t7, 1 -/* 0D6250 8031B250 330E00FF */ andi $t6, $t8, 0xff -/* 0D6254 8031B254 000E7880 */ sll $t7, $t6, 2 -/* 0D6258 8031B258 A0580018 */ sb $t8, 0x18($v0) -/* 0D625C 8031B25C 004FC021 */ addu $t8, $v0, $t7 -/* 0D6260 8031B260 AF190000 */ sw $t9, ($t8) -/* 0D6264 8031B264 8D8E0014 */ lw $t6, 0x14($t4) -/* 0D6268 8031B268 30AFFFFF */ andi $t7, $a1, 0xffff -/* 0D626C 8031B26C 30AAFFFF */ andi $t2, $a1, 0xffff -/* 0D6270 8031B270 01CFC821 */ addu $t9, $t6, $t7 -/* 0D6274 8031B274 1000FFC0 */ b .L8031B178 -/* 0D6278 8031B278 AC590000 */ sw $t9, ($v0) -glabel L8031B27C -/* 0D627C 8031B27C 26020054 */ addiu $v0, $s0, 0x54 -/* 0D6280 8031B280 8C430000 */ lw $v1, ($v0) -/* 0D6284 8031B284 904E0018 */ lbu $t6, 0x18($v0) -/* 0D6288 8031B288 24780001 */ addiu $t8, $v1, 1 -/* 0D628C 8031B28C AC580000 */ sw $t8, ($v0) -/* 0D6290 8031B290 90650000 */ lbu $a1, ($v1) -/* 0D6294 8031B294 004E7821 */ addu $t7, $v0, $t6 -/* 0D6298 8031B298 A1E50014 */ sb $a1, 0x14($t7) -/* 0D629C 8031B29C 90590018 */ lbu $t9, 0x18($v0) -/* 0D62A0 8031B2A0 8C4E0000 */ lw $t6, ($v0) -/* 0D62A4 8031B2A4 27380001 */ addiu $t8, $t9, 1 -/* 0D62A8 8031B2A8 330F00FF */ andi $t7, $t8, 0xff -/* 0D62AC 8031B2AC 000FC880 */ sll $t9, $t7, 2 -/* 0D62B0 8031B2B0 A0580018 */ sb $t8, 0x18($v0) -/* 0D62B4 8031B2B4 0059C021 */ addu $t8, $v0, $t9 -/* 0D62B8 8031B2B8 1000FFAF */ b .L8031B178 -/* 0D62BC 8031B2BC AF0E0000 */ sw $t6, ($t8) -glabel L8031B2C0 -/* 0D62C0 8031B2C0 26020054 */ addiu $v0, $s0, 0x54 -/* 0D62C4 8031B2C4 904F0018 */ lbu $t7, 0x18($v0) -/* 0D62C8 8031B2C8 004F2021 */ addu $a0, $v0, $t7 -/* 0D62CC 8031B2CC 90990013 */ lbu $t9, 0x13($a0) -/* 0D62D0 8031B2D0 272EFFFF */ addiu $t6, $t9, -1 -/* 0D62D4 8031B2D4 A08E0013 */ sb $t6, 0x13($a0) -/* 0D62D8 8031B2D8 90430018 */ lbu $v1, 0x18($v0) -/* 0D62DC 8031B2DC 0043C021 */ addu $t8, $v0, $v1 -/* 0D62E0 8031B2E0 930F0013 */ lbu $t7, 0x13($t8) -/* 0D62E4 8031B2E4 00602825 */ move $a1, $v1 -/* 0D62E8 8031B2E8 0005C880 */ sll $t9, $a1, 2 -/* 0D62EC 8031B2EC 11E00004 */ beqz $t7, .L8031B300 -/* 0D62F0 8031B2F0 00597021 */ addu $t6, $v0, $t9 -/* 0D62F4 8031B2F4 8DD80000 */ lw $t8, ($t6) -/* 0D62F8 8031B2F8 1000FF9F */ b .L8031B178 -/* 0D62FC 8031B2FC AC580000 */ sw $t8, ($v0) -.L8031B300: -/* 0D6300 8031B300 246FFFFF */ addiu $t7, $v1, -1 -/* 0D6304 8031B304 1000FF9C */ b .L8031B178 -/* 0D6308 8031B308 A04F0018 */ sb $t7, 0x18($v0) -glabel L8031B30C -/* 0D630C 8031B30C 26020054 */ addiu $v0, $s0, 0x54 -/* 0D6310 8031B310 8C430000 */ lw $v1, ($v0) -/* 0D6314 8031B314 90640000 */ lbu $a0, ($v1) -/* 0D6318 8031B318 246F0001 */ addiu $t7, $v1, 1 -/* 0D631C 8031B31C AC4F0000 */ sw $t7, ($v0) -/* 0D6320 8031B320 91F90000 */ lbu $t9, ($t7) -/* 0D6324 8031B324 0004C200 */ sll $t8, $a0, 8 -/* 0D6328 8031B328 25EF0001 */ addiu $t7, $t7, 1 -/* 0D632C 8031B32C 03387025 */ or $t6, $t9, $t8 -/* 0D6330 8031B330 AC4F0000 */ sw $t7, ($v0) -/* 0D6334 8031B334 8D990014 */ lw $t9, 0x14($t4) -/* 0D6338 8031B338 01C0C025 */ move $t8, $t6 -/* 0D633C 8031B33C 330AFFFF */ andi $t2, $t8, 0xffff -/* 0D6340 8031B340 330EFFFF */ andi $t6, $t8, 0xffff -/* 0D6344 8031B344 032EC021 */ addu $t8, $t9, $t6 -/* 0D6348 8031B348 1000FF8B */ b .L8031B178 -/* 0D634C 8031B34C AC580000 */ sw $t8, ($v0) -glabel L8031B350 -/* 0D6350 8031B350 26020054 */ addiu $v0, $s0, 0x54 -/* 0D6354 8031B354 8C430000 */ lw $v1, ($v0) -/* 0D6358 8031B358 240100C1 */ li $at, 193 -/* 0D635C 8031B35C 90640000 */ lbu $a0, ($v1) -/* 0D6360 8031B360 246F0001 */ addiu $t7, $v1, 1 -/* 0D6364 8031B364 14A10008 */ bne $a1, $at, .L8031B388 -/* 0D6368 8031B368 AC4F0000 */ sw $t7, ($v0) -/* 0D636C 8031B36C 00840019 */ multu $a0, $a0 -/* 0D6370 8031B370 0000C812 */ mflo $t9 -/* 0D6374 8031B374 44992000 */ mtc1 $t9, $f4 -/* 0D6378 8031B378 00000000 */ nop -/* 0D637C 8031B37C 468021A0 */ cvt.s.w $f6, $f4 -/* 0D6380 8031B380 1000FF7D */ b .L8031B178 -/* 0D6384 8031B384 E6060024 */ swc1 $f6, 0x24($s0) -.L8031B388: -/* 0D6388 8031B388 44844000 */ mtc1 $a0, $f8 -/* 0D638C 8031B38C 00000000 */ nop -/* 0D6390 8031B390 468042A0 */ cvt.s.w $f10, $f8 -/* 0D6394 8031B394 46005421 */ cvt.d.s $f16, $f10 -/* 0D6398 8031B398 46208482 */ mul.d $f18, $f16, $f0 -/* 0D639C 8031B39C 46209120 */ cvt.s.d $f4, $f18 -/* 0D63A0 8031B3A0 1000FF75 */ b .L8031B178 -/* 0D63A4 8031B3A4 E6040028 */ swc1 $f4, 0x28($s0) -glabel L8031B3A8 -/* 0D63A8 8031B3A8 26020054 */ addiu $v0, $s0, 0x54 -/* 0D63AC 8031B3AC 8C430000 */ lw $v1, ($v0) -/* 0D63B0 8031B3B0 240100C9 */ li $at, 201 -/* 0D63B4 8031B3B4 90640000 */ lbu $a0, ($v1) -/* 0D63B8 8031B3B8 246E0001 */ addiu $t6, $v1, 1 -/* 0D63BC 8031B3BC 14A10003 */ bne $a1, $at, .L8031B3CC -/* 0D63C0 8031B3C0 AC4E0000 */ sw $t6, ($v0) -/* 0D63C4 8031B3C4 1000FF6C */ b .L8031B178 -/* 0D63C8 8031B3C8 A2040002 */ sb $a0, 2($s0) -.L8031B3CC: -/* 0D63CC 8031B3CC 1000FF6A */ b .L8031B178 -/* 0D63D0 8031B3D0 A604001E */ sh $a0, 0x1e($s0) -glabel L8031B3D4 -/* 0D63D4 8031B3D4 240100C4 */ li $at, 196 -/* 0D63D8 8031B3D8 14A10003 */ bne $a1, $at, .L8031B3E8 -/* 0D63DC 8031B3DC 02002025 */ move $a0, $s0 -/* 0D63E0 8031B3E0 10000002 */ b .L8031B3EC -/* 0D63E4 8031B3E4 24020001 */ li $v0, 1 -.L8031B3E8: -/* 0D63E8 8031B3E8 00001025 */ move $v0, $zero -.L8031B3EC: -/* 0D63EC 8031B3EC 920E0000 */ lbu $t6, ($s0) -/* 0D63F0 8031B3F0 00027900 */ sll $t7, $v0, 4 -/* 0D63F4 8031B3F4 31F90010 */ andi $t9, $t7, 0x10 -/* 0D63F8 8031B3F8 31D8FFEF */ andi $t8, $t6, 0xffef -/* 0D63FC 8031B3FC 03387825 */ or $t7, $t9, $t8 -/* 0D6400 8031B400 A20F0000 */ sb $t7, ($s0) -/* 0D6404 8031B404 AFAD0058 */ sw $t5, 0x58($sp) -/* 0D6408 8031B408 AFAC005C */ sw $t4, 0x5c($sp) -/* 0D640C 8031B40C 0C0C63B1 */ jal seq_channel_layer_note_decay -/* 0D6410 8031B410 A7AA003A */ sh $t2, 0x3a($sp) -/* 0D6414 8031B414 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 0D6418 8031B418 44810800 */ mtc1 $at, $f1 -/* 0D641C 8031B41C 3C0B8022 */ lui $t3, %hi(gBankLoadedPool) # $t3, 0x8022 -/* 0D6420 8031B420 3C1F8022 */ lui $ra, %hi(gCtlEntries) -/* 0D6424 8031B424 44800000 */ mtc1 $zero, $f0 -/* 0D6428 8031B428 27FF6D60 */ addiu $ra, $ra, %lo(gCtlEntries) -/* 0D642C 8031B42C 256B14F8 */ addiu $t3, %lo(gBankLoadedPool) # addiu $t3, $t3, 0x14f8 -/* 0D6430 8031B430 240900FF */ li $t1, 255 -/* 0D6434 8031B434 97AA003A */ lhu $t2, 0x3a($sp) -/* 0D6438 8031B438 8FAC005C */ lw $t4, 0x5c($sp) -/* 0D643C 8031B43C 1000FF4E */ b .L8031B178 -/* 0D6440 8031B440 8FAD0058 */ lw $t5, 0x58($sp) -glabel L8031B444 -/* 0D6444 8031B444 26020054 */ addiu $v0, $s0, 0x54 -/* 0D6448 8031B448 8C430000 */ lw $v1, ($v0) -/* 0D644C 8031B44C 90640000 */ lbu $a0, ($v1) -/* 0D6450 8031B450 246E0001 */ addiu $t6, $v1, 1 -/* 0D6454 8031B454 AC4E0000 */ sw $t6, ($v0) -/* 0D6458 8031B458 30990080 */ andi $t9, $a0, 0x80 -/* 0D645C 8031B45C 1320000A */ beqz $t9, .L8031B488 -/* 0D6460 8031B460 00802825 */ move $a1, $a0 -/* 0D6464 8031B464 01C01825 */ move $v1, $t6 -/* 0D6468 8031B468 91CE0000 */ lbu $t6, ($t6) -/* 0D646C 8031B46C 00052200 */ sll $a0, $a1, 8 -/* 0D6470 8031B470 308F7F00 */ andi $t7, $a0, 0x7f00 -/* 0D6474 8031B474 01CF2025 */ or $a0, $t6, $t7 -/* 0D6478 8031B478 3085FFFF */ andi $a1, $a0, 0xffff -/* 0D647C 8031B47C 24780001 */ addiu $t8, $v1, 1 -/* 0D6480 8031B480 AC580000 */ sw $t8, ($v0) -/* 0D6484 8031B484 00A02025 */ move $a0, $a1 -.L8031B488: -/* 0D6488 8031B488 308AFFFF */ andi $t2, $a0, 0xffff -/* 0D648C 8031B48C 1000FF3A */ b .L8031B178 -/* 0D6490 8031B490 A6050038 */ sh $a1, 0x38($s0) -glabel L8031B494 -/* 0D6494 8031B494 26020054 */ addiu $v0, $s0, 0x54 -/* 0D6498 8031B498 8C430000 */ lw $v1, ($v0) -/* 0D649C 8031B49C 246F0001 */ addiu $t7, $v1, 1 -/* 0D64A0 8031B4A0 AC4F0000 */ sw $t7, ($v0) -/* 0D64A4 8031B4A4 90650000 */ lbu $a1, ($v1) -/* 0D64A8 8031B4A8 28A1007F */ slti $at, $a1, 0x7f -/* 0D64AC 8031B4AC 5020FF33 */ beql $at, $zero, .L8031B17C -/* 0D64B0 8031B4B0 8E020054 */ lw $v0, 0x54($s0) -/* 0D64B4 8031B4B4 91B90005 */ lbu $t9, 5($t5) -/* 0D64B8 8031B4B8 8FEE0000 */ lw $t6, ($ra) -/* 0D64BC 8031B4BC 30A200FF */ andi $v0, $a1, 0xff -/* 0D64C0 8031B4C0 0019C080 */ sll $t8, $t9, 2 -/* 0D64C4 8031B4C4 0319C023 */ subu $t8, $t8, $t9 -/* 0D64C8 8031B4C8 0018C080 */ sll $t8, $t8, 2 -/* 0D64CC 8031B4CC 01D83821 */ addu $a3, $t6, $t8 -/* 0D64D0 8031B4D0 90E30001 */ lbu $v1, 1($a3) -/* 0D64D4 8031B4D4 00A3082A */ slt $at, $a1, $v1 -/* 0D64D8 8031B4D8 54200008 */ bnezl $at, .L8031B4FC -/* 0D64DC 8031B4DC 8CE30004 */ lw $v1, 4($a3) -/* 0D64E0 8031B4E0 306200FF */ andi $v0, $v1, 0xff -/* 0D64E4 8031B4E4 5040FF25 */ beql $v0, $zero, .L8031B17C -/* 0D64E8 8031B4E8 8E020054 */ lw $v0, 0x54($s0) -/* 0D64EC 8031B4EC 2442FFFF */ addiu $v0, $v0, -1 -/* 0D64F0 8031B4F0 304F00FF */ andi $t7, $v0, 0xff -/* 0D64F4 8031B4F4 01E01025 */ move $v0, $t7 -/* 0D64F8 8031B4F8 8CE30004 */ lw $v1, 4($a3) -.L8031B4FC: -/* 0D64FC 8031B4FC 0002C880 */ sll $t9, $v0, 2 -/* 0D6500 8031B500 26050048 */ addiu $a1, $s0, 0x48 -/* 0D6504 8031B504 00797021 */ addu $t6, $v1, $t9 -/* 0D6508 8031B508 8DC40000 */ lw $a0, ($t6) -/* 0D650C 8031B50C 5480000C */ bnezl $a0, .L8031B540 -/* 0D6510 8031B510 8D630004 */ lw $v1, 4($t3) -/* 0D6514 8031B514 11220009 */ beq $t1, $v0, .L8031B53C -.L8031B518: -/* 0D6518 8031B518 0002C080 */ sll $t8, $v0, 2 -/* 0D651C 8031B51C 00787821 */ addu $t7, $v1, $t8 -/* 0D6520 8031B520 8DE40000 */ lw $a0, ($t7) -/* 0D6524 8031B524 54800006 */ bnezl $a0, .L8031B540 -/* 0D6528 8031B528 8D630004 */ lw $v1, 4($t3) -/* 0D652C 8031B52C 2442FFFF */ addiu $v0, $v0, -1 -/* 0D6530 8031B530 305900FF */ andi $t9, $v0, 0xff -/* 0D6534 8031B534 1539FFF8 */ bne $t1, $t9, .L8031B518 -/* 0D6538 8031B538 03201025 */ move $v0, $t9 -.L8031B53C: -/* 0D653C 8031B53C 8D630004 */ lw $v1, 4($t3) -.L8031B540: -/* 0D6540 8031B540 0083082B */ sltu $at, $a0, $v1 -/* 0D6544 8031B544 54200007 */ bnezl $at, .L8031B564 -/* 0D6548 8031B548 8D630198 */ lw $v1, 0x198($t3) -/* 0D654C 8031B54C 8D6E000C */ lw $t6, 0xc($t3) -/* 0D6550 8031B550 006EC021 */ addu $t8, $v1, $t6 -/* 0D6554 8031B554 0304082B */ sltu $at, $t8, $a0 -/* 0D6558 8031B558 5020000B */ beql $at, $zero, .L8031B588 -/* 0D655C 8031B55C 8C8E0004 */ lw $t6, 4($a0) -/* 0D6560 8031B560 8D630198 */ lw $v1, 0x198($t3) -.L8031B564: -/* 0D6564 8031B564 0083082B */ sltu $at, $a0, $v1 -/* 0D6568 8031B568 5420000E */ bnezl $at, .L8031B5A4 -/* 0D656C 8031B56C 3C010002 */ lui $at, 2 -/* 0D6570 8031B570 8D6F01A0 */ lw $t7, 0x1a0($t3) -/* 0D6574 8031B574 006FC821 */ addu $t9, $v1, $t7 -/* 0D6578 8031B578 0324082B */ sltu $at, $t9, $a0 -/* 0D657C 8031B57C 54200009 */ bnezl $at, .L8031B5A4 -/* 0D6580 8031B580 3C010002 */ lui $at, 2 -/* 0D6584 8031B584 8C8E0004 */ lw $t6, 4($a0) -.L8031B588: -/* 0D6588 8031B588 26020014 */ addiu $v0, $s0, 0x14 -/* 0D658C 8031B58C AC4E0004 */ sw $t6, 4($v0) -/* 0D6590 8031B590 90980003 */ lbu $t8, 3($a0) -/* 0D6594 8031B594 A0580000 */ sb $t8, ($v0) -/* 0D6598 8031B598 1000FEF7 */ b .L8031B178 -/* 0D659C 8031B59C ACA40000 */ sw $a0, ($a1) -/* 0D65A0 8031B5A0 3C010002 */ lui $at, 2 -.L8031B5A4: -/* 0D65A4 8031B5A4 00417821 */ addu $t7, $v0, $at -/* 0D65A8 8031B5A8 3C018033 */ lui $at, %hi(gAudioErrorFlags) # $at, 0x8033 -/* 0D65AC 8031B5AC AC2F1D40 */ sw $t7, %lo(gAudioErrorFlags)($at) -/* 0D65B0 8031B5B0 1000FEF1 */ b .L8031B178 -/* 0D65B4 8031B5B4 ACA00000 */ sw $zero, ($a1) -glabel L8031B5B8 -/* 0D65B8 8031B5B8 26020054 */ addiu $v0, $s0, 0x54 -/* 0D65BC 8031B5BC 8C430000 */ lw $v1, ($v0) -/* 0D65C0 8031B5C0 24790001 */ addiu $t9, $v1, 1 -/* 0D65C4 8031B5C4 AC590000 */ sw $t9, ($v0) -/* 0D65C8 8031B5C8 90650000 */ lbu $a1, ($v1) -/* 0D65CC 8031B5CC A2050004 */ sb $a1, 4($s0) -/* 0D65D0 8031B5D0 8C430000 */ lw $v1, ($v0) -/* 0D65D4 8031B5D4 246E0001 */ addiu $t6, $v1, 1 -/* 0D65D8 8031B5D8 AC4E0000 */ sw $t6, ($v0) -/* 0D65DC 8031B5DC 85B8001A */ lh $t8, 0x1a($t5) -/* 0D65E0 8031B5E0 90670000 */ lbu $a3, ($v1) -/* 0D65E4 8031B5E4 8619001E */ lh $t9, 0x1e($s0) -/* 0D65E8 8031B5E8 03077821 */ addu $t7, $t8, $a3 -/* 0D65EC 8031B5EC 85980010 */ lh $t8, 0x10($t4) -/* 0D65F0 8031B5F0 01F97021 */ addu $t6, $t7, $t9 -/* 0D65F4 8031B5F4 01D84021 */ addu $t0, $t6, $t8 -/* 0D65F8 8031B5F8 310F00FF */ andi $t7, $t0, 0xff -/* 0D65FC 8031B5FC 29E10080 */ slti $at, $t7, 0x80 -/* 0D6600 8031B600 14200002 */ bnez $at, .L8031B60C -/* 0D6604 8031B604 01E04025 */ move $t0, $t7 -/* 0D6608 8031B608 00004025 */ move $t0, $zero -.L8031B60C: -/* 0D660C 8031B60C 92190004 */ lbu $t9, 4($s0) -/* 0D6610 8031B610 A2080003 */ sb $t0, 3($s0) -/* 0D6614 8031B614 332E0080 */ andi $t6, $t9, 0x80 -/* 0D6618 8031B618 51C00009 */ beql $t6, $zero, .L8031B640 -/* 0D661C 8031B61C 8C430000 */ lw $v1, ($v0) -/* 0D6620 8031B620 8C580000 */ lw $t8, ($v0) -/* 0D6624 8031B624 930F0000 */ lbu $t7, ($t8) -/* 0D6628 8031B628 A60F001C */ sh $t7, 0x1c($s0) -/* 0D662C 8031B62C 8C590000 */ lw $t9, ($v0) -/* 0D6630 8031B630 272E0001 */ addiu $t6, $t9, 1 -/* 0D6634 8031B634 1000FED0 */ b .L8031B178 -/* 0D6638 8031B638 AC4E0000 */ sw $t6, ($v0) -/* 0D663C 8031B63C 8C430000 */ lw $v1, ($v0) -.L8031B640: -/* 0D6640 8031B640 90640000 */ lbu $a0, ($v1) -/* 0D6644 8031B644 24780001 */ addiu $t8, $v1, 1 -/* 0D6648 8031B648 AC580000 */ sw $t8, ($v0) -/* 0D664C 8031B64C 308F0080 */ andi $t7, $a0, 0x80 -/* 0D6650 8031B650 11E0000A */ beqz $t7, .L8031B67C -/* 0D6654 8031B654 00802825 */ move $a1, $a0 -/* 0D6658 8031B658 03001825 */ move $v1, $t8 -/* 0D665C 8031B65C 93180000 */ lbu $t8, ($t8) -/* 0D6660 8031B660 00052200 */ sll $a0, $a1, 8 -/* 0D6664 8031B664 308E7F00 */ andi $t6, $a0, 0x7f00 -/* 0D6668 8031B668 030E2025 */ or $a0, $t8, $t6 -/* 0D666C 8031B66C 308FFFFF */ andi $t7, $a0, 0xffff -/* 0D6670 8031B670 24790001 */ addiu $t9, $v1, 1 -/* 0D6674 8031B674 AC590000 */ sw $t9, ($v0) -/* 0D6678 8031B678 01E02025 */ move $a0, $t7 -.L8031B67C: -/* 0D667C 8031B67C 308AFFFF */ andi $t2, $a0, 0xffff -/* 0D6680 8031B680 1000FEBD */ b .L8031B178 -/* 0D6684 8031B684 A604001C */ sh $a0, 0x1c($s0) -glabel L8031B688 -/* 0D6688 8031B688 1000FEBB */ b .L8031B178 -/* 0D668C 8031B68C A2000004 */ sb $zero, 4($s0) -.L8031B690: -glabel L8031B690 -/* 0D6690 8031B690 30A200F0 */ andi $v0, $a1, 0xf0 -/* 0D6694 8031B694 240100D0 */ li $at, 208 -/* 0D6698 8031B698 10410005 */ beq $v0, $at, .L8031B6B0 -/* 0D669C 8031B69C 240100E0 */ li $at, 224 -/* 0D66A0 8031B6A0 5041000F */ beql $v0, $at, .L8031B6E0 -/* 0D66A4 8031B6A4 8D8E008C */ lw $t6, 0x8c($t4) -/* 0D66A8 8031B6A8 1000FEB4 */ b .L8031B17C -/* 0D66AC 8031B6AC 8E020054 */ lw $v0, 0x54($s0) -.L8031B6B0: -/* 0D66B0 8031B6B0 8D8E0088 */ lw $t6, 0x88($t4) -/* 0D66B4 8031B6B4 30B8000F */ andi $t8, $a1, 0xf -/* 0D66B8 8031B6B8 01D87821 */ addu $t7, $t6, $t8 -/* 0D66BC 8031B6BC 91EA0000 */ lbu $t2, ($t7) -/* 0D66C0 8031B6C0 014A0019 */ multu $t2, $t2 -/* 0D66C4 8031B6C4 0000C812 */ mflo $t9 -/* 0D66C8 8031B6C8 44993000 */ mtc1 $t9, $f6 -/* 0D66CC 8031B6CC 00000000 */ nop -/* 0D66D0 8031B6D0 46803220 */ cvt.s.w $f8, $f6 -/* 0D66D4 8031B6D4 1000FEA8 */ b .L8031B178 -/* 0D66D8 8031B6D8 E6080024 */ swc1 $f8, 0x24($s0) -/* 0D66DC 8031B6DC 8D8E008C */ lw $t6, 0x8c($t4) -.L8031B6E0: -/* 0D66E0 8031B6E0 30B8000F */ andi $t8, $a1, 0xf -/* 0D66E4 8031B6E4 01D87821 */ addu $t7, $t6, $t8 -/* 0D66E8 8031B6E8 91F90000 */ lbu $t9, ($t7) -/* 0D66EC 8031B6EC 1000FEA2 */ b .L8031B178 -/* 0D66F0 8031B6F0 A2190002 */ sb $t9, 2($s0) -.L8031B6F4: -/* 0D66F4 8031B6F4 240100C0 */ li $at, 192 -/* 0D66F8 8031B6F8 14A10015 */ bne $a1, $at, .L8031B750 -/* 0D66FC 8031B6FC 26020054 */ addiu $v0, $s0, 0x54 -/* 0D6700 8031B700 8C430000 */ lw $v1, ($v0) -/* 0D6704 8031B704 90640000 */ lbu $a0, ($v1) -/* 0D6708 8031B708 246E0001 */ addiu $t6, $v1, 1 -/* 0D670C 8031B70C AC4E0000 */ sw $t6, ($v0) -/* 0D6710 8031B710 30980080 */ andi $t8, $a0, 0x80 -/* 0D6714 8031B714 13000009 */ beqz $t8, .L8031B73C -/* 0D6718 8031B718 00802825 */ move $a1, $a0 -/* 0D671C 8031B71C 01C01825 */ move $v1, $t6 -/* 0D6720 8031B720 91CE0000 */ lbu $t6, ($t6) -/* 0D6724 8031B724 00042200 */ sll $a0, $a0, 8 -/* 0D6728 8031B728 30997F00 */ andi $t9, $a0, 0x7f00 -/* 0D672C 8031B72C 246F0001 */ addiu $t7, $v1, 1 -/* 0D6730 8031B730 01D92025 */ or $a0, $t6, $t9 -/* 0D6734 8031B734 3085FFFF */ andi $a1, $a0, 0xffff -/* 0D6738 8031B738 AC4F0000 */ sw $t7, ($v0) -.L8031B73C: -/* 0D673C 8031B73C 920E0000 */ lbu $t6, ($s0) -/* 0D6740 8031B740 A605003C */ sh $a1, 0x3c($s0) -/* 0D6744 8031B744 35D80020 */ ori $t8, $t6, 0x20 -/* 0D6748 8031B748 1000019C */ b .L8031BDBC -/* 0D674C 8031B74C A2180000 */ sb $t8, ($s0) -.L8031B750: -/* 0D6750 8031B750 920F0000 */ lbu $t7, ($s0) -/* 0D6754 8031B754 24010001 */ li $at, 1 -/* 0D6758 8031B758 30A900C0 */ andi $t1, $a1, 0xc0 -/* 0D675C 8031B75C 31F9FFDF */ andi $t9, $t7, 0xffdf -/* 0D6760 8031B760 A2190000 */ sb $t9, ($s0) -/* 0D6764 8031B764 8DAE0000 */ lw $t6, ($t5) -/* 0D6768 8031B768 000EC180 */ sll $t8, $t6, 6 -/* 0D676C 8031B76C 00187FC2 */ srl $t7, $t8, 0x1f -/* 0D6770 8031B770 15E10057 */ bne $t7, $at, .L8031B8D0 -/* 0D6774 8031B774 00000000 */ nop -/* 0D6778 8031B778 30A900C0 */ andi $t1, $a1, 0xc0 -/* 0D677C 8031B77C 11200009 */ beqz $t1, .L8031B7A4 -/* 0D6780 8031B780 26020054 */ addiu $v0, $s0, 0x54 -/* 0D6784 8031B784 24010040 */ li $at, 64 -/* 0D6788 8031B788 11210023 */ beq $t1, $at, .L8031B818 -/* 0D678C 8031B78C 26020054 */ addiu $v0, $s0, 0x54 -/* 0D6790 8031B790 24010080 */ li $at, 128 -/* 0D6794 8031B794 11210039 */ beq $t1, $at, .L8031B87C -/* 0D6798 8031B798 26020054 */ addiu $v0, $s0, 0x54 -/* 0D679C 8031B79C 10000043 */ b .L8031B8AC -/* 0D67A0 8031B7A0 01402025 */ move $a0, $t2 -.L8031B7A4: -/* 0D67A4 8031B7A4 8C430000 */ lw $v1, ($v0) -/* 0D67A8 8031B7A8 90660000 */ lbu $a2, ($v1) -/* 0D67AC 8031B7AC 24790001 */ addiu $t9, $v1, 1 -/* 0D67B0 8031B7B0 AC590000 */ sw $t9, ($v0) -/* 0D67B4 8031B7B4 30CE0080 */ andi $t6, $a2, 0x80 -/* 0D67B8 8031B7B8 11C0000A */ beqz $t6, .L8031B7E4 -/* 0D67BC 8031B7BC 00C03825 */ or $a3, $a2, $zero -/* 0D67C0 8031B7C0 03201825 */ move $v1, $t9 -/* 0D67C4 8031B7C4 93390000 */ lbu $t9, ($t9) -/* 0D67C8 8031B7C8 00073200 */ sll $a2, $a3, 8 -/* 0D67CC 8031B7CC 30CF7F00 */ andi $t7, $a2, 0x7f00 -/* 0D67D0 8031B7D0 032F3025 */ or $a2, $t9, $t7 -/* 0D67D4 8031B7D4 30C7FFFF */ andi $a3, $a2, 0xffff -/* 0D67D8 8031B7D8 24780001 */ addiu $t8, $v1, 1 -/* 0D67DC 8031B7DC AC580000 */ sw $t8, ($v0) -/* 0D67E0 8031B7E0 00E03025 */ move $a2, $a3 -.L8031B7E4: -/* 0D67E4 8031B7E4 8C430000 */ lw $v1, ($v0) -/* 0D67E8 8031B7E8 30CAFFFF */ andi $t2, $a2, 0xffff -/* 0D67EC 8031B7EC 01402025 */ move $a0, $t2 -/* 0D67F0 8031B7F0 906B0000 */ lbu $t3, ($v1) -/* 0D67F4 8031B7F4 246F0001 */ addiu $t7, $v1, 1 -/* 0D67F8 8031B7F8 AC4F0000 */ sw $t7, ($v0) -/* 0D67FC 8031B7FC 91EE0000 */ lbu $t6, ($t7) -/* 0D6800 8031B800 A20E0002 */ sb $t6, 2($s0) -/* 0D6804 8031B804 8C580000 */ lw $t8, ($v0) -/* 0D6808 8031B808 270F0001 */ addiu $t7, $t8, 1 -/* 0D680C 8031B80C AC4F0000 */ sw $t7, ($v0) -/* 0D6810 8031B810 10000027 */ b .L8031B8B0 -/* 0D6814 8031B814 A607003A */ sh $a3, 0x3a($s0) -.L8031B818: -/* 0D6818 8031B818 8C430000 */ lw $v1, ($v0) -/* 0D681C 8031B81C 90660000 */ lbu $a2, ($v1) -/* 0D6820 8031B820 24790001 */ addiu $t9, $v1, 1 -/* 0D6824 8031B824 AC590000 */ sw $t9, ($v0) -/* 0D6828 8031B828 30CE0080 */ andi $t6, $a2, 0x80 -/* 0D682C 8031B82C 11C0000A */ beqz $t6, .L8031B858 -/* 0D6830 8031B830 00C03825 */ or $a3, $a2, $zero -/* 0D6834 8031B834 03201825 */ move $v1, $t9 -/* 0D6838 8031B838 93390000 */ lbu $t9, ($t9) -/* 0D683C 8031B83C 00073200 */ sll $a2, $a3, 8 -/* 0D6840 8031B840 30CF7F00 */ andi $t7, $a2, 0x7f00 -/* 0D6844 8031B844 032F3025 */ or $a2, $t9, $t7 -/* 0D6848 8031B848 30C7FFFF */ andi $a3, $a2, 0xffff -/* 0D684C 8031B84C 24780001 */ addiu $t8, $v1, 1 -/* 0D6850 8031B850 AC580000 */ sw $t8, ($v0) -/* 0D6854 8031B854 00E03025 */ move $a2, $a3 -.L8031B858: -/* 0D6858 8031B858 8C430000 */ lw $v1, ($v0) -/* 0D685C 8031B85C 30CAFFFF */ andi $t2, $a2, 0xffff -/* 0D6860 8031B860 01402025 */ move $a0, $t2 -/* 0D6864 8031B864 906B0000 */ lbu $t3, ($v1) -/* 0D6868 8031B868 246F0001 */ addiu $t7, $v1, 1 -/* 0D686C 8031B86C AC4F0000 */ sw $t7, ($v0) -/* 0D6870 8031B870 A2000002 */ sb $zero, 2($s0) -/* 0D6874 8031B874 1000000E */ b .L8031B8B0 -/* 0D6878 8031B878 A607003A */ sh $a3, 0x3a($s0) -.L8031B87C: -/* 0D687C 8031B87C 8C430000 */ lw $v1, ($v0) -/* 0D6880 8031B880 960A003A */ lhu $t2, 0x3a($s0) -/* 0D6884 8031B884 906B0000 */ lbu $t3, ($v1) -/* 0D6888 8031B888 24790001 */ addiu $t9, $v1, 1 -/* 0D688C 8031B88C AC590000 */ sw $t9, ($v0) -/* 0D6890 8031B890 93380000 */ lbu $t8, ($t9) -/* 0D6894 8031B894 01402025 */ move $a0, $t2 -/* 0D6898 8031B898 A2180002 */ sb $t8, 2($s0) -/* 0D689C 8031B89C 8C4F0000 */ lw $t7, ($v0) -/* 0D68A0 8031B8A0 25F90001 */ addiu $t9, $t7, 1 -/* 0D68A4 8031B8A4 10000002 */ b .L8031B8B0 -/* 0D68A8 8031B8A8 AC590000 */ sw $t9, ($v0) -.L8031B8AC: -/* 0D68AC 8031B8AC 8FAB0030 */ lw $t3, 0x30($sp) -.L8031B8B0: -/* 0D68B0 8031B8B0 016B0019 */ multu $t3, $t3 -/* 0D68B4 8031B8B4 00A91823 */ subu $v1, $a1, $t1 -/* 0D68B8 8031B8B8 00007012 */ mflo $t6 -/* 0D68BC 8031B8BC 448E5000 */ mtc1 $t6, $f10 -/* 0D68C0 8031B8C0 00000000 */ nop -/* 0D68C4 8031B8C4 46805420 */ cvt.s.w $f16, $f10 -/* 0D68C8 8031B8C8 10000024 */ b .L8031B95C -/* 0D68CC 8031B8CC E6100024 */ swc1 $f16, 0x24($s0) -.L8031B8D0: -/* 0D68D0 8031B8D0 11200008 */ beqz $t1, .L8031B8F4 -/* 0D68D4 8031B8D4 26020054 */ addiu $v0, $s0, 0x54 -/* 0D68D8 8031B8D8 24010040 */ li $at, 64 -/* 0D68DC 8031B8DC 11210019 */ beq $t1, $at, .L8031B944 -/* 0D68E0 8031B8E0 24010080 */ li $at, 128 -/* 0D68E4 8031B8E4 5121001B */ beql $t1, $at, .L8031B954 -/* 0D68E8 8031B8E8 960A003A */ lhu $t2, 0x3a($s0) -/* 0D68EC 8031B8EC 1000001A */ b .L8031B958 -/* 0D68F0 8031B8F0 01402025 */ move $a0, $t2 -.L8031B8F4: -/* 0D68F4 8031B8F4 8C430000 */ lw $v1, ($v0) -/* 0D68F8 8031B8F8 90660000 */ lbu $a2, ($v1) -/* 0D68FC 8031B8FC 24780001 */ addiu $t8, $v1, 1 -/* 0D6900 8031B900 AC580000 */ sw $t8, ($v0) -/* 0D6904 8031B904 30CF0080 */ andi $t7, $a2, 0x80 -/* 0D6908 8031B908 11E0000A */ beqz $t7, .L8031B934 -/* 0D690C 8031B90C 00C03825 */ or $a3, $a2, $zero -/* 0D6910 8031B910 03001825 */ move $v1, $t8 -/* 0D6914 8031B914 93180000 */ lbu $t8, ($t8) -/* 0D6918 8031B918 00073200 */ sll $a2, $a3, 8 -/* 0D691C 8031B91C 30CE7F00 */ andi $t6, $a2, 0x7f00 -/* 0D6920 8031B920 030E3025 */ or $a2, $t8, $t6 -/* 0D6924 8031B924 30C7FFFF */ andi $a3, $a2, 0xffff -/* 0D6928 8031B928 24790001 */ addiu $t9, $v1, 1 -/* 0D692C 8031B92C AC590000 */ sw $t9, ($v0) -/* 0D6930 8031B930 00E03025 */ move $a2, $a3 -.L8031B934: -/* 0D6934 8031B934 30CAFFFF */ andi $t2, $a2, 0xffff -/* 0D6938 8031B938 A607003A */ sh $a3, 0x3a($s0) -/* 0D693C 8031B93C 10000006 */ b .L8031B958 -/* 0D6940 8031B940 01402025 */ move $a0, $t2 -.L8031B944: -/* 0D6944 8031B944 960A0038 */ lhu $t2, 0x38($s0) -/* 0D6948 8031B948 10000003 */ b .L8031B958 -/* 0D694C 8031B94C 01402025 */ move $a0, $t2 -/* 0D6950 8031B950 960A003A */ lhu $t2, 0x3a($s0) -.L8031B954: -/* 0D6954 8031B954 01402025 */ move $a0, $t2 -.L8031B958: -/* 0D6958 8031B958 00A91823 */ subu $v1, $a1, $t1 -.L8031B95C: -/* 0D695C 8031B95C 920E0002 */ lbu $t6, 2($s0) -/* 0D6960 8031B960 A604003C */ sh $a0, 0x3c($s0) -/* 0D6964 8031B964 01C40019 */ multu $t6, $a0 -/* 0D6968 8031B968 0000C012 */ mflo $t8 -/* 0D696C 8031B96C 07010003 */ bgez $t8, .L8031B97C -/* 0D6970 8031B970 00187A03 */ sra $t7, $t8, 8 -/* 0D6974 8031B974 270100FF */ addiu $at, $t8, 0xff -/* 0D6978 8031B978 00017A03 */ sra $t7, $at, 8 -.L8031B97C: -/* 0D697C 8031B97C A60F003E */ sh $t7, 0x3e($s0) -/* 0D6980 8031B980 8D990000 */ lw $t9, ($t4) -/* 0D6984 8031B984 0019C080 */ sll $t8, $t9, 2 -/* 0D6988 8031B988 07030006 */ bgezl $t8, .L8031B9A4 -/* 0D698C 8031B98C 8DA20000 */ lw $v0, ($t5) -/* 0D6990 8031B990 91AF0002 */ lbu $t7, 2($t5) -/* 0D6994 8031B994 31F90040 */ andi $t9, $t7, 0x40 -/* 0D6998 8031B998 57200008 */ bnezl $t9, .L8031B9BC -/* 0D699C 8031B99C 92180000 */ lbu $t8, ($s0) -/* 0D69A0 8031B9A0 8DA20000 */ lw $v0, ($t5) -.L8031B9A4: -/* 0D69A4 8031B9A4 0002C0C0 */ sll $t8, $v0, 3 -/* 0D69A8 8031B9A8 07000003 */ bltz $t8, .L8031B9B8 -/* 0D69AC 8031B9AC 0002C900 */ sll $t9, $v0, 4 -/* 0D69B0 8031B9B0 07220006 */ bltzl $t9, .L8031B9CC -/* 0D69B4 8031B9B4 85B90018 */ lh $t9, 0x18($t5) -.L8031B9B8: -/* 0D69B8 8031B9B8 92180000 */ lbu $t8, ($s0) -.L8031B9BC: -/* 0D69BC 8031B9BC 370F0020 */ ori $t7, $t8, 0x20 -/* 0D69C0 8031B9C0 100000FE */ b .L8031BDBC -/* 0D69C4 8031B9C4 A20F0000 */ sb $t7, ($s0) -/* 0D69C8 8031B9C8 85B90018 */ lh $t9, 0x18($t5) -.L8031B9CC: -/* 0D69CC 8031B9CC 5720003B */ bnezl $t9, .L8031BABC -/* 0D69D0 8031B9D0 85980010 */ lh $t8, 0x10($t4) -/* 0D69D4 8031B9D4 85B8001A */ lh $t8, 0x1a($t5) -/* 0D69D8 8031B9D8 8619001E */ lh $t9, 0x1e($s0) -/* 0D69DC 8031B9DC 00787821 */ addu $t7, $v1, $t8 -/* 0D69E0 8031B9E0 01F94021 */ addu $t0, $t7, $t9 -/* 0D69E4 8031B9E4 91AF0005 */ lbu $t7, 5($t5) -/* 0D69E8 8031B9E8 8FF80000 */ lw $t8, ($ra) -/* 0D69EC 8031B9EC 310E00FF */ andi $t6, $t0, 0xff -/* 0D69F0 8031B9F0 000FC880 */ sll $t9, $t7, 2 -/* 0D69F4 8031B9F4 032FC823 */ subu $t9, $t9, $t7 -/* 0D69F8 8031B9F8 0019C880 */ sll $t9, $t9, 2 -/* 0D69FC 8031B9FC 03193821 */ addu $a3, $t8, $t9 -/* 0D6A00 8031BA00 90E20002 */ lbu $v0, 2($a3) -/* 0D6A04 8031BA04 01C04025 */ move $t0, $t6 -/* 0D6A08 8031BA08 01C2082A */ slt $at, $t6, $v0 -/* 0D6A0C 8031BA0C 5420000C */ bnezl $at, .L8031BA40 -/* 0D6A10 8031BA10 8CEE0008 */ lw $t6, 8($a3) -/* 0D6A14 8031BA14 304800FF */ andi $t0, $v0, 0xff -/* 0D6A18 8031BA18 55000006 */ bnezl $t0, .L8031BA34 -/* 0D6A1C 8031BA1C 2508FFFF */ addiu $t0, $t0, -1 -/* 0D6A20 8031BA20 920F0000 */ lbu $t7, ($s0) -/* 0D6A24 8031BA24 35F80020 */ ori $t8, $t7, 0x20 -/* 0D6A28 8031BA28 100000E2 */ b .L8031BDB4 -/* 0D6A2C 8031BA2C A2180000 */ sb $t8, ($s0) -/* 0D6A30 8031BA30 2508FFFF */ addiu $t0, $t0, -1 -.L8031BA34: -/* 0D6A34 8031BA34 311900FF */ andi $t9, $t0, 0xff -/* 0D6A38 8031BA38 03204025 */ move $t0, $t9 -/* 0D6A3C 8031BA3C 8CEE0008 */ lw $t6, 8($a3) -.L8031BA40: -/* 0D6A40 8031BA40 00087880 */ sll $t7, $t0, 2 -/* 0D6A44 8031BA44 01CFC021 */ addu $t8, $t6, $t7 -/* 0D6A48 8031BA48 8F020000 */ lw $v0, ($t8) -/* 0D6A4C 8031BA4C 54400006 */ bnezl $v0, .L8031BA68 -/* 0D6A50 8031BA50 8C58000C */ lw $t8, 0xc($v0) -/* 0D6A54 8031BA54 920E0000 */ lbu $t6, ($s0) -/* 0D6A58 8031BA58 35CF0020 */ ori $t7, $t6, 0x20 -/* 0D6A5C 8031BA5C 100000D5 */ b .L8031BDB4 -/* 0D6A60 8031BA60 A20F0000 */ sb $t7, ($s0) -/* 0D6A64 8031BA64 8C58000C */ lw $t8, 0xc($v0) -.L8031BA68: -/* 0D6A68 8031BA68 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 0D6A6C 8031BA6C AE180018 */ sw $t8, 0x18($s0) -/* 0D6A70 8031BA70 90590000 */ lbu $t9, ($v0) -/* 0D6A74 8031BA74 A2190014 */ sb $t9, 0x14($s0) -/* 0D6A78 8031BA78 904E0001 */ lbu $t6, 1($v0) -/* 0D6A7C 8031BA7C 448E9000 */ mtc1 $t6, $f18 -/* 0D6A80 8031BA80 05C10004 */ bgez $t6, .L8031BA94 -/* 0D6A84 8031BA84 46809120 */ cvt.s.w $f4, $f18 -/* 0D6A88 8031BA88 44813000 */ mtc1 $at, $f6 -/* 0D6A8C 8031BA8C 00000000 */ nop -/* 0D6A90 8031BA90 46062100 */ add.s $f4, $f4, $f6 -.L8031BA94: -/* 0D6A94 8031BA94 46002221 */ cvt.d.s $f8, $f4 -/* 0D6A98 8031BA98 24430004 */ addiu $v1, $v0, 4 -/* 0D6A9C 8031BA9C 46204282 */ mul.d $f10, $f8, $f0 -/* 0D6AA0 8031BAA0 AE03004C */ sw $v1, 0x4c($s0) -/* 0D6AA4 8031BAA4 46205420 */ cvt.s.d $f16, $f10 -/* 0D6AA8 8031BAA8 E6100028 */ swc1 $f16, 0x28($s0) -/* 0D6AAC 8031BAAC C4720004 */ lwc1 $f18, 4($v1) -/* 0D6AB0 8031BAB0 100000C0 */ b .L8031BDB4 -/* 0D6AB4 8031BAB4 E6120020 */ swc1 $f18, 0x20($s0) -/* 0D6AB8 8031BAB8 85980010 */ lh $t8, 0x10($t4) -.L8031BABC: -/* 0D6ABC 8031BABC 85AE001A */ lh $t6, 0x1a($t5) -/* 0D6AC0 8031BAC0 0078C821 */ addu $t9, $v1, $t8 -/* 0D6AC4 8031BAC4 8618001E */ lh $t8, 0x1e($s0) -/* 0D6AC8 8031BAC8 032E7821 */ addu $t7, $t9, $t6 -/* 0D6ACC 8031BACC 01F84021 */ addu $t0, $t7, $t8 -/* 0D6AD0 8031BAD0 310200FF */ andi $v0, $t0, 0xff -/* 0D6AD4 8031BAD4 28410080 */ slti $at, $v0, 0x80 -/* 0D6AD8 8031BAD8 14200005 */ bnez $at, .L8031BAF0 -/* 0D6ADC 8031BADC 00404025 */ move $t0, $v0 -/* 0D6AE0 8031BAE0 920F0000 */ lbu $t7, ($s0) -/* 0D6AE4 8031BAE4 35F80020 */ ori $t8, $t7, 0x20 -/* 0D6AE8 8031BAE8 100000B2 */ b .L8031BDB4 -/* 0D6AEC 8031BAEC A2180000 */ sb $t8, ($s0) -.L8031BAF0: -/* 0D6AF0 8031BAF0 8E030048 */ lw $v1, 0x48($s0) -/* 0D6AF4 8031BAF4 54600003 */ bnezl $v1, .L8031BB04 -/* 0D6AF8 8031BAF8 92190004 */ lbu $t9, 4($s0) -/* 0D6AFC 8031BAFC 8DA3003C */ lw $v1, 0x3c($t5) -/* 0D6B00 8031BB00 92190004 */ lbu $t9, 4($s0) -.L8031BB04: -/* 0D6B04 8031BB04 13200088 */ beqz $t9, .L8031BD28 -/* 0D6B08 8031BB08 00000000 */ nop -/* 0D6B0C 8031BB0C 92040003 */ lbu $a0, 3($s0) -/* 0D6B10 8031BB10 0082082A */ slt $at, $a0, $v0 -/* 0D6B14 8031BB14 10200003 */ beqz $at, .L8031BB24 -/* 0D6B18 8031BB18 00802825 */ move $a1, $a0 -/* 0D6B1C 8031BB1C 10000001 */ b .L8031BB24 -/* 0D6B20 8031BB20 00402825 */ move $a1, $v0 -.L8031BB24: -/* 0D6B24 8031BB24 10600017 */ beqz $v1, .L8031BB84 -/* 0D6B28 8031BB28 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 0D6B2C 8031BB2C 906E0001 */ lbu $t6, 1($v1) -/* 0D6B30 8031BB30 30A200FF */ andi $v0, $a1, 0xff -/* 0D6B34 8031BB34 004E082A */ slt $at, $v0, $t6 -/* 0D6B38 8031BB38 50200004 */ beql $at, $zero, .L8031BB4C -/* 0D6B3C 8031BB3C 906F0002 */ lbu $t7, 2($v1) -/* 0D6B40 8031BB40 10000009 */ b .L8031BB68 -/* 0D6B44 8031BB44 24620008 */ addiu $v0, $v1, 8 -/* 0D6B48 8031BB48 906F0002 */ lbu $t7, 2($v1) -.L8031BB4C: -/* 0D6B4C 8031BB4C 24640018 */ addiu $a0, $v1, 0x18 -/* 0D6B50 8031BB50 01E2082A */ slt $at, $t7, $v0 -/* 0D6B54 8031BB54 14200003 */ bnez $at, .L8031BB64 -/* 0D6B58 8031BB58 00000000 */ nop -/* 0D6B5C 8031BB5C 10000001 */ b .L8031BB64 -/* 0D6B60 8031BB60 24640010 */ addiu $a0, $v1, 0x10 -.L8031BB64: -/* 0D6B64 8031BB64 00801025 */ move $v0, $a0 -.L8031BB68: -/* 0D6B68 8031BB68 8E18004C */ lw $t8, 0x4c($s0) -/* 0D6B6C 8031BB6C 0058C826 */ xor $t9, $v0, $t8 -/* 0D6B70 8031BB70 2F390001 */ sltiu $t9, $t9, 1 -/* 0D6B74 8031BB74 A3B9003F */ sb $t9, 0x3f($sp) -/* 0D6B78 8031BB78 AE02004C */ sw $v0, 0x4c($s0) -/* 0D6B7C 8031BB7C 10000003 */ b .L8031BB8C -/* 0D6B80 8031BB80 C4400004 */ lwc1 $f0, 4($v0) -.L8031BB84: -/* 0D6B84 8031BB84 44810000 */ mtc1 $at, $f0 -/* 0D6B88 8031BB88 AE00004C */ sw $zero, 0x4c($s0) -.L8031BB8C: -/* 0D6B8C 8031BB8C 3C038033 */ lui $v1, %hi(gNoteFrequencies) -/* 0D6B90 8031BB90 24632884 */ addiu $v1, %lo(gNoteFrequencies) # addiu $v1, $v1, 0x2884 -/* 0D6B94 8031BB94 00087080 */ sll $t6, $t0, 2 -/* 0D6B98 8031BB98 92180003 */ lbu $t8, 3($s0) -/* 0D6B9C 8031BB9C 006E7821 */ addu $t7, $v1, $t6 -/* 0D6BA0 8031BBA0 C5E60000 */ lwc1 $f6, ($t7) -/* 0D6BA4 8031BBA4 920F0004 */ lbu $t7, 4($s0) -/* 0D6BA8 8031BBA8 0018C880 */ sll $t9, $t8, 2 -/* 0D6BAC 8031BBAC 00797021 */ addu $t6, $v1, $t9 -/* 0D6BB0 8031BBB0 C5C40000 */ lwc1 $f4, ($t6) -/* 0D6BB4 8031BBB4 46003082 */ mul.s $f2, $f6, $f0 -/* 0D6BB8 8031BBB8 2401FF7F */ li $at, -129 -/* 0D6BBC 8031BBBC 01E1C024 */ and $t8, $t7, $at -/* 0D6BC0 8031BBC0 2719FFFF */ addiu $t9, $t8, -1 -/* 0D6BC4 8031BBC4 2F210005 */ sltiu $at, $t9, 5 -/* 0D6BC8 8031BBC8 46002302 */ mul.s $f12, $f4, $f0 -/* 0D6BCC 8031BBCC 1020000C */ beqz $at, .L8031BC00 -/* 0D6BD0 8031BBD0 0019C880 */ sll $t9, $t9, 2 -/* 0D6BD4 8031BBD4 3C018033 */ lui $at, %hi(jtbl_80337CDC) -/* 0D6BD8 8031BBD8 00390821 */ addu $at, $at, $t9 -/* 0D6BDC 8031BBDC 8C397CDC */ lw $t9, %lo(jtbl_80337CDC)($at) -/* 0D6BE0 8031BBE0 03200008 */ jr $t9 -/* 0D6BE4 8031BBE4 00000000 */ nop -glabel L8031BBE8 -/* 0D6BE8 8031BBE8 E7A20024 */ swc1 $f2, 0x24($sp) -/* 0D6BEC 8031BBEC 10000005 */ b .L8031BC04 -/* 0D6BF0 8031BBF0 46006006 */ mov.s $f0, $f12 -glabel L8031BBF4 -/* 0D6BF4 8031BBF4 46001006 */ mov.s $f0, $f2 -/* 0D6BF8 8031BBF8 10000002 */ b .L8031BC04 -/* 0D6BFC 8031BBFC E7AC0024 */ swc1 $f12, 0x24($sp) -.L8031BC00: -/* 0D6C00 8031BC00 C7A00028 */ lwc1 $f0, 0x28($sp) -.L8031BC04: -/* 0D6C04 8031BC04 C7A80024 */ lwc1 $f8, 0x24($sp) -/* 0D6C08 8031BC08 3C013FF0 */ li $at, 0x3FF00000 # 1.875000 -/* 0D6C0C 8031BC0C 44819800 */ mtc1 $at, $f19 -/* 0D6C10 8031BC10 46004283 */ div.s $f10, $f8, $f0 -/* 0D6C14 8031BC14 44809000 */ mtc1 $zero, $f18 -/* 0D6C18 8031BC18 26020004 */ addiu $v0, $s0, 4 -/* 0D6C1C 8031BC1C 46005421 */ cvt.d.s $f16, $f10 -/* 0D6C20 8031BC20 46328181 */ sub.d $f6, $f16, $f18 -/* 0D6C24 8031BC24 46203120 */ cvt.s.d $f4, $f6 -/* 0D6C28 8031BC28 E444000C */ swc1 $f4, 0xc($v0) -/* 0D6C2C 8031BC2C 920E0004 */ lbu $t6, 4($s0) -/* 0D6C30 8031BC30 31CF0080 */ andi $t7, $t6, 0x80 -/* 0D6C34 8031BC34 11E00023 */ beqz $t7, .L8031BCC4 -/* 0D6C38 8031BC38 3C0E8022 */ lui $t6, %hi(gTempoInternalToExternal) -/* 0D6C3C 8031BC3C 9598000A */ lhu $t8, 0xa($t4) -/* 0D6C40 8031BC40 3C018033 */ lui $at, %hi(D_80337CF0) -/* 0D6C44 8031BC44 D4287CF0 */ ldc1 $f8, %lo(D_80337CF0)($at) -/* 0D6C48 8031BC48 44985000 */ mtc1 $t8, $f10 -/* 0D6C4C 8031BC4C 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 0D6C50 8031BC50 07010004 */ bgez $t8, .L8031BC64 -/* 0D6C54 8031BC54 46805420 */ cvt.s.w $f16, $f10 -/* 0D6C58 8031BC58 44819000 */ mtc1 $at, $f18 -/* 0D6C5C 8031BC5C 00000000 */ nop -/* 0D6C60 8031BC60 46128400 */ add.s $f16, $f16, $f18 -.L8031BC64: -/* 0D6C64 8031BC64 8619003C */ lh $t9, 0x3c($s0) -/* 0D6C68 8031BC68 85CE6D7C */ lh $t6, %lo(gTempoInternalToExternal)($t6) -/* 0D6C6C 8031BC6C 460081A1 */ cvt.d.s $f6, $f16 -/* 0D6C70 8031BC70 44995000 */ mtc1 $t9, $f10 -/* 0D6C74 8031BC74 448E8000 */ mtc1 $t6, $f16 -/* 0D6C78 8031BC78 46264102 */ mul.d $f4, $f8, $f6 -/* 0D6C7C 8031BC7C 960F001C */ lhu $t7, 0x1c($s0) -/* 0D6C80 8031BC80 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 0D6C84 8031BC84 468054A0 */ cvt.s.w $f18, $f10 -/* 0D6C88 8031BC88 448F5000 */ mtc1 $t7, $f10 -/* 0D6C8C 8031BC8C 46808220 */ cvt.s.w $f8, $f16 -/* 0D6C90 8031BC90 46805420 */ cvt.s.w $f16, $f10 -/* 0D6C94 8031BC94 46089182 */ mul.s $f6, $f18, $f8 -/* 0D6C98 8031BC98 05E10004 */ bgez $t7, .L8031BCAC -/* 0D6C9C 8031BC9C 00000000 */ nop -/* 0D6CA0 8031BCA0 44819000 */ mtc1 $at, $f18 -/* 0D6CA4 8031BCA4 00000000 */ nop -/* 0D6CA8 8031BCA8 46128400 */ add.s $f16, $f16, $f18 -.L8031BCAC: -/* 0D6CAC 8031BCAC 46068202 */ mul.s $f8, $f16, $f6 -/* 0D6CB0 8031BCB0 460042A1 */ cvt.d.s $f10, $f8 -/* 0D6CB4 8031BCB4 462A2483 */ div.d $f18, $f4, $f10 -/* 0D6CB8 8031BCB8 46209420 */ cvt.s.d $f16, $f18 -/* 0D6CBC 8031BCBC 1000000F */ b .L8031BCFC -/* 0D6CC0 8031BCC0 E4500008 */ swc1 $f16, 8($v0) -.L8031BCC4: -/* 0D6CC4 8031BCC4 9618001C */ lhu $t8, 0x1c($s0) -/* 0D6CC8 8031BCC8 3C018033 */ lui $at, %hi(D_80337CF8) -/* 0D6CCC 8031BCCC D4267CF8 */ ldc1 $f6, %lo(D_80337CF8)($at) -/* 0D6CD0 8031BCD0 44984000 */ mtc1 $t8, $f8 -/* 0D6CD4 8031BCD4 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 0D6CD8 8031BCD8 07010004 */ bgez $t8, .L8031BCEC -/* 0D6CDC 8031BCDC 46804120 */ cvt.s.w $f4, $f8 -/* 0D6CE0 8031BCE0 44815000 */ mtc1 $at, $f10 -/* 0D6CE4 8031BCE4 00000000 */ nop -/* 0D6CE8 8031BCE8 460A2100 */ add.s $f4, $f4, $f10 -.L8031BCEC: -/* 0D6CEC 8031BCEC 460024A1 */ cvt.d.s $f18, $f4 -/* 0D6CF0 8031BCF0 46323403 */ div.d $f16, $f6, $f18 -/* 0D6CF4 8031BCF4 46208220 */ cvt.s.d $f8, $f16 -/* 0D6CF8 8031BCF8 E4480008 */ swc1 $f8, 8($v0) -.L8031BCFC: -/* 0D6CFC 8031BCFC 44805000 */ mtc1 $zero, $f10 -/* 0D6D00 8031BD00 2401FF7F */ li $at, -129 -/* 0D6D04 8031BD04 E44A0004 */ swc1 $f10, 4($v0) -/* 0D6D08 8031BD08 92190004 */ lbu $t9, 4($s0) -/* 0D6D0C 8031BD0C E6000020 */ swc1 $f0, 0x20($s0) -/* 0D6D10 8031BD10 03217024 */ and $t6, $t9, $at -/* 0D6D14 8031BD14 24010005 */ li $at, 5 -/* 0D6D18 8031BD18 55C10027 */ bnel $t6, $at, .L8031BDB8 -/* 0D6D1C 8031BD1C 860F003C */ lh $t7, 0x3c($s0) -/* 0D6D20 8031BD20 10000024 */ b .L8031BDB4 -/* 0D6D24 8031BD24 A2080003 */ sb $t0, 3($s0) -.L8031BD28: -/* 0D6D28 8031BD28 1060001C */ beqz $v1, .L8031BD9C -/* 0D6D2C 8031BD2C 0008C880 */ sll $t9, $t0, 2 -/* 0D6D30 8031BD30 906F0001 */ lbu $t7, 1($v1) -/* 0D6D34 8031BD34 004F082A */ slt $at, $v0, $t7 -/* 0D6D38 8031BD38 10200003 */ beqz $at, .L8031BD48 -/* 0D6D3C 8031BD3C 00087880 */ sll $t7, $t0, 2 -/* 0D6D40 8031BD40 10000009 */ b .L8031BD68 -/* 0D6D44 8031BD44 24620008 */ addiu $v0, $v1, 8 -.L8031BD48: -/* 0D6D48 8031BD48 90780002 */ lbu $t8, 2($v1) -/* 0D6D4C 8031BD4C 24640018 */ addiu $a0, $v1, 0x18 -/* 0D6D50 8031BD50 0302082A */ slt $at, $t8, $v0 -/* 0D6D54 8031BD54 14200003 */ bnez $at, .L8031BD64 -/* 0D6D58 8031BD58 00000000 */ nop -/* 0D6D5C 8031BD5C 10000001 */ b .L8031BD64 -/* 0D6D60 8031BD60 24640010 */ addiu $a0, $v1, 0x10 -.L8031BD64: -/* 0D6D64 8031BD64 00801025 */ move $v0, $a0 -.L8031BD68: -/* 0D6D68 8031BD68 8E19004C */ lw $t9, 0x4c($s0) -/* 0D6D6C 8031BD6C 3C038033 */ lui $v1, %hi(gNoteFrequencies) # $v1, 0x8033 -/* 0D6D70 8031BD70 24632884 */ addiu $v1, %lo(gNoteFrequencies) # addiu $v1, $v1, 0x2884 -/* 0D6D74 8031BD74 00597026 */ xor $t6, $v0, $t9 -/* 0D6D78 8031BD78 2DCE0001 */ sltiu $t6, $t6, 1 -/* 0D6D7C 8031BD7C A3AE003F */ sb $t6, 0x3f($sp) -/* 0D6D80 8031BD80 AE02004C */ sw $v0, 0x4c($s0) -/* 0D6D84 8031BD84 006FC021 */ addu $t8, $v1, $t7 -/* 0D6D88 8031BD88 C7060000 */ lwc1 $f6, ($t8) -/* 0D6D8C 8031BD8C C4440004 */ lwc1 $f4, 4($v0) -/* 0D6D90 8031BD90 46062482 */ mul.s $f18, $f4, $f6 -/* 0D6D94 8031BD94 10000007 */ b .L8031BDB4 -/* 0D6D98 8031BD98 E6120020 */ swc1 $f18, 0x20($s0) -.L8031BD9C: -/* 0D6D9C 8031BD9C 3C038033 */ lui $v1, %hi(gNoteFrequencies) # $v1, 0x8033 -/* 0D6DA0 8031BDA0 24632884 */ addiu $v1, %lo(gNoteFrequencies) # addiu $v1, $v1, 0x2884 -/* 0D6DA4 8031BDA4 AE00004C */ sw $zero, 0x4c($s0) -/* 0D6DA8 8031BDA8 00797021 */ addu $t6, $v1, $t9 -/* 0D6DAC 8031BDAC C5D00000 */ lwc1 $f16, ($t6) -/* 0D6DB0 8031BDB0 E6100020 */ swc1 $f16, 0x20($s0) -.L8031BDB4: -/* 0D6DB4 8031BDB4 860F003C */ lh $t7, 0x3c($s0) -.L8031BDB8: -/* 0D6DB8 8031BDB8 A60F0040 */ sh $t7, 0x40($s0) -.L8031BDBC: -/* 0D6DBC 8031BDBC 8E020000 */ lw $v0, ($s0) -/* 0D6DC0 8031BDC0 24010001 */ li $at, 1 -/* 0D6DC4 8031BDC4 0002C080 */ sll $t8, $v0, 2 -/* 0D6DC8 8031BDC8 0018CFC2 */ srl $t9, $t8, 0x1f -/* 0D6DCC 8031BDCC 5721000C */ bnel $t9, $at, .L8031BE00 -/* 0D6DD0 8031BDD0 000270C0 */ sll $t6, $v0, 3 -/* 0D6DD4 8031BDD4 8E0E0044 */ lw $t6, 0x44($s0) -/* 0D6DD8 8031BDD8 0002C0C0 */ sll $t8, $v0, 3 -/* 0D6DDC 8031BDDC 15C00003 */ bnez $t6, .L8031BDEC -/* 0D6DE0 8031BDE0 00000000 */ nop -/* 0D6DE4 8031BDE4 0703002E */ bgezl $t8, .L8031BEA0 -/* 0D6DE8 8031BDE8 8FBF001C */ lw $ra, 0x1c($sp) -.L8031BDEC: -/* 0D6DEC 8031BDEC 0C0C63B1 */ jal seq_channel_layer_note_decay -/* 0D6DF0 8031BDF0 02002025 */ move $a0, $s0 -/* 0D6DF4 8031BDF4 1000002A */ b .L8031BEA0 -/* 0D6DF8 8031BDF8 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D6DFC 8031BDFC 000270C0 */ sll $t6, $v0, 3 -.L8031BE00: -/* 0D6E00 8031BE00 05C00003 */ bltz $t6, .L8031BE10 -/* 0D6E04 8031BE04 00004025 */ move $t0, $zero -/* 0D6E08 8031BE08 10000017 */ b .L8031BE68 -/* 0D6E0C 8031BE0C 24080001 */ li $t0, 1 -.L8031BE10: -/* 0D6E10 8031BE10 8E040044 */ lw $a0, 0x44($s0) -/* 0D6E14 8031BE14 10800005 */ beqz $a0, .L8031BE2C -/* 0D6E18 8031BE18 00000000 */ nop -/* 0D6E1C 8031BE1C 920F0001 */ lbu $t7, 1($s0) -/* 0D6E20 8031BE20 93B8003F */ lbu $t8, 0x3f($sp) -/* 0D6E24 8031BE24 15E00003 */ bnez $t7, .L8031BE34 -/* 0D6E28 8031BE28 00000000 */ nop -.L8031BE2C: -/* 0D6E2C 8031BE2C 1000000E */ b .L8031BE68 -/* 0D6E30 8031BE30 24080001 */ li $t0, 1 -.L8031BE34: -/* 0D6E34 8031BE34 57000006 */ bnezl $t8, .L8031BE50 -/* 0D6E38 8031BE38 8E19004C */ lw $t9, 0x4c($s0) -/* 0D6E3C 8031BE3C 0C0C63B1 */ jal seq_channel_layer_note_decay -/* 0D6E40 8031BE40 02002025 */ move $a0, $s0 -/* 0D6E44 8031BE44 10000008 */ b .L8031BE68 -/* 0D6E48 8031BE48 24080001 */ li $t0, 1 -/* 0D6E4C 8031BE4C 8E19004C */ lw $t9, 0x4c($s0) -.L8031BE50: -/* 0D6E50 8031BE50 02002825 */ move $a1, $s0 -/* 0D6E54 8031BE54 17200004 */ bnez $t9, .L8031BE68 -/* 0D6E58 8031BE58 00000000 */ nop -/* 0D6E5C 8031BE5C 0C0C6459 */ jal init_synthetic_wave -/* 0D6E60 8031BE60 A3A8003D */ sb $t0, 0x3d($sp) -/* 0D6E64 8031BE64 93A8003D */ lbu $t0, 0x3d($sp) -.L8031BE68: -/* 0D6E68 8031BE68 51000005 */ beql $t0, $zero, .L8031BE80 -/* 0D6E6C 8031BE6C 8E040044 */ lw $a0, 0x44($s0) -/* 0D6E70 8031BE70 0C0C6638 */ jal alloc_note -/* 0D6E74 8031BE74 02002025 */ move $a0, $s0 -/* 0D6E78 8031BE78 AE020044 */ sw $v0, 0x44($s0) -/* 0D6E7C 8031BE7C 8E040044 */ lw $a0, 0x44($s0) -.L8031BE80: -/* 0D6E80 8031BE80 50800007 */ beql $a0, $zero, .L8031BEA0 -/* 0D6E84 8031BE84 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D6E88 8031BE88 8C8E002C */ lw $t6, 0x2c($a0) -/* 0D6E8C 8031BE8C 560E0004 */ bnel $s0, $t6, .L8031BEA0 -/* 0D6E90 8031BE90 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D6E94 8031BE94 0C0C691E */ jal note_vibrato_init -/* 0D6E98 8031BE98 00000000 */ nop -.L8031BE9C: -/* 0D6E9C 8031BE9C 8FBF001C */ lw $ra, 0x1c($sp) -.L8031BEA0: -/* 0D6EA0 8031BEA0 8FB00018 */ lw $s0, 0x18($sp) -/* 0D6EA4 8031BEA4 27BD0060 */ addiu $sp, $sp, 0x60 -/* 0D6EA8 8031BEA8 03E00008 */ jr $ra -/* 0D6EAC 8031BEAC 00000000 */ nop diff --git a/asm/non_matchings/seq_channel_layer_process_script_us.s b/asm/non_matchings/seq_channel_layer_process_script_us.s deleted file mode 100644 index fd64cbd0..00000000 --- a/asm/non_matchings/seq_channel_layer_process_script_us.s +++ /dev/null @@ -1,999 +0,0 @@ -.late_rodata -glabel jtbl_80337C90 - .word L8031C2DC - .word L8031C298 - .word L8031C6A0 - .word L8031C6A0 - .word L8031C328 - .word L8031C23C - .word L8031C6A0 - .word L8031C6A0 - .word L8031C200 - -glabel jtbl_80337CB4 - .word L8031C36C - .word L8031C3BC - .word L8031C454 - .word L8031C3E8 - .word L8031C3E8 - .word L8031C4A4 - .word L8031C5C8 - .word L8031C698 - .word L8031C3BC - .word L8031C36C - -glabel jtbl_80337CDC - .word L8031CBE0 - .word L8031CBEC - .word L8031CBE0 - .word L8031CBEC - .word L8031CBE0 - -.text -glabel seq_channel_layer_process_script -/* 0D70C4 8031C0C4 27BDFFA0 */ addiu $sp, $sp, -0x60 -/* 0D70C8 8031C0C8 240E0001 */ li $t6, 1 -/* 0D70CC 8031C0CC AFBF001C */ sw $ra, 0x1c($sp) -/* 0D70D0 8031C0D0 AFB00018 */ sw $s0, 0x18($sp) -/* 0D70D4 8031C0D4 A3AE003F */ sb $t6, 0x3f($sp) -/* 0D70D8 8031C0D8 8C820000 */ lw $v0, ($a0) -/* 0D70DC 8031C0DC 00808025 */ move $s0, $a0 -/* 0D70E0 8031C0E0 00027FC2 */ srl $t7, $v0, 0x1f -/* 0D70E4 8031C0E4 51E00357 */ beql $t7, $zero, .L8031CE44 -/* 0D70E8 8031C0E8 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D70EC 8031C0EC 8483003C */ lh $v1, 0x3c($a0) -/* 0D70F0 8031C0F0 00027080 */ sll $t6, $v0, 2 -/* 0D70F4 8031C0F4 0002C8C0 */ sll $t9, $v0, 3 -/* 0D70F8 8031C0F8 28610002 */ slti $at, $v1, 2 -/* 0D70FC 8031C0FC 1420000E */ bnez $at, .L8031C138 -/* 0D7100 8031C100 2478FFFF */ addiu $t8, $v1, -1 -/* 0D7104 8031C104 05C0034E */ bltz $t6, .L8031CE40 -/* 0D7108 8031C108 A498003C */ sh $t8, 0x3c($a0) -/* 0D710C 8031C10C 848F003E */ lh $t7, 0x3e($a0) -/* 0D7110 8031C110 8498003C */ lh $t8, 0x3c($a0) -/* 0D7114 8031C114 01F8082A */ slt $at, $t7, $t8 -/* 0D7118 8031C118 5420034A */ bnezl $at, .L8031CE44 -/* 0D711C 8031C11C 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D7120 8031C120 0C0C67D9 */ jal seq_channel_layer_note_decay -/* 0D7124 8031C124 00000000 */ nop -/* 0D7128 8031C128 920E0000 */ lbu $t6, ($s0) -/* 0D712C 8031C12C 35CF0020 */ ori $t7, $t6, 0x20 -/* 0D7130 8031C130 10000343 */ b .L8031CE40 -/* 0D7134 8031C134 A20F0000 */ sb $t7, ($s0) -.L8031C138: -/* 0D7138 8031C138 07220004 */ bltzl $t9, .L8031C14C_2 -/* 0D713C 8031C13C 92020004 */ lbu $v0, 4($s0) -/* 0D7140 8031C140 0C0C67D9 */ jal seq_channel_layer_note_decay -/* 0D7144 8031C144 02002025 */ move $a0, $s0 -/* 0D7148 8031C148 92020004 */ lbu $v0, 4($s0) -.L8031C14C_2: -/* 0D714C 8031C14C 2401FF7F */ li $at, -129 -/* 0D7150 8031C150 3C1F8022 */ lui $ra, %hi(gCtlEntries) # $ra, 0x8022 -/* 0D7154 8031C154 00417024 */ and $t6, $v0, $at -/* 0D7158 8031C158 24010001 */ li $at, 1 -/* 0D715C 8031C15C 11C10004 */ beq $t6, $at, .L8031C170 -/* 0D7160 8031C160 27FF6B60 */ addiu $ra, %lo(gCtlEntries) # addiu $ra, $ra, 0x6b60 -/* 0D7164 8031C164 24010002 */ li $at, 2 -/* 0D7168 8031C168 55C10003 */ bnel $t6, $at, .L8031C178 -/* 0D716C 8031C16C 8E0D0050 */ lw $t5, 0x50($s0) -.L8031C170: -/* 0D7170 8031C170 A2000004 */ sb $zero, 4($s0) -/* 0D7174 8031C174 8E0D0050 */ lw $t5, 0x50($s0) -.L8031C178: -/* 0D7178 8031C178 3C013C00 */ li $at, 0x3C000000 # 0.007812 -/* 0D717C 8031C17C 3C0B8022 */ lui $t3, %hi(gBankLoadedPool) # $t3, 0x8022 -/* 0D7180 8031C180 44810000 */ mtc1 $at, $f0 -/* 0D7184 8031C184 256B10F8 */ addiu $t3, %lo(gBankLoadedPool) # addiu $t3, $t3, 0x10f8 -/* 0D7188 8031C188 97AA003A */ lhu $t2, 0x3a($sp) -/* 0D718C 8031C18C 240900FF */ li $t1, 255 -/* 0D7190 8031C190 8DAC0040 */ lw $t4, 0x40($t5) -.L8031C194: -/* 0D7194 8031C194 8E020054 */ lw $v0, 0x54($s0) -.L8031C198: -/* 0D7198 8031C198 244F0001 */ addiu $t7, $v0, 1 -/* 0D719C 8031C19C AE0F0054 */ sw $t7, 0x54($s0) -/* 0D71A0 8031C1A0 90440000 */ lbu $a0, ($v0) -/* 0D71A4 8031C1A4 288100C1 */ slti $at, $a0, 0xc1 -/* 0D71A8 8031C1A8 14200156 */ bnez $at, .L8031C704 -/* 0D71AC 8031C1AC 00802825 */ move $a1, $a0 -/* 0D71B0 8031C1B0 288100CB */ slti $at, $a0, 0xcb -/* 0D71B4 8031C1B4 1420000A */ bnez $at, .L8031C1E0 -/* 0D71B8 8031C1B8 24B9FF3F */ addiu $t9, $a1, -0xc1 -/* 0D71BC 8031C1BC 2498FF09 */ addiu $t8, $a0, -0xf7 -/* 0D71C0 8031C1C0 2F010009 */ sltiu $at, $t8, 9 -/* 0D71C4 8031C1C4 10200136 */ beqz $at, .L8031C6A0 -/* 0D71C8 8031C1C8 0018C080 */ sll $t8, $t8, 2 -/* 0D71CC 8031C1CC 3C018034 */ lui $at, %hi(jtbl_80337C90) -/* 0D71D0 8031C1D0 00380821 */ addu $at, $at, $t8 -/* 0D71D4 8031C1D4 8C388E60 */ lw $t8, %lo(jtbl_80337C90)($at) -/* 0D71D8 8031C1D8 03000008 */ jr $t8 -/* 0D71DC 8031C1DC 00000000 */ nop -.L8031C1E0: -/* 0D71E0 8031C1E0 2F21000A */ sltiu $at, $t9, 0xa -/* 0D71E4 8031C1E4 1020012E */ beqz $at, .L8031C6A0 -/* 0D71E8 8031C1E8 0019C880 */ sll $t9, $t9, 2 -/* 0D71EC 8031C1EC 3C018034 */ lui $at, %hi(jtbl_80337CB4) -/* 0D71F0 8031C1F0 00390821 */ addu $at, $at, $t9 -/* 0D71F4 8031C1F4 8C398E84 */ lw $t9, %lo(jtbl_80337CB4)($at) -/* 0D71F8 8031C1F8 03200008 */ jr $t9 -/* 0D71FC 8031C1FC 00000000 */ nop -glabel L8031C200 -/* 0D7200 8031C200 26020054 */ addiu $v0, $s0, 0x54 -/* 0D7204 8031C204 90430018 */ lbu $v1, 0x18($v0) -/* 0D7208 8031C208 14600005 */ bnez $v1, .L8031C220 -/* 0D720C 8031C20C 246EFFFF */ addiu $t6, $v1, -1 -/* 0D7210 8031C210 0C0C6E8C */ jal seq_channel_layer_disable -/* 0D7214 8031C214 02002025 */ move $a0, $s0 -/* 0D7218 8031C218 1000030A */ b .L8031CE44 -/* 0D721C 8031C21C 8FBF001C */ lw $ra, 0x1c($sp) -.L8031C220: -/* 0D7220 8031C220 31CF00FF */ andi $t7, $t6, 0xff -/* 0D7224 8031C224 000FC080 */ sll $t8, $t7, 2 -/* 0D7228 8031C228 0058C821 */ addu $t9, $v0, $t8 -/* 0D722C 8031C22C A04E0018 */ sb $t6, 0x18($v0) -/* 0D7230 8031C230 8F2E0004 */ lw $t6, 4($t9) -/* 0D7234 8031C234 1000FFD7 */ b .L8031C194 -/* 0D7238 8031C238 AC4E0000 */ sw $t6, ($v0) -glabel L8031C23C -/* 0D723C 8031C23C 26020054 */ addiu $v0, $s0, 0x54 -/* 0D7240 8031C240 8C430000 */ lw $v1, ($v0) -/* 0D7244 8031C244 90640000 */ lbu $a0, ($v1) -/* 0D7248 8031C248 246E0001 */ addiu $t6, $v1, 1 -/* 0D724C 8031C24C AC4E0000 */ sw $t6, ($v0) -/* 0D7250 8031C250 91CF0000 */ lbu $t7, ($t6) -/* 0D7254 8031C254 0004CA00 */ sll $t9, $a0, 8 -/* 0D7258 8031C258 01F92825 */ or $a1, $t7, $t9 -/* 0D725C 8031C25C 904F0018 */ lbu $t7, 0x18($v0) -/* 0D7260 8031C260 25D90001 */ addiu $t9, $t6, 1 -/* 0D7264 8031C264 AC590000 */ sw $t9, ($v0) -/* 0D7268 8031C268 25F80001 */ addiu $t8, $t7, 1 -/* 0D726C 8031C26C 330E00FF */ andi $t6, $t8, 0xff -/* 0D7270 8031C270 000E7880 */ sll $t7, $t6, 2 -/* 0D7274 8031C274 A0580018 */ sb $t8, 0x18($v0) -/* 0D7278 8031C278 004FC021 */ addu $t8, $v0, $t7 -/* 0D727C 8031C27C AF190000 */ sw $t9, ($t8) -/* 0D7280 8031C280 8D8E0014 */ lw $t6, 0x14($t4) -/* 0D7284 8031C284 30AFFFFF */ andi $t7, $a1, 0xffff -/* 0D7288 8031C288 30AAFFFF */ andi $t2, $a1, 0xffff -/* 0D728C 8031C28C 01CFC821 */ addu $t9, $t6, $t7 -/* 0D7290 8031C290 1000FFC0 */ b .L8031C194 -/* 0D7294 8031C294 AC590000 */ sw $t9, ($v0) -glabel L8031C298 -/* 0D7298 8031C298 26020054 */ addiu $v0, $s0, 0x54 -/* 0D729C 8031C29C 8C430000 */ lw $v1, ($v0) -/* 0D72A0 8031C2A0 904E0018 */ lbu $t6, 0x18($v0) -/* 0D72A4 8031C2A4 24780001 */ addiu $t8, $v1, 1 -/* 0D72A8 8031C2A8 AC580000 */ sw $t8, ($v0) -/* 0D72AC 8031C2AC 90650000 */ lbu $a1, ($v1) -/* 0D72B0 8031C2B0 004E7821 */ addu $t7, $v0, $t6 -/* 0D72B4 8031C2B4 A1E50014 */ sb $a1, 0x14($t7) -/* 0D72B8 8031C2B8 90590018 */ lbu $t9, 0x18($v0) -/* 0D72BC 8031C2BC 8C4E0000 */ lw $t6, ($v0) -/* 0D72C0 8031C2C0 27380001 */ addiu $t8, $t9, 1 -/* 0D72C4 8031C2C4 330F00FF */ andi $t7, $t8, 0xff -/* 0D72C8 8031C2C8 000FC880 */ sll $t9, $t7, 2 -/* 0D72CC 8031C2CC A0580018 */ sb $t8, 0x18($v0) -/* 0D72D0 8031C2D0 0059C021 */ addu $t8, $v0, $t9 -/* 0D72D4 8031C2D4 1000FFAF */ b .L8031C194 -/* 0D72D8 8031C2D8 AF0E0000 */ sw $t6, ($t8) -glabel L8031C2DC -/* 0D72DC 8031C2DC 26020054 */ addiu $v0, $s0, 0x54 -/* 0D72E0 8031C2E0 904F0018 */ lbu $t7, 0x18($v0) -/* 0D72E4 8031C2E4 004F2021 */ addu $a0, $v0, $t7 -/* 0D72E8 8031C2E8 90990013 */ lbu $t9, 0x13($a0) -/* 0D72EC 8031C2EC 272EFFFF */ addiu $t6, $t9, -1 -/* 0D72F0 8031C2F0 A08E0013 */ sb $t6, 0x13($a0) -/* 0D72F4 8031C2F4 90430018 */ lbu $v1, 0x18($v0) -/* 0D72F8 8031C2F8 0043C021 */ addu $t8, $v0, $v1 -/* 0D72FC 8031C2FC 930F0013 */ lbu $t7, 0x13($t8) -/* 0D7300 8031C300 00602825 */ move $a1, $v1 -/* 0D7304 8031C304 0005C880 */ sll $t9, $a1, 2 -/* 0D7308 8031C308 11E00004 */ beqz $t7, .L8031C31C -/* 0D730C 8031C30C 00597021 */ addu $t6, $v0, $t9 -/* 0D7310 8031C310 8DD80000 */ lw $t8, ($t6) -/* 0D7314 8031C314 1000FF9F */ b .L8031C194 -/* 0D7318 8031C318 AC580000 */ sw $t8, ($v0) -.L8031C31C: -/* 0D731C 8031C31C 246FFFFF */ addiu $t7, $v1, -1 -/* 0D7320 8031C320 1000FF9C */ b .L8031C194 -/* 0D7324 8031C324 A04F0018 */ sb $t7, 0x18($v0) -glabel L8031C328 -/* 0D7328 8031C328 26020054 */ addiu $v0, $s0, 0x54 -/* 0D732C 8031C32C 8C430000 */ lw $v1, ($v0) -/* 0D7330 8031C330 90640000 */ lbu $a0, ($v1) -/* 0D7334 8031C334 246F0001 */ addiu $t7, $v1, 1 -/* 0D7338 8031C338 AC4F0000 */ sw $t7, ($v0) -/* 0D733C 8031C33C 91F90000 */ lbu $t9, ($t7) -/* 0D7340 8031C340 0004C200 */ sll $t8, $a0, 8 -/* 0D7344 8031C344 25EF0001 */ addiu $t7, $t7, 1 -/* 0D7348 8031C348 03387025 */ or $t6, $t9, $t8 -/* 0D734C 8031C34C AC4F0000 */ sw $t7, ($v0) -/* 0D7350 8031C350 8D990014 */ lw $t9, 0x14($t4) -/* 0D7354 8031C354 01C0C025 */ move $t8, $t6 -/* 0D7358 8031C358 330AFFFF */ andi $t2, $t8, 0xffff -/* 0D735C 8031C35C 330EFFFF */ andi $t6, $t8, 0xffff -/* 0D7360 8031C360 032EC021 */ addu $t8, $t9, $t6 -/* 0D7364 8031C364 1000FF8B */ b .L8031C194 -/* 0D7368 8031C368 AC580000 */ sw $t8, ($v0) -glabel L8031C36C -/* 0D736C 8031C36C 26020054 */ addiu $v0, $s0, 0x54 -/* 0D7370 8031C370 8C430000 */ lw $v1, ($v0) -/* 0D7374 8031C374 240100C1 */ li $at, 193 -/* 0D7378 8031C378 90640000 */ lbu $a0, ($v1) -/* 0D737C 8031C37C 246F0001 */ addiu $t7, $v1, 1 -/* 0D7380 8031C380 14A10008 */ bne $a1, $at, .L8031C3A4 -/* 0D7384 8031C384 AC4F0000 */ sw $t7, ($v0) -/* 0D7388 8031C388 00840019 */ multu $a0, $a0 -/* 0D738C 8031C38C 0000C812 */ mflo $t9 -/* 0D7390 8031C390 44992000 */ mtc1 $t9, $f4 -/* 0D7394 8031C394 00000000 */ nop -/* 0D7398 8031C398 468021A0 */ cvt.s.w $f6, $f4 -/* 0D739C 8031C39C 1000FF7D */ b .L8031C194 -/* 0D73A0 8031C3A0 E6060024 */ swc1 $f6, 0x24($s0) -.L8031C3A4: -/* 0D73A4 8031C3A4 44844000 */ mtc1 $a0, $f8 -/* 0D73A8 8031C3A8 00000000 */ nop -/* 0D73AC 8031C3AC 468042A0 */ cvt.s.w $f10, $f8 -/* 0D73B0 8031C3B0 46005402 */ mul.s $f16, $f10, $f0 -/* 0D73B4 8031C3B4 1000FF77 */ b .L8031C194 -/* 0D73B8 8031C3B8 E6100028 */ swc1 $f16, 0x28($s0) -glabel L8031C3BC -/* 0D73BC 8031C3BC 26020054 */ addiu $v0, $s0, 0x54 -/* 0D73C0 8031C3C0 8C430000 */ lw $v1, ($v0) -/* 0D73C4 8031C3C4 240100C9 */ li $at, 201 -/* 0D73C8 8031C3C8 90640000 */ lbu $a0, ($v1) -/* 0D73CC 8031C3CC 246E0001 */ addiu $t6, $v1, 1 -/* 0D73D0 8031C3D0 14A10003 */ bne $a1, $at, .L8031C3E0 -/* 0D73D4 8031C3D4 AC4E0000 */ sw $t6, ($v0) -/* 0D73D8 8031C3D8 1000FF6E */ b .L8031C194 -/* 0D73DC 8031C3DC A2040002 */ sb $a0, 2($s0) -.L8031C3E0: -/* 0D73E0 8031C3E0 1000FF6C */ b .L8031C194 -/* 0D73E4 8031C3E4 A604001E */ sh $a0, 0x1e($s0) -glabel L8031C3E8 -/* 0D73E8 8031C3E8 240100C4 */ li $at, 196 -/* 0D73EC 8031C3EC 14A10003 */ bne $a1, $at, .L8031C3FC -/* 0D73F0 8031C3F0 02002025 */ move $a0, $s0 -/* 0D73F4 8031C3F4 10000002 */ b .L8031C400 -/* 0D73F8 8031C3F8 24020001 */ li $v0, 1 -.L8031C3FC: -/* 0D73FC 8031C3FC 00001025 */ move $v0, $zero -.L8031C400: -/* 0D7400 8031C400 920E0000 */ lbu $t6, ($s0) -/* 0D7404 8031C404 00027900 */ sll $t7, $v0, 4 -/* 0D7408 8031C408 31F90010 */ andi $t9, $t7, 0x10 -/* 0D740C 8031C40C 31D8FFEF */ andi $t8, $t6, 0xffef -/* 0D7410 8031C410 03387825 */ or $t7, $t9, $t8 -/* 0D7414 8031C414 A20F0000 */ sb $t7, ($s0) -/* 0D7418 8031C418 AFAD0058 */ sw $t5, 0x58($sp) -/* 0D741C 8031C41C AFAC005C */ sw $t4, 0x5c($sp) -/* 0D7420 8031C420 0C0C67D9 */ jal seq_channel_layer_note_decay -/* 0D7424 8031C424 A7AA003A */ sh $t2, 0x3a($sp) -/* 0D7428 8031C428 3C013C00 */ li $at, 0x3C000000 # 0.007812 -/* 0D742C 8031C42C 44810000 */ mtc1 $at, $f0 -/* 0D7430 8031C430 3C0B8022 */ lui $t3, %hi(gBankLoadedPool) # $t3, 0x8022 -/* 0D7434 8031C434 3C1F8022 */ lui $ra, %hi(gCtlEntries) # $ra, 0x8022 -/* 0D7438 8031C438 27FF6B60 */ addiu $ra, %lo(gCtlEntries) # addiu $ra, $ra, 0x6b60 -/* 0D743C 8031C43C 256B10F8 */ addiu $t3, %lo(gBankLoadedPool) # addiu $t3, $t3, 0x10f8 -/* 0D7440 8031C440 240900FF */ li $t1, 255 -/* 0D7444 8031C444 97AA003A */ lhu $t2, 0x3a($sp) -/* 0D7448 8031C448 8FAC005C */ lw $t4, 0x5c($sp) -/* 0D744C 8031C44C 1000FF51 */ b .L8031C194 -/* 0D7450 8031C450 8FAD0058 */ lw $t5, 0x58($sp) -glabel L8031C454 -/* 0D7454 8031C454 26020054 */ addiu $v0, $s0, 0x54 -/* 0D7458 8031C458 8C430000 */ lw $v1, ($v0) -/* 0D745C 8031C45C 90640000 */ lbu $a0, ($v1) -/* 0D7460 8031C460 246E0001 */ addiu $t6, $v1, 1 -/* 0D7464 8031C464 AC4E0000 */ sw $t6, ($v0) -/* 0D7468 8031C468 30990080 */ andi $t9, $a0, 0x80 -/* 0D746C 8031C46C 1320000A */ beqz $t9, .L8031C498 -/* 0D7470 8031C470 00802825 */ move $a1, $a0 -/* 0D7474 8031C474 01C01825 */ move $v1, $t6 -/* 0D7478 8031C478 91CE0000 */ lbu $t6, ($t6) -/* 0D747C 8031C47C 00052200 */ sll $a0, $a1, 8 -/* 0D7480 8031C480 308F7F00 */ andi $t7, $a0, 0x7f00 -/* 0D7484 8031C484 01CF2025 */ or $a0, $t6, $t7 -/* 0D7488 8031C488 3085FFFF */ andi $a1, $a0, 0xffff -/* 0D748C 8031C48C 24780001 */ addiu $t8, $v1, 1 -/* 0D7490 8031C490 AC580000 */ sw $t8, ($v0) -/* 0D7494 8031C494 00A02025 */ move $a0, $a1 -.L8031C498: -/* 0D7498 8031C498 308AFFFF */ andi $t2, $a0, 0xffff -/* 0D749C 8031C49C 1000FF3D */ b .L8031C194 -/* 0D74A0 8031C4A0 A6050038 */ sh $a1, 0x38($s0) -glabel L8031C4A4 -/* 0D74A4 8031C4A4 26020054 */ addiu $v0, $s0, 0x54 -/* 0D74A8 8031C4A8 8C430000 */ lw $v1, ($v0) -/* 0D74AC 8031C4AC 246F0001 */ addiu $t7, $v1, 1 -/* 0D74B0 8031C4B0 AC4F0000 */ sw $t7, ($v0) -/* 0D74B4 8031C4B4 90650000 */ lbu $a1, ($v1) -/* 0D74B8 8031C4B8 28A1007F */ slti $at, $a1, 0x7f -/* 0D74BC 8031C4BC 5020FF36 */ beql $at, $zero, .L8031C198 -/* 0D74C0 8031C4C0 8E020054 */ lw $v0, 0x54($s0) -/* 0D74C4 8031C4C4 91B90005 */ lbu $t9, 5($t5) -/* 0D74C8 8031C4C8 8FEE0000 */ lw $t6, ($ra) -/* 0D74CC 8031C4CC 30A200FF */ andi $v0, $a1, 0xff -/* 0D74D0 8031C4D0 0019C080 */ sll $t8, $t9, 2 -/* 0D74D4 8031C4D4 0319C023 */ subu $t8, $t8, $t9 -/* 0D74D8 8031C4D8 0018C080 */ sll $t8, $t8, 2 -/* 0D74DC 8031C4DC 01D83821 */ addu $a3, $t6, $t8 -/* 0D74E0 8031C4E0 90E30001 */ lbu $v1, 1($a3) -/* 0D74E4 8031C4E4 00A3082A */ slt $at, $a1, $v1 -/* 0D74E8 8031C4E8 54200008 */ bnezl $at, .L8031C50C -/* 0D74EC 8031C4EC 8CE30004 */ lw $v1, 4($a3) -/* 0D74F0 8031C4F0 306200FF */ andi $v0, $v1, 0xff -/* 0D74F4 8031C4F4 5040FF28 */ beql $v0, $zero, .L8031C198 -/* 0D74F8 8031C4F8 8E020054 */ lw $v0, 0x54($s0) -/* 0D74FC 8031C4FC 2442FFFF */ addiu $v0, $v0, -1 -/* 0D7500 8031C500 304F00FF */ andi $t7, $v0, 0xff -/* 0D7504 8031C504 01E01025 */ move $v0, $t7 -/* 0D7508 8031C508 8CE30004 */ lw $v1, 4($a3) -.L8031C50C: -/* 0D750C 8031C50C 0002C880 */ sll $t9, $v0, 2 -/* 0D7510 8031C510 26050048 */ addiu $a1, $s0, 0x48 -/* 0D7514 8031C514 00797021 */ addu $t6, $v1, $t9 -/* 0D7518 8031C518 8DC40000 */ lw $a0, ($t6) -/* 0D751C 8031C51C 5480000C */ bnezl $a0, .L8031C550 -/* 0D7520 8031C520 8D630004 */ lw $v1, 4($t3) -/* 0D7524 8031C524 11220009 */ beq $t1, $v0, .L8031C54C -.L8031C528: -/* 0D7528 8031C528 0002C080 */ sll $t8, $v0, 2 -/* 0D752C 8031C52C 00787821 */ addu $t7, $v1, $t8 -/* 0D7530 8031C530 8DE40000 */ lw $a0, ($t7) -/* 0D7534 8031C534 54800006 */ bnezl $a0, .L8031C550 -/* 0D7538 8031C538 8D630004 */ lw $v1, 4($t3) -/* 0D753C 8031C53C 2442FFFF */ addiu $v0, $v0, -1 -/* 0D7540 8031C540 305900FF */ andi $t9, $v0, 0xff -/* 0D7544 8031C544 1539FFF8 */ bne $t1, $t9, .L8031C528 -/* 0D7548 8031C548 03201025 */ move $v0, $t9 -.L8031C54C: -/* 0D754C 8031C54C 8D630004 */ lw $v1, 4($t3) -.L8031C550: -/* 0D7550 8031C550 0083082B */ sltu $at, $a0, $v1 -/* 0D7554 8031C554 54200007 */ bnezl $at, .L8031C574 -/* 0D7558 8031C558 8D630198 */ lw $v1, 0x198($t3) -/* 0D755C 8031C55C 8D6E000C */ lw $t6, 0xc($t3) -/* 0D7560 8031C560 006EC021 */ addu $t8, $v1, $t6 -/* 0D7564 8031C564 0304082B */ sltu $at, $t8, $a0 -/* 0D7568 8031C568 5020000B */ beql $at, $zero, .L8031C598 -/* 0D756C 8031C56C 8C8E0004 */ lw $t6, 4($a0) -/* 0D7570 8031C570 8D630198 */ lw $v1, 0x198($t3) -.L8031C574: -/* 0D7574 8031C574 0083082B */ sltu $at, $a0, $v1 -/* 0D7578 8031C578 5420000E */ bnezl $at, .L8031C5B4 -/* 0D757C 8031C57C 3C010002 */ lui $at, 2 -/* 0D7580 8031C580 8D6F01A0 */ lw $t7, 0x1a0($t3) -/* 0D7584 8031C584 006FC821 */ addu $t9, $v1, $t7 -/* 0D7588 8031C588 0324082B */ sltu $at, $t9, $a0 -/* 0D758C 8031C58C 54200009 */ bnezl $at, .L8031C5B4 -/* 0D7590 8031C590 3C010002 */ lui $at, 2 -/* 0D7594 8031C594 8C8E0004 */ lw $t6, 4($a0) -.L8031C598: -/* 0D7598 8031C598 26020014 */ addiu $v0, $s0, 0x14 -/* 0D759C 8031C59C AC4E0004 */ sw $t6, 4($v0) -/* 0D75A0 8031C5A0 90980003 */ lbu $t8, 3($a0) -/* 0D75A4 8031C5A4 A0580000 */ sb $t8, ($v0) -/* 0D75A8 8031C5A8 1000FEFA */ b .L8031C194 -/* 0D75AC 8031C5AC ACA40000 */ sw $a0, ($a1) -/* 0D75B0 8031C5B0 3C010002 */ lui $at, 2 -.L8031C5B4: -/* 0D75B4 8031C5B4 00417821 */ addu $t7, $v0, $at -/* 0D75B8 8031C5B8 3C018033 */ lui $at, %hi(gAudioErrorFlags) # $at, 0x8033 -/* 0D75BC 8031C5BC AC2F2E50 */ sw $t7, %lo(gAudioErrorFlags)($at) -/* 0D75C0 8031C5C0 1000FEF4 */ b .L8031C194 -/* 0D75C4 8031C5C4 ACA00000 */ sw $zero, ($a1) -glabel L8031C5C8 -/* 0D75C8 8031C5C8 26020054 */ addiu $v0, $s0, 0x54 -/* 0D75CC 8031C5CC 8C430000 */ lw $v1, ($v0) -/* 0D75D0 8031C5D0 24790001 */ addiu $t9, $v1, 1 -/* 0D75D4 8031C5D4 AC590000 */ sw $t9, ($v0) -/* 0D75D8 8031C5D8 90650000 */ lbu $a1, ($v1) -/* 0D75DC 8031C5DC A2050004 */ sb $a1, 4($s0) -/* 0D75E0 8031C5E0 8C430000 */ lw $v1, ($v0) -/* 0D75E4 8031C5E4 246E0001 */ addiu $t6, $v1, 1 -/* 0D75E8 8031C5E8 AC4E0000 */ sw $t6, ($v0) -/* 0D75EC 8031C5EC 85B8001A */ lh $t8, 0x1a($t5) -/* 0D75F0 8031C5F0 90670000 */ lbu $a3, ($v1) -/* 0D75F4 8031C5F4 8619001E */ lh $t9, 0x1e($s0) -/* 0D75F8 8031C5F8 03077821 */ addu $t7, $t8, $a3 -/* 0D75FC 8031C5FC 85980010 */ lh $t8, 0x10($t4) -/* 0D7600 8031C600 01F97021 */ addu $t6, $t7, $t9 -/* 0D7604 8031C604 01D84021 */ addu $t0, $t6, $t8 -/* 0D7608 8031C608 310F00FF */ andi $t7, $t0, 0xff -/* 0D760C 8031C60C 29E10080 */ slti $at, $t7, 0x80 -/* 0D7610 8031C610 14200002 */ bnez $at, .L8031C61C -/* 0D7614 8031C614 01E04025 */ move $t0, $t7 -/* 0D7618 8031C618 00004025 */ move $t0, $zero -.L8031C61C: -/* 0D761C 8031C61C 92190004 */ lbu $t9, 4($s0) -/* 0D7620 8031C620 A2080003 */ sb $t0, 3($s0) -/* 0D7624 8031C624 332E0080 */ andi $t6, $t9, 0x80 -/* 0D7628 8031C628 51C00009 */ beql $t6, $zero, .L8031C650 -/* 0D762C 8031C62C 8C430000 */ lw $v1, ($v0) -/* 0D7630 8031C630 8C580000 */ lw $t8, ($v0) -/* 0D7634 8031C634 930F0000 */ lbu $t7, ($t8) -/* 0D7638 8031C638 A60F001C */ sh $t7, 0x1c($s0) -/* 0D763C 8031C63C 8C590000 */ lw $t9, ($v0) -/* 0D7640 8031C640 272E0001 */ addiu $t6, $t9, 1 -/* 0D7644 8031C644 1000FED3 */ b .L8031C194 -/* 0D7648 8031C648 AC4E0000 */ sw $t6, ($v0) -/* 0D764C 8031C64C 8C430000 */ lw $v1, ($v0) -.L8031C650: -/* 0D7650 8031C650 90640000 */ lbu $a0, ($v1) -/* 0D7654 8031C654 24780001 */ addiu $t8, $v1, 1 -/* 0D7658 8031C658 AC580000 */ sw $t8, ($v0) -/* 0D765C 8031C65C 308F0080 */ andi $t7, $a0, 0x80 -/* 0D7660 8031C660 11E0000A */ beqz $t7, .L8031C68C -/* 0D7664 8031C664 00802825 */ move $a1, $a0 -/* 0D7668 8031C668 03001825 */ move $v1, $t8 -/* 0D766C 8031C66C 93180000 */ lbu $t8, ($t8) -/* 0D7670 8031C670 00052200 */ sll $a0, $a1, 8 -/* 0D7674 8031C674 308E7F00 */ andi $t6, $a0, 0x7f00 -/* 0D7678 8031C678 030E2025 */ or $a0, $t8, $t6 -/* 0D767C 8031C67C 308FFFFF */ andi $t7, $a0, 0xffff -/* 0D7680 8031C680 24790001 */ addiu $t9, $v1, 1 -/* 0D7684 8031C684 AC590000 */ sw $t9, ($v0) -/* 0D7688 8031C688 01E02025 */ move $a0, $t7 -.L8031C68C: -/* 0D768C 8031C68C 308AFFFF */ andi $t2, $a0, 0xffff -/* 0D7690 8031C690 1000FEC0 */ b .L8031C194 -/* 0D7694 8031C694 A604001C */ sh $a0, 0x1c($s0) -glabel L8031C698 -/* 0D7698 8031C698 1000FEBE */ b .L8031C194 -/* 0D769C 8031C69C A2000004 */ sb $zero, 4($s0) -glabel L8031C6A0 -.L8031C6A0: -/* 0D76A0 8031C6A0 30A200F0 */ andi $v0, $a1, 0xf0 -/* 0D76A4 8031C6A4 240100D0 */ li $at, 208 -/* 0D76A8 8031C6A8 10410005 */ beq $v0, $at, .L8031C6C0 -/* 0D76AC 8031C6AC 240100E0 */ li $at, 224 -/* 0D76B0 8031C6B0 5041000F */ beql $v0, $at, .L8031C6F0 -/* 0D76B4 8031C6B4 8D8E008C */ lw $t6, 0x8c($t4) -/* 0D76B8 8031C6B8 1000FEB7 */ b .L8031C198 -/* 0D76BC 8031C6BC 8E020054 */ lw $v0, 0x54($s0) -.L8031C6C0: -/* 0D76C0 8031C6C0 8D8E0088 */ lw $t6, 0x88($t4) -/* 0D76C4 8031C6C4 30B8000F */ andi $t8, $a1, 0xf -/* 0D76C8 8031C6C8 01D87821 */ addu $t7, $t6, $t8 -/* 0D76CC 8031C6CC 91EA0000 */ lbu $t2, ($t7) -/* 0D76D0 8031C6D0 014A0019 */ multu $t2, $t2 -/* 0D76D4 8031C6D4 0000C812 */ mflo $t9 -/* 0D76D8 8031C6D8 44999000 */ mtc1 $t9, $f18 -/* 0D76DC 8031C6DC 00000000 */ nop -/* 0D76E0 8031C6E0 46809120 */ cvt.s.w $f4, $f18 -/* 0D76E4 8031C6E4 1000FEAB */ b .L8031C194 -/* 0D76E8 8031C6E8 E6040024 */ swc1 $f4, 0x24($s0) -/* 0D76EC 8031C6EC 8D8E008C */ lw $t6, 0x8c($t4) -.L8031C6F0: -/* 0D76F0 8031C6F0 30B8000F */ andi $t8, $a1, 0xf -/* 0D76F4 8031C6F4 01D87821 */ addu $t7, $t6, $t8 -/* 0D76F8 8031C6F8 91F90000 */ lbu $t9, ($t7) -/* 0D76FC 8031C6FC 1000FEA5 */ b .L8031C194 -/* 0D7700 8031C700 A2190002 */ sb $t9, 2($s0) -.L8031C704: -/* 0D7704 8031C704 240100C0 */ li $at, 192 -/* 0D7708 8031C708 14A10015 */ bne $a1, $at, .L8031C760 -/* 0D770C 8031C70C 26020054 */ addiu $v0, $s0, 0x54 -/* 0D7710 8031C710 8C430000 */ lw $v1, ($v0) -/* 0D7714 8031C714 90640000 */ lbu $a0, ($v1) -/* 0D7718 8031C718 246E0001 */ addiu $t6, $v1, 1 -/* 0D771C 8031C71C AC4E0000 */ sw $t6, ($v0) -/* 0D7720 8031C720 30980080 */ andi $t8, $a0, 0x80 -/* 0D7724 8031C724 13000009 */ beqz $t8, .L8031C74C -/* 0D7728 8031C728 00802825 */ move $a1, $a0 -/* 0D772C 8031C72C 01C01825 */ move $v1, $t6 -/* 0D7730 8031C730 91CE0000 */ lbu $t6, ($t6) -/* 0D7734 8031C734 00042200 */ sll $a0, $a0, 8 -/* 0D7738 8031C738 30997F00 */ andi $t9, $a0, 0x7f00 -/* 0D773C 8031C73C 246F0001 */ addiu $t7, $v1, 1 -/* 0D7740 8031C740 01D92025 */ or $a0, $t6, $t9 -/* 0D7744 8031C744 3085FFFF */ andi $a1, $a0, 0xffff -/* 0D7748 8031C748 AC4F0000 */ sw $t7, ($v0) -.L8031C74C: -/* 0D774C 8031C74C 920E0000 */ lbu $t6, ($s0) -/* 0D7750 8031C750 A605003C */ sh $a1, 0x3c($s0) -/* 0D7754 8031C754 35D80020 */ ori $t8, $t6, 0x20 -/* 0D7758 8031C758 10000181 */ b .L8031CD60 -/* 0D775C 8031C75C A2180000 */ sb $t8, ($s0) -.L8031C760: -/* 0D7760 8031C760 920F0000 */ lbu $t7, ($s0) -/* 0D7764 8031C764 24010001 */ li $at, 1 -/* 0D7768 8031C768 30A900C0 */ andi $t1, $a1, 0xc0 -/* 0D776C 8031C76C 31F9FFDF */ andi $t9, $t7, 0xffdf -/* 0D7770 8031C770 A2190000 */ sb $t9, ($s0) -/* 0D7774 8031C774 8DAE0000 */ lw $t6, ($t5) -/* 0D7778 8031C778 000EC180 */ sll $t8, $t6, 6 -/* 0D777C 8031C77C 00187FC2 */ srl $t7, $t8, 0x1f -/* 0D7780 8031C780 15E10057 */ bne $t7, $at, .L8031C8E0 -/* 0D7784 8031C784 00000000 */ nop -/* 0D7788 8031C788 30A900C0 */ andi $t1, $a1, 0xc0 -/* 0D778C 8031C78C 11200009 */ beqz $t1, .L8031C7B4 -/* 0D7790 8031C790 26020054 */ addiu $v0, $s0, 0x54 -/* 0D7794 8031C794 24010040 */ li $at, 64 -/* 0D7798 8031C798 11210023 */ beq $t1, $at, .L8031C828 -/* 0D779C 8031C79C 26020054 */ addiu $v0, $s0, 0x54 -/* 0D77A0 8031C7A0 24010080 */ li $at, 128 -/* 0D77A4 8031C7A4 11210039 */ beq $t1, $at, .L8031C88C -/* 0D77A8 8031C7A8 26020054 */ addiu $v0, $s0, 0x54 -/* 0D77AC 8031C7AC 10000043 */ b .L8031C8BC -/* 0D77B0 8031C7B0 01402025 */ move $a0, $t2 -.L8031C7B4: -/* 0D77B4 8031C7B4 8C430000 */ lw $v1, ($v0) -/* 0D77B8 8031C7B8 90660000 */ lbu $a2, ($v1) -/* 0D77BC 8031C7BC 24790001 */ addiu $t9, $v1, 1 -/* 0D77C0 8031C7C0 AC590000 */ sw $t9, ($v0) -/* 0D77C4 8031C7C4 30CE0080 */ andi $t6, $a2, 0x80 -/* 0D77C8 8031C7C8 11C0000A */ beqz $t6, .L8031C7F4 -/* 0D77CC 8031C7CC 00C03825 */ move $a3, $a2 -/* 0D77D0 8031C7D0 03201825 */ move $v1, $t9 -/* 0D77D4 8031C7D4 93390000 */ lbu $t9, ($t9) -/* 0D77D8 8031C7D8 00073200 */ sll $a2, $a3, 8 -/* 0D77DC 8031C7DC 30CF7F00 */ andi $t7, $a2, 0x7f00 -/* 0D77E0 8031C7E0 032F3025 */ or $a2, $t9, $t7 -/* 0D77E4 8031C7E4 30C7FFFF */ andi $a3, $a2, 0xffff -/* 0D77E8 8031C7E8 24780001 */ addiu $t8, $v1, 1 -/* 0D77EC 8031C7EC AC580000 */ sw $t8, ($v0) -/* 0D77F0 8031C7F0 00E03025 */ move $a2, $a3 -.L8031C7F4: -/* 0D77F4 8031C7F4 8C430000 */ lw $v1, ($v0) -/* 0D77F8 8031C7F8 30CAFFFF */ andi $t2, $a2, 0xffff -/* 0D77FC 8031C7FC 01402025 */ move $a0, $t2 -/* 0D7800 8031C800 906B0000 */ lbu $t3, ($v1) -/* 0D7804 8031C804 246F0001 */ addiu $t7, $v1, 1 -/* 0D7808 8031C808 AC4F0000 */ sw $t7, ($v0) -/* 0D780C 8031C80C 91EE0000 */ lbu $t6, ($t7) -/* 0D7810 8031C810 A20E0002 */ sb $t6, 2($s0) -/* 0D7814 8031C814 8C580000 */ lw $t8, ($v0) -/* 0D7818 8031C818 270F0001 */ addiu $t7, $t8, 1 -/* 0D781C 8031C81C AC4F0000 */ sw $t7, ($v0) -/* 0D7820 8031C820 10000027 */ b .L8031C8C0 -/* 0D7824 8031C824 A607003A */ sh $a3, 0x3a($s0) -.L8031C828: -/* 0D7828 8031C828 8C430000 */ lw $v1, ($v0) -/* 0D782C 8031C82C 90660000 */ lbu $a2, ($v1) -/* 0D7830 8031C830 24790001 */ addiu $t9, $v1, 1 -/* 0D7834 8031C834 AC590000 */ sw $t9, ($v0) -/* 0D7838 8031C838 30CE0080 */ andi $t6, $a2, 0x80 -/* 0D783C 8031C83C 11C0000A */ beqz $t6, .L8031C868 -/* 0D7840 8031C840 00C03825 */ move $a3, $a2 -/* 0D7844 8031C844 03201825 */ move $v1, $t9 -/* 0D7848 8031C848 93390000 */ lbu $t9, ($t9) -/* 0D784C 8031C84C 00073200 */ sll $a2, $a3, 8 -/* 0D7850 8031C850 30CF7F00 */ andi $t7, $a2, 0x7f00 -/* 0D7854 8031C854 032F3025 */ or $a2, $t9, $t7 -/* 0D7858 8031C858 30C7FFFF */ andi $a3, $a2, 0xffff -/* 0D785C 8031C85C 24780001 */ addiu $t8, $v1, 1 -/* 0D7860 8031C860 AC580000 */ sw $t8, ($v0) -/* 0D7864 8031C864 00E03025 */ move $a2, $a3 -.L8031C868: -/* 0D7868 8031C868 8C430000 */ lw $v1, ($v0) -/* 0D786C 8031C86C 30CAFFFF */ andi $t2, $a2, 0xffff -/* 0D7870 8031C870 01402025 */ move $a0, $t2 -/* 0D7874 8031C874 906B0000 */ lbu $t3, ($v1) -/* 0D7878 8031C878 246F0001 */ addiu $t7, $v1, 1 -/* 0D787C 8031C87C AC4F0000 */ sw $t7, ($v0) -/* 0D7880 8031C880 A2000002 */ sb $zero, 2($s0) -/* 0D7884 8031C884 1000000E */ b .L8031C8C0 -/* 0D7888 8031C888 A607003A */ sh $a3, 0x3a($s0) -.L8031C88C: -/* 0D788C 8031C88C 8C430000 */ lw $v1, ($v0) -/* 0D7890 8031C890 960A003A */ lhu $t2, 0x3a($s0) -/* 0D7894 8031C894 906B0000 */ lbu $t3, ($v1) -/* 0D7898 8031C898 24790001 */ addiu $t9, $v1, 1 -/* 0D789C 8031C89C AC590000 */ sw $t9, ($v0) -/* 0D78A0 8031C8A0 93380000 */ lbu $t8, ($t9) -/* 0D78A4 8031C8A4 01402025 */ move $a0, $t2 -/* 0D78A8 8031C8A8 A2180002 */ sb $t8, 2($s0) -/* 0D78AC 8031C8AC 8C4F0000 */ lw $t7, ($v0) -/* 0D78B0 8031C8B0 25F90001 */ addiu $t9, $t7, 1 -/* 0D78B4 8031C8B4 10000002 */ b .L8031C8C0 -/* 0D78B8 8031C8B8 AC590000 */ sw $t9, ($v0) -.L8031C8BC: -/* 0D78BC 8031C8BC 8FAB0030 */ lw $t3, 0x30($sp) -.L8031C8C0: -/* 0D78C0 8031C8C0 016B0019 */ multu $t3, $t3 -/* 0D78C4 8031C8C4 00A91823 */ subu $v1, $a1, $t1 -/* 0D78C8 8031C8C8 00007012 */ mflo $t6 -/* 0D78CC 8031C8CC 448E3000 */ mtc1 $t6, $f6 -/* 0D78D0 8031C8D0 00000000 */ nop -/* 0D78D4 8031C8D4 46803220 */ cvt.s.w $f8, $f6 -/* 0D78D8 8031C8D8 10000024 */ b .L8031C96C -/* 0D78DC 8031C8DC E6080024 */ swc1 $f8, 0x24($s0) -.L8031C8E0: -/* 0D78E0 8031C8E0 11200008 */ beqz $t1, .L8031C904 -/* 0D78E4 8031C8E4 26020054 */ addiu $v0, $s0, 0x54 -/* 0D78E8 8031C8E8 24010040 */ li $at, 64 -/* 0D78EC 8031C8EC 11210019 */ beq $t1, $at, .L8031C954 -/* 0D78F0 8031C8F0 24010080 */ li $at, 128 -/* 0D78F4 8031C8F4 5121001B */ beql $t1, $at, .L8031C964 -/* 0D78F8 8031C8F8 960A003A */ lhu $t2, 0x3a($s0) -/* 0D78FC 8031C8FC 1000001A */ b .L8031C968 -/* 0D7900 8031C900 01402025 */ move $a0, $t2 -.L8031C904: -/* 0D7904 8031C904 8C430000 */ lw $v1, ($v0) -/* 0D7908 8031C908 90660000 */ lbu $a2, ($v1) -/* 0D790C 8031C90C 24780001 */ addiu $t8, $v1, 1 -/* 0D7910 8031C910 AC580000 */ sw $t8, ($v0) -/* 0D7914 8031C914 30CF0080 */ andi $t7, $a2, 0x80 -/* 0D7918 8031C918 11E0000A */ beqz $t7, .L8031C944 -/* 0D791C 8031C91C 00C03825 */ move $a3, $a2 -/* 0D7920 8031C920 03001825 */ move $v1, $t8 -/* 0D7924 8031C924 93180000 */ lbu $t8, ($t8) -/* 0D7928 8031C928 00073200 */ sll $a2, $a3, 8 -/* 0D792C 8031C92C 30CE7F00 */ andi $t6, $a2, 0x7f00 -/* 0D7930 8031C930 030E3025 */ or $a2, $t8, $t6 -/* 0D7934 8031C934 30C7FFFF */ andi $a3, $a2, 0xffff -/* 0D7938 8031C938 24790001 */ addiu $t9, $v1, 1 -/* 0D793C 8031C93C AC590000 */ sw $t9, ($v0) -/* 0D7940 8031C940 00E03025 */ move $a2, $a3 -.L8031C944: -/* 0D7944 8031C944 30CAFFFF */ andi $t2, $a2, 0xffff -/* 0D7948 8031C948 A607003A */ sh $a3, 0x3a($s0) -/* 0D794C 8031C94C 10000006 */ b .L8031C968 -/* 0D7950 8031C950 01402025 */ move $a0, $t2 -.L8031C954: -/* 0D7954 8031C954 960A0038 */ lhu $t2, 0x38($s0) -/* 0D7958 8031C958 10000003 */ b .L8031C968 -/* 0D795C 8031C95C 01402025 */ move $a0, $t2 -/* 0D7960 8031C960 960A003A */ lhu $t2, 0x3a($s0) -.L8031C964: -/* 0D7964 8031C964 01402025 */ move $a0, $t2 -.L8031C968: -/* 0D7968 8031C968 00A91823 */ subu $v1, $a1, $t1 -.L8031C96C: -/* 0D796C 8031C96C 920E0002 */ lbu $t6, 2($s0) -/* 0D7970 8031C970 A604003C */ sh $a0, 0x3c($s0) -/* 0D7974 8031C974 01C40019 */ multu $t6, $a0 -/* 0D7978 8031C978 0000C012 */ mflo $t8 -/* 0D797C 8031C97C 07010003 */ bgez $t8, .L8031C98C -/* 0D7980 8031C980 00187A03 */ sra $t7, $t8, 8 -/* 0D7984 8031C984 270100FF */ addiu $at, $t8, 0xff -/* 0D7988 8031C988 00017A03 */ sra $t7, $at, 8 -.L8031C98C: -/* 0D798C 8031C98C A60F003E */ sh $t7, 0x3e($s0) -/* 0D7990 8031C990 8D990000 */ lw $t9, ($t4) -/* 0D7994 8031C994 0019C080 */ sll $t8, $t9, 2 -/* 0D7998 8031C998 07030006 */ bgezl $t8, .L8031C9B4 -/* 0D799C 8031C99C 8DA20000 */ lw $v0, ($t5) -/* 0D79A0 8031C9A0 91AF0002 */ lbu $t7, 2($t5) -/* 0D79A4 8031C9A4 31F90040 */ andi $t9, $t7, 0x40 -/* 0D79A8 8031C9A8 57200008 */ bnezl $t9, .L8031C9CC -/* 0D79AC 8031C9AC 92180000 */ lbu $t8, ($s0) -/* 0D79B0 8031C9B0 8DA20000 */ lw $v0, ($t5) -.L8031C9B4: -/* 0D79B4 8031C9B4 0002C0C0 */ sll $t8, $v0, 3 -/* 0D79B8 8031C9B8 07000003 */ bltz $t8, .L8031C9C8 -/* 0D79BC 8031C9BC 0002C900 */ sll $t9, $v0, 4 -/* 0D79C0 8031C9C0 07220006 */ bltzl $t9, .L8031C9DC -/* 0D79C4 8031C9C4 85B90018 */ lh $t9, 0x18($t5) -.L8031C9C8: -/* 0D79C8 8031C9C8 92180000 */ lbu $t8, ($s0) -.L8031C9CC: -/* 0D79CC 8031C9CC 370F0020 */ ori $t7, $t8, 0x20 -/* 0D79D0 8031C9D0 100000E3 */ b .L8031CD60 -/* 0D79D4 8031C9D4 A20F0000 */ sb $t7, ($s0) -/* 0D79D8 8031C9D8 85B90018 */ lh $t9, 0x18($t5) -.L8031C9DC: -/* 0D79DC 8031C9DC 57200035 */ bnezl $t9, .L8031CAB4 -/* 0D79E0 8031C9E0 85980010 */ lh $t8, 0x10($t4) -/* 0D79E4 8031C9E4 85B8001A */ lh $t8, 0x1a($t5) -/* 0D79E8 8031C9E8 8619001E */ lh $t9, 0x1e($s0) -/* 0D79EC 8031C9EC 00787821 */ addu $t7, $v1, $t8 -/* 0D79F0 8031C9F0 01F94021 */ addu $t0, $t7, $t9 -/* 0D79F4 8031C9F4 91AF0005 */ lbu $t7, 5($t5) -/* 0D79F8 8031C9F8 8FF80000 */ lw $t8, ($ra) -/* 0D79FC 8031C9FC 310E00FF */ andi $t6, $t0, 0xff -/* 0D7A00 8031CA00 000FC880 */ sll $t9, $t7, 2 -/* 0D7A04 8031CA04 032FC823 */ subu $t9, $t9, $t7 -/* 0D7A08 8031CA08 0019C880 */ sll $t9, $t9, 2 -/* 0D7A0C 8031CA0C 03193821 */ addu $a3, $t8, $t9 -/* 0D7A10 8031CA10 90E20002 */ lbu $v0, 2($a3) -/* 0D7A14 8031CA14 01C04025 */ move $t0, $t6 -/* 0D7A18 8031CA18 01C2082A */ slt $at, $t6, $v0 -/* 0D7A1C 8031CA1C 5420000C */ bnezl $at, .L8031CA50 -/* 0D7A20 8031CA20 8CEE0008 */ lw $t6, 8($a3) -/* 0D7A24 8031CA24 304800FF */ andi $t0, $v0, 0xff -/* 0D7A28 8031CA28 55000006 */ bnezl $t0, .L8031CA44 -/* 0D7A2C 8031CA2C 2508FFFF */ addiu $t0, $t0, -1 -/* 0D7A30 8031CA30 920F0000 */ lbu $t7, ($s0) -/* 0D7A34 8031CA34 35F80020 */ ori $t8, $t7, 0x20 -/* 0D7A38 8031CA38 100000C7 */ b .L8031CD58 -/* 0D7A3C 8031CA3C A2180000 */ sb $t8, ($s0) -/* 0D7A40 8031CA40 2508FFFF */ addiu $t0, $t0, -1 -.L8031CA44: -/* 0D7A44 8031CA44 311900FF */ andi $t9, $t0, 0xff -/* 0D7A48 8031CA48 03204025 */ move $t0, $t9 -/* 0D7A4C 8031CA4C 8CEE0008 */ lw $t6, 8($a3) -.L8031CA50: -/* 0D7A50 8031CA50 00087880 */ sll $t7, $t0, 2 -/* 0D7A54 8031CA54 01CFC021 */ addu $t8, $t6, $t7 -/* 0D7A58 8031CA58 8F020000 */ lw $v0, ($t8) -/* 0D7A5C 8031CA5C 54400006 */ bnezl $v0, .L8031CA78 -/* 0D7A60 8031CA60 8C58000C */ lw $t8, 0xc($v0) -/* 0D7A64 8031CA64 920E0000 */ lbu $t6, ($s0) -/* 0D7A68 8031CA68 35CF0020 */ ori $t7, $t6, 0x20 -/* 0D7A6C 8031CA6C 100000BA */ b .L8031CD58 -/* 0D7A70 8031CA70 A20F0000 */ sb $t7, ($s0) -/* 0D7A74 8031CA74 8C58000C */ lw $t8, 0xc($v0) -.L8031CA78: -/* 0D7A78 8031CA78 24430004 */ addiu $v1, $v0, 4 -/* 0D7A7C 8031CA7C AE180018 */ sw $t8, 0x18($s0) -/* 0D7A80 8031CA80 90590000 */ lbu $t9, ($v0) -/* 0D7A84 8031CA84 A2190014 */ sb $t9, 0x14($s0) -/* 0D7A88 8031CA88 904E0001 */ lbu $t6, 1($v0) -/* 0D7A8C 8031CA8C AE03004C */ sw $v1, 0x4c($s0) -/* 0D7A90 8031CA90 448E5000 */ mtc1 $t6, $f10 -/* 0D7A94 8031CA94 00000000 */ nop -/* 0D7A98 8031CA98 46805420 */ cvt.s.w $f16, $f10 -/* 0D7A9C 8031CA9C 46008482 */ mul.s $f18, $f16, $f0 -/* 0D7AA0 8031CAA0 E6120028 */ swc1 $f18, 0x28($s0) -/* 0D7AA4 8031CAA4 C4640004 */ lwc1 $f4, 4($v1) -/* 0D7AA8 8031CAA8 100000AB */ b .L8031CD58 -/* 0D7AAC 8031CAAC E6040020 */ swc1 $f4, 0x20($s0) -/* 0D7AB0 8031CAB0 85980010 */ lh $t8, 0x10($t4) -.L8031CAB4: -/* 0D7AB4 8031CAB4 85AE001A */ lh $t6, 0x1a($t5) -/* 0D7AB8 8031CAB8 0078C821 */ addu $t9, $v1, $t8 -/* 0D7ABC 8031CABC 8618001E */ lh $t8, 0x1e($s0) -/* 0D7AC0 8031CAC0 032E7821 */ addu $t7, $t9, $t6 -/* 0D7AC4 8031CAC4 01F84021 */ addu $t0, $t7, $t8 -/* 0D7AC8 8031CAC8 310200FF */ andi $v0, $t0, 0xff -/* 0D7ACC 8031CACC 28410080 */ slti $at, $v0, 0x80 -/* 0D7AD0 8031CAD0 14200005 */ bnez $at, .L8031CAE8 -/* 0D7AD4 8031CAD4 00404025 */ move $t0, $v0 -/* 0D7AD8 8031CAD8 920F0000 */ lbu $t7, ($s0) -/* 0D7ADC 8031CADC 35F80020 */ ori $t8, $t7, 0x20 -/* 0D7AE0 8031CAE0 1000009D */ b .L8031CD58 -/* 0D7AE4 8031CAE4 A2180000 */ sb $t8, ($s0) -.L8031CAE8: -/* 0D7AE8 8031CAE8 8E030048 */ lw $v1, 0x48($s0) -/* 0D7AEC 8031CAEC 54600003 */ bnezl $v1, .L8031CAFC -/* 0D7AF0 8031CAF0 92190004 */ lbu $t9, 4($s0) -/* 0D7AF4 8031CAF4 8DA3003C */ lw $v1, 0x3c($t5) -/* 0D7AF8 8031CAF8 92190004 */ lbu $t9, 4($s0) -.L8031CAFC: -/* 0D7AFC 8031CAFC 13200073 */ beqz $t9, .L8031CCCC -/* 0D7B00 8031CB00 00000000 */ nop -/* 0D7B04 8031CB04 92040003 */ lbu $a0, 3($s0) -/* 0D7B08 8031CB08 0082082A */ slt $at, $a0, $v0 -/* 0D7B0C 8031CB0C 10200003 */ beqz $at, .L8031CB1C -/* 0D7B10 8031CB10 00802825 */ move $a1, $a0 -/* 0D7B14 8031CB14 10000001 */ b .L8031CB1C -/* 0D7B18 8031CB18 00402825 */ move $a1, $v0 -.L8031CB1C: -/* 0D7B1C 8031CB1C 10600017 */ beqz $v1, .L8031CB7C -/* 0D7B20 8031CB20 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 0D7B24 8031CB24 906E0001 */ lbu $t6, 1($v1) -/* 0D7B28 8031CB28 30A200FF */ andi $v0, $a1, 0xff -/* 0D7B2C 8031CB2C 004E082A */ slt $at, $v0, $t6 -/* 0D7B30 8031CB30 50200004 */ beql $at, $zero, .L8031CB44 -/* 0D7B34 8031CB34 906F0002 */ lbu $t7, 2($v1) -/* 0D7B38 8031CB38 10000009 */ b .L8031CB60 -/* 0D7B3C 8031CB3C 24620008 */ addiu $v0, $v1, 8 -/* 0D7B40 8031CB40 906F0002 */ lbu $t7, 2($v1) -.L8031CB44: -/* 0D7B44 8031CB44 24640018 */ addiu $a0, $v1, 0x18 -/* 0D7B48 8031CB48 01E2082A */ slt $at, $t7, $v0 -/* 0D7B4C 8031CB4C 14200003 */ bnez $at, .L8031CB5C -/* 0D7B50 8031CB50 00000000 */ nop -/* 0D7B54 8031CB54 10000001 */ b .L8031CB5C -/* 0D7B58 8031CB58 24640010 */ addiu $a0, $v1, 0x10 -.L8031CB5C: -/* 0D7B5C 8031CB5C 00801025 */ move $v0, $a0 -.L8031CB60: -/* 0D7B60 8031CB60 8E18004C */ lw $t8, 0x4c($s0) -/* 0D7B64 8031CB64 0058C826 */ xor $t9, $v0, $t8 -/* 0D7B68 8031CB68 2F390001 */ sltiu $t9, $t9, 1 -/* 0D7B6C 8031CB6C A3B9003F */ sb $t9, 0x3f($sp) -/* 0D7B70 8031CB70 AE02004C */ sw $v0, 0x4c($s0) -/* 0D7B74 8031CB74 10000003 */ b .L8031CB84 -/* 0D7B78 8031CB78 C4400004 */ lwc1 $f0, 4($v0) -.L8031CB7C: -/* 0D7B7C 8031CB7C 44810000 */ mtc1 $at, $f0 -/* 0D7B80 8031CB80 AE00004C */ sw $zero, 0x4c($s0) -.L8031CB84: -/* 0D7B84 8031CB84 3C038033 */ lui $v1, %hi(gNoteFrequencies) # $v1, 0x8033 -/* 0D7B88 8031CB88 24633994 */ addiu $v1, %lo(gNoteFrequencies) # addiu $v1, $v1, 0x3994 -/* 0D7B8C 8031CB8C 00087080 */ sll $t6, $t0, 2 -/* 0D7B90 8031CB90 92180003 */ lbu $t8, 3($s0) -/* 0D7B94 8031CB94 006E7821 */ addu $t7, $v1, $t6 -/* 0D7B98 8031CB98 C5E60000 */ lwc1 $f6, ($t7) -/* 0D7B9C 8031CB9C 920F0004 */ lbu $t7, 4($s0) -/* 0D7BA0 8031CBA0 0018C880 */ sll $t9, $t8, 2 -/* 0D7BA4 8031CBA4 00797021 */ addu $t6, $v1, $t9 -/* 0D7BA8 8031CBA8 C5C80000 */ lwc1 $f8, ($t6) -/* 0D7BAC 8031CBAC 46003082 */ mul.s $f2, $f6, $f0 -/* 0D7BB0 8031CBB0 2401FF7F */ li $at, -129 -/* 0D7BB4 8031CBB4 01E1C024 */ and $t8, $t7, $at -/* 0D7BB8 8031CBB8 2719FFFF */ addiu $t9, $t8, -1 -/* 0D7BBC 8031CBBC 2F210005 */ sltiu $at, $t9, 5 -/* 0D7BC0 8031CBC0 46004302 */ mul.s $f12, $f8, $f0 -/* 0D7BC4 8031CBC4 1020000C */ beqz $at, .L8031CBF8 -/* 0D7BC8 8031CBC8 0019C880 */ sll $t9, $t9, 2 -/* 0D7BCC 8031CBCC 3C018034 */ lui $at, %hi(jtbl_80337CDC) -/* 0D7BD0 8031CBD0 00390821 */ addu $at, $at, $t9 -/* 0D7BD4 8031CBD4 8C398EAC */ lw $t9, %lo(jtbl_80337CDC)($at) -/* 0D7BD8 8031CBD8 03200008 */ jr $t9 -/* 0D7BDC 8031CBDC 00000000 */ nop -glabel L8031CBE0 -/* 0D7BE0 8031CBE0 E7A20024 */ swc1 $f2, 0x24($sp) -/* 0D7BE4 8031CBE4 10000005 */ b .L8031CBFC -/* 0D7BE8 8031CBE8 46006006 */ mov.s $f0, $f12 -glabel L8031CBEC -/* 0D7BEC 8031CBEC 46001006 */ mov.s $f0, $f2 -/* 0D7BF0 8031CBF0 10000002 */ b .L8031CBFC -/* 0D7BF4 8031CBF4 E7AC0024 */ swc1 $f12, 0x24($sp) -.L8031CBF8: -/* 0D7BF8 8031CBF8 C7A00028 */ lwc1 $f0, 0x28($sp) -.L8031CBFC: -/* 0D7BFC 8031CBFC C7AA0024 */ lwc1 $f10, 0x24($sp) -/* 0D7C00 8031CC00 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 0D7C04 8031CC04 44819000 */ mtc1 $at, $f18 -/* 0D7C08 8031CC08 46005403 */ div.s $f16, $f10, $f0 -/* 0D7C0C 8031CC0C 26020004 */ addiu $v0, $s0, 4 -/* 0D7C10 8031CC10 3C0146FE */ li $at, 0x46FE0000 # 32512.000000 -/* 0D7C14 8031CC14 46128101 */ sub.s $f4, $f16, $f18 -/* 0D7C18 8031CC18 E444000C */ swc1 $f4, 0xc($v0) -/* 0D7C1C 8031CC1C 920E0004 */ lbu $t6, 4($s0) -/* 0D7C20 8031CC20 31CF0080 */ andi $t7, $t6, 0x80 -/* 0D7C24 8031CC24 51E00017 */ beql $t7, $zero, .L8031CC84 -/* 0D7C28 8031CC28 9618001C */ lhu $t8, 0x1c($s0) -/* 0D7C2C 8031CC2C 9598000A */ lhu $t8, 0xa($t4) -/* 0D7C30 8031CC30 3C0E8022 */ lui $t6, %hi(gTempoInternalToExternal) # $t6, 0x8022 -/* 0D7C34 8031CC34 85CE6B7C */ lh $t6, %lo(gTempoInternalToExternal)($t6) -/* 0D7C38 8031CC38 44984000 */ mtc1 $t8, $f8 -/* 0D7C3C 8031CC3C 8619003C */ lh $t9, 0x3c($s0) -/* 0D7C40 8031CC40 44813000 */ mtc1 $at, $f6 -/* 0D7C44 8031CC44 468042A0 */ cvt.s.w $f10, $f8 -/* 0D7C48 8031CC48 448E4000 */ mtc1 $t6, $f8 -/* 0D7C4C 8031CC4C 44999000 */ mtc1 $t9, $f18 -/* 0D7C50 8031CC50 960F001C */ lhu $t7, 0x1c($s0) -/* 0D7C54 8031CC54 46809120 */ cvt.s.w $f4, $f18 -/* 0D7C58 8031CC58 460A3402 */ mul.s $f16, $f6, $f10 -/* 0D7C5C 8031CC5C 448F9000 */ mtc1 $t7, $f18 -/* 0D7C60 8031CC60 468041A0 */ cvt.s.w $f6, $f8 -/* 0D7C64 8031CC64 46809220 */ cvt.s.w $f8, $f18 -/* 0D7C68 8031CC68 46062282 */ mul.s $f10, $f4, $f6 -/* 0D7C6C 8031CC6C 00000000 */ nop -/* 0D7C70 8031CC70 460A4102 */ mul.s $f4, $f8, $f10 -/* 0D7C74 8031CC74 46048183 */ div.s $f6, $f16, $f4 -/* 0D7C78 8031CC78 10000009 */ b .L8031CCA0 -/* 0D7C7C 8031CC7C E4460008 */ swc1 $f6, 8($v0) -/* 0D7C80 8031CC80 9618001C */ lhu $t8, 0x1c($s0) -.L8031CC84: -/* 0D7C84 8031CC84 3C0142FE */ li $at, 0x42FE0000 # 127.000000 -/* 0D7C88 8031CC88 44819000 */ mtc1 $at, $f18 -/* 0D7C8C 8031CC8C 44984000 */ mtc1 $t8, $f8 -/* 0D7C90 8031CC90 00000000 */ nop -/* 0D7C94 8031CC94 468042A0 */ cvt.s.w $f10, $f8 -/* 0D7C98 8031CC98 460A9403 */ div.s $f16, $f18, $f10 -/* 0D7C9C 8031CC9C E4500008 */ swc1 $f16, 8($v0) -.L8031CCA0: -/* 0D7CA0 8031CCA0 44802000 */ mtc1 $zero, $f4 -/* 0D7CA4 8031CCA4 2401FF7F */ li $at, -129 -/* 0D7CA8 8031CCA8 E4440004 */ swc1 $f4, 4($v0) -/* 0D7CAC 8031CCAC 92190004 */ lbu $t9, 4($s0) -/* 0D7CB0 8031CCB0 E6000020 */ swc1 $f0, 0x20($s0) -/* 0D7CB4 8031CCB4 03217024 */ and $t6, $t9, $at -/* 0D7CB8 8031CCB8 24010005 */ li $at, 5 -/* 0D7CBC 8031CCBC 55C10027 */ bnel $t6, $at, .L8031CD5C -/* 0D7CC0 8031CCC0 860F003C */ lh $t7, 0x3c($s0) -/* 0D7CC4 8031CCC4 10000024 */ b .L8031CD58 -/* 0D7CC8 8031CCC8 A2080003 */ sb $t0, 3($s0) -.L8031CCCC: -/* 0D7CCC 8031CCCC 1060001C */ beqz $v1, .L8031CD40 -/* 0D7CD0 8031CCD0 0008C880 */ sll $t9, $t0, 2 -/* 0D7CD4 8031CCD4 906F0001 */ lbu $t7, 1($v1) -/* 0D7CD8 8031CCD8 004F082A */ slt $at, $v0, $t7 -/* 0D7CDC 8031CCDC 10200003 */ beqz $at, .L8031CCEC -/* 0D7CE0 8031CCE0 00087880 */ sll $t7, $t0, 2 -/* 0D7CE4 8031CCE4 10000009 */ b .L8031CD0C -/* 0D7CE8 8031CCE8 24620008 */ addiu $v0, $v1, 8 -.L8031CCEC: -/* 0D7CEC 8031CCEC 90780002 */ lbu $t8, 2($v1) -/* 0D7CF0 8031CCF0 24640018 */ addiu $a0, $v1, 0x18 -/* 0D7CF4 8031CCF4 0302082A */ slt $at, $t8, $v0 -/* 0D7CF8 8031CCF8 14200003 */ bnez $at, .L8031CD08 -/* 0D7CFC 8031CCFC 00000000 */ nop -/* 0D7D00 8031CD00 10000001 */ b .L8031CD08 -/* 0D7D04 8031CD04 24640010 */ addiu $a0, $v1, 0x10 -.L8031CD08: -/* 0D7D08 8031CD08 00801025 */ move $v0, $a0 -.L8031CD0C: -/* 0D7D0C 8031CD0C 8E19004C */ lw $t9, 0x4c($s0) -/* 0D7D10 8031CD10 3C038033 */ lui $v1, %hi(gNoteFrequencies) # $v1, 0x8033 -/* 0D7D14 8031CD14 24633994 */ addiu $v1, %lo(gNoteFrequencies) # addiu $v1, $v1, 0x3994 -/* 0D7D18 8031CD18 00597026 */ xor $t6, $v0, $t9 -/* 0D7D1C 8031CD1C 2DCE0001 */ sltiu $t6, $t6, 1 -/* 0D7D20 8031CD20 A3AE003F */ sb $t6, 0x3f($sp) -/* 0D7D24 8031CD24 AE02004C */ sw $v0, 0x4c($s0) -/* 0D7D28 8031CD28 006FC021 */ addu $t8, $v1, $t7 -/* 0D7D2C 8031CD2C C7080000 */ lwc1 $f8, ($t8) -/* 0D7D30 8031CD30 C4460004 */ lwc1 $f6, 4($v0) -/* 0D7D34 8031CD34 46083482 */ mul.s $f18, $f6, $f8 -/* 0D7D38 8031CD38 10000007 */ b .L8031CD58 -/* 0D7D3C 8031CD3C E6120020 */ swc1 $f18, 0x20($s0) -.L8031CD40: -/* 0D7D40 8031CD40 3C038033 */ lui $v1, %hi(gNoteFrequencies) # $v1, 0x8033 -/* 0D7D44 8031CD44 24633994 */ addiu $v1, %lo(gNoteFrequencies) # addiu $v1, $v1, 0x3994 -/* 0D7D48 8031CD48 AE00004C */ sw $zero, 0x4c($s0) -/* 0D7D4C 8031CD4C 00797021 */ addu $t6, $v1, $t9 -/* 0D7D50 8031CD50 C5CA0000 */ lwc1 $f10, ($t6) -/* 0D7D54 8031CD54 E60A0020 */ swc1 $f10, 0x20($s0) -.L8031CD58: -/* 0D7D58 8031CD58 860F003C */ lh $t7, 0x3c($s0) -.L8031CD5C: -/* 0D7D5C 8031CD5C A60F0040 */ sh $t7, 0x40($s0) -.L8031CD60: -/* 0D7D60 8031CD60 8E020000 */ lw $v0, ($s0) -/* 0D7D64 8031CD64 24010001 */ li $at, 1 -/* 0D7D68 8031CD68 0002C080 */ sll $t8, $v0, 2 -/* 0D7D6C 8031CD6C 0018CFC2 */ srl $t9, $t8, 0x1f -/* 0D7D70 8031CD70 5721000C */ bnel $t9, $at, .L8031CDA4 -/* 0D7D74 8031CD74 000270C0 */ sll $t6, $v0, 3 -/* 0D7D78 8031CD78 8E0E0044 */ lw $t6, 0x44($s0) -/* 0D7D7C 8031CD7C 0002C0C0 */ sll $t8, $v0, 3 -/* 0D7D80 8031CD80 15C00003 */ bnez $t6, .L8031CD90 -/* 0D7D84 8031CD84 00000000 */ nop -/* 0D7D88 8031CD88 0703002E */ bgezl $t8, .L8031CE44 -/* 0D7D8C 8031CD8C 8FBF001C */ lw $ra, 0x1c($sp) -.L8031CD90: -/* 0D7D90 8031CD90 0C0C67D9 */ jal seq_channel_layer_note_decay -/* 0D7D94 8031CD94 02002025 */ move $a0, $s0 -/* 0D7D98 8031CD98 1000002A */ b .L8031CE44 -/* 0D7D9C 8031CD9C 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D7DA0 8031CDA0 000270C0 */ sll $t6, $v0, 3 -.L8031CDA4: -/* 0D7DA4 8031CDA4 05C00003 */ bltz $t6, .L8031CDB4 -/* 0D7DA8 8031CDA8 00004025 */ move $t0, $zero -/* 0D7DAC 8031CDAC 10000017 */ b .L8031CE0C -/* 0D7DB0 8031CDB0 24080001 */ li $t0, 1 -.L8031CDB4: -/* 0D7DB4 8031CDB4 8E040044 */ lw $a0, 0x44($s0) -/* 0D7DB8 8031CDB8 10800005 */ beqz $a0, .L8031CDD0 -/* 0D7DBC 8031CDBC 00000000 */ nop -/* 0D7DC0 8031CDC0 920F0001 */ lbu $t7, 1($s0) -/* 0D7DC4 8031CDC4 93B8003F */ lbu $t8, 0x3f($sp) -/* 0D7DC8 8031CDC8 15E00003 */ bnez $t7, .L8031CDD8 -/* 0D7DCC 8031CDCC 00000000 */ nop -.L8031CDD0: -/* 0D7DD0 8031CDD0 1000000E */ b .L8031CE0C -/* 0D7DD4 8031CDD4 24080001 */ li $t0, 1 -.L8031CDD8: -/* 0D7DD8 8031CDD8 57000006 */ bnezl $t8, .L8031CDF4 -/* 0D7DDC 8031CDDC 8E19004C */ lw $t9, 0x4c($s0) -/* 0D7DE0 8031CDE0 0C0C67D9 */ jal seq_channel_layer_note_decay -/* 0D7DE4 8031CDE4 02002025 */ move $a0, $s0 -/* 0D7DE8 8031CDE8 10000008 */ b .L8031CE0C -/* 0D7DEC 8031CDEC 24080001 */ li $t0, 1 -/* 0D7DF0 8031CDF0 8E19004C */ lw $t9, 0x4c($s0) -.L8031CDF4: -/* 0D7DF4 8031CDF4 02002825 */ move $a1, $s0 -/* 0D7DF8 8031CDF8 17200004 */ bnez $t9, .L8031CE0C -/* 0D7DFC 8031CDFC 00000000 */ nop -/* 0D7E00 8031CE00 0C0C6874 */ jal init_synthetic_wave -/* 0D7E04 8031CE04 A3A8003D */ sb $t0, 0x3d($sp) -/* 0D7E08 8031CE08 93A8003D */ lbu $t0, 0x3d($sp) -.L8031CE0C: -/* 0D7E0C 8031CE0C 51000005 */ beql $t0, $zero, .L8031CE24 -/* 0D7E10 8031CE10 8E040044 */ lw $a0, 0x44($s0) -/* 0D7E14 8031CE14 0C0C6A53 */ jal alloc_note -/* 0D7E18 8031CE18 02002025 */ move $a0, $s0 -/* 0D7E1C 8031CE1C AE020044 */ sw $v0, 0x44($s0) -/* 0D7E20 8031CE20 8E040044 */ lw $a0, 0x44($s0) -.L8031CE24: -/* 0D7E24 8031CE24 50800007 */ beql $a0, $zero, .L8031CE44 -/* 0D7E28 8031CE28 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D7E2C 8031CE2C 8C8E002C */ lw $t6, 0x2c($a0) -/* 0D7E30 8031CE30 560E0004 */ bnel $s0, $t6, .L8031CE44 -/* 0D7E34 8031CE34 8FBF001C */ lw $ra, 0x1c($sp) -/* 0D7E38 8031CE38 0C0C6D28 */ jal note_vibrato_init -/* 0D7E3C 8031CE3C 00000000 */ nop -.L8031CE40: -/* 0D7E40 8031CE40 8FBF001C */ lw $ra, 0x1c($sp) -.L8031CE44: -/* 0D7E44 8031CE44 8FB00018 */ lw $s0, 0x18($sp) -/* 0D7E48 8031CE48 27BD0060 */ addiu $sp, $sp, 0x60 -/* 0D7E4C 8031CE4C 03E00008 */ jr $ra -/* 0D7E50 8031CE50 00000000 */ nop diff --git a/asm/non_matchings/sequence_channel_process_script_jp.s b/asm/non_matchings/sequence_channel_process_script_jp.s deleted file mode 100644 index e28faf81..00000000 --- a/asm/non_matchings/sequence_channel_process_script_jp.s +++ /dev/null @@ -1,954 +0,0 @@ -.late_rodata -.late_rodata_alignment 8 -glabel jtbl_80337D08 # US: 80338EC0 - .word L8031C430 - .word L8031C3DC - .word L8031C44C - .word L8031C45C - .word L8031C3F8 - .word L8031C6C8 - .word L8031C724 - .word L8031C75C - .word L8031C75C - .word L8031C7A8 - .word L8031C7B8 - .word L8031C75C - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C7D8 - .word L8031C7FC - .word L8031C80C - .word L8031C508 - .word L8031C6B8 - .word L8031C1CC - .word L8031C698 - .word L8031C600 - .word L8031C5E4 - .word L8031C5D4 - .word L8031C5B8 - .word L8031C5A0 - .word L8031C568 - .word L8031C530 - .word L8031C4C0 - .word L8031C46C - .word L8031C488 - .word L8031C650 - .word L8031C61C - .word L8031C684 - .word L8031C820 - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C3CC - .word L8031C3A4 - .word L8031C1CC - .word L8031C1CC - .word L8031C34C - .word L8031C33C - .word L8031C2F4 - .word L8031C2BC - .word L8031C34C - .word L8031C34C - .word L8031C34C - .word L8031C280 - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - -glabel jtbl_80337E04 # US: 80338FBC - .word L8031C89C - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C9E4 - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031CA14 - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031CA30 - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031CA58 - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C8F8 - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C9DC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C8CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C8DC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C914 - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C960 - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C1CC - .word L8031C97C - -.text -glabel sequence_channel_process_script -/* 0D7104 8031C104 27BDFF98 */ addiu $sp, $sp, -0x68 -/* 0D7108 8031C108 AFBF0034 */ sw $ra, 0x34($sp) -/* 0D710C 8031C10C AFB50030 */ sw $s5, 0x30($sp) -/* 0D7110 8031C110 AFB4002C */ sw $s4, 0x2c($sp) -/* 0D7114 8031C114 AFB30028 */ sw $s3, 0x28($sp) -/* 0D7118 8031C118 AFB20024 */ sw $s2, 0x24($sp) -/* 0D711C 8031C11C AFB10020 */ sw $s1, 0x20($sp) -/* 0D7120 8031C120 AFB0001C */ sw $s0, 0x1c($sp) -/* 0D7124 8031C124 F7B40010 */ sdc1 $f20, 0x10($sp) -/* 0D7128 8031C128 8C820000 */ lw $v0, ($a0) -/* 0D712C 8031C12C 00809025 */ move $s2, $a0 -/* 0D7130 8031C130 000277C2 */ srl $t6, $v0, 0x1f -/* 0D7134 8031C134 11C0025D */ beqz $t6, .L8031CAAC -/* 0D7138 8031C138 0002C080 */ sll $t8, $v0, 2 -/* 0D713C 8031C13C 0701000D */ bgez $t8, .L8031C174 -/* 0D7140 8031C140 00008025 */ move $s0, $zero -/* 0D7144 8031C144 00808825 */ move $s1, $a0 -/* 0D7148 8031C148 24120010 */ li $s2, 16 -.L8031C14C: -/* 0D714C 8031C14C 8E240044 */ lw $a0, 0x44($s1) -/* 0D7150 8031C150 50800004 */ beql $a0, $zero, .L8031C164 -/* 0D7154 8031C154 26100004 */ addiu $s0, $s0, 4 -/* 0D7158 8031C158 0C0C6C29 */ jal seq_channel_layer_process_script -/* 0D715C 8031C15C 00000000 */ nop -/* 0D7160 8031C160 26100004 */ addiu $s0, $s0, 4 -.L8031C164: -/* 0D7164 8031C164 1612FFF9 */ bne $s0, $s2, .L8031C14C -/* 0D7168 8031C168 26310004 */ addiu $s1, $s1, 4 -/* 0D716C 8031C16C 10000250 */ b .L8031CAB0 -/* 0D7170 8031C170 8FBF0034 */ lw $ra, 0x34($sp) -.L8031C174: -/* 0D7174 8031C174 8E540040 */ lw $s4, 0x40($s2) -/* 0D7178 8031C178 8E990000 */ lw $t9, ($s4) -/* 0D717C 8031C17C 00195080 */ sll $t2, $t9, 2 -/* 0D7180 8031C180 05430006 */ bgezl $t2, .L8031C19C -/* 0D7184 8031C184 96430016 */ lhu $v1, 0x16($s2) -/* 0D7188 8031C188 924B0002 */ lbu $t3, 2($s2) -/* 0D718C 8031C18C 316C0080 */ andi $t4, $t3, 0x80 -/* 0D7190 8031C190 55800247 */ bnezl $t4, .L8031CAB0 -/* 0D7194 8031C194 8FBF0034 */ lw $ra, 0x34($sp) -/* 0D7198 8031C198 96430016 */ lhu $v1, 0x16($s2) -.L8031C19C: -/* 0D719C 8031C19C 2650005C */ addiu $s0, $s2, 0x5c -/* 0D71A0 8031C1A0 3C013F80 */ li $at, 0x3F800000 # 1.000000 -/* 0D71A4 8031C1A4 10600004 */ beqz $v1, .L8031C1B8 -/* 0D71A8 8031C1A8 00601025 */ move $v0, $v1 -/* 0D71AC 8031C1AC 246DFFFF */ addiu $t5, $v1, -1 -/* 0D71B0 8031C1B0 A64D0016 */ sh $t5, 0x16($s2) -/* 0D71B4 8031C1B4 31A2FFFF */ andi $v0, $t5, 0xffff -.L8031C1B8: -/* 0D71B8 8031C1B8 14400231 */ bnez $v0, .L8031CA80 -/* 0D71BC 8031C1BC 2415FFFF */ li $s5, -1 -/* 0D71C0 8031C1C0 4481A800 */ mtc1 $at, $f21 -/* 0D71C4 8031C1C4 4480A000 */ mtc1 $zero, $f20 -/* 0D71C8 8031C1C8 83B30053 */ lb $s3, 0x53($sp) -.L8031C1CC: -glabel L8031C1CC -/* 0D71CC 8031C1CC 0C0C6C07 */ jal m64_read_u8 -/* 0D71D0 8031C1D0 02002025 */ move $a0, $s0 -/* 0D71D4 8031C1D4 240100FF */ li $at, 255 -/* 0D71D8 8031C1D8 305100FF */ andi $s1, $v0, 0xff -/* 0D71DC 8031C1DC 1441000E */ bne $v0, $at, .L8031C218 -/* 0D71E0 8031C1E0 00401825 */ move $v1, $v0 -/* 0D71E4 8031C1E4 92040018 */ lbu $a0, 0x18($s0) -/* 0D71E8 8031C1E8 14800005 */ bnez $a0, .L8031C200 -/* 0D71EC 8031C1EC 248EFFFF */ addiu $t6, $a0, -1 -/* 0D71F0 8031C1F0 0C0C6AB4 */ jal sequence_channel_disable -/* 0D71F4 8031C1F4 02402025 */ move $a0, $s2 -/* 0D71F8 8031C1F8 10000222 */ b .L8031CA84 -/* 0D71FC 8031C1FC 02408825 */ move $s1, $s2 -.L8031C200: -/* 0D7200 8031C200 31CF00FF */ andi $t7, $t6, 0xff -/* 0D7204 8031C204 000FC080 */ sll $t8, $t7, 2 -/* 0D7208 8031C208 0218C821 */ addu $t9, $s0, $t8 -/* 0D720C 8031C20C A20E0018 */ sb $t6, 0x18($s0) -/* 0D7210 8031C210 8F290004 */ lw $t1, 4($t9) -/* 0D7214 8031C214 AE090000 */ sw $t1, ($s0) -.L8031C218: -/* 0D7218 8031C218 240100FE */ li $at, 254 -/* 0D721C 8031C21C 10610218 */ beq $v1, $at, .L8031CA80 -/* 0D7220 8031C220 240100FD */ li $at, 253 -/* 0D7224 8031C224 14610005 */ bne $v1, $at, .L8031C23C -/* 0D7228 8031C228 307900F0 */ andi $t9, $v1, 0xf0 -/* 0D722C 8031C22C 0C0C6C18 */ jal m64_read_compressed_u16 -/* 0D7230 8031C230 02002025 */ move $a0, $s0 -/* 0D7234 8031C234 10000212 */ b .L8031CA80 -/* 0D7238 8031C238 A6420016 */ sh $v0, 0x16($s2) -.L8031C23C: -/* 0D723C 8031C23C 240100F3 */ li $at, 243 -/* 0D7240 8031C240 14610005 */ bne $v1, $at, .L8031C258 -/* 0D7244 8031C244 246DFF3F */ addiu $t5, $v1, -0xc1 -/* 0D7248 8031C248 924B0000 */ lbu $t3, ($s2) -/* 0D724C 8031C24C 356C0020 */ ori $t4, $t3, 0x20 -/* 0D7250 8031C250 1000020B */ b .L8031CA80 -/* 0D7254 8031C254 A24C0000 */ sb $t4, ($s2) -.L8031C258: -/* 0D7258 8031C258 286100C1 */ slti $at, $v1, 0xc1 -/* 0D725C 8031C25C 14200185 */ bnez $at, .L8031C874 -/* 0D7260 8031C260 2DA1003F */ sltiu $at, $t5, 0x3f -/* 0D7264 8031C264 1020FFD9 */ beqz $at, .L8031C1CC -/* 0D7268 8031C268 000D6880 */ sll $t5, $t5, 2 -/* 0D726C 8031C26C 3C018033 */ lui $at, %hi(jtbl_80337D08) -/* 0D7270 8031C270 002D0821 */ addu $at, $at, $t5 -/* 0D7274 8031C274 8C2D7D08 */ lw $t5, %lo(jtbl_80337D08)($at) -/* 0D7278 8031C278 01A00008 */ jr $t5 -/* 0D727C 8031C27C 00000000 */ nop -glabel L8031C280 -/* 0D7280 8031C280 0C0C6C0C */ jal m64_read_s16 -/* 0D7284 8031C284 02002025 */ move $a0, $s0 -/* 0D7288 8031C288 920E0018 */ lbu $t6, 0x18($s0) -/* 0D728C 8031C28C 8E180000 */ lw $t8, ($s0) -/* 0D7290 8031C290 304CFFFF */ andi $t4, $v0, 0xffff -/* 0D7294 8031C294 25CF0001 */ addiu $t7, $t6, 1 -/* 0D7298 8031C298 31F900FF */ andi $t9, $t7, 0xff -/* 0D729C 8031C29C 00194880 */ sll $t1, $t9, 2 -/* 0D72A0 8031C2A0 02095021 */ addu $t2, $s0, $t1 -/* 0D72A4 8031C2A4 A20F0018 */ sb $t7, 0x18($s0) -/* 0D72A8 8031C2A8 AD580000 */ sw $t8, ($t2) -/* 0D72AC 8031C2AC 8E8B0014 */ lw $t3, 0x14($s4) -/* 0D72B0 8031C2B0 016C6821 */ addu $t5, $t3, $t4 -/* 0D72B4 8031C2B4 1000FFC5 */ b .L8031C1CC -/* 0D72B8 8031C2B8 AE0D0000 */ sw $t5, ($s0) -glabel L8031C2BC -/* 0D72BC 8031C2BC 0C0C6C07 */ jal m64_read_u8 -/* 0D72C0 8031C2C0 02002025 */ move $a0, $s0 -/* 0D72C4 8031C2C4 920E0018 */ lbu $t6, 0x18($s0) -/* 0D72C8 8031C2C8 020E7821 */ addu $t7, $s0, $t6 -/* 0D72CC 8031C2CC A1E20014 */ sb $v0, 0x14($t7) -/* 0D72D0 8031C2D0 92190018 */ lbu $t9, 0x18($s0) -/* 0D72D4 8031C2D4 8E180000 */ lw $t8, ($s0) -/* 0D72D8 8031C2D8 27290001 */ addiu $t1, $t9, 1 -/* 0D72DC 8031C2DC 312A00FF */ andi $t2, $t1, 0xff -/* 0D72E0 8031C2E0 000A5880 */ sll $t3, $t2, 2 -/* 0D72E4 8031C2E4 020B6021 */ addu $t4, $s0, $t3 -/* 0D72E8 8031C2E8 A2090018 */ sb $t1, 0x18($s0) -/* 0D72EC 8031C2EC 1000FFB7 */ b .L8031C1CC -/* 0D72F0 8031C2F0 AD980000 */ sw $t8, ($t4) -glabel L8031C2F4 -/* 0D72F4 8031C2F4 920D0018 */ lbu $t5, 0x18($s0) -/* 0D72F8 8031C2F8 020D1021 */ addu $v0, $s0, $t5 -/* 0D72FC 8031C2FC 904E0013 */ lbu $t6, 0x13($v0) -/* 0D7300 8031C300 25CFFFFF */ addiu $t7, $t6, -1 -/* 0D7304 8031C304 A04F0013 */ sb $t7, 0x13($v0) -/* 0D7308 8031C308 92040018 */ lbu $a0, 0x18($s0) -/* 0D730C 8031C30C 0204C821 */ addu $t9, $s0, $a0 -/* 0D7310 8031C310 93290013 */ lbu $t1, 0x13($t9) -/* 0D7314 8031C314 00801825 */ move $v1, $a0 -/* 0D7318 8031C318 00035080 */ sll $t2, $v1, 2 -/* 0D731C 8031C31C 11200005 */ beqz $t1, .L8031C334 -/* 0D7320 8031C320 248CFFFF */ addiu $t4, $a0, -1 -/* 0D7324 8031C324 020A5821 */ addu $t3, $s0, $t2 -/* 0D7328 8031C328 8D780000 */ lw $t8, ($t3) -/* 0D732C 8031C32C 1000FFA7 */ b .L8031C1CC -/* 0D7330 8031C330 AE180000 */ sw $t8, ($s0) -.L8031C334: -/* 0D7334 8031C334 1000FFA5 */ b .L8031C1CC -/* 0D7338 8031C338 A20C0018 */ sb $t4, 0x18($s0) -glabel L8031C33C -/* 0D733C 8031C33C 920D0018 */ lbu $t5, 0x18($s0) -/* 0D7340 8031C340 25AEFFFF */ addiu $t6, $t5, -1 -/* 0D7344 8031C344 1000FFA1 */ b .L8031C1CC -/* 0D7348 8031C348 A20E0018 */ sb $t6, 0x18($s0) -glabel L8031C34C -/* 0D734C 8031C34C 0C0C6C0C */ jal m64_read_s16 -/* 0D7350 8031C350 02002025 */ move $a0, $s0 -/* 0D7354 8031C354 240100FA */ li $at, 250 -/* 0D7358 8031C358 16210003 */ bne $s1, $at, .L8031C368 -/* 0D735C 8031C35C 02201825 */ move $v1, $s1 -/* 0D7360 8031C360 1660FF9A */ bnez $s3, .L8031C1CC -/* 0D7364 8031C364 00000000 */ nop -.L8031C368: -/* 0D7368 8031C368 240100F9 */ li $at, 249 -/* 0D736C 8031C36C 54610004 */ bnel $v1, $at, .L8031C380 -/* 0D7370 8031C370 240100F5 */ li $at, 245 -/* 0D7374 8031C374 0661FF95 */ bgez $s3, .L8031C1CC -/* 0D7378 8031C378 00000000 */ nop -/* 0D737C 8031C37C 240100F5 */ li $at, 245 -.L8031C380: -/* 0D7380 8031C380 54610004 */ bnel $v1, $at, .L8031C394 -/* 0D7384 8031C384 8E8F0014 */ lw $t7, 0x14($s4) -/* 0D7388 8031C388 0660FF90 */ bltz $s3, .L8031C1CC -/* 0D738C 8031C38C 00000000 */ nop -/* 0D7390 8031C390 8E8F0014 */ lw $t7, 0x14($s4) -.L8031C394: -/* 0D7394 8031C394 3059FFFF */ andi $t9, $v0, 0xffff -/* 0D7398 8031C398 01F94821 */ addu $t1, $t7, $t9 -/* 0D739C 8031C39C 1000FF8B */ b .L8031C1CC -/* 0D73A0 8031C3A0 AE090000 */ sw $t1, ($s0) -glabel L8031C3A4 -/* 0D73A4 8031C3A4 26510080 */ addiu $s1, $s2, 0x80 -/* 0D73A8 8031C3A8 0C0C64BF */ jal note_pool_clear -/* 0D73AC 8031C3AC 02202025 */ move $a0, $s1 -/* 0D73B0 8031C3B0 0C0C6C07 */ jal m64_read_u8 -/* 0D73B4 8031C3B4 02002025 */ move $a0, $s0 -/* 0D73B8 8031C3B8 02202025 */ move $a0, $s1 -/* 0D73BC 8031C3BC 0C0C650A */ jal note_pool_fill -/* 0D73C0 8031C3C0 00402825 */ move $a1, $v0 -/* 0D73C4 8031C3C4 1000FF81 */ b .L8031C1CC -/* 0D73C8 8031C3C8 00000000 */ nop -glabel L8031C3CC -/* 0D73CC 8031C3CC 0C0C64BF */ jal note_pool_clear -/* 0D73D0 8031C3D0 26440080 */ addiu $a0, $s2, 0x80 -/* 0D73D4 8031C3D4 1000FF7D */ b .L8031C1CC -/* 0D73D8 8031C3D8 00000000 */ nop -glabel L8031C3DC -/* 0D73DC 8031C3DC 0C0C6C0C */ jal m64_read_s16 -/* 0D73E0 8031C3E0 02002025 */ move $a0, $s0 -/* 0D73E4 8031C3E4 8E8A0014 */ lw $t2, 0x14($s4) -/* 0D73E8 8031C3E8 304BFFFF */ andi $t3, $v0, 0xffff -/* 0D73EC 8031C3EC 014BC021 */ addu $t8, $t2, $t3 -/* 0D73F0 8031C3F0 1000FF76 */ b .L8031C1CC -/* 0D73F4 8031C3F4 AE580030 */ sw $t8, 0x30($s2) -glabel L8031C3F8 -/* 0D73F8 8031C3F8 1275FF74 */ beq $s3, $s5, .L8031C1CC -/* 0D73FC 8031C3FC 00000000 */ nop -/* 0D7400 8031C400 8E4C0030 */ lw $t4, 0x30($s2) -/* 0D7404 8031C404 00136840 */ sll $t5, $s3, 1 -/* 0D7408 8031C408 8E8A0014 */ lw $t2, 0x14($s4) -/* 0D740C 8031C40C 018D1021 */ addu $v0, $t4, $t5 -/* 0D7410 8031C410 904F0000 */ lbu $t7, ($v0) -/* 0D7414 8031C414 904E0001 */ lbu $t6, 1($v0) -/* 0D7418 8031C418 000FCA00 */ sll $t9, $t7, 8 -/* 0D741C 8031C41C 01D93821 */ addu $a3, $t6, $t9 -/* 0D7420 8031C420 30E9FFFF */ andi $t1, $a3, 0xffff -/* 0D7424 8031C424 01495821 */ addu $t3, $t2, $t1 -/* 0D7428 8031C428 1000FF68 */ b .L8031C1CC -/* 0D742C 8031C42C AE4B0030 */ sw $t3, 0x30($s2) -glabel L8031C430 -/* 0D7430 8031C430 0C0C6C07 */ jal m64_read_u8 -/* 0D7434 8031C434 02002025 */ move $a0, $s0 -/* 0D7438 8031C438 02402025 */ move $a0, $s2 -/* 0D743C 8031C43C 0C0C700C */ jal set_instrument -/* 0D7440 8031C440 304500FF */ andi $a1, $v0, 0xff -/* 0D7444 8031C444 1000FF61 */ b .L8031C1CC -/* 0D7448 8031C448 00000000 */ nop -glabel L8031C44C -/* 0D744C 8031C44C 92580000 */ lbu $t8, ($s2) -/* 0D7450 8031C450 330CFFFD */ andi $t4, $t8, 0xfffd -/* 0D7454 8031C454 1000FF5D */ b .L8031C1CC -/* 0D7458 8031C458 A24C0000 */ sb $t4, ($s2) -glabel L8031C45C -/* 0D745C 8031C45C 924F0000 */ lbu $t7, ($s2) -/* 0D7460 8031C460 35EE0002 */ ori $t6, $t7, 2 -/* 0D7464 8031C464 1000FF59 */ b .L8031C1CC -/* 0D7468 8031C468 A24E0000 */ sb $t6, ($s2) -glabel L8031C46C -/* 0D746C 8031C46C 0C0C6C07 */ jal m64_read_u8 -/* 0D7470 8031C470 02002025 */ move $a0, $s0 -/* 0D7474 8031C474 02402025 */ move $a0, $s2 -/* 0D7478 8031C478 0C0C7031 */ jal sequence_channel_set_volume -/* 0D747C 8031C47C 304500FF */ andi $a1, $v0, 0xff -/* 0D7480 8031C480 1000FF52 */ b .L8031C1CC -/* 0D7484 8031C484 00000000 */ nop -glabel L8031C488 -/* 0D7488 8031C488 0C0C6C07 */ jal m64_read_u8 -/* 0D748C 8031C48C 02002025 */ move $a0, $s0 -/* 0D7490 8031C490 44822000 */ mtc1 $v0, $f4 -/* 0D7494 8031C494 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 0D7498 8031C498 04410004 */ bgez $v0, .L8031C4AC -/* 0D749C 8031C49C 468021A0 */ cvt.s.w $f6, $f4 -/* 0D74A0 8031C4A0 44814000 */ mtc1 $at, $f8 -/* 0D74A4 8031C4A4 00000000 */ nop -/* 0D74A8 8031C4A8 46083180 */ add.s $f6, $f6, $f8 -.L8031C4AC: -/* 0D74AC 8031C4AC 460032A1 */ cvt.d.s $f10, $f6 -/* 0D74B0 8031C4B0 46345402 */ mul.d $f16, $f10, $f20 -/* 0D74B4 8031C4B4 462084A0 */ cvt.s.d $f18, $f16 -/* 0D74B8 8031C4B8 1000FF44 */ b .L8031C1CC -/* 0D74BC 8031C4BC E652001C */ swc1 $f18, 0x1c($s2) -glabel L8031C4C0 -/* 0D74C0 8031C4C0 0C0C6C0C */ jal m64_read_s16 -/* 0D74C4 8031C4C4 02002025 */ move $a0, $s0 -/* 0D74C8 8031C4C8 3059FFFF */ andi $t9, $v0, 0xffff -/* 0D74CC 8031C4CC 44992000 */ mtc1 $t9, $f4 -/* 0D74D0 8031C4D0 44808000 */ mtc1 $zero, $f16 -/* 0D74D4 8031C4D4 07210005 */ bgez $t9, .L8031C4EC -/* 0D74D8 8031C4D8 46802220 */ cvt.s.w $f8, $f4 -/* 0D74DC 8031C4DC 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 0D74E0 8031C4E0 44813000 */ mtc1 $at, $f6 -/* 0D74E4 8031C4E4 00000000 */ nop -/* 0D74E8 8031C4E8 46064200 */ add.s $f8, $f8, $f6 -.L8031C4EC: -/* 0D74EC 8031C4EC 3C0140E0 */ li $at, 0x40E00000 # 7.000000 -/* 0D74F0 8031C4F0 44818800 */ mtc1 $at, $f17 -/* 0D74F4 8031C4F4 460042A1 */ cvt.d.s $f10, $f8 -/* 0D74F8 8031C4F8 46305483 */ div.d $f18, $f10, $f16 -/* 0D74FC 8031C4FC 46209120 */ cvt.s.d $f4, $f18 -/* 0D7500 8031C500 1000FF32 */ b .L8031C1CC -/* 0D7504 8031C504 E644002C */ swc1 $f4, 0x2c($s2) -glabel L8031C508 -/* 0D7508 8031C508 0C0C6C07 */ jal m64_read_u8 -/* 0D750C 8031C50C 02002025 */ move $a0, $s0 -/* 0D7510 8031C510 2449007F */ addiu $t1, $v0, 0x7f -/* 0D7514 8031C514 312A00FF */ andi $t2, $t1, 0xff -/* 0D7518 8031C518 000A5880 */ sll $t3, $t2, 2 -/* 0D751C 8031C51C 3C018033 */ lui $at, %hi(gPitchBendFrequencyScale) -/* 0D7520 8031C520 002B0821 */ addu $at, $at, $t3 -/* 0D7524 8031C524 C4262488 */ lwc1 $f6, %lo(gPitchBendFrequencyScale)($at) -/* 0D7528 8031C528 1000FF28 */ b .L8031C1CC -/* 0D752C 8031C52C E646002C */ swc1 $f6, 0x2c($s2) -glabel L8031C530 -/* 0D7530 8031C530 0C0C6C07 */ jal m64_read_u8 -/* 0D7534 8031C534 02002025 */ move $a0, $s0 -/* 0D7538 8031C538 44824000 */ mtc1 $v0, $f8 -/* 0D753C 8031C53C 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 0D7540 8031C540 04410004 */ bgez $v0, .L8031C554 -/* 0D7544 8031C544 468042A0 */ cvt.s.w $f10, $f8 -/* 0D7548 8031C548 44818000 */ mtc1 $at, $f16 -/* 0D754C 8031C54C 00000000 */ nop -/* 0D7550 8031C550 46105280 */ add.s $f10, $f10, $f16 -.L8031C554: -/* 0D7554 8031C554 460054A1 */ cvt.d.s $f18, $f10 -/* 0D7558 8031C558 46349102 */ mul.d $f4, $f18, $f20 -/* 0D755C 8031C55C 462021A0 */ cvt.s.d $f6, $f4 -/* 0D7560 8031C560 1000FF1A */ b .L8031C1CC -/* 0D7564 8031C564 E6460024 */ swc1 $f6, 0x24($s2) -glabel L8031C568 -/* 0D7568 8031C568 0C0C6C07 */ jal m64_read_u8 -/* 0D756C 8031C56C 02002025 */ move $a0, $s0 -/* 0D7570 8031C570 44824000 */ mtc1 $v0, $f8 -/* 0D7574 8031C574 3C014F80 */ li $at, 0x4F800000 # 4294967296.000000 -/* 0D7578 8031C578 04410004 */ bgez $v0, .L8031C58C -/* 0D757C 8031C57C 46804420 */ cvt.s.w $f16, $f8 -/* 0D7580 8031C580 44815000 */ mtc1 $at, $f10 -/* 0D7584 8031C584 00000000 */ nop -/* 0D7588 8031C588 460A8400 */ add.s $f16, $f16, $f10 -.L8031C58C: -/* 0D758C 8031C58C 460084A1 */ cvt.d.s $f18, $f16 -/* 0D7590 8031C590 46349102 */ mul.d $f4, $f18, $f20 -/* 0D7594 8031C594 462021A0 */ cvt.s.d $f6, $f4 -/* 0D7598 8031C598 1000FF0C */ b .L8031C1CC -/* 0D759C 8031C59C E6460028 */ swc1 $f6, 0x28($s2) -glabel L8031C5A0 -/* 0D75A0 8031C5A0 8E020000 */ lw $v0, ($s0) -/* 0D75A4 8031C5A4 80430000 */ lb $v1, ($v0) -/* 0D75A8 8031C5A8 24580001 */ addiu $t8, $v0, 1 -/* 0D75AC 8031C5AC AE180000 */ sw $t8, ($s0) -/* 0D75B0 8031C5B0 1000FF06 */ b .L8031C1CC -/* 0D75B4 8031C5B4 A643001A */ sh $v1, 0x1a($s2) -glabel L8031C5B8 -/* 0D75B8 8031C5B8 0C0C6C0C */ jal m64_read_s16 -/* 0D75BC 8031C5BC 02002025 */ move $a0, $s0 -/* 0D75C0 8031C5C0 8E8C0014 */ lw $t4, 0x14($s4) -/* 0D75C4 8031C5C4 304DFFFF */ andi $t5, $v0, 0xffff -/* 0D75C8 8031C5C8 018D7821 */ addu $t7, $t4, $t5 -/* 0D75CC 8031C5CC 1000FEFF */ b .L8031C1CC -/* 0D75D0 8031C5D0 AE4F007C */ sw $t7, 0x7c($s2) -glabel L8031C5D4 -/* 0D75D4 8031C5D4 0C0C6C07 */ jal m64_read_u8 -/* 0D75D8 8031C5D8 02002025 */ move $a0, $s0 -/* 0D75DC 8031C5DC 1000FEFB */ b .L8031C1CC -/* 0D75E0 8031C5E0 A2420078 */ sb $v0, 0x78($s2) -glabel L8031C5E4 -/* 0D75E4 8031C5E4 0C0C6C07 */ jal m64_read_u8 -/* 0D75E8 8031C5E8 02002025 */ move $a0, $s0 -/* 0D75EC 8031C5EC 000270C0 */ sll $t6, $v0, 3 -/* 0D75F0 8031C5F0 A64E000E */ sh $t6, 0xe($s2) -/* 0D75F4 8031C5F4 A640000A */ sh $zero, 0xa($s2) -/* 0D75F8 8031C5F8 1000FEF4 */ b .L8031C1CC -/* 0D75FC 8031C5FC A6400012 */ sh $zero, 0x12($s2) -glabel L8031C600 -/* 0D7600 8031C600 0C0C6C07 */ jal m64_read_u8 -/* 0D7604 8031C604 02002025 */ move $a0, $s0 -/* 0D7608 8031C608 00021940 */ sll $v1, $v0, 5 -/* 0D760C 8031C60C A643000C */ sh $v1, 0xc($s2) -/* 0D7610 8031C610 A6430008 */ sh $v1, 8($s2) -/* 0D7614 8031C614 1000FEED */ b .L8031C1CC -/* 0D7618 8031C618 A6400010 */ sh $zero, 0x10($s2) -glabel L8031C61C -/* 0D761C 8031C61C 0C0C6C07 */ jal m64_read_u8 -/* 0D7620 8031C620 02002025 */ move $a0, $s0 -/* 0D7624 8031C624 0002C8C0 */ sll $t9, $v0, 3 -/* 0D7628 8031C628 A659000A */ sh $t9, 0xa($s2) -/* 0D762C 8031C62C 0C0C6C07 */ jal m64_read_u8 -/* 0D7630 8031C630 02002025 */ move $a0, $s0 -/* 0D7634 8031C634 000248C0 */ sll $t1, $v0, 3 -/* 0D7638 8031C638 A649000E */ sh $t1, 0xe($s2) -/* 0D763C 8031C63C 0C0C6C07 */ jal m64_read_u8 -/* 0D7640 8031C640 02002025 */ move $a0, $s0 -/* 0D7644 8031C644 00025100 */ sll $t2, $v0, 4 -/* 0D7648 8031C648 1000FEE0 */ b .L8031C1CC -/* 0D764C 8031C64C A64A0012 */ sh $t2, 0x12($s2) -glabel L8031C650 -/* 0D7650 8031C650 0C0C6C07 */ jal m64_read_u8 -/* 0D7654 8031C654 02002025 */ move $a0, $s0 -/* 0D7658 8031C658 00025940 */ sll $t3, $v0, 5 -/* 0D765C 8031C65C A64B0008 */ sh $t3, 8($s2) -/* 0D7660 8031C660 0C0C6C07 */ jal m64_read_u8 -/* 0D7664 8031C664 02002025 */ move $a0, $s0 -/* 0D7668 8031C668 0002C140 */ sll $t8, $v0, 5 -/* 0D766C 8031C66C A658000C */ sh $t8, 0xc($s2) -/* 0D7670 8031C670 0C0C6C07 */ jal m64_read_u8 -/* 0D7674 8031C674 02002025 */ move $a0, $s0 -/* 0D7678 8031C678 00026100 */ sll $t4, $v0, 4 -/* 0D767C 8031C67C 1000FED3 */ b .L8031C1CC -/* 0D7680 8031C680 A64C0010 */ sh $t4, 0x10($s2) -glabel L8031C684 -/* 0D7684 8031C684 0C0C6C07 */ jal m64_read_u8 -/* 0D7688 8031C688 02002025 */ move $a0, $s0 -/* 0D768C 8031C68C 00026900 */ sll $t5, $v0, 4 -/* 0D7690 8031C690 1000FECE */ b .L8031C1CC -/* 0D7694 8031C694 A64D0014 */ sh $t5, 0x14($s2) -glabel L8031C698 -/* 0D7698 8031C698 0C0C6C07 */ jal m64_read_u8 -/* 0D769C 8031C69C 02002025 */ move $a0, $s0 -/* 0D76A0 8031C6A0 14400003 */ bnez $v0, .L8031C6B0 -/* 0D76A4 8031C6A4 305100FF */ andi $s1, $v0, 0xff -/* 0D76A8 8031C6A8 3C118022 */ lui $s1, %hi(gAudioUpdatesPerFrame) # $s1, 0x8022 -/* 0D76AC 8031C6AC 92316D7E */ lbu $s1, %lo(gAudioUpdatesPerFrame)($s1) -.L8031C6B0: -/* 0D76B0 8031C6B0 1000FEC6 */ b .L8031C1CC -/* 0D76B4 8031C6B4 A2510006 */ sb $s1, 6($s2) -glabel L8031C6B8 -/* 0D76B8 8031C6B8 0C0C6C07 */ jal m64_read_u8 -/* 0D76BC 8031C6BC 02002025 */ move $a0, $s0 -/* 0D76C0 8031C6C0 1000FEC2 */ b .L8031C1CC -/* 0D76C4 8031C6C4 A2420003 */ sb $v0, 3($s2) -glabel L8031C6C8 -/* 0D76C8 8031C6C8 0C0C6C07 */ jal m64_read_u8 -/* 0D76CC 8031C6CC 02002025 */ move $a0, $s0 -/* 0D76D0 8031C6D0 928F0005 */ lbu $t7, 5($s4) -/* 0D76D4 8031C6D4 3C038022 */ lui $v1, %hi(gAlBankSets) # $v1, 0x8022 -/* 0D76D8 8031C6D8 8C636D58 */ lw $v1, %lo(gAlBankSets)($v1) -/* 0D76DC 8031C6DC 000F7040 */ sll $t6, $t7, 1 -/* 0D76E0 8031C6E0 3C048022 */ lui $a0, %hi(gBankLoadedPool) # $a0, 0x8022 -/* 0D76E4 8031C6E4 006EC821 */ addu $t9, $v1, $t6 -/* 0D76E8 8031C6E8 97270000 */ lhu $a3, ($t9) -/* 0D76EC 8031C6EC 248414F8 */ addiu $a0, %lo(gBankLoadedPool) # addiu $a0, $a0, 0x14f8 -/* 0D76F0 8031C6F0 24050002 */ li $a1, 2 -/* 0D76F4 8031C6F4 00E34821 */ addu $t1, $a3, $v1 -/* 0D76F8 8031C6F8 91280000 */ lbu $t0, ($t1) -/* 0D76FC 8031C6FC 00E85021 */ addu $t2, $a3, $t0 -/* 0D7700 8031C700 01425823 */ subu $t3, $t2, $v0 -/* 0D7704 8031C704 0163C021 */ addu $t8, $t3, $v1 -/* 0D7708 8031C708 93110000 */ lbu $s1, ($t8) -/* 0D770C 8031C70C 0C0C5A03 */ jal get_bank_or_seq -/* 0D7710 8031C710 02203025 */ move $a2, $s1 -/* 0D7714 8031C714 1040FEAD */ beqz $v0, .L8031C1CC -/* 0D7718 8031C718 00000000 */ nop -/* 0D771C 8031C71C 1000FEAB */ b .L8031C1CC -/* 0D7720 8031C720 A2510005 */ sb $s1, 5($s2) -glabel L8031C724 -/* 0D7724 8031C724 326C00FF */ andi $t4, $s3, 0xff -/* 0D7728 8031C728 AFAC0038 */ sw $t4, 0x38($sp) -/* 0D772C 8031C72C 0C0C6C07 */ jal m64_read_u8 -/* 0D7730 8031C730 02002025 */ move $a0, $s0 -/* 0D7734 8031C734 305100FF */ andi $s1, $v0, 0xff -/* 0D7738 8031C738 0C0C6C0C */ jal m64_read_s16 -/* 0D773C 8031C73C 02002025 */ move $a0, $s0 -/* 0D7740 8031C740 8E8D0014 */ lw $t5, 0x14($s4) -/* 0D7744 8031C744 8FAE0038 */ lw $t6, 0x38($sp) -/* 0D7748 8031C748 304FFFFF */ andi $t7, $v0, 0xffff -/* 0D774C 8031C74C 01AF1821 */ addu $v1, $t5, $t7 -/* 0D7750 8031C750 01D1C821 */ addu $t9, $t6, $s1 -/* 0D7754 8031C754 1000FE9D */ b .L8031C1CC -/* 0D7758 8031C758 A0790000 */ sb $t9, ($v1) -glabel L8031C75C -/* 0D775C 8031C75C 0C0C6C07 */ jal m64_read_u8 -/* 0D7760 8031C760 02002025 */ move $a0, $s0 -/* 0D7764 8031C764 240100C8 */ li $at, 200 -/* 0D7768 8031C768 16210005 */ bne $s1, $at, .L8031C780 -/* 0D776C 8031C76C 02201825 */ move $v1, $s1 -/* 0D7770 8031C770 02629823 */ subu $s3, $s3, $v0 -/* 0D7774 8031C774 00135E00 */ sll $t3, $s3, 0x18 -/* 0D7778 8031C778 1000FE94 */ b .L8031C1CC -/* 0D777C 8031C77C 000B9E03 */ sra $s3, $t3, 0x18 -.L8031C780: -/* 0D7780 8031C780 240100CC */ li $at, 204 -/* 0D7784 8031C784 14610005 */ bne $v1, $at, .L8031C79C -/* 0D7788 8031C788 02629824 */ and $s3, $s3, $v0 -/* 0D778C 8031C78C 00029E00 */ sll $s3, $v0, 0x18 -/* 0D7790 8031C790 00136603 */ sra $t4, $s3, 0x18 -/* 0D7794 8031C794 1000FE8D */ b .L8031C1CC -/* 0D7798 8031C798 01809825 */ move $s3, $t4 -.L8031C79C: -/* 0D779C 8031C79C 00137600 */ sll $t6, $s3, 0x18 -/* 0D77A0 8031C7A0 1000FE8A */ b .L8031C1CC -/* 0D77A4 8031C7A4 000E9E03 */ sra $s3, $t6, 0x18 -glabel L8031C7A8 -/* 0D77A8 8031C7A8 0C0C6C07 */ jal m64_read_u8 -/* 0D77AC 8031C7AC 02002025 */ move $a0, $s0 -/* 0D77B0 8031C7B0 1000FE86 */ b .L8031C1CC -/* 0D77B4 8031C7B4 A2420002 */ sb $v0, 2($s2) -glabel L8031C7B8 -/* 0D77B8 8031C7B8 0C0C6C0C */ jal m64_read_s16 -/* 0D77BC 8031C7BC 02002025 */ move $a0, $s0 -/* 0D77C0 8031C7C0 8E890014 */ lw $t1, 0x14($s4) -/* 0D77C4 8031C7C4 304AFFFF */ andi $t2, $v0, 0xffff -/* 0D77C8 8031C7C8 01535821 */ addu $t3, $t2, $s3 -/* 0D77CC 8031C7CC 012BC021 */ addu $t8, $t1, $t3 -/* 0D77D0 8031C7D0 1000FE7E */ b .L8031C1CC -/* 0D77D4 8031C7D4 83130000 */ lb $s3, ($t8) -glabel L8031C7D8 -/* 0D77D8 8031C7D8 0C0C6C07 */ jal m64_read_u8 -/* 0D77DC 8031C7DC 02002025 */ move $a0, $s0 -/* 0D77E0 8031C7E0 924E0000 */ lbu $t6, ($s2) -/* 0D77E4 8031C7E4 00026880 */ sll $t5, $v0, 2 -/* 0D77E8 8031C7E8 31AF0004 */ andi $t7, $t5, 4 -/* 0D77EC 8031C7EC 31D9FFFB */ andi $t9, $t6, 0xfffb -/* 0D77F0 8031C7F0 01F95025 */ or $t2, $t7, $t9 -/* 0D77F4 8031C7F4 1000FE75 */ b .L8031C1CC -/* 0D77F8 8031C7F8 A24A0000 */ sb $t2, ($s2) -glabel L8031C7FC -/* 0D77FC 8031C7FC 0C0C6C07 */ jal m64_read_u8 -/* 0D7800 8031C800 02002025 */ move $a0, $s0 -/* 0D7804 8031C804 1000FE71 */ b .L8031C1CC -/* 0D7808 8031C808 A2420001 */ sb $v0, 1($s2) -glabel L8031C80C -/* 0D780C 8031C80C 0C0C6C07 */ jal m64_read_u8 -/* 0D7810 8031C810 02002025 */ move $a0, $s0 -/* 0D7814 8031C814 00024A00 */ sll $t1, $v0, 8 -/* 0D7818 8031C818 1000FE6C */ b .L8031C1CC -/* 0D781C 8031C81C A649007A */ sh $t1, 0x7a($s2) -glabel L8031C820 -/* 0D7820 8031C820 1275FE6A */ beq $s3, $s5, .L8031C1CC -/* 0D7824 8031C824 0013C040 */ sll $t8, $s3, 1 -/* 0D7828 8031C828 920C0018 */ lbu $t4, 0x18($s0) -/* 0D782C 8031C82C 8E4B0030 */ lw $t3, 0x30($s2) -/* 0D7830 8031C830 8E0E0000 */ lw $t6, ($s0) -/* 0D7834 8031C834 258D0001 */ addiu $t5, $t4, 1 -/* 0D7838 8031C838 31AF00FF */ andi $t7, $t5, 0xff -/* 0D783C 8031C83C 000FC880 */ sll $t9, $t7, 2 -/* 0D7840 8031C840 02195021 */ addu $t2, $s0, $t9 -/* 0D7844 8031C844 A20D0018 */ sb $t5, 0x18($s0) -/* 0D7848 8031C848 01781021 */ addu $v0, $t3, $t8 -/* 0D784C 8031C84C AD4E0000 */ sw $t6, ($t2) -/* 0D7850 8031C850 904B0000 */ lbu $t3, ($v0) -/* 0D7854 8031C854 90490001 */ lbu $t1, 1($v0) -/* 0D7858 8031C858 8E8D0014 */ lw $t5, 0x14($s4) -/* 0D785C 8031C85C 000BC200 */ sll $t8, $t3, 8 -/* 0D7860 8031C860 01383821 */ addu $a3, $t1, $t8 -/* 0D7864 8031C864 30ECFFFF */ andi $t4, $a3, 0xffff -/* 0D7868 8031C868 01AC7821 */ addu $t7, $t5, $t4 -/* 0D786C 8031C86C 1000FE57 */ b .L8031C1CC -/* 0D7870 8031C870 AE0F0000 */ sw $t7, ($s0) -.L8031C874: -/* 0D7874 8031C874 3064000F */ andi $a0, $v1, 0xf -/* 0D7878 8031C878 2F2100B1 */ sltiu $at, $t9, 0xb1 -/* 0D787C 8031C87C 1020FE53 */ beqz $at, .L8031C1CC -/* 0D7880 8031C880 308800FF */ andi $t0, $a0, 0xff -/* 0D7884 8031C884 0019C880 */ sll $t9, $t9, 2 -/* 0D7888 8031C888 3C018033 */ lui $at, %hi(jtbl_80337E04) -/* 0D788C 8031C88C 00390821 */ addu $at, $at, $t9 -/* 0D7890 8031C890 8C397E04 */ lw $t9, %lo(jtbl_80337E04)($at) -/* 0D7894 8031C894 03200008 */ jr $t9 -/* 0D7898 8031C898 00000000 */ nop -glabel L8031C89C -/* 0D789C 8031C89C 308E00FF */ andi $t6, $a0, 0xff -/* 0D78A0 8031C8A0 000E5080 */ sll $t2, $t6, 2 -/* 0D78A4 8031C8A4 024A5821 */ addu $t3, $s2, $t2 -/* 0D78A8 8031C8A8 8D630044 */ lw $v1, 0x44($t3) -/* 0D78AC 8031C8AC 1060FE47 */ beqz $v1, .L8031C1CC -/* 0D78B0 8031C8B0 00000000 */ nop -/* 0D78B4 8031C8B4 8C730000 */ lw $s3, ($v1) -/* 0D78B8 8031C8B8 00134840 */ sll $t1, $s3, 1 -/* 0D78BC 8031C8BC 0009C7C2 */ srl $t8, $t1, 0x1f -/* 0D78C0 8031C8C0 00186600 */ sll $t4, $t8, 0x18 -/* 0D78C4 8031C8C4 1000FE41 */ b .L8031C1CC -/* 0D78C8 8031C8C8 000C9E03 */ sra $s3, $t4, 0x18 -glabel L8031C8CC -/* 0D78CC 8031C8CC 308F00FF */ andi $t7, $a0, 0xff -/* 0D78D0 8031C8D0 024FC821 */ addu $t9, $s2, $t7 -/* 0D78D4 8031C8D4 1000FE3D */ b .L8031C1CC -/* 0D78D8 8031C8D8 A3330054 */ sb $s3, 0x54($t9) -glabel L8031C8DC -/* 0D78DC 8031C8DC 308300FF */ andi $v1, $a0, 0xff -/* 0D78E0 8031C8E0 02432821 */ addu $a1, $s2, $v1 -/* 0D78E4 8031C8E4 28610004 */ slti $at, $v1, 4 -/* 0D78E8 8031C8E8 1020FE38 */ beqz $at, .L8031C1CC -/* 0D78EC 8031C8EC 80B30054 */ lb $s3, 0x54($a1) -/* 0D78F0 8031C8F0 1000FE36 */ b .L8031C1CC -/* 0D78F4 8031C8F4 A0B50054 */ sb $s5, 0x54($a1) -glabel L8031C8F8 -/* 0D78F8 8031C8F8 308E00FF */ andi $t6, $a0, 0xff -/* 0D78FC 8031C8FC 024E5021 */ addu $t2, $s2, $t6 -/* 0D7900 8031C900 814B0054 */ lb $t3, 0x54($t2) -/* 0D7904 8031C904 026B9823 */ subu $s3, $s3, $t3 -/* 0D7908 8031C908 00134E00 */ sll $t1, $s3, 0x18 -/* 0D790C 8031C90C 1000FE2F */ b .L8031C1CC -/* 0D7910 8031C910 00099E03 */ sra $s3, $t1, 0x18 -glabel L8031C914 -/* 0D7914 8031C914 0C0C6C0C */ jal m64_read_s16 -/* 0D7918 8031C918 02002025 */ move $a0, $s0 -/* 0D791C 8031C91C 02201825 */ move $v1, $s1 -/* 0D7920 8031C920 3065000F */ andi $a1, $v1, 0xf -/* 0D7924 8031C924 00A01825 */ move $v1, $a1 -/* 0D7928 8031C928 AFA50038 */ sw $a1, 0x38($sp) -/* 0D792C 8031C92C 02402025 */ move $a0, $s2 -/* 0D7930 8031C930 0C0C6A48 */ jal seq_channel_set_layer -/* 0D7934 8031C934 A7A2005A */ sh $v0, 0x5a($sp) -/* 0D7938 8031C938 8FA30038 */ lw $v1, 0x38($sp) -/* 0D793C 8031C93C 1440FE23 */ bnez $v0, .L8031C1CC -/* 0D7940 8031C940 97A7005A */ lhu $a3, 0x5a($sp) -/* 0D7944 8031C944 8E8D0014 */ lw $t5, 0x14($s4) -/* 0D7948 8031C948 0003C880 */ sll $t9, $v1, 2 -/* 0D794C 8031C94C 02597021 */ addu $t6, $s2, $t9 -/* 0D7950 8031C950 8DCA0044 */ lw $t2, 0x44($t6) -/* 0D7954 8031C954 01A77821 */ addu $t7, $t5, $a3 -/* 0D7958 8031C958 1000FE1C */ b .L8031C1CC -/* 0D795C 8031C95C AD4F0054 */ sw $t7, 0x54($t2) -glabel L8031C960 -/* 0D7960 8031C960 02202825 */ move $a1, $s1 -/* 0D7964 8031C964 30AB000F */ andi $t3, $a1, 0xf -/* 0D7968 8031C968 01602825 */ move $a1, $t3 -/* 0D796C 8031C96C 0C0C6A93 */ jal seq_channel_layer_free -/* 0D7970 8031C970 02402025 */ move $a0, $s2 -/* 0D7974 8031C974 1000FE15 */ b .L8031C1CC -/* 0D7978 8031C978 00000000 */ nop -glabel L8031C97C -/* 0D797C 8031C97C 1275FE13 */ beq $s3, $s5, .L8031C1CC -/* 0D7980 8031C980 02402025 */ move $a0, $s2 -/* 0D7984 8031C984 02201825 */ move $v1, $s1 -/* 0D7988 8031C988 3065000F */ andi $a1, $v1, 0xf -/* 0D798C 8031C98C 00A01825 */ move $v1, $a1 -/* 0D7990 8031C990 0C0C6A48 */ jal seq_channel_set_layer -/* 0D7994 8031C994 AFA50038 */ sw $a1, 0x38($sp) -/* 0D7998 8031C998 1055FE0C */ beq $v0, $s5, .L8031C1CC -/* 0D799C 8031C99C 8FA30038 */ lw $v1, 0x38($sp) -/* 0D79A0 8031C9A0 8E580030 */ lw $t8, 0x30($s2) -/* 0D79A4 8031C9A4 00136040 */ sll $t4, $s3, 1 -/* 0D79A8 8031C9A8 8E8A0014 */ lw $t2, 0x14($s4) -/* 0D79AC 8031C9AC 030C1021 */ addu $v0, $t8, $t4 -/* 0D79B0 8031C9B0 90590000 */ lbu $t9, ($v0) -/* 0D79B4 8031C9B4 904D0001 */ lbu $t5, 1($v0) -/* 0D79B8 8031C9B8 00034880 */ sll $t1, $v1, 2 -/* 0D79BC 8031C9BC 00197200 */ sll $t6, $t9, 8 -/* 0D79C0 8031C9C0 0249C021 */ addu $t8, $s2, $t1 -/* 0D79C4 8031C9C4 01AE3821 */ addu $a3, $t5, $t6 -/* 0D79C8 8031C9C8 8F0C0044 */ lw $t4, 0x44($t8) -/* 0D79CC 8031C9CC 30EFFFFF */ andi $t7, $a3, 0xffff -/* 0D79D0 8031C9D0 014F5821 */ addu $t3, $t2, $t7 -/* 0D79D4 8031C9D4 1000FDFD */ b .L8031C1CC -/* 0D79D8 8031C9D8 AD8B0054 */ sw $t3, 0x54($t4) -glabel L8031C9DC -/* 0D79DC 8031C9DC 1000FDFB */ b .L8031C1CC -/* 0D79E0 8031C9E0 A2440004 */ sb $a0, 4($s2) -glabel L8031C9E4 -/* 0D79E4 8031C9E4 0C0C6C0C */ jal m64_read_s16 -/* 0D79E8 8031C9E8 02002025 */ move $a0, $s0 -/* 0D79EC 8031C9EC 8E8D0014 */ lw $t5, 0x14($s4) -/* 0D79F0 8031C9F0 02202825 */ move $a1, $s1 -/* 0D79F4 8031C9F4 30B9000F */ andi $t9, $a1, 0xf -/* 0D79F8 8031C9F8 304EFFFF */ andi $t6, $v0, 0xffff -/* 0D79FC 8031C9FC 03202825 */ move $a1, $t9 -/* 0D7A00 8031CA00 02802025 */ move $a0, $s4 -/* 0D7A04 8031CA04 0C0C6B60 */ jal sequence_channel_enable -/* 0D7A08 8031CA08 01AE3021 */ addu $a2, $t5, $t6 -/* 0D7A0C 8031CA0C 1000FDEF */ b .L8031C1CC -/* 0D7A10 8031CA10 00000000 */ nop -glabel L8031CA14 -/* 0D7A14 8031CA14 322A000F */ andi $t2, $s1, 0xf -/* 0D7A18 8031CA18 000A4880 */ sll $t1, $t2, 2 -/* 0D7A1C 8031CA1C 0289C021 */ addu $t8, $s4, $t1 -/* 0D7A20 8031CA20 0C0C6AB4 */ jal sequence_channel_disable -/* 0D7A24 8031CA24 8F04002C */ lw $a0, 0x2c($t8) -/* 0D7A28 8031CA28 1000FDE8 */ b .L8031C1CC -/* 0D7A2C 8031CA2C 00000000 */ nop -glabel L8031CA30 -/* 0D7A30 8031CA30 02002025 */ move $a0, $s0 -/* 0D7A34 8031CA34 0C0C6C07 */ jal m64_read_u8 -/* 0D7A38 8031CA38 A3A8005D */ sb $t0, 0x5d($sp) -/* 0D7A3C 8031CA3C 93A8005D */ lbu $t0, 0x5d($sp) -/* 0D7A40 8031CA40 00085880 */ sll $t3, $t0, 2 -/* 0D7A44 8031CA44 028B6021 */ addu $t4, $s4, $t3 -/* 0D7A48 8031CA48 8D99002C */ lw $t9, 0x2c($t4) -/* 0D7A4C 8031CA4C 03226821 */ addu $t5, $t9, $v0 -/* 0D7A50 8031CA50 1000FDDE */ b .L8031C1CC -/* 0D7A54 8031CA54 A1B30054 */ sb $s3, 0x54($t5) -glabel L8031CA58 -/* 0D7A58 8031CA58 02002025 */ move $a0, $s0 -/* 0D7A5C 8031CA5C 0C0C6C07 */ jal m64_read_u8 -/* 0D7A60 8031CA60 A3A8005D */ sb $t0, 0x5d($sp) -/* 0D7A64 8031CA64 93A8005D */ lbu $t0, 0x5d($sp) -/* 0D7A68 8031CA68 00087080 */ sll $t6, $t0, 2 -/* 0D7A6C 8031CA6C 028E7821 */ addu $t7, $s4, $t6 -/* 0D7A70 8031CA70 8DEA002C */ lw $t2, 0x2c($t7) -/* 0D7A74 8031CA74 01424821 */ addu $t1, $t2, $v0 -/* 0D7A78 8031CA78 1000FDD4 */ b .L8031C1CC -/* 0D7A7C 8031CA7C 81330054 */ lb $s3, 0x54($t1) -.L8031CA80: -/* 0D7A80 8031CA80 02408825 */ move $s1, $s2 -.L8031CA84: -/* 0D7A84 8031CA84 24120010 */ li $s2, 16 -/* 0D7A88 8031CA88 00008025 */ move $s0, $zero -.L8031CA8C: -/* 0D7A8C 8031CA8C 8E240044 */ lw $a0, 0x44($s1) -/* 0D7A90 8031CA90 50800004 */ beql $a0, $zero, .L8031CAA4 -/* 0D7A94 8031CA94 26100004 */ addiu $s0, $s0, 4 -/* 0D7A98 8031CA98 0C0C6C29 */ jal seq_channel_layer_process_script -/* 0D7A9C 8031CA9C 00000000 */ nop -/* 0D7AA0 8031CAA0 26100004 */ addiu $s0, $s0, 4 -.L8031CAA4: -/* 0D7AA4 8031CAA4 1612FFF9 */ bne $s0, $s2, .L8031CA8C -/* 0D7AA8 8031CAA8 26310004 */ addiu $s1, $s1, 4 -.L8031CAAC: -/* 0D7AAC 8031CAAC 8FBF0034 */ lw $ra, 0x34($sp) -.L8031CAB0: -/* 0D7AB0 8031CAB0 D7B40010 */ ldc1 $f20, 0x10($sp) -/* 0D7AB4 8031CAB4 8FB0001C */ lw $s0, 0x1c($sp) -/* 0D7AB8 8031CAB8 8FB10020 */ lw $s1, 0x20($sp) -/* 0D7ABC 8031CABC 8FB20024 */ lw $s2, 0x24($sp) -/* 0D7AC0 8031CAC0 8FB30028 */ lw $s3, 0x28($sp) -/* 0D7AC4 8031CAC4 8FB4002C */ lw $s4, 0x2c($sp) -/* 0D7AC8 8031CAC8 8FB50030 */ lw $s5, 0x30($sp) -/* 0D7ACC 8031CACC 03E00008 */ jr $ra -/* 0D7AD0 8031CAD0 27BD0068 */ addiu $sp, $sp, 0x68 diff --git a/asm/non_matchings/sequence_channel_process_script_us.s b/asm/non_matchings/sequence_channel_process_script_us.s deleted file mode 100644 index d64254d7..00000000 --- a/asm/non_matchings/sequence_channel_process_script_us.s +++ /dev/null @@ -1,922 +0,0 @@ -.late_rodata -.late_rodata_alignment 8 -glabel jtbl_80337D08 # US: 80338EC0 - .word L_U_8031D3A8 - .word L_U_8031D354 - .word L_U_8031D3C4 - .word L_U_8031D3D4 - .word L_U_8031D370 - .word L_U_8031D5E4 - .word L_U_8031D640 - .word L_U_8031D678 - .word L_U_8031D678 - .word L_U_8031D6C4 - .word L_U_8031D6D4 - .word L_U_8031D678 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D6F4 - .word L_U_8031D718 - .word L_U_8031D728 - .word L_U_8031D44C - .word L_U_8031D5D4 - .word L_U_8031D144 - .word L_U_8031D5B4 - .word L_U_8031D51C - .word L_U_8031D500 - .word L_U_8031D4F0 - .word L_U_8031D4D4 - .word L_U_8031D4BC - .word L_U_8031D498 - .word L_U_8031D474 - .word L_U_8031D424 - .word L_U_8031D3E4 - .word L_U_8031D400 - .word L_U_8031D56C - .word L_U_8031D538 - .word L_U_8031D5A0 - .word L_U_8031D73C - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D344 - .word L_U_8031D31C - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D2C4 - .word L_U_8031D2B4 - .word L_U_8031D26C - .word L_U_8031D234 - .word L_U_8031D2C4 - .word L_U_8031D2C4 - .word L_U_8031D2C4 - .word L_U_8031D1F8 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - -glabel jtbl_80337E04 # US: 80338FBC - .word L_U_8031D7B8 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D900 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D930 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D94C - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D974 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D814 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D8F8 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D7E8 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D7F8 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D830 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D87C - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D144 - .word L_U_8031D898 - -.text -glabel sequence_channel_process_script -/* 0D808C 8031D08C 27BDFFA0 */ addiu $sp, $sp, -0x60 -/* 0D8090 8031D090 AFBF002C */ sw $ra, 0x2c($sp) -/* 0D8094 8031D094 AFB50028 */ sw $s5, 0x28($sp) -/* 0D8098 8031D098 AFB40024 */ sw $s4, 0x24($sp) -/* 0D809C 8031D09C AFB30020 */ sw $s3, 0x20($sp) -/* 0D80A0 8031D0A0 AFB2001C */ sw $s2, 0x1c($sp) -/* 0D80A4 8031D0A4 AFB10018 */ sw $s1, 0x18($sp) -/* 0D80A8 8031D0A8 AFB00014 */ sw $s0, 0x14($sp) -/* 0D80AC 8031D0AC 8C820000 */ lw $v0, ($a0) -/* 0D80B0 8031D0B0 00809025 */ move $s2, $a0 -/* 0D80B4 8031D0B4 000277C2 */ srl $t6, $v0, 0x1f -/* 0D80B8 8031D0B8 11C00243 */ beqz $t6, .L8031D9C8 -/* 0D80BC 8031D0BC 0002C080 */ sll $t8, $v0, 2 -/* 0D80C0 8031D0C0 0701000D */ bgez $t8, .L8031D0F8 -/* 0D80C4 8031D0C4 00008025 */ move $s0, $zero -/* 0D80C8 8031D0C8 00808825 */ move $s1, $a0 -/* 0D80CC 8031D0CC 24120010 */ li $s2, 16 -.L8031D0D0: -/* 0D80D0 8031D0D0 8E240044 */ lw $a0, 0x44($s1) -/* 0D80D4 8031D0D4 50800004 */ beql $a0, $zero, .L8031D0E8 -/* 0D80D8 8031D0D8 26100004 */ addiu $s0, $s0, 4 -/* 0D80DC 8031D0DC 0C0C7031 */ jal seq_channel_layer_process_script -/* 0D80E0 8031D0E0 00000000 */ nop -/* 0D80E4 8031D0E4 26100004 */ addiu $s0, $s0, 4 -.L8031D0E8: -/* 0D80E8 8031D0E8 1612FFF9 */ bne $s0, $s2, .L8031D0D0 -/* 0D80EC 8031D0EC 26310004 */ addiu $s1, $s1, 4 -/* 0D80F0 8031D0F0 10000236 */ b .L8031D9CC -/* 0D80F4 8031D0F4 8FBF002C */ lw $ra, 0x2c($sp) -.L8031D0F8: -/* 0D80F8 8031D0F8 8E540040 */ lw $s4, 0x40($s2) -/* 0D80FC 8031D0FC 8E990000 */ lw $t9, ($s4) -/* 0D8100 8031D100 00195080 */ sll $t2, $t9, 2 -/* 0D8104 8031D104 05430006 */ bgezl $t2, .L8031D120 -/* 0D8108 8031D108 96430016 */ lhu $v1, 0x16($s2) -/* 0D810C 8031D10C 924B0002 */ lbu $t3, 2($s2) -/* 0D8110 8031D110 316C0080 */ andi $t4, $t3, 0x80 -/* 0D8114 8031D114 5580022D */ bnezl $t4, .L8031D9CC -/* 0D8118 8031D118 8FBF002C */ lw $ra, 0x2c($sp) -/* 0D811C 8031D11C 96430016 */ lhu $v1, 0x16($s2) -.L8031D120: -/* 0D8120 8031D120 2650005C */ addiu $s0, $s2, 0x5c -/* 0D8124 8031D124 2415FFFF */ li $s5, -1 -/* 0D8128 8031D128 10600004 */ beqz $v1, .L8031D13C -/* 0D812C 8031D12C 00601025 */ move $v0, $v1 -/* 0D8130 8031D130 246DFFFF */ addiu $t5, $v1, -1 -/* 0D8134 8031D134 A64D0016 */ sh $t5, 0x16($s2) -/* 0D8138 8031D138 31A2FFFF */ andi $v0, $t5, 0xffff -.L8031D13C: -/* 0D813C 8031D13C 14400217 */ bnez $v0, .L8031D99C -/* 0D8140 8031D140 83B3004B */ lb $s3, 0x4b($sp) -glabel L_U_8031D144 -.L8031D144: -/* 0D8144 8031D144 0C0C700F */ jal m64_read_u8 -/* 0D8148 8031D148 02002025 */ move $a0, $s0 -/* 0D814C 8031D14C 240100FF */ li $at, 255 -/* 0D8150 8031D150 305100FF */ andi $s1, $v0, 0xff -/* 0D8154 8031D154 1441000E */ bne $v0, $at, .L8031D190 -/* 0D8158 8031D158 00401825 */ move $v1, $v0 -/* 0D815C 8031D15C 92040018 */ lbu $a0, 0x18($s0) -/* 0D8160 8031D160 14800005 */ bnez $a0, .L8031D178 -/* 0D8164 8031D164 248EFFFF */ addiu $t6, $a0, -1 -/* 0D8168 8031D168 0C0C6EBC */ jal sequence_channel_disable -/* 0D816C 8031D16C 02402025 */ move $a0, $s2 -/* 0D8170 8031D170 1000020B */ b .L8031D9A0 -/* 0D8174 8031D174 02408825 */ move $s1, $s2 -.L8031D178: -/* 0D8178 8031D178 31CF00FF */ andi $t7, $t6, 0xff -/* 0D817C 8031D17C 000FC080 */ sll $t8, $t7, 2 -/* 0D8180 8031D180 0218C821 */ addu $t9, $s0, $t8 -/* 0D8184 8031D184 A20E0018 */ sb $t6, 0x18($s0) -/* 0D8188 8031D188 8F290004 */ lw $t1, 4($t9) -/* 0D818C 8031D18C AE090000 */ sw $t1, ($s0) -.L8031D190: -/* 0D8190 8031D190 240100FE */ li $at, 254 -/* 0D8194 8031D194 10610201 */ beq $v1, $at, .L8031D99C -/* 0D8198 8031D198 240100FD */ li $at, 253 -/* 0D819C 8031D19C 14610005 */ bne $v1, $at, .L8031D1B4 -/* 0D81A0 8031D1A0 307900F0 */ andi $t9, $v1, 0xf0 -/* 0D81A4 8031D1A4 0C0C7020 */ jal m64_read_compressed_u16 -/* 0D81A8 8031D1A8 02002025 */ move $a0, $s0 -/* 0D81AC 8031D1AC 100001FB */ b .L8031D99C -/* 0D81B0 8031D1B0 A6420016 */ sh $v0, 0x16($s2) -.L8031D1B4: -/* 0D81B4 8031D1B4 240100F3 */ li $at, 243 -/* 0D81B8 8031D1B8 14610005 */ bne $v1, $at, .L8031D1D0 -/* 0D81BC 8031D1BC 246DFF3F */ addiu $t5, $v1, -0xc1 -/* 0D81C0 8031D1C0 924B0000 */ lbu $t3, ($s2) -/* 0D81C4 8031D1C4 356C0020 */ ori $t4, $t3, 0x20 -/* 0D81C8 8031D1C8 100001F4 */ b .L8031D99C -/* 0D81CC 8031D1CC A24C0000 */ sb $t4, ($s2) -.L8031D1D0: -/* 0D81D0 8031D1D0 286100C1 */ slti $at, $v1, 0xc1 -/* 0D81D4 8031D1D4 1420016E */ bnez $at, .L8031D790 -/* 0D81D8 8031D1D8 2DA1003F */ sltiu $at, $t5, 0x3f -/* 0D81DC 8031D1DC 1020FFD9 */ beqz $at, .L8031D144 -/* 0D81E0 8031D1E0 000D6880 */ sll $t5, $t5, 2 -/* 0D81E4 8031D1E4 3C018034 */ lui $at, %hi(jtbl_80337D08) -/* 0D81E8 8031D1E8 002D0821 */ addu $at, $at, $t5 -/* 0D81EC 8031D1EC 8C2D8EC0 */ lw $t5, %lo(jtbl_80337D08)($at) -/* 0D81F0 8031D1F0 01A00008 */ jr $t5 -/* 0D81F4 8031D1F4 00000000 */ nop -glabel L_U_8031D1F8 -/* 0D81F8 8031D1F8 0C0C7014 */ jal m64_read_s16 -/* 0D81FC 8031D1FC 02002025 */ move $a0, $s0 -/* 0D8200 8031D200 920E0018 */ lbu $t6, 0x18($s0) -/* 0D8204 8031D204 8E180000 */ lw $t8, ($s0) -/* 0D8208 8031D208 304CFFFF */ andi $t4, $v0, 0xffff -/* 0D820C 8031D20C 25CF0001 */ addiu $t7, $t6, 1 -/* 0D8210 8031D210 31F900FF */ andi $t9, $t7, 0xff -/* 0D8214 8031D214 00194880 */ sll $t1, $t9, 2 -/* 0D8218 8031D218 02095021 */ addu $t2, $s0, $t1 -/* 0D821C 8031D21C A20F0018 */ sb $t7, 0x18($s0) -/* 0D8220 8031D220 AD580000 */ sw $t8, ($t2) -/* 0D8224 8031D224 8E8B0014 */ lw $t3, 0x14($s4) -/* 0D8228 8031D228 016C6821 */ addu $t5, $t3, $t4 -/* 0D822C 8031D22C 1000FFC5 */ b .L8031D144 -/* 0D8230 8031D230 AE0D0000 */ sw $t5, ($s0) -glabel L_U_8031D234 -/* 0D8234 8031D234 0C0C700F */ jal m64_read_u8 -/* 0D8238 8031D238 02002025 */ move $a0, $s0 -/* 0D823C 8031D23C 920E0018 */ lbu $t6, 0x18($s0) -/* 0D8240 8031D240 020E7821 */ addu $t7, $s0, $t6 -/* 0D8244 8031D244 A1E20014 */ sb $v0, 0x14($t7) -/* 0D8248 8031D248 92190018 */ lbu $t9, 0x18($s0) -/* 0D824C 8031D24C 8E180000 */ lw $t8, ($s0) -/* 0D8250 8031D250 27290001 */ addiu $t1, $t9, 1 -/* 0D8254 8031D254 312A00FF */ andi $t2, $t1, 0xff -/* 0D8258 8031D258 000A5880 */ sll $t3, $t2, 2 -/* 0D825C 8031D25C 020B6021 */ addu $t4, $s0, $t3 -/* 0D8260 8031D260 A2090018 */ sb $t1, 0x18($s0) -/* 0D8264 8031D264 1000FFB7 */ b .L8031D144 -/* 0D8268 8031D268 AD980000 */ sw $t8, ($t4) -glabel L_U_8031D26C -/* 0D826C 8031D26C 920D0018 */ lbu $t5, 0x18($s0) -/* 0D8270 8031D270 020D1021 */ addu $v0, $s0, $t5 -/* 0D8274 8031D274 904E0013 */ lbu $t6, 0x13($v0) -/* 0D8278 8031D278 25CFFFFF */ addiu $t7, $t6, -1 -/* 0D827C 8031D27C A04F0013 */ sb $t7, 0x13($v0) -/* 0D8280 8031D280 92040018 */ lbu $a0, 0x18($s0) -/* 0D8284 8031D284 0204C821 */ addu $t9, $s0, $a0 -/* 0D8288 8031D288 93290013 */ lbu $t1, 0x13($t9) -/* 0D828C 8031D28C 00801825 */ move $v1, $a0 -/* 0D8290 8031D290 00035080 */ sll $t2, $v1, 2 -/* 0D8294 8031D294 11200005 */ beqz $t1, .L8031D2AC -/* 0D8298 8031D298 248CFFFF */ addiu $t4, $a0, -1 -/* 0D829C 8031D29C 020A5821 */ addu $t3, $s0, $t2 -/* 0D82A0 8031D2A0 8D780000 */ lw $t8, ($t3) -/* 0D82A4 8031D2A4 1000FFA7 */ b .L8031D144 -/* 0D82A8 8031D2A8 AE180000 */ sw $t8, ($s0) -.L8031D2AC: -/* 0D82AC 8031D2AC 1000FFA5 */ b .L8031D144 -/* 0D82B0 8031D2B0 A20C0018 */ sb $t4, 0x18($s0) -glabel L_U_8031D2B4 -/* 0D82B4 8031D2B4 920D0018 */ lbu $t5, 0x18($s0) -/* 0D82B8 8031D2B8 25AEFFFF */ addiu $t6, $t5, -1 -/* 0D82BC 8031D2BC 1000FFA1 */ b .L8031D144 -/* 0D82C0 8031D2C0 A20E0018 */ sb $t6, 0x18($s0) -glabel L_U_8031D2C4 -/* 0D82C4 8031D2C4 0C0C7014 */ jal m64_read_s16 -/* 0D82C8 8031D2C8 02002025 */ move $a0, $s0 -/* 0D82CC 8031D2CC 240100FA */ li $at, 250 -/* 0D82D0 8031D2D0 16210003 */ bne $s1, $at, .L8031D2E0 -/* 0D82D4 8031D2D4 02201825 */ move $v1, $s1 -/* 0D82D8 8031D2D8 1660FF9A */ bnez $s3, .L8031D144 -/* 0D82DC 8031D2DC 00000000 */ nop -.L8031D2E0: -/* 0D82E0 8031D2E0 240100F9 */ li $at, 249 -/* 0D82E4 8031D2E4 54610004 */ bnel $v1, $at, .L8031D2F8 -/* 0D82E8 8031D2E8 240100F5 */ li $at, 245 -/* 0D82EC 8031D2EC 0661FF95 */ bgez $s3, .L8031D144 -/* 0D82F0 8031D2F0 00000000 */ nop -/* 0D82F4 8031D2F4 240100F5 */ li $at, 245 -.L8031D2F8: -/* 0D82F8 8031D2F8 54610004 */ bnel $v1, $at, .L8031D30C -/* 0D82FC 8031D2FC 8E8F0014 */ lw $t7, 0x14($s4) -/* 0D8300 8031D300 0660FF90 */ bltz $s3, .L8031D144 -/* 0D8304 8031D304 00000000 */ nop -/* 0D8308 8031D308 8E8F0014 */ lw $t7, 0x14($s4) -.L8031D30C: -/* 0D830C 8031D30C 3059FFFF */ andi $t9, $v0, 0xffff -/* 0D8310 8031D310 01F94821 */ addu $t1, $t7, $t9 -/* 0D8314 8031D314 1000FF8B */ b .L8031D144 -/* 0D8318 8031D318 AE090000 */ sw $t1, ($s0) -glabel L_U_8031D31C -/* 0D831C 8031D31C 26510080 */ addiu $s1, $s2, 0x80 -/* 0D8320 8031D320 0C0C68DA */ jal note_pool_clear -/* 0D8324 8031D324 02202025 */ move $a0, $s1 -/* 0D8328 8031D328 0C0C700F */ jal m64_read_u8 -/* 0D832C 8031D32C 02002025 */ move $a0, $s0 -/* 0D8330 8031D330 02202025 */ move $a0, $s1 -/* 0D8334 8031D334 0C0C6925 */ jal note_pool_fill -/* 0D8338 8031D338 00402825 */ move $a1, $v0 -/* 0D833C 8031D33C 1000FF81 */ b .L8031D144 -/* 0D8340 8031D340 00000000 */ nop -glabel L_U_8031D344 -/* 0D8344 8031D344 0C0C68DA */ jal note_pool_clear -/* 0D8348 8031D348 26440080 */ addiu $a0, $s2, 0x80 -/* 0D834C 8031D34C 1000FF7D */ b .L8031D144 -/* 0D8350 8031D350 00000000 */ nop -glabel L_U_8031D354 -/* 0D8354 8031D354 0C0C7014 */ jal m64_read_s16 -/* 0D8358 8031D358 02002025 */ move $a0, $s0 -/* 0D835C 8031D35C 8E8A0014 */ lw $t2, 0x14($s4) -/* 0D8360 8031D360 304BFFFF */ andi $t3, $v0, 0xffff -/* 0D8364 8031D364 014BC021 */ addu $t8, $t2, $t3 -/* 0D8368 8031D368 1000FF76 */ b .L8031D144 -/* 0D836C 8031D36C AE580030 */ sw $t8, 0x30($s2) -glabel L_U_8031D370 -/* 0D8370 8031D370 1275FF74 */ beq $s3, $s5, .L8031D144 -/* 0D8374 8031D374 00000000 */ nop -/* 0D8378 8031D378 8E4C0030 */ lw $t4, 0x30($s2) -/* 0D837C 8031D37C 00136840 */ sll $t5, $s3, 1 -/* 0D8380 8031D380 8E8A0014 */ lw $t2, 0x14($s4) -/* 0D8384 8031D384 018D1021 */ addu $v0, $t4, $t5 -/* 0D8388 8031D388 904F0000 */ lbu $t7, ($v0) -/* 0D838C 8031D38C 904E0001 */ lbu $t6, 1($v0) -/* 0D8390 8031D390 000FCA00 */ sll $t9, $t7, 8 -/* 0D8394 8031D394 01D93821 */ addu $a3, $t6, $t9 -/* 0D8398 8031D398 30E9FFFF */ andi $t1, $a3, 0xffff -/* 0D839C 8031D39C 01495821 */ addu $t3, $t2, $t1 -/* 0D83A0 8031D3A0 1000FF68 */ b .L8031D144 -/* 0D83A4 8031D3A4 AE4B0030 */ sw $t3, 0x30($s2) -glabel L_U_8031D3A8 -/* 0D83A8 8031D3A8 0C0C700F */ jal m64_read_u8 -/* 0D83AC 8031D3AC 02002025 */ move $a0, $s0 -/* 0D83B0 8031D3B0 02402025 */ move $a0, $s2 -/* 0D83B4 8031D3B4 0C0C73F5 */ jal set_instrument -/* 0D83B8 8031D3B8 304500FF */ andi $a1, $v0, 0xff -/* 0D83BC 8031D3BC 1000FF61 */ b .L8031D144 -/* 0D83C0 8031D3C0 00000000 */ nop -glabel L_U_8031D3C4 -/* 0D83C4 8031D3C4 92580000 */ lbu $t8, ($s2) -/* 0D83C8 8031D3C8 330CFFFD */ andi $t4, $t8, 0xfffd -/* 0D83CC 8031D3CC 1000FF5D */ b .L8031D144 -/* 0D83D0 8031D3D0 A24C0000 */ sb $t4, ($s2) -glabel L_U_8031D3D4 -/* 0D83D4 8031D3D4 924F0000 */ lbu $t7, ($s2) -/* 0D83D8 8031D3D8 35EE0002 */ ori $t6, $t7, 2 -/* 0D83DC 8031D3DC 1000FF59 */ b .L8031D144 -/* 0D83E0 8031D3E0 A24E0000 */ sb $t6, ($s2) -glabel L_U_8031D3E4 -/* 0D83E4 8031D3E4 0C0C700F */ jal m64_read_u8 -/* 0D83E8 8031D3E8 02002025 */ move $a0, $s0 -/* 0D83EC 8031D3EC 02402025 */ move $a0, $s2 -/* 0D83F0 8031D3F0 0C0C741A */ jal sequence_channel_set_volume -/* 0D83F4 8031D3F4 304500FF */ andi $a1, $v0, 0xff -/* 0D83F8 8031D3F8 1000FF52 */ b .L8031D144 -/* 0D83FC 8031D3FC 00000000 */ nop -glabel L_U_8031D400 -/* 0D8400 8031D400 0C0C700F */ jal m64_read_u8 -/* 0D8404 8031D404 02002025 */ move $a0, $s0 -/* 0D8408 8031D408 44822000 */ mtc1 $v0, $f4 -/* 0D840C 8031D40C 3C013C00 */ li $at, 0x3C000000 # 0.007812 -/* 0D8410 8031D410 44814000 */ mtc1 $at, $f8 -/* 0D8414 8031D414 468021A0 */ cvt.s.w $f6, $f4 -/* 0D8418 8031D418 46083282 */ mul.s $f10, $f6, $f8 -/* 0D841C 8031D41C 1000FF49 */ b .L8031D144 -/* 0D8420 8031D420 E64A001C */ swc1 $f10, 0x1c($s2) -glabel L_U_8031D424 -/* 0D8424 8031D424 0C0C7014 */ jal m64_read_s16 -/* 0D8428 8031D428 02002025 */ move $a0, $s0 -/* 0D842C 8031D42C 3059FFFF */ andi $t9, $v0, 0xffff -/* 0D8430 8031D430 44998000 */ mtc1 $t9, $f16 -/* 0D8434 8031D434 3C014700 */ li $at, 0x47000000 # 32768.000000 -/* 0D8438 8031D438 44812000 */ mtc1 $at, $f4 -/* 0D843C 8031D43C 468084A0 */ cvt.s.w $f18, $f16 -/* 0D8440 8031D440 46049183 */ div.s $f6, $f18, $f4 -/* 0D8444 8031D444 1000FF3F */ b .L8031D144 -/* 0D8448 8031D448 E646002C */ swc1 $f6, 0x2c($s2) -glabel L_U_8031D44C -/* 0D844C 8031D44C 0C0C700F */ jal m64_read_u8 -/* 0D8450 8031D450 02002025 */ move $a0, $s0 -/* 0D8454 8031D454 2449007F */ addiu $t1, $v0, 0x7f -/* 0D8458 8031D458 312A00FF */ andi $t2, $t1, 0xff -/* 0D845C 8031D45C 000A5880 */ sll $t3, $t2, 2 -/* 0D8460 8031D460 3C018033 */ lui $at, %hi(gPitchBendFrequencyScale) -/* 0D8464 8031D464 002B0821 */ addu $at, $at, $t3 -/* 0D8468 8031D468 C4283598 */ lwc1 $f8, %lo(gPitchBendFrequencyScale)($at) -/* 0D846C 8031D46C 1000FF35 */ b .L8031D144 -/* 0D8470 8031D470 E648002C */ swc1 $f8, 0x2c($s2) -glabel L_U_8031D474 -/* 0D8474 8031D474 0C0C700F */ jal m64_read_u8 -/* 0D8478 8031D478 02002025 */ move $a0, $s0 -/* 0D847C 8031D47C 44825000 */ mtc1 $v0, $f10 -/* 0D8480 8031D480 3C013C00 */ li $at, 0x3C000000 # 0.007812 -/* 0D8484 8031D484 44819000 */ mtc1 $at, $f18 -/* 0D8488 8031D488 46805420 */ cvt.s.w $f16, $f10 -/* 0D848C 8031D48C 46128102 */ mul.s $f4, $f16, $f18 -/* 0D8490 8031D490 1000FF2C */ b .L8031D144 -/* 0D8494 8031D494 E6440024 */ swc1 $f4, 0x24($s2) -glabel L_U_8031D498 -/* 0D8498 8031D498 0C0C700F */ jal m64_read_u8 -/* 0D849C 8031D49C 02002025 */ move $a0, $s0 -/* 0D84A0 8031D4A0 44823000 */ mtc1 $v0, $f6 -/* 0D84A4 8031D4A4 3C013C00 */ li $at, 0x3C000000 # 0.007812 -/* 0D84A8 8031D4A8 44815000 */ mtc1 $at, $f10 -/* 0D84AC 8031D4AC 46803220 */ cvt.s.w $f8, $f6 -/* 0D84B0 8031D4B0 460A4402 */ mul.s $f16, $f8, $f10 -/* 0D84B4 8031D4B4 1000FF23 */ b .L8031D144 -/* 0D84B8 8031D4B8 E6500028 */ swc1 $f16, 0x28($s2) -glabel L_U_8031D4BC -/* 0D84BC 8031D4BC 8E020000 */ lw $v0, ($s0) -/* 0D84C0 8031D4C0 80430000 */ lb $v1, ($v0) -/* 0D84C4 8031D4C4 24580001 */ addiu $t8, $v0, 1 -/* 0D84C8 8031D4C8 AE180000 */ sw $t8, ($s0) -/* 0D84CC 8031D4CC 1000FF1D */ b .L8031D144 -/* 0D84D0 8031D4D0 A643001A */ sh $v1, 0x1a($s2) -glabel L_U_8031D4D4 -/* 0D84D4 8031D4D4 0C0C7014 */ jal m64_read_s16 -/* 0D84D8 8031D4D8 02002025 */ move $a0, $s0 -/* 0D84DC 8031D4DC 8E8C0014 */ lw $t4, 0x14($s4) -/* 0D84E0 8031D4E0 304DFFFF */ andi $t5, $v0, 0xffff -/* 0D84E4 8031D4E4 018D7821 */ addu $t7, $t4, $t5 -/* 0D84E8 8031D4E8 1000FF16 */ b .L8031D144 -/* 0D84EC 8031D4EC AE4F007C */ sw $t7, 0x7c($s2) -glabel L_U_8031D4F0 -/* 0D84F0 8031D4F0 0C0C700F */ jal m64_read_u8 -/* 0D84F4 8031D4F4 02002025 */ move $a0, $s0 -/* 0D84F8 8031D4F8 1000FF12 */ b .L8031D144 -/* 0D84FC 8031D4FC A2420078 */ sb $v0, 0x78($s2) -glabel L_U_8031D500 -/* 0D8500 8031D500 0C0C700F */ jal m64_read_u8 -/* 0D8504 8031D504 02002025 */ move $a0, $s0 -/* 0D8508 8031D508 000270C0 */ sll $t6, $v0, 3 -/* 0D850C 8031D50C A64E000E */ sh $t6, 0xe($s2) -/* 0D8510 8031D510 A640000A */ sh $zero, 0xa($s2) -/* 0D8514 8031D514 1000FF0B */ b .L8031D144 -/* 0D8518 8031D518 A6400012 */ sh $zero, 0x12($s2) -glabel L_U_8031D51C -/* 0D851C 8031D51C 0C0C700F */ jal m64_read_u8 -/* 0D8520 8031D520 02002025 */ move $a0, $s0 -/* 0D8524 8031D524 00021940 */ sll $v1, $v0, 5 -/* 0D8528 8031D528 A643000C */ sh $v1, 0xc($s2) -/* 0D852C 8031D52C A6430008 */ sh $v1, 8($s2) -/* 0D8530 8031D530 1000FF04 */ b .L8031D144 -/* 0D8534 8031D534 A6400010 */ sh $zero, 0x10($s2) -glabel L_U_8031D538 -/* 0D8538 8031D538 0C0C700F */ jal m64_read_u8 -/* 0D853C 8031D53C 02002025 */ move $a0, $s0 -/* 0D8540 8031D540 0002C8C0 */ sll $t9, $v0, 3 -/* 0D8544 8031D544 A659000A */ sh $t9, 0xa($s2) -/* 0D8548 8031D548 0C0C700F */ jal m64_read_u8 -/* 0D854C 8031D54C 02002025 */ move $a0, $s0 -/* 0D8550 8031D550 000248C0 */ sll $t1, $v0, 3 -/* 0D8554 8031D554 A649000E */ sh $t1, 0xe($s2) -/* 0D8558 8031D558 0C0C700F */ jal m64_read_u8 -/* 0D855C 8031D55C 02002025 */ move $a0, $s0 -/* 0D8560 8031D560 00025100 */ sll $t2, $v0, 4 -/* 0D8564 8031D564 1000FEF7 */ b .L8031D144 -/* 0D8568 8031D568 A64A0012 */ sh $t2, 0x12($s2) -glabel L_U_8031D56C -/* 0D856C 8031D56C 0C0C700F */ jal m64_read_u8 -/* 0D8570 8031D570 02002025 */ move $a0, $s0 -/* 0D8574 8031D574 00025940 */ sll $t3, $v0, 5 -/* 0D8578 8031D578 A64B0008 */ sh $t3, 8($s2) -/* 0D857C 8031D57C 0C0C700F */ jal m64_read_u8 -/* 0D8580 8031D580 02002025 */ move $a0, $s0 -/* 0D8584 8031D584 0002C140 */ sll $t8, $v0, 5 -/* 0D8588 8031D588 A658000C */ sh $t8, 0xc($s2) -/* 0D858C 8031D58C 0C0C700F */ jal m64_read_u8 -/* 0D8590 8031D590 02002025 */ move $a0, $s0 -/* 0D8594 8031D594 00026100 */ sll $t4, $v0, 4 -/* 0D8598 8031D598 1000FEEA */ b .L8031D144 -/* 0D859C 8031D59C A64C0010 */ sh $t4, 0x10($s2) -glabel L_U_8031D5A0 -/* 0D85A0 8031D5A0 0C0C700F */ jal m64_read_u8 -/* 0D85A4 8031D5A4 02002025 */ move $a0, $s0 -/* 0D85A8 8031D5A8 00026900 */ sll $t5, $v0, 4 -/* 0D85AC 8031D5AC 1000FEE5 */ b .L8031D144 -/* 0D85B0 8031D5B0 A64D0014 */ sh $t5, 0x14($s2) -glabel L_U_8031D5B4 -/* 0D85B4 8031D5B4 0C0C700F */ jal m64_read_u8 -/* 0D85B8 8031D5B8 02002025 */ move $a0, $s0 -/* 0D85BC 8031D5BC 14400003 */ bnez $v0, .L8031D5CC -/* 0D85C0 8031D5C0 305100FF */ andi $s1, $v0, 0xff -/* 0D85C4 8031D5C4 3C118022 */ lui $s1, %hi(gAudioUpdatesPerFrame) # $s1, 0x8022 -/* 0D85C8 8031D5C8 92316B7E */ lbu $s1, %lo(gAudioUpdatesPerFrame)($s1) -.L8031D5CC: -/* 0D85CC 8031D5CC 1000FEDD */ b .L8031D144 -/* 0D85D0 8031D5D0 A2510006 */ sb $s1, 6($s2) -glabel L_U_8031D5D4 -/* 0D85D4 8031D5D4 0C0C700F */ jal m64_read_u8 -/* 0D85D8 8031D5D8 02002025 */ move $a0, $s0 -/* 0D85DC 8031D5DC 1000FED9 */ b .L8031D144 -/* 0D85E0 8031D5E0 A2420003 */ sb $v0, 3($s2) -glabel L_U_8031D5E4 -/* 0D85E4 8031D5E4 0C0C700F */ jal m64_read_u8 -/* 0D85E8 8031D5E8 02002025 */ move $a0, $s0 -/* 0D85EC 8031D5EC 928F0005 */ lbu $t7, 5($s4) -/* 0D85F0 8031D5F0 3C038022 */ lui $v1, %hi(gAlBankSets) # $v1, 0x8022 -/* 0D85F4 8031D5F4 8C636B58 */ lw $v1, %lo(gAlBankSets)($v1) -/* 0D85F8 8031D5F8 000F7040 */ sll $t6, $t7, 1 -/* 0D85FC 8031D5FC 3C048022 */ lui $a0, %hi(gBankLoadedPool) # $a0, 0x8022 -/* 0D8600 8031D600 006EC821 */ addu $t9, $v1, $t6 -/* 0D8604 8031D604 97270000 */ lhu $a3, ($t9) -/* 0D8608 8031D608 248410F8 */ addiu $a0, %lo(gBankLoadedPool) # addiu $a0, $a0, 0x10f8 -/* 0D860C 8031D60C 24050002 */ li $a1, 2 -/* 0D8610 8031D610 00E34821 */ addu $t1, $a3, $v1 -/* 0D8614 8031D614 91280000 */ lbu $t0, ($t1) -/* 0D8618 8031D618 00E85021 */ addu $t2, $a3, $t0 -/* 0D861C 8031D61C 01425823 */ subu $t3, $t2, $v0 -/* 0D8620 8031D620 0163C021 */ addu $t8, $t3, $v1 -/* 0D8624 8031D624 93110000 */ lbu $s1, ($t8) -/* 0D8628 8031D628 0C0C5E0B */ jal get_bank_or_seq -/* 0D862C 8031D62C 02203025 */ move $a2, $s1 -/* 0D8630 8031D630 1040FEC4 */ beqz $v0, .L8031D144 -/* 0D8634 8031D634 00000000 */ nop -/* 0D8638 8031D638 1000FEC2 */ b .L8031D144 -/* 0D863C 8031D63C A2510005 */ sb $s1, 5($s2) -glabel L_U_8031D640 -/* 0D8640 8031D640 326C00FF */ andi $t4, $s3, 0xff -/* 0D8644 8031D644 AFAC0030 */ sw $t4, 0x30($sp) -/* 0D8648 8031D648 0C0C700F */ jal m64_read_u8 -/* 0D864C 8031D64C 02002025 */ move $a0, $s0 -/* 0D8650 8031D650 305100FF */ andi $s1, $v0, 0xff -/* 0D8654 8031D654 0C0C7014 */ jal m64_read_s16 -/* 0D8658 8031D658 02002025 */ move $a0, $s0 -/* 0D865C 8031D65C 8E8D0014 */ lw $t5, 0x14($s4) -/* 0D8660 8031D660 8FAE0030 */ lw $t6, 0x30($sp) -/* 0D8664 8031D664 304FFFFF */ andi $t7, $v0, 0xffff -/* 0D8668 8031D668 01AF1821 */ addu $v1, $t5, $t7 -/* 0D866C 8031D66C 01D1C821 */ addu $t9, $t6, $s1 -/* 0D8670 8031D670 1000FEB4 */ b .L8031D144 -/* 0D8674 8031D674 A0790000 */ sb $t9, ($v1) -glabel L_U_8031D678 -/* 0D8678 8031D678 0C0C700F */ jal m64_read_u8 -/* 0D867C 8031D67C 02002025 */ move $a0, $s0 -/* 0D8680 8031D680 240100C8 */ li $at, 200 -/* 0D8684 8031D684 16210005 */ bne $s1, $at, .L8031D69C -/* 0D8688 8031D688 02201825 */ move $v1, $s1 -/* 0D868C 8031D68C 02629823 */ subu $s3, $s3, $v0 -/* 0D8690 8031D690 00135E00 */ sll $t3, $s3, 0x18 -/* 0D8694 8031D694 1000FEAB */ b .L8031D144 -/* 0D8698 8031D698 000B9E03 */ sra $s3, $t3, 0x18 -.L8031D69C: -/* 0D869C 8031D69C 240100CC */ li $at, 204 -/* 0D86A0 8031D6A0 14610005 */ bne $v1, $at, .L8031D6B8 -/* 0D86A4 8031D6A4 02629824 */ and $s3, $s3, $v0 -/* 0D86A8 8031D6A8 00029E00 */ sll $s3, $v0, 0x18 -/* 0D86AC 8031D6AC 00136603 */ sra $t4, $s3, 0x18 -/* 0D86B0 8031D6B0 1000FEA4 */ b .L8031D144 -/* 0D86B4 8031D6B4 01809825 */ move $s3, $t4 -.L8031D6B8: -/* 0D86B8 8031D6B8 00137600 */ sll $t6, $s3, 0x18 -/* 0D86BC 8031D6BC 1000FEA1 */ b .L8031D144 -/* 0D86C0 8031D6C0 000E9E03 */ sra $s3, $t6, 0x18 -glabel L_U_8031D6C4 -/* 0D86C4 8031D6C4 0C0C700F */ jal m64_read_u8 -/* 0D86C8 8031D6C8 02002025 */ move $a0, $s0 -/* 0D86CC 8031D6CC 1000FE9D */ b .L8031D144 -/* 0D86D0 8031D6D0 A2420002 */ sb $v0, 2($s2) -glabel L_U_8031D6D4 -/* 0D86D4 8031D6D4 0C0C7014 */ jal m64_read_s16 -/* 0D86D8 8031D6D8 02002025 */ move $a0, $s0 -/* 0D86DC 8031D6DC 8E890014 */ lw $t1, 0x14($s4) -/* 0D86E0 8031D6E0 304AFFFF */ andi $t2, $v0, 0xffff -/* 0D86E4 8031D6E4 01535821 */ addu $t3, $t2, $s3 -/* 0D86E8 8031D6E8 012BC021 */ addu $t8, $t1, $t3 -/* 0D86EC 8031D6EC 1000FE95 */ b .L8031D144 -/* 0D86F0 8031D6F0 83130000 */ lb $s3, ($t8) -glabel L_U_8031D6F4 -/* 0D86F4 8031D6F4 0C0C700F */ jal m64_read_u8 -/* 0D86F8 8031D6F8 02002025 */ move $a0, $s0 -/* 0D86FC 8031D6FC 924E0000 */ lbu $t6, ($s2) -/* 0D8700 8031D700 00026880 */ sll $t5, $v0, 2 -/* 0D8704 8031D704 31AF0004 */ andi $t7, $t5, 4 -/* 0D8708 8031D708 31D9FFFB */ andi $t9, $t6, 0xfffb -/* 0D870C 8031D70C 01F95025 */ or $t2, $t7, $t9 -/* 0D8710 8031D710 1000FE8C */ b .L8031D144 -/* 0D8714 8031D714 A24A0000 */ sb $t2, ($s2) -glabel L_U_8031D718 -/* 0D8718 8031D718 0C0C700F */ jal m64_read_u8 -/* 0D871C 8031D71C 02002025 */ move $a0, $s0 -/* 0D8720 8031D720 1000FE88 */ b .L8031D144 -/* 0D8724 8031D724 A2420001 */ sb $v0, 1($s2) -glabel L_U_8031D728 -/* 0D8728 8031D728 0C0C700F */ jal m64_read_u8 -/* 0D872C 8031D72C 02002025 */ move $a0, $s0 -/* 0D8730 8031D730 00024A00 */ sll $t1, $v0, 8 -/* 0D8734 8031D734 1000FE83 */ b .L8031D144 -/* 0D8738 8031D738 A649007A */ sh $t1, 0x7a($s2) -glabel L_U_8031D73C -/* 0D873C 8031D73C 1275FE81 */ beq $s3, $s5, .L8031D144 -/* 0D8740 8031D740 0013C040 */ sll $t8, $s3, 1 -/* 0D8744 8031D744 920C0018 */ lbu $t4, 0x18($s0) -/* 0D8748 8031D748 8E4B0030 */ lw $t3, 0x30($s2) -/* 0D874C 8031D74C 8E0E0000 */ lw $t6, ($s0) -/* 0D8750 8031D750 258D0001 */ addiu $t5, $t4, 1 -/* 0D8754 8031D754 31AF00FF */ andi $t7, $t5, 0xff -/* 0D8758 8031D758 000FC880 */ sll $t9, $t7, 2 -/* 0D875C 8031D75C 02195021 */ addu $t2, $s0, $t9 -/* 0D8760 8031D760 A20D0018 */ sb $t5, 0x18($s0) -/* 0D8764 8031D764 01781021 */ addu $v0, $t3, $t8 -/* 0D8768 8031D768 AD4E0000 */ sw $t6, ($t2) -/* 0D876C 8031D76C 904B0000 */ lbu $t3, ($v0) -/* 0D8770 8031D770 90490001 */ lbu $t1, 1($v0) -/* 0D8774 8031D774 8E8D0014 */ lw $t5, 0x14($s4) -/* 0D8778 8031D778 000BC200 */ sll $t8, $t3, 8 -/* 0D877C 8031D77C 01383821 */ addu $a3, $t1, $t8 -/* 0D8780 8031D780 30ECFFFF */ andi $t4, $a3, 0xffff -/* 0D8784 8031D784 01AC7821 */ addu $t7, $t5, $t4 -/* 0D8788 8031D788 1000FE6E */ b .L8031D144 -/* 0D878C 8031D78C AE0F0000 */ sw $t7, ($s0) -.L8031D790: -/* 0D8790 8031D790 3064000F */ andi $a0, $v1, 0xf -/* 0D8794 8031D794 2F2100B1 */ sltiu $at, $t9, 0xb1 -/* 0D8798 8031D798 1020FE6A */ beqz $at, .L8031D144 -/* 0D879C 8031D79C 308800FF */ andi $t0, $a0, 0xff -/* 0D87A0 8031D7A0 0019C880 */ sll $t9, $t9, 2 -/* 0D87A4 8031D7A4 3C018034 */ lui $at, %hi(jtbl_80337E04) -/* 0D87A8 8031D7A8 00390821 */ addu $at, $at, $t9 -/* 0D87AC 8031D7AC 8C398FBC */ lw $t9, %lo(jtbl_80337E04)($at) -/* 0D87B0 8031D7B0 03200008 */ jr $t9 -/* 0D87B4 8031D7B4 00000000 */ nop -glabel L_U_8031D7B8 -/* 0D87B8 8031D7B8 308E00FF */ andi $t6, $a0, 0xff -/* 0D87BC 8031D7BC 000E5080 */ sll $t2, $t6, 2 -/* 0D87C0 8031D7C0 024A5821 */ addu $t3, $s2, $t2 -/* 0D87C4 8031D7C4 8D630044 */ lw $v1, 0x44($t3) -/* 0D87C8 8031D7C8 1060FE5E */ beqz $v1, .L8031D144 -/* 0D87CC 8031D7CC 00000000 */ nop -/* 0D87D0 8031D7D0 8C730000 */ lw $s3, ($v1) -/* 0D87D4 8031D7D4 00134840 */ sll $t1, $s3, 1 -/* 0D87D8 8031D7D8 0009C7C2 */ srl $t8, $t1, 0x1f -/* 0D87DC 8031D7DC 00186600 */ sll $t4, $t8, 0x18 -/* 0D87E0 8031D7E0 1000FE58 */ b .L8031D144 -/* 0D87E4 8031D7E4 000C9E03 */ sra $s3, $t4, 0x18 -glabel L_U_8031D7E8 -/* 0D87E8 8031D7E8 308F00FF */ andi $t7, $a0, 0xff -/* 0D87EC 8031D7EC 024FC821 */ addu $t9, $s2, $t7 -/* 0D87F0 8031D7F0 1000FE54 */ b .L8031D144 -/* 0D87F4 8031D7F4 A3330054 */ sb $s3, 0x54($t9) -glabel L_U_8031D7F8 -/* 0D87F8 8031D7F8 308300FF */ andi $v1, $a0, 0xff -/* 0D87FC 8031D7FC 02432821 */ addu $a1, $s2, $v1 -/* 0D8800 8031D800 28610004 */ slti $at, $v1, 4 -/* 0D8804 8031D804 1020FE4F */ beqz $at, .L8031D144 -/* 0D8808 8031D808 80B30054 */ lb $s3, 0x54($a1) -/* 0D880C 8031D80C 1000FE4D */ b .L8031D144 -/* 0D8810 8031D810 A0B50054 */ sb $s5, 0x54($a1) -glabel L_U_8031D814 -/* 0D8814 8031D814 308E00FF */ andi $t6, $a0, 0xff -/* 0D8818 8031D818 024E5021 */ addu $t2, $s2, $t6 -/* 0D881C 8031D81C 814B0054 */ lb $t3, 0x54($t2) -/* 0D8820 8031D820 026B9823 */ subu $s3, $s3, $t3 -/* 0D8824 8031D824 00134E00 */ sll $t1, $s3, 0x18 -/* 0D8828 8031D828 1000FE46 */ b .L8031D144 -/* 0D882C 8031D82C 00099E03 */ sra $s3, $t1, 0x18 -glabel L_U_8031D830 -/* 0D8830 8031D830 0C0C7014 */ jal m64_read_s16 -/* 0D8834 8031D834 02002025 */ move $a0, $s0 -/* 0D8838 8031D838 02201825 */ move $v1, $s1 -/* 0D883C 8031D83C 3065000F */ andi $a1, $v1, 0xf -/* 0D8840 8031D840 00A01825 */ move $v1, $a1 -/* 0D8844 8031D844 AFA50030 */ sw $a1, 0x30($sp) -/* 0D8848 8031D848 02402025 */ move $a0, $s2 -/* 0D884C 8031D84C 0C0C6E50 */ jal seq_channel_set_layer -/* 0D8850 8031D850 A7A20052 */ sh $v0, 0x52($sp) -/* 0D8854 8031D854 8FA30030 */ lw $v1, 0x30($sp) -/* 0D8858 8031D858 1440FE3A */ bnez $v0, .L8031D144 -/* 0D885C 8031D85C 97A70052 */ lhu $a3, 0x52($sp) -/* 0D8860 8031D860 8E8D0014 */ lw $t5, 0x14($s4) -/* 0D8864 8031D864 0003C880 */ sll $t9, $v1, 2 -/* 0D8868 8031D868 02597021 */ addu $t6, $s2, $t9 -/* 0D886C 8031D86C 8DCA0044 */ lw $t2, 0x44($t6) -/* 0D8870 8031D870 01A77821 */ addu $t7, $t5, $a3 -/* 0D8874 8031D874 1000FE33 */ b .L8031D144 -/* 0D8878 8031D878 AD4F0054 */ sw $t7, 0x54($t2) -glabel L_U_8031D87C -/* 0D887C 8031D87C 02202825 */ move $a1, $s1 -/* 0D8880 8031D880 30AB000F */ andi $t3, $a1, 0xf -/* 0D8884 8031D884 01602825 */ move $a1, $t3 -/* 0D8888 8031D888 0C0C6E9B */ jal seq_channel_layer_free -/* 0D888C 8031D88C 02402025 */ move $a0, $s2 -/* 0D8890 8031D890 1000FE2C */ b .L8031D144 -/* 0D8894 8031D894 00000000 */ nop -glabel L_U_8031D898 -/* 0D8898 8031D898 1275FE2A */ beq $s3, $s5, .L8031D144 -/* 0D889C 8031D89C 02402025 */ move $a0, $s2 -/* 0D88A0 8031D8A0 02201825 */ move $v1, $s1 -/* 0D88A4 8031D8A4 3065000F */ andi $a1, $v1, 0xf -/* 0D88A8 8031D8A8 00A01825 */ move $v1, $a1 -/* 0D88AC 8031D8AC 0C0C6E50 */ jal seq_channel_set_layer -/* 0D88B0 8031D8B0 AFA50030 */ sw $a1, 0x30($sp) -/* 0D88B4 8031D8B4 1055FE23 */ beq $v0, $s5, .L8031D144 -/* 0D88B8 8031D8B8 8FA30030 */ lw $v1, 0x30($sp) -/* 0D88BC 8031D8BC 8E580030 */ lw $t8, 0x30($s2) -/* 0D88C0 8031D8C0 00136040 */ sll $t4, $s3, 1 -/* 0D88C4 8031D8C4 8E8A0014 */ lw $t2, 0x14($s4) -/* 0D88C8 8031D8C8 030C1021 */ addu $v0, $t8, $t4 -/* 0D88CC 8031D8CC 90590000 */ lbu $t9, ($v0) -/* 0D88D0 8031D8D0 904D0001 */ lbu $t5, 1($v0) -/* 0D88D4 8031D8D4 00034880 */ sll $t1, $v1, 2 -/* 0D88D8 8031D8D8 00197200 */ sll $t6, $t9, 8 -/* 0D88DC 8031D8DC 0249C021 */ addu $t8, $s2, $t1 -/* 0D88E0 8031D8E0 01AE3821 */ addu $a3, $t5, $t6 -/* 0D88E4 8031D8E4 8F0C0044 */ lw $t4, 0x44($t8) -/* 0D88E8 8031D8E8 30EFFFFF */ andi $t7, $a3, 0xffff -/* 0D88EC 8031D8EC 014F5821 */ addu $t3, $t2, $t7 -/* 0D88F0 8031D8F0 1000FE14 */ b .L8031D144 -/* 0D88F4 8031D8F4 AD8B0054 */ sw $t3, 0x54($t4) -glabel L_U_8031D8F8 -/* 0D88F8 8031D8F8 1000FE12 */ b .L8031D144 -/* 0D88FC 8031D8FC A2440004 */ sb $a0, 4($s2) -glabel L_U_8031D900 -/* 0D8900 8031D900 0C0C7014 */ jal m64_read_s16 -/* 0D8904 8031D904 02002025 */ move $a0, $s0 -/* 0D8908 8031D908 8E8D0014 */ lw $t5, 0x14($s4) -/* 0D890C 8031D90C 02202825 */ move $a1, $s1 -/* 0D8910 8031D910 30B9000F */ andi $t9, $a1, 0xf -/* 0D8914 8031D914 304EFFFF */ andi $t6, $v0, 0xffff -/* 0D8918 8031D918 03202825 */ move $a1, $t9 -/* 0D891C 8031D91C 02802025 */ move $a0, $s4 -/* 0D8920 8031D920 0C0C6F68 */ jal sequence_channel_enable -/* 0D8924 8031D924 01AE3021 */ addu $a2, $t5, $t6 -/* 0D8928 8031D928 1000FE06 */ b .L8031D144 -/* 0D892C 8031D92C 00000000 */ nop -glabel L_U_8031D930 -/* 0D8930 8031D930 322A000F */ andi $t2, $s1, 0xf -/* 0D8934 8031D934 000A4880 */ sll $t1, $t2, 2 -/* 0D8938 8031D938 0289C021 */ addu $t8, $s4, $t1 -/* 0D893C 8031D93C 0C0C6EBC */ jal sequence_channel_disable -/* 0D8940 8031D940 8F04002C */ lw $a0, 0x2c($t8) -/* 0D8944 8031D944 1000FDFF */ b .L8031D144 -/* 0D8948 8031D948 00000000 */ nop -glabel L_U_8031D94C -/* 0D894C 8031D94C 02002025 */ move $a0, $s0 -/* 0D8950 8031D950 0C0C700F */ jal m64_read_u8 -/* 0D8954 8031D954 A3A80055 */ sb $t0, 0x55($sp) -/* 0D8958 8031D958 93A80055 */ lbu $t0, 0x55($sp) -/* 0D895C 8031D95C 00085880 */ sll $t3, $t0, 2 -/* 0D8960 8031D960 028B6021 */ addu $t4, $s4, $t3 -/* 0D8964 8031D964 8D99002C */ lw $t9, 0x2c($t4) -/* 0D8968 8031D968 03226821 */ addu $t5, $t9, $v0 -/* 0D896C 8031D96C 1000FDF5 */ b .L8031D144 -/* 0D8970 8031D970 A1B30054 */ sb $s3, 0x54($t5) -glabel L_U_8031D974 -/* 0D8974 8031D974 02002025 */ move $a0, $s0 -/* 0D8978 8031D978 0C0C700F */ jal m64_read_u8 -/* 0D897C 8031D97C A3A80055 */ sb $t0, 0x55($sp) -/* 0D8980 8031D980 93A80055 */ lbu $t0, 0x55($sp) -/* 0D8984 8031D984 00087080 */ sll $t6, $t0, 2 -/* 0D8988 8031D988 028E7821 */ addu $t7, $s4, $t6 -/* 0D898C 8031D98C 8DEA002C */ lw $t2, 0x2c($t7) -/* 0D8990 8031D990 01424821 */ addu $t1, $t2, $v0 -/* 0D8994 8031D994 1000FDEB */ b .L8031D144 -/* 0D8998 8031D998 81330054 */ lb $s3, 0x54($t1) -.L8031D99C: -/* 0D899C 8031D99C 02408825 */ move $s1, $s2 -.L8031D9A0: -/* 0D89A0 8031D9A0 24120010 */ li $s2, 16 -/* 0D89A4 8031D9A4 00008025 */ move $s0, $zero -.L8031D9A8: -/* 0D89A8 8031D9A8 8E240044 */ lw $a0, 0x44($s1) -/* 0D89AC 8031D9AC 50800004 */ beql $a0, $zero, .L8031D9C0 -/* 0D89B0 8031D9B0 26100004 */ addiu $s0, $s0, 4 -/* 0D89B4 8031D9B4 0C0C7031 */ jal seq_channel_layer_process_script -/* 0D89B8 8031D9B8 00000000 */ nop -/* 0D89BC 8031D9BC 26100004 */ addiu $s0, $s0, 4 -.L8031D9C0: -/* 0D89C0 8031D9C0 1612FFF9 */ bne $s0, $s2, .L8031D9A8 -/* 0D89C4 8031D9C4 26310004 */ addiu $s1, $s1, 4 -.L8031D9C8: -/* 0D89C8 8031D9C8 8FBF002C */ lw $ra, 0x2c($sp) -.L8031D9CC: -/* 0D89CC 8031D9CC 8FB00014 */ lw $s0, 0x14($sp) -/* 0D89D0 8031D9D0 8FB10018 */ lw $s1, 0x18($sp) -/* 0D89D4 8031D9D4 8FB2001C */ lw $s2, 0x1c($sp) -/* 0D89D8 8031D9D8 8FB30020 */ lw $s3, 0x20($sp) -/* 0D89DC 8031D9DC 8FB40024 */ lw $s4, 0x24($sp) -/* 0D89E0 8031D9E0 8FB50028 */ lw $s5, 0x28($sp) -/* 0D89E4 8031D9E4 03E00008 */ jr $ra -/* 0D89E8 8031D9E8 27BD0060 */ addiu $sp, $sp, 0x60 diff --git a/asm/rom_header.s b/asm/rom_header.s deleted file mode 100644 index c056acdb..00000000 --- a/asm/rom_header.s +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Super Mario 64 ROM header - * Only the first 0x18 bytes matter to the console. - */ - -.byte 0x80, 0x37, 0x12, 0x40 /* PI BSD Domain 1 register */ -.word 0x0000000F /* Clockrate setting*/ -.word entry_point /* Entrypoint */ - -/* Revision */ -.if VERSION_SH == 1 - .word 0x00001448 -.elseif VERSION_EU == 1 - .word 0x00001446 -.else /* NTSC-U and NTSC-J 1.0 */ - .word 0x00001444 -.endif - -.word 0x4EAA3D0E /* Checksum 1 */ -.word 0x74757C24 /* Checksum 2 */ -.word 0x00000000 /* Unknown */ -.word 0x00000000 /* Unknown */ -.if VERSION_SH == 1 -.ascii "SUPERMARIO64 " /* Internal ROM name */ -.else -.ascii "SUPER MARIO 64 " /* Internal ROM name */ -.endif -.word 0x00000000 /* Unknown */ -.word 0x0000004E /* Cartridge */ -.ascii "SM" /* Cartridge ID */ - -/* Region */ -.if VERSION_US == 1 - .ascii "E" /* NTSC-U (North America) */ -.elseif (VERSION_JP == 1 || VERSION_SH == 1) - .ascii "J" /* NTSC-J (Japan) */ -.else - .ascii "P" /* PAL (Europe) */ -.endif - -.if VERSION_SH == 1 - .byte 0x03 /* Version (Shindou) */ -.else - .byte 0x00 /* Version */ -.endif diff --git a/assets.json b/assets.json index 422858ee..dd27f39f 100644 --- a/assets.json +++ b/assets.json @@ -4,9 +4,13 @@ "@sound ctl eu": [97856,{"eu":[5626032]}], "@sound ctl jp": [94400,{"jp":[5738816]}], "@sound ctl us": [97856,{"us":[5748512]}], +"@sound ctl sh": [89472,{"sh":[5596480]}], "@sound tbl eu": [2216704,{"us":[5846368],"eu":[5723888]}], "@sound tbl jp": [1793408,{"jp":[5833216]}], "@sound tbl us": [2216704,{"us":[5846368],"eu":[5723888]}], +"@sound tbl sh": [2184688,{"sh":[5685952]}], +"@sound ctl header sh": [624,{"sh":[864272]}], +"@sound tbl header sh": [192,{"sh":[865056]}], "textures/ipl3_raw/ipl3_font_00.ia1.png": [13,14,23,{"jp":[2928],"us":[2928],"eu":[2928],"sh":[2928]}], "textures/ipl3_raw/ipl3_font_01.ia1.png": [13,14,23,{"jp":[2951],"us":[2951],"eu":[2951],"sh":[2951]}], "textures/ipl3_raw/ipl3_font_02.ia1.png": [13,14,23,{"jp":[2974],"us":[2974],"eu":[2974],"sh":[2974]}], @@ -57,15 +61,7 @@ "textures/ipl3_raw/ipl3_font_47.ia1.png": [13,14,23,{"jp":[4009],"us":[4009],"eu":[4009],"sh":[4009]}], "textures/ipl3_raw/ipl3_font_48.ia1.png": [13,14,23,{"jp":[4032],"us":[4032],"eu":[4032],"sh":[4032]}], "textures/ipl3_raw/ipl3_font_49.ia1.png": [13,14,23,{"jp":[4055],"us":[4055],"eu":[4055],"sh":[4055]}], -"textures/crash_screen/crash_font_01234.ia1.png": [32,7,28,{"eu":[757168],"sh":[805680]}], -"textures/crash_screen/crash_font_56789.ia1.png": [32,7,28,{"eu":[757196],"sh":[805708]}], -"textures/crash_screen/crash_font_ABCDE.ia1.png": [32,7,28,{"eu":[757224],"sh":[805736]}], -"textures/crash_screen/crash_font_FGHIJ.ia1.png": [32,7,28,{"eu":[757252],"sh":[805764]}], -"textures/crash_screen/crash_font_KLMNO.ia1.png": [32,7,28,{"eu":[757280],"sh":[805792]}], -"textures/crash_screen/crash_font_PQRST.ia1.png": [32,7,28,{"eu":[757308],"sh":[805820]}], -"textures/crash_screen/crash_font_UVWXY.ia1.png": [32,7,28,{"eu":[757336],"sh":[805848]}], -"textures/crash_screen/crash_font_Zsym1.ia1.png": [32,7,28,{"eu":[757364],"sh":[805876]}], -"textures/crash_screen/crash_font_sym2.ia1.png": [32,7,28,{"eu":[757392],"sh":[805904]}], +"textures/crash_screen/crash_screen_font.ia1.png": [32,63,252,{"eu":[757168],"sh":[805680]}], "actors/amp/amp_body.rgba16.png": [32,32,2048,{"jp":[2032944,6936],"us":[2040320,6936],"eu":[1912288,6936],"sh":[1888800,6936]}], "actors/amp/amp_electricity.rgba16.png": [16,32,1024,{"jp":[2032944,3864],"us":[2040320,3864],"eu":[1912288,3864],"sh":[1888800,3864]}], "actors/amp/amp_eyes.rgba16.png": [32,32,2048,{"jp":[2032944,4888],"us":[2040320,4888],"eu":[1912288,4888],"sh":[1888800,4888]}], @@ -637,7 +633,7 @@ "levels/ddd/2.rgba16.png": [32,32,2048,{"jp":[4765904,6144],"us":[4774192,6144],"eu":[4647792,6144],"sh":[4622160,6144]}], "levels/ddd/3.rgba16.png": [64,32,4096,{"jp":[4765904,8192],"us":[4774192,8192],"eu":[4647792,8192],"sh":[4622160,8192]}], "levels/ddd/4.rgba16.png": [32,32,2048,{"jp":[4765904,12288],"us":[4774192,12288],"eu":[4647792,12288],"sh":[4622160,12288]}], -"levels/ending/cake.png": [153600,{"jp":[4834992,0],"us":[4843280,0]}], +"levels/ending/cake.png": [153600,{"jp":[4834992,0],"us":[4843280,0],"sh":[4691248,0]}], "levels/ending/cake_eu.png": [143360,{"eu":[4716880,0]}], "levels/ending/eu_023000.rgba16.png": [64,32,4096,{"eu":[4716880,143360]}], "levels/ending/eu_024000.rgba16.png": [64,32,4096,{"eu":[4716880,147456]}], @@ -659,6 +655,7 @@ "levels/intro/2_eu_copyright.rgba16.png": [128,16,4096,{"eu":[2401056,46240],"sh":[2377888,46240]}], "levels/intro/3_eu_tm.rgba16.png": [16,16,512,{"eu":[2401056,50336]}], "levels/intro/3_tm.rgba16.png": [16,16,512,{"jp":[2524448,50336],"us":[2532256,50336]}], +"levels/intro/3_sh_tm.rgba16.png": [16,16,512,{"sh":[2377888,50336]}], "levels/jrb/0.rgba16.png": [32,32,2048,{"jp":[3432432,4096],"us":[3439184,4096],"eu":[3312784,4096],"sh":[3287152,4096]}], "levels/jrb/1.rgba16.png": [64,32,4096,{"jp":[4294592,2048],"us":[4302688,2048],"eu":[4176288,2048],"sh":[4150656,2048]}], "levels/jrb/2.rgba16.png": [32,32,2048,{"jp":[4294592,6144],"us":[4302688,6144],"eu":[4176288,6144],"sh":[4150656,6144]}], @@ -1054,6 +1051,40 @@ "sound/sequences/jp/1F_cutscene_victory.m64": [2074,{"jp":[7735392]}], "sound/sequences/jp/20_cutscene_ending.m64": [1892,{"jp":[7737472]}], "sound/sequences/jp/21_menu_file_select.m64": [789,{"jp":[7739376]}], +"sound/sequences/sh/01_cutscene_collect_star.m64": [626,{"sh":[7884144]}], +"sound/sequences/sh/02_menu_title_screen.m64": [8282,{"sh":[7884784]}], +"sound/sequences/sh/03_level_grass.m64": [5129,{"sh":[7893072]}], +"sound/sequences/sh/04_level_inside_castle.m64": [2503,{"sh":[7898208]}], +"sound/sequences/sh/05_level_water.m64": [4788,{"sh":[7900720]}], +"sound/sequences/sh/06_level_hot.m64": [2455,{"sh":[7905520]}], +"sound/sequences/sh/07_level_boss_koopa.m64": [3424,{"sh":[7907984]}], +"sound/sequences/sh/08_level_snow.m64": [8150,{"sh":[7911408]}], +"sound/sequences/sh/09_level_slide.m64": [7443,{"sh":[7919568]}], +"sound/sequences/sh/0A_level_spooky.m64": [5681,{"sh":[7927024]}], +"sound/sequences/sh/0B_event_piranha_plant.m64": [1400,{"sh":[7932720]}], +"sound/sequences/sh/0C_level_underground.m64": [4899,{"sh":[7934128]}], +"sound/sequences/sh/0D_menu_star_select.m64": [136,{"sh":[7939040]}], +"sound/sequences/sh/0E_event_powerup.m64": [3137,{"sh":[7939184]}], +"sound/sequences/sh/0F_event_metal_cap.m64": [2779,{"sh":[7942336]}], +"sound/sequences/sh/10_event_koopa_message.m64": [558,{"sh":[7945120]}], +"sound/sequences/sh/11_level_koopa_road.m64": [4753,{"sh":[7945680]}], +"sound/sequences/sh/12_event_high_score.m64": [275,{"sh":[7950448]}], +"sound/sequences/sh/13_event_merry_go_round.m64": [1660,{"sh":[7950736]}], +"sound/sequences/sh/14_event_race.m64": [200,{"sh":[7952400]}], +"sound/sequences/sh/15_cutscene_star_spawn.m64": [649,{"sh":[7952608]}], +"sound/sequences/sh/16_event_boss.m64": [3444,{"sh":[7953264]}], +"sound/sequences/sh/17_cutscene_collect_key.m64": [677,{"sh":[7956720]}], +"sound/sequences/sh/18_event_endless_stairs.m64": [1783,{"sh":[7957408]}], +"sound/sequences/sh/19_level_boss_koopa_final.m64": [3521,{"sh":[7959200]}], +"sound/sequences/sh/1A_cutscene_credits.m64": [14328,{"sh":[7962736]}], +"sound/sequences/sh/1B_event_solve_puzzle.m64": [219,{"sh":[7977072]}], +"sound/sequences/sh/1C_event_toad_message.m64": [211,{"sh":[7977296]}], +"sound/sequences/sh/1D_event_peach_message.m64": [436,{"sh":[7977520]}], +"sound/sequences/sh/1E_cutscene_intro.m64": [1770,{"sh":[7977968]}], +"sound/sequences/sh/1F_cutscene_victory.m64": [2066,{"sh":[7979744]}], +"sound/sequences/sh/20_cutscene_ending.m64": [1887,{"sh":[7981824]}], +"sound/sequences/sh/21_menu_file_select.m64": [786,{"sh":[7983712]}], +"sound/sequences/sh/22_cutscene_lakitu.m64": [317,{"sh":[7984512]}], "sound/sequences/us/01_cutscene_collect_star.m64": [619,{"us":[8076816]}], "sound/sequences/us/02_menu_title_screen.m64": [8254,{"us":[8077440]}], "sound/sequences/us/03_level_grass.m64": [5122,{"us":[8085696]}], @@ -1105,16 +1136,16 @@ "textures/cave/hmc_textures.0A800.rgba16.png": [32,64,4096,{"jp":[3432432,43008],"us":[3439184,43008],"eu":[3312784,43008],"sh":[3287152,43008]}], "textures/cave/hmc_textures.0B800.ia16.png": [32,32,2048,{"jp":[3432432,47104],"us":[3439184,47104],"eu":[3312784,47104],"sh":[3287152,47104]}], "textures/cave/hmc_textures.0C000.ia16.png": [32,32,2048,{"jp":[3298272,43008],"us":[3305024,43008],"eu":[3178624,43008],"sh":[3152992,43008]}], -"textures/skyboxes/bbh.png": [84288,{"jp":[3118928,0],"us":[3125680,0],"eu":[2999280,0]}], -"textures/skyboxes/bidw.png": [131392,{"jp":[3146352,0],"us":[3153104,0],"eu":[3026704,0]}], -"textures/skyboxes/bitfs.png": [102720,{"jp":[2942432,0],"us":[2949184,0],"eu":[2822784,0]}], -"textures/skyboxes/bits.png": [131392,{"jp":[3191904,0],"us":[3198656,0],"eu":[3072256,0]}], -"textures/skyboxes/ccm.png": [131392,{"jp":[2847920,0],"us":[2854672,0],"eu":[2728272,0]}], -"textures/skyboxes/cloud_floor.png": [131392,{"jp":[3038752,0],"us":[3045504,0],"eu":[2919104,0]}], -"textures/skyboxes/clouds.png": [84288,{"jp":[2906480,0],"us":[2913232,0],"eu":[2786832,0]}], -"textures/skyboxes/ssl.png": [131392,{"jp":[3078784,0],"us":[3085536,0],"eu":[2959136,0]}], -"textures/skyboxes/water.png": [131392,{"jp":[2796624,0],"us":[2803376,0],"eu":[2676976,0]}], -"textures/skyboxes/wdw.png": [131392,{"jp":[2968208,0],"us":[2974960,0],"eu":[2848560,0]}], +"textures/skyboxes/bbh.png": [84288,{"jp":[3118928,0],"us":[3125680,0],"eu":[2999280,0],"sh":[2973648,0]}], +"textures/skyboxes/bidw.png": [131392,{"jp":[3146352,0],"us":[3153104,0],"eu":[3026704,0],"sh":[3001072,0]}], +"textures/skyboxes/bitfs.png": [102720,{"jp":[2942432,0],"us":[2949184,0],"eu":[2822784,0],"sh":[2797152,0]}], +"textures/skyboxes/bits.png": [131392,{"jp":[3191904,0],"us":[3198656,0],"eu":[3072256,0],"sh":[3046624,0]}], +"textures/skyboxes/ccm.png": [131392,{"jp":[2847920,0],"us":[2854672,0],"eu":[2728272,0],"sh":[2702640,0]}], +"textures/skyboxes/cloud_floor.png": [131392,{"jp":[3038752,0],"us":[3045504,0],"eu":[2919104,0],"sh":[2893472,0]}], +"textures/skyboxes/clouds.png": [84288,{"jp":[2906480,0],"us":[2913232,0],"eu":[2786832,0],"sh":[2761200,0]}], +"textures/skyboxes/ssl.png": [131392,{"jp":[3078784,0],"us":[3085536,0],"eu":[2959136,0],"sh":[2933504,0]}], +"textures/skyboxes/water.png": [131392,{"jp":[2796624,0],"us":[2803376,0],"eu":[2676976,0],"sh":[2651344,0]}], +"textures/skyboxes/wdw.png": [131392,{"jp":[2968208,0],"us":[2974960,0],"eu":[2848560,0],"sh":[2822928,0]}], "textures/effect/bubble.06048.rgba16.png": [32,32,2048,{"jp":[3594960,24648],"us":[3601712,24648],"eu":[3475312,24648],"sh":[3449680,24648]}], "textures/effect/flower.00008.rgba16.png": [32,32,2048,{"jp":[3594960,8],"us":[3601712,8],"eu":[3475312,8],"sh":[3449680,8]}], "textures/effect/flower.00808.rgba16.png": [32,32,2048,{"jp":[3594960,2056],"us":[3601712,2056],"eu":[3475312,2056],"sh":[3449680,2056]}], @@ -1813,6 +1844,7 @@ "textures/title_screen_bg/title_screen_bg.04040.rgba16.png": [80,20,3200,{"jp":[2550336,16448],"us":[2558144,16448],"eu":[2426672,16448],"sh":[2403488,16448]}], "textures/title_screen_bg/title_screen_bg.04CC0.rgba16.png": [80,20,3200,{"jp":[2550336,19648],"us":[2558144,19648],"eu":[2426672,19648],"sh":[2403488,19648]}], "textures/title_screen_bg/title_screen_bg.05940.rgba16.png": [80,20,3200,{"jp":[2550336,22848],"us":[2558144,22848],"eu":[2426672,22848],"sh":[2403488,22848]}], +"textures/title_screen_bg/title_screen_bg.06648.rgba16.png": [80,24,3840,{"sh":[2403488,26184]}], "textures/water/jrb_textures.00000.rgba16.png": [32,32,2048,{"jp":[3354832,0],"us":[3361584,0],"eu":[3235184,0],"sh":[3209552,0]}], "textures/water/jrb_textures.00800.rgba16.png": [64,32,4096,{"jp":[3354832,2048],"us":[3361584,2048],"eu":[3235184,2048],"sh":[3209552,2048]}], "textures/water/jrb_textures.01800.rgba16.png": [64,32,4096,{"jp":[3354832,6144],"us":[3361584,6144],"eu":[3235184,6144],"sh":[3209552,6144]}], @@ -1828,223 +1860,227 @@ "textures/water/jrb_textures.0A000.rgba16.png": [32,32,2048,{"jp":[3354832,40960],"us":[3361584,40960],"eu":[3235184,40960],"sh":[3209552,40960]}], "textures/water/jrb_textures.0A800.rgba16.png": [64,32,4096,{"jp":[3354832,43008],"us":[3361584,43008],"eu":[3235184,43008],"sh":[3209552,43008]}], "textures/water/jrb_textures.0B800.rgba16.png": [64,32,4096,{"jp":[3354832,47104],"us":[3361584,47104],"eu":[3235184,47104],"sh":[3209552,47104]}], -"sound/samples/bowser_organ/00.aiff": [0,{"jp":["@sound",195],"us":["@sound",216],"eu":["@sound",216]}], -"sound/samples/bowser_organ/01.aiff": [0,{"jp":["@sound",196],"us":["@sound",217],"eu":["@sound",217]}], -"sound/samples/bowser_organ/02.aiff": [0,{"jp":["@sound",197],"us":["@sound",218],"eu":["@sound",218]}], +"sound/samples/bowser_organ/00_organ_1.aiff": [0,{"jp":["@sound",195],"us":["@sound",216],"eu":["@sound",216]}], +"sound/samples/bowser_organ/01_organ_1_lq.aiff": [0,{"jp":["@sound",196],"us":["@sound",217],"eu":["@sound",217]}], +"sound/samples/bowser_organ/02_boys_choir.aiff": [0,{"jp":["@sound",197],"us":["@sound",218],"eu":["@sound",218]}], "sound/samples/course_start/00_la.aiff": [0,{"jp":["@sound",194],"us":["@sound",215],"eu":["@sound",215]}], -"sound/samples/instruments/00.aiff": [0,{"jp":["@sound",120],"us":["@sound",141],"eu":["@sound",141]}], -"sound/samples/instruments/01.aiff": [0,{"jp":["@sound",121],"us":["@sound",142],"eu":["@sound",142]}], -"sound/samples/instruments/02.aiff": [0,{"jp":["@sound",122],"us":["@sound",143],"eu":["@sound",143]}], -"sound/samples/instruments/03.aiff": [0,{"jp":["@sound",123],"us":["@sound",144],"eu":["@sound",144]}], -"sound/samples/instruments/04.aiff": [0,{"jp":["@sound",124],"us":["@sound",145],"eu":["@sound",145]}], -"sound/samples/instruments/05.aiff": [0,{"jp":["@sound",125],"us":["@sound",146],"eu":["@sound",146]}], -"sound/samples/instruments/06.aiff": [0,{"jp":["@sound",126],"us":["@sound",147],"eu":["@sound",147]}], -"sound/samples/instruments/07.aiff": [0,{"jp":["@sound",127],"us":["@sound",148],"eu":["@sound",148]}], -"sound/samples/instruments/08.aiff": [0,{"jp":["@sound",128],"us":["@sound",149],"eu":["@sound",149]}], -"sound/samples/instruments/09.aiff": [0,{"jp":["@sound",129],"us":["@sound",150],"eu":["@sound",150]}], -"sound/samples/instruments/0A.aiff": [0,{"jp":["@sound",130],"us":["@sound",151],"eu":["@sound",151]}], -"sound/samples/instruments/0B.aiff": [0,{"jp":["@sound",131],"us":["@sound",152],"eu":["@sound",152]}], -"sound/samples/instruments/0C.aiff": [0,{"jp":["@sound",132],"us":["@sound",153],"eu":["@sound",153]}], -"sound/samples/instruments/0D.aiff": [0,{"jp":["@sound",133],"us":["@sound",154],"eu":["@sound",154]}], -"sound/samples/instruments/0E.aiff": [0,{"jp":["@sound",134],"us":["@sound",155],"eu":["@sound",155]}], -"sound/samples/instruments/0F.aiff": [0,{"jp":["@sound",135],"us":["@sound",156],"eu":["@sound",156]}], -"sound/samples/instruments/10.aiff": [0,{"jp":["@sound",136],"us":["@sound",157],"eu":["@sound",157]}], -"sound/samples/instruments/11.aiff": [0,{"jp":["@sound",137],"us":["@sound",158],"eu":["@sound",158]}], -"sound/samples/instruments/12.aiff": [0,{"jp":["@sound",138],"us":["@sound",159],"eu":["@sound",159]}], -"sound/samples/instruments/13.aiff": [0,{"jp":["@sound",139],"us":["@sound",160],"eu":["@sound",160]}], -"sound/samples/instruments/14.aiff": [0,{"jp":["@sound",140],"us":["@sound",161],"eu":["@sound",161]}], -"sound/samples/instruments/15.aiff": [0,{"jp":["@sound",141],"us":["@sound",162],"eu":["@sound",162]}], -"sound/samples/instruments/16.aiff": [0,{"jp":["@sound",142],"us":["@sound",163],"eu":["@sound",163]}], -"sound/samples/instruments/17.aiff": [0,{"jp":["@sound",143],"us":["@sound",164],"eu":["@sound",164]}], -"sound/samples/instruments/18.aiff": [0,{"jp":["@sound",144],"us":["@sound",165],"eu":["@sound",165]}], -"sound/samples/instruments/19.aiff": [0,{"jp":["@sound",145],"us":["@sound",166],"eu":["@sound",166]}], -"sound/samples/instruments/1A.aiff": [0,{"jp":["@sound",146],"us":["@sound",167],"eu":["@sound",167]}], -"sound/samples/instruments/1B.aiff": [0,{"jp":["@sound",147],"us":["@sound",168],"eu":["@sound",168]}], -"sound/samples/instruments/1C.aiff": [0,{"jp":["@sound",148],"us":["@sound",169],"eu":["@sound",169]}], -"sound/samples/instruments/1D.aiff": [0,{"jp":["@sound",149],"us":["@sound",170],"eu":["@sound",170]}], -"sound/samples/instruments/1E.aiff": [0,{"jp":["@sound",150],"us":["@sound",171],"eu":["@sound",171]}], -"sound/samples/instruments/1F.aiff": [0,{"jp":["@sound",151],"us":["@sound",172],"eu":["@sound",172]}], -"sound/samples/instruments/20.aiff": [0,{"jp":["@sound",152],"us":["@sound",173],"eu":["@sound",173]}], -"sound/samples/instruments/21.aiff": [0,{"jp":["@sound",153],"us":["@sound",174],"eu":["@sound",174]}], -"sound/samples/instruments/22.aiff": [0,{"jp":["@sound",154],"us":["@sound",175],"eu":["@sound",175]}], -"sound/samples/instruments/23.aiff": [0,{"jp":["@sound",155],"us":["@sound",176],"eu":["@sound",176]}], -"sound/samples/instruments/24.aiff": [0,{"jp":["@sound",156],"us":["@sound",177],"eu":["@sound",177]}], -"sound/samples/instruments/25.aiff": [0,{"jp":["@sound",157],"us":["@sound",178],"eu":["@sound",178]}], -"sound/samples/instruments/26.aiff": [0,{"jp":["@sound",158],"us":["@sound",179],"eu":["@sound",179]}], -"sound/samples/instruments/27.aiff": [0,{"jp":["@sound",159],"us":["@sound",180],"eu":["@sound",180]}], -"sound/samples/instruments/28.aiff": [0,{"jp":["@sound",160],"us":["@sound",181],"eu":["@sound",181]}], -"sound/samples/instruments/29.aiff": [0,{"jp":["@sound",161],"us":["@sound",182],"eu":["@sound",182]}], -"sound/samples/instruments/2A.aiff": [0,{"jp":["@sound",162],"us":["@sound",183],"eu":["@sound",183]}], -"sound/samples/instruments/2B.aiff": [0,{"jp":["@sound",163],"us":["@sound",184],"eu":["@sound",184]}], -"sound/samples/instruments/2C.aiff": [0,{"jp":["@sound",164],"us":["@sound",185],"eu":["@sound",185]}], -"sound/samples/instruments/2D.aiff": [0,{"jp":["@sound",165],"us":["@sound",186],"eu":["@sound",186]}], -"sound/samples/instruments/2E.aiff": [0,{"jp":["@sound",166],"us":["@sound",187],"eu":["@sound",187]}], -"sound/samples/instruments/2F.aiff": [0,{"jp":["@sound",167],"us":["@sound",188],"eu":["@sound",188]}], -"sound/samples/instruments/30.aiff": [0,{"jp":["@sound",168],"us":["@sound",189],"eu":["@sound",189]}], -"sound/samples/instruments/31.aiff": [0,{"jp":["@sound",169],"us":["@sound",190],"eu":["@sound",190]}], -"sound/samples/instruments/32.aiff": [0,{"jp":["@sound",170],"us":["@sound",191],"eu":["@sound",191]}], -"sound/samples/instruments/33.aiff": [0,{"jp":["@sound",171],"us":["@sound",192],"eu":["@sound",192]}], -"sound/samples/instruments/34.aiff": [0,{"jp":["@sound",172],"us":["@sound",193],"eu":["@sound",193]}], -"sound/samples/instruments/35.aiff": [0,{"jp":["@sound",173],"us":["@sound",194],"eu":["@sound",194]}], -"sound/samples/instruments/36.aiff": [0,{"jp":["@sound",174],"us":["@sound",195],"eu":["@sound",195]}], -"sound/samples/instruments/37.aiff": [0,{"jp":["@sound",175],"us":["@sound",196],"eu":["@sound",196]}], -"sound/samples/instruments/38.aiff": [0,{"jp":["@sound",176],"us":["@sound",197],"eu":["@sound",197]}], -"sound/samples/instruments/39.aiff": [0,{"jp":["@sound",177],"us":["@sound",198],"eu":["@sound",198]}], -"sound/samples/instruments/3A.aiff": [0,{"jp":["@sound",178],"us":["@sound",199],"eu":["@sound",199]}], -"sound/samples/instruments/3B.aiff": [0,{"jp":["@sound",179],"us":["@sound",200],"eu":["@sound",200]}], -"sound/samples/instruments/3C.aiff": [0,{"jp":["@sound",180],"us":["@sound",201],"eu":["@sound",201]}], -"sound/samples/instruments/3D.aiff": [0,{"jp":["@sound",181],"us":["@sound",202],"eu":["@sound",202]}], -"sound/samples/instruments/3E.aiff": [0,{"jp":["@sound",182],"us":["@sound",203],"eu":["@sound",203]}], -"sound/samples/instruments/3F.aiff": [0,{"jp":["@sound",183],"us":["@sound",204],"eu":["@sound",204]}], -"sound/samples/instruments/40.aiff": [0,{"jp":["@sound",184],"us":["@sound",205],"eu":["@sound",205]}], -"sound/samples/instruments/41.aiff": [0,{"jp":["@sound",185],"us":["@sound",206],"eu":["@sound",206]}], -"sound/samples/instruments/42.aiff": [0,{"jp":["@sound",186],"us":["@sound",207],"eu":["@sound",207]}], -"sound/samples/instruments/43.aiff": [0,{"jp":["@sound",187],"us":["@sound",208],"eu":["@sound",208]}], -"sound/samples/instruments/44.aiff": [0,{"jp":["@sound",188],"us":["@sound",209],"eu":["@sound",209]}], -"sound/samples/instruments/45.aiff": [0,{"jp":["@sound",189],"us":["@sound",210],"eu":["@sound",210]}], -"sound/samples/instruments/46.aiff": [0,{"jp":["@sound",190],"us":["@sound",211],"eu":["@sound",211]}], -"sound/samples/instruments/47.aiff": [0,{"jp":["@sound",191],"us":["@sound",212],"eu":["@sound",212]}], -"sound/samples/instruments/48.aiff": [0,{"jp":["@sound",192],"us":["@sound",213],"eu":["@sound",213]}], -"sound/samples/piranha_music_box/00_pling.aiff": [0,{"jp":["@sound",193],"us":["@sound",214],"eu":["@sound",214]}], -"sound/samples/sfx_1/00_twirl.aiff": [0,{"jp":["@sound",0],"us":["@sound",0],"eu":["@sound",0]}], -"sound/samples/sfx_1/01_brushing.aiff": [0,{"jp":["@sound",1],"us":["@sound",1],"eu":["@sound",1]}], -"sound/samples/sfx_1/02_hand_touch.aiff": [0,{"jp":["@sound",2],"us":["@sound",2],"eu":["@sound",2]}], -"sound/samples/sfx_1/03_yoshi.aiff": [0,{"jp":["@sound",3],"us":["@sound",3],"eu":["@sound",3]}], -"sound/samples/sfx_1/04_plop.aiff": [0,{"jp":["@sound",4],"us":["@sound",4],"eu":["@sound",4]}], -"sound/samples/sfx_1/05_heavy_landing.aiff": [0,{"jp":["@sound",5],"us":["@sound",5],"eu":["@sound",5]}], -"sound/samples/sfx_4/00.aiff": [0,{"jp":["@sound",17],"us":["@sound",17],"eu":["@sound",17]}], -"sound/samples/sfx_4/01.aiff": [0,{"jp":["@sound",18],"us":["@sound",18],"eu":["@sound",18]}], -"sound/samples/sfx_4/02.aiff": [0,{"jp":["@sound",19],"us":["@sound",19],"eu":["@sound",19]}], -"sound/samples/sfx_4/03.aiff": [0,{"jp":["@sound",20],"us":["@sound",20],"eu":["@sound",20]}], -"sound/samples/sfx_4/04.aiff": [0,{"jp":["@sound",21],"us":["@sound",21],"eu":["@sound",21]}], -"sound/samples/sfx_4/05.aiff": [0,{"jp":["@sound",22],"us":["@sound",22],"eu":["@sound",22]}], -"sound/samples/sfx_4/06.aiff": [0,{"jp":["@sound",23],"us":["@sound",23],"eu":["@sound",23]}], -"sound/samples/sfx_4/07.aiff": [0,{"jp":["@sound",24],"us":["@sound",24],"eu":["@sound",24]}], -"sound/samples/sfx_4/08.aiff": [0,{"jp":["@sound",25],"us":["@sound",25],"eu":["@sound",25]}], -"sound/samples/sfx_4/09.aiff": [0,{"jp":["@sound",26],"us":["@sound",26],"eu":["@sound",26]}], -"sound/samples/sfx_5/00.aiff": [0,{"jp":["@sound",27],"us":["@sound",27],"eu":["@sound",27]}], -"sound/samples/sfx_5/01.aiff": [0,{"jp":["@sound",28],"us":["@sound",28],"eu":["@sound",28]}], -"sound/samples/sfx_5/02.aiff": [0,{"jp":["@sound",29],"us":["@sound",29],"eu":["@sound",29]}], -"sound/samples/sfx_5/03.aiff": [0,{"jp":["@sound",30],"us":["@sound",30],"eu":["@sound",30]}], -"sound/samples/sfx_5/04.aiff": [0,{"jp":["@sound",31],"us":["@sound",31],"eu":["@sound",31]}], -"sound/samples/sfx_5/05.aiff": [0,{"jp":["@sound",32],"us":["@sound",32],"eu":["@sound",32]}], -"sound/samples/sfx_5/06.aiff": [0,{"jp":["@sound",33],"us":["@sound",33],"eu":["@sound",33]}], -"sound/samples/sfx_5/07.aiff": [0,{"jp":["@sound",34],"us":["@sound",34],"eu":["@sound",34]}], -"sound/samples/sfx_5/08.aiff": [0,{"jp":["@sound",35],"us":["@sound",35],"eu":["@sound",35]}], -"sound/samples/sfx_5/09.aiff": [0,{"jp":["@sound",36],"us":["@sound",36],"eu":["@sound",36]}], -"sound/samples/sfx_5/0A.aiff": [0,{"jp":["@sound",37],"us":["@sound",37],"eu":["@sound",37]}], -"sound/samples/sfx_5/0B.aiff": [0,{"jp":["@sound",38],"us":["@sound",38],"eu":["@sound",38]}], -"sound/samples/sfx_5/0C.aiff": [0,{"jp":["@sound",39],"us":["@sound",39],"eu":["@sound",39]}], -"sound/samples/sfx_5/0D.aiff": [0,{"jp":["@sound",40],"us":["@sound",40],"eu":["@sound",40]}], -"sound/samples/sfx_5/0E.aiff": [0,{"jp":["@sound",41],"us":["@sound",41],"eu":["@sound",41]}], -"sound/samples/sfx_5/0F.aiff": [0,{"jp":["@sound",42],"us":["@sound",42],"eu":["@sound",42]}], -"sound/samples/sfx_5/10.aiff": [0,{"jp":["@sound",43],"us":["@sound",43],"eu":["@sound",43]}], -"sound/samples/sfx_5/11.aiff": [0,{"jp":["@sound",44],"us":["@sound",44],"eu":["@sound",44]}], -"sound/samples/sfx_5/12.aiff": [0,{"jp":["@sound",45],"us":["@sound",45],"eu":["@sound",45]}], -"sound/samples/sfx_5/13.aiff": [0,{"jp":["@sound",46],"us":["@sound",46],"eu":["@sound",46]}], -"sound/samples/sfx_5/14.aiff": [0,{"jp":["@sound",47],"us":["@sound",47],"eu":["@sound",47]}], -"sound/samples/sfx_5/15.aiff": [0,{"jp":["@sound",48],"us":["@sound",48],"eu":["@sound",48]}], -"sound/samples/sfx_5/16.aiff": [0,{"jp":["@sound",49],"us":["@sound",49],"eu":["@sound",49]}], -"sound/samples/sfx_5/17.aiff": [0,{"jp":["@sound",50],"us":["@sound",50],"eu":["@sound",50]}], -"sound/samples/sfx_5/18.aiff": [0,{"jp":["@sound",51],"us":["@sound",51],"eu":["@sound",51]}], -"sound/samples/sfx_5/19.aiff": [0,{"jp":["@sound",52],"us":["@sound",52],"eu":["@sound",52]}], -"sound/samples/sfx_5/1A.aiff": [0,{"jp":["@sound",53],"us":["@sound",53],"eu":["@sound",53]}], -"sound/samples/sfx_5/1B.aiff": [0,{"jp":["@sound",54],"us":["@sound",54],"eu":["@sound",54]}], -"sound/samples/sfx_5/1C.aiff": [0,{"jp":["@sound",55],"us":["@sound",55],"eu":["@sound",55]}], -"sound/samples/sfx_6/00.aiff": [0,{"jp":["@sound",56],"us":["@sound",56],"eu":["@sound",56]}], -"sound/samples/sfx_6/01.aiff": [0,{"jp":["@sound",57],"us":["@sound",57],"eu":["@sound",57]}], -"sound/samples/sfx_6/02.aiff": [0,{"jp":["@sound",58],"us":["@sound",58],"eu":["@sound",58]}], -"sound/samples/sfx_6/03.aiff": [0,{"jp":["@sound",59],"us":["@sound",59],"eu":["@sound",59]}], -"sound/samples/sfx_6/04.aiff": [0,{"jp":["@sound",60],"us":["@sound",60],"eu":["@sound",60]}], -"sound/samples/sfx_6/05.aiff": [0,{"jp":["@sound",61],"us":["@sound",61],"eu":["@sound",61]}], -"sound/samples/sfx_6/06.aiff": [0,{"jp":["@sound",62],"us":["@sound",62],"eu":["@sound",62]}], -"sound/samples/sfx_6/07.aiff": [0,{"jp":["@sound",63],"us":["@sound",63],"eu":["@sound",63]}], -"sound/samples/sfx_6/08.aiff": [0,{"jp":["@sound",64],"us":["@sound",64],"eu":["@sound",64]}], -"sound/samples/sfx_6/09.aiff": [0,{"jp":["@sound",65],"us":["@sound",65],"eu":["@sound",65]}], -"sound/samples/sfx_6/0A.aiff": [0,{"jp":["@sound",66],"us":["@sound",66],"eu":["@sound",66]}], -"sound/samples/sfx_6/0B.aiff": [0,{"jp":["@sound",67],"us":["@sound",67],"eu":["@sound",67]}], -"sound/samples/sfx_6/0C.aiff": [0,{"jp":["@sound",68],"us":["@sound",68],"eu":["@sound",68]}], -"sound/samples/sfx_6/0D.aiff": [0,{"jp":["@sound",69],"us":["@sound",69],"eu":["@sound",69]}], -"sound/samples/sfx_7/00.aiff": [0,{"jp":["@sound",70],"us":["@sound",70],"eu":["@sound",70]}], -"sound/samples/sfx_7/01.aiff": [0,{"jp":["@sound",71],"us":["@sound",71],"eu":["@sound",71]}], -"sound/samples/sfx_7/02.aiff": [0,{"jp":["@sound",72],"us":["@sound",72],"eu":["@sound",72]}], -"sound/samples/sfx_7/03.aiff": [0,{"jp":["@sound",73],"us":["@sound",73],"eu":["@sound",73]}], -"sound/samples/sfx_7/04.aiff": [0,{"jp":["@sound",74],"us":["@sound",74],"eu":["@sound",74]}], -"sound/samples/sfx_7/05.aiff": [0,{"jp":["@sound",75],"us":["@sound",75],"eu":["@sound",75]}], -"sound/samples/sfx_7/06.aiff": [0,{"jp":["@sound",76],"us":["@sound",76],"eu":["@sound",76]}], -"sound/samples/sfx_7/07.aiff": [0,{"jp":["@sound",77],"us":["@sound",77],"eu":["@sound",77]}], -"sound/samples/sfx_7/08.aiff": [0,{"jp":["@sound",78],"us":["@sound",78],"eu":["@sound",78]}], -"sound/samples/sfx_7/09.aiff": [0,{"jp":["@sound",79],"us":["@sound",79],"eu":["@sound",79]}], -"sound/samples/sfx_7/0A.aiff": [0,{"jp":["@sound",80],"us":["@sound",80],"eu":["@sound",80]}], -"sound/samples/sfx_7/0B.aiff": [0,{"jp":["@sound",81],"us":["@sound",81],"eu":["@sound",81]}], -"sound/samples/sfx_7/0C.aiff": [0,{"jp":["@sound",82],"us":["@sound",82],"eu":["@sound",82]}], -"sound/samples/sfx_7/0D.aiff": [0,{"us":["@sound",83],"eu":["@sound",83]}], -"sound/samples/sfx_9/00.aiff": [0,{"jp":["@sound",99],"us":["@sound",111],"eu":["@sound",111]}], -"sound/samples/sfx_9/01.aiff": [0,{"jp":["@sound",100],"us":["@sound",112],"eu":["@sound",112]}], -"sound/samples/sfx_9/02.aiff": [0,{"jp":["@sound",101],"us":["@sound",113],"eu":["@sound",113]}], -"sound/samples/sfx_9/03.aiff": [0,{"jp":["@sound",102],"us":["@sound",114],"eu":["@sound",114]}], -"sound/samples/sfx_9/04.aiff": [0,{"jp":["@sound",103],"us":["@sound",115],"eu":["@sound",115]}], -"sound/samples/sfx_9/05.aiff": [0,{"jp":["@sound",104],"us":["@sound",116],"eu":["@sound",116]}], -"sound/samples/sfx_9/06.aiff": [0,{"jp":["@sound",105],"us":["@sound",117],"eu":["@sound",117]}], -"sound/samples/sfx_mario/00.aiff": [0,{"jp":["@sound",83],"us":["@sound",84],"eu":["@sound",84]}], -"sound/samples/sfx_mario/01.aiff": [0,{"jp":["@sound",84],"us":["@sound",85],"eu":["@sound",85]}], -"sound/samples/sfx_mario/02.aiff": [0,{"jp":["@sound",85],"us":["@sound",86],"eu":["@sound",86]}], -"sound/samples/sfx_mario/03.aiff": [0,{"jp":["@sound",86],"us":["@sound",87],"eu":["@sound",87]}], -"sound/samples/sfx_mario/04.aiff": [0,{"jp":["@sound",87],"us":["@sound",88],"eu":["@sound",88]}], -"sound/samples/sfx_mario/05.aiff": [0,{"jp":["@sound",88],"us":["@sound",89],"eu":["@sound",89]}], -"sound/samples/sfx_mario/06.aiff": [0,{"jp":["@sound",89],"us":["@sound",90],"eu":["@sound",90]}], -"sound/samples/sfx_mario/07.aiff": [0,{"jp":["@sound",90],"us":["@sound",91],"eu":["@sound",91]}], -"sound/samples/sfx_mario/08.aiff": [0,{"jp":["@sound",91],"us":["@sound",92],"eu":["@sound",92]}], -"sound/samples/sfx_mario/09.aiff": [0,{"jp":["@sound",92],"us":["@sound",93],"eu":["@sound",93]}], -"sound/samples/sfx_mario/0A.aiff": [0,{"jp":["@sound",93],"us":["@sound",94],"eu":["@sound",94]}], -"sound/samples/sfx_mario/0B.aiff": [0,{"jp":["@sound",94],"us":["@sound",95],"eu":["@sound",95]}], -"sound/samples/sfx_mario/0C.aiff": [0,{"jp":["@sound",95],"us":["@sound",96],"eu":["@sound",96]}], -"sound/samples/sfx_mario/0D.aiff": [0,{"jp":["@sound",96],"us":["@sound",97],"eu":["@sound",97]}], -"sound/samples/sfx_mario/0E.aiff": [0,{"jp":["@sound",97],"us":["@sound",98],"eu":["@sound",98]}], -"sound/samples/sfx_mario/0F.aiff": [0,{"jp":["@sound",98],"us":["@sound",99],"eu":["@sound",99]}], -"sound/samples/sfx_mario/10.aiff": [0,{"us":["@sound",100],"eu":["@sound",100]}], -"sound/samples/sfx_mario/11.aiff": [0,{"us":["@sound",101],"eu":["@sound",101]}], -"sound/samples/sfx_mario/12.aiff": [0,{"us":["@sound",102],"eu":["@sound",102]}], -"sound/samples/sfx_mario/13.aiff": [0,{"us":["@sound",103],"eu":["@sound",103]}], -"sound/samples/sfx_mario/14.aiff": [0,{"us":["@sound",104],"eu":["@sound",104]}], -"sound/samples/sfx_mario/15.aiff": [0,{"us":["@sound",105],"eu":["@sound",105]}], -"sound/samples/sfx_mario/16.aiff": [0,{"us":["@sound",106],"eu":["@sound",106]}], -"sound/samples/sfx_mario/17.aiff": [0,{"us":["@sound",107],"eu":["@sound",107]}], -"sound/samples/sfx_mario/18.aiff": [0,{"us":["@sound",108],"eu":["@sound",108]}], -"sound/samples/sfx_mario/19.aiff": [0,{"us":["@sound",109],"eu":["@sound",109]}], -"sound/samples/sfx_mario/1A.aiff": [0,{"us":["@sound",110],"eu":["@sound",110]}], -"sound/samples/sfx_mario_peach/00.aiff": [0,{"jp":["@sound",106],"us":["@sound",118],"eu":["@sound",118]}], -"sound/samples/sfx_mario_peach/01.aiff": [0,{"jp":["@sound",107],"us":["@sound",119],"eu":["@sound",119]}], -"sound/samples/sfx_mario_peach/02.aiff": [0,{"jp":["@sound",108],"us":["@sound",120],"eu":["@sound",120]}], -"sound/samples/sfx_mario_peach/03.aiff": [0,{"jp":["@sound",109],"us":["@sound",121],"eu":["@sound",121]}], -"sound/samples/sfx_mario_peach/04.aiff": [0,{"jp":["@sound",110],"us":["@sound",122],"eu":["@sound",122]}], -"sound/samples/sfx_mario_peach/05.aiff": [0,{"jp":["@sound",111],"us":["@sound",123],"eu":["@sound",123]}], -"sound/samples/sfx_mario_peach/06.aiff": [0,{"jp":["@sound",112],"us":["@sound",124],"eu":["@sound",124]}], -"sound/samples/sfx_mario_peach/07.aiff": [0,{"jp":["@sound",113],"us":["@sound",125],"eu":["@sound",125]}], -"sound/samples/sfx_mario_peach/08.aiff": [0,{"jp":["@sound",114],"us":["@sound",126],"eu":["@sound",126]}], -"sound/samples/sfx_mario_peach/09.aiff": [0,{"jp":["@sound",115],"us":["@sound",127],"eu":["@sound",127]}], -"sound/samples/sfx_mario_peach/0A.aiff": [0,{"jp":["@sound",116],"us":["@sound",128],"eu":["@sound",128]}], -"sound/samples/sfx_mario_peach/0B.aiff": [0,{"jp":["@sound",117],"us":["@sound",129],"eu":["@sound",129]}], -"sound/samples/sfx_mario_peach/0C.aiff": [0,{"jp":["@sound",118],"us":["@sound",130],"eu":["@sound",130]}], -"sound/samples/sfx_mario_peach/0D.aiff": [0,{"jp":["@sound",119],"us":["@sound",131],"eu":["@sound",131]}], -"sound/samples/sfx_mario_peach/0E.aiff": [0,{"us":["@sound",132],"eu":["@sound",132]}], -"sound/samples/sfx_mario_peach/0F.aiff": [0,{"us":["@sound",133],"eu":["@sound",133]}], -"sound/samples/sfx_mario_peach/10.aiff": [0,{"us":["@sound",134],"eu":["@sound",134]}], -"sound/samples/sfx_mario_peach/11.aiff": [0,{"us":["@sound",135],"eu":["@sound",135]}], -"sound/samples/sfx_mario_peach/12.aiff": [0,{"us":["@sound",136],"eu":["@sound",136]}], -"sound/samples/sfx_mario_peach/13.aiff": [0,{"us":["@sound",137],"eu":["@sound",137]}], -"sound/samples/sfx_mario_peach/14.aiff": [0,{"us":["@sound",138],"eu":["@sound",138]}], -"sound/samples/sfx_mario_peach/15.aiff": [0,{"us":["@sound",139],"eu":["@sound",139]}], -"sound/samples/sfx_mario_peach/16.aiff": [0,{"us":["@sound",140],"eu":["@sound",140]}], -"sound/samples/sfx_terrain/00_step_default.aiff": [0,{"jp":["@sound",6],"us":["@sound",6],"eu":["@sound",6]}], -"sound/samples/sfx_terrain/01_step_grass.aiff": [0,{"jp":["@sound",7],"us":["@sound",7],"eu":["@sound",7]}], -"sound/samples/sfx_terrain/02_step_stone.aiff": [0,{"jp":["@sound",8],"us":["@sound",8],"eu":["@sound",8]}], -"sound/samples/sfx_terrain/03_step_spooky.aiff": [0,{"jp":["@sound",9],"us":["@sound",9],"eu":["@sound",9]}], -"sound/samples/sfx_terrain/04_step_snow.aiff": [0,{"jp":["@sound",10],"us":["@sound",10],"eu":["@sound",10]}], -"sound/samples/sfx_terrain/05_step_ice.aiff": [0,{"jp":["@sound",11],"us":["@sound",11],"eu":["@sound",11]}], -"sound/samples/sfx_terrain/06_step_metal.aiff": [0,{"jp":["@sound",12],"us":["@sound",12],"eu":["@sound",12]}], -"sound/samples/sfx_terrain/07_step_sand.aiff": [0,{"jp":["@sound",13],"us":["@sound",13],"eu":["@sound",13]}], -"sound/samples/sfx_water/00_plunge.aiff": [0,{"jp":["@sound",14],"us":["@sound",14],"eu":["@sound",14]}], -"sound/samples/sfx_water/01_splash.aiff": [0,{"jp":["@sound",15],"us":["@sound",15],"eu":["@sound",15]}], -"sound/samples/sfx_water/02_swim.aiff": [0,{"jp":["@sound",16],"us":["@sound",16],"eu":["@sound",16]}] +"sound/samples/instruments/00.aiff": [0,{"jp":["@sound",120],"us":["@sound",141],"eu":["@sound",141],"sh":["@sound",141]}], +"sound/samples/instruments/01_banjo_1.aiff": [0,{"jp":["@sound",121],"us":["@sound",142],"eu":["@sound",142],"sh":["@sound",142]}], +"sound/samples/instruments/02.aiff": [0,{"jp":["@sound",122],"us":["@sound",143],"eu":["@sound",143],"sh":["@sound",143]}], +"sound/samples/instruments/03_human_whistle.aiff": [0,{"jp":["@sound",123],"us":["@sound",144],"eu":["@sound",144],"sh":["@sound",144]}], +"sound/samples/instruments/04_bright_piano.aiff": [0,{"jp":["@sound",124],"us":["@sound",145],"eu":["@sound",145],"sh":["@sound",145]}], +"sound/samples/instruments/05_acoustic_bass.aiff": [0,{"jp":["@sound",125],"us":["@sound",146],"eu":["@sound",146],"sh":["@sound",146]}], +"sound/samples/instruments/06_kick_drum_1.aiff": [0,{"jp":["@sound",126],"us":["@sound",147],"eu":["@sound",147],"sh":["@sound",147]}], +"sound/samples/instruments/07_rimshot.aiff": [0,{"jp":["@sound",127],"us":["@sound",148],"eu":["@sound",148],"sh":["@sound",148]}], +"sound/samples/instruments/08.aiff": [0,{"jp":["@sound",128],"us":["@sound",149],"eu":["@sound",149],"sh":["@sound",149]}], +"sound/samples/instruments/09.aiff": [0,{"jp":["@sound",129],"us":["@sound",150],"eu":["@sound",150],"sh":["@sound",150]}], +"sound/samples/instruments/0A_tambourine.aiff": [0,{"jp":["@sound",130],"us":["@sound",151],"eu":["@sound",151],"sh":["@sound",151]}], +"sound/samples/instruments/0B.aiff": [0,{"jp":["@sound",131],"us":["@sound",152],"eu":["@sound",152],"sh":["@sound",152]}], +"sound/samples/instruments/0C_conga_stick.aiff": [0,{"jp":["@sound",132],"us":["@sound",153],"eu":["@sound",153],"sh":["@sound",153]}], +"sound/samples/instruments/0D_clave.aiff": [0,{"jp":["@sound",133],"us":["@sound",154],"eu":["@sound",154],"sh":["@sound",154]}], +"sound/samples/instruments/0E_hihat_closed.aiff": [0,{"jp":["@sound",134],"us":["@sound",155],"eu":["@sound",155],"sh":["@sound",155]}], +"sound/samples/instruments/0F_hihat_open.aiff": [0,{"jp":["@sound",135],"us":["@sound",156],"eu":["@sound",156],"sh":["@sound",156]}], +"sound/samples/instruments/10_cymbal_bell.aiff": [0,{"jp":["@sound",136],"us":["@sound",157],"eu":["@sound",157],"sh":["@sound",157]}], +"sound/samples/instruments/11_splash_cymbal.aiff": [0,{"jp":["@sound",137],"us":["@sound",158],"eu":["@sound",158],"sh":["@sound",158]}], +"sound/samples/instruments/12_snare_drum_1.aiff": [0,{"jp":["@sound",138],"us":["@sound",159],"eu":["@sound",159],"sh":["@sound",159]}], +"sound/samples/instruments/13_snare_drum_2.aiff": [0,{"jp":["@sound",139],"us":["@sound",160],"eu":["@sound",160],"sh":["@sound",160]}], +"sound/samples/instruments/14_strings_5.aiff": [0,{"jp":["@sound",140],"us":["@sound",161],"eu":["@sound",161],"sh":["@sound",161]}], +"sound/samples/instruments/15_strings_4.aiff": [0,{"jp":["@sound",141],"us":["@sound",162],"eu":["@sound",162],"sh":["@sound",162]}], +"sound/samples/instruments/16_french_horns.aiff": [0,{"jp":["@sound",142],"us":["@sound",163],"eu":["@sound",163],"sh":["@sound",163]}], +"sound/samples/instruments/17_trumpet.aiff": [0,{"jp":["@sound",143],"us":["@sound",164],"eu":["@sound",164],"sh":["@sound",164]}], +"sound/samples/instruments/18_timpani.aiff": [0,{"jp":["@sound",144],"us":["@sound",165],"eu":["@sound",165],"sh":["@sound",165]}], +"sound/samples/instruments/19_brass.aiff": [0,{"jp":["@sound",145],"us":["@sound",166],"eu":["@sound",166],"sh":["@sound",166]}], +"sound/samples/instruments/1A_slap_bass.aiff": [0,{"jp":["@sound",146],"us":["@sound",167],"eu":["@sound",167],"sh":["@sound",167]}], +"sound/samples/instruments/1B_organ_2.aiff": [0,{"jp":["@sound",147],"us":["@sound",168],"eu":["@sound",168],"sh":["@sound",168]}], +"sound/samples/instruments/1C.aiff": [0,{"jp":["@sound",148],"us":["@sound",169],"eu":["@sound",169],"sh":["@sound",169]}], +"sound/samples/instruments/1D.aiff": [0,{"jp":["@sound",149],"us":["@sound",170],"eu":["@sound",170],"sh":["@sound",170]}], +"sound/samples/instruments/1E_closed_triangle.aiff": [0,{"jp":["@sound",150],"us":["@sound",171],"eu":["@sound",171],"sh":["@sound",171]}], +"sound/samples/instruments/1F_open_triangle.aiff": [0,{"jp":["@sound",151],"us":["@sound",172],"eu":["@sound",172],"sh":["@sound",172]}], +"sound/samples/instruments/20_cabasa.aiff": [0,{"jp":["@sound",152],"us":["@sound",173],"eu":["@sound",173],"sh":["@sound",173]}], +"sound/samples/instruments/21_sine_bass.aiff": [0,{"jp":["@sound",153],"us":["@sound",174],"eu":["@sound",174],"sh":["@sound",174]}], +"sound/samples/instruments/22_boys_choir.aiff": [0,{"jp":["@sound",154],"us":["@sound",175],"eu":["@sound",175],"sh":["@sound",175]}], +"sound/samples/instruments/23_strings_1.aiff": [0,{"jp":["@sound",155],"us":["@sound",176],"eu":["@sound",176],"sh":["@sound",176]}], +"sound/samples/instruments/24_strings_2.aiff": [0,{"jp":["@sound",156],"us":["@sound",177],"eu":["@sound",177],"sh":["@sound",177]}], +"sound/samples/instruments/25_strings_3.aiff": [0,{"jp":["@sound",157],"us":["@sound",178],"eu":["@sound",178],"sh":["@sound",178]}], +"sound/samples/instruments/26_crystal_rhodes.aiff": [0,{"jp":["@sound",158],"us":["@sound",179],"eu":["@sound",179],"sh":["@sound",179]}], +"sound/samples/instruments/27_harpsichord.aiff": [0,{"jp":["@sound",159],"us":["@sound",180],"eu":["@sound",180],"sh":["@sound",180]}], +"sound/samples/instruments/28_sitar_1.aiff": [0,{"jp":["@sound",160],"us":["@sound",181],"eu":["@sound",181],"sh":["@sound",181]}], +"sound/samples/instruments/29_orchestra_hit.aiff": [0,{"jp":["@sound",161],"us":["@sound",182],"eu":["@sound",182],"sh":["@sound",182]}], +"sound/samples/instruments/2A.aiff": [0,{"jp":["@sound",162],"us":["@sound",183],"eu":["@sound",183],"sh":["@sound",183]}], +"sound/samples/instruments/2B.aiff": [0,{"jp":["@sound",163],"us":["@sound",184],"eu":["@sound",184],"sh":["@sound",184]}], +"sound/samples/instruments/2C.aiff": [0,{"jp":["@sound",164],"us":["@sound",185],"eu":["@sound",185],"sh":["@sound",185]}], +"sound/samples/instruments/2D_trombone.aiff": [0,{"jp":["@sound",165],"us":["@sound",186],"eu":["@sound",186],"sh":["@sound",186]}], +"sound/samples/instruments/2E_accordion.aiff": [0,{"jp":["@sound",166],"us":["@sound",187],"eu":["@sound",187],"sh":["@sound",187]}], +"sound/samples/instruments/2F_sleigh_bells.aiff": [0,{"jp":["@sound",167],"us":["@sound",188],"eu":["@sound",188],"sh":["@sound",188]}], +"sound/samples/instruments/30_rarefaction-lahna.aiff": [0,{"jp":["@sound",168],"us":["@sound",189],"eu":["@sound",189],"sh":["@sound",189]}], +"sound/samples/instruments/31_rarefaction-convolution.aiff": [0,{"jp":["@sound",169],"us":["@sound",190],"eu":["@sound",190],"sh":["@sound",190]}], +"sound/samples/instruments/32_metal_rimshot.aiff": [0,{"jp":["@sound",170],"us":["@sound",191],"eu":["@sound",191],"sh":["@sound",191]}], +"sound/samples/instruments/33_kick_drum_2.aiff": [0,{"jp":["@sound",171],"us":["@sound",192],"eu":["@sound",192],"sh":["@sound",192]}], +"sound/samples/instruments/34_alto_flute.aiff": [0,{"jp":["@sound",172],"us":["@sound",193],"eu":["@sound",193],"sh":["@sound",193]}], +"sound/samples/instruments/34b_organ.aiff": [0,{"sh":["@sound",194]}], +"sound/samples/instruments/34c_organ_lq.aiff": [0,{"sh":["@sound",195]}], +"sound/samples/instruments/35_gospel_organ.aiff": [0,{"jp":["@sound",173],"us":["@sound",194],"eu":["@sound",194],"sh":["@sound",196]}], +"sound/samples/instruments/36_sawtooth_synth.aiff": [0,{"jp":["@sound",174],"us":["@sound",195],"eu":["@sound",195],"sh":["@sound",197]}], +"sound/samples/instruments/37_square_synth.aiff": [0,{"jp":["@sound",175],"us":["@sound",196],"eu":["@sound",196],"sh":["@sound",198]}], +"sound/samples/instruments/38_electric_kick_drum.aiff": [0,{"jp":["@sound",176],"us":["@sound",197],"eu":["@sound",197],"sh":["@sound",199]}], +"sound/samples/instruments/39_sitar_2.aiff": [0,{"jp":["@sound",177],"us":["@sound",198],"eu":["@sound",198],"sh":["@sound",200]}], +"sound/samples/instruments/3A_music_box.aiff": [0,{"jp":["@sound",178],"us":["@sound",199],"eu":["@sound",199],"sh":["@sound",201]}], +"sound/samples/instruments/3B_banjo_2.aiff": [0,{"jp":["@sound",179],"us":["@sound",200],"eu":["@sound",200],"sh":["@sound",202]}], +"sound/samples/instruments/3C_acoustic_guitar.aiff": [0,{"jp":["@sound",180],"us":["@sound",201],"eu":["@sound",201],"sh":["@sound",203]}], +"sound/samples/instruments/3D.aiff": [0,{"jp":["@sound",181],"us":["@sound",202],"eu":["@sound",202],"sh":["@sound",204]}], +"sound/samples/instruments/3E_monk_choir.aiff": [0,{"jp":["@sound",182],"us":["@sound",203],"eu":["@sound",203],"sh":["@sound",205]}], +"sound/samples/instruments/3F.aiff": [0,{"jp":["@sound",183],"us":["@sound",204],"eu":["@sound",204],"sh":["@sound",206]}], +"sound/samples/instruments/40_bell.aiff": [0,{"jp":["@sound",184],"us":["@sound",205],"eu":["@sound",205],"sh":["@sound",207]}], +"sound/samples/instruments/41_pan_flute.aiff": [0,{"jp":["@sound",185],"us":["@sound",206],"eu":["@sound",206],"sh":["@sound",208]}], +"sound/samples/instruments/42_vibraphone.aiff": [0,{"jp":["@sound",186],"us":["@sound",207],"eu":["@sound",207],"sh":["@sound",209]}], +"sound/samples/instruments/43_harmonica.aiff": [0,{"jp":["@sound",187],"us":["@sound",208],"eu":["@sound",208],"sh":["@sound",210]}], +"sound/samples/instruments/44_grand_piano.aiff": [0,{"jp":["@sound",188],"us":["@sound",209],"eu":["@sound",209],"sh":["@sound",211]}], +"sound/samples/instruments/45_french_horns_lq.aiff": [0,{"jp":["@sound",189],"us":["@sound",210],"eu":["@sound",210],"sh":["@sound",212]}], +"sound/samples/instruments/45b_la.aiff": [0,{"sh":["@sound",213]}], +"sound/samples/instruments/46_pizzicato_strings_1.aiff": [0,{"jp":["@sound",190],"us":["@sound",211],"eu":["@sound",211],"sh":["@sound",214]}], +"sound/samples/instruments/47_pizzicato_strings_2.aiff": [0,{"jp":["@sound",191],"us":["@sound",212],"eu":["@sound",212],"sh":["@sound",215]}], +"sound/samples/instruments/48_steel_drum.aiff": [0,{"jp":["@sound",192],"us":["@sound",213],"eu":["@sound",213],"sh":["@sound",216]}], +"sound/samples/piranha_music_box/00_music_box.aiff": [0,{"jp":["@sound",193],"us":["@sound",214],"eu":["@sound",214]}], +"sound/samples/sfx_1/00_twirl.aiff": [0,{"jp":["@sound",0],"us":["@sound",0],"eu":["@sound",0],"sh":["@sound",0]}], +"sound/samples/sfx_1/01_brushing.aiff": [0,{"jp":["@sound",1],"us":["@sound",1],"eu":["@sound",1],"sh":["@sound",1]}], +"sound/samples/sfx_1/02_hand_touch.aiff": [0,{"jp":["@sound",2],"us":["@sound",2],"eu":["@sound",2],"sh":["@sound",2]}], +"sound/samples/sfx_1/03_yoshi.aiff": [0,{"jp":["@sound",3],"us":["@sound",3],"eu":["@sound",3],"sh":["@sound",3]}], +"sound/samples/sfx_1/04_plop.aiff": [0,{"jp":["@sound",4],"us":["@sound",4],"eu":["@sound",4],"sh":["@sound",4]}], +"sound/samples/sfx_1/05_heavy_landing.aiff": [0,{"jp":["@sound",5],"us":["@sound",5],"eu":["@sound",5],"sh":["@sound",5]}], +"sound/samples/sfx_4/00.aiff": [0,{"jp":["@sound",17],"us":["@sound",17],"eu":["@sound",17],"sh":["@sound",17]}], +"sound/samples/sfx_4/01.aiff": [0,{"jp":["@sound",18],"us":["@sound",18],"eu":["@sound",18],"sh":["@sound",18]}], +"sound/samples/sfx_4/02.aiff": [0,{"jp":["@sound",19],"us":["@sound",19],"eu":["@sound",19],"sh":["@sound",19]}], +"sound/samples/sfx_4/03.aiff": [0,{"jp":["@sound",20],"us":["@sound",20],"eu":["@sound",20],"sh":["@sound",20]}], +"sound/samples/sfx_4/04.aiff": [0,{"jp":["@sound",21],"us":["@sound",21],"eu":["@sound",21],"sh":["@sound",21]}], +"sound/samples/sfx_4/05.aiff": [0,{"jp":["@sound",22],"us":["@sound",22],"eu":["@sound",22],"sh":["@sound",22]}], +"sound/samples/sfx_4/06.aiff": [0,{"jp":["@sound",23],"us":["@sound",23],"eu":["@sound",23],"sh":["@sound",23]}], +"sound/samples/sfx_4/07.aiff": [0,{"jp":["@sound",24],"us":["@sound",24],"eu":["@sound",24],"sh":["@sound",24]}], +"sound/samples/sfx_4/08.aiff": [0,{"jp":["@sound",25],"us":["@sound",25],"eu":["@sound",25],"sh":["@sound",25]}], +"sound/samples/sfx_4/09.aiff": [0,{"jp":["@sound",26],"us":["@sound",26],"eu":["@sound",26],"sh":["@sound",26]}], +"sound/samples/sfx_5/00.aiff": [0,{"jp":["@sound",27],"us":["@sound",27],"eu":["@sound",27],"sh":["@sound",27]}], +"sound/samples/sfx_5/01.aiff": [0,{"jp":["@sound",28],"us":["@sound",28],"eu":["@sound",28],"sh":["@sound",28]}], +"sound/samples/sfx_5/02.aiff": [0,{"jp":["@sound",29],"us":["@sound",29],"eu":["@sound",29],"sh":["@sound",29]}], +"sound/samples/sfx_5/03.aiff": [0,{"jp":["@sound",30],"us":["@sound",30],"eu":["@sound",30],"sh":["@sound",30]}], +"sound/samples/sfx_5/04.aiff": [0,{"jp":["@sound",31],"us":["@sound",31],"eu":["@sound",31],"sh":["@sound",31]}], +"sound/samples/sfx_5/05.aiff": [0,{"jp":["@sound",32],"us":["@sound",32],"eu":["@sound",32],"sh":["@sound",32]}], +"sound/samples/sfx_5/06.aiff": [0,{"jp":["@sound",33],"us":["@sound",33],"eu":["@sound",33],"sh":["@sound",33]}], +"sound/samples/sfx_5/07.aiff": [0,{"jp":["@sound",34],"us":["@sound",34],"eu":["@sound",34],"sh":["@sound",34]}], +"sound/samples/sfx_5/08.aiff": [0,{"jp":["@sound",35],"us":["@sound",35],"eu":["@sound",35],"sh":["@sound",35]}], +"sound/samples/sfx_5/09.aiff": [0,{"jp":["@sound",36],"us":["@sound",36],"eu":["@sound",36],"sh":["@sound",36]}], +"sound/samples/sfx_5/0A.aiff": [0,{"jp":["@sound",37],"us":["@sound",37],"eu":["@sound",37],"sh":["@sound",37]}], +"sound/samples/sfx_5/0B.aiff": [0,{"jp":["@sound",38],"us":["@sound",38],"eu":["@sound",38],"sh":["@sound",38]}], +"sound/samples/sfx_5/0C.aiff": [0,{"jp":["@sound",39],"us":["@sound",39],"eu":["@sound",39],"sh":["@sound",39]}], +"sound/samples/sfx_5/0D.aiff": [0,{"jp":["@sound",40],"us":["@sound",40],"eu":["@sound",40],"sh":["@sound",40]}], +"sound/samples/sfx_5/0E.aiff": [0,{"jp":["@sound",41],"us":["@sound",41],"eu":["@sound",41],"sh":["@sound",41]}], +"sound/samples/sfx_5/0F.aiff": [0,{"jp":["@sound",42],"us":["@sound",42],"eu":["@sound",42],"sh":["@sound",42]}], +"sound/samples/sfx_5/10.aiff": [0,{"jp":["@sound",43],"us":["@sound",43],"eu":["@sound",43],"sh":["@sound",43]}], +"sound/samples/sfx_5/11.aiff": [0,{"jp":["@sound",44],"us":["@sound",44],"eu":["@sound",44],"sh":["@sound",44]}], +"sound/samples/sfx_5/12.aiff": [0,{"jp":["@sound",45],"us":["@sound",45],"eu":["@sound",45],"sh":["@sound",45]}], +"sound/samples/sfx_5/13.aiff": [0,{"jp":["@sound",46],"us":["@sound",46],"eu":["@sound",46],"sh":["@sound",46]}], +"sound/samples/sfx_5/14.aiff": [0,{"jp":["@sound",47],"us":["@sound",47],"eu":["@sound",47],"sh":["@sound",47]}], +"sound/samples/sfx_5/15.aiff": [0,{"jp":["@sound",48],"us":["@sound",48],"eu":["@sound",48],"sh":["@sound",48]}], +"sound/samples/sfx_5/16.aiff": [0,{"jp":["@sound",49],"us":["@sound",49],"eu":["@sound",49],"sh":["@sound",49]}], +"sound/samples/sfx_5/17.aiff": [0,{"jp":["@sound",50],"us":["@sound",50],"eu":["@sound",50],"sh":["@sound",50]}], +"sound/samples/sfx_5/18.aiff": [0,{"jp":["@sound",51],"us":["@sound",51],"eu":["@sound",51],"sh":["@sound",51]}], +"sound/samples/sfx_5/19.aiff": [0,{"jp":["@sound",52],"us":["@sound",52],"eu":["@sound",52],"sh":["@sound",52]}], +"sound/samples/sfx_5/1A.aiff": [0,{"jp":["@sound",53],"us":["@sound",53],"eu":["@sound",53],"sh":["@sound",53]}], +"sound/samples/sfx_5/1B.aiff": [0,{"jp":["@sound",54],"us":["@sound",54],"eu":["@sound",54],"sh":["@sound",54]}], +"sound/samples/sfx_5/1C.aiff": [0,{"jp":["@sound",55],"us":["@sound",55],"eu":["@sound",55],"sh":["@sound",55]}], +"sound/samples/sfx_6/00.aiff": [0,{"jp":["@sound",56],"us":["@sound",56],"eu":["@sound",56],"sh":["@sound",56]}], +"sound/samples/sfx_6/01.aiff": [0,{"jp":["@sound",57],"us":["@sound",57],"eu":["@sound",57],"sh":["@sound",57]}], +"sound/samples/sfx_6/02.aiff": [0,{"jp":["@sound",58],"us":["@sound",58],"eu":["@sound",58],"sh":["@sound",58]}], +"sound/samples/sfx_6/03.aiff": [0,{"jp":["@sound",59],"us":["@sound",59],"eu":["@sound",59],"sh":["@sound",59]}], +"sound/samples/sfx_6/04.aiff": [0,{"jp":["@sound",60],"us":["@sound",60],"eu":["@sound",60],"sh":["@sound",60]}], +"sound/samples/sfx_6/05.aiff": [0,{"jp":["@sound",61],"us":["@sound",61],"eu":["@sound",61],"sh":["@sound",61]}], +"sound/samples/sfx_6/06.aiff": [0,{"jp":["@sound",62],"us":["@sound",62],"eu":["@sound",62],"sh":["@sound",62]}], +"sound/samples/sfx_6/07.aiff": [0,{"jp":["@sound",63],"us":["@sound",63],"eu":["@sound",63],"sh":["@sound",63]}], +"sound/samples/sfx_6/08.aiff": [0,{"jp":["@sound",64],"us":["@sound",64],"eu":["@sound",64],"sh":["@sound",64]}], +"sound/samples/sfx_6/09.aiff": [0,{"jp":["@sound",65],"us":["@sound",65],"eu":["@sound",65],"sh":["@sound",65]}], +"sound/samples/sfx_6/0A.aiff": [0,{"jp":["@sound",66],"us":["@sound",66],"eu":["@sound",66],"sh":["@sound",66]}], +"sound/samples/sfx_6/0B.aiff": [0,{"jp":["@sound",67],"us":["@sound",67],"eu":["@sound",67],"sh":["@sound",67]}], +"sound/samples/sfx_6/0C.aiff": [0,{"jp":["@sound",68],"us":["@sound",68],"eu":["@sound",68],"sh":["@sound",68]}], +"sound/samples/sfx_6/0D.aiff": [0,{"jp":["@sound",69],"us":["@sound",69],"eu":["@sound",69],"sh":["@sound",69]}], +"sound/samples/sfx_7/00.aiff": [0,{"jp":["@sound",70],"us":["@sound",70],"eu":["@sound",70],"sh":["@sound",70]}], +"sound/samples/sfx_7/01.aiff": [0,{"jp":["@sound",71],"us":["@sound",71],"eu":["@sound",71],"sh":["@sound",71]}], +"sound/samples/sfx_7/02.aiff": [0,{"jp":["@sound",72],"us":["@sound",72],"eu":["@sound",72],"sh":["@sound",72]}], +"sound/samples/sfx_7/03.aiff": [0,{"jp":["@sound",73],"us":["@sound",73],"eu":["@sound",73],"sh":["@sound",73]}], +"sound/samples/sfx_7/04.aiff": [0,{"jp":["@sound",74],"us":["@sound",74],"eu":["@sound",74],"sh":["@sound",74]}], +"sound/samples/sfx_7/05.aiff": [0,{"jp":["@sound",75],"us":["@sound",75],"eu":["@sound",75],"sh":["@sound",75]}], +"sound/samples/sfx_7/06.aiff": [0,{"jp":["@sound",76],"us":["@sound",76],"eu":["@sound",76],"sh":["@sound",76]}], +"sound/samples/sfx_7/07.aiff": [0,{"jp":["@sound",77],"us":["@sound",77],"eu":["@sound",77],"sh":["@sound",77]}], +"sound/samples/sfx_7/08.aiff": [0,{"jp":["@sound",78],"us":["@sound",78],"eu":["@sound",78],"sh":["@sound",78]}], +"sound/samples/sfx_7/09.aiff": [0,{"jp":["@sound",79],"us":["@sound",79],"eu":["@sound",79],"sh":["@sound",79]}], +"sound/samples/sfx_7/0A.aiff": [0,{"jp":["@sound",80],"us":["@sound",80],"eu":["@sound",80],"sh":["@sound",80]}], +"sound/samples/sfx_7/0B.aiff": [0,{"jp":["@sound",81],"us":["@sound",81],"eu":["@sound",81],"sh":["@sound",81]}], +"sound/samples/sfx_7/0C.aiff": [0,{"jp":["@sound",82],"us":["@sound",82],"eu":["@sound",82],"sh":["@sound",82]}], +"sound/samples/sfx_7/0D_chain_chomp_bark.aiff": [0,{"us":["@sound",83],"eu":["@sound",83],"sh":["@sound",83]}], +"sound/samples/sfx_9/00.aiff": [0,{"jp":["@sound",99],"us":["@sound",111],"eu":["@sound",111],"sh":["@sound",111]}], +"sound/samples/sfx_9/01.aiff": [0,{"jp":["@sound",100],"us":["@sound",112],"eu":["@sound",112],"sh":["@sound",112]}], +"sound/samples/sfx_9/02.aiff": [0,{"jp":["@sound",101],"us":["@sound",113],"eu":["@sound",113],"sh":["@sound",113]}], +"sound/samples/sfx_9/03.aiff": [0,{"jp":["@sound",102],"us":["@sound",114],"eu":["@sound",114],"sh":["@sound",114]}], +"sound/samples/sfx_9/04_camera_buzz.aiff": [0,{"jp":["@sound",103],"us":["@sound",115],"eu":["@sound",115],"sh":["@sound",115]}], +"sound/samples/sfx_9/05_camera_shutter.aiff": [0,{"jp":["@sound",104],"us":["@sound",116],"eu":["@sound",116],"sh":["@sound",116]}], +"sound/samples/sfx_9/06.aiff": [0,{"jp":["@sound",105],"us":["@sound",117],"eu":["@sound",117],"sh":["@sound",117]}], +"sound/samples/sfx_mario/00_mario_jump_hoo.aiff": [0,{"jp":["@sound",83],"us":["@sound",84],"eu":["@sound",84],"sh":["@sound",84]}], +"sound/samples/sfx_mario/01_mario_jump_wah.aiff": [0,{"jp":["@sound",84],"us":["@sound",85],"eu":["@sound",85],"sh":["@sound",85]}], +"sound/samples/sfx_mario/02_mario_yah.aiff": [0,{"jp":["@sound",85],"us":["@sound",86],"eu":["@sound",86],"sh":["@sound",86]}], +"sound/samples/sfx_mario/03_mario_haha.aiff": [0,{"jp":["@sound",86],"us":["@sound",87],"eu":["@sound",87],"sh":["@sound",87]}], +"sound/samples/sfx_mario/04_mario_yahoo.aiff": [0,{"jp":["@sound",87],"us":["@sound",88],"eu":["@sound",88],"sh":["@sound",88]}], +"sound/samples/sfx_mario/05_mario_uh.aiff": [0,{"jp":["@sound",88],"us":["@sound",89],"eu":["@sound",89],"sh":["@sound",89]}], +"sound/samples/sfx_mario/06_mario_hrmm.aiff": [0,{"jp":["@sound",89],"us":["@sound",90],"eu":["@sound",90],"sh":["@sound",90]}], +"sound/samples/sfx_mario/07_mario_wah2.aiff": [0,{"jp":["@sound",90],"us":["@sound",91],"eu":["@sound",91],"sh":["@sound",91]}], +"sound/samples/sfx_mario/08_mario_whoa.aiff": [0,{"jp":["@sound",91],"us":["@sound",92],"eu":["@sound",92],"sh":["@sound",92]}], +"sound/samples/sfx_mario/09_mario_eeuh.aiff": [0,{"jp":["@sound",92],"us":["@sound",93],"eu":["@sound",93],"sh":["@sound",93]}], +"sound/samples/sfx_mario/0A_mario_attacked.aiff": [0,{"jp":["@sound",93],"us":["@sound",94],"eu":["@sound",94],"sh":["@sound",94]}], +"sound/samples/sfx_mario/0B_mario_ooof.aiff": [0,{"jp":["@sound",94],"us":["@sound",95],"eu":["@sound",95],"sh":["@sound",95]}], +"sound/samples/sfx_mario/0C_mario_here_we_go.aiff": [0,{"jp":["@sound",95],"us":["@sound",96],"eu":["@sound",96],"sh":["@sound",96]}], +"sound/samples/sfx_mario/0D_mario_yawning.aiff": [0,{"jp":["@sound",96],"us":["@sound",97],"eu":["@sound",97],"sh":["@sound",97]}], +"sound/samples/sfx_mario/0E_mario_snoring1.aiff": [0,{"jp":["@sound",97],"us":["@sound",98],"eu":["@sound",98],"sh":["@sound",98]}], +"sound/samples/sfx_mario/0F_mario_snoring2.aiff": [0,{"jp":["@sound",98],"us":["@sound",99],"eu":["@sound",99],"sh":["@sound",99]}], +"sound/samples/sfx_mario/10_mario_doh.aiff": [0,{"us":["@sound",100],"eu":["@sound",100],"sh":["@sound",100]}], +"sound/samples/sfx_mario/11_mario_game_over.aiff": [0,{"us":["@sound",101],"eu":["@sound",101],"sh":["@sound",101]}], +"sound/samples/sfx_mario/12_mario_hello.aiff": [0,{"us":["@sound",102],"eu":["@sound",102],"sh":["@sound",102]}], +"sound/samples/sfx_mario/13_mario_press_start_to_play.aiff": [0,{"us":["@sound",103],"eu":["@sound",103],"sh":["@sound",103]}], +"sound/samples/sfx_mario/14_mario_twirl_bounce.aiff": [0,{"us":["@sound",104],"eu":["@sound",104],"sh":["@sound",104]}], +"sound/samples/sfx_mario/15_mario_snoring3.aiff": [0,{"us":["@sound",105],"eu":["@sound",105],"sh":["@sound",105]}], +"sound/samples/sfx_mario/16_mario_so_longa_bowser.aiff": [0,{"us":["@sound",106],"eu":["@sound",106]}], +"sound/samples/sfx_mario/16_mario_bye_bye.aiff": [0,{"sh":["@sound",106]}], +"sound/samples/sfx_mario/17_mario_ima_tired.aiff": [0,{"us":["@sound",107],"eu":["@sound",107],"sh":["@sound",107]}], +"sound/samples/sfx_mario/18_mario_waha.aiff": [0,{"us":["@sound",108],"eu":["@sound",108],"sh":["@sound",108]}], +"sound/samples/sfx_mario/19_mario_yippee.aiff": [0,{"us":["@sound",109],"eu":["@sound",109],"sh":["@sound",109]}], +"sound/samples/sfx_mario/1A_mario_lets_a_go.aiff": [0,{"us":["@sound",110],"eu":["@sound",110],"sh":["@sound",110]}], +"sound/samples/sfx_mario_peach/00_mario_waaaooow.aiff": [0,{"jp":["@sound",106],"us":["@sound",118],"eu":["@sound",118],"sh":["@sound",118]}], +"sound/samples/sfx_mario_peach/01_mario_hoohoo.aiff": [0,{"jp":["@sound",107],"us":["@sound",119],"eu":["@sound",119],"sh":["@sound",119]}], +"sound/samples/sfx_mario_peach/02_mario_panting.aiff": [0,{"jp":["@sound",108],"us":["@sound",120],"eu":["@sound",120],"sh":["@sound",120]}], +"sound/samples/sfx_mario_peach/03_mario_dying.aiff": [0,{"jp":["@sound",109],"us":["@sound",121],"eu":["@sound",121],"sh":["@sound",121]}], +"sound/samples/sfx_mario_peach/04_mario_on_fire.aiff": [0,{"jp":["@sound",110],"us":["@sound",122],"eu":["@sound",122],"sh":["@sound",122]}], +"sound/samples/sfx_mario_peach/05_mario_uh2.aiff": [0,{"jp":["@sound",111],"us":["@sound",123],"eu":["@sound",123],"sh":["@sound",123]}], +"sound/samples/sfx_mario_peach/06_mario_coughing.aiff": [0,{"jp":["@sound",112],"us":["@sound",124],"eu":["@sound",124],"sh":["@sound",124]}], +"sound/samples/sfx_mario_peach/07_mario_its_a_me_mario.aiff": [0,{"jp":["@sound",113],"us":["@sound",125],"eu":["@sound",125],"sh":["@sound",125]}], +"sound/samples/sfx_mario_peach/08_mario_punch_yah.aiff": [0,{"jp":["@sound",114],"us":["@sound",126],"eu":["@sound",126],"sh":["@sound",126]}], +"sound/samples/sfx_mario_peach/09_mario_punch_hoo.aiff": [0,{"jp":["@sound",115],"us":["@sound",127],"eu":["@sound",127],"sh":["@sound",127]}], +"sound/samples/sfx_mario_peach/0A_mario_mama_mia.aiff": [0,{"jp":["@sound",116],"us":["@sound",128],"eu":["@sound",128],"sh":["@sound",128]}], +"sound/samples/sfx_mario_peach/0B_mario_okey_dokey.aiff": [0,{"jp":["@sound",117],"us":["@sound",129],"eu":["@sound",129],"sh":["@sound",129]}], +"sound/samples/sfx_mario_peach/0C_mario_drowning.aiff": [0,{"jp":["@sound",118],"us":["@sound",130],"eu":["@sound",130],"sh":["@sound",130]}], +"sound/samples/sfx_mario_peach/0D_mario_thank_you_playing_my_game.aiff": [0,{"jp":["@sound",119],"us":["@sound",131],"eu":["@sound",131],"sh":["@sound",131]}], +"sound/samples/sfx_mario_peach/0E_peach_dear_mario.aiff": [0,{"us":["@sound",132],"eu":["@sound",132],"sh":["@sound",132]}], +"sound/samples/sfx_mario_peach/0F_peach_mario.aiff": [0,{"us":["@sound",133],"eu":["@sound",133],"sh":["@sound",133]}], +"sound/samples/sfx_mario_peach/10_peach_power_of_the_stars.aiff": [0,{"us":["@sound",134],"eu":["@sound",134],"sh":["@sound",134]}], +"sound/samples/sfx_mario_peach/11_peach_thanks_to_you.aiff": [0,{"us":["@sound",135],"eu":["@sound",135],"sh":["@sound",135]}], +"sound/samples/sfx_mario_peach/12_peach_thank_you_mario.aiff": [0,{"us":["@sound",136],"eu":["@sound",136],"sh":["@sound",136]}], +"sound/samples/sfx_mario_peach/13_peach_something_special.aiff": [0,{"us":["@sound",137],"eu":["@sound",137],"sh":["@sound",137]}], +"sound/samples/sfx_mario_peach/14_peach_bake_a_cake.aiff": [0,{"us":["@sound",138],"eu":["@sound",138],"sh":["@sound",138]}], +"sound/samples/sfx_mario_peach/15_peach_for_mario.aiff": [0,{"us":["@sound",139],"eu":["@sound",139],"sh":["@sound",139]}], +"sound/samples/sfx_mario_peach/16_peach_mario2.aiff": [0,{"us":["@sound",140],"eu":["@sound",140],"sh":["@sound",140]}], +"sound/samples/sfx_terrain/00_step_default.aiff": [0,{"jp":["@sound",6],"us":["@sound",6],"eu":["@sound",6],"sh":["@sound",6]}], +"sound/samples/sfx_terrain/01_step_grass.aiff": [0,{"jp":["@sound",7],"us":["@sound",7],"eu":["@sound",7],"sh":["@sound",7]}], +"sound/samples/sfx_terrain/02_step_stone.aiff": [0,{"jp":["@sound",8],"us":["@sound",8],"eu":["@sound",8],"sh":["@sound",8]}], +"sound/samples/sfx_terrain/03_step_spooky.aiff": [0,{"jp":["@sound",9],"us":["@sound",9],"eu":["@sound",9],"sh":["@sound",9]}], +"sound/samples/sfx_terrain/04_step_snow.aiff": [0,{"jp":["@sound",10],"us":["@sound",10],"eu":["@sound",10],"sh":["@sound",10]}], +"sound/samples/sfx_terrain/05_step_ice.aiff": [0,{"jp":["@sound",11],"us":["@sound",11],"eu":["@sound",11],"sh":["@sound",11]}], +"sound/samples/sfx_terrain/06_step_metal.aiff": [0,{"jp":["@sound",12],"us":["@sound",12],"eu":["@sound",12],"sh":["@sound",12]}], +"sound/samples/sfx_terrain/07_step_sand.aiff": [0,{"jp":["@sound",13],"us":["@sound",13],"eu":["@sound",13],"sh":["@sound",13]}], +"sound/samples/sfx_water/00_plunge.aiff": [0,{"jp":["@sound",14],"us":["@sound",14],"eu":["@sound",14],"sh":["@sound",14]}], +"sound/samples/sfx_water/01_splash.aiff": [0,{"jp":["@sound",15],"us":["@sound",15],"eu":["@sound",15],"sh":["@sound",15]}], +"sound/samples/sfx_water/02_swim.aiff": [0,{"jp":["@sound",16],"us":["@sound",16],"eu":["@sound",16],"sh":["@sound",16]}] } diff --git a/assets/demo_data.json b/assets/demo_data.json index 5993222b..3652b490 100644 --- a/assets/demo_data.json +++ b/assets/demo_data.json @@ -19,7 +19,7 @@ { "table": [ - {"demofile":"bitdw", "ifdef":["VERSION_US"]}, + {"demofile":"bitdw", "ifdef":["VERSION_US", "VERSION_SH"]}, /* Whomp's Fortress has the wrong size. The original entries probably manually input the sizes. */ @@ -44,6 +44,6 @@ Mario runs into the sign and aligns himself as if it were a mistake. */ {"name":"unused"}, - {"name":"bitdw", "ifdef":["VERSION_US"]} + {"name":"bitdw", "ifdef":["VERSION_US", "VERSION_SH"]} ] } diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index f4db0b6b..22e1365c 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -14,7 +14,7 @@ in_files = [ "src/pc/lua/smlua_hooks.h", "src/game/camera.h", "include/mario_animation_ids.h", - "include/audio_defines.h", + "include/sounds.h", "src/game/characters.h", "src/pc/network/network_player.h", "include/PR/os_cont.h", diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index e3a31713..1d3b1a4c 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -25,7 +25,7 @@ in_files = [ "src/game/mario_actions_submerged.c", "src/game/mario_step.h", "src/game/mario.h", - "src/game/thread6.c", + "src/game/rumble_init.c", "src/pc/djui/djui_popup.h", "src/pc/network/network_utils.h", "src/pc/djui/djui_chat_message.h", @@ -49,7 +49,7 @@ in_files = [ override_allowed_functions = { "src/audio/external.h": [ " play_", "fade" ], "src/game/camera.h": [ "set_.*camera_.*shake", "set_camera_mode" ], - "src/game/thread6.c": [ "queue_rumble_"], + "src/game/rumble_init.c": [ "queue_rumble_"], "src/pc/djui/djui_popup.h" : [ "create" ], "src/game/save_file.h": [ "save_file_get_" ], } diff --git a/autogen/extract_constants.py b/autogen/extract_constants.py index 70272113..dea84c61 100644 --- a/autogen/extract_constants.py +++ b/autogen/extract_constants.py @@ -100,6 +100,5 @@ def extract_constants(filename): return txt - if __name__ == "__main__": - print(extract_constants(sys.argv[1])) + print(extract_constants(sys.argv[1])) \ No newline at end of file diff --git a/bin/cave.c b/bin/cave.c index 56658cd6..a2e358f3 100644 --- a/bin/cave.c +++ b/bin/cave.c @@ -1,88 +1,89 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 cave_09000000[] = { +ALIGNED8 const Texture cave_09000000[] = { #include "textures/cave/hmc_textures.00000.rgba16.inc.c" }; // 0x09001000 -ALIGNED8 const u8 cave_09001000[] = { +ALIGNED8 const Texture cave_09001000[] = { #include "textures/cave/hmc_textures.01000.rgba16.inc.c" }; // 0x09001800 -ALIGNED8 const u8 cave_09001800[] = { +ALIGNED8 const Texture cave_09001800[] = { #include "textures/cave/hmc_textures.01800.rgba16.inc.c" }; // 0x09002800 -ALIGNED8 const u8 cave_09002800[] = { +ALIGNED8 const Texture cave_09002800[] = { #include "textures/cave/hmc_textures.02800.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 cave_09003000[] = { +ALIGNED8 const Texture cave_09003000[] = { #include "textures/cave/hmc_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 cave_09003800[] = { +ALIGNED8 const Texture cave_09003800[] = { #include "textures/cave/hmc_textures.03800.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 cave_09004800[] = { +ALIGNED8 const Texture cave_09004800[] = { #include "textures/cave/hmc_textures.04800.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 cave_09005800[] = { +ALIGNED8 const Texture cave_09005800[] = { #include "textures/cave/hmc_textures.05800.rgba16.inc.c" }; // 0x09006800 -ALIGNED8 const u8 cave_09006800[] = { +ALIGNED8 const Texture cave_09006800[] = { #include "textures/cave/hmc_textures.06800.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 cave_09007000[] = { +ALIGNED8 const Texture cave_09007000[] = { #include "textures/cave/hmc_textures.07000.rgba16.inc.c" }; // 0x09007800 -ALIGNED8 const u8 cave_09007800[] = { +ALIGNED8 const Texture cave_09007800[] = { #include "textures/cave/hmc_textures.07800.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 cave_09008800[] = { +ALIGNED8 const Texture cave_09008800[] = { #include "textures/cave/hmc_textures.08800.rgba16.inc.c" }; // 0x09009800 -ALIGNED8 const u8 cave_09009800[] = { +ALIGNED8 const Texture cave_09009800[] = { #include "textures/cave/hmc_textures.09800.rgba16.inc.c" }; // 0x0900A000 -ALIGNED8 const u8 cave_0900A000[] = { +ALIGNED8 const Texture cave_0900A000[] = { #include "textures/cave/hmc_textures.0A000.rgba16.inc.c" }; // 0x0900A800 -ALIGNED8 const u8 cave_0900A800[] = { +ALIGNED8 const Texture cave_0900A800[] = { #include "textures/cave/hmc_textures.0A800.rgba16.inc.c" }; // 0x0900B800 -ALIGNED8 const u8 cave_0900B800[] = { +ALIGNED8 const Texture cave_0900B800[] = { #include "textures/cave/hmc_textures.0B800.ia16.inc.c" }; // 0x0900C000 -ALIGNED8 const u8 cave_0900C000[] = { +ALIGNED8 const Texture cave_0900C000[] = { #include "textures/cave/hmc_textures.0C000.ia16.inc.c" }; diff --git a/bin/debug_level_select.c b/bin/debug_level_select.c index bc79a0b3..345203a6 100644 --- a/bin/debug_level_select.c +++ b/bin/debug_level_select.c @@ -5,8 +5,8 @@ // 0x07000000 - 0x07000018 static const Lights1 debug_level_select_lights_07000000 = gdSPDefLights1( - 0x7f, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x50 + 0x7f, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x50 ); // 0x07000018 - 0x07000108 @@ -221,8 +221,8 @@ const Gfx debug_level_select_dl_07000858[] = { // 0x07000A28 - 0x07000A40 static const Lights1 debug_level_select_lights_07000A28 = gdSPDefLights1( - 0x00, 0x00, 0x7f, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x50 + 0x00, 0x00, 0x7f, + 0x00, 0x00, 0xff, 0x00, 0x00, 0x50 ); // 0x07000A40 - 0x07000B30 @@ -404,8 +404,8 @@ const Gfx debug_level_select_dl_07001100[] = { // 0x07001288 - 0x070012A0 static const Lights1 debug_level_select_lights_07001288 = gdSPDefLights1( - 0x00, 0x56, 0x00, - 0x00, 0xad, 0x00, 0x00, 0x00, 0x50 + 0x00, 0x56, 0x00, + 0x00, 0xad, 0x00, 0x00, 0x00, 0x50 ); // 0x070012A0 - 0x07001390 @@ -640,8 +640,8 @@ const Gfx debug_level_select_dl_07001BA0[] = { // 0x07001D98 - 0x07001DB0 static const Lights1 debug_level_select_lights_07001D98 = gdSPDefLights1( - 0x7f, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x50 + 0x7f, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x50 ); // 0x07001DB0 - 0x07001EA0 @@ -856,8 +856,8 @@ const Gfx debug_level_select_dl_070025F0[] = { // 0x070027C0 - 0x070027D8 static const Lights1 debug_level_select_lights_070027C0 = gdSPDefLights1( - 0x00, 0x00, 0x7f, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x50 + 0x00, 0x00, 0x7f, + 0x00, 0x00, 0xff, 0x00, 0x00, 0x50 ); // 0x070027D8 - 0x070028C8 @@ -1131,8 +1131,8 @@ const Gfx debug_level_select_dl_07003258[] = { // 0x070034A0 - 0x070034B8 static const Lights1 debug_level_select_lights_070034A0 = gdSPDefLights1( - 0x7f, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x50 + 0x7f, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x50 ); // 0x070034B8 - 0x070035A8 @@ -1367,8 +1367,8 @@ const Gfx debug_level_select_dl_07003DB8[] = { // 0x07003FB0 - 0x07003FC8 static const Lights1 debug_level_select_lights_07003FB0 = gdSPDefLights1( - 0x00, 0x00, 0x7f, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x50 + 0x00, 0x00, 0x7f, + 0x00, 0x00, 0xff, 0x00, 0x00, 0x50 ); // 0x07003FC8 - 0x070040B8 @@ -1603,8 +1603,8 @@ const Gfx debug_level_select_dl_070048C8[] = { // 0x07004AC0 - 0x07004AD8 static const Lights1 debug_level_select_lights_07004AC0 = gdSPDefLights1( - 0x00, 0x59, 0x00, - 0x00, 0xb2, 0x00, 0x00, 0x00, 0x50 + 0x00, 0x59, 0x00, + 0x00, 0xb2, 0x00, 0x00, 0x00, 0x50 ); // 0x07004AD8 - 0x07004BC8 @@ -1878,8 +1878,8 @@ const Gfx debug_level_select_dl_07005558[] = { // 0x070057A0 - 0x070057B8 static const Lights1 debug_level_select_lights_070057A0 = gdSPDefLights1( - 0x7f, 0x00, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x50 + 0x7f, 0x00, 0x00, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x50 ); // 0x070057B8 - 0x070058A8 @@ -1949,8 +1949,8 @@ const Gfx debug_level_select_dl_070059F8[] = { // 0x07005A98 - 0x07005AB0 static const Lights1 debug_level_select_lights_07005A98 = gdSPDefLights1( - 0x00, 0x00, 0x7f, - 0x00, 0x00, 0xff, 0x00, 0x00, 0x50 + 0x00, 0x00, 0x7f, + 0x00, 0x00, 0xff, 0x00, 0x00, 0x50 ); // 0x07005AB0 - 0x07005BA0 diff --git a/bin/effect.c b/bin/effect.c index fd6af43c..1b8091b1 100644 --- a/bin/effect.c +++ b/bin/effect.c @@ -1,5 +1,8 @@ -#include -#include "sm64.h" +#include +#include + +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" @@ -7,27 +10,27 @@ UNUSED static const u64 effect_unused_0 = 0; // Flower (Unused) // 0x0B000008 -ALIGNED8 static const u8 effect_0B000008[] = { +ALIGNED8 static const Texture effect_0B000008[] = { #include "textures/effect/flower.00008.rgba16.inc.c" }; // 0x0B000808 -ALIGNED8 static const u8 effect_0B000808[] = { +ALIGNED8 static const Texture effect_0B000808[] = { #include "textures/effect/flower.00808.rgba16.inc.c" }; // 0x0B001008 -ALIGNED8 static const u8 effect_0B001008[] = { +ALIGNED8 static const Texture effect_0B001008[] = { #include "textures/effect/flower.01008.rgba16.inc.c" }; // 0x0B001808 -ALIGNED8 static const u8 effect_0B001808[] = { +ALIGNED8 static const Texture effect_0B001808[] = { #include "textures/effect/flower.01808.rgba16.inc.c" }; // 0x0B002008 -const u8 *const flower_bubbles_textures_ptr_0B002008[] = { +const Texture *const flower_bubbles_textures_ptr_0B002008[] = { effect_0B000008, effect_0B000808, effect_0B001008, @@ -38,47 +41,47 @@ const u8 *const flower_bubbles_textures_ptr_0B002008[] = { // Lava Bubble // 0x0B002020 -ALIGNED8 static const u8 effect_0B002020[] = { +ALIGNED8 static const Texture effect_0B002020[] = { #include "textures/effect/lava_bubble.02020.rgba16.inc.c" }; // 0x0B002820 -ALIGNED8 static const u8 effect_0B002820[] = { +ALIGNED8 static const Texture effect_0B002820[] = { #include "textures/effect/lava_bubble.02820.rgba16.inc.c" }; // 0x0B003020 -ALIGNED8 static const u8 effect_0B003020[] = { +ALIGNED8 static const Texture effect_0B003020[] = { #include "textures/effect/lava_bubble.03020.rgba16.inc.c" }; // 0x0B003820 -ALIGNED8 static const u8 effect_0B003820[] = { +ALIGNED8 static const Texture effect_0B003820[] = { #include "textures/effect/lava_bubble.03820.rgba16.inc.c" }; // 0x0B004020 -ALIGNED8 static const u8 effect_0B004020[] = { +ALIGNED8 static const Texture effect_0B004020[] = { #include "textures/effect/lava_bubble.04020.rgba16.inc.c" }; // 0x0B004820 -ALIGNED8 static const u8 effect_0B004820[] = { +ALIGNED8 static const Texture effect_0B004820[] = { #include "textures/effect/lava_bubble.04820.rgba16.inc.c" }; // 0x0B005020 -ALIGNED8 static const u8 effect_0B005020[] = { +ALIGNED8 static const Texture effect_0B005020[] = { #include "textures/effect/lava_bubble.05020.rgba16.inc.c" }; // 0x0B005820 -ALIGNED8 static const u8 effect_0B005820[] = { +ALIGNED8 static const Texture effect_0B005820[] = { #include "textures/effect/lava_bubble.05820.rgba16.inc.c" }; // 0x0B006020 -const u8 *const lava_bubble_ptr_0B006020[] = { +const Texture *const lava_bubble_ptr_0B006020[] = { effect_0B002020, effect_0B002820, effect_0B003020, @@ -93,18 +96,18 @@ const u8 *const lava_bubble_ptr_0B006020[] = { // Bubble // 0x0B006048 -ALIGNED8 static const u8 effect_0B006048[] = { +ALIGNED8 static const Texture effect_0B006048[] = { #include "textures/effect/bubble.06048.rgba16.inc.c" }; // 0x0B006848 -const u8 *const bubble_ptr_0B006848[] = { +const Texture *const bubble_ptr_0B006848[] = { effect_0B006048, }; // Tiny Bubble // 0x0B00684C -ALIGNED8 static const u8 effect_0B00684C[] = { +ALIGNED8 const Texture effect_0B00684C[] = { #include "textures/effect/tiny_bubble.0684C.rgba16.inc.c" }; @@ -134,7 +137,7 @@ const Gfx tiny_bubble_dl_0B006AB0[] = { }; // 0x0B006AD8 -ALIGNED8 static const u8 effect_0B006AD8[] = { +ALIGNED8 static const Texture effect_0B006AD8[] = { #include "textures/effect/tiny_bubble.06AD8.rgba16.inc.c" }; diff --git a/bin/fire.c b/bin/fire.c index ea0f5ec2..72e230cf 100644 --- a/bin/fire.c +++ b/bin/fire.c @@ -1,123 +1,124 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 fire_09000000[] = { +ALIGNED8 const Texture fire_09000000[] = { #include "textures/fire/lll_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 fire_09000800[] = { +ALIGNED8 const Texture fire_09000800[] = { #include "textures/fire/lll_textures.00800.rgba16.inc.c" }; // 0x09001000 -ALIGNED8 const u8 fire_09001000[] = { +ALIGNED8 const Texture fire_09001000[] = { #include "textures/fire/lll_textures.01000.rgba16.inc.c" }; // 0x09001800 -ALIGNED8 const u8 fire_09001800[] = { +ALIGNED8 const Texture fire_09001800[] = { #include "textures/fire/lll_textures.01800.rgba16.inc.c" }; // 0x09002000 -ALIGNED8 const u8 fire_09002000[] = { +ALIGNED8 const Texture fire_09002000[] = { #include "textures/fire/lll_textures.02000.rgba16.inc.c" }; // 0x09002800 -ALIGNED8 const u8 fire_09002800[] = { +ALIGNED8 const Texture fire_09002800[] = { #include "textures/fire/lll_textures.02800.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 fire_09003000[] = { +ALIGNED8 const Texture fire_09003000[] = { #include "textures/fire/lll_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 fire_09003800[] = { +ALIGNED8 const Texture fire_09003800[] = { #include "textures/fire/lll_textures.03800.rgba16.inc.c" }; // 0x09004000 -ALIGNED8 const u8 fire_09004000[] = { +ALIGNED8 const Texture fire_09004000[] = { #include "textures/fire/lll_textures.04000.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 fire_09004800[] = { +ALIGNED8 const Texture fire_09004800[] = { #include "textures/fire/lll_textures.04800.rgba16.inc.c" }; // 0x09005000 -ALIGNED8 const u8 fire_09005000[] = { +ALIGNED8 const Texture fire_09005000[] = { #include "textures/fire/lll_textures.05000.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 fire_09005800[] = { +ALIGNED8 const Texture fire_09005800[] = { #include "textures/fire/lll_textures.05800.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 fire_09006000[] = { +ALIGNED8 const Texture fire_09006000[] = { #include "textures/fire/lll_textures.06000.rgba16.inc.c" }; // 0x09006800 -ALIGNED8 const u8 fire_09006800[] = { +ALIGNED8 const Texture fire_09006800[] = { #include "textures/fire/lll_textures.06800.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 fire_09007000[] = { +ALIGNED8 const Texture fire_09007000[] = { #include "textures/fire/lll_textures.07000.rgba16.inc.c" }; // 0x09007800 -ALIGNED8 const u8 fire_09007800[] = { +ALIGNED8 const Texture fire_09007800[] = { #include "textures/fire/lll_textures.07800.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 fire_09008000[] = { +ALIGNED8 const Texture fire_09008000[] = { #include "textures/fire/lll_textures.08000.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 fire_09008800[] = { +ALIGNED8 const Texture fire_09008800[] = { #include "textures/fire/lll_textures.08800.rgba16.inc.c" }; // 0x09009000 -ALIGNED8 const u8 fire_09009000[] = { +ALIGNED8 const Texture fire_09009000[] = { #include "textures/fire/lll_textures.09000.rgba16.inc.c" }; // 0x09009800 -ALIGNED8 const u8 fire_09009800[] = { +ALIGNED8 const Texture fire_09009800[] = { #include "textures/fire/lll_textures.09800.rgba16.inc.c" }; // 0x0900A000 -ALIGNED8 const u8 fire_0900A000[] = { +ALIGNED8 const Texture fire_0900A000[] = { #include "textures/fire/lll_textures.0A000.rgba16.inc.c" }; // 0x0900A800 -ALIGNED8 const u8 fire_0900A800[] = { +ALIGNED8 const Texture fire_0900A800[] = { #include "textures/fire/lll_textures.0A800.rgba16.inc.c" }; // 0x0900B000 -ALIGNED8 const u8 fire_0900B000[] = { +ALIGNED8 const Texture fire_0900B000[] = { #include "textures/fire/lll_textures.0B000.rgba16.inc.c" }; // 0x0900B800 -ALIGNED8 const u8 fire_0900B800[] = { +ALIGNED8 const Texture fire_0900B800[] = { #include "textures/fire/lll_textures.0B800.rgba16.inc.c" }; diff --git a/bin/generic.c b/bin/generic.c index 4ce36975..c90dea6c 100644 --- a/bin/generic.c +++ b/bin/generic.c @@ -1,113 +1,114 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 generic_09000000[] = { +ALIGNED8 const Texture generic_09000000[] = { #include "textures/generic/bob_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 generic_09000800[] = { +ALIGNED8 const Texture generic_09000800[] = { #include "textures/generic/bob_textures.00800.rgba16.inc.c" }; // 0x09001000 -ALIGNED8 const u8 generic_09001000[] = { +ALIGNED8 const Texture generic_09001000[] = { #include "textures/generic/bob_textures.01000.rgba16.inc.c" }; // 0x09001800 -ALIGNED8 const u8 generic_09001800[] = { +ALIGNED8 const Texture generic_09001800[] = { #include "textures/generic/bob_textures.01800.rgba16.inc.c" }; // 0x09002000 -ALIGNED8 const u8 generic_09002000[] = { +ALIGNED8 const Texture generic_09002000[] = { #include "textures/generic/bob_textures.02000.rgba16.inc.c" }; // 0x09002800 -ALIGNED8 const u8 generic_09002800[] = { +ALIGNED8 const Texture generic_09002800[] = { #include "textures/generic/bob_textures.02800.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 generic_09003000[] = { +ALIGNED8 const Texture generic_09003000[] = { #include "textures/generic/bob_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 generic_09003800[] = { +ALIGNED8 const Texture generic_09003800[] = { #include "textures/generic/bob_textures.03800.rgba16.inc.c" }; // 0x09004000 -ALIGNED8 const u8 generic_09004000[] = { +ALIGNED8 const Texture generic_09004000[] = { #include "textures/generic/bob_textures.04000.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 generic_09004800[] = { +ALIGNED8 const Texture generic_09004800[] = { #include "textures/generic/bob_textures.04800.rgba16.inc.c" }; // 0x09005000 -ALIGNED8 const u8 generic_09005000[] = { +ALIGNED8 const Texture generic_09005000[] = { #include "textures/generic/bob_textures.05000.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 generic_09005800[] = { +ALIGNED8 const Texture generic_09005800[] = { #include "textures/generic/bob_textures.05800.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 generic_09006000[] = { +ALIGNED8 const Texture generic_09006000[] = { #include "textures/generic/bob_textures.06000.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 generic_09007000[] = { +ALIGNED8 const Texture generic_09007000[] = { #include "textures/generic/bob_textures.07000.rgba16.inc.c" }; // 0x09007800 -ALIGNED8 const u8 generic_09007800[] = { +ALIGNED8 const Texture generic_09007800[] = { #include "textures/generic/bob_textures.07800.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 generic_09008000[] = { +ALIGNED8 const Texture generic_09008000[] = { #include "textures/generic/bob_textures.08000.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 generic_09008800[] = { +ALIGNED8 const Texture generic_09008800[] = { #include "textures/generic/bob_textures.08800.rgba16.inc.c" }; // 0x09009000 -ALIGNED8 const u8 generic_09009000[] = { +ALIGNED8 const Texture generic_09009000[] = { #include "textures/generic/bob_textures.09000.rgba16.inc.c" }; // 0x09009800 -ALIGNED8 const u8 generic_09009800[] = { +ALIGNED8 const Texture generic_09009800[] = { #include "textures/generic/bob_textures.09800.rgba16.inc.c" }; // 0x0900A000 -ALIGNED8 const u8 generic_0900A000[] = { +ALIGNED8 const Texture generic_0900A000[] = { #include "textures/generic/bob_textures.0A000.rgba16.inc.c" }; // 0x0900A800 -ALIGNED8 const u8 generic_0900A800[] = { +ALIGNED8 const Texture generic_0900A800[] = { #include "textures/generic/bob_textures.0A800.rgba16.inc.c" }; // 0x0900B000 -ALIGNED8 const u8 generic_0900B000[] = { +ALIGNED8 const Texture generic_0900B000[] = { #include "textures/generic/bob_textures.0B000.ia16.inc.c" }; diff --git a/bin/grass.c b/bin/grass.c index 3df488d5..24044538 100644 --- a/bin/grass.c +++ b/bin/grass.c @@ -1,123 +1,124 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 grass_09000000[] = { +ALIGNED8 const Texture grass_09000000[] = { #include "textures/grass/wf_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 grass_09000800[] = { +ALIGNED8 const Texture grass_09000800[] = { #include "textures/grass/wf_textures.00800.rgba16.inc.c" }; // 0x09001000 -ALIGNED8 const u8 grass_09001000[] = { +ALIGNED8 const Texture grass_09001000[] = { #include "textures/grass/wf_textures.01000.rgba16.inc.c" }; // 0x09001800 -ALIGNED8 const u8 grass_09001800[] = { +ALIGNED8 const Texture grass_09001800[] = { #include "textures/grass/wf_textures.01800.rgba16.inc.c" }; // 0x09002000 -ALIGNED8 const u8 grass_09002000[] = { +ALIGNED8 const Texture grass_09002000[] = { #include "textures/grass/wf_textures.02000.rgba16.inc.c" }; // 0x09002800 -ALIGNED8 const u8 grass_09002800[] = { +ALIGNED8 const Texture grass_09002800[] = { #include "textures/grass/wf_textures.02800.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 grass_09003000[] = { +ALIGNED8 const Texture grass_09003000[] = { #include "textures/grass/wf_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 grass_09003800[] = { +ALIGNED8 const Texture grass_09003800[] = { #include "textures/grass/wf_textures.03800.rgba16.inc.c" }; // 0x09004000 -ALIGNED8 const u8 grass_09004000[] = { +ALIGNED8 const Texture grass_09004000[] = { #include "textures/grass/wf_textures.04000.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 grass_09004800[] = { +ALIGNED8 const Texture grass_09004800[] = { #include "textures/grass/wf_textures.04800.rgba16.inc.c" }; // 0x09005000 -ALIGNED8 const u8 grass_09005000[] = { +ALIGNED8 const Texture grass_09005000[] = { #include "textures/grass/wf_textures.05000.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 grass_09005800[] = { +ALIGNED8 const Texture grass_09005800[] = { #include "textures/grass/wf_textures.05800.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 grass_09006000[] = { +ALIGNED8 const Texture grass_09006000[] = { #include "textures/grass/wf_textures.06000.rgba16.inc.c" }; // 0x09006800 -ALIGNED8 const u8 grass_09006800[] = { +ALIGNED8 const Texture grass_09006800[] = { #include "textures/grass/wf_textures.06800.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 grass_09007000[] = { +ALIGNED8 const Texture grass_09007000[] = { #include "textures/grass/wf_textures.07000.rgba16.inc.c" }; // 0x09007800 -ALIGNED8 const u8 grass_09007800[] = { +ALIGNED8 const Texture grass_09007800[] = { #include "textures/grass/wf_textures.07800.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 grass_09008000[] = { +ALIGNED8 const Texture grass_09008000[] = { #include "textures/grass/wf_textures.08000.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 grass_09008800[] = { +ALIGNED8 const Texture grass_09008800[] = { #include "textures/grass/wf_textures.08800.rgba16.inc.c" }; // 0x09009000 -ALIGNED8 const u8 grass_09009000[] = { +ALIGNED8 const Texture grass_09009000[] = { #include "textures/grass/wf_textures.09000.rgba16.inc.c" }; // 0x09009800 -ALIGNED8 const u8 grass_09009800[] = { +ALIGNED8 const Texture grass_09009800[] = { #include "textures/grass/wf_textures.09800.rgba16.inc.c" }; // 0x0900A000 -ALIGNED8 const u8 grass_0900A000[] = { +ALIGNED8 const Texture grass_0900A000[] = { #include "textures/grass/wf_textures.0A000.rgba16.inc.c" }; // 0x0900A800 -ALIGNED8 const u8 grass_0900A800[] = { +ALIGNED8 const Texture grass_0900A800[] = { #include "textures/grass/wf_textures.0A800.rgba16.inc.c" }; // 0x0900B000 -ALIGNED8 const u8 grass_0900B000[] = { +ALIGNED8 const Texture grass_0900B000[] = { #include "textures/grass/wf_textures.0B000.ia16.inc.c" }; // 0x0900B800 -ALIGNED8 const u8 grass_0900B800[] = { +ALIGNED8 const Texture grass_0900B800[] = { #include "textures/grass/wf_textures.0B800.ia16.inc.c" }; diff --git a/bin/inside.c b/bin/inside.c index d668af33..5fe85a1e 100644 --- a/bin/inside.c +++ b/bin/inside.c @@ -1,88 +1,89 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 inside_09000000[] = { +ALIGNED8 const Texture inside_09000000[] = { #include "textures/inside/inside_castle_textures.00000.rgba16.inc.c" }; // 0x09001000 -ALIGNED8 const u8 inside_09001000[] = { +ALIGNED8 const Texture inside_09001000[] = { #include "textures/inside/inside_castle_textures.01000.rgba16.inc.c" }; // 0x09002000 -ALIGNED8 const u8 inside_09002000[] = { +ALIGNED8 const Texture inside_09002000[] = { #include "textures/inside/inside_castle_textures.02000.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 inside_09003000[] = { +ALIGNED8 const Texture inside_09003000[] = { #include "textures/inside/inside_castle_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 inside_09003800[] = { +ALIGNED8 const Texture inside_09003800[] = { #include "textures/inside/inside_castle_textures.03800.rgba16.inc.c" }; // 0x09004000 -ALIGNED8 const u8 inside_09004000[] = { +ALIGNED8 const Texture inside_09004000[] = { #include "textures/inside/inside_castle_textures.04000.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 inside_09004800[] = { +ALIGNED8 const Texture inside_09004800[] = { #include "textures/inside/inside_castle_textures.04800.rgba16.inc.c" }; // 0x09005000 -ALIGNED8 const u8 inside_09005000[] = { +ALIGNED8 const Texture inside_09005000[] = { #include "textures/inside/inside_castle_textures.05000.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 inside_09005800[] = { +ALIGNED8 const Texture inside_09005800[] = { #include "textures/inside/inside_castle_textures.05800.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 inside_09006000[] = { +ALIGNED8 const Texture inside_09006000[] = { #include "textures/inside/inside_castle_textures.06000.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 inside_09007000[] = { +ALIGNED8 const Texture inside_09007000[] = { #include "textures/inside/inside_castle_textures.07000.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 inside_09008000[] = { +ALIGNED8 const Texture inside_09008000[] = { #include "textures/inside/inside_castle_textures.08000.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 inside_09008800[] = { +ALIGNED8 const Texture inside_09008800[] = { #include "textures/inside/inside_castle_textures.08800.rgba16.inc.c" }; // 0x09009000 -ALIGNED8 const u8 inside_09009000[] = { +ALIGNED8 const Texture inside_09009000[] = { #include "textures/inside/inside_castle_textures.09000.rgba16.inc.c" }; // 0x0900A000 -ALIGNED8 const u8 inside_0900A000[] = { +ALIGNED8 const Texture inside_0900A000[] = { #include "textures/inside/inside_castle_textures.0A000.rgba16.inc.c" }; // 0x0900B000 -ALIGNED8 const u8 inside_0900B000[] = { +ALIGNED8 const Texture inside_0900B000[] = { #include "textures/inside/inside_castle_textures.0B000.rgba16.inc.c" }; // 0x0900B800 -ALIGNED8 const u8 inside_0900B800[] = { +ALIGNED8 const Texture inside_0900B800[] = { #include "textures/inside/inside_castle_textures.0B800.rgba16.inc.c" }; diff --git a/bin/machine.c b/bin/machine.c index 95afb459..f3f447fe 100644 --- a/bin/machine.c +++ b/bin/machine.c @@ -1,88 +1,89 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 machine_09000000[] = { +ALIGNED8 const Texture machine_09000000[] = { #include "textures/machine/ttc_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 machine_09000800[] = { +ALIGNED8 const Texture machine_09000800[] = { #include "textures/machine/ttc_textures.00800.rgba16.inc.c" }; // 0x09001000 -ALIGNED8 const u8 machine_09001000[] = { +ALIGNED8 const Texture machine_09001000[] = { #include "textures/machine/ttc_textures.01000.rgba16.inc.c" }; // 0x09001800 -ALIGNED8 const u8 machine_09001800[] = { +ALIGNED8 const Texture machine_09001800[] = { #include "textures/machine/ttc_textures.01800.rgba16.inc.c" }; // 0x09002000 -ALIGNED8 const u8 machine_09002000[] = { +ALIGNED8 const Texture machine_09002000[] = { #include "textures/machine/ttc_textures.02000.rgba16.inc.c" }; // 0x09002800 -ALIGNED8 const u8 machine_09002800[] = { +ALIGNED8 const Texture machine_09002800[] = { #include "textures/machine/ttc_textures.02800.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 machine_09003000[] = { +ALIGNED8 const Texture machine_09003000[] = { #include "textures/machine/ttc_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 machine_09003800[] = { +ALIGNED8 const Texture machine_09003800[] = { #include "textures/machine/ttc_textures.03800.rgba16.inc.c" }; // 0x09004000 -ALIGNED8 const u8 machine_09004000[] = { +ALIGNED8 const Texture machine_09004000[] = { #include "textures/machine/ttc_textures.04000.rgba16.inc.c" }; // 0x09005000 -ALIGNED8 const u8 machine_09005000[] = { +ALIGNED8 const Texture machine_09005000[] = { #include "textures/machine/ttc_textures.05000.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 machine_09005800[] = { +ALIGNED8 const Texture machine_09005800[] = { #include "textures/machine/ttc_textures.05800.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 machine_09006000[] = { +ALIGNED8 const Texture machine_09006000[] = { #include "textures/machine/ttc_textures.06000.rgba16.inc.c" }; // 0x09006800 -ALIGNED8 const u8 machine_09006800[] = { +ALIGNED8 const Texture machine_09006800[] = { #include "textures/machine/ttc_textures.06800.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 machine_09007000[] = { +ALIGNED8 const Texture machine_09007000[] = { #include "textures/machine/ttc_textures.07000.rgba16.inc.c" }; // 0x09007800 -ALIGNED8 const u8 machine_09007800[] = { +ALIGNED8 const Texture machine_09007800[] = { #include "textures/machine/ttc_textures.07800.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 machine_09008000[] = { +ALIGNED8 const Texture machine_09008000[] = { #include "textures/machine/ttc_textures.08000.rgba16.inc.c" }; // 0x09008400 -ALIGNED8 const u8 machine_09008400[] = { +ALIGNED8 const Texture machine_09008400[] = { #include "textures/machine/ttc_textures.08400.rgba16.inc.c" }; diff --git a/bin/mountain.c b/bin/mountain.c index 8a675c39..2f3ae947 100644 --- a/bin/mountain.c +++ b/bin/mountain.c @@ -1,108 +1,109 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 mountain_09000000[] = { +ALIGNED8 const Texture mountain_09000000[] = { #include "textures/mountain/ttm_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 mountain_09000800[] = { +ALIGNED8 const Texture mountain_09000800[] = { #include "textures/mountain/ttm_textures.00800.rgba16.inc.c" }; // 0x09001800 -ALIGNED8 const u8 mountain_09001800[] = { +ALIGNED8 const Texture mountain_09001800[] = { #include "textures/mountain/ttm_textures.01800.rgba16.inc.c" }; // 0x09002800 -ALIGNED8 const u8 mountain_09002800[] = { +ALIGNED8 const Texture mountain_09002800[] = { #include "textures/mountain/ttm_textures.02800.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 mountain_09003000[] = { +ALIGNED8 const Texture mountain_09003000[] = { #include "textures/mountain/ttm_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 mountain_09003800[] = { +ALIGNED8 const Texture mountain_09003800[] = { #include "textures/mountain/ttm_textures.03800.rgba16.inc.c" }; // 0x09004000 -ALIGNED8 const u8 mountain_09004000[] = { +ALIGNED8 const Texture mountain_09004000[] = { #include "textures/mountain/ttm_textures.04000.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 mountain_09004800[] = { +ALIGNED8 const Texture mountain_09004800[] = { #include "textures/mountain/ttm_textures.04800.rgba16.inc.c" }; // 0x09005000 -ALIGNED8 const u8 mountain_09005000[] = { +ALIGNED8 const Texture mountain_09005000[] = { #include "textures/mountain/ttm_textures.05000.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 mountain_09005800[] = { +ALIGNED8 const Texture mountain_09005800[] = { #include "textures/mountain/ttm_textures.05800.rgba16.inc.c" }; // 0x09006800 -ALIGNED8 const u8 mountain_09006800[] = { +ALIGNED8 const Texture mountain_09006800[] = { #include "textures/mountain/ttm_textures.06800.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 mountain_09007000[] = { +ALIGNED8 const Texture mountain_09007000[] = { #include "textures/mountain/ttm_textures.07000.rgba16.inc.c" }; // 0x09007800 -ALIGNED8 const u8 mountain_09007800[] = { +ALIGNED8 const Texture mountain_09007800[] = { #include "textures/mountain/ttm_textures.07800.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 mountain_09008000[] = { +ALIGNED8 const Texture mountain_09008000[] = { #include "textures/mountain/ttm_textures.08000.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 mountain_09008800[] = { +ALIGNED8 const Texture mountain_09008800[] = { #include "textures/mountain/ttm_textures.08800.rgba16.inc.c" }; // 0x09009800 -ALIGNED8 const u8 mountain_09009800[] = { +ALIGNED8 const Texture mountain_09009800[] = { #include "textures/mountain/ttm_textures.09800.rgba16.inc.c" }; // 0x0900A000 -ALIGNED8 const u8 mountain_0900A000[] = { +ALIGNED8 const Texture mountain_0900A000[] = { #include "textures/mountain/ttm_textures.0A000.rgba16.inc.c" }; // 0x0900A800 -ALIGNED8 const u8 mountain_0900A800[] = { +ALIGNED8 const Texture mountain_0900A800[] = { #include "textures/mountain/ttm_textures.0A800.rgba16.inc.c" }; // 0x0900B000 -ALIGNED8 const u8 mountain_0900B000[] = { +ALIGNED8 const Texture mountain_0900B000[] = { #include "textures/mountain/ttm_textures.0B000.rgba16.inc.c" }; // 0x0900B800 -ALIGNED8 const u8 mountain_0900B800[] = { +ALIGNED8 const Texture mountain_0900B800[] = { #include "textures/mountain/ttm_textures.0B800.rgba16.inc.c" }; // 0x0900C000 -ALIGNED8 const u8 mountain_0900C000[] = { +ALIGNED8 const Texture mountain_0900C000[] = { #include "textures/mountain/ttm_textures.0C000.rgba16.inc.c" }; diff --git a/bin/outside.c b/bin/outside.c index 8de85134..50cae362 100644 --- a/bin/outside.c +++ b/bin/outside.c @@ -1,109 +1,109 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 outside_09000000[] = { +ALIGNED8 const Texture outside_09000000[] = { #include "textures/outside/castle_grounds_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 outside_09000800[] = { +ALIGNED8 const Texture outside_09000800[] = { #include "textures/outside/castle_grounds_textures.00800.rgba16.inc.c" }; // 0x09001000 -ALIGNED8 const u8 outside_09001000[] = { +ALIGNED8 const Texture outside_09001000[] = { #include "textures/outside/castle_grounds_textures.01000.rgba16.inc.c" }; // 0x09002000 -ALIGNED8 const u8 outside_09002000[] = { +ALIGNED8 const Texture outside_09002000[] = { #include "textures/outside/castle_grounds_textures.02000.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 outside_09003000[] = { +ALIGNED8 const Texture outside_09003000[] = { #include "textures/outside/castle_grounds_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 outside_09003800[] = { +ALIGNED8 const Texture outside_09003800[] = { #include "textures/outside/castle_grounds_textures.03800.rgba16.inc.c" }; // 0x09004000 -ALIGNED8 const u8 outside_09004000[] = { +ALIGNED8 const Texture outside_09004000[] = { #include "textures/outside/castle_grounds_textures.04000.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 outside_09004800[] = { +ALIGNED8 const Texture outside_09004800[] = { #include "textures/outside/castle_grounds_textures.04800.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 outside_09005800[] = { +ALIGNED8 const Texture outside_09005800[] = { #include "textures/outside/castle_grounds_textures.05800.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 outside_09006000[] = { +ALIGNED8 const Texture outside_09006000[] = { #include "textures/outside/castle_grounds_textures.06000.rgba16.inc.c" }; // 0x09006800 -ALIGNED8 const u8 outside_09006800[] = { +ALIGNED8 const Texture outside_09006800[] = { #include "textures/outside/castle_grounds_textures.06800.rgba16.inc.c" }; // 0x09007800 -ALIGNED8 const u8 outside_09007800[] = { +ALIGNED8 const Texture outside_09007800[] = { #include "textures/outside/castle_grounds_textures.07800.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 outside_09008000[] = { +ALIGNED8 const Texture outside_09008000[] = { #include "textures/outside/castle_grounds_textures.08000.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 outside_09008800[] = { +ALIGNED8 const Texture outside_09008800[] = { #include "textures/outside/castle_grounds_textures.08800.rgba16.inc.c" }; // 0x09009000 -ALIGNED8 const u8 outside_09009000[] = { +ALIGNED8 const Texture outside_09009000[] = { #include "textures/outside/castle_grounds_textures.09000.rgba16.inc.c" }; // 0x09009800 -ALIGNED8 const u8 outside_09009800[] = { +ALIGNED8 const Texture outside_09009800[] = { #include "textures/outside/castle_grounds_textures.09800.rgba16.inc.c" }; // 0x0900A000 -ALIGNED8 const u8 outside_0900A000[] = { +ALIGNED8 const Texture outside_0900A000[] = { #include "textures/outside/castle_grounds_textures.0A000.rgba16.inc.c" }; // 0x0900A800 -ALIGNED8 const u8 outside_0900A800[] = { +ALIGNED8 const Texture outside_0900A800[] = { #include "textures/outside/castle_grounds_textures.0A800.rgba16.inc.c" }; // 0x0900B000 -ALIGNED8 const u8 outside_0900B000[] = { +ALIGNED8 const Texture outside_0900B000[] = { #include "textures/outside/castle_grounds_textures.0B000.rgba16.inc.c" }; // 0x0900B400 -ALIGNED8 const u8 outside_0900B400[] = { +ALIGNED8 const Texture outside_0900B400[] = { #include "textures/outside/castle_grounds_textures.0B400.rgba16.inc.c" }; // 0x0900BC00 -ALIGNED8 const u8 outside_0900BC00[] = { +ALIGNED8 const Texture outside_0900BC00[] = { #include "textures/outside/castle_grounds_textures.0BC00.ia16.inc.c" }; - diff --git a/bin/segment2.c b/bin/segment2.c index 3877dab4..11b4fe37 100644 --- a/bin/segment2.c +++ b/bin/segment2.c @@ -1,84 +1,88 @@ -#include -#include "sm64.h" +#include +#include + +#include "config.h" +#include "macros.h" +#include "types.h" #include "game/ingame_menu.h" #include "make_const_nonconst.h" -// SM64 (US/JP/EU) Segment 02 +// SM64 (US/JP/EU/SH) Segment 02 -ALIGNED8 static const u8 texture_hud_char_0[] = { +ALIGNED8 static const Texture texture_hud_char_0[] = { #include "textures/segment2/segment2.00000.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_1[] = { +ALIGNED8 static const Texture texture_hud_char_1[] = { #include "textures/segment2/segment2.00200.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_2[] = { +ALIGNED8 static const Texture texture_hud_char_2[] = { #include "textures/segment2/segment2.00400.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_3[] = { +ALIGNED8 static const Texture texture_hud_char_3[] = { #include "textures/segment2/segment2.00600.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_4[] = { +ALIGNED8 static const Texture texture_hud_char_4[] = { #include "textures/segment2/segment2.00800.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_5[] = { +ALIGNED8 static const Texture texture_hud_char_5[] = { #include "textures/segment2/segment2.00A00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_6[] = { +ALIGNED8 static const Texture texture_hud_char_6[] = { #include "textures/segment2/segment2.00C00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_7[] = { +ALIGNED8 static const Texture texture_hud_char_7[] = { #include "textures/segment2/segment2.00E00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_8[] = { +ALIGNED8 static const Texture texture_hud_char_8[] = { #include "textures/segment2/segment2.01000.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_9[] = { +ALIGNED8 static const Texture texture_hud_char_9[] = { #include "textures/segment2/segment2.01200.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_A[] = { +ALIGNED8 static const Texture texture_hud_char_A[] = { #include "textures/segment2/segment2.01400.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_B[] = { +ALIGNED8 static const Texture texture_hud_char_B[] = { #include "textures/segment2/segment2.01600.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_C[] = { +ALIGNED8 static const Texture texture_hud_char_C[] = { #include "textures/segment2/segment2.01800.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_D[] = { +ALIGNED8 static const Texture texture_hud_char_D[] = { #include "textures/segment2/segment2.01A00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_E[] = { +ALIGNED8 static const Texture texture_hud_char_E[] = { #include "textures/segment2/segment2.01C00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_F[] = { +ALIGNED8 static const Texture texture_hud_char_F[] = { #include "textures/segment2/segment2.01E00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_G[] = { +ALIGNED8 static const Texture texture_hud_char_G[] = { #include "textures/segment2/segment2.02000.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_H[] = { +ALIGNED8 static const Texture texture_hud_char_H[] = { #include "textures/segment2/segment2.02200.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_I[] = { +ALIGNED8 static const Texture texture_hud_char_I[] = { #include "textures/segment2/segment2.02400.rgba16.inc.c" }; @@ -88,1741 +92,1741 @@ ALIGNED8 static const u8 texture_hud_char_J[] = { #if defined(VERSION_JP) || defined(VERSION_SH) -ALIGNED8 static const u8 texture_hud_char_J[] = { +ALIGNED8 static const Texture texture_hud_char_J[] = { #include "textures/segment2/segment2.02600.rgba16.inc.c" }; #endif -ALIGNED8 static const u8 texture_hud_char_K[] = { +ALIGNED8 static const Texture texture_hud_char_K[] = { #include "textures/segment2/segment2.02800.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_L[] = { +ALIGNED8 static const Texture texture_hud_char_L[] = { #include "textures/segment2/segment2.02A00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_M[] = { +ALIGNED8 static const Texture texture_hud_char_M[] = { #include "textures/segment2/segment2.02C00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_N[] = { +ALIGNED8 static const Texture texture_hud_char_N[] = { #include "textures/segment2/segment2.02E00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_O[] = { +ALIGNED8 static const Texture texture_hud_char_O[] = { #include "textures/segment2/segment2.03000.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_P[] = { +ALIGNED8 static const Texture texture_hud_char_P[] = { #include "textures/segment2/segment2.03200.rgba16.inc.c" }; #if defined(VERSION_JP) || defined(VERSION_SH) -ALIGNED8 static const u8 texture_hud_char_Q[] = { +ALIGNED8 static const Texture texture_hud_char_Q[] = { #include "textures/segment2/segment2.03400.rgba16.inc.c" }; #endif -ALIGNED8 static const u8 texture_hud_char_R[] = { +ALIGNED8 static const Texture texture_hud_char_R[] = { #include "textures/segment2/segment2.03600.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_S[] = { +ALIGNED8 static const Texture texture_hud_char_S[] = { #include "textures/segment2/segment2.03800.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_T[] = { +ALIGNED8 static const Texture texture_hud_char_T[] = { #include "textures/segment2/segment2.03A00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_U[] = { +ALIGNED8 static const Texture texture_hud_char_U[] = { #include "textures/segment2/segment2.03C00.rgba16.inc.c" }; #if defined(VERSION_JP) || defined(VERSION_EU) || defined(VERSION_SH) -ALIGNED8 static const u8 texture_hud_char_V[] = { +ALIGNED8 static const Texture texture_hud_char_V[] = { #include "textures/segment2/segment2.03E00.rgba16.inc.c" }; #endif -ALIGNED8 static const u8 texture_hud_char_W[] = { +ALIGNED8 static const Texture texture_hud_char_W[] = { #include "textures/segment2/segment2.04000.rgba16.inc.c" }; #if defined(VERSION_JP) || defined(VERSION_SH) -ALIGNED8 static const u8 texture_hud_char_X[] = { +ALIGNED8 static const Texture texture_hud_char_X[] = { #include "textures/segment2/segment2.04200.rgba16.inc.c" }; #endif -ALIGNED8 static const u8 texture_hud_char_Y[] = { +ALIGNED8 static const Texture texture_hud_char_Y[] = { #include "textures/segment2/segment2.04400.rgba16.inc.c" }; #if defined(VERSION_JP) || defined(VERSION_EU) || defined(VERSION_SH) -ALIGNED8 static const u8 texture_hud_char_Z[] = { +ALIGNED8 static const Texture texture_hud_char_Z[] = { #include "textures/segment2/segment2.04600.rgba16.inc.c" }; #endif -ALIGNED8 static const u8 texture_hud_char_apostrophe[] = { +ALIGNED8 static const Texture texture_hud_char_apostrophe[] = { #include "textures/segment2/segment2.04800.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_hud_char_double_quote[] = { +ALIGNED8 static const Texture texture_hud_char_double_quote[] = { #include "textures/segment2/segment2.04A00.rgba16.inc.c" }; #ifdef VERSION_EU -ALIGNED8 static const u8 texture_hud_char_umlaut[] = { +ALIGNED8 static const Texture texture_hud_char_umlaut[] = { #include "textures/segment2/segment2.umlaut.rgba16.inc.c"// EU ¨ }; #endif #if defined(VERSION_JP) || defined(VERSION_SH) -ALIGNED8 static const u8 texture_hud_char_exclamation[] = { +ALIGNED8 static const Texture texture_hud_char_exclamation[] = { #include "textures/segment2/segment2.04C00.rgba16.inc.c"// JP ! }; -ALIGNED8 static const u8 texture_hud_char_double_exclamation[] = { +ALIGNED8 static const Texture texture_hud_char_double_exclamation[] = { #include "textures/segment2/segment2.04E00.rgba16.inc.c"// JP !! }; -ALIGNED8 static const u8 texture_hud_char_question[] = { +ALIGNED8 static const Texture texture_hud_char_question[] = { #include "textures/segment2/segment2.05000.rgba16.inc.c"// JP ? }; -ALIGNED8 static const u8 texture_hud_char_ampersand[] = { +ALIGNED8 static const Texture texture_hud_char_ampersand[] = { #include "textures/segment2/segment2.05200.rgba16.inc.c"// JP & }; -ALIGNED8 static const u8 texture_hud_char_percent[] = { +ALIGNED8 static const Texture texture_hud_char_percent[] = { #include "textures/segment2/segment2.05400.rgba16.inc.c"// JP % }; #endif -ALIGNED8 static const u8 texture_hud_char_multiply[] = { +ALIGNED8 static const Texture texture_hud_char_multiply[] = { #include "textures/segment2/segment2.05600.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_coin[] = { +ALIGNED8 const Texture texture_hud_char_coin[] = { #include "textures/segment2/segment2.05800.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_mario_head[] = { +ALIGNED8 const Texture texture_hud_char_mario_head[] = { #include "textures/segment2/segment2.05A00.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_luigi_head[] = { +ALIGNED8 const Texture texture_hud_char_luigi_head[] = { #include "textures/segment2/custom_luigi_head.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_toad_head[] = { +ALIGNED8 const Texture texture_hud_char_toad_head[] = { #include "textures/segment2/custom_toad_head.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_waluigi_head[] = { +ALIGNED8 const Texture texture_hud_char_waluigi_head[] = { #include "textures/segment2/custom_waluigi_head.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_wario_head[] = { +ALIGNED8 const Texture texture_hud_char_wario_head[] = { #include "textures/segment2/custom_wario_head.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_star[] = { +ALIGNED8 const Texture texture_hud_char_star[] = { #include "textures/segment2/segment2.05C00.rgba16.inc.c" }; #if defined(VERSION_JP) || defined(VERSION_SH) -ALIGNED8 static const u8 texture_hud_char_decimal_point[] = { +ALIGNED8 static const Texture texture_hud_char_decimal_point[] = { #include "textures/segment2/segment2.05E00.rgba16.inc.c" }; #endif #if defined(VERSION_JP) || defined(VERSION_SH) -ALIGNED8 static const u8 texture_hud_char_beta_key[] = { +ALIGNED8 static const Texture texture_hud_char_beta_key[] = { #include "textures/segment2/segment2.06000.rgba16.inc.c" }; #endif -ALIGNED8 static const u8 texture_credits_char_3[] = { +ALIGNED8 static const Texture texture_credits_char_3[] = { #include "textures/segment2/segment2.06200.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_4[] = { +ALIGNED8 static const Texture texture_credits_char_4[] = { #include "textures/segment2/segment2.06280.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_6[] = { +ALIGNED8 static const Texture texture_credits_char_6[] = { #include "textures/segment2/segment2.06300.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_A[] = { +ALIGNED8 static const Texture texture_credits_char_A[] = { #include "textures/segment2/segment2.06380.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_B[] = { +ALIGNED8 static const Texture texture_credits_char_B[] = { #include "textures/segment2/segment2.06400.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_C[] = { +ALIGNED8 static const Texture texture_credits_char_C[] = { #include "textures/segment2/segment2.06480.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_D[] = { +ALIGNED8 static const Texture texture_credits_char_D[] = { #include "textures/segment2/segment2.06500.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_E[] = { +ALIGNED8 static const Texture texture_credits_char_E[] = { #include "textures/segment2/segment2.06580.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_F[] = { +ALIGNED8 static const Texture texture_credits_char_F[] = { #include "textures/segment2/segment2.06600.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_G[] = { +ALIGNED8 static const Texture texture_credits_char_G[] = { #include "textures/segment2/segment2.06680.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_H[] = { +ALIGNED8 static const Texture texture_credits_char_H[] = { #include "textures/segment2/segment2.06700.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_I[] = { +ALIGNED8 static const Texture texture_credits_char_I[] = { #include "textures/segment2/segment2.06780.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_J[] = { +ALIGNED8 static const Texture texture_credits_char_J[] = { #include "textures/segment2/segment2.06800.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_K[] = { +ALIGNED8 static const Texture texture_credits_char_K[] = { #include "textures/segment2/segment2.06880.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_L[] = { +ALIGNED8 static const Texture texture_credits_char_L[] = { #include "textures/segment2/segment2.06900.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_M[] = { +ALIGNED8 static const Texture texture_credits_char_M[] = { #include "textures/segment2/segment2.06980.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_N[] = { +ALIGNED8 static const Texture texture_credits_char_N[] = { #include "textures/segment2/segment2.06A00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_O[] = { +ALIGNED8 static const Texture texture_credits_char_O[] = { #include "textures/segment2/segment2.06A80.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_P[] = { +ALIGNED8 static const Texture texture_credits_char_P[] = { #include "textures/segment2/segment2.06B00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_Q[] = { +ALIGNED8 static const Texture texture_credits_char_Q[] = { #include "textures/segment2/segment2.06B80.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_R[] = { +ALIGNED8 static const Texture texture_credits_char_R[] = { #include "textures/segment2/segment2.06C00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_S[] = { +ALIGNED8 static const Texture texture_credits_char_S[] = { #include "textures/segment2/segment2.06C80.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_T[] = { +ALIGNED8 static const Texture texture_credits_char_T[] = { #include "textures/segment2/segment2.06D00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_U[] = { +ALIGNED8 static const Texture texture_credits_char_U[] = { #include "textures/segment2/segment2.06D80.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_V[] = { +ALIGNED8 static const Texture texture_credits_char_V[] = { #include "textures/segment2/segment2.06E00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_W[] = { +ALIGNED8 static const Texture texture_credits_char_W[] = { #include "textures/segment2/segment2.06E80.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_X[] = { +ALIGNED8 static const Texture texture_credits_char_X[] = { #include "textures/segment2/segment2.06F00.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_Y[] = { +ALIGNED8 static const Texture texture_credits_char_Y[] = { #include "textures/segment2/segment2.06F80.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_Z[] = { +ALIGNED8 static const Texture texture_credits_char_Z[] = { #include "textures/segment2/segment2.07000.rgba16.inc.c" }; -ALIGNED8 static const u8 texture_credits_char_period[] = { +ALIGNED8 static const Texture texture_credits_char_period[] = { #include "textures/segment2/segment2.07080.rgba16.inc.c" }; // JP Small Font #if defined(VERSION_JP) || defined(VERSION_SH) -ALIGNED8 static const u8 texture_font_char_jp_0[] = { +ALIGNED8 static const Texture texture_font_char_jp_0[] = { #include "textures/segment2/segment2.07100.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_1[] = { +ALIGNED8 static const Texture texture_font_char_jp_1[] = { #include "textures/segment2/segment2.07110.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_2[] = { +ALIGNED8 static const Texture texture_font_char_jp_2[] = { #include "textures/segment2/segment2.07120.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_3[] = { +ALIGNED8 static const Texture texture_font_char_jp_3[] = { #include "textures/segment2/segment2.07130.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_4[] = { +ALIGNED8 static const Texture texture_font_char_jp_4[] = { #include "textures/segment2/segment2.07140.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_5[] = { +ALIGNED8 static const Texture texture_font_char_jp_5[] = { #include "textures/segment2/segment2.07150.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_6[] = { +ALIGNED8 static const Texture texture_font_char_jp_6[] = { #include "textures/segment2/segment2.07160.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_7[] = { +ALIGNED8 static const Texture texture_font_char_jp_7[] = { #include "textures/segment2/segment2.07170.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_8[] = { +ALIGNED8 static const Texture texture_font_char_jp_8[] = { #include "textures/segment2/segment2.07180.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_9[] = { +ALIGNED8 static const Texture texture_font_char_jp_9[] = { #include "textures/segment2/segment2.07190.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_A[] = { +ALIGNED8 static const Texture texture_font_char_jp_A[] = { #include "textures/segment2/segment2.071A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_B[] = { +ALIGNED8 static const Texture texture_font_char_jp_B[] = { #include "textures/segment2/segment2.071B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_C[] = { +ALIGNED8 static const Texture texture_font_char_jp_C[] = { #include "textures/segment2/segment2.071C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_D[] = { +ALIGNED8 static const Texture texture_font_char_jp_D[] = { #include "textures/segment2/segment2.071D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_E[] = { +ALIGNED8 static const Texture texture_font_char_jp_E[] = { #include "textures/segment2/segment2.071E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_F[] = { +ALIGNED8 static const Texture texture_font_char_jp_F[] = { #include "textures/segment2/segment2.071F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_G[] = { +ALIGNED8 static const Texture texture_font_char_jp_G[] = { #include "textures/segment2/segment2.07200.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_H[] = { +ALIGNED8 static const Texture texture_font_char_jp_H[] = { #include "textures/segment2/segment2.07210.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_I[] = { +ALIGNED8 static const Texture texture_font_char_jp_I[] = { #include "textures/segment2/segment2.07220.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_J[] = { +ALIGNED8 static const Texture texture_font_char_jp_J[] = { #include "textures/segment2/segment2.07230.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_K[] = { +ALIGNED8 static const Texture texture_font_char_jp_K[] = { #include "textures/segment2/segment2.07240.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_L[] = { +ALIGNED8 static const Texture texture_font_char_jp_L[] = { #include "textures/segment2/segment2.07250.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_M[] = { +ALIGNED8 static const Texture texture_font_char_jp_M[] = { #include "textures/segment2/segment2.07260.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_N[] = { +ALIGNED8 static const Texture texture_font_char_jp_N[] = { #include "textures/segment2/segment2.07270.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_O[] = { +ALIGNED8 static const Texture texture_font_char_jp_O[] = { #include "textures/segment2/segment2.07280.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_P[] = { +ALIGNED8 static const Texture texture_font_char_jp_P[] = { #include "textures/segment2/segment2.07290.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_Q[] = { +ALIGNED8 static const Texture texture_font_char_jp_Q[] = { #include "textures/segment2/segment2.072A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_R[] = { +ALIGNED8 static const Texture texture_font_char_jp_R[] = { #include "textures/segment2/segment2.072B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_S[] = { +ALIGNED8 static const Texture texture_font_char_jp_S[] = { #include "textures/segment2/segment2.072C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_T[] = { +ALIGNED8 static const Texture texture_font_char_jp_T[] = { #include "textures/segment2/segment2.072D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_U[] = { +ALIGNED8 static const Texture texture_font_char_jp_U[] = { #include "textures/segment2/segment2.072E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_V[] = { +ALIGNED8 static const Texture texture_font_char_jp_V[] = { #include "textures/segment2/segment2.072F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_W[] = { +ALIGNED8 static const Texture texture_font_char_jp_W[] = { #include "textures/segment2/segment2.07300.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_X[] = { +ALIGNED8 static const Texture texture_font_char_jp_X[] = { #include "textures/segment2/segment2.07310.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_Y[] = { +ALIGNED8 static const Texture texture_font_char_jp_Y[] = { #include "textures/segment2/segment2.07320.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_Z[] = { +ALIGNED8 static const Texture texture_font_char_jp_Z[] = { #include "textures/segment2/segment2.07330.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_long_vowel[] = { +ALIGNED8 static const Texture texture_font_char_jp_long_vowel[] = { #include "textures/segment2/segment2.07340.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_exclamation[] = { +ALIGNED8 static const Texture texture_font_char_jp_exclamation[] = { #include "textures/segment2/segment2.07350.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_dakuten[] = { +ALIGNED8 static const Texture texture_font_char_jp_dakuten[] = { #include "textures/segment2/segment2.07360.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_handakuten[] = { +ALIGNED8 static const Texture texture_font_char_jp_handakuten[] = { #include "textures/segment2/segment2.07370.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_percent[] = { +ALIGNED8 static const Texture texture_font_char_jp_percent[] = { #include "textures/segment2/segment2.07380.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_question[] = { +ALIGNED8 static const Texture texture_font_char_jp_question[] = { #include "textures/segment2/segment2.07390.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_left_right_arrow[] = { +ALIGNED8 static const Texture texture_font_char_jp_left_right_arrow[] = { #include "textures/segment2/segment2.073A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_open_parentheses[] = { +ALIGNED8 static const Texture texture_font_char_jp_open_parentheses[] = { #include "textures/segment2/segment2.073B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_close_open_parentheses[] = { +ALIGNED8 static const Texture texture_font_char_jp_close_open_parentheses[] = { #include "textures/segment2/segment2.073C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_close_parentheses[] = { +ALIGNED8 static const Texture texture_font_char_jp_close_parentheses[] = { #include "textures/segment2/segment2.073D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_coin[] = { +ALIGNED8 static const Texture texture_font_char_jp_coin[] = { #include "textures/segment2/segment2.073E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_multiply[] = { +ALIGNED8 static const Texture texture_font_char_jp_multiply[] = { #include "textures/segment2/segment2.073F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_star_filled[] = { +ALIGNED8 static const Texture texture_font_char_jp_star_filled[] = { #include "textures/segment2/segment2.07400.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_star_hollow[] = { +ALIGNED8 static const Texture texture_font_char_jp_star_hollow[] = { #include "textures/segment2/segment2.07410.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_a[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_a[] = { #include "textures/segment2/segment2.07420.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_i[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_i[] = { #include "textures/segment2/segment2.07430.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_u[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_u[] = { #include "textures/segment2/segment2.07440.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_c[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_c[] = { #include "textures/segment2/segment2.07450.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_o[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_o[] = { #include "textures/segment2/segment2.07460.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ka[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ka[] = { #include "textures/segment2/segment2.07470.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ki[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ki[] = { #include "textures/segment2/segment2.07480.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ku[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ku[] = { #include "textures/segment2/segment2.07490.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ke[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ke[] = { #include "textures/segment2/segment2.074A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ko[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ko[] = { #include "textures/segment2/segment2.074B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_sa[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_sa[] = { #include "textures/segment2/segment2.074C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_shi[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_shi[] = { #include "textures/segment2/segment2.074D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_su[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_su[] = { #include "textures/segment2/segment2.074E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_se[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_se[] = { #include "textures/segment2/segment2.074F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_so[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_so[] = { #include "textures/segment2/segment2.07500.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ta[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ta[] = { #include "textures/segment2/segment2.07510.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_chi[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_chi[] = { #include "textures/segment2/segment2.07520.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_tsu[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_tsu[] = { #include "textures/segment2/segment2.07530.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_te[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_te[] = { #include "textures/segment2/segment2.07540.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_to[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_to[] = { #include "textures/segment2/segment2.07550.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_na[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_na[] = { #include "textures/segment2/segment2.07560.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ni[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ni[] = { #include "textures/segment2/segment2.07570.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_nu[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_nu[] = { #include "textures/segment2/segment2.07580.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ne[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ne[] = { #include "textures/segment2/segment2.07590.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_no[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_no[] = { #include "textures/segment2/segment2.075A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ha[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ha[] = { #include "textures/segment2/segment2.075B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_hi[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_hi[] = { #include "textures/segment2/segment2.075C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_hu[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_hu[] = { #include "textures/segment2/segment2.075D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_he[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_he[] = { #include "textures/segment2/segment2.075E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ho[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ho[] = { #include "textures/segment2/segment2.075F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ma[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ma[] = { #include "textures/segment2/segment2.07600.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_mi[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_mi[] = { #include "textures/segment2/segment2.07610.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_mu[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_mu[] = { #include "textures/segment2/segment2.07620.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_me[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_me[] = { #include "textures/segment2/segment2.07630.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_mo[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_mo[] = { #include "textures/segment2/segment2.07640.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ya[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ya[] = { #include "textures/segment2/segment2.07650.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_yu[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_yu[] = { #include "textures/segment2/segment2.07660.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_yo[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_yo[] = { #include "textures/segment2/segment2.07670.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ra[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ra[] = { #include "textures/segment2/segment2.07680.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ri[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ri[] = { #include "textures/segment2/segment2.07690.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ru[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ru[] = { #include "textures/segment2/segment2.076A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_re[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_re[] = { #include "textures/segment2/segment2.076B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_ro[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_ro[] = { #include "textures/segment2/segment2.076C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_wa[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_wa[] = { #include "textures/segment2/segment2.076D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_wo[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_wo[] = { #include "textures/segment2/segment2.076E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_n[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_n[] = { #include "textures/segment2/segment2.076F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_small_e[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_small_e[] = { #include "textures/segment2/segment2.07700.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_small_tsu[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_small_tsu[] = { #include "textures/segment2/segment2.07710.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_small_ya[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_small_ya[] = { #include "textures/segment2/segment2.07720.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_small_yu[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_small_yu[] = { #include "textures/segment2/segment2.07730.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_small_yo[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_small_yo[] = { #include "textures/segment2/segment2.07740.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_small_a[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_small_a[] = { #include "textures/segment2/segment2.07750.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_small_i[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_small_i[] = { #include "textures/segment2/segment2.07760.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_small_o[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_small_o[] = { #include "textures/segment2/segment2.07770.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_hiragana_small_u[] = { +ALIGNED8 static const Texture texture_font_char_jp_hiragana_small_u[] = { #include "textures/segment2/segment2.07780.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_interpunct[] = { +ALIGNED8 static const Texture texture_font_char_jp_interpunct[] = { #include "textures/segment2/segment2.07790.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_comma[] = { +ALIGNED8 static const Texture texture_font_char_jp_comma[] = { #include "textures/segment2/segment2.077A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_a[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_a[] = { #include "textures/segment2/segment2.077B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_i[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_i[] = { #include "textures/segment2/segment2.077C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_u[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_u[] = { #include "textures/segment2/segment2.077D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_e[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_e[] = { #include "textures/segment2/segment2.077E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_o[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_o[] = { #include "textures/segment2/segment2.077F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ka[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ka[] = { #include "textures/segment2/segment2.07800.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ki[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ki[] = { #include "textures/segment2/segment2.07810.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ku[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ku[] = { #include "textures/segment2/segment2.07820.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ke[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ke[] = { #include "textures/segment2/segment2.07830.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ko[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ko[] = { #include "textures/segment2/segment2.07840.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_sa[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_sa[] = { #include "textures/segment2/segment2.07850.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_shi[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_shi[] = { #include "textures/segment2/segment2.07860.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_su[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_su[] = { #include "textures/segment2/segment2.07870.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_se[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_se[] = { #include "textures/segment2/segment2.07880.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_so[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_so[] = { #include "textures/segment2/segment2.07890.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ta[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ta[] = { #include "textures/segment2/segment2.078A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_chi[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_chi[] = { #include "textures/segment2/segment2.078B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_tsu[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_tsu[] = { #include "textures/segment2/segment2.078C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_te[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_te[] = { #include "textures/segment2/segment2.078D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_to[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_to[] = { #include "textures/segment2/segment2.078E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_na[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_na[] = { #include "textures/segment2/segment2.078F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ni[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ni[] = { #include "textures/segment2/segment2.07900.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_nu[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_nu[] = { #include "textures/segment2/segment2.07910.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ne[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ne[] = { #include "textures/segment2/segment2.07920.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_no[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_no[] = { #include "textures/segment2/segment2.07930.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ha[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ha[] = { #include "textures/segment2/segment2.07940.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_hi[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_hi[] = { #include "textures/segment2/segment2.07950.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_hu[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_hu[] = { #include "textures/segment2/segment2.07960.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_he[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_he[] = { #include "textures/segment2/segment2.07970.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ho[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ho[] = { #include "textures/segment2/segment2.07980.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ma[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ma[] = { #include "textures/segment2/segment2.07990.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_mi[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_mi[] = { #include "textures/segment2/segment2.079A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_mu[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_mu[] = { #include "textures/segment2/segment2.079B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_me[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_me[] = { #include "textures/segment2/segment2.079C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_mo[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_mo[] = { #include "textures/segment2/segment2.079D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ya[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ya[] = { #include "textures/segment2/segment2.079E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_yu[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_yu[] = { #include "textures/segment2/segment2.079F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_yo[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_yo[] = { #include "textures/segment2/segment2.07A00.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ra[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ra[] = { #include "textures/segment2/segment2.07A10.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ri[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ri[] = { #include "textures/segment2/segment2.07A20.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ru[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ru[] = { #include "textures/segment2/segment2.07A30.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_re[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_re[] = { #include "textures/segment2/segment2.07A40.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_ro[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_ro[] = { #include "textures/segment2/segment2.07A50.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_wa[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_wa[] = { #include "textures/segment2/segment2.07A60.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_n[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_n[] = { #include "textures/segment2/segment2.07A70.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_small_e[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_small_e[] = { #include "textures/segment2/segment2.07A80.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_small_tsu[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_small_tsu[] = { #include "textures/segment2/segment2.07A90.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_small_ya[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_small_ya[] = { #include "textures/segment2/segment2.07AA0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_small_yu[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_small_yu[] = { #include "textures/segment2/segment2.07AB0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_small_yo[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_small_yo[] = { #include "textures/segment2/segment2.07AC0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_small_a[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_small_a[] = { #include "textures/segment2/segment2.07AD0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_small_i[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_small_i[] = { #include "textures/segment2/segment2.07AE0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_small_u[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_small_u[] = { #include "textures/segment2/segment2.07AF0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_katakana_small_o[] = { +ALIGNED8 static const Texture texture_font_char_jp_katakana_small_o[] = { #include "textures/segment2/segment2.07B00.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_double_quotation_open[] = { +ALIGNED8 static const Texture texture_font_char_jp_double_quotation_open[] = { #include "textures/segment2/segment2.07B10.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_double_quotation_close[] = { +ALIGNED8 static const Texture texture_font_char_jp_double_quotation_close[] = { #include "textures/segment2/segment2.07B20.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_wave_dash[] = { +ALIGNED8 static const Texture texture_font_char_jp_wave_dash[] = { #include "textures/segment2/segment2.07B30.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_jp_ellipsis[] = { +ALIGNED8 static const Texture texture_font_char_jp_ellipsis[] = { #include "textures/segment2/segment2.07B40.ia1.inc.c" }; // EU Small Font #elif defined(VERSION_EU) -ALIGNED8 static const u8 texture_font_char_eu_0[] = { +ALIGNED8 static const Texture texture_font_char_eu_0[] = { #include "textures/segment2/font_graphics.05F00.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_1[] = { +ALIGNED8 static const Texture texture_font_char_eu_1[] = { #include "textures/segment2/font_graphics.05F10.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_2[] = { +ALIGNED8 static const Texture texture_font_char_eu_2[] = { #include "textures/segment2/font_graphics.05F20.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_3[] = { +ALIGNED8 static const Texture texture_font_char_eu_3[] = { #include "textures/segment2/font_graphics.05F30.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_4[] = { +ALIGNED8 static const Texture texture_font_char_eu_4[] = { #include "textures/segment2/font_graphics.05F40.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_5[] = { +ALIGNED8 static const Texture texture_font_char_eu_5[] = { #include "textures/segment2/font_graphics.05F50.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_6[] = { +ALIGNED8 static const Texture texture_font_char_eu_6[] = { #include "textures/segment2/font_graphics.05F60.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_7[] = { +ALIGNED8 static const Texture texture_font_char_eu_7[] = { #include "textures/segment2/font_graphics.05F70.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_8[] = { +ALIGNED8 static const Texture texture_font_char_eu_8[] = { #include "textures/segment2/font_graphics.05F80.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_9[] = { +ALIGNED8 static const Texture texture_font_char_eu_9[] = { #include "textures/segment2/font_graphics.05F90.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_A[] = { +ALIGNED8 static const Texture texture_font_char_eu_A[] = { #include "textures/segment2/font_graphics.05FA0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_B[] = { +ALIGNED8 static const Texture texture_font_char_eu_B[] = { #include "textures/segment2/font_graphics.05FB0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_C[] = { +ALIGNED8 static const Texture texture_font_char_eu_C[] = { #include "textures/segment2/font_graphics.05FC0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_D[] = { +ALIGNED8 static const Texture texture_font_char_eu_D[] = { #include "textures/segment2/font_graphics.05FD0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_E[] = { +ALIGNED8 static const Texture texture_font_char_eu_E[] = { #include "textures/segment2/font_graphics.05FE0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_F[] = { +ALIGNED8 static const Texture texture_font_char_eu_F[] = { #include "textures/segment2/font_graphics.05FF0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_G[] = { +ALIGNED8 static const Texture texture_font_char_eu_G[] = { #include "textures/segment2/font_graphics.06000.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_H[] = { +ALIGNED8 static const Texture texture_font_char_eu_H[] = { #include "textures/segment2/font_graphics.06010.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_I[] = { +ALIGNED8 static const Texture texture_font_char_eu_I[] = { #include "textures/segment2/font_graphics.06020.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_J[] = { +ALIGNED8 static const Texture texture_font_char_eu_J[] = { #include "textures/segment2/font_graphics.06030.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_K[] = { +ALIGNED8 static const Texture texture_font_char_eu_K[] = { #include "textures/segment2/font_graphics.06040.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_L[] = { +ALIGNED8 static const Texture texture_font_char_eu_L[] = { #include "textures/segment2/font_graphics.06050.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_M[] = { +ALIGNED8 static const Texture texture_font_char_eu_M[] = { #include "textures/segment2/font_graphics.06060.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_N[] = { +ALIGNED8 static const Texture texture_font_char_eu_N[] = { #include "textures/segment2/font_graphics.06070.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_O[] = { +ALIGNED8 static const Texture texture_font_char_eu_O[] = { #include "textures/segment2/font_graphics.06080.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_P[] = { +ALIGNED8 static const Texture texture_font_char_eu_P[] = { #include "textures/segment2/font_graphics.06090.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_Q[] = { +ALIGNED8 static const Texture texture_font_char_eu_Q[] = { #include "textures/segment2/font_graphics.060A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_R[] = { +ALIGNED8 static const Texture texture_font_char_eu_R[] = { #include "textures/segment2/font_graphics.060B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_S[] = { +ALIGNED8 static const Texture texture_font_char_eu_S[] = { #include "textures/segment2/font_graphics.060C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_T[] = { +ALIGNED8 static const Texture texture_font_char_eu_T[] = { #include "textures/segment2/font_graphics.060D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_U[] = { +ALIGNED8 static const Texture texture_font_char_eu_U[] = { #include "textures/segment2/font_graphics.060E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_V[] = { +ALIGNED8 static const Texture texture_font_char_eu_V[] = { #include "textures/segment2/font_graphics.060F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_W[] = { +ALIGNED8 static const Texture texture_font_char_eu_W[] = { #include "textures/segment2/font_graphics.06100.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_X[] = { +ALIGNED8 static const Texture texture_font_char_eu_X[] = { #include "textures/segment2/font_graphics.06110.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_Y[] = { +ALIGNED8 static const Texture texture_font_char_eu_Y[] = { #include "textures/segment2/font_graphics.06120.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_Z[] = { +ALIGNED8 static const Texture texture_font_char_eu_Z[] = { #include "textures/segment2/font_graphics.06130.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_a[] = { +ALIGNED8 static const Texture texture_font_char_eu_a[] = { #include "textures/segment2/font_graphics.06140.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_b[] = { +ALIGNED8 static const Texture texture_font_char_eu_b[] = { #include "textures/segment2/font_graphics.06150.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_c[] = { +ALIGNED8 static const Texture texture_font_char_eu_c[] = { #include "textures/segment2/font_graphics.06160.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_d[] = { +ALIGNED8 static const Texture texture_font_char_eu_d[] = { #include "textures/segment2/font_graphics.06170.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_e[] = { +ALIGNED8 static const Texture texture_font_char_eu_e[] = { #include "textures/segment2/font_graphics.06180.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_f[] = { +ALIGNED8 static const Texture texture_font_char_eu_f[] = { #include "textures/segment2/font_graphics.06190.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_g[] = { +ALIGNED8 static const Texture texture_font_char_eu_g[] = { #include "textures/segment2/font_graphics.061A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_h[] = { +ALIGNED8 static const Texture texture_font_char_eu_h[] = { #include "textures/segment2/font_graphics.061B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_i[] = { +ALIGNED8 static const Texture texture_font_char_eu_i[] = { #include "textures/segment2/font_graphics.061C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_j[] = { +ALIGNED8 static const Texture texture_font_char_eu_j[] = { #include "textures/segment2/font_graphics.061D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_k[] = { +ALIGNED8 static const Texture texture_font_char_eu_k[] = { #include "textures/segment2/font_graphics.061E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_l[] = { +ALIGNED8 static const Texture texture_font_char_eu_l[] = { #include "textures/segment2/font_graphics.061F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_m[] = { +ALIGNED8 static const Texture texture_font_char_eu_m[] = { #include "textures/segment2/font_graphics.06200.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_n[] = { +ALIGNED8 static const Texture texture_font_char_eu_n[] = { #include "textures/segment2/font_graphics.06210.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_o[] = { +ALIGNED8 static const Texture texture_font_char_eu_o[] = { #include "textures/segment2/font_graphics.06220.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_p[] = { +ALIGNED8 static const Texture texture_font_char_eu_p[] = { #include "textures/segment2/font_graphics.06230.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_q[] = { +ALIGNED8 static const Texture texture_font_char_eu_q[] = { #include "textures/segment2/font_graphics.06240.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_r[] = { +ALIGNED8 static const Texture texture_font_char_eu_r[] = { #include "textures/segment2/font_graphics.06250.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_s[] = { +ALIGNED8 static const Texture texture_font_char_eu_s[] = { #include "textures/segment2/font_graphics.06260.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_t[] = { +ALIGNED8 static const Texture texture_font_char_eu_t[] = { #include "textures/segment2/font_graphics.06270.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_u[] = { +ALIGNED8 static const Texture texture_font_char_eu_u[] = { #include "textures/segment2/font_graphics.06280.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_v[] = { +ALIGNED8 static const Texture texture_font_char_eu_v[] = { #include "textures/segment2/font_graphics.06290.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_w[] = { +ALIGNED8 static const Texture texture_font_char_eu_w[] = { #include "textures/segment2/font_graphics.062A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_x[] = { +ALIGNED8 static const Texture texture_font_char_eu_x[] = { #include "textures/segment2/font_graphics.062B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_y[] = { +ALIGNED8 static const Texture texture_font_char_eu_y[] = { #include "textures/segment2/font_graphics.062C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_z[] = { +ALIGNED8 static const Texture texture_font_char_eu_z[] = { #include "textures/segment2/font_graphics.062D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_left_right_arrow[] = { +ALIGNED8 static const Texture texture_font_char_eu_left_right_arrow[] = { #include "textures/segment2/font_graphics.062E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_ampersand[] = { +ALIGNED8 static const Texture texture_font_char_eu_ampersand[] = { #include "textures/segment2/font_graphics.062F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_exclamation[] = { +ALIGNED8 static const Texture texture_font_char_eu_exclamation[] = { #include "textures/segment2/font_graphics.06300.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_coin[] = { +ALIGNED8 static const Texture texture_font_char_eu_coin[] = { #include "textures/segment2/font_graphics.06310.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_multiply[] = { +ALIGNED8 static const Texture texture_font_char_eu_multiply[] = { #include "textures/segment2/font_graphics.06320.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_open_parentheses[] = { +ALIGNED8 static const Texture texture_font_char_eu_open_parentheses[] = { #include "textures/segment2/font_graphics.06330.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_close_open_parentheses[] = { +ALIGNED8 static const Texture texture_font_char_eu_close_open_parentheses[] = { #include "textures/segment2/font_graphics.06340.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_close_parentheses[] = { +ALIGNED8 static const Texture texture_font_char_eu_close_parentheses[] = { #include "textures/segment2/font_graphics.06350.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_tilde[] = { +ALIGNED8 static const Texture texture_font_char_eu_tilde[] = { #include "textures/segment2/font_graphics.06360.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_period[] = { +ALIGNED8 static const Texture texture_font_char_eu_period[] = { #include "textures/segment2/font_graphics.06370.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_percent[] = { +ALIGNED8 static const Texture texture_font_char_eu_percent[] = { #include "textures/segment2/font_graphics.06380.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_interpunct[] = { +ALIGNED8 static const Texture texture_font_char_eu_interpunct[] = { #include "textures/segment2/font_graphics.06390.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_comma[] = { +ALIGNED8 static const Texture texture_font_char_eu_comma[] = { #include "textures/segment2/font_graphics.063A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_apostrophe[] = { +ALIGNED8 static const Texture texture_font_char_eu_apostrophe[] = { #include "textures/segment2/font_graphics.063B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_question[] = { +ALIGNED8 static const Texture texture_font_char_eu_question[] = { #include "textures/segment2/font_graphics.063C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_star_filled[] = { +ALIGNED8 static const Texture texture_font_char_eu_star_filled[] = { #include "textures/segment2/font_graphics.063D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_star_hollow[] = { +ALIGNED8 static const Texture texture_font_char_eu_star_hollow[] = { #include "textures/segment2/font_graphics.063E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_double_quote_open[] = { +ALIGNED8 static const Texture texture_font_char_eu_double_quote_open[] = { #include "textures/segment2/font_graphics.063F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_double_quote_close[] = { +ALIGNED8 static const Texture texture_font_char_eu_double_quote_close[] = { #include "textures/segment2/font_graphics.06400.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_colon[] = { +ALIGNED8 static const Texture texture_font_char_eu_colon[] = { #include "textures/segment2/font_graphics.06410.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_EU_slash[] = { +ALIGNED8 static const Texture texture_font_char_EU_slash[] = { #include "textures/segment2/font_graphics.06420.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_button_A[] = { +ALIGNED8 static const Texture texture_font_char_eu_button_A[] = { #include "textures/segment2/font_graphics.06430.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_button_B[] = { +ALIGNED8 static const Texture texture_font_char_eu_button_B[] = { #include "textures/segment2/font_graphics.06440.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_button_C[] = { +ALIGNED8 static const Texture texture_font_char_eu_button_C[] = { #include "textures/segment2/font_graphics.06450.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_button_Z[] = { +ALIGNED8 static const Texture texture_font_char_eu_button_Z[] = { #include "textures/segment2/font_graphics.06460.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_button_R[] = { +ALIGNED8 static const Texture texture_font_char_eu_button_R[] = { #include "textures/segment2/font_graphics.06470.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_button_C_up[] = { +ALIGNED8 static const Texture texture_font_char_eu_button_C_up[] = { #include "textures/segment2/font_graphics.06480.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_button_C_down[] = { +ALIGNED8 static const Texture texture_font_char_eu_button_C_down[] = { #include "textures/segment2/font_graphics.06490.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_button_C_left[] = { +ALIGNED8 static const Texture texture_font_char_eu_button_C_left[] = { #include "textures/segment2/font_graphics.064A0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_button_C_right[] = { +ALIGNED8 static const Texture texture_font_char_eu_button_C_right[] = { #include "textures/segment2/font_graphics.064B0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_umlaut[] = { +ALIGNED8 static const Texture texture_font_char_eu_umlaut[] = { #include "textures/segment2/font_graphics.064C0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_circumflex[] = { +ALIGNED8 static const Texture texture_font_char_eu_circumflex[] = { #include "textures/segment2/font_graphics.064D0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_grave[] = { +ALIGNED8 static const Texture texture_font_char_eu_grave[] = { #include "textures/segment2/font_graphics.064E0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_acute[] = { +ALIGNED8 static const Texture texture_font_char_eu_acute[] = { #include "textures/segment2/font_graphics.064F0.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_cedilla[] = { +ALIGNED8 static const Texture texture_font_char_eu_cedilla[] = { #include "textures/segment2/font_graphics.06500.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_unknown[] = { +ALIGNED8 static const Texture texture_font_char_eu_unknown[] = { #include "textures/segment2/font_graphics.06510.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_Cedilla[] = { +ALIGNED8 static const Texture texture_font_char_eu_Cedilla[] = { #include "textures/segment2/font_graphics.06520.ia1.inc.c" }; -ALIGNED8 static const u8 texture_font_char_eu_eszeet[] = { +ALIGNED8 static const Texture texture_font_char_eu_eszeet[] = { #include "textures/segment2/font_graphics.06530.ia1.inc.c" }; // US Small Font #else -ALIGNED8 static const u8 texture_font_char_us_0[] = { +ALIGNED8 static const Texture texture_font_char_us_0[] = { #include "textures/segment2/font_graphics.05900.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_1[] = { +ALIGNED8 static const Texture texture_font_char_us_1[] = { #include "textures/segment2/font_graphics.05940.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_2[] = { +ALIGNED8 static const Texture texture_font_char_us_2[] = { #include "textures/segment2/font_graphics.05980.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_3[] = { +ALIGNED8 static const Texture texture_font_char_us_3[] = { #include "textures/segment2/font_graphics.059C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_4[] = { +ALIGNED8 static const Texture texture_font_char_us_4[] = { #include "textures/segment2/font_graphics.05A00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_5[] = { +ALIGNED8 static const Texture texture_font_char_us_5[] = { #include "textures/segment2/font_graphics.05A40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_6[] = { +ALIGNED8 static const Texture texture_font_char_us_6[] = { #include "textures/segment2/font_graphics.05A80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_7[] = { +ALIGNED8 static const Texture texture_font_char_us_7[] = { #include "textures/segment2/font_graphics.05AC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_8[] = { +ALIGNED8 static const Texture texture_font_char_us_8[] = { #include "textures/segment2/font_graphics.05B00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_9[] = { +ALIGNED8 static const Texture texture_font_char_us_9[] = { #include "textures/segment2/font_graphics.05B40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_A[] = { +ALIGNED8 static const Texture texture_font_char_us_A[] = { #include "textures/segment2/font_graphics.05B80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_B[] = { +ALIGNED8 static const Texture texture_font_char_us_B[] = { #include "textures/segment2/font_graphics.05BC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_C[] = { +ALIGNED8 static const Texture texture_font_char_us_C[] = { #include "textures/segment2/font_graphics.05C00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_D[] = { +ALIGNED8 static const Texture texture_font_char_us_D[] = { #include "textures/segment2/font_graphics.05C40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_E[] = { +ALIGNED8 static const Texture texture_font_char_us_E[] = { #include "textures/segment2/font_graphics.05C80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_F[] = { +ALIGNED8 static const Texture texture_font_char_us_F[] = { #include "textures/segment2/font_graphics.05CC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_G[] = { +ALIGNED8 static const Texture texture_font_char_us_G[] = { #include "textures/segment2/font_graphics.05D00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_H[] = { +ALIGNED8 static const Texture texture_font_char_us_H[] = { #include "textures/segment2/font_graphics.05D40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_I[] = { +ALIGNED8 static const Texture texture_font_char_us_I[] = { #include "textures/segment2/font_graphics.05D80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_J[] = { +ALIGNED8 static const Texture texture_font_char_us_J[] = { #include "textures/segment2/font_graphics.05DC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_K[] = { +ALIGNED8 static const Texture texture_font_char_us_K[] = { #include "textures/segment2/font_graphics.05E00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_L[] = { +ALIGNED8 static const Texture texture_font_char_us_L[] = { #include "textures/segment2/font_graphics.05E40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_M[] = { +ALIGNED8 static const Texture texture_font_char_us_M[] = { #include "textures/segment2/font_graphics.05E80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_N[] = { +ALIGNED8 static const Texture texture_font_char_us_N[] = { #include "textures/segment2/font_graphics.05EC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_O[] = { +ALIGNED8 static const Texture texture_font_char_us_O[] = { #include "textures/segment2/font_graphics.05F00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_P[] = { +ALIGNED8 static const Texture texture_font_char_us_P[] = { #include "textures/segment2/font_graphics.05F40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_Q[] = { +ALIGNED8 static const Texture texture_font_char_us_Q[] = { #include "textures/segment2/font_graphics.05F80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_R[] = { +ALIGNED8 static const Texture texture_font_char_us_R[] = { #include "textures/segment2/font_graphics.05FC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_S[] = { +ALIGNED8 static const Texture texture_font_char_us_S[] = { #include "textures/segment2/font_graphics.06000.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_T[] = { +ALIGNED8 static const Texture texture_font_char_us_T[] = { #include "textures/segment2/font_graphics.06040.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_U[] = { +ALIGNED8 static const Texture texture_font_char_us_U[] = { #include "textures/segment2/font_graphics.06080.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_V[] = { +ALIGNED8 static const Texture texture_font_char_us_V[] = { #include "textures/segment2/font_graphics.060C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_W[] = { +ALIGNED8 static const Texture texture_font_char_us_W[] = { #include "textures/segment2/font_graphics.06100.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_X[] = { +ALIGNED8 static const Texture texture_font_char_us_X[] = { #include "textures/segment2/font_graphics.06140.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_Y[] = { +ALIGNED8 static const Texture texture_font_char_us_Y[] = { #include "textures/segment2/font_graphics.06180.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_Z[] = { +ALIGNED8 static const Texture texture_font_char_us_Z[] = { #include "textures/segment2/font_graphics.061C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_a[] = { +ALIGNED8 static const Texture texture_font_char_us_a[] = { #include "textures/segment2/font_graphics.06200.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_b[] = { +ALIGNED8 static const Texture texture_font_char_us_b[] = { #include "textures/segment2/font_graphics.06240.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_c[] = { +ALIGNED8 static const Texture texture_font_char_us_c[] = { #include "textures/segment2/font_graphics.06280.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_d[] = { +ALIGNED8 static const Texture texture_font_char_us_d[] = { #include "textures/segment2/font_graphics.062C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_e[] = { +ALIGNED8 static const Texture texture_font_char_us_e[] = { #include "textures/segment2/font_graphics.06300.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_f[] = { +ALIGNED8 static const Texture texture_font_char_us_f[] = { #include "textures/segment2/font_graphics.06340.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_g[] = { +ALIGNED8 static const Texture texture_font_char_us_g[] = { #include "textures/segment2/font_graphics.06380.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_h[] = { +ALIGNED8 static const Texture texture_font_char_us_h[] = { #include "textures/segment2/font_graphics.063C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_i[] = { +ALIGNED8 static const Texture texture_font_char_us_i[] = { #include "textures/segment2/font_graphics.06400.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_j[] = { +ALIGNED8 static const Texture texture_font_char_us_j[] = { #include "textures/segment2/font_graphics.06440.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_k[] = { +ALIGNED8 static const Texture texture_font_char_us_k[] = { #include "textures/segment2/font_graphics.06480.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_l[] = { +ALIGNED8 static const Texture texture_font_char_us_l[] = { #include "textures/segment2/font_graphics.064C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_m[] = { +ALIGNED8 static const Texture texture_font_char_us_m[] = { #include "textures/segment2/font_graphics.06500.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_n[] = { +ALIGNED8 static const Texture texture_font_char_us_n[] = { #include "textures/segment2/font_graphics.06540.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_o[] = { +ALIGNED8 static const Texture texture_font_char_us_o[] = { #include "textures/segment2/font_graphics.06580.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_p[] = { +ALIGNED8 static const Texture texture_font_char_us_p[] = { #include "textures/segment2/font_graphics.065C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_q[] = { +ALIGNED8 static const Texture texture_font_char_us_q[] = { #include "textures/segment2/font_graphics.06600.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_r[] = { +ALIGNED8 static const Texture texture_font_char_us_r[] = { #include "textures/segment2/font_graphics.06640.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_s[] = { +ALIGNED8 static const Texture texture_font_char_us_s[] = { #include "textures/segment2/font_graphics.06680.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_t[] = { +ALIGNED8 static const Texture texture_font_char_us_t[] = { #include "textures/segment2/font_graphics.066C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_u[] = { +ALIGNED8 static const Texture texture_font_char_us_u[] = { #include "textures/segment2/font_graphics.06700.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_v[] = { +ALIGNED8 static const Texture texture_font_char_us_v[] = { #include "textures/segment2/font_graphics.06740.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_w[] = { +ALIGNED8 static const Texture texture_font_char_us_w[] = { #include "textures/segment2/font_graphics.06780.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_x[] = { +ALIGNED8 static const Texture texture_font_char_us_x[] = { #include "textures/segment2/font_graphics.067C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_y[] = { +ALIGNED8 static const Texture texture_font_char_us_y[] = { #include "textures/segment2/font_graphics.06800.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_z[] = { +ALIGNED8 static const Texture texture_font_char_us_z[] = { #include "textures/segment2/font_graphics.06840.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_left_right_arrow[] = { +ALIGNED8 static const Texture texture_font_char_us_left_right_arrow[] = { #include "textures/segment2/font_graphics.06880.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_exclamation[] = { +ALIGNED8 static const Texture texture_font_char_us_exclamation[] = { #include "textures/segment2/font_graphics.068C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_coin[] = { +ALIGNED8 static const Texture texture_font_char_us_coin[] = { #include "textures/segment2/font_graphics.06900.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_multiply[] = { +ALIGNED8 static const Texture texture_font_char_us_multiply[] = { #include "textures/segment2/font_graphics.06940.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_open_parentheses[] = { +ALIGNED8 static const Texture texture_font_char_us_open_parentheses[] = { #include "textures/segment2/font_graphics.06980.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_close_open_parentheses[] = { +ALIGNED8 static const Texture texture_font_char_us_close_open_parentheses[] = { #include "textures/segment2/font_graphics.069C0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_close_parentheses[] = { +ALIGNED8 static const Texture texture_font_char_us_close_parentheses[] = { #include "textures/segment2/font_graphics.06A00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_tilde[] = { +ALIGNED8 static const Texture texture_font_char_us_tilde[] = { #include "textures/segment2/font_graphics.06A40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_period[] = { +ALIGNED8 static const Texture texture_font_char_us_period[] = { #include "textures/segment2/font_graphics.06A80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_percent[] = { +ALIGNED8 static const Texture texture_font_char_us_percent[] = { #include "textures/segment2/font_graphics.06AC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_interpunct[] = { +ALIGNED8 static const Texture texture_font_char_us_interpunct[] = { #include "textures/segment2/font_graphics.06B00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_comma[] = { +ALIGNED8 static const Texture texture_font_char_us_comma[] = { #include "textures/segment2/font_graphics.06B40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_apostrophe[] = { +ALIGNED8 static const Texture texture_font_char_us_apostrophe[] = { #include "textures/segment2/font_graphics.06B80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_question[] = { +ALIGNED8 static const Texture texture_font_char_us_question[] = { #include "textures/segment2/font_graphics.06BC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_star_filled[] = { +ALIGNED8 static const Texture texture_font_char_us_star_filled[] = { #include "textures/segment2/font_graphics.06C00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_star_hollow[] = { +ALIGNED8 static const Texture texture_font_char_us_star_hollow[] = { #include "textures/segment2/font_graphics.06C40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_double_quote_open[] = { +ALIGNED8 static const Texture texture_font_char_us_double_quote_open[] = { #include "textures/segment2/font_graphics.06C80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_double_quote_close[] = { +ALIGNED8 static const Texture texture_font_char_us_double_quote_close[] = { #include "textures/segment2/font_graphics.06CC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_ellipsis[] = { +ALIGNED8 static const Texture texture_font_char_us_ellipsis[] = { #include "textures/segment2/font_graphics.06D00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_slash[] = { +ALIGNED8 static const Texture texture_font_char_us_slash[] = { #include "textures/segment2/font_graphics.06D40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_ampersand[] = { +ALIGNED8 static const Texture texture_font_char_us_ampersand[] = { #include "textures/segment2/font_graphics.06D80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_button_A[] = { +ALIGNED8 static const Texture texture_font_char_us_button_A[] = { #include "textures/segment2/font_graphics.06DC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_button_B[] = { +ALIGNED8 static const Texture texture_font_char_us_button_B[] = { #include "textures/segment2/font_graphics.06E00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_button_C[] = { +ALIGNED8 static const Texture texture_font_char_us_button_C[] = { #include "textures/segment2/font_graphics.06E40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_button_Z[] = { +ALIGNED8 static const Texture texture_font_char_us_button_Z[] = { #include "textures/segment2/font_graphics.06E80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_button_R[] = { +ALIGNED8 static const Texture texture_font_char_us_button_R[] = { #include "textures/segment2/font_graphics.06EC0.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_button_C_up[] = { +ALIGNED8 static const Texture texture_font_char_us_button_C_up[] = { #include "textures/segment2/font_graphics.06F00.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_button_C_down[] = { +ALIGNED8 static const Texture texture_font_char_us_button_C_down[] = { #include "textures/segment2/font_graphics.06F40.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_button_C_left[] = { +ALIGNED8 static const Texture texture_font_char_us_button_C_left[] = { #include "textures/segment2/font_graphics.06F80.ia4.inc.c" }; -ALIGNED8 static const u8 texture_font_char_us_button_C_right[] = { +ALIGNED8 static const Texture texture_font_char_us_button_C_right[] = { #include "textures/segment2/font_graphics.06FC0.ia4.inc.c" }; #endif -ALIGNED8 const u8 texture_hud_char_camera[] = { +ALIGNED8 const Texture texture_hud_char_camera[] = { #include "textures/segment2/segment2.07B50.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_lakitu[] = { +ALIGNED8 const Texture texture_hud_char_lakitu[] = { #include "textures/segment2/segment2.07D50.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_no_camera[] = { +ALIGNED8 const Texture texture_hud_char_no_camera[] = { #include "textures/segment2/segment2.07F50.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_arrow_up[] = { +ALIGNED8 const Texture texture_hud_char_arrow_up[] = { #include "textures/segment2/segment2.08150.rgba16.inc.c" }; -ALIGNED8 const u8 texture_hud_char_arrow_down[] = { +ALIGNED8 const Texture texture_hud_char_arrow_down[] = { #include "textures/segment2/segment2.081D0.rgba16.inc.c" }; // Main HUD print table 0x02008250-0x02008337 -const u8 *const main_hud_lut[] = { +const Texture *const main_hud_lut[] = { #ifdef VERSION_EU texture_hud_char_0, texture_hud_char_1, texture_hud_char_2, texture_hud_char_3, texture_hud_char_4, texture_hud_char_5, texture_hud_char_6, texture_hud_char_7, @@ -1875,7 +1879,7 @@ const u8 *const main_hud_lut[] = { }; // Main small font print table 0x02008338-0x02008737 -const u8 *const main_font_lut[] = { +const Texture *const main_font_lut[] = { #ifdef VERSION_EU // EU Font Table texture_font_char_eu_0, texture_font_char_eu_1, texture_font_char_eu_2, texture_font_char_eu_3, texture_font_char_eu_4, texture_font_char_eu_5, texture_font_char_eu_6, texture_font_char_eu_7, @@ -2077,7 +2081,7 @@ const u8 *const main_font_lut[] = { }; // credits font LUT 0x02008738-0x020087CB -const u8 *const main_credits_font_lut[] = { +const Texture *const main_credits_font_lut[] = { 0x0, 0x0, 0x0, texture_credits_char_3, texture_credits_char_4, 0x0, texture_credits_char_6, 0x0, 0x0, 0x0, texture_credits_char_A, texture_credits_char_B, @@ -2091,7 +2095,7 @@ const u8 *const main_credits_font_lut[] = { }; // HUD camera table 0x020087CC-0x020087E3 -const u8 *const main_hud_camera_lut[] = { +const Texture *const main_hud_camera_lut[] = { texture_hud_char_camera, texture_hud_char_mario_head, texture_hud_char_lakitu, texture_hud_char_no_camera, texture_hud_char_arrow_up, texture_hud_char_arrow_down, texture_hud_char_luigi_head, texture_hud_char_toad_head, texture_hud_char_waluigi_head, texture_hud_char_wario_head, @@ -2115,10 +2119,12 @@ const Gfx dl_hud_img_begin[] = { gsDPSetTexturePersp(G_TP_NONE), gsDPSetAlphaCompare(G_AC_THRESHOLD), gsDPSetBlendColor(255, 255, 255, 255), -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) gsDPSetRenderMode(G_RM_NOOP, G_RM_NOOP2), +#endif +#ifdef VERSION_EU gsDPSetTextureFilter(G_TF_POINT), -#else +#elif defined(VERSION_JP) || defined(VERSION_US) gsDPSetRenderMode(G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2), #endif gsSPEndDisplayList(), @@ -2142,9 +2148,9 @@ const Gfx dl_hud_img_end[] = { gsDPSetAlphaCompare(G_AC_NONE), #ifdef VERSION_EU gsDPSetTextureFilter(G_TF_BILERP), +#endif gsDPSetCycleType(G_CYC_1CYCLE), -#else - gsDPSetCycleType(G_CYC_1CYCLE), +#if defined(VERSION_JP) || defined(VERSION_US) gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF), #endif gsSPEndDisplayList(), @@ -2205,16 +2211,16 @@ const Gfx dl_draw_text_bg_box[] = { #ifndef VERSION_EU // 0x0200EE28 - 0x0200EE68 static const Vtx vertex_ia8_char[] = { -#ifndef VERSION_JP - {{{ 0, 0, 0}, 0, { 0, 256}, {0xff, 0xff, 0xff, 0xff}}}, - {{{ 8, 0, 0}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}}, - {{{ 8, 16, 0}, 0, { 480, 0}, {0xff, 0xff, 0xff, 0xff}}}, - {{{ 0, 16, 0}, 0, { 480, 256}, {0xff, 0xff, 0xff, 0xff}}}, -#else +#if defined(VERSION_JP) || defined(VERSION_SH) {{{ 0, 0, 0}, 0, { 0, 1024}, {0xff, 0xff, 0xff, 0xff}}}, {{{ 8, 0, 0}, 0, { 512, 1024}, {0xff, 0xff, 0xff, 0xff}}}, {{{ 8, 16, 0}, 0, { 512, 0}, {0xff, 0xff, 0xff, 0xff}}}, {{{ 0, 16, 0}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}}, +#else + {{{ 0, 0, 0}, 0, { 0, 256}, {0xff, 0xff, 0xff, 0xff}}}, + {{{ 8, 0, 0}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}}, + {{{ 8, 16, 0}, 0, { 480, 0}, {0xff, 0xff, 0xff, 0xff}}}, + {{{ 0, 16, 0}, 0, { 480, 256}, {0xff, 0xff, 0xff, 0xff}}}, #endif }; // !EU @@ -2469,47 +2475,47 @@ const Gfx dl_billboard_num_9[] = { gsSPEndDisplayList(), }; -ALIGNED8 static const u8 texture_shadow_quarter_circle[] = { +ALIGNED8 static const Texture texture_shadow_quarter_circle[] = { #include "textures/segment2/shadow_quarter_circle.ia8.inc.c" }; -ALIGNED8 static const u8 texture_shadow_quarter_square[] = { +ALIGNED8 static const Texture texture_shadow_quarter_square[] = { #include "textures/segment2/shadow_quarter_square.ia8.inc.c" }; -ALIGNED8 const u8 texture_transition_star_half[] = { +const Texture texture_transition_star_half[] = { #include "textures/segment2/segment2.0F458.ia8.inc.c" }; -ALIGNED8 const u8 texture_transition_circle_half[] = { +const Texture texture_transition_circle_half[] = { #include "textures/segment2/segment2.0FC58.ia8.inc.c" }; -ALIGNED8 const u8 texture_transition_mario[] = { +const Texture texture_transition_mario[] = { #include "textures/segment2/segment2.10458.ia8.inc.c" }; -ALIGNED8 const u8 texture_transition_bowser_half[] = { +const Texture texture_transition_bowser_half[] = { #include "textures/segment2/segment2.11458.ia8.inc.c" }; -ALIGNED8 const u8 texture_waterbox_water[] = { +const Texture texture_waterbox_water[] = { #include "textures/segment2/segment2.11C58.rgba16.inc.c" }; -ALIGNED8 const u8 texture_waterbox_jrb_water[] = { +const Texture texture_waterbox_jrb_water[] = { #include "textures/segment2/segment2.12458.rgba16.inc.c" }; -ALIGNED8 const u8 texture_waterbox_unknown_water[] = { +const Texture texture_waterbox_unknown_water[] = { #include "textures/segment2/segment2.12C58.rgba16.inc.c" }; -ALIGNED8 const u8 texture_waterbox_mist[] = { +const Texture texture_waterbox_mist[] = { #include "textures/segment2/segment2.13458.ia16.inc.c" }; -ALIGNED8 const u8 texture_waterbox_lava[] = { +const Texture texture_waterbox_lava[] = { #include "textures/segment2/segment2.13C58.rgba16.inc.c" }; @@ -2685,7 +2691,7 @@ const Gfx dl_waterbox_end[] = { }; // 0x02014838 - 0x02014878 -ALIGNED8 static const u8 texture_ia8_up_arrow[] = { +ALIGNED8 static const Texture texture_ia8_up_arrow[] = { #include "textures/segment2/segment2.14838.ia8.inc.c" }; diff --git a/bin/sky.c b/bin/sky.c index 861f7765..48c07830 100644 --- a/bin/sky.c +++ b/bin/sky.c @@ -1,77 +1,78 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 sky_09000000[] = { +ALIGNED8 const Texture sky_09000000[] = { #include "textures/sky/rr_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 sky_09000800[] = { +ALIGNED8 const Texture sky_09000800[] = { #include "textures/sky/rr_textures.00800.rgba16.inc.c" }; // 0x09001000 -ALIGNED8 const u8 sky_09001000[] = { +ALIGNED8 const Texture sky_09001000[] = { #include "textures/sky/rr_textures.01000.rgba16.inc.c" }; // 0x09001800 -ALIGNED8 const u8 sky_09001800[] = { +ALIGNED8 const Texture sky_09001800[] = { #include "textures/sky/rr_textures.01800.rgba16.inc.c" }; // 0x09002000 -ALIGNED8 const u8 sky_09002000[] = { +ALIGNED8 const Texture sky_09002000[] = { #include "textures/sky/rr_textures.02000.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 sky_09003000[] = { +ALIGNED8 const Texture sky_09003000[] = { #include "textures/sky/rr_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 sky_09003800[] = { +ALIGNED8 const Texture sky_09003800[] = { #include "textures/sky/rr_textures.03800.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 sky_09004800[] = { +ALIGNED8 const Texture sky_09004800[] = { #include "textures/sky/rr_textures.04800.rgba16.inc.c" }; // 0x09005000 -ALIGNED8 const u8 sky_09005000[] = { +ALIGNED8 const Texture sky_09005000[] = { #include "textures/sky/rr_textures.05000.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 sky_09005800[] = { +ALIGNED8 const Texture sky_09005800[] = { #include "textures/sky/rr_textures.05800.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 sky_09006000[] = { +ALIGNED8 const Texture sky_09006000[] = { #include "textures/sky/rr_textures.06000.rgba16.inc.c" }; -ALIGNED8 const u8 texture_metal_hole[] = { +ALIGNED8 const Texture texture_metal_hole[] = { #include "textures/sky/metal_hole.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 sky_09007000[] = { +ALIGNED8 const Texture sky_09007000[] = { #include "textures/sky/rr_textures.07000.rgba16.inc.c" }; // 0x09007800 -ALIGNED8 const u8 sky_09007800[] = { +ALIGNED8 const Texture sky_09007800[] = { #include "textures/sky/rr_textures.07800.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 sky_09008000[] = { +ALIGNED8 const Texture sky_09008000[] = { #include "textures/sky/rr_textures.08000.rgba16.inc.c" }; diff --git a/bin/snow.c b/bin/snow.c index 5e8999f7..f89ebe0c 100644 --- a/bin/snow.c +++ b/bin/snow.c @@ -1,93 +1,94 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 snow_09000000[] = { +ALIGNED8 const Texture snow_09000000[] = { #include "textures/snow/ccm_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 snow_09000800[] = { +ALIGNED8 const Texture snow_09000800[] = { #include "textures/snow/ccm_textures.00800.rgba16.inc.c" }; // 0x09001000 -ALIGNED8 const u8 snow_09001000[] = { +ALIGNED8 const Texture snow_09001000[] = { #include "textures/snow/ccm_textures.01000.rgba16.inc.c" }; // 0x09002000 -ALIGNED8 const u8 snow_09002000[] = { +ALIGNED8 const Texture snow_09002000[] = { #include "textures/snow/ccm_textures.02000.rgba16.inc.c" }; // 0x09002800 -ALIGNED8 const u8 snow_09002800[] = { +ALIGNED8 const Texture snow_09002800[] = { #include "textures/snow/ccm_textures.02800.rgba16.inc.c" }; // 0x09003000 -ALIGNED8 const u8 snow_09003000[] = { +ALIGNED8 const Texture snow_09003000[] = { #include "textures/snow/ccm_textures.03000.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 snow_09003800[] = { +ALIGNED8 const Texture snow_09003800[] = { #include "textures/snow/ccm_textures.03800.rgba16.inc.c" }; // 0x09004000 -ALIGNED8 const u8 snow_09004000[] = { +ALIGNED8 const Texture snow_09004000[] = { #include "textures/snow/ccm_textures.04000.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 snow_09004800[] = { +ALIGNED8 const Texture snow_09004800[] = { #include "textures/snow/ccm_textures.04800.rgba16.inc.c" }; // 0x09005000 -ALIGNED8 const u8 snow_09005000[] = { +ALIGNED8 const Texture snow_09005000[] = { #include "textures/snow/ccm_textures.05000.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 snow_09005800[] = { +ALIGNED8 const Texture snow_09005800[] = { #include "textures/snow/ccm_textures.05800.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 snow_09006000[] = { +ALIGNED8 const Texture snow_09006000[] = { #include "textures/snow/ccm_textures.06000.rgba16.inc.c" }; // 0x09006800 -ALIGNED8 const u8 snow_09006800[] = { +ALIGNED8 const Texture snow_09006800[] = { #include "textures/snow/ccm_textures.06800.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 snow_09007000[] = { +ALIGNED8 const Texture snow_09007000[] = { #include "textures/snow/ccm_textures.07000.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 snow_09008000[] = { +ALIGNED8 const Texture snow_09008000[] = { #include "textures/snow/ccm_textures.08000.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 snow_09008800[] = { +ALIGNED8 const Texture snow_09008800[] = { #include "textures/snow/ccm_textures.08800.rgba16.inc.c" }; // 0x09009000 -ALIGNED8 const u8 snow_09009000[] = { +ALIGNED8 const Texture snow_09009000[] = { #include "textures/snow/ccm_textures.09000.ia16.inc.c" }; // 0x09009800 -ALIGNED8 const u8 snow_09009800[] = { +ALIGNED8 const Texture snow_09009800[] = { #include "textures/snow/ccm_textures.09800.ia16.inc.c" }; diff --git a/bin/spooky.c b/bin/spooky.c index 391519ef..c8616703 100644 --- a/bin/spooky.c +++ b/bin/spooky.c @@ -1,89 +1,90 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 spooky_09000000[] = { +ALIGNED8 const Texture spooky_09000000[] = { #include "textures/spooky/bbh_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 spooky_09000800[] = { +ALIGNED8 const Texture spooky_09000800[] = { #include "textures/spooky/bbh_textures.00800.rgba16.inc.c" }; // 0x09001800 -ALIGNED8 const u8 spooky_09001800[] = { +ALIGNED8 const Texture spooky_09001800[] = { #include "textures/spooky/bbh_textures.01800.rgba16.inc.c" }; // 0x09002800 -ALIGNED8 const u8 spooky_09002800[] = { +ALIGNED8 const Texture spooky_09002800[] = { #include "textures/spooky/bbh_textures.02800.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 spooky_09003800[] = { +ALIGNED8 const Texture spooky_09003800[] = { #include "textures/spooky/bbh_textures.03800.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 spooky_09004800[] = { +ALIGNED8 const Texture spooky_09004800[] = { #include "textures/spooky/bbh_textures.04800.rgba16.inc.c" }; // 0x09005000 -ALIGNED8 const u8 spooky_09005000[] = { +ALIGNED8 const Texture spooky_09005000[] = { #include "textures/spooky/bbh_textures.05000.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 spooky_09006000[] = { +ALIGNED8 const Texture spooky_09006000[] = { #include "textures/spooky/bbh_textures.06000.rgba16.inc.c" }; // 0x09006800 -ALIGNED8 const u8 spooky_09006800[] = { +ALIGNED8 const Texture spooky_09006800[] = { #include "textures/spooky/bbh_textures.06800.rgba16.inc.c" }; // 0x09007000 -ALIGNED8 const u8 spooky_09007000[] = { +ALIGNED8 const Texture spooky_09007000[] = { #include "textures/spooky/bbh_textures.07000.rgba16.inc.c" }; // 0x09008000 -ALIGNED8 const u8 spooky_09008000[] = { +ALIGNED8 const Texture spooky_09008000[] = { #include "textures/spooky/bbh_textures.08000.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 spooky_09008800[] = { +ALIGNED8 const Texture spooky_09008800[] = { #include "textures/spooky/bbh_textures.08800.rgba16.inc.c" }; // 0x09009000 -ALIGNED8 const u8 spooky_09009000[] = { +ALIGNED8 const Texture spooky_09009000[] = { #include "textures/spooky/bbh_textures.09000.rgba16.inc.c" }; // 0x0900A000 -ALIGNED8 const u8 spooky_0900A000[] = { +ALIGNED8 const Texture spooky_0900A000[] = { #include "textures/spooky/bbh_textures.0A000.rgba16.inc.c" }; // 0x0900A800 -ALIGNED8 const u8 spooky_0900A800[] = { +ALIGNED8 const Texture spooky_0900A800[] = { #include "textures/spooky/bbh_textures.0A800.ia16.inc.c" }; // 0x0900B000 -ALIGNED8 const u8 spooky_0900B000[] = { +ALIGNED8 const Texture spooky_0900B000[] = { #include "textures/spooky/bbh_textures.0B000.ia16.inc.c" }; // 0x0900B800 -ALIGNED8 const u8 spooky_0900B800[] = { +ALIGNED8 const Texture spooky_0900B800[] = { #include "textures/spooky/bbh_textures.0B800.ia16.inc.c" }; diff --git a/bin/title_screen_bg.c b/bin/title_screen_bg.c index e63233ab..d6deb092 100644 --- a/bin/title_screen_bg.c +++ b/bin/title_screen_bg.c @@ -72,53 +72,94 @@ const Gfx title_screen_bg_dl_0A000190[] = { }; // 0x0A0001C0 -ALIGNED8 static const u8 title_texture_0A0001C0[] = { +ALIGNED8 static const Texture title_texture_0A0001C0[] = { #include "textures/title_screen_bg/title_screen_bg.001C0.rgba16.inc.c" }; // 0x0A000E40 -ALIGNED8 static const u8 title_texture_0A000E40[] = { +ALIGNED8 static const Texture title_texture_0A000E40[] = { #include "textures/title_screen_bg/title_screen_bg.00E40.rgba16.inc.c" }; // 0x0A001AC0 -ALIGNED8 static const u8 title_texture_0A001AC0[] = { +ALIGNED8 static const Texture title_texture_0A001AC0[] = { #include "textures/title_screen_bg/title_screen_bg.01AC0.rgba16.inc.c" }; // 0x0A002740 -ALIGNED8 static const u8 title_texture_0A002740[] = { +ALIGNED8 static const Texture title_texture_0A002740[] = { #include "textures/title_screen_bg/title_screen_bg.02740.rgba16.inc.c" }; // 0x0A0033C0 -ALIGNED8 static const u8 title_texture_0A0033C0[] = { +ALIGNED8 static const Texture title_texture_0A0033C0[] = { #include "textures/title_screen_bg/title_screen_bg.033C0.rgba16.inc.c" }; // 0x0A004040 -ALIGNED8 static const u8 title_texture_0A004040[] = { +ALIGNED8 static const Texture title_texture_0A004040[] = { #include "textures/title_screen_bg/title_screen_bg.04040.rgba16.inc.c" }; // 0x0A004CC0 -ALIGNED8 static const u8 title_texture_0A004CC0[] = { +ALIGNED8 static const Texture title_texture_0A004CC0[] = { #include "textures/title_screen_bg/title_screen_bg.04CC0.rgba16.inc.c" }; // 0x0A005940 -ALIGNED8 static const u8 title_texture_0A005940[] = { +ALIGNED8 static const Texture title_texture_0A005940[] = { #include "textures/title_screen_bg/title_screen_bg.05940.rgba16.inc.c" }; // 0x0A0065C0 -const u8 *const mario_title_texture_table[] = { +const Texture *const mario_title_texture_table[] = { title_texture_0A0001C0, title_texture_0A000E40, title_texture_0A001AC0, title_texture_0A002740, }; // 0x0A0065D0 -const u8 *const game_over_texture_table[] = { +const Texture *const game_over_texture_table[] = { title_texture_0A0033C0, title_texture_0A004040, title_texture_0A004CC0, title_texture_0A005940, }; UNUSED static const u64 title_screen_bg_unused_0 = 0; + +#ifdef VERSION_SH +const Gfx title_screen_bg_dl_0A0065E8[] = { + gsDPPipeSync(), + gsDPSetCycleType(G_CYC_COPY), + gsDPSetTexturePersp(G_TP_NONE), + gsDPSetTextureFilter(G_TF_POINT), + gsDPSetRenderMode(G_RM_NOOP, G_RM_NOOP2), + gsSPEndDisplayList(), +}; + +const Gfx title_screen_bg_dl_0A006618[] = { + gsDPPipeSync(), + gsDPSetCycleType(G_CYC_1CYCLE), + gsDPSetTexturePersp(G_TP_PERSP), + gsDPSetTextureFilter(G_TF_BILERP), + gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), + gsSPEndDisplayList(), +}; + +ALIGNED8 static const u8 title_texture_rumble_pak[] = { +#include "textures/title_screen_bg/title_screen_bg.06648.rgba16.inc.c" +}; + +const Gfx title_screen_bg_dl_0A007548[] = { + gsDPPipeSync(), + gsDPSetCycleType(G_CYC_COPY), + gsDPSetTexturePersp(G_TP_NONE), + gsDPSetTextureFilter(G_TF_POINT), + gsDPSetRenderMode(G_RM_NOOP, G_RM_NOOP2), + gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, 319, 239), + gsDPLoadTextureTile(title_texture_rumble_pak, G_IM_FMT_RGBA, G_IM_SIZ_16b, 80, 0, 0, 0, 79, 23, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 7, 5, G_TX_NOLOD, G_TX_NOLOD), + gsSPTextureRectangle(220 << 2, 200 << 2, 299 << 2, 223 << 2, G_TX_RENDERTILE, 0, 0, 4 << 10, 1 << 10), + gsDPPipeSync(), + gsDPSetCycleType(G_CYC_1CYCLE), + gsDPSetTexturePersp(G_TP_PERSP), + gsDPSetTextureFilter(G_TF_BILERP), + gsDPSetRenderMode(G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2), + gsSPEndDisplayList(), +}; +#endif diff --git a/bin/water.c b/bin/water.c index a9588917..ce612c98 100644 --- a/bin/water.c +++ b/bin/water.c @@ -1,78 +1,79 @@ -#include "sm64.h" +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" // 0x09000000 -ALIGNED8 const u8 water_09000000[] = { +ALIGNED8 const Texture water_09000000[] = { #include "textures/water/jrb_textures.00000.rgba16.inc.c" }; // 0x09000800 -ALIGNED8 const u8 water_09000800[] = { +ALIGNED8 const Texture water_09000800[] = { #include "textures/water/jrb_textures.00800.rgba16.inc.c" }; // 0x09001800 -ALIGNED8 const u8 water_09001800[] = { +ALIGNED8 const Texture water_09001800[] = { #include "textures/water/jrb_textures.01800.rgba16.inc.c" }; // 0x09002800 -ALIGNED8 const u8 water_09002800[] = { +ALIGNED8 const Texture water_09002800[] = { #include "textures/water/jrb_textures.02800.rgba16.inc.c" }; // 0x09003800 -ALIGNED8 const u8 water_09003800[] = { +ALIGNED8 const Texture water_09003800[] = { #include "textures/water/jrb_textures.03800.rgba16.inc.c" }; // 0x09004800 -ALIGNED8 const u8 water_09004800[] = { +ALIGNED8 const Texture water_09004800[] = { #include "textures/water/jrb_textures.04800.rgba16.inc.c" }; // 0x09005800 -ALIGNED8 const u8 water_09005800[] = { +ALIGNED8 const Texture water_09005800[] = { #include "textures/water/jrb_textures.05800.rgba16.inc.c" }; // 0x09006000 -ALIGNED8 const u8 water_09006000[] = { +ALIGNED8 const Texture water_09006000[] = { #include "textures/water/jrb_textures.06000.rgba16.inc.c" }; // 0x09006800 -ALIGNED8 const u8 water_09006800[] = { +ALIGNED8 const Texture water_09006800[] = { #include "textures/water/jrb_textures.06800.rgba16.inc.c" }; // 0x09007800 -ALIGNED8 const u8 water_09007800[] = { +ALIGNED8 const Texture water_09007800[] = { #include "textures/water/jrb_textures.07800.rgba16.inc.c" }; // 0x09008800 -ALIGNED8 const u8 water_09008800[] = { +ALIGNED8 const Texture water_09008800[] = { #include "textures/water/jrb_textures.08800.rgba16.inc.c" }; // 0x09009000 -ALIGNED8 const u8 water_09009000[] = { +ALIGNED8 const Texture water_09009000[] = { #include "textures/water/jrb_textures.09000.rgba16.inc.c" }; // 0x0900A000 -ALIGNED8 const u8 water_0900A000[] = { +ALIGNED8 const Texture water_0900A000[] = { #include "textures/water/jrb_textures.0A000.rgba16.inc.c" }; // 0x0900A800 -ALIGNED8 const u8 water_0900A800[] = { +ALIGNED8 const Texture water_0900A800[] = { #include "textures/water/jrb_textures.0A800.rgba16.inc.c" }; // 0x0900B800 -ALIGNED8 const u8 water_0900B800[] = { +ALIGNED8 const Texture water_0900B800[] = { #include "textures/water/jrb_textures.0B800.rgba16.inc.c" }; diff --git a/data/behavior_data.c b/data/behavior_data.c index 8bf68eae..cabc2f1c 100644 --- a/data/behavior_data.c +++ b/data/behavior_data.c @@ -2756,28 +2756,28 @@ const BehaviorScript bhvSmallPenguin[] = { END_LOOP(), }; -const BehaviorScript bhvFish2[] = { +const BehaviorScript bhvManyBlueFishSpawner[] = { BEGIN(OBJ_LIST_DEFAULT), - ID(id_bhvFish2), + ID(id_bhvManyBlueFishSpawner), SET_INT(oBehParams2ndByte, 0), - GOTO(bhvLargeFishGroup + 1 + 1), + GOTO(bhvFishSpawner + 1 + 1), }; -const BehaviorScript bhvFish3[] = { +const BehaviorScript bhvFewBlueFishSpawner[] = { BEGIN(OBJ_LIST_DEFAULT), - ID(id_bhvFish3), + ID(id_bhvFewBlueFishSpawner), SET_INT(oBehParams2ndByte, 1), - GOTO(bhvLargeFishGroup + 1 + 1), + GOTO(bhvFishSpawner + 1 + 1), }; -const BehaviorScript bhvLargeFishGroup[] = { +const BehaviorScript bhvFishSpawner[] = { BEGIN(OBJ_LIST_DEFAULT), - ID(id_bhvLargeFishGroup), - // Large fish group - common: + ID(id_bhvFishSpawner), + // Fish Spawner - common: DISABLE_RENDERING(), OR_INT(oFlags, (OBJ_FLAG_COMPUTE_DIST_TO_MARIO | OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW | OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE)), BEGIN_LOOP(), - CALL_NATIVE(bhv_large_fish_group_loop), + CALL_NATIVE(bhv_fish_spawner_loop), END_LOOP(), }; diff --git a/data/behavior_table.c b/data/behavior_table.c index 28c0ffe9..8fd06cfa 100644 --- a/data/behavior_table.c +++ b/data/behavior_table.c @@ -205,9 +205,9 @@ const BehaviorScript* gBehaviorTable[id_bhv_max_count] = { [id_bhvPenguinBaby] = bhvPenguinBaby, [id_bhvUnused20E0] = bhvUnused20E0, [id_bhvSmallPenguin] = bhvSmallPenguin, - [id_bhvFish2] = bhvFish2, - [id_bhvFish3] = bhvFish3, - [id_bhvLargeFishGroup] = bhvLargeFishGroup, + [id_bhvManyBlueFishSpawner] = bhvManyBlueFishSpawner, + [id_bhvFewBlueFishSpawner] = bhvFewBlueFishSpawner, + [id_bhvFishSpawner] = bhvFishSpawner, [id_bhvFish] = bhvFish, [id_bhvWdwExpressElevator] = bhvWdwExpressElevator, [id_bhvWdwExpressElevatorPlatform] = bhvWdwExpressElevatorPlatform, diff --git a/data/dynos.h b/data/dynos.h index 7a9127f6..d7fbcee5 100644 --- a/data/dynos.h +++ b/data/dynos.h @@ -19,7 +19,7 @@ extern "C" { #endif #include "config.h" #include "pc/fs/fs.h" -#include "audio_defines.h" +#include "sounds.h" #undef STB_IMAGE_IMPLEMENTATION #include "stb/stb_image.h" #ifdef __cplusplus diff --git a/data/dynos_opt.cpp b/data/dynos_opt.cpp index 495b3872..aee4e71a 100644 --- a/data/dynos_opt.cpp +++ b/data/dynos_opt.cpp @@ -386,7 +386,7 @@ static s32 DynOS_Opt_ProcessInput(DynosOption *aOpt, s32 input) { } static void DynOS_Opt_Open(DynosOption *aMenu) { - play_sound(SOUND_DYNOS_SELECT, gDefaultSoundArgs); + play_sound(SOUND_DYNOS_SELECT, gGlobalSoundSource); sCurrentMenu = aMenu; sCurrentOpt = aMenu; } @@ -394,7 +394,7 @@ static void DynOS_Opt_Open(DynosOption *aMenu) { static void DynOS_Opt_Close(bool aPlaySavedSfx) { if (sCurrentMenu != NULL) { if (aPlaySavedSfx) { - play_sound(SOUND_DYNOS_SAVED, gDefaultSoundArgs); + play_sound(SOUND_DYNOS_SAVED, gGlobalSoundSource); } #ifdef BETTERCAMERA newcam_init_settings(); @@ -431,7 +431,7 @@ static void DynOS_Opt_ProcessInputs() { if (sBindingState != 0) { u32 _Key = (sCurrentOpt->mDynos ? (u32) DynOS_Opt_ControllerGetKeyPressed() : controller_get_raw_key()); if (_Key != VK_INVALID) { - play_sound(SOUND_DYNOS_SELECT, gDefaultSoundArgs); + play_sound(SOUND_DYNOS_SELECT, gGlobalSoundSource); sCurrentOpt->mBind.mBinds[sCurrentOpt->mBind.mIndex] = _Key; sBindingState = false; } @@ -447,7 +447,7 @@ static void DynOS_Opt_ProcessInputs() { } else { while (sCurrentOpt->mNext) sCurrentOpt = sCurrentOpt->mNext; } - play_sound(SOUND_DYNOS_SELECT, gDefaultSoundArgs); + play_sound(SOUND_DYNOS_SELECT, gGlobalSoundSource); return; } @@ -458,15 +458,15 @@ static void DynOS_Opt_ProcessInputs() { } else { while (sCurrentOpt->mPrev) sCurrentOpt = sCurrentOpt->mPrev; } - play_sound(SOUND_DYNOS_SELECT, gDefaultSoundArgs); + play_sound(SOUND_DYNOS_SELECT, gGlobalSoundSource); return; } // Left if (_StickX < -60) { switch (DynOS_Opt_ProcessInput(sCurrentOpt, INPUT_LEFT)) { - case RESULT_OK: play_sound(SOUND_DYNOS_OK, gDefaultSoundArgs); break; - case RESULT_CANCEL: play_sound(SOUND_DYNOS_CANCEL, gDefaultSoundArgs); break; + case RESULT_OK: play_sound(SOUND_DYNOS_OK, gGlobalSoundSource); break; + case RESULT_CANCEL: play_sound(SOUND_DYNOS_CANCEL, gGlobalSoundSource); break; case RESULT_NONE: break; } return; @@ -475,8 +475,8 @@ static void DynOS_Opt_ProcessInputs() { // Right if (_StickX > +60) { switch (DynOS_Opt_ProcessInput(sCurrentOpt, INPUT_RIGHT)) { - case RESULT_OK: play_sound(SOUND_DYNOS_OK, gDefaultSoundArgs); break; - case RESULT_CANCEL: play_sound(SOUND_DYNOS_CANCEL, gDefaultSoundArgs); break; + case RESULT_OK: play_sound(SOUND_DYNOS_OK, gGlobalSoundSource); break; + case RESULT_CANCEL: play_sound(SOUND_DYNOS_CANCEL, gGlobalSoundSource); break; case RESULT_NONE: break; } return; @@ -485,8 +485,8 @@ static void DynOS_Opt_ProcessInputs() { // A if (gPlayer1Controller->buttonPressed & A_BUTTON) { switch (DynOS_Opt_ProcessInput(sCurrentOpt, INPUT_A)) { - case RESULT_OK: play_sound(SOUND_DYNOS_OK, gDefaultSoundArgs); break; - case RESULT_CANCEL: play_sound(SOUND_DYNOS_CANCEL, gDefaultSoundArgs); break; + case RESULT_OK: play_sound(SOUND_DYNOS_OK, gGlobalSoundSource); break; + case RESULT_CANCEL: play_sound(SOUND_DYNOS_CANCEL, gGlobalSoundSource); break; case RESULT_NONE: break; } return; @@ -496,7 +496,7 @@ static void DynOS_Opt_ProcessInputs() { if (gPlayer1Controller->buttonPressed & B_BUTTON) { if (sCurrentOpt->mParent != NULL) { sCurrentOpt = sCurrentOpt->mParent; - play_sound(SOUND_DYNOS_SELECT, gDefaultSoundArgs); + play_sound(SOUND_DYNOS_SELECT, gGlobalSoundSource); } else { DynOS_Opt_Close(true); } @@ -506,8 +506,8 @@ static void DynOS_Opt_ProcessInputs() { // Z if (gPlayer1Controller->buttonPressed & Z_TRIG) { switch (DynOS_Opt_ProcessInput(sCurrentOpt, INPUT_Z)) { - case RESULT_OK: play_sound(SOUND_DYNOS_OK, gDefaultSoundArgs); break; - case RESULT_CANCEL: play_sound(SOUND_DYNOS_CANCEL, gDefaultSoundArgs); break; + case RESULT_OK: play_sound(SOUND_DYNOS_OK, gGlobalSoundSource); break; + case RESULT_CANCEL: play_sound(SOUND_DYNOS_CANCEL, gGlobalSoundSource); break; case RESULT_NONE: if (sCurrentMenu == sDynosMenu) { DynOS_Opt_Close(true); diff --git a/data/dynos_warps.cpp b/data/dynos_warps.cpp index 9151592f..de6a61cc 100644 --- a/data/dynos_warps.cpp +++ b/data/dynos_warps.cpp @@ -434,7 +434,7 @@ static void *DynOS_Warp_UpdateExit(void *aCmd, bool aIsLevelInitDone) { init_camera(gCurrentArea->camera); sDelayedWarpOp = WARP_OP_NONE; play_transition(WARP_TRANSITION_FADE_FROM_STAR, 15, 0x00, 0x00, 0x00); - play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gDefaultSoundArgs); + play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gGlobalSoundSource); // Set music set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0); diff --git a/diff.py b/diff.py index 869070d6..e74120f8 100755 --- a/diff.py +++ b/diff.py @@ -1,59 +1,112 @@ #!/usr/bin/env python3 -import sys -import re -import os -import ast +# PYTHON_ARGCOMPLETE_OK import argparse -import subprocess -import collections -import difflib -import string -import itertools -import threading -import queue -import time +import sys +from typing import ( + Any, + Dict, + List, + Match, + NamedTuple, + NoReturn, + Optional, + Set, + Tuple, + Union, + Callable, + Pattern, +) -def fail(msg): +def fail(msg: str) -> NoReturn: print(msg, file=sys.stderr) sys.exit(1) -MISSING_PREREQUISITES = ( - "Missing prerequisite python module {}. " - "Run `python3 -m pip install --user colorama ansiwrap attrs watchdog python-Levenshtein cxxfilt` to install prerequisites (cxxfilt only needed with --source)." -) - -try: - import attr - from colorama import Fore, Style, Back - import ansiwrap - import watchdog -except ModuleNotFoundError as e: - fail(MISSING_PREREQUISITES.format(e.name)) - # Prefer to use diff_settings.py from the current working directory sys.path.insert(0, ".") try: import diff_settings except ModuleNotFoundError: fail("Unable to find diff_settings.py in the same directory.") +sys.path.pop(0) -# ==== CONFIG ==== +# ==== COMMAND-LINE ==== -parser = argparse.ArgumentParser(description="Diff MIPS assembly.") -parser.add_argument("start", help="Function name or address to start diffing from.") -parser.add_argument("end", nargs="?", help="Address to end diff at.") +try: + import argcomplete # type: ignore +except ModuleNotFoundError: + argcomplete = None + +parser = argparse.ArgumentParser(description="Diff MIPS or AArch64 assembly.") + +start_argument = parser.add_argument( + "start", + help="Function name or address to start diffing from.", +) + +if argcomplete: + + def complete_symbol( + prefix: str, parsed_args: argparse.Namespace, **kwargs: object + ) -> List[str]: + if not prefix or prefix.startswith("-"): + # skip reading the map file, which would + # result in a lot of useless completions + return [] + config: Dict[str, Any] = {} + diff_settings.apply(config, parsed_args) # type: ignore + mapfile = config.get("mapfile") + if not mapfile: + return [] + completes = [] + with open(mapfile) as f: + data = f.read() + # assume symbols are prefixed by a space character + search = f" {prefix}" + pos = data.find(search) + while pos != -1: + # skip the space character in the search string + pos += 1 + # assume symbols are suffixed by either a space + # character or a (unix-style) line return + spacePos = data.find(" ", pos) + lineReturnPos = data.find("\n", pos) + if lineReturnPos == -1: + endPos = spacePos + elif spacePos == -1: + endPos = lineReturnPos + else: + endPos = min(spacePos, lineReturnPos) + if endPos == -1: + match = data[pos:] + pos = -1 + else: + match = data[pos:endPos] + pos = data.find(search, endPos) + completes.append(match) + return completes + + setattr(start_argument, "completer", complete_symbol) + +parser.add_argument( + "end", + nargs="?", + help="Address to end diff at.", +) parser.add_argument( "-o", dest="diff_obj", action="store_true", - help="Diff .o files rather than a whole binary. This makes it possible to see symbol names. (Recommended)", + help="Diff .o files rather than a whole binary. This makes it possible to " + "see symbol names. (Recommended)", ) parser.add_argument( "--elf", dest="diff_elf_symbol", - help="Diff a given function in two ELFs, one being stripped and the other one non-stripped. Requires objdump from binutils 2.33+.", + metavar="SYMBOL", + help="Diff a given function in two ELFs, one being stripped and the other " + "one non-stripped. Requires objdump from binutils 2.33+.", ) parser.add_argument( "--source", @@ -90,6 +143,7 @@ parser.add_argument( dest="skip_lines", type=int, default=0, + metavar="LINES", help="Skip the first N lines of output.", ) parser.add_argument( @@ -106,6 +160,12 @@ parser.add_argument( action="store_true", help="Pretend all large enough immediates are the same.", ) +parser.add_argument( + "-I", + "--ignore-addr-diffs", + action="store_true", + help="Ignore address differences. Currently only affects AArch64.", +) parser.add_argument( "-B", "--no-show-branches", @@ -132,6 +192,24 @@ parser.add_argument( help="Automatically update when source/object files change. " "Recommended in combination with -m.", ) +parser.add_argument( + "-3", + "--threeway=prev", + dest="threeway", + action="store_const", + const="prev", + help="Show a three-way diff between target asm, current asm, and asm " + "prior to -w rebuild. Requires -w.", +) +parser.add_argument( + "-b", + "--threeway=base", + dest="threeway", + action="store_const", + const="base", + help="Show a three-way diff between target asm, current asm, and asm " + "when diff.py was started. Requires -w.", +) parser.add_argument( "--width", dest="column_width", @@ -144,9 +222,9 @@ parser.add_argument( dest="algorithm", default="levenshtein", choices=["levenshtein", "difflib"], - help="Diff algorithm to use.", + help="Diff algorithm to use. Levenshtein gives the minimum diff, while difflib " + "aims for long sections of equal opcodes. Defaults to %(default)s.", ) - parser.add_argument( "--max-size", "--max-lines", @@ -157,27 +235,61 @@ parser.add_argument( ) # Project-specific flags, e.g. different versions/make arguments. -if hasattr(diff_settings, "add_custom_arguments"): - diff_settings.add_custom_arguments(parser) +add_custom_arguments_fn = getattr(diff_settings, "add_custom_arguments", None) +if add_custom_arguments_fn: + add_custom_arguments_fn(parser) + +if argcomplete: + argcomplete.autocomplete(parser) + +# ==== IMPORTS ==== + +# (We do imports late to optimize auto-complete performance.) + +import re +import os +import ast +import subprocess +import difflib +import string +import itertools +import threading +import queue +import time + + +MISSING_PREREQUISITES = ( + "Missing prerequisite python module {}. " + "Run `python3 -m pip install --user colorama ansiwrap watchdog python-Levenshtein cxxfilt` to install prerequisites (cxxfilt only needed with --source)." +) + +try: + from colorama import Fore, Style, Back # type: ignore + import ansiwrap # type: ignore + import watchdog # type: ignore +except ModuleNotFoundError as e: + fail(MISSING_PREREQUISITES.format(e.name)) + +# ==== CONFIG ==== args = parser.parse_args() # Set imgs, map file and make flags in a project-specific manner. -config = {} -diff_settings.apply(config, args) +config: Dict[str, Any] = {} +diff_settings.apply(config, args) # type: ignore -arch = config.get("arch", "mips") -baseimg = config.get("baseimg", None) -myimg = config.get("myimg", None) -mapfile = config.get("mapfile", None) -makeflags = config.get("makeflags", []) -source_directories = config.get("source_directories", None) -objdump_executable = config.get("objdump_executable", None) +arch: str = config.get("arch", "mips") +baseimg: Optional[str] = config.get("baseimg") +myimg: Optional[str] = config.get("myimg") +mapfile: Optional[str] = config.get("mapfile") +makeflags: List[str] = config.get("makeflags", []) +source_directories: Optional[List[str]] = config.get("source_directories") +objdump_executable: Optional[str] = config.get("objdump_executable") -MAX_FUNCTION_SIZE_LINES = args.max_lines -MAX_FUNCTION_SIZE_BYTES = MAX_FUNCTION_SIZE_LINES * 4 +MAX_FUNCTION_SIZE_LINES: int = args.max_lines +MAX_FUNCTION_SIZE_BYTES: int = MAX_FUNCTION_SIZE_LINES * 4 -COLOR_ROTATION = [ +COLOR_ROTATION: List[str] = [ Fore.MAGENTA, Fore.CYAN, Fore.GREEN, @@ -189,26 +301,31 @@ COLOR_ROTATION = [ Fore.LIGHTBLACK_EX, ] -BUFFER_CMD = ["tail", "-c", str(10 ** 9)] -LESS_CMD = ["less", "-SRic", "-#6"] +BUFFER_CMD: List[str] = ["tail", "-c", str(10 ** 9)] +LESS_CMD: List[str] = ["less", "-SRic", "-#6"] -DEBOUNCE_DELAY = 0.1 -FS_WATCH_EXTENSIONS = [".c", ".h"] +DEBOUNCE_DELAY: float = 0.1 +FS_WATCH_EXTENSIONS: List[str] = [".c", ".h", ".s"] # ==== LOGIC ==== +ObjdumpCommand = Tuple[List[str], str, Optional[str]] + if args.algorithm == "levenshtein": try: - import Levenshtein + import Levenshtein # type: ignore except ModuleNotFoundError as e: fail(MISSING_PREREQUISITES.format(e.name)) if args.source: try: - import cxxfilt + import cxxfilt # type: ignore except ModuleNotFoundError as e: fail(MISSING_PREREQUISITES.format(e.name)) +if args.threeway and not args.watch: + fail("Threeway diffing requires -w.") + if objdump_executable is None: for objdump_cand in ["mips-linux-gnu-objdump", "mips64-elf-objdump"]: try: @@ -230,35 +347,41 @@ if not objdump_executable: ) -def eval_int(expr, emsg=None): +def maybe_eval_int(expr: str) -> Optional[int]: try: ret = ast.literal_eval(expr) if not isinstance(ret, int): raise Exception("not an integer") return ret except Exception: - if emsg is not None: - fail(emsg) return None -def eval_line_num(expr): +def eval_int(expr: str, emsg: str) -> int: + ret = maybe_eval_int(expr) + if ret is None: + fail(emsg) + return ret + + +def eval_line_num(expr: str) -> int: return int(expr.strip().replace(":", ""), 16) -def run_make(target, capture_output=False): - if capture_output: - return subprocess.run( - ["make"] + makeflags + [target], - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - ) - else: - subprocess.check_call(["make"] + makeflags + [target]) +def run_make(target: str) -> None: + subprocess.check_call(["make"] + makeflags + [target]) -def restrict_to_function(dump, fn_name): - out = [] +def run_make_capture_output(target: str) -> "subprocess.CompletedProcess[bytes]": + return subprocess.run( + ["make"] + makeflags + [target], + stderr=subprocess.PIPE, + stdout=subprocess.PIPE, + ) + + +def restrict_to_function(dump: str, fn_name: str) -> str: + out: List[str] = [] search = f"<{fn_name}>:" found = False for line in dump.split("\n"): @@ -271,13 +394,13 @@ def restrict_to_function(dump, fn_name): return "\n".join(out) -def maybe_get_objdump_source_flags(): +def maybe_get_objdump_source_flags() -> List[str]: if not args.source: return [] flags = [ "--source", - "--source-comment=| ", + "--source-comment=│ ", "-l", ] @@ -287,22 +410,23 @@ def maybe_get_objdump_source_flags(): return flags -def run_objdump(cmd): +def run_objdump(cmd: ObjdumpCommand) -> str: flags, target, restrict = cmd + assert objdump_executable, "checked previously" out = subprocess.check_output( - [objdump_executable] + flags + [target], universal_newlines=True + [objdump_executable] + arch_flags + flags + [target], universal_newlines=True ) if restrict is not None: return restrict_to_function(out, restrict) return out -base_shift = eval_int( +base_shift: int = eval_int( args.base_shift, "Failed to parse --base-shift (-S) argument as an integer." ) -def search_map_file(fn_name): +def search_map_file(fn_name: str) -> Tuple[Optional[str], Optional[int]]: if not mapfile: fail(f"No map file configured; cannot find function {fn_name}.") @@ -343,7 +467,7 @@ def search_map_file(fn_name): return None, None -def dump_elf(): +def dump_elf() -> Tuple[str, ObjdumpCommand, ObjdumpCommand]: if not baseimg or not myimg: fail("Missing myimg/baseimg in config.") if base_shift: @@ -373,7 +497,7 @@ def dump_elf(): ) -def dump_objfile(): +def dump_objfile() -> Tuple[str, ObjdumpCommand, ObjdumpCommand]: if base_shift: fail("--base-shift not compatible with -o") if args.end is not None: @@ -403,12 +527,12 @@ def dump_objfile(): ) -def dump_binary(): +def dump_binary() -> Tuple[str, ObjdumpCommand, ObjdumpCommand]: if not baseimg or not myimg: fail("Missing myimg/baseimg in config.") if args.make: run_make(myimg) - start_addr = eval_int(args.start) + start_addr = maybe_eval_int(args.start) if start_addr is None: _, start_addr = search_map_file(args.start) if start_addr is None: @@ -417,7 +541,7 @@ def dump_binary(): end_addr = eval_int(args.end, "End address must be an integer expression.") else: end_addr = start_addr + MAX_FUNCTION_SIZE_BYTES - objdump_flags = ["-Dz", "-bbinary", "-mmips", "-EB"] + objdump_flags = ["-Dz", "-bbinary", "-EB"] flags1 = [ f"--start-address={start_addr + base_shift}", f"--stop-address={end_addr + base_shift}", @@ -430,9 +554,9 @@ def dump_binary(): ) -# Alignment with ANSI colors is broken, let's fix it. -def ansi_ljust(s, width): - needed = width - ansiwrap.ansilen(s) +def ansi_ljust(s: str, width: int) -> str: + """Like s.ljust(width), but accounting for ANSI colors.""" + needed: int = width - ansiwrap.ansilen(s) if needed > 0: return s + " " * needed else: @@ -442,11 +566,14 @@ def ansi_ljust(s, width): if arch == "mips": re_int = re.compile(r"[0-9]+") re_comment = re.compile(r"<.*?>") - re_reg = re.compile(r"\$?\b(a[0-3]|t[0-9]|s[0-8]|at|v[01]|f[12]?[0-9]|f3[01]|k[01]|fp|ra)\b") + re_reg = re.compile( + r"\$?\b(a[0-3]|t[0-9]|s[0-8]|at|v[01]|f[12]?[0-9]|f3[01]|k[01]|fp|ra|zero)\b" + ) re_sprel = re.compile(r"(?<=,)([0-9]+|0x[0-9a-f]+)\(sp\)") re_large_imm = re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}") re_imm = re.compile(r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(sp)|%(lo|hi)\([^)]*\)") forbidden = set(string.ascii_letters + "_") + arch_flags = ["-m", "mips:4300"] branch_likely_instructions = { "beql", "bnel", @@ -460,7 +587,19 @@ if arch == "mips": "bc1fl", } branch_instructions = branch_likely_instructions.union( - {"b", "beq", "bne", "beqz", "bnez", "bgez", "bgtz", "blez", "bltz", "bc1t", "bc1f"} + { + "b", + "beq", + "bne", + "beqz", + "bnez", + "bgez", + "bgtz", + "blez", + "bltz", + "bc1t", + "bc1f", + } ) instructions_with_address_immediates = branch_instructions.union({"jal", "j"}) elif arch == "aarch64": @@ -472,15 +611,39 @@ elif arch == "aarch64": re_sprel = re.compile(r"sp, #-?(0x[0-9a-fA-F]+|[0-9]+)\b") re_large_imm = re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}") re_imm = re.compile(r"(? str: full = pat.group(0) if len(full) <= 1: # leave one-digit ints alone @@ -493,7 +656,7 @@ def hexify_int(row, pat): return hex(int(full)) -def parse_relocated_line(line): +def parse_relocated_line(line: str) -> Tuple[str, str, str]: try: ind2 = line.rindex(",") except ValueError: @@ -510,11 +673,20 @@ def parse_relocated_line(line): return before, imm, after -def process_reloc(row, prev): +def process_mips_reloc(row: str, prev: str) -> str: before, imm, after = parse_relocated_line(prev) repl = row.split()[-1] if imm != "0": - if before.strip() == "jal" and not imm.startswith("0x"): + # MIPS uses relocations with addends embedded in the code as immediates. + # If there is an immediate, show it as part of the relocation. Ideally + # we'd show this addend in both %lo/%hi, but annoyingly objdump's output + # doesn't include enough information to pair up %lo's and %hi's... + # TODO: handle unambiguous cases where all addends for a symbol are the + # same, or show "+???". + mnemonic = prev.split()[0] + if mnemonic in instructions_with_address_immediates and not imm.startswith( + "0x" + ): imm = "0x" + imm repl += "+" + imm if int(imm, 0) > 0 else imm if "R_MIPS_LO16" in row: @@ -524,30 +696,105 @@ def process_reloc(row, prev): # correct addend for each, but objdump doesn't give us the order of # the relocations, so we can't find the right LO16. :( repl = f"%hi({repl})" + elif "R_MIPS_26" in row: + # Function calls + pass + elif "R_MIPS_PC16" in row: + # Branch to glabel. This gives confusing output, but there's not much + # we can do here. + pass else: - assert "R_MIPS_26" in row, f"unknown relocation type '{row}'" + assert False, f"unknown relocation type '{row}' for line '{prev}'" return before + repl + after -def cleanup_whitespace(line): - return "".join(f"{o:<8s}" for o in line.strip().split("\t")) +def pad_mnemonic(line: str) -> str: + if "\t" not in line: + return line + mn, args = line.split("\t", 1) + return f"{mn:<7s} {args}" -Line = collections.namedtuple( - "Line", - [ - "mnemonic", - "diff_row", - "original", - "line_num", - "branch_target", - "source_lines", - "comment", - ], -) +class Line(NamedTuple): + mnemonic: str + diff_row: str + original: str + normalized_original: str + line_num: str + branch_target: Optional[str] + source_lines: List[str] + comment: Optional[str] -def process(lines): +class DifferenceNormalizer: + def normalize(self, mnemonic: str, row: str) -> str: + """This should be called exactly once for each line.""" + row = self._normalize_arch_specific(mnemonic, row) + if args.ignore_large_imms: + row = re.sub(re_large_imm, "", row) + return row + + def _normalize_arch_specific(self, mnemonic: str, row: str) -> str: + return row + + +class DifferenceNormalizerAArch64(DifferenceNormalizer): + def __init__(self) -> None: + super().__init__() + self._adrp_pair_registers: Set[str] = set() + + def _normalize_arch_specific(self, mnemonic: str, row: str) -> str: + if args.ignore_addr_diffs: + row = self._normalize_adrp_differences(mnemonic, row) + row = self._normalize_bl(mnemonic, row) + return row + + def _normalize_bl(self, mnemonic: str, row: str) -> str: + if mnemonic != "bl": + return row + + row, _ = split_off_branch(row) + return row + + def _normalize_adrp_differences(self, mnemonic: str, row: str) -> str: + """Identifies ADRP + LDR/ADD pairs that are used to access the GOT and + suppresses any immediate differences. + + Whenever an ADRP is seen, the destination register is added to the set of registers + that are part of an ADRP + LDR/ADD pair. Registers are removed from the set as soon + as they are used for an LDR or ADD instruction which completes the pair. + + This method is somewhat crude but should manage to detect most such pairs. + """ + row_parts = row.split("\t", 1) + if mnemonic == "adrp": + self._adrp_pair_registers.add(row_parts[1].strip().split(",")[0]) + row, _ = split_off_branch(row) + elif mnemonic == "ldr": + for reg in self._adrp_pair_registers: + # ldr xxx, [reg] + # ldr xxx, [reg, ] + if f", [{reg}" in row_parts[1]: + self._adrp_pair_registers.remove(reg) + return normalize_imms(row) + elif mnemonic == "add": + for reg in self._adrp_pair_registers: + # add reg, reg, + if row_parts[1].startswith(f"{reg}, {reg}, "): + self._adrp_pair_registers.remove(reg) + return normalize_imms(row) + + return row + + +def make_difference_normalizer() -> DifferenceNormalizer: + if arch == "aarch64": + return DifferenceNormalizerAArch64() + return DifferenceNormalizer() + + +def process(lines: List[str]) -> List[Line]: + normalizer = make_difference_normalizer() skip_next = False source_lines = [] if not args.diff_obj: @@ -555,7 +802,8 @@ def process(lines): if lines and not lines[-1]: lines.pop() - output = [] + output: List[Line] = [] + stop_after_delay_slot = False for row in lines: if args.diff_obj and (">:" in row or not row): continue @@ -571,8 +819,8 @@ def process(lines): if "R_MIPS_" in row: # N.B. Don't transform the diff rows, they already ignore immediates # if output[-1].diff_row != "": - # output[-1] = output[-1].replace(diff_row=process_reloc(row, output[-1].row_with_imm)) - new_original = process_reloc(row, output[-1].original) + # output[-1] = output[-1].replace(diff_row=process_mips_reloc(row, output[-1].row_with_imm)) + new_original = process_mips_reloc(row, output[-1].original) output[-1] = output[-1]._replace(original=new_original) continue @@ -586,8 +834,9 @@ def process(lines): row_parts = row.split("\t", 1) mnemonic = row_parts[0].strip() if mnemonic not in instructions_with_address_immediates: - row = re.sub(re_int, lambda s: hexify_int(row, s), row) + row = re.sub(re_int, lambda m: hexify_int(row, m), row) original = row + normalized_original = normalizer.normalize(mnemonic, original) if skip_next: skip_next = False row = "" @@ -616,6 +865,7 @@ def process(lines): mnemonic=mnemonic, diff_row=row, original=original, + normalized_original=normalized_original, line_num=line_num, branch_target=branch_target, source_lines=source_lines, @@ -625,26 +875,25 @@ def process(lines): source_lines = [] if args.stop_jrra and mnemonic == "jr" and row_parts[1].strip() == "ra": + stop_after_delay_slot = True + elif stop_after_delay_slot: break - # Cleanup whitespace, after relocation fixups have happened - output = [ - line._replace(original=cleanup_whitespace(line.original)) for line in output - ] - return output -def format_single_line_diff(line1, line2, column_width): - return f"{ansi_ljust(line1,column_width)}{ansi_ljust(line2,column_width)}" +def format_single_line_diff(line1: str, line2: str, column_width: int) -> str: + return ansi_ljust(line1, column_width) + line2 class SymbolColorer: - def __init__(self, base_index): + symbol_colors: Dict[str, str] + + def __init__(self, base_index: int) -> None: self.color_index = base_index self.symbol_colors = {} - def color_symbol(self, s, t=None): + def color_symbol(self, s: str, t: Optional[str] = None) -> str: try: color = self.symbol_colors[s] except: @@ -655,21 +904,15 @@ class SymbolColorer: return f"{color}{t}{Fore.RESET}" -def maybe_normalize_large_imms(row): - if args.ignore_large_imms: - row = re.sub(re_large_imm, "", row) - return row - - -def normalize_imms(row): +def normalize_imms(row: str) -> str: return re.sub(re_imm, "", row) -def normalize_stack(row): +def normalize_stack(row: str) -> str: return re.sub(re_sprel, "addr(sp)", row) -def split_off_branch(line): +def split_off_branch(line: str) -> Tuple[str, str]: parts = line.split(",") if len(parts) < 2: parts = line.split(None, 1) @@ -677,37 +920,50 @@ def split_off_branch(line): return line[:off], line[off:] -def color_imms(out1, out2): - g1 = [] - g2 = [] - re.sub(re_imm, lambda s: g1.append(s.group()), out1) - re.sub(re_imm, lambda s: g2.append(s.group()), out2) - if len(g1) == len(g2): - diffs = [x != y for (x, y) in zip(g1, g2)] - it = iter(diffs) +ColorFunction = Callable[[str], str] - def maybe_color(s): - return f"{Fore.LIGHTBLUE_EX}{s}{Style.RESET_ALL}" if next(it) else s - out1 = re.sub(re_imm, lambda s: maybe_color(s.group()), out1) - it = iter(diffs) - out2 = re.sub(re_imm, lambda s: maybe_color(s.group()), out2) +def color_fields( + pat: Pattern[str], + out1: str, + out2: str, + color1: ColorFunction, + color2: Optional[ColorFunction] = None, +) -> Tuple[str, str]: + diffs = [ + of.group() != nf.group() + for (of, nf) in zip(pat.finditer(out1), pat.finditer(out2)) + ] + + it = iter(diffs) + + def maybe_color(color: ColorFunction, s: str) -> str: + return color(s) if next(it, False) else f"{Style.RESET_ALL}{s}" + + out1 = pat.sub(lambda m: maybe_color(color1, m.group()), out1) + it = iter(diffs) + out2 = pat.sub(lambda m: maybe_color(color2 or color1, m.group()), out2) + return out1, out2 -def color_branch_imms(br1, br2): +def color_branch_imms(br1: str, br2: str) -> Tuple[str, str]: if br1 != br2: br1 = f"{Fore.LIGHTBLUE_EX}{br1}{Style.RESET_ALL}" br2 = f"{Fore.LIGHTBLUE_EX}{br2}{Style.RESET_ALL}" return br1, br2 -def diff_sequences_difflib(seq1, seq2): +def diff_sequences_difflib( + seq1: List[str], seq2: List[str] +) -> List[Tuple[str, int, int, int, int]]: differ = difflib.SequenceMatcher(a=seq1, b=seq2, autojunk=False) return differ.get_opcodes() -def diff_sequences(seq1, seq2): +def diff_sequences( + seq1: List[str], seq2: List[str] +) -> List[Tuple[str, int, int, int, int]]: if ( args.algorithm != "levenshtein" or len(seq1) * len(seq2) > 4 * 10 ** 8 @@ -717,9 +973,9 @@ def diff_sequences(seq1, seq2): # The Levenshtein library assumes that we compare strings, not lists. Convert. # (Per the check above we know we have fewer than 0x110000 unique elements, so chr() works.) - remapping = {} + remapping: Dict[str, str] = {} - def remap(seq): + def remap(seq: List[str]) -> str: seq = seq[:] for i in range(len(seq)): val = remapping.get(seq[i]) @@ -729,16 +985,56 @@ def diff_sequences(seq1, seq2): seq[i] = val return "".join(seq) - seq1 = remap(seq1) - seq2 = remap(seq2) - return Levenshtein.opcodes(seq1, seq2) + rem1 = remap(seq1) + rem2 = remap(seq2) + return Levenshtein.opcodes(rem1, rem2) # type: ignore -def do_diff(basedump, mydump): - output = [] +def diff_lines( + lines1: List[Line], + lines2: List[Line], +) -> List[Tuple[Optional[Line], Optional[Line]]]: + ret = [] + for (tag, i1, i2, j1, j2) in diff_sequences( + [line.mnemonic for line in lines1], + [line.mnemonic for line in lines2], + ): + for line1, line2 in itertools.zip_longest(lines1[i1:i2], lines2[j1:j2]): + if tag == "replace": + if line1 is None: + tag = "insert" + elif line2 is None: + tag = "delete" + elif tag == "insert": + assert line1 is None + elif tag == "delete": + assert line2 is None + ret.append((line1, line2)) - # TODO: status line? - # output.append(sha1sum(mydump)) + return ret + + +class OutputLine: + base: Optional[str] + fmt2: str + key2: Optional[str] + + def __init__(self, base: Optional[str], fmt2: str, key2: Optional[str]) -> None: + self.base = base + self.fmt2 = fmt2 + self.key2 = key2 + + def __eq__(self, other: object) -> bool: + if not isinstance(other, OutputLine): + return NotImplemented + return self.key2 == other.key2 + + def __hash__(self) -> int: + return hash(self.key2) + + +def do_diff(basedump: str, mydump: str) -> List[OutputLine]: + output: List[OutputLine] = [] lines1 = process(basedump.split("\n")) lines2 = process(mydump.split("\n")) @@ -749,8 +1045,8 @@ def do_diff(basedump, mydump): sc4 = SymbolColorer(4) sc5 = SymbolColorer(0) sc6 = SymbolColorer(0) - bts1 = set() - bts2 = set() + bts1: Set[str] = set() + bts2: Set[str] = set() if args.show_branches: for (lines, btset, sc) in [ @@ -763,172 +1059,237 @@ def do_diff(basedump, mydump): btset.add(bt + ":") sc.color_symbol(bt + ":") - for (tag, i1, i2, j1, j2) in diff_sequences( - [line.mnemonic for line in lines1], [line.mnemonic for line in lines2] - ): - for line1, line2 in itertools.zip_longest(lines1[i1:i2], lines2[j1:j2]): - if tag == "replace": - if line1 is None: - tag = "insert" - elif line2 is None: - tag = "delete" - elif tag == "insert": - assert line1 is None - elif tag == "delete": - assert line2 is None + for (line1, line2) in diff_lines(lines1, lines2): + line_color1 = line_color2 = sym_color = Fore.RESET + line_prefix = " " + if line1 and line2 and line1.diff_row == line2.diff_row: + if line1.normalized_original == line2.normalized_original: + out1 = line1.original + out2 = line2.original + elif line1.diff_row == "": + out1 = f"{Style.BRIGHT}{Fore.LIGHTBLACK_EX}{line1.original}" + out2 = f"{Style.BRIGHT}{Fore.LIGHTBLACK_EX}{line2.original}" + else: + mnemonic = line1.original.split()[0] + out1, out2 = line1.original, line2.original + branch1 = branch2 = "" + if mnemonic in instructions_with_address_immediates: + out1, branch1 = split_off_branch(line1.original) + out2, branch2 = split_off_branch(line2.original) + branchless1 = out1 + branchless2 = out2 + out1, out2 = color_fields( + re_imm, + out1, + out2, + lambda s: f"{Fore.LIGHTBLUE_EX}{s}{Style.RESET_ALL}", + ) - line_color1 = line_color2 = sym_color = Fore.RESET - line_prefix = " " - if line1 and line2 and line1.diff_row == line2.diff_row: - if maybe_normalize_large_imms( - line1.original - ) == maybe_normalize_large_imms(line2.original): - out1 = line1.original - out2 = line2.original - elif line1.diff_row == "": - out1 = f"{Style.BRIGHT}{Fore.LIGHTBLACK_EX}{line1.original}" - out2 = f"{Style.BRIGHT}{Fore.LIGHTBLACK_EX}{line2.original}" - else: - mnemonic = line1.original.split()[0] - out1, out2 = line1.original, line2.original - branch1 = branch2 = "" - if mnemonic in instructions_with_address_immediates: - out1, branch1 = split_off_branch(line1.original) - out2, branch2 = split_off_branch(line2.original) - branchless1 = out1 - branchless2 = out2 - out1, out2 = color_imms(out1, out2) + same_relative_target = False + if line1.branch_target is not None and line2.branch_target is not None: + relative_target1 = eval_line_num( + line1.branch_target + ) - eval_line_num(line1.line_num) + relative_target2 = eval_line_num( + line2.branch_target + ) - eval_line_num(line2.line_num) + same_relative_target = relative_target1 == relative_target2 - same_relative_target = False - if line1.branch_target is not None and line2.branch_target is not None: - relative_target1 = eval_line_num(line1.branch_target) - eval_line_num(line1.line_num) - relative_target2 = eval_line_num(line2.branch_target) - eval_line_num(line2.line_num) - same_relative_target = relative_target1 == relative_target2 + if not same_relative_target: + branch1, branch2 = color_branch_imms(branch1, branch2) + out1 += branch1 + out2 += branch2 + if normalize_imms(branchless1) == normalize_imms(branchless2): if not same_relative_target: - branch1, branch2 = color_branch_imms(branch1, branch2) - - out1 += branch1 - out2 += branch2 - if normalize_imms(branchless1) == normalize_imms(branchless2): - if not same_relative_target: - # only imms differences - sym_color = Fore.LIGHTBLUE_EX - line_prefix = "i" - else: - out1 = re.sub( - re_sprel, lambda s: sc3.color_symbol(s.group()), out1, - ) - out2 = re.sub( - re_sprel, lambda s: sc4.color_symbol(s.group()), out2, - ) - if normalize_stack(branchless1) == normalize_stack(branchless2): - # only stack differences (luckily stack and imm - # differences can't be combined in MIPS, so we - # don't have to think about that case) - sym_color = Fore.YELLOW - line_prefix = "s" - else: - # regs differences and maybe imms as well - out1 = re.sub( - re_reg, lambda s: sc1.color_symbol(s.group()), out1 - ) - out2 = re.sub( - re_reg, lambda s: sc2.color_symbol(s.group()), out2 - ) - line_color1 = line_color2 = sym_color = Fore.YELLOW - line_prefix = "r" - elif line1 and line2: - line_prefix = "|" - line_color1 = Fore.LIGHTBLUE_EX - line_color2 = Fore.LIGHTBLUE_EX - sym_color = Fore.LIGHTBLUE_EX - out1 = line1.original - out2 = line2.original - elif line1: - line_prefix = "<" - line_color1 = line_color2 = sym_color = Fore.RED - out1 = line1.original - out2 = "" - elif line2: - line_prefix = ">" - line_color1 = line_color2 = sym_color = Fore.GREEN - out1 = "" - out2 = line2.original - - in_arrow1 = " " - in_arrow2 = " " - out_arrow1 = "" - out_arrow2 = "" - - if args.show_branches and line1: - if line1.line_num in bts1: - in_arrow1 = sc5.color_symbol(line1.line_num, "~>") + line_color1 - if line1.branch_target is not None: - out_arrow1 = " " + sc5.color_symbol(line1.branch_target + ":", "~>") - if args.show_branches and line2: - if line2.line_num in bts2: - in_arrow2 = sc6.color_symbol(line2.line_num, "~>") + line_color2 - if line2.branch_target is not None: - out_arrow2 = " " + sc6.color_symbol(line2.branch_target + ":", "~>") - - if args.source and line2 and line2.comment: - out2 += f" {line2.comment}" - - line_num1 = line1.line_num if line1 else "" - line_num2 = line2.line_num if line2 else "" - - out1 = f"{line_color1}{line_num1} {in_arrow1} {out1}{Style.RESET_ALL}{out_arrow1}" - out2 = f"{line_color2}{line_num2} {in_arrow2} {out2}{Style.RESET_ALL}{out_arrow2}" - mid = f"{sym_color}{line_prefix} " - - if line2: - for source_line in line2.source_lines: - color = Style.DIM - # File names and function names - if source_line and source_line[0] != "|": - color += Style.BRIGHT - # Function names - if source_line.endswith("():"): - # Underline. Colorama does not provide this feature, unfortunately. - color += "\u001b[4m" - try: - source_line = cxxfilt.demangle( - source_line[:-3], external_only=False - ) - except: - pass - output.append( - format_single_line_diff( - "", - f" {color}{source_line}{Style.RESET_ALL}", - args.column_width, - ) + # only imms differences + sym_color = Fore.LIGHTBLUE_EX + line_prefix = "i" + else: + out1, out2 = color_fields( + re_sprel, out1, out2, sc3.color_symbol, sc4.color_symbol ) + if normalize_stack(branchless1) == normalize_stack(branchless2): + # only stack differences (luckily stack and imm + # differences can't be combined in MIPS, so we + # don't have to think about that case) + sym_color = Fore.YELLOW + line_prefix = "s" + else: + # regs differences and maybe imms as well + out1, out2 = color_fields( + re_reg, out1, out2, sc1.color_symbol, sc2.color_symbol + ) + line_color1 = line_color2 = sym_color = Fore.YELLOW + line_prefix = "r" + elif line1 and line2: + line_prefix = "|" + line_color1 = Fore.LIGHTBLUE_EX + line_color2 = Fore.LIGHTBLUE_EX + sym_color = Fore.LIGHTBLUE_EX + out1 = line1.original + out2 = line2.original + elif line1: + line_prefix = "<" + line_color1 = sym_color = Fore.RED + out1 = line1.original + out2 = "" + elif line2: + line_prefix = ">" + line_color2 = sym_color = Fore.GREEN + out1 = "" + out2 = line2.original - output.append(format_single_line_diff(out1, mid + out2, args.column_width)) + if args.source and line2 and line2.comment: + out2 += f" {line2.comment}" - return output[args.skip_lines :] + def format_part( + out: str, + line: Optional[Line], + line_color: str, + btset: Set[str], + sc: SymbolColorer, + ) -> Optional[str]: + if line is None: + return None + in_arrow = " " + out_arrow = "" + if args.show_branches: + if line.line_num in btset: + in_arrow = sc.color_symbol(line.line_num, "~>") + line_color + if line.branch_target is not None: + out_arrow = " " + sc.color_symbol(line.branch_target + ":", "~>") + out = pad_mnemonic(out) + return f"{line_color}{line.line_num} {in_arrow} {out}{Style.RESET_ALL}{out_arrow}" + + part1 = format_part(out1, line1, line_color1, bts1, sc5) + part2 = format_part(out2, line2, line_color2, bts2, sc6) + key2 = line2.original if line2 else None + + mid = f"{sym_color}{line_prefix}" + + if line2: + for source_line in line2.source_lines: + color = Style.DIM + # File names and function names + if source_line and source_line[0] != "│": + color += Style.BRIGHT + # Function names + if source_line.endswith("():"): + # Underline. Colorama does not provide this feature, unfortunately. + color += "\u001b[4m" + try: + source_line = cxxfilt.demangle( + source_line[:-3], external_only=False + ) + except: + pass + output.append( + OutputLine( + None, + f" {color}{source_line}{Style.RESET_ALL}", + source_line, + ) + ) + + fmt2 = mid + " " + (part2 or "") + output.append(OutputLine(part1, fmt2, key2)) + + return output -def debounced_fs_watch(targets, outq, debounce_delay): - import watchdog.events - import watchdog.observers +def chunk_diff(diff: List[OutputLine]) -> List[Union[List[OutputLine], OutputLine]]: + cur_right: List[OutputLine] = [] + chunks: List[Union[List[OutputLine], OutputLine]] = [] + for output_line in diff: + if output_line.base is not None: + chunks.append(cur_right) + chunks.append(output_line) + cur_right = [] + else: + cur_right.append(output_line) + chunks.append(cur_right) + return chunks - class WatchEventHandler(watchdog.events.FileSystemEventHandler): - def __init__(self, queue, file_targets): + +def format_diff( + old_diff: List[OutputLine], new_diff: List[OutputLine] +) -> Tuple[str, List[str]]: + old_chunks = chunk_diff(old_diff) + new_chunks = chunk_diff(new_diff) + output: List[Tuple[str, OutputLine, OutputLine]] = [] + assert len(old_chunks) == len(new_chunks), "same target" + empty = OutputLine("", "", None) + for old_chunk, new_chunk in zip(old_chunks, new_chunks): + if isinstance(old_chunk, list): + assert isinstance(new_chunk, list) + if not old_chunk and not new_chunk: + # Most of the time lines sync up without insertions/deletions, + # and there's no interdiffing to be done. + continue + differ = difflib.SequenceMatcher(a=old_chunk, b=new_chunk, autojunk=False) + for (tag, i1, i2, j1, j2) in differ.get_opcodes(): + if tag in ["equal", "replace"]: + for i, j in zip(range(i1, i2), range(j1, j2)): + output.append(("", old_chunk[i], new_chunk[j])) + if tag in ["insert", "replace"]: + for j in range(j1 + i2 - i1, j2): + output.append(("", empty, new_chunk[j])) + if tag in ["delete", "replace"]: + for i in range(i1 + j2 - j1, i2): + output.append(("", old_chunk[i], empty)) + else: + assert isinstance(new_chunk, OutputLine) + assert new_chunk.base + # old_chunk.base and new_chunk.base have the same text since + # both diffs are based on the same target, but they might + # differ in color. Use the new version. + output.append((new_chunk.base, old_chunk, new_chunk)) + + # TODO: status line, with e.g. approximate permuter score? + width = args.column_width + if args.threeway: + header_line = "TARGET".ljust(width) + " CURRENT".ljust(width) + " PREVIOUS" + diff_lines = [ + ansi_ljust(base, width) + + ansi_ljust(new.fmt2, width) + + (old.fmt2 or "-" if old != new else "") + for (base, old, new) in output + ] + else: + header_line = "" + diff_lines = [ + ansi_ljust(base, width) + new.fmt2 + for (base, old, new) in output + if base or new.key2 is not None + ] + return header_line, diff_lines + + +def debounced_fs_watch( + targets: List[str], + outq: "queue.Queue[Optional[float]]", + debounce_delay: float, +) -> None: + import watchdog.events # type: ignore + import watchdog.observers # type: ignore + + class WatchEventHandler(watchdog.events.FileSystemEventHandler): # type: ignore + def __init__( + self, queue: "queue.Queue[float]", file_targets: List[str] + ) -> None: self.queue = queue self.file_targets = file_targets - def on_modified(self, ev): + def on_modified(self, ev: object) -> None: if isinstance(ev, watchdog.events.FileModifiedEvent): self.changed(ev.src_path) - def on_moved(self, ev): + def on_moved(self, ev: object) -> None: if isinstance(ev, watchdog.events.FileMovedEvent): self.changed(ev.dest_path) - def should_notify(self, path): + def should_notify(self, path: str) -> bool: for target in self.file_targets: if path == target: return True @@ -938,13 +1299,13 @@ def debounced_fs_watch(targets, outq, debounce_delay): return True return False - def changed(self, path): + def changed(self, path: str) -> None: if self.should_notify(path): self.queue.put(time.time()) - def debounce_thread(): - listenq = queue.Queue() - file_targets = [] + def debounce_thread() -> NoReturn: + listenq: "queue.Queue[float]" = queue.Queue() + file_targets: List[str] = [] event_handler = WatchEventHandler(listenq, file_targets) observer = watchdog.observers.Observer() observed = set() @@ -980,16 +1341,32 @@ def debounced_fs_watch(targets, outq, debounce_delay): class Display: - def __init__(self, basedump, mydump): + basedump: str + mydump: str + emsg: Optional[str] + last_diff_output: Optional[List[OutputLine]] + pending_update: Optional[Tuple[str, bool]] + ready_queue: "queue.Queue[None]" + watch_queue: "queue.Queue[Optional[float]]" + less_proc: "Optional[subprocess.Popen[bytes]]" + + def __init__(self, basedump: str, mydump: str) -> None: self.basedump = basedump self.mydump = mydump self.emsg = None + self.last_diff_output = None - def run_less(self): + def run_less(self) -> "Tuple[subprocess.Popen[bytes], subprocess.Popen[bytes]]": if self.emsg is not None: output = self.emsg else: - output = "\n".join(do_diff(self.basedump, self.mydump)) + diff_output = do_diff(self.basedump, self.mydump) + last_diff_output = self.last_diff_output or diff_output + if args.threeway != "base" or not self.last_diff_output: + self.last_diff_output = diff_output + header, diff_lines = format_diff(last_diff_output, diff_output) + header_lines = [header] if header else [] + output = "\n".join(header_lines + diff_lines[args.skip_lines :]) # Pipe the output through 'tail' and only then to less, to ensure the # write call doesn't block. ('tail' has to buffer all its input before @@ -999,17 +1376,19 @@ class Display: BUFFER_CMD, stdin=subprocess.PIPE, stdout=subprocess.PIPE ) less_proc = subprocess.Popen(LESS_CMD, stdin=buffer_proc.stdout) + assert buffer_proc.stdin + assert buffer_proc.stdout buffer_proc.stdin.write(output.encode()) buffer_proc.stdin.close() buffer_proc.stdout.close() return (buffer_proc, less_proc) - def run_sync(self): + def run_sync(self) -> None: proca, procb = self.run_less() procb.wait() proca.wait() - def run_async(self, watch_queue): + def run_async(self, watch_queue: "queue.Queue[Optional[float]]") -> None: self.watch_queue = watch_queue self.ready_queue = queue.Queue() self.pending_update = None @@ -1017,10 +1396,10 @@ class Display: dthread.start() self.ready_queue.get() - def display_thread(self): + def display_thread(self) -> None: proca, procb = self.run_less() self.less_proc = procb - self.ready_queue.put(0) + self.ready_queue.put(None) while True: ret = procb.wait() proca.wait() @@ -1039,19 +1418,19 @@ class Display: self.emsg = msg proca, procb = self.run_less() self.less_proc = procb - self.ready_queue.put(0) + self.ready_queue.put(None) else: # terminated by user, or killed self.watch_queue.put(None) - self.ready_queue.put(0) + self.ready_queue.put(None) break - def progress(self, msg): + def progress(self, msg: str) -> None: # Write message to top-left corner sys.stdout.write("\x1b7\x1b[1;1f{}\x1b8".format(msg + " ")) sys.stdout.flush() - def update(self, text, error): + def update(self, text: str, error: bool) -> None: if not error and not self.emsg and text == self.mydump: self.progress("Unchanged. ") return @@ -1061,14 +1440,14 @@ class Display: self.less_proc.kill() self.ready_queue.get() - def terminate(self): + def terminate(self) -> None: if not self.less_proc: return self.less_proc.kill() self.ready_queue.get() -def main(): +def main() -> None: if args.diff_elf_symbol: make_target, basecmd, mycmd = dump_elf() elif args.diff_obj: @@ -1098,23 +1477,27 @@ def main(): else: if not args.make: yn = input( - "Warning: watch-mode (-w) enabled without auto-make (-m). You will have to run make manually. Ok? (Y/n) " + "Warning: watch-mode (-w) enabled without auto-make (-m). " + "You will have to run make manually. Ok? (Y/n) " ) if yn.lower() == "n": return if args.make: watch_sources = None - if hasattr(diff_settings, "watch_sources_for_target"): - watch_sources = diff_settings.watch_sources_for_target(make_target) + watch_sources_for_target_fn = getattr( + diff_settings, "watch_sources_for_target", None + ) + if watch_sources_for_target_fn: + watch_sources = watch_sources_for_target_fn(make_target) watch_sources = watch_sources or source_directories if not watch_sources: fail("Missing source_directories config, don't know what to watch.") else: watch_sources = [make_target] - q = queue.Queue() + q: "queue.Queue[Optional[float]]" = queue.Queue() debounced_fs_watch(watch_sources, q, DEBOUNCE_DELAY) display.run_async(q) - last_build = 0 + last_build = 0.0 try: while True: t = q.get() @@ -1125,7 +1508,7 @@ def main(): last_build = time.time() if args.make: display.progress("Building...") - ret = run_make(make_target, capture_output=True) + ret = run_make_capture_output(make_target) if ret.returncode != 0: display.update( ret.stderr.decode("utf-8-sig", "replace") diff --git a/diff_settings.py b/diff_settings.py index c1cd3a5f..933ccb37 100644 --- a/diff_settings.py +++ b/diff_settings.py @@ -17,4 +17,4 @@ def apply(config, args): config['myimg'] = f'build/{lang}/sm64.{lang}.z64' config['baseimg'] = f'baserom.{lang}.z64' config['makeflags'] = [f'VERSION={lang}'] - config['source_directories'] = ['src', 'include'] + config['source_directories'] = ['src', 'include', 'lib', 'lib/src', 'asm', 'rsp'] diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 00c242e5..c124d653 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -1,7 +1,6 @@ ## [:rewind: Lua Reference](lua.md) # Supported Constants -- [audio_defines.h](#audio_definesh) - [behavior_table.h](#behavior_tableh) - [enum BehaviorId](#enum-BehaviorId) - [camera.h](#camerah) @@ -36,491 +35,13 @@ - [enum LuaHookedEventType](#enum-LuaHookedEventType) - [smlua_model_utils.h](#smlua_model_utilsh) - [enum ModelExtendedId](#enum-ModelExtendedId) +- [sounds.h](#soundsh) - [types.h](#typesh) - [enum AreaTimerType](#enum-AreaTimerType) - [enum SpTaskState](#enum-SpTaskState)
-## [audio_defines.h](#audio_defines.h) -- NO_SOUND -- SOUNDARGS_MASK_BANK -- SOUNDARGS_MASK_PRIORITY -- SOUNDARGS_MASK_SOUNDID -- SOUNDARGS_MASK_STATUS -- SOUNDARGS_SHIFT_BANK -- SOUNDARGS_SHIFT_PRIORITY -- SOUNDARGS_SHIFT_SOUNDID -- SOUND_ACTION_BONK -- SOUND_ACTION_BOUNCE_OFF_OBJECT -- SOUND_ACTION_BRUSH_HAIR -- SOUND_ACTION_CLAP_HANDS_COLD -- SOUND_ACTION_CLIMB_DOWN_TREE -- SOUND_ACTION_CLIMB_UP_POLE -- SOUND_ACTION_CLIMB_UP_TREE -- SOUND_ACTION_FLYING_FAST -- SOUND_ACTION_HANGING_STEP -- SOUND_ACTION_HIT -- SOUND_ACTION_HIT_2 -- SOUND_ACTION_HIT_3 -- SOUND_ACTION_INTRO_UNK45E -- SOUND_ACTION_INTRO_UNK45F -- SOUND_ACTION_KEY_SWISH -- SOUND_ACTION_METAL_BONK -- SOUND_ACTION_METAL_HEAVY_LANDING -- SOUND_ACTION_METAL_JUMP -- SOUND_ACTION_METAL_JUMP_WATER -- SOUND_ACTION_METAL_LANDING -- SOUND_ACTION_METAL_LAND_WATER -- SOUND_ACTION_METAL_STEP -- SOUND_ACTION_METAL_STEP_TIPTOE -- SOUND_ACTION_METAL_STEP_WATER -- SOUND_ACTION_PAT_BACK -- SOUND_ACTION_QUICKSAND_STEP -- SOUND_ACTION_READ_SIGN -- SOUND_ACTION_SHRINK_INTO_BBH -- SOUND_ACTION_SIDE_FLIP_UNK -- SOUND_ACTION_SPIN -- SOUND_ACTION_SWIM -- SOUND_ACTION_SWIM_FAST -- SOUND_ACTION_TELEPORT -- SOUND_ACTION_TERRAIN_BODY_HIT_GROUND -- SOUND_ACTION_TERRAIN_HEAVY_LANDING -- SOUND_ACTION_TERRAIN_JUMP -- SOUND_ACTION_TERRAIN_LANDING -- SOUND_ACTION_TERRAIN_STEP -- SOUND_ACTION_TERRAIN_STEP_TIPTOE -- SOUND_ACTION_TERRAIN_STUCK_IN_GROUND -- SOUND_ACTION_THROW -- SOUND_ACTION_TWIRL -- SOUND_ACTION_UNK3C -- SOUND_ACTION_UNK53 -- SOUND_ACTION_UNK54 -- SOUND_ACTION_UNK55 -- SOUND_ACTION_UNK5D -- SOUND_ACTION_UNKNOWN430 -- SOUND_ACTION_UNKNOWN431 -- SOUND_ACTION_UNKNOWN432 -- SOUND_ACTION_UNKNOWN434 -- SOUND_ACTION_UNKNOWN43D -- SOUND_ACTION_UNKNOWN43E -- SOUND_ACTION_UNKNOWN458 -- SOUND_ACTION_UNKNOWN45C -- SOUND_ACTION_UNSTUCK_FROM_GROUND -- SOUND_AIR_AMP_BUZZ -- SOUND_AIR_BLOW_FIRE -- SOUND_AIR_BLOW_WIND -- SOUND_AIR_BOBOMB_LIT_FUSE -- SOUND_AIR_BOWSER_SPIT_FIRE -- SOUND_AIR_CASTLE_OUTDOORS_AMBIENT -- SOUND_AIR_CHUCKYA_MOVE -- SOUND_AIR_HEAVEHO_MOVE -- SOUND_AIR_HOWLING_WIND -- SOUND_AIR_LAKITU_FLY -- SOUND_AIR_LAKITU_FLY_HIGHPRIO -- SOUND_AIR_PEACH_TWINKLE -- SOUND_AIR_ROUGH_SLIDE -- SOUND_AIR_UNK01 -- SOUND_AIR_UNK07 -- SOUND_ENV_BOAT_ROCKING1 -- SOUND_ENV_DRONING1 -- SOUND_ENV_DRONING2 -- SOUND_ENV_ELEVATOR1 -- SOUND_ENV_ELEVATOR2 -- SOUND_ENV_ELEVATOR3 -- SOUND_ENV_ELEVATOR4 -- SOUND_ENV_ELEVATOR4_2 -- SOUND_ENV_MERRY_GO_ROUND_CREAKING -- SOUND_ENV_METAL_BOX_PUSH -- SOUND_ENV_MOVINGSAND -- SOUND_ENV_MOVING_SAND_SNOW -- SOUND_ENV_SINK_QUICKSAND -- SOUND_ENV_SLIDING -- SOUND_ENV_STAR -- SOUND_ENV_UNK07 -- SOUND_ENV_UNK12 -- SOUND_ENV_UNKNOWN2 -- SOUND_ENV_UNKNOWN4 -- SOUND_ENV_WATER -- SOUND_ENV_WATERFALL1 -- SOUND_ENV_WATERFALL2 -- SOUND_ENV_WATER_DRAIN -- SOUND_ENV_WIND1 -- SOUND_ENV_WIND2 -- SOUND_GENERAL2_1UP_APPEAR -- SOUND_GENERAL2_BIRD_CHIRP2 -- SOUND_GENERAL2_BOBOMB_EXPLOSION -- SOUND_GENERAL2_BOWSER_EXPLODE -- SOUND_GENERAL2_BOWSER_KEY -- SOUND_GENERAL2_PURPLE_SWITCH -- SOUND_GENERAL2_PYRAMID_TOP_EXPLOSION -- SOUND_GENERAL2_PYRAMID_TOP_SPIN -- SOUND_GENERAL2_RIGHT_ANSWER -- SOUND_GENERAL2_ROTATING_BLOCK_ALERT -- SOUND_GENERAL2_ROTATING_BLOCK_CLICK -- SOUND_GENERAL2_SPINDEL_ROLL -- SOUND_GENERAL2_STAR_APPEARS -- SOUND_GENERAL2_SWITCH_TICK_FAST -- SOUND_GENERAL2_SWITCH_TICK_SLOW -- SOUND_GENERAL_ACTIVATE_CAP_SWITCH -- SOUND_GENERAL_BIG_CLOCK -- SOUND_GENERAL_BIG_POUND -- SOUND_GENERAL_BIRDS_FLY_AWAY -- SOUND_GENERAL_BOAT_ROCK -- SOUND_GENERAL_BOAT_TILT1 -- SOUND_GENERAL_BOAT_TILT2 -- SOUND_GENERAL_BOING1 -- SOUND_GENERAL_BOING2 -- SOUND_GENERAL_BOING2_LOWPRIO -- SOUND_GENERAL_BOING3 -- SOUND_GENERAL_BOWSER_BOMB_EXPLOSION -- SOUND_GENERAL_BOWSER_PLATFORM -- SOUND_GENERAL_BOWSER_PLATFORM_2 -- SOUND_GENERAL_BOX_LANDING -- SOUND_GENERAL_BOX_LANDING_2 -- SOUND_GENERAL_BREAK_BOX -- SOUND_GENERAL_BUBBLES -- SOUND_GENERAL_BUTTON_PRESS -- SOUND_GENERAL_BUTTON_PRESS_2 -- SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO -- SOUND_GENERAL_BUTTON_PRESS_LOWPRIO -- SOUND_GENERAL_CAGE_OPEN -- SOUND_GENERAL_CANNON_UP -- SOUND_GENERAL_CASTLE_TRAP_OPEN -- SOUND_GENERAL_CHAIN_CHOMP1 -- SOUND_GENERAL_CHAIN_CHOMP2 -- SOUND_GENERAL_CLAM_SHELL1 -- SOUND_GENERAL_CLAM_SHELL2 -- SOUND_GENERAL_CLAM_SHELL3 -- SOUND_GENERAL_CLOSE_IRON_DOOR -- SOUND_GENERAL_CLOSE_WOOD_DOOR -- SOUND_GENERAL_COIN -- SOUND_GENERAL_COIN_DROP -- SOUND_GENERAL_COIN_SPURT -- SOUND_GENERAL_COIN_SPURT_2 -- SOUND_GENERAL_COIN_SPURT_EU -- SOUND_GENERAL_COIN_WATER -- SOUND_GENERAL_COLLECT_1UP -- SOUND_GENERAL_DONUT_PLATFORM_EXPLOSION -- SOUND_GENERAL_DOOR_INSERT_KEY -- SOUND_GENERAL_DOOR_TURN_KEY -- SOUND_GENERAL_ELEVATOR_MOVE -- SOUND_GENERAL_ELEVATOR_MOVE_2 -- SOUND_GENERAL_ENEMY_ALERT1 -- SOUND_GENERAL_EXPLOSION6 -- SOUND_GENERAL_EXPLOSION7 -- SOUND_GENERAL_FLAME_OUT -- SOUND_GENERAL_GRAND_STAR -- SOUND_GENERAL_GRAND_STAR_JUMP -- SOUND_GENERAL_GRINDEL_ROLL -- SOUND_GENERAL_HAUNTED_CHAIR -- SOUND_GENERAL_HAUNTED_CHAIR_MOVE -- SOUND_GENERAL_HEART_SPIN -- SOUND_GENERAL_LEVEL_SELECT_CHANGE -- SOUND_GENERAL_LOUD_POUND -- SOUND_GENERAL_LOUD_POUND2 -- SOUND_GENERAL_METAL_POUND -- SOUND_GENERAL_MOVING_IN_SAND -- SOUND_GENERAL_MOVING_PLATFORM_SWITCH -- SOUND_GENERAL_MOVING_WATER -- SOUND_GENERAL_OPEN_CHEST -- SOUND_GENERAL_OPEN_IRON_DOOR -- SOUND_GENERAL_OPEN_WOOD_DOOR -- SOUND_GENERAL_PAINTING_EJECT -- SOUND_GENERAL_PENDULUM_SWING -- SOUND_GENERAL_PLATFORM -- SOUND_GENERAL_POUND_ROCK -- SOUND_GENERAL_POUND_WOOD_POST -- SOUND_GENERAL_QUIET_BUBBLE -- SOUND_GENERAL_QUIET_BUBBLE2 -- SOUND_GENERAL_QUIET_POUND1 -- SOUND_GENERAL_QUIET_POUND1_LOWPRIO -- SOUND_GENERAL_QUIET_POUND2 -- SOUND_GENERAL_RACE_GUN_SHOT -- SOUND_GENERAL_RED_COIN -- SOUND_GENERAL_SHAKE_COFFIN -- SOUND_GENERAL_SHORT_POUND1 -- SOUND_GENERAL_SHORT_POUND2 -- SOUND_GENERAL_SHORT_POUND3 -- SOUND_GENERAL_SHORT_POUND4 -- SOUND_GENERAL_SHORT_POUND5 -- SOUND_GENERAL_SHORT_POUND6 -- SOUND_GENERAL_SHORT_STAR -- SOUND_GENERAL_SOFT_LANDING -- SOUND_GENERAL_SPLATTERING -- SOUND_GENERAL_STAR_APPEARS -- SOUND_GENERAL_STAR_DOOR_CLOSE -- SOUND_GENERAL_STAR_DOOR_OPEN -- SOUND_GENERAL_SWISH_AIR -- SOUND_GENERAL_SWISH_AIR_2 -- SOUND_GENERAL_SWISH_WATER -- SOUND_GENERAL_SWITCH_DOOR_OPEN -- SOUND_GENERAL_UNK32 -- SOUND_GENERAL_UNK45 -- SOUND_GENERAL_UNK46 -- SOUND_GENERAL_UNK46_LOWPRIO -- SOUND_GENERAL_UNKNOWN1 -- SOUND_GENERAL_UNKNOWN1_2 -- SOUND_GENERAL_UNKNOWN3 -- SOUND_GENERAL_UNKNOWN3_2 -- SOUND_GENERAL_UNKNOWN3_LOWPRIO -- SOUND_GENERAL_UNKNOWN4 -- SOUND_GENERAL_UNKNOWN4_LOWPRIO -- SOUND_GENERAL_VANISH_SFX -- SOUND_GENERAL_VOLCANO_EXPLOSION -- SOUND_GENERAL_WALL_EXPLOSION -- SOUND_GENERAL_WATER_LEVEL_TRIG -- SOUND_GENERAL_YOSHI_TALK -- SOUND_GENERAL_YOSHI_WALK -- SOUND_LO_BITFLAG_UNK1 -- SOUND_LO_BITFLAG_UNK8 -- SOUND_MARIO_ATTACKED -- SOUND_MARIO_COUGHING1 -- SOUND_MARIO_COUGHING2 -- SOUND_MARIO_COUGHING3 -- SOUND_MARIO_DOH -- SOUND_MARIO_DROWNING -- SOUND_MARIO_DYING -- SOUND_MARIO_EEUH -- SOUND_MARIO_GAME_OVER -- SOUND_MARIO_GROUND_POUND_WAH -- SOUND_MARIO_HAHA -- SOUND_MARIO_HAHA_2 -- SOUND_MARIO_HELLO -- SOUND_MARIO_HERE_WE_GO -- SOUND_MARIO_HOOHOO -- SOUND_MARIO_HRMM -- SOUND_MARIO_IMA_TIRED -- SOUND_MARIO_MAMA_MIA -- SOUND_MARIO_OKEY_DOKEY -- SOUND_MARIO_ON_FIRE -- SOUND_MARIO_OOOF -- SOUND_MARIO_OOOF2 -- SOUND_MARIO_PANTING -- SOUND_MARIO_PANTING_COLD -- SOUND_MARIO_PRESS_START_TO_PLAY -- SOUND_MARIO_PUNCH_HOO -- SOUND_MARIO_PUNCH_WAH -- SOUND_MARIO_PUNCH_YAH -- SOUND_MARIO_SNORING1 -- SOUND_MARIO_SNORING2 -- SOUND_MARIO_SNORING3 -- SOUND_MARIO_SO_LONGA_BOWSER -- SOUND_MARIO_TWIRL_BOUNCE -- SOUND_MARIO_UH -- SOUND_MARIO_UH2 -- SOUND_MARIO_UH2_2 -- SOUND_MARIO_WAAAOOOW -- SOUND_MARIO_WAH2 -- SOUND_MARIO_WHOA -- SOUND_MARIO_YAHOO -- SOUND_MARIO_YAHOO_WAHA_YIPPEE -- SOUND_MARIO_YAH_WAH_HOO -- SOUND_MARIO_YAWNING -- SOUND_MENU_BOWSER_LAUGH -- SOUND_MENU_CAMERA_BUZZ -- SOUND_MENU_CAMERA_TURN -- SOUND_MENU_CAMERA_UNUSED1 -- SOUND_MENU_CAMERA_UNUSED2 -- SOUND_MENU_CAMERA_ZOOM_IN -- SOUND_MENU_CAMERA_ZOOM_OUT -- SOUND_MENU_CHANGE_SELECT -- SOUND_MENU_CLICK_CHANGE_VIEW -- SOUND_MENU_CLICK_FILE_SELECT -- SOUND_MENU_COIN_ITS_A_ME_MARIO -- SOUND_MENU_COLLECT_RED_COIN -- SOUND_MENU_COLLECT_SECRET -- SOUND_MENU_ENTER_HOLE -- SOUND_MENU_ENTER_PIPE -- SOUND_MENU_EXIT_A_SIGN -- SOUND_MENU_EXIT_PIPE -- SOUND_MENU_HAND_APPEAR -- SOUND_MENU_HAND_DISAPPEAR -- SOUND_MENU_LET_GO_MARIO_FACE -- SOUND_MENU_MARIO_CASTLE_WARP -- SOUND_MENU_MARIO_CASTLE_WARP2 -- SOUND_MENU_MESSAGE_APPEAR -- SOUND_MENU_MESSAGE_DISAPPEAR -- SOUND_MENU_MESSAGE_NEXT_PAGE -- SOUND_MENU_PAUSE -- SOUND_MENU_PAUSE_2 -- SOUND_MENU_PAUSE_HIGHPRIO -- SOUND_MENU_PINCH_MARIO_FACE -- SOUND_MENU_POWER_METER -- SOUND_MENU_READ_A_SIGN -- SOUND_MENU_REVERSE_PAUSE -- SOUND_MENU_STAR_SOUND -- SOUND_MENU_STAR_SOUND_LETS_A_GO -- SOUND_MENU_STAR_SOUND_OKEY_DOKEY -- SOUND_MENU_THANK_YOU_PLAYING_MY_GAME -- SOUND_MENU_UNK0C -- SOUND_MENU_UNK10 -- SOUND_MENU_YOSHI_GAIN_LIVES -- SOUND_MOVING_AIM_CANNON -- SOUND_MOVING_ALMOST_DROWNING -- SOUND_MOVING_FLYING -- SOUND_MOVING_LAVA_BURN -- SOUND_MOVING_QUICKSAND_DEATH -- SOUND_MOVING_RIDING_SHELL_LAVA -- SOUND_MOVING_SHOCKED -- SOUND_MOVING_SLIDE_DOWN_POLE -- SOUND_MOVING_SLIDE_DOWN_TREE -- SOUND_MOVING_TERRAIN_RIDING_SHELL -- SOUND_MOVING_TERRAIN_SLIDE -- SOUND_MOVING_UNK1A -- SOUND_NO_ECHO -- SOUND_NO_FREQUENCY_LOSS -- SOUND_NO_PRIORITY_LOSS -- SOUND_NO_VOLUME_LOSS -- SOUND_OBJ2_BABY_PENGUIN_YELL -- SOUND_OBJ2_BIRD_CHIRP1 -- SOUND_OBJ2_BOSS_DIALOG_GRUNT -- SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE -- SOUND_OBJ2_BOWSER_ROAR -- SOUND_OBJ2_BOWSER_TELEPORT -- SOUND_OBJ2_BULLY_ATTACKED -- SOUND_OBJ2_EYEROK_SOUND_LONG -- SOUND_OBJ2_EYEROK_SOUND_SHORT -- SOUND_OBJ2_KING_BOBOMB_DAMAGE -- SOUND_OBJ2_LARGE_BULLY_ATTACKED -- SOUND_OBJ2_MONTY_MOLE_APPEAR -- SOUND_OBJ2_MRI_SPINNING -- SOUND_OBJ2_PIRANHA_PLANT_BITE -- SOUND_OBJ2_PIRANHA_PLANT_DYING -- SOUND_OBJ2_SCUTTLEBUG_ALERT -- SOUND_OBJ2_SCUTTLEBUG_WALK -- SOUND_OBJ2_SWOOP -- SOUND_OBJ2_WHOMP_SOUND_SHORT -- SOUND_OBJ_BABY_PENGUIN_DIVE -- SOUND_OBJ_BABY_PENGUIN_WALK -- SOUND_OBJ_BIG_PENGUIN_WALK -- SOUND_OBJ_BIG_PENGUIN_YELL -- SOUND_OBJ_BIRD_CHIRP3 -- SOUND_OBJ_BOBOMB_BUDDY_TALK -- SOUND_OBJ_BOBOMB_WALK -- SOUND_OBJ_BOO_BOUNCE_TOP -- SOUND_OBJ_BOO_LAUGH_LONG -- SOUND_OBJ_BOO_LAUGH_SHORT -- SOUND_OBJ_BOWSER_DEFEATED -- SOUND_OBJ_BOWSER_INHALING -- SOUND_OBJ_BOWSER_INTRO_LAUGH -- SOUND_OBJ_BOWSER_LAUGH -- SOUND_OBJ_BOWSER_SPINNING -- SOUND_OBJ_BOWSER_TAIL_PICKUP -- SOUND_OBJ_BOWSER_WALK -- SOUND_OBJ_BUBBA_CHOMP -- SOUND_OBJ_BULLY_EXPLODE -- SOUND_OBJ_BULLY_EXPLODE_2 -- SOUND_OBJ_BULLY_METAL -- SOUND_OBJ_BULLY_WALK -- SOUND_OBJ_BULLY_WALKING -- SOUND_OBJ_CANNON1 -- SOUND_OBJ_CANNON2 -- SOUND_OBJ_CANNON3 -- SOUND_OBJ_CANNON4 -- SOUND_OBJ_CHUCKYA_DEATH -- SOUND_OBJ_DEFAULT_DEATH -- SOUND_OBJ_DIVING_INTO_WATER -- SOUND_OBJ_DIVING_IN_WATER -- SOUND_OBJ_DORRIE -- SOUND_OBJ_DYING_ENEMY1 -- SOUND_OBJ_DYING_ENEMY2 -- SOUND_OBJ_EEL -- SOUND_OBJ_EEL_2 -- SOUND_OBJ_ENEMY_DEATH_HIGH -- SOUND_OBJ_ENEMY_DEATH_LOW -- SOUND_OBJ_ENEMY_DEFEAT_SHRINK -- SOUND_OBJ_EVIL_LAKITU_THROW -- SOUND_OBJ_EYEROK_EXPLODE -- SOUND_OBJ_EYEROK_SHOW_EYE -- SOUND_OBJ_FLAME_BLOWN -- SOUND_OBJ_GOOMBA_ALERT -- SOUND_OBJ_GOOMBA_WALK -- SOUND_OBJ_HEAVEHO_TOSSED -- SOUND_OBJ_JUMP_WALK_WATER -- SOUND_OBJ_KING_BOBOMB -- SOUND_OBJ_KING_BOBOMB_JUMP -- SOUND_OBJ_KING_BOBOMB_TALK -- SOUND_OBJ_KING_WHOMP_DEATH -- SOUND_OBJ_KLEPTO1 -- SOUND_OBJ_KLEPTO2 -- SOUND_OBJ_KOOPA_DAMAGE -- SOUND_OBJ_KOOPA_FLYGUY_DEATH -- SOUND_OBJ_KOOPA_TALK -- SOUND_OBJ_KOOPA_THE_QUICK_WALK -- SOUND_OBJ_KOOPA_WALK -- SOUND_OBJ_MAD_PIANO_CHOMPING -- SOUND_OBJ_MIPS_RABBIT -- SOUND_OBJ_MIPS_RABBIT_WATER -- SOUND_OBJ_MONTY_MOLE_ATTACK -- SOUND_OBJ_MRI_DEATH -- SOUND_OBJ_MRI_SHOOT -- SOUND_OBJ_MR_BLIZZARD_ALERT -- SOUND_OBJ_PIRANHA_PLANT_APPEAR -- SOUND_OBJ_PIRANHA_PLANT_SHRINK -- SOUND_OBJ_POKEY_DEATH -- SOUND_OBJ_POUNDING1 -- SOUND_OBJ_POUNDING1_HIGHPRIO -- SOUND_OBJ_POUNDING_CANNON -- SOUND_OBJ_POUNDING_LOUD -- SOUND_OBJ_SKEETER_WALK -- SOUND_OBJ_SNOWMAN_BOUNCE -- SOUND_OBJ_SNOWMAN_EXPLODE -- SOUND_OBJ_SNOW_SAND1 -- SOUND_OBJ_SNOW_SAND2 -- SOUND_OBJ_SNUFIT_SHOOT -- SOUND_OBJ_SNUFIT_SKEETER_DEATH -- SOUND_OBJ_SOMETHING_LANDING -- SOUND_OBJ_SPINY_UNK59 -- SOUND_OBJ_STOMPED -- SOUND_OBJ_SUSHI_SHARK_WATER_SOUND -- SOUND_OBJ_SWOOP_DEATH -- SOUND_OBJ_THWOMP -- SOUND_OBJ_UKIKI_CHATTER_IDLE -- SOUND_OBJ_UKIKI_CHATTER_LONG -- SOUND_OBJ_UKIKI_CHATTER_SHORT -- SOUND_OBJ_UKIKI_STEP_DEFAULT -- SOUND_OBJ_UKIKI_STEP_LEAVES -- SOUND_OBJ_UNK23 -- SOUND_OBJ_UNKNOWN2 -- SOUND_OBJ_UNKNOWN3 -- SOUND_OBJ_UNKNOWN4 -- SOUND_OBJ_UNKNOWN6 -- SOUND_OBJ_WALKING_WATER -- SOUND_OBJ_WATER_BOMB_BOUNCING -- SOUND_OBJ_WHOMP_LOWPRIO -- SOUND_OBJ_WIGGLER_ATTACKED -- SOUND_OBJ_WIGGLER_DEATH -- SOUND_OBJ_WIGGLER_HIGH_PITCH -- SOUND_OBJ_WIGGLER_JUMP -- SOUND_OBJ_WIGGLER_LOW_PITCH -- SOUND_OBJ_WIGGLER_TALK -- SOUND_PEACH_BAKE_A_CAKE -- SOUND_PEACH_DEAR_MARIO -- SOUND_PEACH_FOR_MARIO -- SOUND_PEACH_MARIO -- SOUND_PEACH_MARIO2 -- SOUND_PEACH_POWER_OF_THE_STARS -- SOUND_PEACH_SOMETHING_SPECIAL -- SOUND_PEACH_THANKS_TO_YOU -- SOUND_PEACH_THANK_YOU_MARIO -- SOUND_STATUS_PLAYING -- SOUND_STATUS_STARTING -- SOUND_STATUS_STOPPED -- SOUND_TERRAIN_DEFAULT -- SOUND_TERRAIN_GRASS -- SOUND_TERRAIN_ICE -- SOUND_TERRAIN_SAND -- SOUND_TERRAIN_SNOW -- SOUND_TERRAIN_SPOOKY -- SOUND_TERRAIN_STONE -- SOUND_TERRAIN_WATER -- SOUND_VIBRATO - -[:arrow_up_small:](#) - -
- ## [behavior_table.h](#behavior_table.h) ### [enum BehaviorId](#BehaviorId) @@ -728,9 +249,9 @@ | id_bhvPenguinBaby | 199 | | id_bhvUnused20E0 | 200 | | id_bhvSmallPenguin | 201 | -| id_bhvFish2 | 202 | -| id_bhvFish3 | 203 | -| id_bhvLargeFishGroup | 204 | +| id_bhvManyBlueFishSpawner | 202 | +| id_bhvFewBlueFishSpawner | 203 | +| id_bhvFishSpawner | 204 | | id_bhvFish | 205 | | id_bhvWdwExpressElevator | 206 | | id_bhvWdwExpressElevatorPlatform | 207 | @@ -2728,6 +2249,504 @@
+## [sounds.h](#sounds.h) +- NO_SOUND +- SOUNDARGS_MASK_BANK +- SOUNDARGS_MASK_PRIORITY +- SOUNDARGS_MASK_SOUNDID +- SOUNDARGS_MASK_STATUS +- SOUNDARGS_SHIFT_BANK +- SOUNDARGS_SHIFT_PRIORITY +- SOUNDARGS_SHIFT_SOUNDID +- SOUND_ACTION_BONK +- SOUND_ACTION_BOUNCE_OFF_OBJECT +- SOUND_ACTION_BRUSH_HAIR +- SOUND_ACTION_CLAP_HANDS_COLD +- SOUND_ACTION_CLIMB_DOWN_TREE +- SOUND_ACTION_CLIMB_UP_POLE +- SOUND_ACTION_CLIMB_UP_TREE +- SOUND_ACTION_FLYING_FAST +- SOUND_ACTION_HANGING_STEP +- SOUND_ACTION_HIT +- SOUND_ACTION_HIT_2 +- SOUND_ACTION_HIT_3 +- SOUND_ACTION_INTRO_UNK45E +- SOUND_ACTION_INTRO_UNK45F +- SOUND_ACTION_KEY_SWISH +- SOUND_ACTION_METAL_BONK +- SOUND_ACTION_METAL_HEAVY_LANDING +- SOUND_ACTION_METAL_JUMP +- SOUND_ACTION_METAL_JUMP_WATER +- SOUND_ACTION_METAL_LANDING +- SOUND_ACTION_METAL_LAND_WATER +- SOUND_ACTION_METAL_STEP +- SOUND_ACTION_METAL_STEP_TIPTOE +- SOUND_ACTION_METAL_STEP_WATER +- SOUND_ACTION_PAT_BACK +- SOUND_ACTION_QUICKSAND_STEP +- SOUND_ACTION_READ_SIGN +- SOUND_ACTION_SHRINK_INTO_BBH +- SOUND_ACTION_SIDE_FLIP_UNK +- SOUND_ACTION_SPIN +- SOUND_ACTION_SWIM +- SOUND_ACTION_SWIM_FAST +- SOUND_ACTION_TELEPORT +- SOUND_ACTION_TERRAIN_BODY_HIT_GROUND +- SOUND_ACTION_TERRAIN_HEAVY_LANDING +- SOUND_ACTION_TERRAIN_JUMP +- SOUND_ACTION_TERRAIN_LANDING +- SOUND_ACTION_TERRAIN_STEP +- SOUND_ACTION_TERRAIN_STEP_TIPTOE +- SOUND_ACTION_TERRAIN_STUCK_IN_GROUND +- SOUND_ACTION_THROW +- SOUND_ACTION_TWIRL +- SOUND_ACTION_UNK3C +- SOUND_ACTION_UNK53 +- SOUND_ACTION_UNK54 +- SOUND_ACTION_UNK55 +- SOUND_ACTION_UNK5D +- SOUND_ACTION_UNKNOWN430 +- SOUND_ACTION_UNKNOWN431 +- SOUND_ACTION_UNKNOWN432 +- SOUND_ACTION_UNKNOWN434 +- SOUND_ACTION_UNKNOWN43D +- SOUND_ACTION_UNKNOWN43E +- SOUND_ACTION_UNKNOWN458 +- SOUND_ACTION_UNKNOWN45C +- SOUND_ACTION_UNSTUCK_FROM_GROUND +- SOUND_AIR_AMP_BUZZ +- SOUND_AIR_BLOW_FIRE +- SOUND_AIR_BLOW_WIND +- SOUND_AIR_BOBOMB_LIT_FUSE +- SOUND_AIR_BOWSER_SPIT_FIRE +- SOUND_AIR_CASTLE_OUTDOORS_AMBIENT +- SOUND_AIR_CHUCKYA_MOVE +- SOUND_AIR_HEAVEHO_MOVE +- SOUND_AIR_HOWLING_WIND +- SOUND_AIR_LAKITU_FLY +- SOUND_AIR_LAKITU_FLY_HIGHPRIO +- SOUND_AIR_PEACH_TWINKLE +- SOUND_AIR_ROUGH_SLIDE +- SOUND_AIR_UNK01 +- SOUND_AIR_UNK07 +- SOUND_BANKS_ALL +- SOUND_BANKS_ALL_BITS +- SOUND_BANKS_BACKGROUND +- SOUND_BANKS_DISABLED_AFTER_CREDITS +- SOUND_BANKS_DISABLED_DURING_INTRO_CUTSCENE +- SOUND_BANKS_FOREGROUND +- SOUND_BANK_ACTION +- SOUND_BANK_AIR +- SOUND_BANK_COUNT +- SOUND_BANK_ENV +- SOUND_BANK_GENERAL +- SOUND_BANK_GENERAL2 +- SOUND_BANK_LUIGI_VOICE +- SOUND_BANK_MARIO_VOICE +- SOUND_BANK_MENU +- SOUND_BANK_MOVING +- SOUND_BANK_OBJ +- SOUND_BANK_OBJ2 +- SOUND_BANK_WARIO_VOICE +- SOUND_CONSTANT_FREQUENCY +- SOUND_DISCRETE +- SOUND_ENV_BOAT_ROCKING1 +- SOUND_ENV_DRONING1 +- SOUND_ENV_DRONING2 +- SOUND_ENV_ELEVATOR1 +- SOUND_ENV_ELEVATOR2 +- SOUND_ENV_ELEVATOR3 +- SOUND_ENV_ELEVATOR4 +- SOUND_ENV_ELEVATOR4_2 +- SOUND_ENV_MERRY_GO_ROUND_CREAKING +- SOUND_ENV_METAL_BOX_PUSH +- SOUND_ENV_MOVINGSAND +- SOUND_ENV_MOVING_SAND_SNOW +- SOUND_ENV_SINK_QUICKSAND +- SOUND_ENV_SLIDING +- SOUND_ENV_STAR +- SOUND_ENV_UNK07 +- SOUND_ENV_UNK12 +- SOUND_ENV_UNKNOWN2 +- SOUND_ENV_UNKNOWN4 +- SOUND_ENV_WATER +- SOUND_ENV_WATERFALL1 +- SOUND_ENV_WATERFALL2 +- SOUND_ENV_WATER_DRAIN +- SOUND_ENV_WIND1 +- SOUND_ENV_WIND2 +- SOUND_GENERAL2_1UP_APPEAR +- SOUND_GENERAL2_BIRD_CHIRP2 +- SOUND_GENERAL2_BOBOMB_EXPLOSION +- SOUND_GENERAL2_BOWSER_EXPLODE +- SOUND_GENERAL2_BOWSER_KEY +- SOUND_GENERAL2_PURPLE_SWITCH +- SOUND_GENERAL2_PYRAMID_TOP_EXPLOSION +- SOUND_GENERAL2_PYRAMID_TOP_SPIN +- SOUND_GENERAL2_RIGHT_ANSWER +- SOUND_GENERAL2_ROTATING_BLOCK_ALERT +- SOUND_GENERAL2_ROTATING_BLOCK_CLICK +- SOUND_GENERAL2_SPINDEL_ROLL +- SOUND_GENERAL2_STAR_APPEARS +- SOUND_GENERAL2_SWITCH_TICK_FAST +- SOUND_GENERAL2_SWITCH_TICK_SLOW +- SOUND_GENERAL_ACTIVATE_CAP_SWITCH +- SOUND_GENERAL_BIG_CLOCK +- SOUND_GENERAL_BIG_POUND +- SOUND_GENERAL_BIRDS_FLY_AWAY +- SOUND_GENERAL_BOAT_ROCK +- SOUND_GENERAL_BOAT_TILT1 +- SOUND_GENERAL_BOAT_TILT2 +- SOUND_GENERAL_BOING1 +- SOUND_GENERAL_BOING2 +- SOUND_GENERAL_BOING2_LOWPRIO +- SOUND_GENERAL_BOING3 +- SOUND_GENERAL_BOWSER_BOMB_EXPLOSION +- SOUND_GENERAL_BOWSER_PLATFORM +- SOUND_GENERAL_BOWSER_PLATFORM_2 +- SOUND_GENERAL_BOX_LANDING +- SOUND_GENERAL_BOX_LANDING_2 +- SOUND_GENERAL_BREAK_BOX +- SOUND_GENERAL_BUBBLES +- SOUND_GENERAL_BUTTON_PRESS +- SOUND_GENERAL_BUTTON_PRESS_2 +- SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO +- SOUND_GENERAL_BUTTON_PRESS_LOWPRIO +- SOUND_GENERAL_CAGE_OPEN +- SOUND_GENERAL_CANNON_UP +- SOUND_GENERAL_CASTLE_TRAP_OPEN +- SOUND_GENERAL_CHAIN_CHOMP1 +- SOUND_GENERAL_CHAIN_CHOMP2 +- SOUND_GENERAL_CLAM_SHELL1 +- SOUND_GENERAL_CLAM_SHELL2 +- SOUND_GENERAL_CLAM_SHELL3 +- SOUND_GENERAL_CLOSE_IRON_DOOR +- SOUND_GENERAL_CLOSE_WOOD_DOOR +- SOUND_GENERAL_COIN +- SOUND_GENERAL_COIN_DROP +- SOUND_GENERAL_COIN_SPURT +- SOUND_GENERAL_COIN_SPURT_2 +- SOUND_GENERAL_COIN_SPURT_EU +- SOUND_GENERAL_COIN_WATER +- SOUND_GENERAL_COLLECT_1UP +- SOUND_GENERAL_DONUT_PLATFORM_EXPLOSION +- SOUND_GENERAL_DOOR_INSERT_KEY +- SOUND_GENERAL_DOOR_TURN_KEY +- SOUND_GENERAL_ELEVATOR_MOVE +- SOUND_GENERAL_ELEVATOR_MOVE_2 +- SOUND_GENERAL_ENEMY_ALERT1 +- SOUND_GENERAL_EXPLOSION6 +- SOUND_GENERAL_EXPLOSION7 +- SOUND_GENERAL_FLAME_OUT +- SOUND_GENERAL_GRAND_STAR +- SOUND_GENERAL_GRAND_STAR_JUMP +- SOUND_GENERAL_GRINDEL_ROLL +- SOUND_GENERAL_HAUNTED_CHAIR +- SOUND_GENERAL_HAUNTED_CHAIR_MOVE +- SOUND_GENERAL_HEART_SPIN +- SOUND_GENERAL_LEVEL_SELECT_CHANGE +- SOUND_GENERAL_LOUD_POUND +- SOUND_GENERAL_LOUD_POUND2 +- SOUND_GENERAL_METAL_POUND +- SOUND_GENERAL_MOVING_IN_SAND +- SOUND_GENERAL_MOVING_PLATFORM_SWITCH +- SOUND_GENERAL_MOVING_WATER +- SOUND_GENERAL_OPEN_CHEST +- SOUND_GENERAL_OPEN_IRON_DOOR +- SOUND_GENERAL_OPEN_WOOD_DOOR +- SOUND_GENERAL_PAINTING_EJECT +- SOUND_GENERAL_PENDULUM_SWING +- SOUND_GENERAL_PLATFORM +- SOUND_GENERAL_POUND_ROCK +- SOUND_GENERAL_POUND_WOOD_POST +- SOUND_GENERAL_QUIET_BUBBLE +- SOUND_GENERAL_QUIET_BUBBLE2 +- SOUND_GENERAL_QUIET_POUND1 +- SOUND_GENERAL_QUIET_POUND1_LOWPRIO +- SOUND_GENERAL_QUIET_POUND2 +- SOUND_GENERAL_RACE_GUN_SHOT +- SOUND_GENERAL_RED_COIN +- SOUND_GENERAL_SHAKE_COFFIN +- SOUND_GENERAL_SHORT_POUND1 +- SOUND_GENERAL_SHORT_POUND2 +- SOUND_GENERAL_SHORT_POUND3 +- SOUND_GENERAL_SHORT_POUND4 +- SOUND_GENERAL_SHORT_POUND5 +- SOUND_GENERAL_SHORT_POUND6 +- SOUND_GENERAL_SHORT_STAR +- SOUND_GENERAL_SOFT_LANDING +- SOUND_GENERAL_SPLATTERING +- SOUND_GENERAL_STAR_APPEARS +- SOUND_GENERAL_STAR_DOOR_CLOSE +- SOUND_GENERAL_STAR_DOOR_OPEN +- SOUND_GENERAL_SWISH_AIR +- SOUND_GENERAL_SWISH_AIR_2 +- SOUND_GENERAL_SWISH_WATER +- SOUND_GENERAL_SWITCH_DOOR_OPEN +- SOUND_GENERAL_UNK32 +- SOUND_GENERAL_UNK45 +- SOUND_GENERAL_UNK46 +- SOUND_GENERAL_UNK46_LOWPRIO +- SOUND_GENERAL_UNKNOWN1 +- SOUND_GENERAL_UNKNOWN1_2 +- SOUND_GENERAL_UNKNOWN3 +- SOUND_GENERAL_UNKNOWN3_2 +- SOUND_GENERAL_UNKNOWN3_LOWPRIO +- SOUND_GENERAL_UNKNOWN4 +- SOUND_GENERAL_UNKNOWN4_LOWPRIO +- SOUND_GENERAL_VANISH_SFX +- SOUND_GENERAL_VOLCANO_EXPLOSION +- SOUND_GENERAL_WALL_EXPLOSION +- SOUND_GENERAL_WATER_LEVEL_TRIG +- SOUND_GENERAL_YOSHI_TALK +- SOUND_GENERAL_YOSHI_WALK +- SOUND_LOWER_BACKGROUND_MUSIC +- SOUND_MARIO_ATTACKED +- SOUND_MARIO_COUGHING1 +- SOUND_MARIO_COUGHING2 +- SOUND_MARIO_COUGHING3 +- SOUND_MARIO_DOH +- SOUND_MARIO_DROWNING +- SOUND_MARIO_DYING +- SOUND_MARIO_EEUH +- SOUND_MARIO_GAME_OVER +- SOUND_MARIO_GROUND_POUND_WAH +- SOUND_MARIO_HAHA +- SOUND_MARIO_HAHA_2 +- SOUND_MARIO_HELLO +- SOUND_MARIO_HERE_WE_GO +- SOUND_MARIO_HOOHOO +- SOUND_MARIO_HRMM +- SOUND_MARIO_IMA_TIRED +- SOUND_MARIO_MAMA_MIA +- SOUND_MARIO_OKEY_DOKEY +- SOUND_MARIO_ON_FIRE +- SOUND_MARIO_OOOF +- SOUND_MARIO_OOOF2 +- SOUND_MARIO_PANTING +- SOUND_MARIO_PANTING_COLD +- SOUND_MARIO_PRESS_START_TO_PLAY +- SOUND_MARIO_PUNCH_HOO +- SOUND_MARIO_PUNCH_WAH +- SOUND_MARIO_PUNCH_YAH +- SOUND_MARIO_SNORING1 +- SOUND_MARIO_SNORING2 +- SOUND_MARIO_SNORING3 +- SOUND_MARIO_SO_LONGA_BOWSER +- SOUND_MARIO_TWIRL_BOUNCE +- SOUND_MARIO_UH +- SOUND_MARIO_UH2 +- SOUND_MARIO_UH2_2 +- SOUND_MARIO_WAAAOOOW +- SOUND_MARIO_WAH2 +- SOUND_MARIO_WHOA +- SOUND_MARIO_YAHOO +- SOUND_MARIO_YAHOO_WAHA_YIPPEE +- SOUND_MARIO_YAH_WAH_HOO +- SOUND_MARIO_YAWNING +- SOUND_MENU_BOWSER_LAUGH +- SOUND_MENU_CAMERA_BUZZ +- SOUND_MENU_CAMERA_TURN +- SOUND_MENU_CAMERA_UNUSED1 +- SOUND_MENU_CAMERA_UNUSED2 +- SOUND_MENU_CAMERA_ZOOM_IN +- SOUND_MENU_CAMERA_ZOOM_OUT +- SOUND_MENU_CHANGE_SELECT +- SOUND_MENU_CLICK_CHANGE_VIEW +- SOUND_MENU_CLICK_FILE_SELECT +- SOUND_MENU_COIN_ITS_A_ME_MARIO +- SOUND_MENU_COLLECT_RED_COIN +- SOUND_MENU_COLLECT_SECRET +- SOUND_MENU_ENTER_HOLE +- SOUND_MENU_ENTER_PIPE +- SOUND_MENU_EXIT_A_SIGN +- SOUND_MENU_EXIT_PIPE +- SOUND_MENU_HAND_APPEAR +- SOUND_MENU_HAND_DISAPPEAR +- SOUND_MENU_LET_GO_MARIO_FACE +- SOUND_MENU_MARIO_CASTLE_WARP +- SOUND_MENU_MARIO_CASTLE_WARP2 +- SOUND_MENU_MESSAGE_APPEAR +- SOUND_MENU_MESSAGE_DISAPPEAR +- SOUND_MENU_MESSAGE_NEXT_PAGE +- SOUND_MENU_PAUSE +- SOUND_MENU_PAUSE_2 +- SOUND_MENU_PAUSE_HIGHPRIO +- SOUND_MENU_PINCH_MARIO_FACE +- SOUND_MENU_POWER_METER +- SOUND_MENU_READ_A_SIGN +- SOUND_MENU_REVERSE_PAUSE +- SOUND_MENU_STAR_SOUND +- SOUND_MENU_STAR_SOUND_LETS_A_GO +- SOUND_MENU_STAR_SOUND_OKEY_DOKEY +- SOUND_MENU_THANK_YOU_PLAYING_MY_GAME +- SOUND_MENU_UNK0C +- SOUND_MENU_UNK10 +- SOUND_MENU_YOSHI_GAIN_LIVES +- SOUND_MOVING_AIM_CANNON +- SOUND_MOVING_ALMOST_DROWNING +- SOUND_MOVING_FLYING +- SOUND_MOVING_LAVA_BURN +- SOUND_MOVING_QUICKSAND_DEATH +- SOUND_MOVING_RIDING_SHELL_LAVA +- SOUND_MOVING_SHOCKED +- SOUND_MOVING_SLIDE_DOWN_POLE +- SOUND_MOVING_SLIDE_DOWN_TREE +- SOUND_MOVING_TERRAIN_RIDING_SHELL +- SOUND_MOVING_TERRAIN_SLIDE +- SOUND_MOVING_UNK1A +- SOUND_NO_ECHO +- SOUND_NO_PRIORITY_LOSS +- SOUND_NO_VOLUME_LOSS +- SOUND_OBJ2_BABY_PENGUIN_YELL +- SOUND_OBJ2_BIRD_CHIRP1 +- SOUND_OBJ2_BOSS_DIALOG_GRUNT +- SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE +- SOUND_OBJ2_BOWSER_ROAR +- SOUND_OBJ2_BOWSER_TELEPORT +- SOUND_OBJ2_BULLY_ATTACKED +- SOUND_OBJ2_EYEROK_SOUND_LONG +- SOUND_OBJ2_EYEROK_SOUND_SHORT +- SOUND_OBJ2_KING_BOBOMB_DAMAGE +- SOUND_OBJ2_LARGE_BULLY_ATTACKED +- SOUND_OBJ2_MONTY_MOLE_APPEAR +- SOUND_OBJ2_MRI_SPINNING +- SOUND_OBJ2_PIRANHA_PLANT_BITE +- SOUND_OBJ2_PIRANHA_PLANT_DYING +- SOUND_OBJ2_SCUTTLEBUG_ALERT +- SOUND_OBJ2_SCUTTLEBUG_WALK +- SOUND_OBJ2_SWOOP +- SOUND_OBJ2_WHOMP_SOUND_SHORT +- SOUND_OBJ_BABY_PENGUIN_DIVE +- SOUND_OBJ_BABY_PENGUIN_WALK +- SOUND_OBJ_BIG_PENGUIN_WALK +- SOUND_OBJ_BIG_PENGUIN_YELL +- SOUND_OBJ_BIRD_CHIRP3 +- SOUND_OBJ_BOBOMB_BUDDY_TALK +- SOUND_OBJ_BOBOMB_WALK +- SOUND_OBJ_BOO_BOUNCE_TOP +- SOUND_OBJ_BOO_LAUGH_LONG +- SOUND_OBJ_BOO_LAUGH_SHORT +- SOUND_OBJ_BOWSER_DEFEATED +- SOUND_OBJ_BOWSER_INHALING +- SOUND_OBJ_BOWSER_INTRO_LAUGH +- SOUND_OBJ_BOWSER_LAUGH +- SOUND_OBJ_BOWSER_SPINNING +- SOUND_OBJ_BOWSER_TAIL_PICKUP +- SOUND_OBJ_BOWSER_WALK +- SOUND_OBJ_BUBBA_CHOMP +- SOUND_OBJ_BULLY_EXPLODE +- SOUND_OBJ_BULLY_EXPLODE_2 +- SOUND_OBJ_BULLY_METAL +- SOUND_OBJ_BULLY_WALK +- SOUND_OBJ_BULLY_WALKING +- SOUND_OBJ_CANNON1 +- SOUND_OBJ_CANNON2 +- SOUND_OBJ_CANNON3 +- SOUND_OBJ_CANNON4 +- SOUND_OBJ_CHUCKYA_DEATH +- SOUND_OBJ_DEFAULT_DEATH +- SOUND_OBJ_DIVING_INTO_WATER +- SOUND_OBJ_DIVING_IN_WATER +- SOUND_OBJ_DORRIE +- SOUND_OBJ_DYING_ENEMY1 +- SOUND_OBJ_DYING_ENEMY2 +- SOUND_OBJ_EEL +- SOUND_OBJ_EEL_2 +- SOUND_OBJ_ENEMY_DEATH_HIGH +- SOUND_OBJ_ENEMY_DEATH_LOW +- SOUND_OBJ_ENEMY_DEFEAT_SHRINK +- SOUND_OBJ_EVIL_LAKITU_THROW +- SOUND_OBJ_EYEROK_EXPLODE +- SOUND_OBJ_EYEROK_SHOW_EYE +- SOUND_OBJ_FLAME_BLOWN +- SOUND_OBJ_GOOMBA_ALERT +- SOUND_OBJ_GOOMBA_WALK +- SOUND_OBJ_HEAVEHO_TOSSED +- SOUND_OBJ_JUMP_WALK_WATER +- SOUND_OBJ_KING_BOBOMB +- SOUND_OBJ_KING_BOBOMB_JUMP +- SOUND_OBJ_KING_BOBOMB_TALK +- SOUND_OBJ_KING_WHOMP_DEATH +- SOUND_OBJ_KLEPTO1 +- SOUND_OBJ_KLEPTO2 +- SOUND_OBJ_KOOPA_DAMAGE +- SOUND_OBJ_KOOPA_FLYGUY_DEATH +- SOUND_OBJ_KOOPA_TALK +- SOUND_OBJ_KOOPA_THE_QUICK_WALK +- SOUND_OBJ_KOOPA_WALK +- SOUND_OBJ_MAD_PIANO_CHOMPING +- SOUND_OBJ_MIPS_RABBIT +- SOUND_OBJ_MIPS_RABBIT_WATER +- SOUND_OBJ_MONTY_MOLE_ATTACK +- SOUND_OBJ_MRI_DEATH +- SOUND_OBJ_MRI_SHOOT +- SOUND_OBJ_MR_BLIZZARD_ALERT +- SOUND_OBJ_PIRANHA_PLANT_APPEAR +- SOUND_OBJ_PIRANHA_PLANT_SHRINK +- SOUND_OBJ_POKEY_DEATH +- SOUND_OBJ_POUNDING1 +- SOUND_OBJ_POUNDING1_HIGHPRIO +- SOUND_OBJ_POUNDING_CANNON +- SOUND_OBJ_POUNDING_LOUD +- SOUND_OBJ_SKEETER_WALK +- SOUND_OBJ_SNOWMAN_BOUNCE +- SOUND_OBJ_SNOWMAN_EXPLODE +- SOUND_OBJ_SNOW_SAND1 +- SOUND_OBJ_SNOW_SAND2 +- SOUND_OBJ_SNUFIT_SHOOT +- SOUND_OBJ_SNUFIT_SKEETER_DEATH +- SOUND_OBJ_SOMETHING_LANDING +- SOUND_OBJ_SPINY_UNK59 +- SOUND_OBJ_STOMPED +- SOUND_OBJ_SUSHI_SHARK_WATER_SOUND +- SOUND_OBJ_SWOOP_DEATH +- SOUND_OBJ_THWOMP +- SOUND_OBJ_UKIKI_CHATTER_IDLE +- SOUND_OBJ_UKIKI_CHATTER_LONG +- SOUND_OBJ_UKIKI_CHATTER_SHORT +- SOUND_OBJ_UKIKI_STEP_DEFAULT +- SOUND_OBJ_UKIKI_STEP_LEAVES +- SOUND_OBJ_UNK23 +- SOUND_OBJ_UNKNOWN2 +- SOUND_OBJ_UNKNOWN3 +- SOUND_OBJ_UNKNOWN4 +- SOUND_OBJ_UNKNOWN6 +- SOUND_OBJ_WALKING_WATER +- SOUND_OBJ_WATER_BOMB_BOUNCING +- SOUND_OBJ_WHOMP_LOWPRIO +- SOUND_OBJ_WIGGLER_ATTACKED +- SOUND_OBJ_WIGGLER_DEATH +- SOUND_OBJ_WIGGLER_HIGH_PITCH +- SOUND_OBJ_WIGGLER_JUMP +- SOUND_OBJ_WIGGLER_LOW_PITCH +- SOUND_OBJ_WIGGLER_TALK +- SOUND_PEACH_BAKE_A_CAKE +- SOUND_PEACH_DEAR_MARIO +- SOUND_PEACH_FOR_MARIO +- SOUND_PEACH_MARIO +- SOUND_PEACH_MARIO2 +- SOUND_PEACH_POWER_OF_THE_STARS +- SOUND_PEACH_SOMETHING_SPECIAL +- SOUND_PEACH_THANKS_TO_YOU +- SOUND_PEACH_THANK_YOU_MARIO +- SOUND_STATUS_PLAYING +- SOUND_STATUS_STOPPED +- SOUND_STATUS_WAITING +- SOUND_TERRAIN_DEFAULT +- SOUND_TERRAIN_GRASS +- SOUND_TERRAIN_ICE +- SOUND_TERRAIN_SAND +- SOUND_TERRAIN_SNOW +- SOUND_TERRAIN_SPOOKY +- SOUND_TERRAIN_STONE +- SOUND_TERRAIN_WATER +- SOUND_VIBRATO + +[:arrow_up_small:](#) + +
+ ## [types.h](#types.h) - ANIM_FLAG_2 - ANIM_FLAG_5 diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 26a403d8..986c6dd8 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -75,8 +75,9 @@ - [play_sound_with_freq_scale](#play_sound_with_freq_scale) - [play_star_fanfare](#play_star_fanfare) - [play_toads_jingle](#play_toads_jingle) - - [sequence_player_fade_out](#sequence_player_fade_out) - - [sequence_player_unlower](#sequence_player_unlower) + - [seq_player_fade_out](#seq_player_fade_out) + - [seq_player_lower_volume](#seq_player_lower_volume) + - [seq_player_unlower_volume](#seq_player_unlower_volume)
@@ -606,6 +607,13 @@
+- rumble_init.c + - [queue_rumble_data](#queue_rumble_data) + - [queue_rumble_data_mario](#queue_rumble_data_mario) + - [queue_rumble_data_object](#queue_rumble_data_object) + +
+ - save_file.h - [save_file_get_cap_pos](#save_file_get_cap_pos) - [save_file_get_course_coin_score](#save_file_get_course_coin_score) @@ -701,13 +709,6 @@
-- thread6.c - - [queue_rumble_data](#queue_rumble_data) - - [queue_rumble_data_mario](#queue_rumble_data_mario) - - [queue_rumble_data_object](#queue_rumble_data_object) - -
- --- # manually written functions @@ -1396,20 +1397,20 @@ The `reliable` field will ensure that the packet arrives, but should be used spa ## [fade_volume_scale](#fade_volume_scale) ### Lua Example -`fade_volume_scale(player, targetScale, fadeTimer)` +`fade_volume_scale(player, targetScale, fadeDuration)` ### Parameters | Field | Type | | ----- | ---- | | player | `integer` | | targetScale | `integer` | -| fadeTimer | `integer` | +| fadeDuration | `integer` | ### Returns - None ### C Prototype -`void fade_volume_scale(u8 player, u8 targetScale, u16 fadeTimer);` +`void fade_volume_scale(u8 player, u8 targetScale, u16 fadeDuration);` [:arrow_up_small:](#) @@ -1672,43 +1673,65 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
-## [sequence_player_fade_out](#sequence_player_fade_out) +## [seq_player_fade_out](#seq_player_fade_out) ### Lua Example -`sequence_player_fade_out(player, fadeTimer)` +`seq_player_fade_out(player, fadeDuration)` ### Parameters | Field | Type | | ----- | ---- | | player | `integer` | -| fadeTimer | `integer` | +| fadeDuration | `integer` | ### Returns - None ### C Prototype -`void sequence_player_fade_out(u8 player, u16 fadeTimer);` +`void seq_player_fade_out(u8 player, u16 fadeDuration);` [:arrow_up_small:](#)
-## [sequence_player_unlower](#sequence_player_unlower) +## [seq_player_lower_volume](#seq_player_lower_volume) ### Lua Example -`sequence_player_unlower(player, fadeTimer)` +`seq_player_lower_volume(player, fadeDuration, percentage)` ### Parameters | Field | Type | | ----- | ---- | | player | `integer` | -| fadeTimer | `integer` | +| fadeDuration | `integer` | +| percentage | `integer` | ### Returns - None ### C Prototype -`void sequence_player_unlower(u8 player, u16 fadeTimer);` +`void seq_player_lower_volume(u8 player, u16 fadeDuration, u8 percentage);` + +[:arrow_up_small:](#) + +
+ +## [seq_player_unlower_volume](#seq_player_unlower_volume) + +### Lua Example +`seq_player_unlower_volume(player, fadeDuration)` + +### Parameters +| Field | Type | +| ----- | ---- | +| player | `integer` | +| fadeDuration | `integer` | + +### Returns +- None + +### C Prototype +`void seq_player_unlower_volume(u8 player, u16 fadeDuration);` [:arrow_up_small:](#) @@ -5654,7 +5677,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa - `integer` ### C Prototype -`s32 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist);` +`s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist);` [:arrow_up_small:](#) @@ -5677,7 +5700,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa - `integer` ### C Prototype -`s32 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist);` +`s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist);` [:arrow_up_small:](#) @@ -5760,7 +5783,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa - `integer` ### C Prototype -`s32 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range);` +`s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range);` [:arrow_up_small:](#) @@ -5784,7 +5807,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa - `integer` ### C Prototype -`s32 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ);` +`s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ);` [:arrow_up_small:](#) @@ -5808,7 +5831,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa - `integer` ### C Prototype -`s32 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius);` +`s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius);` [:arrow_up_small:](#) @@ -5829,7 +5852,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa - `integer` ### C Prototype -`s32 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan);` +`s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan);` [:arrow_up_small:](#) @@ -5847,7 +5870,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa - `integer` ### C Prototype -`s32 obj_lava_death(void);` +`s8 obj_lava_death(void);` [:arrow_up_small:](#) @@ -5938,7 +5961,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa - `integer` ### C Prototype -`s32 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist);` +`s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist);` [:arrow_up_small:](#) @@ -6119,7 +6142,7 @@ The `reliable` field will ensure that the packet arrives, but should be used spa - `integer` ### C Prototype -`s32 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ);` +`s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ);` [:arrow_up_small:](#) @@ -11267,6 +11290,77 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
+--- +# functions from rumble_init.c + +
+ + +## [queue_rumble_data](#queue_rumble_data) + +### Lua Example +`queue_rumble_data(a0, a1)` + +### Parameters +| Field | Type | +| ----- | ---- | +| a0 | `integer` | +| a1 | `integer` | + +### Returns +- None + +### C Prototype +`void queue_rumble_data(s16 a0, s16 a1);` + +[:arrow_up_small:](#) + +
+ +## [queue_rumble_data_mario](#queue_rumble_data_mario) + +### Lua Example +`queue_rumble_data_mario(m, a0, a1)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | +| a0 | `integer` | +| a1 | `integer` | + +### Returns +- None + +### C Prototype +`void queue_rumble_data_mario(struct MarioState* m, s16 a0, s16 a1);` + +[:arrow_up_small:](#) + +
+ +## [queue_rumble_data_object](#queue_rumble_data_object) + +### Lua Example +`queue_rumble_data_object(object, a0, a1)` + +### Parameters +| Field | Type | +| ----- | ---- | +| object | [Object](structs.md#Object) | +| a0 | `integer` | +| a1 | `integer` | + +### Returns +- None + +### C Prototype +`void queue_rumble_data_object(struct Object* object, s16 a0, s16 a1);` + +[:arrow_up_small:](#) + +
+ --- # functions from save_file.h @@ -12580,74 +12674,3 @@ The `reliable` field will ensure that the packet arrives, but should be used spa [:arrow_up_small:](#)
- ---- -# functions from thread6.c - -
- - -## [queue_rumble_data](#queue_rumble_data) - -### Lua Example -`queue_rumble_data(a0, a1)` - -### Parameters -| Field | Type | -| ----- | ---- | -| a0 | `integer` | -| a1 | `integer` | - -### Returns -- None - -### C Prototype -`void queue_rumble_data(s16 a0, s16 a1);` - -[:arrow_up_small:](#) - -
- -## [queue_rumble_data_mario](#queue_rumble_data_mario) - -### Lua Example -`queue_rumble_data_mario(m, a0, a1)` - -### Parameters -| Field | Type | -| ----- | ---- | -| m | [MarioState](structs.md#MarioState) | -| a0 | `integer` | -| a1 | `integer` | - -### Returns -- None - -### C Prototype -`void queue_rumble_data_mario(struct MarioState* m, s16 a0, s16 a1);` - -[:arrow_up_small:](#) - -
- -## [queue_rumble_data_object](#queue_rumble_data_object) - -### Lua Example -`queue_rumble_data_object(object, a0, a1)` - -### Parameters -| Field | Type | -| ----- | ---- | -| object | [Object](structs.md#Object) | -| a0 | `integer` | -| a1 | `integer` | - -### Returns -- None - -### C Prototype -`void queue_rumble_data_object(struct Object* object, s16 a0, s16 a1);` - -[:arrow_up_small:](#) - -
diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 21c5ea46..afaa3738 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -993,10 +993,10 @@ | oHomingAmpAvgY | `number` | | | oArrowLiftDisplacement | `number` | | | oArrowLiftUnk100 | `integer` | | -| oBackAndForthPlatformUnkF4 | `number` | | -| oBackAndForthPlatformUnkF8 | `number` | | -| oBackAndForthPlatformUnkFC | `number` | | -| oBackAndForthPlatformUnk100 | `number` | | +| oBackAndForthPlatformDirection | `number` | | +| oBackAndForthPlatformPathLength | `number` | | +| oBackAndForthPlatformDistance | `number` | | +| oBackAndForthPlatformVel | `number` | | | oBirdSpeed | `number` | | | oBirdTargetPitch | `integer` | | | oBirdTargetYaw | `integer` | | @@ -1182,23 +1182,23 @@ | oBlueFishRandomTime | `integer` | | | oBlueFishRandomAngle | `number` | | | oFishWaterLevel | `number` | | -| oFishPosY | `number` | | -| oFishRandomOffset | `number` | | -| oFishRandomSpeed | `integer` | | -| oFishRespawnDistance | `number` | | -| oFishRandomVel | `number` | | +| oFishGoalY | `number` | | +| oFishHeightOffset | `number` | | +| oFishYawVel | `integer` | | +| oFishRoamDistance | `number` | | +| oFishGoalVel | `number` | | | oFishDepthDistance | `number` | | | oFishActiveDistance | `number` | | -| oFlameUnkF4 | `number` | | -| oFlameUnkF8 | `integer` | | +| oFlameScale | `number` | | +| oFlameSpeedTimerOffset | `integer` | | | oFlameUnkFC | `number` | | -| oFlameUnk100 | [Object](structs.md#Object) | | -| oBlueFlameUnkF8 | `number` | | +| oFlameBowser | [Object](structs.md#Object) | | +| oBlueFlameNextScale | `number` | | | oSmallPiranhaFlameStartSpeed | `number` | | | oSmallPiranhaFlameEndSpeed | `number` | | | oSmallPiranhaFlameModel | `integer` | | -| oSmallPiranhaFlameUnk100 | `integer` | | -| oSmallPiranhaFlameUnk104 | `number` | | +| oSmallPiranhaFlameNextFlameTimer | `integer` | | +| oSmallPiranhaFlameSpeed | `number` | | | oMovingFlameTimer | `integer` | | | oFlameThowerFlameUnk110 | `integer` | | | oFlameThowerUnk110 | `integer` | | @@ -1309,9 +1309,8 @@ | oMenuButtonScale | `number` | | | oMenuButtonActionPhase | `integer` | | | oMenuButtonIsCustom | `integer` | | -| oMantaUnkF4 | `integer` | | -| oMantaUnkF8 | `integer` | | -| oMantaUnk1AC | `integer` | | +| oMantaTargetPitch | `integer` | | +| oMantaTargetYaw | `integer` | | | oMerryGoRoundStopped | `integer` | | | oMerryGoRoundMusicShouldPlay | `integer` | | | oMerryGoRoundMarioIsOutside | `integer` | | @@ -1876,7 +1875,7 @@ | numWalls | `integer` | | | offsetY | `number` | | | radius | `number` | | -| unk14 | `integer` | | +| unused | `integer` | | [:arrow_up_small:](#) diff --git a/extract_assets.py b/extract_assets.py index bb529348..3b6427e3 100755 --- a/extract_assets.py +++ b/extract_assets.py @@ -166,32 +166,28 @@ def main(): assets = todo[key] lang, mio0 = key if mio0 == "@sound": - with tempfile.NamedTemporaryFile(prefix="ctl", delete=False) as ctl_file: - with tempfile.NamedTemporaryFile(prefix="tbl", delete=False) as tbl_file: - rom = roms[lang] - size, locs = asset_map["@sound ctl " + lang] - offset = locs[lang][0] - ctl_file.write(rom[offset : offset + size]) - ctl_file.close() - size, locs = asset_map["@sound tbl " + lang] - offset = locs[lang][0] - tbl_file.write(rom[offset : offset + size]) - tbl_file.close() - args = [ - "python3", - "tools/disassemble_sound.py", - ctl_file.name, - tbl_file.name, - "--only-samples", - ] - for (asset, pos, size, meta) in assets: - print("extracting", asset) - args.append(asset + ":" + str(pos)) - try: - subprocess.run(args, check=True) - finally: - os.unlink(ctl_file.name) - os.unlink(tbl_file.name) + rom = roms[lang] + args = [ + "python3", + "tools/disassemble_sound.py", + "baserom." + lang + ".z64", + ] + def append_args(key): + size, locs = asset_map["@sound " + key + " " + lang] + offset = locs[lang][0] + args.append(str(offset)) + args.append(str(size)) + append_args("ctl") + append_args("tbl") + if lang == "sh": + args.append("--shindou-headers") + append_args("ctl header") + append_args("tbl header") + args.append("--only-samples") + for (asset, pos, size, meta) in assets: + print("extracting", asset) + args.append(asset + ":" + str(pos)) + subprocess.run(args, check=True) continue if mio0 is not None: diff --git a/first-diff.py b/first-diff.py index 202a7daf..c4483b53 100755 --- a/first-diff.py +++ b/first-diff.py @@ -109,7 +109,8 @@ if len(mybin) != len(basebin): if mybin == basebin: print("No differences!") - exit(0) + if not args.by_name: + exit(0) def search_map(rom_addr): @@ -273,7 +274,8 @@ for i in range(24, len(mybin), 4): map_search_diff.append(search_map(i)) if diffs == 0: print("No differences!") - exit() + if not args.by_name: + exit() definite_shift = diffs > shift_cap if not definite_shift: print(str(diffs) + " differing word(s).") diff --git a/include/PR/abi.h b/include/PR/abi.h index 0cec6a9c..2631214f 100644 --- a/include/PR/abi.h +++ b/include/PR/abi.h @@ -24,29 +24,51 @@ /* * Header file for the Audio Binary Interface. * This is included in the Media Binary Interface file - * mbi.h. + * mbi.h. * * This file follows the framework used for graphics. - * + * */ /* Audio commands: */ #define A_SPNOOP 0 #define A_ADPCM 1 #define A_CLEARBUFF 2 +#define A_RESAMPLE 5 +#define A_SETBUFF 8 +#define A_DMEMMOVE 10 +#define A_LOADADPCM 11 +#define A_MIXER 12 +#define A_INTERLEAVE 13 +#define A_SETLOOP 15 + +#ifndef VERSION_SH + #define A_ENVMIXER 3 #define A_LOADBUFF 4 #define A_RESAMPLE 5 #define A_SAVEBUFF 6 #define A_SEGMENT 7 -#define A_SETBUFF 8 #define A_SETVOL 9 -#define A_DMEMMOVE 10 -#define A_LOADADPCM 11 -#define A_MIXER 12 -#define A_INTERLEAVE 13 #define A_POLEF 14 -#define A_SETLOOP 15 + +#else + +#define A_ADDMIXER 4 +#define A_RESAMPLE_ZOH 6 +#define A_INTERL 17 +#define A_ENVSETUP1 18 +#define A_ENVMIXER 19 +#define A_LOADBUFF 20 +#define A_SAVEBUFF 21 +#define A_ENVSETUP2 22 +#define A_UNK_23 23 +#define A_HILOGAIN 24 +#define A_UNK_25 25 +#define A_DUPLICATE 26 +#define A_FILTER 27 + +#endif #define ACMD_SIZE 32 /* @@ -205,7 +227,7 @@ typedef struct { unsigned int pad2:16; unsigned int addr; } Asetloop; - + /* * Generic Acmd Packet */ @@ -327,6 +349,14 @@ typedef short ENVMIX_STATE[40]; _a->words.w1 = (uintptr_t)(s); \ } +#define aADPCM_23(pkt, f, s) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = _SHIFTL(A_UNK_23, 24, 8) | _SHIFTL(f, 16, 8); \ + _a->words.w1 = (uintptr_t)(s); \ +} + /* * Not used in SM64. */ @@ -540,6 +570,15 @@ typedef short ENVMIX_STATE[40]; _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \ } +#define aInterl(pkt, f, i, o, c) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = (_SHIFTL(A_INTERL, 24, 8) | _SHIFTL(f, 16, 8) | \ + _SHIFTL(i, 0, 16)); \ + _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \ +} + /* * Sets internal volume parameters. * See aEnvMixer for more info. @@ -597,7 +636,7 @@ typedef short ENVMIX_STATE[40]; Acmd *_a = (Acmd *)pkt; \ \ _a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \ - _a->words.w1 = (uintptr_t) d; \ + _a->words.w1 = (uintptr_t) (d); \ } // This is a version of aSetVolume which takes a single 32-bit parameter @@ -617,6 +656,186 @@ typedef short ENVMIX_STATE[40]; _a->words.w1 = (uintptr_t)(tr); \ } +#ifdef VERSION_SH +#undef aLoadBuffer +#undef aSaveBuffer +#undef aMix +#undef aEnvMixer +#undef aInterleave + +/* + * Mix two tracks by simple clamped addition. + * + * s: DMEM source track 1 + * d: DMEM source track 2 and destination + * c: number of bytes to write (rounded down to 16 byte alignment) + */ +#define aAddMixer(pkt, s, d, c) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = (_SHIFTL(A_ADDMIXER, 24, 8) | \ + _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(0x7fff, 0, 16)); \ + _a->words.w1 = (_SHIFTL(s, 16, 16) | _SHIFTL(d, 0, 16)); \ +} + +/* + * Loads a buffer from DRAM to DMEM. + * + * s: DRAM source + * d: DMEM destination + * c: number of bytes to copy (rounded down to 16 byte alignment) + */ +#define aLoadBuffer(pkt, s, d, c) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8) | \ + _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(d, 0, 16); \ + _a->words.w1 = (uintptr_t)(s); \ +} + +/* + * Stores a buffer from DMEM to DRAM. + * + * s: DMEM source + * d: DRAM destination + * c: number of bytes to copy (rounded down to 16 byte alignment) + */ +#define aSaveBuffer(pkt, s, d, c) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8) | \ + _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(s, 0, 16); \ + _a->words.w1 = (uintptr_t)(d); \ +} + +/* + * Duplicates 128 bytes of data a number of times. + * + * 128 bytes are read from source DMEM address s. + * Then c identical copies of these bytes are written to DMEM address d. + */ +#define aDuplicate(pkt, s, d, c) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = (_SHIFTL(A_DUPLICATE, 24, 8) | \ + _SHIFTL(c, 16, 8) | _SHIFTL(s, 0, 16)); \ + _a->words.w1 = (_SHIFTL(d, 16, 16) | _SHIFTL(0x80, 0, 16)); \ +} + +/* + * Fast resample. + * + * Before this command, call: + * aSetBuffer(cmd++, 0, in, out, count) + * + * This works like the other resample command but just takes the "nearest" sample, + * instead of a function of the four nearest samples. + */ +#define aResampleZoh(pkt, pitch, start_fract) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = (_SHIFTL(A_RESAMPLE_ZOH, 24, 8) | \ + _SHIFTL(pitch, 0, 16)); \ + _a->words.w1 = _SHIFTL(start_fract, 0, 16); \ +} + +/* + * Mixes audio. + * + * Input and output addresses are taken from the i and o parameters. + * The volume with which the input is changed is taken from the g parameter. + * After the volume of the input samples have been changed, the result + * is added to the output. + * + * Note: count is first rounded down to the nearest multiple of 16 bytes + * and then rounded up to the nearest multiple of 32 bytes. + */ +#define aMix(pkt, g, i, o, c) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | \ + _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(g, 0, 16)); \ + _a->words.w1 = _SHIFTL(i, 16, 16) | _SHIFTL(o, 0, 16); \ +} + +#define aEnvSetup1(pkt, a, b, c, d) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = (_SHIFTL(A_ENVSETUP1, 24, 8) | \ + _SHIFTL(a, 16, 8) | _SHIFTL(b, 0, 16)); \ + _a->words.w1 = _SHIFTL(c, 16, 16) | _SHIFTL(d, 0, 16); \ +} + +#define aEnvSetup2(pkt, volLeft, volRight) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = _SHIFTL(A_ENVSETUP2, 24, 8); \ + _a->words.w1 = _SHIFTL(volLeft, 16, 16) | \ + _SHIFTL(volRight, 0, 16); \ +} + +#define aEnvMixer(pkt, inBuf, nSamples, bit1, bit2, bit3, dryLeft, dryRight, wetLeft, wetRight) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = (_SHIFTL(A_ENVMIXER, 24, 8) | \ + _SHIFTL((inBuf) >> 4, 16, 8) | \ + _SHIFTL(nSamples, 8, 8)) | \ + _SHIFTL(bit1, 2, 1) | _SHIFTL(bit2, 1, 1) | \ + _SHIFTL(bit3, 0, 1); \ + _a->words.w1 = _SHIFTL((dryLeft) >> 4, 24, 8) | \ + _SHIFTL((dryRight) >> 4, 16, 8) | \ + _SHIFTL((wetLeft) >> 4, 8, 8) | \ + _SHIFTL((wetRight) >> 4, 0, 8); \ +} + +#define aInterleave(pkt, o, l, r, c) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8) | \ + _SHIFTL((c) >> 4, 16, 8) | _SHIFTL(o, 0, 16); \ + _a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \ +} + +// countOrBuf meaning depends on flag +#define aFilter(pkt, f, countOrBuf, addr) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = _SHIFTL(A_FILTER, 24, 8) | _SHIFTL((f), 16, 8) | \ + _SHIFTL((countOrBuf), 0, 16); \ + _a->words.w1 = (uintptr_t)(addr); \ +} + +#define aHilogain(pkt, id, buflen, i) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = _SHIFTL(A_HILOGAIN, 24, 8) | \ + _SHIFTL((id), 16, 8) | _SHIFTL((buflen), 0, 16); \ + _a->words.w1 = _SHIFTL((i), 16, 16); \ +} + +#define aUnknown25(pkt, f, g, i, o) \ +{ \ + Acmd *_a = (Acmd *)pkt; \ + \ + _a->words.w0 = (_SHIFTL(A_UNK_25, 24, 8) | \ + _SHIFTL((f), 16, 8) | _SHIFTL((g), 0, 16)); \ + _a->words.w1 = _SHIFTL((i), 16, 16) | _SHIFTL((o), 0, 16); \ +} + +#endif + #endif /* _LANGUAGE_C */ #endif /* !_ABI_H_ */ diff --git a/include/PR/libaudio.h b/include/PR/libaudio.h index c374a9ff..3fffe9c0 100644 --- a/include/PR/libaudio.h +++ b/include/PR/libaudio.h @@ -7,12 +7,39 @@ typedef struct { u8 *offset; s32 len; +#ifdef VERSION_SH + s8 magic[2]; // tbl: 0x0204, otherwise: 0x0203 + + // for ctl (else zeros): + union { + // unused, just for clarification (big endian) + struct { + u8 bank; + u8 ff; + u8 numInstruments; + u8 numDrums; + } as_u8; + + // used + struct { + s16 bankAndFf; + s16 numInstrumentsAndDrums; + } as_s16; + } ctl; +#endif } ALSeqData; typedef struct { +#ifndef VERSION_SH s16 revision; +#endif s16 seqCount; +#ifdef VERSION_SH + s16 unk2; + u8 *data; + s32 pad[2]; +#endif ALSeqData seqArray[1]; } ALSeqFile; diff --git a/include/PR/os_internal.h b/include/PR/os_internal.h index a18e0367..889048fb 100644 --- a/include/PR/os_internal.h +++ b/include/PR/os_internal.h @@ -1,5 +1,6 @@ #ifndef _ULTRA64_OS_INTERNAL_H_ #define _ULTRA64_OS_INTERNAL_H_ +#include "PR/os_message.h" /* Internal functions used by the operating system */ /* Do not include this header in application code */ diff --git a/include/PR/os_pi.h b/include/PR/os_pi.h index 9b5abd2b..8da37e25 100644 --- a/include/PR/os_pi.h +++ b/include/PR/os_pi.h @@ -1,12 +1,13 @@ #ifndef _ULTRA64_PI_H_ #define _ULTRA64_PI_H_ +#include /* Ultra64 Parallel Interface */ /* Types */ typedef struct { -#if !defined(VERSION_EU) && !defined(VERSION_SH) +#if !defined(VERSION_EU) u32 errStatus; #endif void *dramAddr; @@ -22,8 +23,8 @@ typedef struct { u16 blockNum; // 6 s32 sectorNum; // 8 uintptr_t devAddr; // c -#if defined(VERSION_EU) || defined(VERSION_SH) - u32 unk10; //error status added moved to blockinfo +#if defined(VERSION_EU) + u32 errStatus; //error status added moved to blockinfo #endif u32 bmCtlShadow; // 10 u32 seqCtlShadow; // 14 diff --git a/include/PR/os_time.h b/include/PR/os_time.h index 328e6015..ecb05d62 100644 --- a/include/PR/os_time.h +++ b/include/PR/os_time.h @@ -22,6 +22,6 @@ typedef u64 OSTime; OSTime osGetTime(void); void osSetTime(OSTime time); -u32 osSetTimer(OSTimer *, OSTime, u64, OSMesgQueue *, OSMesg); +u32 osSetTimer(OSTimer *, OSTime, OSTime, OSMesgQueue *, OSMesg); #endif diff --git a/include/PR/os_vi.h b/include/PR/os_vi.h index 3578c9a3..98fb4ed3 100644 --- a/include/PR/os_vi.h +++ b/include/PR/os_vi.h @@ -61,7 +61,7 @@ typedef struct /* 0x00 */ u16 unk00; //some kind of flags. swap buffer sets to 0x10 /* 0x02 */ u16 retraceCount; /* 0x04 */ void* buffer; - /* 0x08 */ OSViMode *unk08; + /* 0x08 */ OSViMode *modep; /* 0x0c */ u32 features; /* 0x10 */ OSMesgQueue *mq; /* 0x14 */ OSMesg *msg; diff --git a/include/PR/sptask.h b/include/PR/sptask.h index 8f23c1b2..ec443ef4 100644 --- a/include/PR/sptask.h +++ b/include/PR/sptask.h @@ -18,6 +18,9 @@ /* Flags */ #define M_TASK_FLAG0 1 #define M_TASK_FLAG1 2 +#ifdef VERSION_SH +#define M_TASK_FLAG2 4 +#endif /* SpStatus */ #define SPSTATUS_CLEAR_HALT 0x00000001 diff --git a/include/audio_defines.h b/include/audio_defines.h deleted file mode 100644 index 0e9d69bf..00000000 --- a/include/audio_defines.h +++ /dev/null @@ -1,564 +0,0 @@ -#ifndef AUDIO_DEFINES_H -#define AUDIO_DEFINES_H - -// Sound Magic Definition: -// First Byte (Upper Nibble): Sound Bank (not the same as audio bank!) -// First Byte (Lower Nibble): Bitflags for audio playback? -// Second Byte: Sound ID -// Third Byte: Priority -// Fourth Byte (Upper Nibble): More bitflags -// Fourth Byte (Lower Nibble): Sound Status (this is set to SOUND_STATUS_PLAYING when passed to the audio driver.) -#define SOUND_ARG_LOAD(bank, playFlags, soundID, priority, flags2) (((u32) (bank) << 28) | \ - ((u32) (playFlags) << 24) | ((u32) (soundID) << 16) | ((u32) (priority) << 8) | \ - ((u32) (flags2) << 4) | SOUND_STATUS_STARTING) - -#include "luigi_audio_defines.h" -#include "wario_audio_defines.h" - -#define SOUNDARGS_MASK_BANK 0xF0000000 -#define SOUNDARGS_MASK_SOUNDID 0x00FF0000 -#define SOUNDARGS_MASK_PRIORITY 0x0000FF00 -#define SOUNDARGS_MASK_STATUS 0x0000000F - -#define SOUNDARGS_SHIFT_BANK 28 -#define SOUNDARGS_SHIFT_SOUNDID 16 -#define SOUNDARGS_SHIFT_PRIORITY 8 - -/* Audio Status */ -#define SOUND_STATUS_STOPPED 0 -#define SOUND_STATUS_STARTING 1 -#define SOUND_STATUS_PLAYING 2 - -/* Audio lower bitflags. TODO: Figure out what these mean and use them below. */ -#define SOUND_LO_BITFLAG_UNK1 0x10 // fade in? -#define SOUND_NO_ECHO 0x20 // not in JP -#define SOUND_LO_BITFLAG_UNK8 0x80 // restart playing on each play_sound call? - -/* Audio playback bitflags. */ -#define SOUND_NO_VOLUME_LOSS 0x1000000 // No volume loss with distance -#define SOUND_VIBRATO 0x2000000 // Randomly alter frequency each audio frame -#define SOUND_NO_PRIORITY_LOSS 0x4000000 // Do not prioritize closer sounds -#define SOUND_NO_FREQUENCY_LOSS 0x8000000 // Frequency scale does not change with distance - -// silence -#define NO_SOUND 0 - -/** - * The table below defines all sounds that exist in the game, and which flags - * they are used with. If a sound is used with multiple sets of flags (e.g. - * different priorities), they are gives distinguishing suffixes. - * A _2 suffix means the sound is the same despite a different sound ID. - * Some sounds are unused by the game, and given as hexadecimal literals rather - * than SOUND_ARG_LOAD calls. - */ - -/* Terrain sounds */ - -/** - * Terrain-dependent action sounds. mario_get_terrain_sound_addend computes a - * sound terrain type between 0 and 7, depending on the terrain type of the - * level and the floor type that Mario is standing on. That value is then added - * to the sound ID for the TERRAIN_* sounds. - */ -#define SOUND_TERRAIN_DEFAULT 0 // e.g. air -#define SOUND_TERRAIN_GRASS 1 -#define SOUND_TERRAIN_WATER 2 -#define SOUND_TERRAIN_STONE 3 -#define SOUND_TERRAIN_SPOOKY 4 // squeaky floor -#define SOUND_TERRAIN_SNOW 5 -#define SOUND_TERRAIN_ICE 6 -#define SOUND_TERRAIN_SAND 7 - -#define SOUND_ACTION_TERRAIN_JUMP SOUND_ARG_LOAD(0, 4, 0x00, 0x80, 8) -#define SOUND_ACTION_TERRAIN_LANDING SOUND_ARG_LOAD(0, 4, 0x08, 0x80, 8) -#define SOUND_ACTION_TERRAIN_STEP SOUND_ARG_LOAD(0, 6, 0x10, 0x80, 8) -#define SOUND_ACTION_TERRAIN_BODY_HIT_GROUND SOUND_ARG_LOAD(0, 4, 0x18, 0x80, 8) -#define SOUND_ACTION_TERRAIN_STEP_TIPTOE SOUND_ARG_LOAD(0, 6, 0x20, 0x80, 8) -#define SOUND_ACTION_TERRAIN_STUCK_IN_GROUND SOUND_ARG_LOAD(0, 4, 0x48, 0x80, 8) -#define SOUND_ACTION_TERRAIN_HEAVY_LANDING SOUND_ARG_LOAD(0, 4, 0x60, 0x80, 8) - -#define SOUND_ACTION_METAL_JUMP SOUND_ARG_LOAD(0, 4, 0x28, 0x90, 8) -#define SOUND_ACTION_METAL_LANDING SOUND_ARG_LOAD(0, 4, 0x29, 0x90, 8) -#define SOUND_ACTION_METAL_STEP SOUND_ARG_LOAD(0, 4, 0x2A, 0x90, 8) -#define SOUND_ACTION_METAL_HEAVY_LANDING SOUND_ARG_LOAD(0, 4, 0x2B, 0x90, 8) -#define SOUND_ACTION_CLAP_HANDS_COLD SOUND_ARG_LOAD(0, 6, 0x2C, 0x00, 8) -#define SOUND_ACTION_HANGING_STEP SOUND_ARG_LOAD(0, 4, 0x2D, 0xA0, 8) -#define SOUND_ACTION_QUICKSAND_STEP SOUND_ARG_LOAD(0, 4, 0x2E, 0x00, 8) -#define SOUND_ACTION_METAL_STEP_TIPTOE SOUND_ARG_LOAD(0, 4, 0x2F, 0x90, 8) -/* not verified */ #define SOUND_ACTION_UNKNOWN430 SOUND_ARG_LOAD(0, 4, 0x30, 0xC0, 8) -/* not verified */ #define SOUND_ACTION_UNKNOWN431 SOUND_ARG_LOAD(0, 4, 0x31, 0x60, 8) -/* not verified */ #define SOUND_ACTION_UNKNOWN432 SOUND_ARG_LOAD(0, 4, 0x32, 0x80, 8) -#define SOUND_ACTION_SWIM SOUND_ARG_LOAD(0, 4, 0x33, 0x80, 8) -/* not verified */ #define SOUND_ACTION_UNKNOWN434 SOUND_ARG_LOAD(0, 4, 0x34, 0x80, 8) -#define SOUND_ACTION_THROW SOUND_ARG_LOAD(0, 4, 0x35, 0x80, 8) -#define SOUND_ACTION_KEY_SWISH SOUND_ARG_LOAD(0, 4, 0x36, 0x80, 8) -#define SOUND_ACTION_SPIN SOUND_ARG_LOAD(0, 4, 0x37, 0x80, 8) -#define SOUND_ACTION_TWIRL SOUND_ARG_LOAD(0, 4, 0x38, 0x80, 8) // same sound as spin -/* not verified */ #define SOUND_ACTION_CLIMB_UP_TREE SOUND_ARG_LOAD(0, 4, 0x3A, 0x80, 8) -/* not verified */ #define SOUND_ACTION_CLIMB_DOWN_TREE 0x003B -/* not verified */ #define SOUND_ACTION_UNK3C 0x003C -/* not verified */ #define SOUND_ACTION_UNKNOWN43D SOUND_ARG_LOAD(0, 4, 0x3D, 0x80, 8) -/* not verified */ #define SOUND_ACTION_UNKNOWN43E SOUND_ARG_LOAD(0, 4, 0x3E, 0x80, 8) -/* not verified */ #define SOUND_ACTION_PAT_BACK SOUND_ARG_LOAD(0, 4, 0x3F, 0x80, 8) -#define SOUND_ACTION_BRUSH_HAIR SOUND_ARG_LOAD(0, 4, 0x40, 0x80, 8) -/* not verified */ #define SOUND_ACTION_CLIMB_UP_POLE SOUND_ARG_LOAD(0, 4, 0x41, 0x80, 8) -#define SOUND_ACTION_METAL_BONK SOUND_ARG_LOAD(0, 4, 0x42, 0x80, 8) -#define SOUND_ACTION_UNSTUCK_FROM_GROUND SOUND_ARG_LOAD(0, 4, 0x43, 0x80, 8) -/* not verified */ #define SOUND_ACTION_HIT SOUND_ARG_LOAD(0, 4, 0x44, 0xC0, 8) -/* not verified */ #define SOUND_ACTION_HIT_2 SOUND_ARG_LOAD(0, 4, 0x44, 0xB0, 8) -/* not verified */ #define SOUND_ACTION_HIT_3 SOUND_ARG_LOAD(0, 4, 0x44, 0xA0, 8) -#define SOUND_ACTION_BONK SOUND_ARG_LOAD(0, 4, 0x45, 0xA0, 8) -#define SOUND_ACTION_SHRINK_INTO_BBH SOUND_ARG_LOAD(0, 4, 0x46, 0xA0, 8) -#define SOUND_ACTION_SWIM_FAST SOUND_ARG_LOAD(0, 4, 0x47, 0xA0, 8) -#define SOUND_ACTION_METAL_JUMP_WATER SOUND_ARG_LOAD(0, 4, 0x50, 0x90, 8) -#define SOUND_ACTION_METAL_LAND_WATER SOUND_ARG_LOAD(0, 4, 0x51, 0x90, 8) -#define SOUND_ACTION_METAL_STEP_WATER SOUND_ARG_LOAD(0, 4, 0x52, 0x90, 8) -/* not verified */ #define SOUND_ACTION_UNK53 0x0053 -/* not verified */ #define SOUND_ACTION_UNK54 0x0054 -/* not verified */ #define SOUND_ACTION_UNK55 0x0055 -/* not verified */ #define SOUND_ACTION_FLYING_FAST SOUND_ARG_LOAD(0, 4, 0x56, 0x80, 8) // "swoop"? -#define SOUND_ACTION_TELEPORT SOUND_ARG_LOAD(0, 4, 0x57, 0xC0, 8) -/* not verified */ #define SOUND_ACTION_UNKNOWN458 SOUND_ARG_LOAD(0, 4, 0x58, 0xA0, 8) -/* not verified */ #define SOUND_ACTION_BOUNCE_OFF_OBJECT SOUND_ARG_LOAD(0, 4, 0x59, 0xB0, 8) -/* not verified */ #define SOUND_ACTION_SIDE_FLIP_UNK SOUND_ARG_LOAD(0, 4, 0x5A, 0x80, 8) -#define SOUND_ACTION_READ_SIGN SOUND_ARG_LOAD(0, 4, 0x5B, 0xFF, 8) -/* not verified */ #define SOUND_ACTION_UNKNOWN45C SOUND_ARG_LOAD(0, 4, 0x5C, 0x80, 8) -/* not verified */ #define SOUND_ACTION_UNK5D 0x005D -/* not verified */ #define SOUND_ACTION_INTRO_UNK45E SOUND_ARG_LOAD(0, 4, 0x5E, 0x80, 8) -/* not verified */ #define SOUND_ACTION_INTRO_UNK45F SOUND_ARG_LOAD(0, 4, 0x5F, 0x80, 8) - -/* Moving Sound Effects */ - -// Terrain-dependent moving sounds; a value 0-7 is added to the sound ID before -// playing. See higher up for the different terrain types. -#define SOUND_MOVING_TERRAIN_SLIDE SOUND_ARG_LOAD(1, 4, 0x00, 0x00, 0) -#define SOUND_MOVING_TERRAIN_RIDING_SHELL SOUND_ARG_LOAD(1, 4, 0x20, 0x00, 0) - -#define SOUND_MOVING_LAVA_BURN SOUND_ARG_LOAD(1, 4, 0x10, 0x00, 0) // ? -#define SOUND_MOVING_SLIDE_DOWN_POLE SOUND_ARG_LOAD(1, 4, 0x11, 0x00, 0) // ? -#define SOUND_MOVING_SLIDE_DOWN_TREE SOUND_ARG_LOAD(1, 4, 0x12, 0x80, 0) -#define SOUND_MOVING_QUICKSAND_DEATH SOUND_ARG_LOAD(1, 4, 0x14, 0x00, 0) -#define SOUND_MOVING_SHOCKED SOUND_ARG_LOAD(1, 4, 0x16, 0x00, 0) -#define SOUND_MOVING_FLYING SOUND_ARG_LOAD(1, 4, 0x17, 0x00, 0) -#define SOUND_MOVING_ALMOST_DROWNING SOUND_ARG_LOAD(1, 0xC, 0x18, 0x00, 0) -#define SOUND_MOVING_AIM_CANNON SOUND_ARG_LOAD(1, 0xD, 0x19, 0x20, 0) -#define SOUND_MOVING_UNK1A 0x101A // ? -#define SOUND_MOVING_RIDING_SHELL_LAVA SOUND_ARG_LOAD(1, 4, 0x28, 0x00, 0) - -/* Mario Sound Effects */ -// A random number 0-2 is added to the sound ID before playing, producing Yah/Wah/Hoo -#define SOUND_MARIO_YAH_WAH_HOO SOUND_ARG_LOAD(2, 4, 0x00, 0x80, 8) -/* not verified */ #define SOUND_MARIO_HOOHOO SOUND_ARG_LOAD(2, 4, 0x03, 0x80, 8) -/* not verified */ #define SOUND_MARIO_YAHOO SOUND_ARG_LOAD(2, 4, 0x04, 0x80, 8) -/* not verified */ #define SOUND_MARIO_UH SOUND_ARG_LOAD(2, 4, 0x05, 0x80, 8) -/* not verified */ #define SOUND_MARIO_HRMM SOUND_ARG_LOAD(2, 4, 0x06, 0x80, 8) -/* not verified */ #define SOUND_MARIO_WAH2 SOUND_ARG_LOAD(2, 4, 0x07, 0x80, 8) -/* not verified */ #define SOUND_MARIO_WHOA SOUND_ARG_LOAD(2, 4, 0x08, 0xC0, 8) -/* not verified */ #define SOUND_MARIO_EEUH SOUND_ARG_LOAD(2, 4, 0x09, 0x80, 8) -/* not verified */ #define SOUND_MARIO_ATTACKED SOUND_ARG_LOAD(2, 4, 0x0A, 0xFF, 8) -/* not verified */ #define SOUND_MARIO_OOOF SOUND_ARG_LOAD(2, 4, 0x0B, 0x80, 8) -/* not verified */ #define SOUND_MARIO_OOOF2 SOUND_ARG_LOAD(2, 4, 0x0B, 0xD0, 8) -#define SOUND_MARIO_HERE_WE_GO SOUND_ARG_LOAD(2, 4, 0x0C, 0x80, 8) -/* not verified */ #define SOUND_MARIO_YAWNING SOUND_ARG_LOAD(2, 4, 0x0D, 0x80, 8) -#define SOUND_MARIO_SNORING1 SOUND_ARG_LOAD(2, 4, 0x0E, 0x00, 8) -#define SOUND_MARIO_SNORING2 SOUND_ARG_LOAD(2, 4, 0x0F, 0x00, 8) -/* not verified */ #define SOUND_MARIO_WAAAOOOW SOUND_ARG_LOAD(2, 4, 0x10, 0xC0, 8) -/* not verified */ #define SOUND_MARIO_HAHA SOUND_ARG_LOAD(2, 4, 0x11, 0x80, 8) -/* not verified */ #define SOUND_MARIO_HAHA_2 SOUND_ARG_LOAD(2, 4, 0x11, 0xF0, 8) -/* not verified */ #define SOUND_MARIO_UH2 SOUND_ARG_LOAD(2, 4, 0x13, 0xD0, 8) -/* not verified */ #define SOUND_MARIO_UH2_2 SOUND_ARG_LOAD(2, 4, 0x13, 0x80, 8) -/* not verified */ #define SOUND_MARIO_ON_FIRE SOUND_ARG_LOAD(2, 4, 0x14, 0xA0, 8) -/* not verified */ #define SOUND_MARIO_DYING SOUND_ARG_LOAD(2, 4, 0x15, 0xFF, 8) -#define SOUND_MARIO_PANTING_COLD SOUND_ARG_LOAD(2, 4, 0x16, 0x80, 8) - -// A random number 0-2 is added to the sound ID before playing -#define SOUND_MARIO_PANTING SOUND_ARG_LOAD(2, 4, 0x18, 0x80, 8) - -#define SOUND_MARIO_COUGHING1 SOUND_ARG_LOAD(2, 4, 0x1B, 0x80, 8) -#define SOUND_MARIO_COUGHING2 SOUND_ARG_LOAD(2, 4, 0x1C, 0x80, 8) -#define SOUND_MARIO_COUGHING3 SOUND_ARG_LOAD(2, 4, 0x1D, 0x80, 8) -#define SOUND_MARIO_PUNCH_YAH SOUND_ARG_LOAD(2, 4, 0x1E, 0x80, 8) -#define SOUND_MARIO_PUNCH_HOO SOUND_ARG_LOAD(2, 4, 0x1F, 0x80, 8) -#define SOUND_MARIO_MAMA_MIA SOUND_ARG_LOAD(2, 4, 0x20, 0x80, 8) -#define SOUND_MARIO_OKEY_DOKEY 0x2021 -#define SOUND_MARIO_GROUND_POUND_WAH SOUND_ARG_LOAD(2, 4, 0x22, 0x80, 8) -#define SOUND_MARIO_DROWNING SOUND_ARG_LOAD(2, 4, 0x23, 0xF0, 8) -#define SOUND_MARIO_PUNCH_WAH SOUND_ARG_LOAD(2, 4, 0x24, 0x80, 8) - -/* Mario Sound Effects (US/EU only) */ -#define SOUND_PEACH_DEAR_MARIO SOUND_ARG_LOAD(2, 4, 0x28, 0xFF, 8) - -// A random number 0-4 is added to the sound ID before playing, producing one of -// Yahoo! (60% chance), Waha! (20%), or Yippee! (20%). -#define SOUND_MARIO_YAHOO_WAHA_YIPPEE SOUND_ARG_LOAD(2, 4, 0x2B, 0x80, 8) - -#define SOUND_MARIO_DOH SOUND_ARG_LOAD(2, 4, 0x30, 0x80, 8) -#define SOUND_MARIO_GAME_OVER SOUND_ARG_LOAD(2, 4, 0x31, 0xFF, 8) -#define SOUND_MARIO_HELLO SOUND_ARG_LOAD(2, 4, 0x32, 0xFF, 8) -#define SOUND_MARIO_PRESS_START_TO_PLAY SOUND_ARG_LOAD(2, 4, 0x33, 0xFF, 0xA) -#define SOUND_MARIO_TWIRL_BOUNCE SOUND_ARG_LOAD(2, 4, 0x34, 0x80, 8) -#define SOUND_MARIO_SNORING3 SOUND_ARG_LOAD(2, 4, 0x35, 0x00, 8) -#define SOUND_MARIO_SO_LONGA_BOWSER SOUND_ARG_LOAD(2, 4, 0x36, 0x80, 8) -#define SOUND_MARIO_IMA_TIRED SOUND_ARG_LOAD(2, 4, 0x37, 0x80, 8) - -/* Princess Peach Sound Effects (US/EU only) */ -#define SOUND_PEACH_MARIO SOUND_ARG_LOAD(2, 4, 0x38, 0xFF, 8) -#define SOUND_PEACH_POWER_OF_THE_STARS SOUND_ARG_LOAD(2, 4, 0x39, 0xFF, 8) -#define SOUND_PEACH_THANKS_TO_YOU SOUND_ARG_LOAD(2, 4, 0x3A, 0xFF, 8) -#define SOUND_PEACH_THANK_YOU_MARIO SOUND_ARG_LOAD(2, 4, 0x3B, 0xFF, 8) -#define SOUND_PEACH_SOMETHING_SPECIAL SOUND_ARG_LOAD(2, 4, 0x3C, 0xFF, 8) -#define SOUND_PEACH_BAKE_A_CAKE SOUND_ARG_LOAD(2, 4, 0x3D, 0xFF, 8) -#define SOUND_PEACH_FOR_MARIO SOUND_ARG_LOAD(2, 4, 0x3E, 0xFF, 8) -#define SOUND_PEACH_MARIO2 SOUND_ARG_LOAD(2, 4, 0x3F, 0xFF, 8) - -/* General Sound Effects */ -#define SOUND_GENERAL_ACTIVATE_CAP_SWITCH SOUND_ARG_LOAD(3, 0, 0x00, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_FLAME_OUT SOUND_ARG_LOAD(3, 0, 0x03, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_OPEN_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x04, 0xC0, 8) -/* not verified */ #define SOUND_GENERAL_CLOSE_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x05, 0xC0, 8) -/* not verified */ #define SOUND_GENERAL_OPEN_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x06, 0xC0, 8) -/* not verified */ #define SOUND_GENERAL_CLOSE_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x07, 0xC0, 8) -/* not verified */ #define SOUND_GENERAL_BUBBLES 0x3008 -/* not verified */ #define SOUND_GENERAL_MOVING_WATER SOUND_ARG_LOAD(3, 0, 0x09, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_SWISH_WATER SOUND_ARG_LOAD(3, 0, 0x0A, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_QUIET_BUBBLE SOUND_ARG_LOAD(3, 0, 0x0B, 0x00, 8) -#define SOUND_GENERAL_VOLCANO_EXPLOSION SOUND_ARG_LOAD(3, 0, 0x0C, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_QUIET_BUBBLE2 SOUND_ARG_LOAD(3, 0, 0x0D, 0x00, 8) -#define SOUND_GENERAL_CASTLE_TRAP_OPEN SOUND_ARG_LOAD(3, 0, 0x0E, 0x80, 8) -#define SOUND_GENERAL_WALL_EXPLOSION SOUND_ARG_LOAD(3, 0, 0x0F, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_COIN SOUND_ARG_LOAD(3, 8, 0x11, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_COIN_WATER SOUND_ARG_LOAD(3, 8, 0x12, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_SHORT_STAR SOUND_ARG_LOAD(3, 0, 0x16, 0x00, 9) -/* not verified */ #define SOUND_GENERAL_BIG_CLOCK SOUND_ARG_LOAD(3, 0, 0x17, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_LOUD_POUND 0x3018 // _TERRAIN? -/* not verified */ #define SOUND_GENERAL_LOUD_POUND2 0x3019 -/* not verified */ #define SOUND_GENERAL_SHORT_POUND1 0x301A -/* not verified */ #define SOUND_GENERAL_SHORT_POUND2 0x301B -/* not verified */ #define SOUND_GENERAL_SHORT_POUND3 0x301C -/* not verified */ #define SOUND_GENERAL_SHORT_POUND4 0x301D -/* not verified */ #define SOUND_GENERAL_SHORT_POUND5 0x301E -/* not verified */ #define SOUND_GENERAL_SHORT_POUND6 0x301F -#define SOUND_GENERAL_OPEN_CHEST SOUND_ARG_LOAD(3, 1, 0x20, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_CLAM_SHELL1 SOUND_ARG_LOAD(3, 1, 0x22, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_BOX_LANDING SOUND_ARG_LOAD(3, 0, 0x24, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_BOX_LANDING_2 SOUND_ARG_LOAD(3, 2, 0x24, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_UNKNOWN1 SOUND_ARG_LOAD(3, 0, 0x25, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_UNKNOWN1_2 SOUND_ARG_LOAD(3, 2, 0x25, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_CLAM_SHELL2 SOUND_ARG_LOAD(3, 0, 0x26, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_CLAM_SHELL3 SOUND_ARG_LOAD(3, 0, 0x27, 0x40, 8) -#ifdef VERSION_JP -#define SOUND_GENERAL_PAINTING_EJECT SOUND_ARG_LOAD(3, 8, 0x28, 0x00, 8) -#else -#define SOUND_GENERAL_PAINTING_EJECT SOUND_ARG_LOAD(3, 9, 0x28, 0x00, 8) -#endif -#define SOUND_GENERAL_LEVEL_SELECT_CHANGE SOUND_ARG_LOAD(3, 0, 0x2B, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_PLATFORM SOUND_ARG_LOAD(3, 0, 0x2D, 0x80, 8) -#define SOUND_GENERAL_DONUT_PLATFORM_EXPLOSION SOUND_ARG_LOAD(3, 0, 0x2E, 0x20, 8) -#define SOUND_GENERAL_BOWSER_BOMB_EXPLOSION SOUND_ARG_LOAD(3, 1, 0x2F, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_COIN_SPURT SOUND_ARG_LOAD(3, 0, 0x30, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_COIN_SPURT_2 SOUND_ARG_LOAD(3, 8, 0x30, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_COIN_SPURT_EU SOUND_ARG_LOAD(3, 8, 0x30, 0x20, 8) - -/* not verified */ #define SOUND_GENERAL_EXPLOSION6 0x3031 -/* not verified */ #define SOUND_GENERAL_UNK32 0x3032 -/* not verified */ #define SOUND_GENERAL_BOAT_TILT1 SOUND_ARG_LOAD(3, 0, 0x34, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_BOAT_TILT2 SOUND_ARG_LOAD(3, 0, 0x35, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_COIN_DROP SOUND_ARG_LOAD(3, 0, 0x36, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_UNKNOWN3_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x37, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_UNKNOWN3 SOUND_ARG_LOAD(3, 0, 0x37, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_UNKNOWN3_2 SOUND_ARG_LOAD(3, 8, 0x37, 0x80, 8) -#define SOUND_GENERAL_PENDULUM_SWING SOUND_ARG_LOAD(3, 0, 0x38, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_CHAIN_CHOMP1 SOUND_ARG_LOAD(3, 0, 0x39, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_CHAIN_CHOMP2 SOUND_ARG_LOAD(3, 0, 0x3A, 0x00, 8) -#define SOUND_GENERAL_DOOR_TURN_KEY SOUND_ARG_LOAD(3, 0, 0x3B, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_MOVING_IN_SAND SOUND_ARG_LOAD(3, 0, 0x3C, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_UNKNOWN4_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x3D, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_UNKNOWN4 SOUND_ARG_LOAD(3, 0, 0x3D, 0x80, 8) -#define SOUND_GENERAL_MOVING_PLATFORM_SWITCH SOUND_ARG_LOAD(3, 0, 0x3E, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_CAGE_OPEN SOUND_ARG_LOAD(3, 0, 0x3F, 0xA0, 8) -/* not verified */ #define SOUND_GENERAL_QUIET_POUND1_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x40, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_QUIET_POUND1 SOUND_ARG_LOAD(3, 0, 0x40, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_BREAK_BOX SOUND_ARG_LOAD(3, 0, 0x41, 0xC0, 8) -#define SOUND_GENERAL_DOOR_INSERT_KEY SOUND_ARG_LOAD(3, 0, 0x42, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_QUIET_POUND2 SOUND_ARG_LOAD(3, 0, 0x43, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_BIG_POUND SOUND_ARG_LOAD(3, 0, 0x44, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_UNK45 SOUND_ARG_LOAD(3, 0, 0x45, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_UNK46_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x46, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_UNK46 SOUND_ARG_LOAD(3, 0, 0x46, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_CANNON_UP SOUND_ARG_LOAD(3, 0, 0x47, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_GRINDEL_ROLL SOUND_ARG_LOAD(3, 0, 0x48, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_EXPLOSION7 0x3049 -/* not verified */ #define SOUND_GENERAL_SHAKE_COFFIN 0x304A -/* not verified */ #define SOUND_GENERAL_RACE_GUN_SHOT SOUND_ARG_LOAD(3, 1, 0x4D, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_STAR_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x4E, 0xC0, 8) -/* not verified */ #define SOUND_GENERAL_STAR_DOOR_CLOSE SOUND_ARG_LOAD(3, 0, 0x4F, 0xC0, 8) -/* not verified */ #define SOUND_GENERAL_POUND_ROCK SOUND_ARG_LOAD(3, 0, 0x56, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_STAR_APPEARS SOUND_ARG_LOAD(3, 0, 0x57, 0xFF, 9) -#define SOUND_GENERAL_COLLECT_1UP SOUND_ARG_LOAD(3, 0, 0x58, 0xFF, 8) -/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x5A, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS SOUND_ARG_LOAD(3, 0, 0x5A, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO SOUND_ARG_LOAD(3, 1, 0x5A, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS_2 SOUND_ARG_LOAD(3, 1, 0x5A, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_ELEVATOR_MOVE SOUND_ARG_LOAD(3, 0, 0x5B, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_ELEVATOR_MOVE_2 SOUND_ARG_LOAD(3, 1, 0x5B, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_SWISH_AIR SOUND_ARG_LOAD(3, 0, 0x5C, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_SWISH_AIR_2 SOUND_ARG_LOAD(3, 1, 0x5C, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_HAUNTED_CHAIR SOUND_ARG_LOAD(3, 0, 0x5D, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_SOFT_LANDING SOUND_ARG_LOAD(3, 0, 0x5E, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_HAUNTED_CHAIR_MOVE SOUND_ARG_LOAD(3, 0, 0x5F, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_BOWSER_PLATFORM SOUND_ARG_LOAD(3, 0, 0x62, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_BOWSER_PLATFORM_2 SOUND_ARG_LOAD(3, 1, 0x62, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_HEART_SPIN SOUND_ARG_LOAD(3, 0, 0x64, 0xC0, 8) -/* not verified */ #define SOUND_GENERAL_POUND_WOOD_POST SOUND_ARG_LOAD(3, 0, 0x65, 0xC0, 8) -/* not verified */ #define SOUND_GENERAL_WATER_LEVEL_TRIG SOUND_ARG_LOAD(3, 0, 0x66, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_SWITCH_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x67, 0xA0, 8) -/* not verified */ #define SOUND_GENERAL_RED_COIN SOUND_ARG_LOAD(3, 0, 0x68, 0x90, 8) -/* not verified */ #define SOUND_GENERAL_BIRDS_FLY_AWAY SOUND_ARG_LOAD(3, 0, 0x69, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_METAL_POUND SOUND_ARG_LOAD(3, 0, 0x6B, 0x80, 8) -/* not verified */ #define SOUND_GENERAL_BOING1 SOUND_ARG_LOAD(3, 0, 0x6C, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_BOING2_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x6D, 0x20, 8) -/* not verified */ #define SOUND_GENERAL_BOING2 SOUND_ARG_LOAD(3, 0, 0x6D, 0x40, 8) -/* not verified */ #define SOUND_GENERAL_YOSHI_WALK SOUND_ARG_LOAD(3, 0, 0x6E, 0x20, 8) -/* not verified */ #define SOUND_GENERAL_ENEMY_ALERT1 SOUND_ARG_LOAD(3, 0, 0x6F, 0x30, 8) -/* not verified */ #define SOUND_GENERAL_YOSHI_TALK SOUND_ARG_LOAD(3, 0, 0x70, 0x30, 8) -/* not verified */ #define SOUND_GENERAL_SPLATTERING SOUND_ARG_LOAD(3, 0, 0x71, 0x30, 8) -/* not verified */ #define SOUND_GENERAL_BOING3 0x3072 -/* not verified */ #define SOUND_GENERAL_GRAND_STAR SOUND_ARG_LOAD(3, 0, 0x73, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_GRAND_STAR_JUMP SOUND_ARG_LOAD(3, 0, 0x74, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_BOAT_ROCK SOUND_ARG_LOAD(3, 0, 0x75, 0x00, 8) -/* not verified */ #define SOUND_GENERAL_VANISH_SFX SOUND_ARG_LOAD(3, 0, 0x76, 0x20, 8) - -/* Environment Sound Effects */ -/* not verified */ #define SOUND_ENV_WATERFALL1 SOUND_ARG_LOAD(4, 0, 0x00, 0x00, 0) -/* not verified */ #define SOUND_ENV_WATERFALL2 SOUND_ARG_LOAD(4, 0, 0x01, 0x00, 0) -/* not verified */ #define SOUND_ENV_ELEVATOR1 SOUND_ARG_LOAD(4, 0, 0x02, 0x00, 0) -/* not verified */ #define SOUND_ENV_DRONING1 SOUND_ARG_LOAD(4, 1, 0x03, 0x00, 0) -/* not verified */ #define SOUND_ENV_DRONING2 SOUND_ARG_LOAD(4, 0, 0x04, 0x00, 0) -/* not verified */ #define SOUND_ENV_WIND1 SOUND_ARG_LOAD(4, 0, 0x05, 0x00, 0) -/* not verified */ #define SOUND_ENV_MOVING_SAND_SNOW 0x4006 -/* not verified */ #define SOUND_ENV_UNK07 0x4007 -/* not verified */ #define SOUND_ENV_ELEVATOR2 SOUND_ARG_LOAD(4, 0, 0x08, 0x00, 0) -/* not verified */ #define SOUND_ENV_WATER SOUND_ARG_LOAD(4, 0, 0x09, 0x00, 0) -/* not verified */ #define SOUND_ENV_UNKNOWN2 SOUND_ARG_LOAD(4, 0, 0x0A, 0x00, 0) -/* not verified */ #define SOUND_ENV_BOAT_ROCKING1 SOUND_ARG_LOAD(4, 0, 0x0B, 0x00, 0) -/* not verified */ #define SOUND_ENV_ELEVATOR3 SOUND_ARG_LOAD(4, 0, 0x0C, 0x00, 0) -/* not verified */ #define SOUND_ENV_ELEVATOR4 SOUND_ARG_LOAD(4, 0, 0x0D, 0x00, 0) -/* not verified */ #define SOUND_ENV_ELEVATOR4_2 SOUND_ARG_LOAD(4, 1, 0x0D, 0x00, 0) -/* not verified */ #define SOUND_ENV_MOVINGSAND SOUND_ARG_LOAD(4, 0, 0x0E, 0x00, 0) -/* not verified */ #define SOUND_ENV_MERRY_GO_ROUND_CREAKING SOUND_ARG_LOAD(4, 0, 0x0F, 0x40, 0) -/* not verified */ #define SOUND_ENV_WIND2 SOUND_ARG_LOAD(4, 0, 0x10, 0x80, 0) -/* not verified */ #define SOUND_ENV_UNK12 0x4012 -/* not verified */ #define SOUND_ENV_SLIDING SOUND_ARG_LOAD(4, 0, 0x13, 0x00, 0) -/* not verified */ #define SOUND_ENV_STAR SOUND_ARG_LOAD(4, 0, 0x14, 0x00, 1) -/* not verified */ #define SOUND_ENV_UNKNOWN4 SOUND_ARG_LOAD(4, 1, 0x15, 0x00, 0) -/* not verified */ #define SOUND_ENV_WATER_DRAIN SOUND_ARG_LOAD(4, 1, 0x16, 0x00, 0) -/* not verified */ #define SOUND_ENV_METAL_BOX_PUSH SOUND_ARG_LOAD(4, 0, 0x17, 0x80, 0) -/* not verified */ #define SOUND_ENV_SINK_QUICKSAND SOUND_ARG_LOAD(4, 0, 0x18, 0x80, 0) - -/* Object Sound Effects */ -#define SOUND_OBJ_SUSHI_SHARK_WATER_SOUND SOUND_ARG_LOAD(5, 0, 0x00, 0x80, 8) -#define SOUND_OBJ_MRI_SHOOT SOUND_ARG_LOAD(5, 0, 0x01, 0x00, 8) -#define SOUND_OBJ_BABY_PENGUIN_WALK SOUND_ARG_LOAD(5, 0, 0x02, 0x00, 8) -#define SOUND_OBJ_BOWSER_WALK SOUND_ARG_LOAD(5, 0, 0x03, 0x00, 8) -#define SOUND_OBJ_BOWSER_TAIL_PICKUP SOUND_ARG_LOAD(5, 0, 0x05, 0x00, 8) -#define SOUND_OBJ_BOWSER_DEFEATED SOUND_ARG_LOAD(5, 0, 0x06, 0x00, 8) -#define SOUND_OBJ_BOWSER_SPINNING SOUND_ARG_LOAD(5, 0, 0x07, 0x00, 8) -#define SOUND_OBJ_BOWSER_INHALING SOUND_ARG_LOAD(5, 0, 0x08, 0x00, 8) -#define SOUND_OBJ_BIG_PENGUIN_WALK SOUND_ARG_LOAD(5, 0, 0x09, 0x80, 8) -#define SOUND_OBJ_BOO_BOUNCE_TOP SOUND_ARG_LOAD(5, 0, 0x0A, 0x00, 8) -#define SOUND_OBJ_BOO_LAUGH_SHORT SOUND_ARG_LOAD(5, 0, 0x0B, 0x00, 8) -#define SOUND_OBJ_THWOMP SOUND_ARG_LOAD(5, 0, 0x0C, 0xA0, 8) -/* not verified */ #define SOUND_OBJ_CANNON1 SOUND_ARG_LOAD(5, 0, 0x0D, 0xF0, 8) -/* not verified */ #define SOUND_OBJ_CANNON2 SOUND_ARG_LOAD(5, 0, 0x0E, 0xF0, 8) -/* not verified */ #define SOUND_OBJ_CANNON3 SOUND_ARG_LOAD(5, 0, 0x0F, 0xF0, 8) -/* not verified */ #define SOUND_OBJ_JUMP_WALK_WATER 0x5012 -/* not verified */ #define SOUND_OBJ_UNKNOWN2 SOUND_ARG_LOAD(5, 0, 0x13, 0x00, 8) -#define SOUND_OBJ_MRI_DEATH SOUND_ARG_LOAD(5, 0, 0x14, 0x00, 8) -/* not verified */ #define SOUND_OBJ_POUNDING1 SOUND_ARG_LOAD(5, 0, 0x15, 0x50, 8) -/* not verified */ #define SOUND_OBJ_POUNDING1_HIGHPRIO SOUND_ARG_LOAD(5, 0, 0x15, 0x80, 8) -#define SOUND_OBJ_WHOMP_LOWPRIO SOUND_ARG_LOAD(5, 0, 0x16, 0x60, 8) -#define SOUND_OBJ_KING_BOBOMB SOUND_ARG_LOAD(5, 0, 0x16, 0x80, 8) -/* not verified */ #define SOUND_OBJ_BULLY_METAL SOUND_ARG_LOAD(5, 0, 0x17, 0x80, 8) -/* not verified */ #define SOUND_OBJ_BULLY_EXPLODE SOUND_ARG_LOAD(5, 0, 0x18, 0xA0, 8) -/* not verified */ #define SOUND_OBJ_BULLY_EXPLODE_2 SOUND_ARG_LOAD(5, 1, 0x18, 0xA0, 8) -/* not verified */ #define SOUND_OBJ_POUNDING_CANNON SOUND_ARG_LOAD(5, 0, 0x1A, 0x50, 8) -/* not verified */ #define SOUND_OBJ_BULLY_WALK SOUND_ARG_LOAD(5, 0, 0x1B, 0x30, 8) -/* not verified */ #define SOUND_OBJ_UNKNOWN3 SOUND_ARG_LOAD(5, 0, 0x1D, 0x80, 8) -/* not verified */ #define SOUND_OBJ_UNKNOWN4 SOUND_ARG_LOAD(5, 0, 0x1E, 0xA0, 8) -#define SOUND_OBJ_BABY_PENGUIN_DIVE SOUND_ARG_LOAD(5, 0, 0x1F, 0x40, 8) -#define SOUND_OBJ_GOOMBA_WALK SOUND_ARG_LOAD(5, 0, 0x20, 0x00, 8) -#define SOUND_OBJ_UKIKI_CHATTER_LONG SOUND_ARG_LOAD(5, 0, 0x21, 0x00, 8) -#define SOUND_OBJ_MONTY_MOLE_ATTACK SOUND_ARG_LOAD(5, 0, 0x22, 0x00, 8) -#define SOUND_OBJ_EVIL_LAKITU_THROW SOUND_ARG_LOAD(5, 0, 0x22, 0x20, 8) -/* not verified */ #define SOUND_OBJ_UNK23 0x5023 -#define SOUND_OBJ_DYING_ENEMY1 SOUND_ARG_LOAD(5, 0, 0x24, 0x40, 8) -/* not verified */ #define SOUND_OBJ_CANNON4 SOUND_ARG_LOAD(5, 0, 0x25, 0x40, 8) -/* not verified */ #define SOUND_OBJ_DYING_ENEMY2 0x5026 -#define SOUND_OBJ_BOBOMB_WALK SOUND_ARG_LOAD(5, 0, 0x27, 0x00, 8) -/* not verified */ #define SOUND_OBJ_SOMETHING_LANDING SOUND_ARG_LOAD(5, 0, 0x28, 0x80, 8) -/* not verified */ #define SOUND_OBJ_DIVING_IN_WATER SOUND_ARG_LOAD(5, 0, 0x29, 0xA0, 8) -/* not verified */ #define SOUND_OBJ_SNOW_SAND1 SOUND_ARG_LOAD(5, 0, 0x2A, 0x00, 8) -/* not verified */ #define SOUND_OBJ_SNOW_SAND2 SOUND_ARG_LOAD(5, 0, 0x2B, 0x00, 8) -#define SOUND_OBJ_DEFAULT_DEATH SOUND_ARG_LOAD(5, 0, 0x2C, 0x80, 8) -#define SOUND_OBJ_BIG_PENGUIN_YELL SOUND_ARG_LOAD(5, 0, 0x2D, 0x00, 8) -#define SOUND_OBJ_WATER_BOMB_BOUNCING SOUND_ARG_LOAD(5, 0, 0x2E, 0x80, 8) -#define SOUND_OBJ_GOOMBA_ALERT SOUND_ARG_LOAD(5, 0, 0x2F, 0x00, 8) -#define SOUND_OBJ_WIGGLER_JUMP SOUND_ARG_LOAD(5, 0, 0x2F, 0x60, 8) -/* not verified */ #define SOUND_OBJ_STOMPED SOUND_ARG_LOAD(5, 0, 0x30, 0x80, 8) -/* not verified */ #define SOUND_OBJ_UNKNOWN6 SOUND_ARG_LOAD(5, 0, 0x31, 0x00, 8) -/* not verified */ #define SOUND_OBJ_DIVING_INTO_WATER SOUND_ARG_LOAD(5, 0, 0x32, 0x40, 8) -#define SOUND_OBJ_PIRANHA_PLANT_SHRINK SOUND_ARG_LOAD(5, 0, 0x33, 0x40, 8) -#define SOUND_OBJ_KOOPA_THE_QUICK_WALK SOUND_ARG_LOAD(5, 0, 0x34, 0x20, 8) -#define SOUND_OBJ_KOOPA_WALK SOUND_ARG_LOAD(5, 0, 0x35, 0x00, 8) -#define SOUND_OBJ_BULLY_WALKING SOUND_ARG_LOAD(5, 0, 0x36, 0x60, 8) -#define SOUND_OBJ_DORRIE SOUND_ARG_LOAD(5, 0, 0x37, 0x60, 8) -#define SOUND_OBJ_BOWSER_LAUGH SOUND_ARG_LOAD(5, 0, 0x38, 0x80, 8) -#define SOUND_OBJ_UKIKI_CHATTER_SHORT SOUND_ARG_LOAD(5, 0, 0x39, 0x00, 8) -#define SOUND_OBJ_UKIKI_CHATTER_IDLE SOUND_ARG_LOAD(5, 0, 0x3A, 0x00, 8) -#define SOUND_OBJ_UKIKI_STEP_DEFAULT SOUND_ARG_LOAD(5, 0, 0x3B, 0x00, 8) -#define SOUND_OBJ_UKIKI_STEP_LEAVES SOUND_ARG_LOAD(5, 0, 0x3C, 0x00, 8) -#define SOUND_OBJ_KOOPA_TALK SOUND_ARG_LOAD(5, 0, 0x3D, 0xA0, 8) -#define SOUND_OBJ_KOOPA_DAMAGE SOUND_ARG_LOAD(5, 0, 0x3E, 0xA0, 8) -/* not verified */ #define SOUND_OBJ_KLEPTO1 SOUND_ARG_LOAD(5, 0, 0x3F, 0x40, 8) -/* not verified */ #define SOUND_OBJ_KLEPTO2 SOUND_ARG_LOAD(5, 0, 0x40, 0x60, 8) -#define SOUND_OBJ_KING_BOBOMB_TALK SOUND_ARG_LOAD(5, 0, 0x41, 0x00, 8) -#define SOUND_OBJ_KING_BOBOMB_JUMP SOUND_ARG_LOAD(5, 0, 0x46, 0x80, 8) -#define SOUND_OBJ_KING_WHOMP_DEATH SOUND_ARG_LOAD(5, 1, 0x47, 0xC0, 8) -#define SOUND_OBJ_BOO_LAUGH_LONG SOUND_ARG_LOAD(5, 0, 0x48, 0x00, 8) -/* not verified */ #define SOUND_OBJ_EEL SOUND_ARG_LOAD(5, 0, 0x4A, 0x00, 8) -/* not verified */ #define SOUND_OBJ_EEL_2 SOUND_ARG_LOAD(5, 2, 0x4A, 0x00, 8) -#define SOUND_OBJ_EYEROK_SHOW_EYE SOUND_ARG_LOAD(5, 2, 0x4B, 0x00, 8) -#define SOUND_OBJ_MR_BLIZZARD_ALERT SOUND_ARG_LOAD(5, 0, 0x4C, 0x00, 8) -#define SOUND_OBJ_SNUFIT_SHOOT SOUND_ARG_LOAD(5, 0, 0x4D, 0x00, 8) -#define SOUND_OBJ_SKEETER_WALK SOUND_ARG_LOAD(5, 0, 0x4E, 0x00, 8) -/* not verified */ #define SOUND_OBJ_WALKING_WATER SOUND_ARG_LOAD(5, 0, 0x4F, 0x00, 8) -#define SOUND_OBJ_BIRD_CHIRP3 SOUND_ARG_LOAD(5, 0, 0x51, 0x40, 0) -#define SOUND_OBJ_PIRANHA_PLANT_APPEAR SOUND_ARG_LOAD(5, 0, 0x54, 0x20, 8) -#define SOUND_OBJ_FLAME_BLOWN SOUND_ARG_LOAD(5, 0, 0x55, 0x80, 8) -#define SOUND_OBJ_MAD_PIANO_CHOMPING SOUND_ARG_LOAD(5, 2, 0x56, 0x40, 8) -#define SOUND_OBJ_BOBOMB_BUDDY_TALK SOUND_ARG_LOAD(5, 0, 0x58, 0x40, 8) -/* not verified */ #define SOUND_OBJ_SPINY_UNK59 SOUND_ARG_LOAD(5, 0, 0x59, 0x10, 8) -#define SOUND_OBJ_WIGGLER_HIGH_PITCH SOUND_ARG_LOAD(5, 0, 0x5C, 0x40, 8) -#define SOUND_OBJ_HEAVEHO_TOSSED SOUND_ARG_LOAD(5, 0, 0x5D, 0x40, 8) -/* not verified */ #define SOUND_OBJ_WIGGLER_DEATH 0x505E -#define SOUND_OBJ_BOWSER_INTRO_LAUGH SOUND_ARG_LOAD(5, 0, 0x5F, 0x80, 9) -/* not verified */ #define SOUND_OBJ_ENEMY_DEATH_HIGH SOUND_ARG_LOAD(5, 0, 0x60, 0xB0, 8) -/* not verified */ #define SOUND_OBJ_ENEMY_DEATH_LOW SOUND_ARG_LOAD(5, 0, 0x61, 0xB0, 8) -#define SOUND_OBJ_SWOOP_DEATH SOUND_ARG_LOAD(5, 0, 0x62, 0xB0, 8) -#define SOUND_OBJ_KOOPA_FLYGUY_DEATH SOUND_ARG_LOAD(5, 0, 0x63, 0xB0, 8) -#define SOUND_OBJ_POKEY_DEATH SOUND_ARG_LOAD(5, 0, 0x63, 0xC0, 8) -/* not verified */ #define SOUND_OBJ_SNOWMAN_BOUNCE SOUND_ARG_LOAD(5, 0, 0x64, 0xC0, 8) -#define SOUND_OBJ_SNOWMAN_EXPLODE SOUND_ARG_LOAD(5, 0, 0x65, 0xD0, 8) -/* not verified */ #define SOUND_OBJ_POUNDING_LOUD SOUND_ARG_LOAD(5, 0, 0x68, 0x40, 8) -/* not verified */ #define SOUND_OBJ_MIPS_RABBIT SOUND_ARG_LOAD(5, 0, 0x6A, 0x00, 8) -/* not verified */ #define SOUND_OBJ_MIPS_RABBIT_WATER SOUND_ARG_LOAD(5, 0, 0x6C, 0x00, 8) -#define SOUND_OBJ_EYEROK_EXPLODE SOUND_ARG_LOAD(5, 0, 0x6D, 0x00, 8) -#define SOUND_OBJ_CHUCKYA_DEATH SOUND_ARG_LOAD(5, 1, 0x6E, 0x00, 8) -#define SOUND_OBJ_WIGGLER_TALK SOUND_ARG_LOAD(5, 0, 0x6F, 0x00, 8) -#define SOUND_OBJ_WIGGLER_ATTACKED SOUND_ARG_LOAD(5, 0, 0x70, 0x60, 8) -#define SOUND_OBJ_WIGGLER_LOW_PITCH SOUND_ARG_LOAD(5, 0, 0x71, 0x20, 8) -#define SOUND_OBJ_SNUFIT_SKEETER_DEATH SOUND_ARG_LOAD(5, 0, 0x72, 0xC0, 8) -#define SOUND_OBJ_BUBBA_CHOMP SOUND_ARG_LOAD(5, 0, 0x73, 0x40, 8) -#define SOUND_OBJ_ENEMY_DEFEAT_SHRINK SOUND_ARG_LOAD(5, 0, 0x74, 0x40, 8) - -#define SOUND_AIR_BOWSER_SPIT_FIRE SOUND_ARG_LOAD(6, 0, 0x00, 0x00, 0) -#define SOUND_AIR_UNK01 0x6001 // ? -#define SOUND_AIR_LAKITU_FLY SOUND_ARG_LOAD(6, 0, 0x02, 0x80, 0) -#define SOUND_AIR_LAKITU_FLY_HIGHPRIO SOUND_ARG_LOAD(6, 0, 0x02, 0xFF, 0) -#define SOUND_AIR_AMP_BUZZ SOUND_ARG_LOAD(6, 0, 0x03, 0x40, 0) -#define SOUND_AIR_BLOW_FIRE SOUND_ARG_LOAD(6, 0, 0x04, 0x80, 0) -#define SOUND_AIR_BLOW_WIND SOUND_ARG_LOAD(6, 0, 0x04, 0x40, 0) -#define SOUND_AIR_ROUGH_SLIDE SOUND_ARG_LOAD(6, 0, 0x05, 0x00, 0) -#define SOUND_AIR_HEAVEHO_MOVE SOUND_ARG_LOAD(6, 0, 0x06, 0x40, 0) -#define SOUND_AIR_UNK07 0x6007 // ? -#define SOUND_AIR_BOBOMB_LIT_FUSE SOUND_ARG_LOAD(6, 0, 0x08, 0x60, 0) -#define SOUND_AIR_HOWLING_WIND SOUND_ARG_LOAD(6, 0, 0x09, 0x80, 0) -#define SOUND_AIR_CHUCKYA_MOVE SOUND_ARG_LOAD(6, 0, 0x0A, 0x40, 0) -#define SOUND_AIR_PEACH_TWINKLE SOUND_ARG_LOAD(6, 0, 0x0B, 0x40, 0) -#define SOUND_AIR_CASTLE_OUTDOORS_AMBIENT SOUND_ARG_LOAD(6, 0, 0x10, 0x40, 0) - -/* Menu Sound Effects */ -#define SOUND_MENU_CHANGE_SELECT SOUND_ARG_LOAD(7, 0, 0x00, 0xF8, 8) -/* not verified */ #define SOUND_MENU_REVERSE_PAUSE 0x7001 -#define SOUND_MENU_PAUSE SOUND_ARG_LOAD(7, 0, 0x02, 0xF0, 8) -#define SOUND_MENU_PAUSE_HIGHPRIO SOUND_ARG_LOAD(7, 0, 0x02, 0xFF, 8) -#define SOUND_MENU_PAUSE_2 SOUND_ARG_LOAD(7, 0, 0x03, 0xFF, 8) -#define SOUND_MENU_MESSAGE_APPEAR SOUND_ARG_LOAD(7, 0, 0x04, 0x00, 8) -#define SOUND_MENU_MESSAGE_DISAPPEAR SOUND_ARG_LOAD(7, 0, 0x05, 0x00, 8) -#define SOUND_MENU_CAMERA_ZOOM_IN SOUND_ARG_LOAD(7, 0, 0x06, 0x00, 8) -#define SOUND_MENU_CAMERA_ZOOM_OUT SOUND_ARG_LOAD(7, 0, 0x07, 0x00, 8) -#define SOUND_MENU_PINCH_MARIO_FACE SOUND_ARG_LOAD(7, 0, 0x08, 0x00, 8) -#define SOUND_MENU_LET_GO_MARIO_FACE SOUND_ARG_LOAD(7, 0, 0x09, 0x00, 8) -#define SOUND_MENU_HAND_APPEAR SOUND_ARG_LOAD(7, 0, 0x0A, 0x00, 8) -#define SOUND_MENU_HAND_DISAPPEAR SOUND_ARG_LOAD(7, 0, 0x0B, 0x00, 8) -/* not verified */ #define SOUND_MENU_UNK0C SOUND_ARG_LOAD(7, 0, 0x0C, 0x00, 8) -/* not verified */ #define SOUND_MENU_POWER_METER SOUND_ARG_LOAD(7, 0, 0x0D, 0x00, 8) -#define SOUND_MENU_CAMERA_BUZZ SOUND_ARG_LOAD(7, 0, 0x0E, 0x00, 8) -#define SOUND_MENU_CAMERA_TURN SOUND_ARG_LOAD(7, 0, 0x0F, 0x00, 8) -/* not verified */ #define SOUND_MENU_UNK10 0x7010 -#define SOUND_MENU_CLICK_FILE_SELECT SOUND_ARG_LOAD(7, 0, 0x11, 0x00, 8) -/* not verified */ #define SOUND_MENU_MESSAGE_NEXT_PAGE SOUND_ARG_LOAD(7, 0, 0x13, 0x00, 8) -#define SOUND_MENU_COIN_ITS_A_ME_MARIO SOUND_ARG_LOAD(7, 0, 0x14, 0x00, 8) -#define SOUND_MENU_YOSHI_GAIN_LIVES SOUND_ARG_LOAD(7, 0, 0x15, 0x00, 8) -#define SOUND_MENU_ENTER_PIPE SOUND_ARG_LOAD(7, 0, 0x16, 0xA0, 8) -#define SOUND_MENU_EXIT_PIPE SOUND_ARG_LOAD(7, 0, 0x17, 0xA0, 8) -#define SOUND_MENU_BOWSER_LAUGH SOUND_ARG_LOAD(7, 0, 0x18, 0x80, 8) -#define SOUND_MENU_ENTER_HOLE SOUND_ARG_LOAD(7, 1, 0x19, 0x80, 8) -/* not verified */ #define SOUND_MENU_CLICK_CHANGE_VIEW SOUND_ARG_LOAD(7, 0, 0x1A, 0x80, 8) -/* not verified */ #define SOUND_MENU_CAMERA_UNUSED1 0x701B -/* not verified */ #define SOUND_MENU_CAMERA_UNUSED2 0x701C -/* not verified */ #define SOUND_MENU_MARIO_CASTLE_WARP SOUND_ARG_LOAD(7, 0, 0x1D, 0xB0, 8) -#define SOUND_MENU_STAR_SOUND SOUND_ARG_LOAD(7, 0, 0x1E, 0xFF, 8) -#define SOUND_MENU_THANK_YOU_PLAYING_MY_GAME SOUND_ARG_LOAD(7, 0, 0x1F, 0xFF, 8) -/* not verified */ #define SOUND_MENU_READ_A_SIGN 0x7020 -/* not verified */ #define SOUND_MENU_EXIT_A_SIGN 0x7021 -/* not verified */ #define SOUND_MENU_MARIO_CASTLE_WARP2 SOUND_ARG_LOAD(7, 0, 0x22, 0x20, 8) -#define SOUND_MENU_STAR_SOUND_OKEY_DOKEY SOUND_ARG_LOAD(7, 0, 0x23, 0xFF, 8) -#define SOUND_MENU_STAR_SOUND_LETS_A_GO SOUND_ARG_LOAD(7, 0, 0x24, 0xFF, 8) - -// US/EU only; an index between 0-7 or 0-4 is added to the sound ID before -// playing, producing the same sound with different pitch. -#define SOUND_MENU_COLLECT_RED_COIN SOUND_ARG_LOAD(7, 8, 0x28, 0x90, 8) -#define SOUND_MENU_COLLECT_SECRET SOUND_ARG_LOAD(7, 0, 0x30, 0x20, 8) - -// Channel 8 loads sounds from the same place as channel 3, making it possible -// to play two channel 3 sounds at once (since just one sound from each channel -// can play at a given time). -#define SOUND_GENERAL2_BOBOMB_EXPLOSION SOUND_ARG_LOAD(8, 0, 0x2E, 0x20, 8) -#define SOUND_GENERAL2_PURPLE_SWITCH SOUND_ARG_LOAD(8, 0, 0x3E, 0xC0, 8) -#define SOUND_GENERAL2_ROTATING_BLOCK_CLICK SOUND_ARG_LOAD(8, 0, 0x40, 0x00, 8) -#define SOUND_GENERAL2_SPINDEL_ROLL SOUND_ARG_LOAD(8, 0, 0x48, 0x20, 8) -#define SOUND_GENERAL2_PYRAMID_TOP_SPIN SOUND_ARG_LOAD(8, 1, 0x4B, 0xE0, 8) -#define SOUND_GENERAL2_PYRAMID_TOP_EXPLOSION SOUND_ARG_LOAD(8, 1, 0x4C, 0xF0, 8) -#define SOUND_GENERAL2_BIRD_CHIRP2 SOUND_ARG_LOAD(8, 0, 0x50, 0x40, 0) -#define SOUND_GENERAL2_SWITCH_TICK_FAST SOUND_ARG_LOAD(8, 0, 0x54, 0xF0, 1) -#define SOUND_GENERAL2_SWITCH_TICK_SLOW SOUND_ARG_LOAD(8, 0, 0x55, 0xF0, 1) -#define SOUND_GENERAL2_STAR_APPEARS SOUND_ARG_LOAD(8, 0, 0x57, 0xFF, 9) -#define SOUND_GENERAL2_ROTATING_BLOCK_ALERT SOUND_ARG_LOAD(8, 0, 0x59, 0x00, 8) -#define SOUND_GENERAL2_BOWSER_EXPLODE SOUND_ARG_LOAD(8, 0, 0x60, 0x00, 8) -#define SOUND_GENERAL2_BOWSER_KEY SOUND_ARG_LOAD(8, 0, 0x61, 0x00, 8) -#define SOUND_GENERAL2_1UP_APPEAR SOUND_ARG_LOAD(8, 0, 0x63, 0xD0, 8) -#define SOUND_GENERAL2_RIGHT_ANSWER SOUND_ARG_LOAD(8, 0, 0x6A, 0xA0, 8) - -// Channel 9 loads sounds from the same place as channel 5. -#define SOUND_OBJ2_BOWSER_ROAR SOUND_ARG_LOAD(9, 0, 0x04, 0x00, 8) -#define SOUND_OBJ2_PIRANHA_PLANT_BITE SOUND_ARG_LOAD(9, 0, 0x10, 0x50, 8) -#define SOUND_OBJ2_PIRANHA_PLANT_DYING SOUND_ARG_LOAD(9, 0, 0x11, 0x60, 8) -#define SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE SOUND_ARG_LOAD(9, 0, 0x19, 0x20, 8) -#define SOUND_OBJ2_BULLY_ATTACKED SOUND_ARG_LOAD(9, 0, 0x1C, 0x00, 8) -#define SOUND_OBJ2_KING_BOBOMB_DAMAGE SOUND_ARG_LOAD(9, 1, 0x42, 0x40, 8) -#define SOUND_OBJ2_SCUTTLEBUG_WALK SOUND_ARG_LOAD(9, 0, 0x43, 0x40, 8) -#define SOUND_OBJ2_SCUTTLEBUG_ALERT SOUND_ARG_LOAD(9, 0, 0x44, 0x40, 8) -#define SOUND_OBJ2_BABY_PENGUIN_YELL SOUND_ARG_LOAD(9, 0, 0x45, 0x00, 8) -#define SOUND_OBJ2_SWOOP SOUND_ARG_LOAD(9, 0, 0x49, 0x00, 8) -#define SOUND_OBJ2_BIRD_CHIRP1 SOUND_ARG_LOAD(9, 0, 0x52, 0x40, 0) -#define SOUND_OBJ2_LARGE_BULLY_ATTACKED SOUND_ARG_LOAD(9, 0, 0x57, 0x00, 8) -#define SOUND_OBJ2_EYEROK_SOUND_SHORT SOUND_ARG_LOAD(9, 3, 0x5A, 0x00, 8) -#define SOUND_OBJ2_WHOMP_SOUND_SHORT SOUND_ARG_LOAD(9, 3, 0x5A, 0xC0, 8) -#define SOUND_OBJ2_EYEROK_SOUND_LONG SOUND_ARG_LOAD(9, 2, 0x5B, 0x00, 8) -#define SOUND_OBJ2_BOWSER_TELEPORT SOUND_ARG_LOAD(9, 0, 0x66, 0x80, 8) -#define SOUND_OBJ2_MONTY_MOLE_APPEAR SOUND_ARG_LOAD(9, 0, 0x67, 0x80, 8) -#define SOUND_OBJ2_BOSS_DIALOG_GRUNT SOUND_ARG_LOAD(9, 0, 0x69, 0x40, 8) -#define SOUND_OBJ2_MRI_SPINNING SOUND_ARG_LOAD(9, 0, 0x6B, 0x00, 8) - -#endif // AUDIO_DEFINES_H diff --git a/include/behavior_data.h b/include/behavior_data.h index 9e130b8d..3c44f400 100644 --- a/include/behavior_data.h +++ b/include/behavior_data.h @@ -209,9 +209,9 @@ extern const BehaviorScript bhvTuxiesMother[]; extern const BehaviorScript bhvPenguinBaby[]; extern const BehaviorScript bhvUnused20E0[]; extern const BehaviorScript bhvSmallPenguin[]; -extern const BehaviorScript bhvFish2[]; -extern const BehaviorScript bhvFish3[]; -extern const BehaviorScript bhvLargeFishGroup[]; +extern const BehaviorScript bhvManyBlueFishSpawner[]; +extern const BehaviorScript bhvFewBlueFishSpawner[]; +extern const BehaviorScript bhvFishSpawner[]; extern const BehaviorScript bhvFishCommon[]; extern const BehaviorScript bhvFish[]; extern const BehaviorScript bhvWdwExpressElevator[]; diff --git a/include/behavior_table.h b/include/behavior_table.h index 8a20092b..8b01e8b6 100644 --- a/include/behavior_table.h +++ b/include/behavior_table.h @@ -208,9 +208,9 @@ enum BehaviorId { id_bhvPenguinBaby, id_bhvUnused20E0, id_bhvSmallPenguin, - id_bhvFish2, - id_bhvFish3, - id_bhvLargeFishGroup, + id_bhvManyBlueFishSpawner, + id_bhvFewBlueFishSpawner, + id_bhvFishSpawner, id_bhvFish, id_bhvWdwExpressElevator, id_bhvWdwExpressElevatorPlatform, diff --git a/include/config.h b/include/config.h index 4512546e..4e9903e6 100644 --- a/include/config.h +++ b/include/config.h @@ -13,7 +13,7 @@ /// Fixes bug where obtaining over 999 coins sets the number of lives to 999 (or -25) #define BUGFIX_MAX_LIVES (0 || VERSION_US || VERSION_EU || VERSION_SH) /// Fixes bug where the Boss music won't fade out after defeating King Bob-omb -#define BUGFIX_KING_BOB_OMB_FADE_MUSIC (0 || VERSION_US || VERSION_EU) +#define BUGFIX_KING_BOB_OMB_FADE_MUSIC (0 || VERSION_US || VERSION_EU || VERSION_SH) /// Fixes bug in Bob-Omb Battlefield where entering a warp stops the Koopa race music #define BUGFIX_KOOPA_RACE_MUSIC (0 || VERSION_US || VERSION_EU || VERSION_SH) /// Fixes bug where Piranha Plants do not reset their action state when the @@ -22,7 +22,7 @@ /// Fixes bug where sleeping Piranha Plants damage players that bump into them #define BUGFIX_PIRANHA_PLANT_SLEEP_DAMAGE (0 || VERSION_US || VERSION_SH) /// Fixes bug where it shows a star when you grab a key in bowser battle stages -#define BUGFIX_STAR_BOWSER_KEY (0 || VERSION_US || VERSION_EU) +#define BUGFIX_STAR_BOWSER_KEY (0 || VERSION_US || VERSION_EU || VERSION_SH) // Screen Size Defines #define SCREEN_WIDTH 320 diff --git a/include/level_commands.h b/include/level_commands.h index 274dfa34..73b1b165 100644 --- a/include/level_commands.h +++ b/include/level_commands.h @@ -104,6 +104,7 @@ CMD_BBH(0x11, 0x08, arg), \ CMD_PTR(func) +// Calls func in a loop until it returns nonzero #define CALL_LOOP(arg, func) \ CMD_BBH(0x12, 0x08, arg), \ CMD_PTR(func) diff --git a/include/luigi_audio_defines.h b/include/luigi_audio_defines.h deleted file mode 100644 index 200e990d..00000000 --- a/include/luigi_audio_defines.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef LUIGI_AUDIO_DEFINES_H -#define LUIGI_AUDIO_DEFINES_H - -/* Mario Sound Effects */ -// A random number 0-2 is added to the sound ID before playing, producing Yah/Wah/Hoo -#define SOUND_LUIGI_YAH_WAH_HOO SOUND_ARG_LOAD(0x0A, 4, 0x00, 0x80, 8) -#define SOUND_LUIGI_HOOHOO SOUND_ARG_LOAD(0x0A, 4, 0x03, 0x80, 8) -#define SOUND_LUIGI_YAHOO SOUND_ARG_LOAD(0x0A, 4, 0x04, 0x80, 8) -#define SOUND_LUIGI_UH SOUND_ARG_LOAD(0x0A, 4, 0x05, 0x80, 8) -#define SOUND_LUIGI_HRMM SOUND_ARG_LOAD(0x0A, 4, 0x06, 0x80, 8) -#define SOUND_LUIGI_WAH2 SOUND_ARG_LOAD(0x0A, 4, 0x07, 0x80, 8) -#define SOUND_LUIGI_WHOA SOUND_ARG_LOAD(0x0A, 4, 0x08, 0xC0, 8) -#define SOUND_LUIGI_EEUH SOUND_ARG_LOAD(0x0A, 4, 0x09, 0x80, 8) -#define SOUND_LUIGI_ATTACKED SOUND_ARG_LOAD(0x0A, 4, 0x0A, 0xFF, 8) -#define SOUND_LUIGI_OOOF SOUND_ARG_LOAD(0x0A, 4, 0x0B, 0x80, 8) -#define SOUND_LUIGI_OOOF2 SOUND_ARG_LOAD(0x0A, 4, 0x0B, 0xD0, 8) -#define SOUND_LUIGI_HERE_WE_GO SOUND_ARG_LOAD(0x0A, 4, 0x0C, 0x80, 8) -#define SOUND_LUIGI_YAWNING SOUND_ARG_LOAD(0x0A, 4, 0x0D, 0x80, 8) -#define SOUND_LUIGI_SNORING1 SOUND_ARG_LOAD(0x0A, 4, 0x0E, 0x00, 8) -#define SOUND_LUIGI_SNORING2 SOUND_ARG_LOAD(0x0A, 4, 0x0F, 0x00, 8) -#define SOUND_LUIGI_WAAAOOOW SOUND_ARG_LOAD(0x0A, 4, 0x10, 0xC0, 8) -#define SOUND_LUIGI_HAHA SOUND_ARG_LOAD(0x0A, 4, 0x11, 0x80, 8) -#define SOUND_LUIGI_HAHA_2 SOUND_ARG_LOAD(0x0A, 4, 0x11, 0xF0, 8) -#define SOUND_LUIGI_UH2 SOUND_ARG_LOAD(0x0A, 4, 0x13, 0xD0, 8) -#define SOUND_LUIGI_UH2_2 SOUND_ARG_LOAD(0x0A, 4, 0x13, 0x80, 8) -#define SOUND_LUIGI_ON_FIRE SOUND_ARG_LOAD(0x0A, 4, 0x14, 0xA0, 8) -#define SOUND_LUIGI_DYING SOUND_ARG_LOAD(0x0A, 4, 0x15, 0xFF, 8) -#define SOUND_LUIGI_PANTING_COLD SOUND_ARG_LOAD(0x0A, 4, 0x16, 0x80, 8) - -// A random number 0-2 is added to the sound ID before playing -#define SOUND_LUIGI_PANTING SOUND_ARG_LOAD(0x0A, 4, 0x18, 0x80, 8) - -#define SOUND_LUIGI_COUGHING1 SOUND_ARG_LOAD(0x0A, 4, 0x1B, 0x80, 8) -#define SOUND_LUIGI_COUGHING2 SOUND_ARG_LOAD(0x0A, 4, 0x1C, 0x80, 8) -#define SOUND_LUIGI_COUGHING3 SOUND_ARG_LOAD(0x0A, 4, 0x1D, 0x80, 8) -#define SOUND_LUIGI_PUNCH_YAH SOUND_ARG_LOAD(0x0A, 4, 0x1E, 0x80, 8) -#define SOUND_LUIGI_PUNCH_HOO SOUND_ARG_LOAD(0x0A, 4, 0x1F, 0x80, 8) -#define SOUND_LUIGI_MAMA_MIA SOUND_ARG_LOAD(0x0A, 4, 0x20, 0x80, 8) -//#define SOUND_LUIGI_OKEY_DOKEY 0x2021 -#define SOUND_LUIGI_GROUND_POUND_WAH SOUND_ARG_LOAD(0x0A, 4, 0x22, 0x80, 8) -#define SOUND_LUIGI_DROWNING SOUND_ARG_LOAD(0x0A, 4, 0x23, 0xF0, 8) -#define SOUND_LUIGI_PUNCH_WAH SOUND_ARG_LOAD(0x0A, 4, 0x24, 0x80, 8) - -// A random number 0-4 is added to the sound ID before playing, producing one of -// Yahoo! (60% chance), Waha! (20%), or Yippee! (20%). -#define SOUND_LUIGI_YAHOO_WAHA_YIPPEE SOUND_ARG_LOAD(0x0A, 4, 0x2B, 0x80, 8) - -#define SOUND_LUIGI_DOH SOUND_ARG_LOAD(0x0A, 4, 0x30, 0x80, 8) -#define SOUND_LUIGI_GAME_OVER SOUND_ARG_LOAD(0x0A, 4, 0x31, 0xFF, 8) -#define SOUND_LUIGI_HELLO SOUND_ARG_LOAD(0x0A, 4, 0x32, 0xFF, 8) -#define SOUND_LUIGI_PRESS_START_TO_PLAY SOUND_ARG_LOAD(0x0A, 4, 0x33, 0xFF, 0xA) -#define SOUND_LUIGI_TWIRL_BOUNCE SOUND_ARG_LOAD(0x0A, 4, 0x34, 0x80, 8) -#define SOUND_LUIGI_SNORING3 SOUND_ARG_LOAD(0x0A, 4, 0x35, 0x00, 8) -#define SOUND_LUIGI_SO_LONGA_BOWSER SOUND_ARG_LOAD(0x0A, 4, 0x36, 0x80, 8) -#define SOUND_LUIGI_IMA_TIRED SOUND_ARG_LOAD(0x0A, 4, 0x37, 0x80, 8) - -#endif // LUIGI_AUDIO_DEFINES_H \ No newline at end of file diff --git a/include/luigi_sounds.h b/include/luigi_sounds.h new file mode 100644 index 00000000..b78bda44 --- /dev/null +++ b/include/luigi_sounds.h @@ -0,0 +1,57 @@ +#ifndef LUIGI_SOUNDS_H +#define LUIGI_SOUNDS_H + +/* Luigi Sound Effects */ +// A random number 0-2 is added to the sound ID before playing, producing Yah/Wah/Hoo +#define SOUND_LUIGI_YAH_WAH_HOO SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x00, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_HOOHOO SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x03, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_YAHOO SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x04, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_UH SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x05, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_HRMM SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x06, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_WAH2 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x07, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_WHOA SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x08, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_EEUH SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x09, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_ATTACKED SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x0A, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_OOOF SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x0B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_OOOF2 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x0B, 0xD0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_HERE_WE_GO SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x0C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_YAWNING SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x0D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_SNORING1 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x0E, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_SNORING2 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x0F, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_WAAAOOOW SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x10, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_HAHA SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x11, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_HAHA_2 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x11, 0xF0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_UH2 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x13, 0xD0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_UH2_2 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x13, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_ON_FIRE SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x14, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_DYING SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x15, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_PANTING_COLD SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x16, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +// A random number 0-2 is added to the sound ID before playing +#define SOUND_LUIGI_PANTING SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x18, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +#define SOUND_LUIGI_COUGHING1 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x1B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_COUGHING2 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x1C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_COUGHING3 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x1D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_PUNCH_YAH SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x1E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_PUNCH_HOO SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x1F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_MAMA_MIA SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x20, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_OKEY_DOKEY SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x21, 0x00, 0) // unused +#define SOUND_LUIGI_GROUND_POUND_WAH SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x22, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_DROWNING SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x23, 0xF0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_PUNCH_WAH SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x24, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +// A random number 0-4 is added to the sound ID before playing, producing one of +// Yahoo! (60% chance), Waha! (20%), or Yippee! (20%). +#define SOUND_LUIGI_YAHOO_WAHA_YIPPEE SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x2B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +#define SOUND_LUIGI_DOH SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x30, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_GAME_OVER SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x31, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_HELLO SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x32, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_PRESS_START_TO_PLAY SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x33, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_NO_ECHO | SOUND_DISCRETE) +#define SOUND_LUIGI_TWIRL_BOUNCE SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x34, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_SNORING3 SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x35, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_SO_LONGA_BOWSER SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x36, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_LUIGI_IMA_TIRED SOUND_ARG_LOAD(SOUND_BANK_LUIGI_VOICE, 0x37, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +#endif // LUIGI_SOUNDS_H \ No newline at end of file diff --git a/include/object_constants.h b/include/object_constants.h index 31e1bb5b..0fa9b7db 100644 --- a/include/object_constants.h +++ b/include/object_constants.h @@ -191,11 +191,22 @@ #define BOBOMB_BUDDY_HAS_NOT_TALKED 0 #define BOBOMB_BUDDY_HAS_TALKED 2 +/* Fish Spawer */ + /* oAction */ + #define FISH_SPAWNER_ACT_SPAWN 0 + #define FISH_SPAWNER_ACT_IDLE 1 + #define FISH_SPAWNER_ACT_RESPAWN 2 + /* oBehParams2ndByte */ + #define FISH_SPAWNER_BP_MANY_BLUE 0 + #define FISH_SPAWNER_BP_FEW_BLUE 1 + #define FISH_SPAWNER_BP_MANY_CYAN 2 + #define FISH_SPAWNER_BP_FEW_CYAN 3 + /* Fish */ /* oAction */ #define FISH_ACT_INIT 0 - #define FISH_ACT_ACTIVE 1 - #define FISH_ACT_RESPAWN 2 + #define FISH_ACT_ROAM 1 + #define FISH_ACT_FLEE 2 /* Blue_Fish */ /* oAction */ @@ -229,7 +240,7 @@ #define AMP_BP_ROT_RADIUS_200 0 #define AMP_BP_ROT_RADIUS_300 1 #define AMP_BP_ROT_RADIUS_400 2 - #define AMP_BP_ROT_RADIUS_0 3 + #define AMP_BP_ROT_RADIUS_0 3 /* oAction */ #define AMP_ACT_IDLE 2 @@ -584,6 +595,11 @@ #define CAMERA_LAKITU_BP_FOLLOW_CAMERA 0 #define CAMERA_LAKITU_BP_INTRO 1 +/* Manta Ray */ + /* oAction */ + #define MANTA_ACT_SPAWN_RINGS 0 + #define MANTA_ACT_NO_RINGS 1 + /* Monty mole */ /* oAction */ #define MONTY_MOLE_ACT_SELECT_HOLE 0 diff --git a/include/object_fields.h b/include/object_fields.h index 99918cc7..56ffe696 100644 --- a/include/object_fields.h +++ b/include/object_fields.h @@ -191,10 +191,10 @@ #define /*0x100*/ oArrowLiftUnk100 OBJECT_FIELD_S32(0x1E) /* Back-and-Forth Platform */ -#define /*0x0F4*/ oBackAndForthPlatformUnkF4 OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oBackAndForthPlatformUnkF8 OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oBackAndForthPlatformUnkFC OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oBackAndForthPlatformUnk100 OBJECT_FIELD_F32(0x1E) +#define /*0x0F4*/ oBackAndForthPlatformDirection OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oBackAndForthPlatformPathLength OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oBackAndForthPlatformDistance OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oBackAndForthPlatformVel OBJECT_FIELD_F32(0x1E) /* Bird */ #define /*0x0F4*/ oBirdSpeed OBJECT_FIELD_F32(0x1B) @@ -490,30 +490,30 @@ #define /*0x100*/ oBlueFishRandomAngle OBJECT_FIELD_F32(0x1E) /* Fish Group */ -#define /*0x0F4*/ oFishWaterLevel OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oFishPosY OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oFishRandomOffset OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oFishRandomSpeed OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oFishRespawnDistance OBJECT_FIELD_F32(0x1F) -#define /*0x108*/ oFishRandomVel OBJECT_FIELD_F32(0x20) -#define /*0x10C*/ oFishDepthDistance OBJECT_FIELD_F32(0x21) -#define /*0x110*/ oFishActiveDistance OBJECT_FIELD_F32(0x22) +#define /*0x0F4*/ oFishWaterLevel OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oFishGoalY OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oFishHeightOffset OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oFishYawVel OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oFishRoamDistance OBJECT_FIELD_F32(0x1F) +#define /*0x108*/ oFishGoalVel OBJECT_FIELD_F32(0x20) +#define /*0x10C*/ oFishDepthDistance OBJECT_FIELD_F32(0x21) +#define /*0x110*/ oFishActiveDistance OBJECT_FIELD_F32(0x22) /* Flame */ -#define /*0x0F4*/ oFlameUnkF4 OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oFlameUnkF8 OBJECT_FIELD_S32(0x1C) -#define /*0x0FC*/ oFlameUnkFC OBJECT_FIELD_F32(0x1D) -#define /*0x100*/ oFlameUnk100 OBJECT_FIELD_OBJ(0x1E) +#define /*0x0F4*/ oFlameScale OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oFlameSpeedTimerOffset OBJECT_FIELD_S32(0x1C) +#define /*0x0FC*/ oFlameUnkFC OBJECT_FIELD_F32(0x1D) +#define /*0x100*/ oFlameBowser OBJECT_FIELD_OBJ(0x1E) /* Blue Flame */ -#define /*0x0F8*/ oBlueFlameUnkF8 OBJECT_FIELD_F32(0x1C) +#define /*0x0F8*/ oBlueFlameNextScale OBJECT_FIELD_F32(0x1C) /* Small Piranha Flame */ -#define /*0x0F4*/ oSmallPiranhaFlameStartSpeed OBJECT_FIELD_F32(0x1B) -#define /*0x0F8*/ oSmallPiranhaFlameEndSpeed OBJECT_FIELD_F32(0x1C) -#define /*0x0FC*/ oSmallPiranhaFlameModel OBJECT_FIELD_S32(0x1D) -#define /*0x100*/ oSmallPiranhaFlameUnk100 OBJECT_FIELD_S32(0x1E) -#define /*0x104*/ oSmallPiranhaFlameUnk104 OBJECT_FIELD_F32(0x1F) +#define /*0x0F4*/ oSmallPiranhaFlameStartSpeed OBJECT_FIELD_F32(0x1B) +#define /*0x0F8*/ oSmallPiranhaFlameEndSpeed OBJECT_FIELD_F32(0x1C) +#define /*0x0FC*/ oSmallPiranhaFlameModel OBJECT_FIELD_S32(0x1D) +#define /*0x100*/ oSmallPiranhaFlameNextFlameTimer OBJECT_FIELD_S32(0x1E) +#define /*0x104*/ oSmallPiranhaFlameSpeed OBJECT_FIELD_F32(0x1F) /* Moving Flame */ #define /*0x0F4*/ oMovingFlameTimer OBJECT_FIELD_S32(0x1B) @@ -677,9 +677,8 @@ #define /*0x110*/ oMenuButtonIsCustom OBJECT_FIELD_S32(0x22) /* Manta Ray */ -#define /*0x0F4*/ oMantaUnkF4 OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oMantaUnkF8 OBJECT_FIELD_S32(0x1C) -#define /*0x1AC*/ oMantaUnk1AC OBJECT_FIELD_S32(0x49) +#define /*0x0F4*/ oMantaTargetPitch OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oMantaTargetYaw OBJECT_FIELD_S32(0x1C) /* Merry-Go-Round */ #define /*0x088*/ oMerryGoRoundStopped OBJECT_FIELD_S32(0x00) diff --git a/include/seq_ids.h b/include/seq_ids.h index 4e529791..0aec73d1 100644 --- a/include/seq_ids.h +++ b/include/seq_ids.h @@ -1,6 +1,9 @@ #ifndef SEQ_IDS_H #define SEQ_IDS_H +// Sometimes a sequence id is represented as one of the below ids (the base id), +// optionally OR'd with SEQ_VARIATION. +#define SEQ_BASE_ID 0x7f #define SEQ_VARIATION 0x80 enum SeqId { diff --git a/include/seq_macros.inc b/include/seq_macros.inc index e4f95b8d..c74796e2 100644 --- a/include/seq_macros.inc +++ b/include/seq_macros.inc @@ -165,6 +165,19 @@ .byte 0xff .endm +.ifdef VERSION_SH + +.macro seq_unreservenotes + .byte 0xf0 +.endm + +.macro seq_reservenotes a + .byte 0xf1 + .byte \a +.endm + +.else + .ifdef VERSION_EU .macro seq_unreservenotes @@ -189,11 +202,9 @@ .endif -# chan commands +.endif -.macro chan_testlayerfinished a - .byte 0x0 + \a -.endm +# chan commands .macro chan_startchannel a, b .byte 0x10 + \a @@ -222,19 +233,6 @@ .byte 0x70 + \a .endm -.macro chan_ioreadval a - .byte 0x80 + \a -.endm - -.macro chan_setlayer a, b - .byte 0x90 + \a - .byte (\b - sequence_start) >> 8, (\b - sequence_start) & 0xff -.endm - -.macro chan_freelayer a - .byte 0xa0 + \a -.endm - .macro chan_dynsetlayer a .byte 0xb0 + \a .endm @@ -474,6 +472,58 @@ var_long \a .endm +.ifdef VERSION_SH + +.macro chan_setnotepriority a + .byte 0xe9 + .byte \a +.endm + +.macro chan_unreservenotes + .byte 0xf0 +.endm + +.macro chan_reservenotes a + .byte 0xf1 + .byte \a +.endm + +.macro chan_testlayerfinished a + .byte 0x80 + \a +.endm + +.macro chan_setlayer a, b + .byte 0x88 + \a + .byte (\b - sequence_start) >> 8, (\b - sequence_start) & 0xff +.endm + +.macro chan_ioreadval a + .byte 0x60 + \a +.endm + +.macro chan_freelayer a + .byte 0x90 + \a +.endm + +.else + +.macro chan_testlayerfinished a + .byte 0x0 + \a +.endm + +.macro chan_ioreadval a + .byte 0x80 + \a +.endm + +.macro chan_setlayer a, b + .byte 0x90 + \a + .byte (\b - sequence_start) >> 8, (\b - sequence_start) & 0xff +.endm + +.macro chan_freelayer a + .byte 0xa0 + \a +.endm + .ifdef VERSION_EU .macro chan_setnotepriority a @@ -507,6 +557,8 @@ .endif +.endif + # layer commands .macro layer_note0 a, b, c, d @@ -624,7 +676,7 @@ .byte \a >> 8, \a & 0xff .endm -.macro envelope_hang a +.macro envelope_hang a=0 .byte 0xff, 0xff .byte \a >> 8, \a & 0xff .endm @@ -634,7 +686,7 @@ .byte \a >> 8, \a & 0xff .endm -.macro envelope_restart a +.macro envelope_restart a=0 .byte 0xff, 0xfd .byte \a >> 8, \a & 0xff .endm diff --git a/include/sm64.h b/include/sm64.h index 7f310ed4..b3f1ed34 100644 --- a/include/sm64.h +++ b/include/sm64.h @@ -7,7 +7,7 @@ #include "config.h" #include "object_fields.h" #include "object_constants.h" -#include "audio_defines.h" +#include "sounds.h" #include "model_ids.h" #include "mario_animation_ids.h" #include "mario_geo_switch_case_ids.h" diff --git a/include/sounds.h b/include/sounds.h new file mode 100644 index 00000000..f3c11bfe --- /dev/null +++ b/include/sounds.h @@ -0,0 +1,610 @@ +#ifndef SOUNDS_H +#define SOUNDS_H + +// Sound Magic Definition: +// First Byte (Upper Nibble): Sound Bank (not the same as audio bank!) +// First Byte (Lower Nibble): Bitflags for audio playback? +// Second Byte: Sound ID +// Third Byte: Priority +// Fourth Byte (Upper Nibble): More bitflags +// Fourth Byte (Lower Nibble): Sound Status (this is set to SOUND_STATUS_PLAYING when passed to the audio driver.) +#define SOUND_ARG_LOAD(bank, soundID, priority, flags) (\ + ((u32) (bank) << 28) | \ + ((u32) (soundID) << 16) | \ + ((u32) (priority) << 8) | \ + (flags) | \ + SOUND_STATUS_WAITING) + +#define SOUNDARGS_MASK_BANK 0xF0000000 +#define SOUNDARGS_MASK_SOUNDID 0x00FF0000 +#define SOUNDARGS_MASK_PRIORITY 0x0000FF00 +#define SOUNDARGS_MASK_STATUS 0x0000000F + +#define SOUNDARGS_SHIFT_BANK 28 +#define SOUNDARGS_SHIFT_SOUNDID 16 +#define SOUNDARGS_SHIFT_PRIORITY 8 + +/* Sound banks */ +#define SOUND_BANK_ACTION 0 +#define SOUND_BANK_MOVING 1 +#define SOUND_BANK_MARIO_VOICE 2 +#define SOUND_BANK_GENERAL 3 +#define SOUND_BANK_ENV 4 +#define SOUND_BANK_OBJ 5 +#define SOUND_BANK_AIR 6 +#define SOUND_BANK_MENU 7 +#define SOUND_BANK_GENERAL2 8 +#define SOUND_BANK_OBJ2 9 +#define SOUND_BANK_LUIGI_VOICE 10 +#define SOUND_BANK_WARIO_VOICE 11 +#define SOUND_BANK_COUNT 12 + +#define SOUND_BANKS_ALL_BITS 0xffff +#define SOUND_BANKS_ALL ((1 << SOUND_BANK_COUNT) - 1) +#define SOUND_BANKS_FOREGROUND (\ + (1 << SOUND_BANK_ACTION) |\ + (1 << SOUND_BANK_MARIO_VOICE) |\ + (1 << SOUND_BANK_MENU) |\ + (1 << SOUND_BANK_LUIGI_VOICE) |\ + (1 << SOUND_BANK_WARIO_VOICE)) +#define SOUND_BANKS_BACKGROUND (SOUND_BANKS_ALL & ~SOUND_BANKS_FOREGROUND) +#define SOUND_BANKS_DISABLED_DURING_INTRO_CUTSCENE (\ + (1 << SOUND_BANK_ENV) |\ + (1 << SOUND_BANK_OBJ) |\ + (1 << SOUND_BANK_GENERAL2) |\ + (1 << SOUND_BANK_OBJ2)) +#define SOUND_BANKS_DISABLED_AFTER_CREDITS (\ + (1 << SOUND_BANK_ACTION) |\ + (1 << SOUND_BANK_MOVING) |\ + (1 << SOUND_BANK_MARIO_VOICE) |\ + (1 << SOUND_BANK_GENERAL) |\ + (1 << SOUND_BANK_LUIGI_VOICE) |\ + (1 << SOUND_BANK_WARIO_VOICE)) + +/* Audio playback bitflags. */ +#define SOUND_NO_VOLUME_LOSS 0x1000000 // No volume loss with distance +#define SOUND_VIBRATO 0x2000000 // Randomly alter frequency each audio frame +#define SOUND_NO_PRIORITY_LOSS 0x4000000 // Do not prioritize closer sounds +#define SOUND_CONSTANT_FREQUENCY 0x8000000 // Frequency is not affected by distance or speed. If + // not set, frequency will increase with distance. + // For sounds in SOUND_BANK_MOVING, frequency will + // further increase with speed, and volume will + // decrease at slow speeds. + +/* Audio lower bitflags. */ +#define SOUND_LOWER_BACKGROUND_MUSIC 0x10 // Lower volume of background music while playing +#define SOUND_NO_ECHO 0x20 // Disable level reverb. Not in JP +#define SOUND_DISCRETE 0x80 // Every call to play_sound restarts the sound. If not + // set, the sound is continuous and play_sound should be + // called at least every other frame to keep it playing + +/* Audio Status */ +#define SOUND_STATUS_STOPPED 0 +#define SOUND_STATUS_WAITING 1 +#define SOUND_STATUS_PLAYING 2 + +/** + * Terrain types. mario_get_terrain_sound_addend computes a + * sound terrain type between 0 and 7, depending on the terrain type of the + * level and the floor type that Mario is standing on. That value is then added + * to the sound ID for the TERRAIN_* sounds. + */ +#define SOUND_TERRAIN_DEFAULT 0 // e.g. air +#define SOUND_TERRAIN_GRASS 1 +#define SOUND_TERRAIN_WATER 2 +#define SOUND_TERRAIN_STONE 3 +#define SOUND_TERRAIN_SPOOKY 4 // squeaky floor +#define SOUND_TERRAIN_SNOW 5 +#define SOUND_TERRAIN_ICE 6 +#define SOUND_TERRAIN_SAND 7 + +// silence +#define NO_SOUND 0 + +// Include our sound defines for our custom characters. +#include "luigi_sounds.h" +#include "wario_sounds.h" + +/** + * The table below defines all sounds that exist in the game, and which flags + * they are used with. If a sound is used with multiple sets of flags (e.g. + * different priorities), they are gives distinguishing suffixes. + * A _2 suffix means the sound is the same despite a different sound ID. + */ + +/* Terrain sounds */ +// Terrain-dependent moving sounds; a value 0-7 is added to the sound ID before +// playing. See higher up for the different terrain types. +#define SOUND_ACTION_TERRAIN_JUMP /* 0x04008080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x00, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_TERRAIN_LANDING /* 0x04088080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x08, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_TERRAIN_STEP /* 0x06108080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x10, 0x80, SOUND_VIBRATO | SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_TERRAIN_BODY_HIT_GROUND /* 0x04188080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x18, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_TERRAIN_STEP_TIPTOE /* 0x06208080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x20, 0x80, SOUND_VIBRATO | SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_TERRAIN_STUCK_IN_GROUND /* 0x04488080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x48, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_TERRAIN_HEAVY_LANDING /* 0x04608080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x60, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +#define SOUND_ACTION_METAL_JUMP /* 0x04289080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x28, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_METAL_LANDING /* 0x04299080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x29, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_METAL_STEP /* 0x042A9080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2A, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_METAL_HEAVY_LANDING /* 0x042B9080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2B, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_CLAP_HANDS_COLD /* 0x062C0080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2C, 0x00, SOUND_VIBRATO | SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_HANGING_STEP /* 0x042DA080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2D, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_QUICKSAND_STEP /* 0x042E0080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2E, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_METAL_STEP_TIPTOE /* 0x042F9080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2F, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_UNKNOWN430 /* 0x0430C080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x30, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_UNKNOWN431 /* 0x04316080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x31, 0x60, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_UNKNOWN432 /* 0x04328080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x32, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_SWIM /* 0x04338080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x33, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_UNKNOWN434 /* 0x04348080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x34, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_THROW /* 0x04358080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x35, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_KEY_SWISH /* 0x04368080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x36, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_SPIN /* 0x04378080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x37, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_TWIRL /* 0x04388080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x38, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // same sound as spin +#define SOUND_ACTION_CLIMB_UP_TREE /* 0x043A8080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3A, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_CLIMB_DOWN_TREE /* 0x003B0000 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3B, 0x00, 0) // unverified, unused +#define SOUND_ACTION_UNK3C /* 0x003C0000 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3C, 0x00, 0) // unverified, unused +#define SOUND_ACTION_UNKNOWN43D /* 0x043D8080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_UNKNOWN43E /* 0x043E8080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_PAT_BACK /* 0x043F8080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_BRUSH_HAIR /* 0x04408080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x40, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_CLIMB_UP_POLE /* 0x04418080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x41, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_METAL_BONK /* 0x04428080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x42, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_UNSTUCK_FROM_GROUND /* 0x04438080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x43, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_HIT /* 0x0444C080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x44, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_HIT_2 /* 0x0444B080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x44, 0xB0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_HIT_3 /* 0x0444A080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x44, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_BONK /* 0x0445A080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x45, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_SHRINK_INTO_BBH /* 0x0446A080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x46, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_SWIM_FAST /* 0x0447A080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x47, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_METAL_JUMP_WATER /* 0x04509080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x50, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_METAL_LAND_WATER /* 0x04519080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x51, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_METAL_STEP_WATER /* 0x04529080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x52, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_UNK53 /* 0x00530000 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x53, 0x00, 0) // unverified, unused +#define SOUND_ACTION_UNK54 /* 0x00540000 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x54, 0x00, 0) // unverified, unused +#define SOUND_ACTION_UNK55 /* 0x00550000 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x55, 0x00, 0) // unverified, unused +#define SOUND_ACTION_FLYING_FAST /* 0x04568080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x56, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // "swoop"?, unverified +#define SOUND_ACTION_TELEPORT /* 0x0457C080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x57, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_UNKNOWN458 /* 0x0458A080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x58, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_BOUNCE_OFF_OBJECT /* 0x0459B080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x59, 0xB0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_SIDE_FLIP_UNK /* 0x045A8080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5A, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_READ_SIGN /* 0x045BFF80 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5B, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_ACTION_UNKNOWN45C /* 0x045C8080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_UNK5D /* 0x005D0000 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5D, 0x00, 0) // unverified, unused +#define SOUND_ACTION_INTRO_UNK45E /* 0x045E8080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_ACTION_INTRO_UNK45F /* 0x045F8080 */ SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified + +/* Moving Sound Effects */ + +// Terrain-dependent moving sounds; a value 0-7 is added to the sound ID before +// playing. See higher up for the different terrain types. +#define SOUND_MOVING_TERRAIN_SLIDE /* 0x14000000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x00, 0x00, SOUND_NO_PRIORITY_LOSS) +#define SOUND_MOVING_TERRAIN_RIDING_SHELL /* 0x14200000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x20, 0x00, SOUND_NO_PRIORITY_LOSS) + +#define SOUND_MOVING_LAVA_BURN /* 0x14100000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x10, 0x00, SOUND_NO_PRIORITY_LOSS) // ? +#define SOUND_MOVING_SLIDE_DOWN_POLE /* 0x14110000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x11, 0x00, SOUND_NO_PRIORITY_LOSS) // ? +#define SOUND_MOVING_SLIDE_DOWN_TREE /* 0x14128000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x12, 0x80, SOUND_NO_PRIORITY_LOSS) +#define SOUND_MOVING_QUICKSAND_DEATH /* 0x14140000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x14, 0x00, SOUND_NO_PRIORITY_LOSS) +#define SOUND_MOVING_SHOCKED /* 0x14160000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x16, 0x00, SOUND_NO_PRIORITY_LOSS) +#define SOUND_MOVING_FLYING /* 0x14170000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x17, 0x00, SOUND_NO_PRIORITY_LOSS) +#define SOUND_MOVING_ALMOST_DROWNING /* 0x1C180000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x18, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_CONSTANT_FREQUENCY) +#define SOUND_MOVING_AIM_CANNON /* 0x1D192000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x19, 0x20, SOUND_NO_VOLUME_LOSS | SOUND_NO_PRIORITY_LOSS | SOUND_CONSTANT_FREQUENCY) +#define SOUND_MOVING_UNK1A /* 0x101A0000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x1A, 0x00, 0) // ?, unused +#define SOUND_MOVING_RIDING_SHELL_LAVA /* 0x14280000 */ SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x28, 0x00, SOUND_NO_PRIORITY_LOSS) + +/* Mario Sound Effects */ +// A random number 0-2 is added to the sound ID before playing, producing Yah/Wah/Hoo +#define SOUND_MARIO_YAH_WAH_HOO /* 0x24008080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x00, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_HOOHOO /* 0x24038080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x03, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_YAHOO /* 0x24048080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x04, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_UH /* 0x24058080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x05, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_HRMM /* 0x24068080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x06, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_WAH2 /* 0x24078080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x07, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_WHOA /* 0x2408C080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x08, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_EEUH /* 0x24098080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x09, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_ATTACKED /* 0x240AFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0A, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_OOOF /* 0x240B8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_OOOF2 /* 0x240BD080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0B, 0xD0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_HERE_WE_GO /* 0x240C8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_YAWNING /* 0x240D8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_SNORING1 /* 0x240E8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_SNORING2 /* 0x240F8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_WAAAOOOW /* 0x2410C080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x10, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_HAHA /* 0x24118080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x11, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_HAHA_2 /* 0x2411F080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x11, 0xF0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_UH2 /* 0x2413D080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x13, 0xD0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_UH2_2 /* 0x24138080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x13, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_ON_FIRE /* 0x2414A080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x14, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_DYING /* 0x2415FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x15, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_MARIO_PANTING_COLD /* 0x24168080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x16, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +// A random number 0-2 is added to the sound ID before playing +#define SOUND_MARIO_PANTING /* 0x24188080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x18, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +#define SOUND_MARIO_COUGHING1 /* 0x241B8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_COUGHING2 /* 0x241C8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_COUGHING3 /* 0x241D8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_PUNCH_YAH /* 0x241E8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_PUNCH_HOO /* 0x241F8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_MAMA_MIA /* 0x24208080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x20, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_OKEY_DOKEY /* 0x20210000 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x21, 0x00, 0) // unused +#define SOUND_MARIO_GROUND_POUND_WAH /* 0x24228080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x22, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_DROWNING /* 0x2423F080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x23, 0xF0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_PUNCH_WAH /* 0x24248080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x24, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +/* Mario Sound Effects (US/EU only) */ +#define SOUND_PEACH_DEAR_MARIO /* 0x2428FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x28, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +// A random number 0-4 is added to the sound ID before playing, producing one of +// Yahoo! (60% chance), Waha! (20%), or Yippee! (20%). +#define SOUND_MARIO_YAHOO_WAHA_YIPPEE /* 0x242B8080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x2B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +#define SOUND_MARIO_DOH /* 0x24308080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x30, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_GAME_OVER /* 0x2431FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x31, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_HELLO /* 0x2432FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x32, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_PRESS_START_TO_PLAY /* 0x2433FFA0 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x33, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_NO_ECHO | SOUND_DISCRETE) +#define SOUND_MARIO_TWIRL_BOUNCE /* 0x24348080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x34, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_SNORING3 /* 0x2435FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x35, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_SO_LONGA_BOWSER /* 0x24368080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x36, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_MARIO_IMA_TIRED /* 0x24378080 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x37, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +/* Princess Peach Sound Effects (US/EU only) */ +#define SOUND_PEACH_MARIO /* 0x2438FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x38, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_PEACH_POWER_OF_THE_STARS /* 0x2439FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x39, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_PEACH_THANKS_TO_YOU /* 0x243AFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3A, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_PEACH_THANK_YOU_MARIO /* 0x243BFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3B, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_PEACH_SOMETHING_SPECIAL /* 0x243CFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3C, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_PEACH_BAKE_A_CAKE /* 0x243DFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3D, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_PEACH_FOR_MARIO /* 0x243EFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3E, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_PEACH_MARIO2 /* 0x243FFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3F, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +/* General Sound Effects */ +#define SOUND_GENERAL_ACTIVATE_CAP_SWITCH /* 0x30008080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x00, 0x80, SOUND_DISCRETE) +#define SOUND_GENERAL_FLAME_OUT /* 0x30038080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x03, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_OPEN_WOOD_DOOR /* 0x3004C080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x04, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_CLOSE_WOOD_DOOR /* 0x3005C080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x05, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_OPEN_IRON_DOOR /* 0x3006C080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x06, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_CLOSE_IRON_DOOR /* 0x3007C080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x07, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BUBBLES /* 0x30080000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x08, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_MOVING_WATER /* 0x30090080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x09, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_SWISH_WATER /* 0x300A0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0A, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_QUIET_BUBBLE /* 0x300B0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0B, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_VOLCANO_EXPLOSION /* 0x300C8080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0C, 0x80, SOUND_DISCRETE) +#define SOUND_GENERAL_QUIET_BUBBLE2 /* 0x300D0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0D, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_CASTLE_TRAP_OPEN /* 0x300E8080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0E, 0x80, SOUND_DISCRETE) +#define SOUND_GENERAL_WALL_EXPLOSION /* 0x300F0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0F, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL_COIN /* 0x38118080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x11, 0x80, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_COIN_WATER /* 0x38128080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x12, 0x80, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_SHORT_STAR /* 0x30160090 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x16, 0x00, SOUND_LOWER_BACKGROUND_MUSIC | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BIG_CLOCK /* 0x30170080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x17, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_LOUD_POUND /* 0x30180000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x18, 0x00, 0) // _TERRAIN?, unverified, unused +#define SOUND_GENERAL_LOUD_POUND2 /* 0x30190000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x19, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_SHORT_POUND1 /* 0x301A0000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1A, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_SHORT_POUND2 /* 0x301B0000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1B, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_SHORT_POUND3 /* 0x301C0000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1C, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_SHORT_POUND4 /* 0x301D0000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1D, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_SHORT_POUND5 /* 0x301E0000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1E, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_SHORT_POUND6 /* 0x301F0000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1F, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_OPEN_CHEST /* 0x31208080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x20, 0x80, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) +#define SOUND_GENERAL_CLAM_SHELL1 /* 0x31228080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x22, 0x80, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOX_LANDING /* 0x30240080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x24, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOX_LANDING_2 /* 0x32240080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x24, 0x00, SOUND_VIBRATO | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNKNOWN1 /* 0x30250080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x25, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNKNOWN1_2 /* 0x32250080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x25, 0x00, SOUND_VIBRATO | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_CLAM_SHELL2 /* 0x30264080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x26, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_CLAM_SHELL3 /* 0x30274080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x27, 0x40, SOUND_DISCRETE) // unverified +#ifdef VERSION_JP +#define SOUND_GENERAL_PAINTING_EJECT /* 0x38280080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x28, 0x00, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE) +#else +#define SOUND_GENERAL_PAINTING_EJECT /* 0x39280080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x28, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE) +#endif +#define SOUND_GENERAL_LEVEL_SELECT_CHANGE /* 0x302B0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x2B, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL_PLATFORM /* 0x302D8080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x2D, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_DONUT_PLATFORM_EXPLOSION /* 0x302E2080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x2E, 0x20, SOUND_DISCRETE) +#define SOUND_GENERAL_BOWSER_BOMB_EXPLOSION /* 0x312F0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x2F, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) +#define SOUND_GENERAL_COIN_SPURT /* 0x30300080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x30, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_COIN_SPURT_2 /* 0x38300080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x30, 0x00, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_COIN_SPURT_EU /* 0x38302080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x30, 0x20, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE) // unverified + +#define SOUND_GENERAL_EXPLOSION6 /* 0x30310000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x31, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_UNK32 /* 0x30320000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x32, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_BOAT_TILT1 /* 0x30344080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x34, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOAT_TILT2 /* 0x30354080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x35, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_COIN_DROP /* 0x30364080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x36, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNKNOWN3_LOWPRIO /* 0x30370080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x37, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNKNOWN3 /* 0x30378080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x37, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNKNOWN3_2 /* 0x38378080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x37, 0x80, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_PENDULUM_SWING /* 0x30380080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x38, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL_CHAIN_CHOMP1 /* 0x30390080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x39, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_CHAIN_CHOMP2 /* 0x303A0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3A, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_DOOR_TURN_KEY /* 0x303B0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3B, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL_MOVING_IN_SAND /* 0x303C0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3C, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNKNOWN4_LOWPRIO /* 0x303D0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3D, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNKNOWN4 /* 0x303D8080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3D, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_MOVING_PLATFORM_SWITCH /* 0x303E0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3E, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL_CAGE_OPEN /* 0x303FA080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3F, 0xA0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_QUIET_POUND1_LOWPRIO /* 0x30400080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x40, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_QUIET_POUND1 /* 0x30404080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x40, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BREAK_BOX /* 0x3041C080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x41, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_DOOR_INSERT_KEY /* 0x30420080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x42, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL_QUIET_POUND2 /* 0x30430080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x43, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BIG_POUND /* 0x30440080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x44, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNK45 /* 0x30450080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x45, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNK46_LOWPRIO /* 0x30460080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x46, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_UNK46 /* 0x30468080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x46, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_CANNON_UP /* 0x30478080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x47, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_GRINDEL_ROLL /* 0x30480080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x48, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_EXPLOSION7 /* 0x30490000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x49, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_SHAKE_COFFIN /* 0x304A0000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x4A, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_RACE_GUN_SHOT /* 0x314D4080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x4D, 0x40, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_STAR_DOOR_OPEN /* 0x304EC080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x4E, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_STAR_DOOR_CLOSE /* 0x304FC080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x4F, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_POUND_ROCK /* 0x30560080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x56, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_STAR_APPEARS /* 0x3057FF90 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x57, 0xFF, SOUND_LOWER_BACKGROUND_MUSIC | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_COLLECT_1UP /* 0x3058FF80 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x58, 0xFF, SOUND_DISCRETE) +#define SOUND_GENERAL_BUTTON_PRESS_LOWPRIO /* 0x305A0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5A, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BUTTON_PRESS /* 0x305A4080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5A, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO /* 0x315A0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5A, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BUTTON_PRESS_2 /* 0x315A4080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5A, 0x40, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_ELEVATOR_MOVE /* 0x305B0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5B, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_ELEVATOR_MOVE_2 /* 0x315B0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5B, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_SWISH_AIR /* 0x305C0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5C, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_SWISH_AIR_2 /* 0x315C0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5C, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_HAUNTED_CHAIR /* 0x305D0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5D, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_SOFT_LANDING /* 0x305E0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5E, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_HAUNTED_CHAIR_MOVE /* 0x305F0080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5F, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOWSER_PLATFORM /* 0x30628080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x62, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOWSER_PLATFORM_2 /* 0x31628080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x62, 0x80, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_HEART_SPIN /* 0x3064C080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x64, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_POUND_WOOD_POST /* 0x3065C080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x65, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_WATER_LEVEL_TRIG /* 0x30668080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x66, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_SWITCH_DOOR_OPEN /* 0x3067A080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x67, 0xA0, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_RED_COIN /* 0x30689080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x68, 0x90, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BIRDS_FLY_AWAY /* 0x30690080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x69, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_METAL_POUND /* 0x306B8080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6B, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOING1 /* 0x306C4080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6C, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOING2_LOWPRIO /* 0x306D2080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6D, 0x20, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOING2 /* 0x306D4080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6D, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_YOSHI_WALK /* 0x306E2080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6E, 0x20, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_ENEMY_ALERT1 /* 0x306F3080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6F, 0x30, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_YOSHI_TALK /* 0x30703080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x70, 0x30, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_SPLATTERING /* 0x30713080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x71, 0x30, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOING3 /* 0x30720000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x72, 0x00, 0) // unverified, unused +#define SOUND_GENERAL_GRAND_STAR /* 0x30730080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x73, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_GRAND_STAR_JUMP /* 0x30740080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x74, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_BOAT_ROCK /* 0x30750080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x75, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_GENERAL_VANISH_SFX /* 0x30762080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x76, 0x20, SOUND_DISCRETE) // unverified + +/* Environment Sound Effects */ +#define SOUND_ENV_WATERFALL1 /* 0x40000000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x00, 0x00, 0) // unverified +#define SOUND_ENV_WATERFALL2 /* 0x40010000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x01, 0x00, 0) // unverified +#define SOUND_ENV_ELEVATOR1 /* 0x40020000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x02, 0x00, 0) // unverified +#define SOUND_ENV_DRONING1 /* 0x41030000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x03, 0x00, SOUND_NO_VOLUME_LOSS) // unverified +#define SOUND_ENV_DRONING2 /* 0x40040000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x04, 0x00, 0) // unverified +#define SOUND_ENV_WIND1 /* 0x40050000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x05, 0x00, 0) // unverified +#define SOUND_ENV_MOVING_SAND_SNOW /* 0x40060000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x06, 0x00, 0) // unverified, unused +#define SOUND_ENV_UNK07 /* 0x40070000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x07, 0x00, 0) // unverified, unused +#define SOUND_ENV_ELEVATOR2 /* 0x40080000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x08, 0x00, 0) // unverified +#define SOUND_ENV_WATER /* 0x40090000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x09, 0x00, 0) // unverified +#define SOUND_ENV_UNKNOWN2 /* 0x400A0000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0A, 0x00, 0) // unverified +#define SOUND_ENV_BOAT_ROCKING1 /* 0x400B0000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0B, 0x00, 0) // unverified +#define SOUND_ENV_ELEVATOR3 /* 0x400C0000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0C, 0x00, 0) // unverified +#define SOUND_ENV_ELEVATOR4 /* 0x400D0000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0D, 0x00, 0) // unverified +#define SOUND_ENV_ELEVATOR4_2 /* 0x410D0000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0D, 0x00, SOUND_NO_VOLUME_LOSS) // unverified +#define SOUND_ENV_MOVINGSAND /* 0x400E0000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0E, 0x00, 0) // unverified +#define SOUND_ENV_MERRY_GO_ROUND_CREAKING /* 0x400F4000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0F, 0x40, 0) // unverified +#define SOUND_ENV_WIND2 /* 0x40108000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x10, 0x80, 0) // unverified +#define SOUND_ENV_UNK12 /* 0x40120000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x12, 0x00, 0) // unverified, unused +#define SOUND_ENV_SLIDING /* 0x40130000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x13, 0x00, 0) // unverified +#define SOUND_ENV_STAR /* 0x40140010 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x14, 0x00, SOUND_LOWER_BACKGROUND_MUSIC) // unverified +#define SOUND_ENV_UNKNOWN4 /* 0x41150000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x15, 0x00, SOUND_NO_VOLUME_LOSS) // unverified +#define SOUND_ENV_WATER_DRAIN /* 0x41160000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x16, 0x00, SOUND_NO_VOLUME_LOSS) // unverified +#define SOUND_ENV_METAL_BOX_PUSH /* 0x40178000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x17, 0x80, 0) // unverified +#define SOUND_ENV_SINK_QUICKSAND /* 0x40188000 */ SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x18, 0x80, 0) // unverified + +/* Object Sound Effects */ +#define SOUND_OBJ_SUSHI_SHARK_WATER_SOUND /* 0x50008080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x00, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ_MRI_SHOOT /* 0x50010080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x01, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_BABY_PENGUIN_WALK /* 0x50020080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x02, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_BOWSER_WALK /* 0x50030080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x03, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_BOWSER_TAIL_PICKUP /* 0x50050080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x05, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_BOWSER_DEFEATED /* 0x50060080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x06, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_BOWSER_SPINNING /* 0x50070080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x07, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_BOWSER_INHALING /* 0x50080080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x08, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_BIG_PENGUIN_WALK /* 0x50098080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x09, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ_BOO_BOUNCE_TOP /* 0x500A0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0A, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_BOO_LAUGH_SHORT /* 0x500B0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0B, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_THWOMP /* 0x500CA080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0C, 0xA0, SOUND_DISCRETE) +#define SOUND_OBJ_CANNON1 /* 0x500DF080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0D, 0xF0, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_CANNON2 /* 0x500EF080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0E, 0xF0, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_CANNON3 /* 0x500FF080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0F, 0xF0, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_JUMP_WALK_WATER /* 0x50120000 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x12, 0x00, 0) // unverified, unused +#define SOUND_OBJ_UNKNOWN2 /* 0x50130080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x13, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_MRI_DEATH /* 0x50140080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x14, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_POUNDING1 /* 0x50155080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x15, 0x50, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_POUNDING1_HIGHPRIO /* 0x50158080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x15, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_WHOMP_LOWPRIO /* 0x50166080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x16, 0x60, SOUND_DISCRETE) +#define SOUND_OBJ_KING_BOBOMB /* 0x50168080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x16, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ_BULLY_METAL /* 0x50178080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x17, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_BULLY_EXPLODE /* 0x5018A080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x18, 0xA0, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_BULLY_EXPLODE_2 /* 0x5118A080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x18, 0xA0, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) // unverified +#define SOUND_OBJ_POUNDING_CANNON /* 0x501A5080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1A, 0x50, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_BULLY_WALK /* 0x501B3080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1B, 0x30, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_UNKNOWN3 /* 0x501D8080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1D, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_UNKNOWN4 /* 0x501EA080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1E, 0xA0, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_BABY_PENGUIN_DIVE /* 0x501F4080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1F, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ_GOOMBA_WALK /* 0x50200080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x20, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_UKIKI_CHATTER_LONG /* 0x50210080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x21, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_MONTY_MOLE_ATTACK /* 0x50220080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x22, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_EVIL_LAKITU_THROW /* 0x50222080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x22, 0x20, SOUND_DISCRETE) +#define SOUND_OBJ_UNK23 /* 0x50230000 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x23, 0x00, 0) // unverified, unused +#define SOUND_OBJ_DYING_ENEMY1 /* 0x50244080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x24, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ_CANNON4 /* 0x50254080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x25, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_DYING_ENEMY2 /* 0x50260000 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x26, 0x00, 0) // unverified, unused +#define SOUND_OBJ_BOBOMB_WALK /* 0x50270080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x27, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_SOMETHING_LANDING /* 0x50288080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x28, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_DIVING_IN_WATER /* 0x5029A080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x29, 0xA0, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_SNOW_SAND1 /* 0x502A0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2A, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_SNOW_SAND2 /* 0x502B0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2B, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_DEFAULT_DEATH /* 0x502C8080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2C, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ_BIG_PENGUIN_YELL /* 0x502D0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2D, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_WATER_BOMB_BOUNCING /* 0x502E8080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2E, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ_GOOMBA_ALERT /* 0x502F0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2F, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_WIGGLER_JUMP /* 0x502F6080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2F, 0x60, SOUND_DISCRETE) +#define SOUND_OBJ_STOMPED /* 0x50308080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x30, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_UNKNOWN6 /* 0x50310080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x31, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_DIVING_INTO_WATER /* 0x50324080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x32, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_PIRANHA_PLANT_SHRINK /* 0x50334080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x33, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ_KOOPA_THE_QUICK_WALK /* 0x50342080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x34, 0x20, SOUND_DISCRETE) +#define SOUND_OBJ_KOOPA_WALK /* 0x50350080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x35, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_BULLY_WALKING /* 0x50366080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x36, 0x60, SOUND_DISCRETE) +#define SOUND_OBJ_DORRIE /* 0x50376080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x37, 0x60, SOUND_DISCRETE) +#define SOUND_OBJ_BOWSER_LAUGH /* 0x50388080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x38, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ_UKIKI_CHATTER_SHORT /* 0x50390080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x39, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_UKIKI_CHATTER_IDLE /* 0x503A0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3A, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_UKIKI_STEP_DEFAULT /* 0x503B0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3B, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_UKIKI_STEP_LEAVES /* 0x503C0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3C, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_KOOPA_TALK /* 0x503DA080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3D, 0xA0, SOUND_DISCRETE) +#define SOUND_OBJ_KOOPA_DAMAGE /* 0x503EA080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3E, 0xA0, SOUND_DISCRETE) +#define SOUND_OBJ_KLEPTO1 /* 0x503F4080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3F, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_KLEPTO2 /* 0x50406080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x40, 0x60, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_KING_BOBOMB_TALK /* 0x50410080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x41, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_KING_BOBOMB_JUMP /* 0x50468080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x46, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ_KING_WHOMP_DEATH /* 0x5147C080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x47, 0xC0, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) +#define SOUND_OBJ_BOO_LAUGH_LONG /* 0x50480080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x48, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_EEL /* 0x504A0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4A, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_EEL_2 /* 0x524A0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4A, 0x00, SOUND_VIBRATO | SOUND_DISCRETE) // unverified +#define SOUND_OBJ_EYEROK_SHOW_EYE /* 0x524B0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4B, 0x00, SOUND_VIBRATO | SOUND_DISCRETE) +#define SOUND_OBJ_MR_BLIZZARD_ALERT /* 0x504C0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4C, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_SNUFIT_SHOOT /* 0x504D0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4D, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_SKEETER_WALK /* 0x504E0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4E, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_WALKING_WATER /* 0x504F0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4F, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_BIRD_CHIRP3 /* 0x50514000 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x51, 0x40, 0) +#define SOUND_OBJ_PIRANHA_PLANT_APPEAR /* 0x50542080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x54, 0x20, SOUND_DISCRETE) +#define SOUND_OBJ_FLAME_BLOWN /* 0x50558080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x55, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ_MAD_PIANO_CHOMPING /* 0x52564080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x56, 0x40, SOUND_VIBRATO | SOUND_DISCRETE) +#define SOUND_OBJ_BOBOMB_BUDDY_TALK /* 0x50584080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x58, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ_SPINY_UNK59 /* 0x50591080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x59, 0x10, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_WIGGLER_HIGH_PITCH /* 0x505C4080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x5C, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ_HEAVEHO_TOSSED /* 0x505D4080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x5D, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ_WIGGLER_DEATH /* 0x505E0000 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x5E, 0x00, 0) // unverified, unused +#define SOUND_OBJ_BOWSER_INTRO_LAUGH /* 0x505F8090 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x5F, 0x80, SOUND_LOWER_BACKGROUND_MUSIC | SOUND_DISCRETE) +#define SOUND_OBJ_ENEMY_DEATH_HIGH /* 0x5060B080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x60, 0xB0, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_ENEMY_DEATH_LOW /* 0x5061B080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x61, 0xB0, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_SWOOP_DEATH /* 0x5062B080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x62, 0xB0, SOUND_DISCRETE) +#define SOUND_OBJ_KOOPA_FLYGUY_DEATH /* 0x5063B080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x63, 0xB0, SOUND_DISCRETE) +#define SOUND_OBJ_POKEY_DEATH /* 0x5063C080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x63, 0xC0, SOUND_DISCRETE) +#define SOUND_OBJ_SNOWMAN_BOUNCE /* 0x5064C080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x64, 0xC0, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_SNOWMAN_EXPLODE /* 0x5065D080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x65, 0xD0, SOUND_DISCRETE) +#define SOUND_OBJ_POUNDING_LOUD /* 0x50684080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x68, 0x40, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_MIPS_RABBIT /* 0x506A0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6A, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_MIPS_RABBIT_WATER /* 0x506C0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6C, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_OBJ_EYEROK_EXPLODE /* 0x506D0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6D, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_CHUCKYA_DEATH /* 0x516E0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6E, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) +#define SOUND_OBJ_WIGGLER_TALK /* 0x506F0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6F, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ_WIGGLER_ATTACKED /* 0x50706080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x70, 0x60, SOUND_DISCRETE) +#define SOUND_OBJ_WIGGLER_LOW_PITCH /* 0x50712080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x71, 0x20, SOUND_DISCRETE) +#define SOUND_OBJ_SNUFIT_SKEETER_DEATH /* 0x5072C080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x72, 0xC0, SOUND_DISCRETE) +#define SOUND_OBJ_BUBBA_CHOMP /* 0x50734080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x73, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ_ENEMY_DEFEAT_SHRINK /* 0x50744080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x74, 0x40, SOUND_DISCRETE) + +#define SOUND_AIR_BOWSER_SPIT_FIRE /* 0x60000000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x00, 0x00, 0) +#define SOUND_AIR_UNK01 /* 0x60010000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x01, 0x00, 0) // ?, unused +#define SOUND_AIR_LAKITU_FLY /* 0x60028000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x02, 0x80, 0) +#define SOUND_AIR_LAKITU_FLY_HIGHPRIO /* 0x6002FF00 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x02, 0xFF, 0) +#define SOUND_AIR_AMP_BUZZ /* 0x60034000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x03, 0x40, 0) +#define SOUND_AIR_BLOW_FIRE /* 0x60048000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x04, 0x80, 0) +#define SOUND_AIR_BLOW_WIND /* 0x60044000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x04, 0x40, 0) +#define SOUND_AIR_ROUGH_SLIDE /* 0x60050000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x05, 0x00, 0) +#define SOUND_AIR_HEAVEHO_MOVE /* 0x60064000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x06, 0x40, 0) +#define SOUND_AIR_UNK07 /* 0x60070000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x07, 0x00, 0) // ?, unused +#define SOUND_AIR_BOBOMB_LIT_FUSE /* 0x60086000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x08, 0x60, 0) +#define SOUND_AIR_HOWLING_WIND /* 0x60098000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x09, 0x80, 0) +#define SOUND_AIR_CHUCKYA_MOVE /* 0x600A4000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x0A, 0x40, 0) +#define SOUND_AIR_PEACH_TWINKLE /* 0x600B4000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x0B, 0x40, 0) +#define SOUND_AIR_CASTLE_OUTDOORS_AMBIENT /* 0x60104000 */ SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x10, 0x40, 0) + +/* Menu Sound Effects */ +#define SOUND_MENU_CHANGE_SELECT /* 0x7000F880 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x00, 0xF8, SOUND_DISCRETE) +#define SOUND_MENU_REVERSE_PAUSE /* 0x70010000 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x01, 0x00, 0) // unverified, unused +#define SOUND_MENU_PAUSE /* 0x7002F080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x02, 0xF0, SOUND_DISCRETE) +#define SOUND_MENU_PAUSE_HIGHPRIO /* 0x7002FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x02, 0xFF, SOUND_DISCRETE) +#define SOUND_MENU_PAUSE_2 /* 0x7003FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x03, 0xFF, SOUND_DISCRETE) +#define SOUND_MENU_MESSAGE_APPEAR /* 0x70040080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x04, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_MESSAGE_DISAPPEAR /* 0x70050080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x05, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_CAMERA_ZOOM_IN /* 0x70060080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x06, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_CAMERA_ZOOM_OUT /* 0x70070080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x07, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_PINCH_MARIO_FACE /* 0x70080080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x08, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_LET_GO_MARIO_FACE /* 0x70090080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x09, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_HAND_APPEAR /* 0x700A0080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0A, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_HAND_DISAPPEAR /* 0x700B0080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0B, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_UNK0C /* 0x700C0080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0C, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_MENU_POWER_METER /* 0x700D0080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0D, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_MENU_CAMERA_BUZZ /* 0x700E0080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0E, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_CAMERA_TURN /* 0x700F0080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0F, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_UNK10 /* 0x70100000 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x10, 0x00, 0) // unverified, unused +#define SOUND_MENU_CLICK_FILE_SELECT /* 0x70110080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x11, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_MESSAGE_NEXT_PAGE /* 0x70130080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x13, 0x00, SOUND_DISCRETE) // unverified +#define SOUND_MENU_COIN_ITS_A_ME_MARIO /* 0x70140080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x14, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_YOSHI_GAIN_LIVES /* 0x70150080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x15, 0x00, SOUND_DISCRETE) +#define SOUND_MENU_ENTER_PIPE /* 0x7016A080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x16, 0xA0, SOUND_DISCRETE) +#define SOUND_MENU_EXIT_PIPE /* 0x7017A080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x17, 0xA0, SOUND_DISCRETE) +#define SOUND_MENU_BOWSER_LAUGH /* 0x70188080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x18, 0x80, SOUND_DISCRETE) +#define SOUND_MENU_ENTER_HOLE /* 0x71198080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x19, 0x80, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) +#define SOUND_MENU_CLICK_CHANGE_VIEW /* 0x701A8080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1A, 0x80, SOUND_DISCRETE) // unverified +#define SOUND_MENU_CAMERA_UNUSED1 /* 0x701B0000 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1B, 0x00, 0) // unverified, unused +#define SOUND_MENU_CAMERA_UNUSED2 /* 0x701C0000 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1C, 0x00, 0) // unverified, unused +#define SOUND_MENU_MARIO_CASTLE_WARP /* 0x701DB080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1D, 0xB0, SOUND_DISCRETE) // unverified +#define SOUND_MENU_STAR_SOUND /* 0x701EFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1E, 0xFF, SOUND_DISCRETE) +#define SOUND_MENU_THANK_YOU_PLAYING_MY_GAME /* 0x701FFF80 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1F, 0xFF, SOUND_DISCRETE) +#define SOUND_MENU_READ_A_SIGN /* 0x70200000 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x20, 0x00, 0) // unverified, unused +#define SOUND_MENU_EXIT_A_SIGN /* 0x70210000 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x21, 0x00, 0) // unverified, unused +#define SOUND_MENU_MARIO_CASTLE_WARP2 /* 0x70222080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x22, 0x20, SOUND_DISCRETE) // unverified +#define SOUND_MENU_STAR_SOUND_OKEY_DOKEY /* 0x7023FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x23, 0xFF, SOUND_DISCRETE) +#define SOUND_MENU_STAR_SOUND_LETS_A_GO /* 0x7024FF80 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x24, 0xFF, SOUND_DISCRETE) + +// US/EU only; an index between 0-7 or 0-4 is added to the sound ID before +// playing, producing the same sound with different pitch. +#define SOUND_MENU_COLLECT_RED_COIN /* 0x78289080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x28, 0x90, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE) +#define SOUND_MENU_COLLECT_SECRET /* 0x70302080 */ SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x30, 0x20, SOUND_DISCRETE) + +// Channel 8 loads sounds from the same place as channel 3, making it possible +// to play two channel 3 sounds at once (since just one sound from each channel +// can play at a given time). +#define SOUND_GENERAL2_BOBOMB_EXPLOSION /* 0x802E2080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x2E, 0x20, SOUND_DISCRETE) +#define SOUND_GENERAL2_PURPLE_SWITCH /* 0x803EC080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x3E, 0xC0, SOUND_DISCRETE) +#define SOUND_GENERAL2_ROTATING_BLOCK_CLICK /* 0x80400080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x40, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL2_SPINDEL_ROLL /* 0x80482080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x48, 0x20, SOUND_DISCRETE) +#define SOUND_GENERAL2_PYRAMID_TOP_SPIN /* 0x814BE080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x4B, 0xE0, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) +#define SOUND_GENERAL2_PYRAMID_TOP_EXPLOSION /* 0x814CF080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x4C, 0xF0, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) +#define SOUND_GENERAL2_BIRD_CHIRP2 /* 0x80504000 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x50, 0x40, 0) +#define SOUND_GENERAL2_SWITCH_TICK_FAST /* 0x8054F010 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x54, 0xF0, SOUND_LOWER_BACKGROUND_MUSIC) +#define SOUND_GENERAL2_SWITCH_TICK_SLOW /* 0x8055F010 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x55, 0xF0, SOUND_LOWER_BACKGROUND_MUSIC) +#define SOUND_GENERAL2_STAR_APPEARS /* 0x8057FF90 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x57, 0xFF, SOUND_LOWER_BACKGROUND_MUSIC | SOUND_DISCRETE) +#define SOUND_GENERAL2_ROTATING_BLOCK_ALERT /* 0x80590080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x59, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL2_BOWSER_EXPLODE /* 0x80600080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x60, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL2_BOWSER_KEY /* 0x80610080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x61, 0x00, SOUND_DISCRETE) +#define SOUND_GENERAL2_1UP_APPEAR /* 0x8063D080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x63, 0xD0, SOUND_DISCRETE) +#define SOUND_GENERAL2_RIGHT_ANSWER /* 0x806AA080 */ SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x6A, 0xA0, SOUND_DISCRETE) + +// Channel 9 loads sounds from the same place as channel 5. +#define SOUND_OBJ2_BOWSER_ROAR /* 0x90040080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x04, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ2_PIRANHA_PLANT_BITE /* 0x90105080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x10, 0x50, SOUND_DISCRETE) +#define SOUND_OBJ2_PIRANHA_PLANT_DYING /* 0x90116080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x11, 0x60, SOUND_DISCRETE) +#define SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE /* 0x90192080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x19, 0x20, SOUND_DISCRETE) +#define SOUND_OBJ2_BULLY_ATTACKED /* 0x901C0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x1C, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ2_KING_BOBOMB_DAMAGE /* 0x91424080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x42, 0x40, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE) +#define SOUND_OBJ2_SCUTTLEBUG_WALK /* 0x90434080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x43, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ2_SCUTTLEBUG_ALERT /* 0x90444080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x44, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ2_BABY_PENGUIN_YELL /* 0x90450080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x45, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ2_SWOOP /* 0x90490080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x49, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ2_BIRD_CHIRP1 /* 0x90524000 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x52, 0x40, 0) +#define SOUND_OBJ2_LARGE_BULLY_ATTACKED /* 0x90570080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x57, 0x00, SOUND_DISCRETE) +#define SOUND_OBJ2_EYEROK_SOUND_SHORT /* 0x935A0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x5A, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_VIBRATO | SOUND_DISCRETE) +#define SOUND_OBJ2_WHOMP_SOUND_SHORT /* 0x935AC080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x5A, 0xC0, SOUND_NO_VOLUME_LOSS | SOUND_VIBRATO | SOUND_DISCRETE) +#define SOUND_OBJ2_EYEROK_SOUND_LONG /* 0x925B0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x5B, 0x00, SOUND_VIBRATO | SOUND_DISCRETE) +#define SOUND_OBJ2_BOWSER_TELEPORT /* 0x90668080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x66, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ2_MONTY_MOLE_APPEAR /* 0x90678080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x67, 0x80, SOUND_DISCRETE) +#define SOUND_OBJ2_BOSS_DIALOG_GRUNT /* 0x90694080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x69, 0x40, SOUND_DISCRETE) +#define SOUND_OBJ2_MRI_SPINNING /* 0x906B0080 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x6B, 0x00, SOUND_DISCRETE) + +#endif // SOUNDS_H diff --git a/include/types.h b/include/types.h index 2dd057a3..4ebeec86 100644 --- a/include/types.h +++ b/include/types.h @@ -53,6 +53,7 @@ typedef s16 Collision; typedef s16 Trajectory; typedef s16 PaintingData; typedef uintptr_t BehaviorScript; +typedef u8 Texture; enum SpTaskState { SPTASK_STATE_NOT_STARTED, diff --git a/include/wario_audio_defines.h b/include/wario_audio_defines.h deleted file mode 100644 index 8ecfc8f0..00000000 --- a/include/wario_audio_defines.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef WARIO_AUDIO_DEFINES_H -#define WARIO_AUDIO_DEFINES_H - -/* Mario Sound Effects */ -// A random number 0-2 is added to the sound ID before playing, producing Yah/Wah/Hoo -#define SOUND_WARIO_YAH_WAH_HOO SOUND_ARG_LOAD(0x0B, 4, 0x00, 0x80, 8) -#define SOUND_WARIO_HOOHOO SOUND_ARG_LOAD(0x0B, 4, 0x03, 0x80, 8) -#define SOUND_WARIO_YAHOO SOUND_ARG_LOAD(0x0B, 4, 0x04, 0x80, 8) -#define SOUND_WARIO_UH SOUND_ARG_LOAD(0x0B, 4, 0x05, 0x80, 8) -#define SOUND_WARIO_HRMM SOUND_ARG_LOAD(0x0B, 4, 0x06, 0x80, 8) -#define SOUND_WARIO_WAH2 SOUND_ARG_LOAD(0x0B, 4, 0x07, 0x80, 8) -#define SOUND_WARIO_WHOA SOUND_ARG_LOAD(0x0B, 4, 0x08, 0xC0, 8) -#define SOUND_WARIO_EEUH SOUND_ARG_LOAD(0x0B, 4, 0x09, 0x80, 8) -#define SOUND_WARIO_ATTACKED SOUND_ARG_LOAD(0x0B, 4, 0x0A, 0xFF, 8) -#define SOUND_WARIO_OOOF SOUND_ARG_LOAD(0x0B, 4, 0x0B, 0x80, 8) -#define SOUND_WARIO_OOOF2 SOUND_ARG_LOAD(0x0B, 4, 0x0B, 0xD0, 8) -#define SOUND_WARIO_HERE_WE_GO SOUND_ARG_LOAD(0x0B, 4, 0x0C, 0x80, 8) -#define SOUND_WARIO_YAWNING SOUND_ARG_LOAD(0x0B, 4, 0x0D, 0x80, 8) -#define SOUND_WARIO_SNORING1 SOUND_ARG_LOAD(0x0B, 4, 0x0E, 0x00, 8) -#define SOUND_WARIO_SNORING2 SOUND_ARG_LOAD(0x0B, 4, 0x0F, 0x00, 8) -#define SOUND_WARIO_WAAAOOOW SOUND_ARG_LOAD(0x0B, 4, 0x10, 0xC0, 8) -#define SOUND_WARIO_HAHA SOUND_ARG_LOAD(0x0B, 4, 0x11, 0x80, 8) -#define SOUND_WARIO_HAHA_2 SOUND_ARG_LOAD(0x0B, 4, 0x11, 0xF0, 8) -#define SOUND_WARIO_UH2 SOUND_ARG_LOAD(0x0B, 4, 0x13, 0xD0, 8) -#define SOUND_WARIO_UH2_2 SOUND_ARG_LOAD(0x0B, 4, 0x13, 0x80, 8) -#define SOUND_WARIO_ON_FIRE SOUND_ARG_LOAD(0x0B, 4, 0x14, 0xA0, 8) -#define SOUND_WARIO_DYING SOUND_ARG_LOAD(0x0B, 4, 0x15, 0xFF, 8) -#define SOUND_WARIO_PANTING_COLD SOUND_ARG_LOAD(0x0B, 4, 0x16, 0x80, 8) - -// A random number 0-2 is added to the sound ID before playing -#define SOUND_WARIO_PANTING SOUND_ARG_LOAD(0x0B, 4, 0x18, 0x80, 8) - -#define SOUND_WARIO_COUGHING1 SOUND_ARG_LOAD(0x0B, 4, 0x1B, 0x80, 8) -#define SOUND_WARIO_COUGHING2 SOUND_ARG_LOAD(0x0B, 4, 0x1C, 0x80, 8) -#define SOUND_WARIO_COUGHING3 SOUND_ARG_LOAD(0x0B, 4, 0x1D, 0x80, 8) -#define SOUND_WARIO_PUNCH_YAH SOUND_ARG_LOAD(0x0B, 4, 0x1E, 0x80, 8) -#define SOUND_WARIO_PUNCH_HOO SOUND_ARG_LOAD(0x0B, 4, 0x1F, 0x80, 8) -#define SOUND_WARIO_MAMA_MIA SOUND_ARG_LOAD(0x0B, 4, 0x20, 0x80, 8) -//#define SOUND_WARIO_OKEY_DOKEY 0x2021 -#define SOUND_WARIO_GROUND_POUND_WAH SOUND_ARG_LOAD(0x0B, 4, 0x22, 0x80, 8) -#define SOUND_WARIO_DROWNING SOUND_ARG_LOAD(0x0B, 4, 0x23, 0xF0, 8) -#define SOUND_WARIO_PUNCH_WAH SOUND_ARG_LOAD(0x0B, 4, 0x24, 0x80, 8) - -// A random number 0-4 is added to the sound ID before playing, producing one of -// Yahoo! (60% chance), Waha! (20%), or Yippee! (20%). -#define SOUND_WARIO_YAHOO_WAHA_YIPPEE SOUND_ARG_LOAD(0x0B, 4, 0x2B, 0x80, 8) - -#define SOUND_WARIO_DOH SOUND_ARG_LOAD(0x0B, 4, 0x30, 0x80, 8) -#define SOUND_WARIO_GAME_OVER SOUND_ARG_LOAD(0x0B, 4, 0x31, 0xFF, 8) -#define SOUND_WARIO_HELLO SOUND_ARG_LOAD(0x0B, 4, 0x32, 0xFF, 8) -#define SOUND_WARIO_PRESS_START_TO_PLAY SOUND_ARG_LOAD(0x0B, 4, 0x33, 0xFF, 0xA) -#define SOUND_WARIO_TWIRL_BOUNCE SOUND_ARG_LOAD(0x0B, 4, 0x34, 0x80, 8) -#define SOUND_WARIO_SNORING3 SOUND_ARG_LOAD(0x0B, 4, 0x35, 0x00, 8) -#define SOUND_WARIO_SO_LONGA_BOWSER SOUND_ARG_LOAD(0x0B, 4, 0x36, 0x80, 8) -#define SOUND_WARIO_IMA_TIRED SOUND_ARG_LOAD(0x0B, 4, 0x37, 0x80, 8) - -#endif // WARIO_AUDIO_DEFINES_H \ No newline at end of file diff --git a/include/wario_sounds.h b/include/wario_sounds.h new file mode 100644 index 00000000..93ca2147 --- /dev/null +++ b/include/wario_sounds.h @@ -0,0 +1,57 @@ +#ifndef WARIO_SOUNDS_H +#define WARIO_SOUNDS_H + +/* Wario Sound Effects */ +// A random number 0-2 is added to the sound ID before playing, producing Yah/Wah/Hoo +#define SOUND_WARIO_YAH_WAH_HOO SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x00, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_HOOHOO SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x03, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_YAHOO SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x04, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_UH SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x05, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_HRMM SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x06, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_WAH2 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x07, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_WHOA SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x08, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_EEUH SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x09, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_ATTACKED SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x0A, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_OOOF SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x0B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_OOOF2 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x0B, 0xD0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_HERE_WE_GO SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x0C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_YAWNING SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x0D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_SNORING1 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x0E, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_SNORING2 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x0F, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_WAAAOOOW SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x10, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_HAHA SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x11, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_HAHA_2 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x11, 0xF0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_UH2 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x13, 0xD0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_UH2_2 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x13, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_ON_FIRE SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x14, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_DYING SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x15, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_PANTING_COLD SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x16, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +// A random number 0-2 is added to the sound ID before playing +#define SOUND_WARIO_PANTING SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x18, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +#define SOUND_WARIO_COUGHING1 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x1B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_COUGHING2 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x1C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_COUGHING3 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x1D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_PUNCH_YAH SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x1E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_PUNCH_HOO SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x1F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_MAMA_MIA SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x20, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_OKEY_DOKEY SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x21, 0x00, 0) // unused +#define SOUND_WARIO_GROUND_POUND_WAH SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x22, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_DROWNING SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x23, 0xF0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_PUNCH_WAH SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x24, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +// A random number 0-4 is added to the sound ID before playing, producing one of +// Yahoo! (60% chance), Waha! (20%), or Yippee! (20%). +#define SOUND_WARIO_YAHOO_WAHA_YIPPEE SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x2B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +#define SOUND_WARIO_DOH SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x30, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_GAME_OVER SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x31, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_HELLO SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x32, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_PRESS_START_TO_PLAY SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x33, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_NO_ECHO | SOUND_DISCRETE) +#define SOUND_WARIO_TWIRL_BOUNCE SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x34, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_SNORING3 SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x35, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_SO_LONGA_BOWSER SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x36, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) +#define SOUND_WARIO_IMA_TIRED SOUND_ARG_LOAD(SOUND_BANK_WARIO_VOICE, 0x37, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE) + +#endif // WARIO_SOUNDS_H \ No newline at end of file diff --git a/levels/bbh/texture.inc.c b/levels/bbh/texture.inc.c index 0bafaa7c..00380afe 100644 --- a/levels/bbh/texture.inc.c +++ b/levels/bbh/texture.inc.c @@ -1,34 +1,34 @@ // 0x07000000 - 0x07001000 -ALIGNED8 static const u8 bbh_seg7_texture_07000000[] = { +ALIGNED8 static const Texture bbh_seg7_texture_07000000[] = { #include "levels/bbh/0.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 bbh_seg7_texture_07001000[] = { +ALIGNED8 static const Texture bbh_seg7_texture_07001000[] = { #include "levels/bbh/1.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 bbh_seg7_texture_07001800[] = { +ALIGNED8 static const Texture bbh_seg7_texture_07001800[] = { #include "levels/bbh/2.rgba16.inc.c" }; // 0x07002000 - 0x07003000 -ALIGNED8 static const u8 bbh_seg7_texture_07002000[] = { +ALIGNED8 static const Texture bbh_seg7_texture_07002000[] = { #include "levels/bbh/3.rgba16.inc.c" }; // 0x07003000 - 0x07003400 -ALIGNED8 static const u8 bbh_seg7_texture_07003000[] = { +ALIGNED8 static const Texture bbh_seg7_texture_07003000[] = { #include "levels/bbh/4.rgba16.inc.c" }; // 0x07003400 - 0x07004400 -ALIGNED8 static const u8 bbh_seg7_texture_07003400[] = { +ALIGNED8 static const Texture bbh_seg7_texture_07003400[] = { #include "levels/bbh/5.rgba16.inc.c" }; // 0x07004400 - 0x07004800 -ALIGNED8 static const u8 bbh_seg7_texture_07004400[] = { +ALIGNED8 static const Texture bbh_seg7_texture_07004400[] = { #include "levels/bbh/6.rgba16.inc.c" }; diff --git a/levels/bitdw/texture.inc.c b/levels/bitdw/texture.inc.c index 8f1a7a9a..8e826e16 100644 --- a/levels/bitdw/texture.inc.c +++ b/levels/bitdw/texture.inc.c @@ -1,19 +1,19 @@ // 0x07000000 - 0x07000002 -ALIGNED8 static const u8 bitdw_seg7_texture_07000000[] = { +ALIGNED8 static const Texture bitdw_seg7_texture_07000000[] = { #include "levels/bitdw/0.rgba16.inc.c" }; // 0x07000800 - 0x07000802 -ALIGNED8 static const u8 bitdw_seg7_texture_07000800[] = { +ALIGNED8 static const Texture bitdw_seg7_texture_07000800[] = { #include "levels/bitdw/1.rgba16.inc.c" }; // 0x07001000 - 0x07001002 -ALIGNED8 static const u8 bitdw_seg7_texture_07001000[] = { +ALIGNED8 static const Texture bitdw_seg7_texture_07001000[] = { #include "levels/bitdw/2.rgba16.inc.c" }; // 0x07001800 - 0x07001802 -ALIGNED8 static const u8 bitdw_seg7_texture_07001800[] = { +ALIGNED8 static const Texture bitdw_seg7_texture_07001800[] = { #include "levels/bitdw/3.rgba16.inc.c" }; diff --git a/levels/bitfs/texture.inc.c b/levels/bitfs/texture.inc.c index 2651e7c4..60854982 100644 --- a/levels/bitfs/texture.inc.c +++ b/levels/bitfs/texture.inc.c @@ -1,14 +1,14 @@ // 0x07000000 - 0x07001000 -ALIGNED8 static const u8 bitfs_seg7_texture_07000000[] = { +ALIGNED8 static const Texture bitfs_seg7_texture_07000000[] = { #include "levels/bitfs/0.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 bitfs_seg7_texture_07001000[] = { +ALIGNED8 static const Texture bitfs_seg7_texture_07001000[] = { #include "levels/bitfs/1.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 bitfs_seg7_texture_07001800[] = { +ALIGNED8 static const Texture bitfs_seg7_texture_07001800[] = { #include "levels/bitfs/2.rgba16.inc.c" }; diff --git a/levels/bits/texture.inc.c b/levels/bits/texture.inc.c index 914694b2..77e44a3b 100644 --- a/levels/bits/texture.inc.c +++ b/levels/bits/texture.inc.c @@ -1,14 +1,14 @@ // 0x07000000 - 0x07001000 -ALIGNED8 static const u8 bits_seg7_texture_07000000[] = { +ALIGNED8 static const Texture bits_seg7_texture_07000000[] = { #include "levels/bits/0.rgba16.inc.c" }; // 0x07001000 - 0x07002000 -ALIGNED8 static const u8 bits_seg7_texture_07001000[] = { +ALIGNED8 static const Texture bits_seg7_texture_07001000[] = { #include "levels/bits/1.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 bits_seg7_texture_07002000[] = { +ALIGNED8 static const Texture bits_seg7_texture_07002000[] = { #include "levels/bits/2.rgba16.inc.c" }; diff --git a/levels/bob/texture.inc.c b/levels/bob/texture.inc.c index 357527cf..b43cc188 100644 --- a/levels/bob/texture.inc.c +++ b/levels/bob/texture.inc.c @@ -1,24 +1,24 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 bob_seg7_texture_07000000[] = { +ALIGNED8 static const Texture bob_seg7_texture_07000000[] = { #include "levels/bob/0.rgba16.inc.c" }; // 0x07000800 - 0x07001000 -ALIGNED8 static const u8 bob_seg7_texture_07000800[] = { +ALIGNED8 static const Texture bob_seg7_texture_07000800[] = { #include "levels/bob/1.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 bob_seg7_texture_07001000[] = { +ALIGNED8 static const Texture bob_seg7_texture_07001000[] = { #include "levels/bob/2.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 bob_seg7_texture_07001800[] = { +ALIGNED8 static const Texture bob_seg7_texture_07001800[] = { #include "levels/bob/3.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 bob_seg7_texture_07002000[] = { +ALIGNED8 static const Texture bob_seg7_texture_07002000[] = { #include "levels/bob/4.rgba16.inc.c" }; diff --git a/levels/bowser_1/texture.inc.c b/levels/bowser_1/texture.inc.c index 20465c94..67e7a24f 100644 --- a/levels/bowser_1/texture.inc.c +++ b/levels/bowser_1/texture.inc.c @@ -1,14 +1,14 @@ // 0x07000000 - 0x07000002 -ALIGNED8 static const u8 bowser_1_seg7_texture_07000000[] = { +ALIGNED8 static const Texture bowser_1_seg7_texture_07000000[] = { #include "levels/bowser_1/0.rgba16.inc.c" }; // 0x07001000 - 0x07001002 -ALIGNED8 static const u8 bowser_1_seg7_texture_07001000[] = { +ALIGNED8 static const Texture bowser_1_seg7_texture_07001000[] = { #include "levels/bowser_1/1.rgba16.inc.c" }; // 0x07001800 - 0x07001802 -ALIGNED8 static const u8 bowser_1_seg7_texture_07001800[] = { +ALIGNED8 static const Texture bowser_1_seg7_texture_07001800[] = { #include "levels/bowser_1/2.rgba16.inc.c" }; diff --git a/levels/bowser_2/texture.inc.c b/levels/bowser_2/texture.inc.c index 9662bae1..8ee1ce64 100644 --- a/levels/bowser_2/texture.inc.c +++ b/levels/bowser_2/texture.inc.c @@ -1,4 +1,4 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 bowser_2_seg7_texture_07000000[] = { +ALIGNED8 static const Texture bowser_2_seg7_texture_07000000[] = { #include "levels/bowser_2/0.rgba16.inc.c" }; diff --git a/levels/bowser_3/texture.inc.c b/levels/bowser_3/texture.inc.c index c7360095..088e9e02 100644 --- a/levels/bowser_3/texture.inc.c +++ b/levels/bowser_3/texture.inc.c @@ -1,14 +1,14 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 bowser_3_seg7_texture_07000000[] = { +ALIGNED8 static const Texture bowser_3_seg7_texture_07000000[] = { #include "levels/bowser_3/0.rgba16.inc.c" }; // 0x07000800 - 0x07001000 -ALIGNED8 static const u8 bowser_3_seg7_texture_07000800[] = { +ALIGNED8 static const Texture bowser_3_seg7_texture_07000800[] = { #include "levels/bowser_3/1.rgba16.inc.c" }; // 0x07001000 - 0x07002000 -ALIGNED8 static const u8 bowser_3_seg7_texture_07001000[] = { +ALIGNED8 static const Texture bowser_3_seg7_texture_07001000[] = { #include "levels/bowser_3/2.rgba16.inc.c" }; diff --git a/levels/castle_grounds/areas/1/12/model.inc.c b/levels/castle_grounds/areas/1/12/model.inc.c index baa8677c..55129ae4 100644 --- a/levels/castle_grounds/areas/1/12/model.inc.c +++ b/levels/castle_grounds/areas/1/12/model.inc.c @@ -18,12 +18,12 @@ static const Vtx castle_grounds_seg7_vertex_0700C9A8[] = { }; // 0x0700C9E8 - 0x0700D9E8 -ALIGNED8 static const u8 castle_grounds_seg7_texture_0700C9E8[] = { +ALIGNED8 static const Texture castle_grounds_seg7_texture_0700C9E8[] = { #include "levels/castle_grounds/3.rgba16.inc.c" }; // 0x0700D9E8 - 0x0700E9E8 -ALIGNED8 static const u8 castle_grounds_seg7_texture_0700D9E8[] = { +ALIGNED8 static const Texture castle_grounds_seg7_texture_0700D9E8[] = { #include "levels/castle_grounds/4.rgba16.inc.c" }; diff --git a/levels/castle_grounds/areas/1/13/model.inc.c b/levels/castle_grounds/areas/1/13/model.inc.c index 01912ea5..20e563d1 100644 --- a/levels/castle_grounds/areas/1/13/model.inc.c +++ b/levels/castle_grounds/areas/1/13/model.inc.c @@ -1,4 +1,4 @@ -ALIGNED8 static const u8 castle_grounds_seg7_us_texture_0700EAE8[] = { +ALIGNED8 static const Texture castle_grounds_seg7_us_texture_0700EAE8[] = { #include "levels/castle_grounds/5.ia8.inc.c" }; diff --git a/levels/castle_grounds/script.c b/levels/castle_grounds/script.c index 9fef7118..7e4d0538 100644 --- a/levels/castle_grounds/script.c +++ b/levels/castle_grounds/script.c @@ -57,7 +57,7 @@ static const LevelScript script_func_local_2[] = { OBJECT(/*model*/ MODEL_MIST, /*pos*/ -5527, -787, -4757, /*angle*/ 0, 0, 0, /*behParam*/ 0x00060000, /*beh*/ bhvWaterMist2), OBJECT(/*model*/ MODEL_MIST, /*pos*/ -5686, -787, -4733, /*angle*/ 0, 0, 0, /*behParam*/ 0x00070000, /*beh*/ bhvWaterMist2), OBJECT(/*model*/ MODEL_MIST, /*pos*/ -5845, -787, -4710, /*angle*/ 0, 0, 0, /*behParam*/ 0x00080000, /*beh*/ bhvWaterMist2), - OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5223, -975, 1667, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFish2), + OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5223, -975, 1667, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvManyBlueFishSpawner), OBJECT(/*model*/ MODEL_BIRDS, /*pos*/ -5069, 850, 3221, /*angle*/ 0, 0, 0, /*behParam*/ 0x00010000, /*beh*/ bhvBird), OBJECT(/*model*/ MODEL_BIRDS, /*pos*/ -4711, 742, 433, /*angle*/ 0, 0, 0, /*behParam*/ 0x00010000, /*beh*/ bhvBird), OBJECT(/*model*/ MODEL_BIRDS, /*pos*/ 5774, 913, -1114, /*angle*/ 0, 0, 0, /*behParam*/ 0x00010000, /*beh*/ bhvBird), diff --git a/levels/castle_grounds/texture.inc.c b/levels/castle_grounds/texture.inc.c index d9f3feae..f5e09586 100644 --- a/levels/castle_grounds/texture.inc.c +++ b/levels/castle_grounds/texture.inc.c @@ -1,14 +1,14 @@ // 0x07000000 - 0x07001000 -ALIGNED8 static const u8 castle_grounds_seg7_texture_07000000[] = { +ALIGNED8 static const Texture castle_grounds_seg7_texture_07000000[] = { #include "levels/castle_grounds/0.rgba16.inc.c" }; // 0x07001000 - 0x07002000 -ALIGNED8 static const u8 castle_grounds_seg7_texture_07001000[] = { +ALIGNED8 static const Texture castle_grounds_seg7_texture_07001000[] = { #include "levels/castle_grounds/1.rgba16.inc.c" }; // 0x07002000 - 0x07003000 -ALIGNED8 static const u8 castle_grounds_seg7_texture_07002000[] = { +ALIGNED8 static const Texture castle_grounds_seg7_texture_07002000[] = { #include "levels/castle_grounds/2.rgba16.inc.c" }; diff --git a/levels/castle_inside/painting.inc.c b/levels/castle_inside/painting.inc.c index 105b6056..d668820f 100644 --- a/levels/castle_inside/painting.inc.c +++ b/levels/castle_inside/painting.inc.c @@ -1300,55 +1300,55 @@ static const Gfx inside_castle_seg7_painting_dl_070235B8[] = { gsSPBranchList(inside_castle_seg7_painting_dl_07023580), }; -static const u8 *const inside_castle_seg7_painting_textures_070235C0[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_070235C0[] = { inside_castle_seg7_texture_0700B800, inside_castle_seg7_texture_0700A800, }; -static const u8 *const inside_castle_seg7_painting_textures_070235C8[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_070235C8[] = { inside_castle_seg7_texture_0700D800, inside_castle_seg7_texture_0700C800, }; -static const u8 *const inside_castle_seg7_painting_textures_070235D0[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_070235D0[] = { inside_castle_seg7_texture_0700F800, inside_castle_seg7_texture_0700E800, }; -static const u8 *const inside_castle_seg7_painting_textures_070235D8[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_070235D8[] = { inside_castle_seg7_texture_07011800, inside_castle_seg7_texture_07010800, }; -static const u8 *const inside_castle_seg7_painting_textures_070235E0[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_070235E0[] = { inside_castle_seg7_texture_07012800, inside_castle_seg7_texture_07013800, }; -static const u8 *const inside_castle_seg7_painting_textures_070235E8[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_070235E8[] = { inside_castle_seg7_texture_07015800, inside_castle_seg7_texture_07014800, }; -static const u8 *const inside_castle_seg7_painting_textures_070235F0[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_070235F0[] = { inside_castle_seg7_texture_07016800, }; -static const u8 *const inside_castle_seg7_painting_textures_070235F4[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_070235F4[] = { inside_castle_seg7_texture_07017000, }; -static const u8 *const inside_castle_seg7_painting_textures_070235F8[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_070235F8[] = { inside_castle_seg7_texture_07018800, inside_castle_seg7_texture_07017800, }; -static const u8 *const inside_castle_seg7_painting_textures_07023600[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_07023600[] = { inside_castle_seg7_texture_0701A800, inside_castle_seg7_texture_07019800, }; -static const u8 *const inside_castle_seg7_painting_textures_07023608[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_07023608[] = { inside_castle_seg7_texture_0701C800, inside_castle_seg7_texture_0701B800, }; -static const u8 *const inside_castle_seg7_painting_textures_07023610[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_07023610[] = { inside_castle_seg7_texture_0701E800, inside_castle_seg7_texture_0701D800, }; -static const u8 *const inside_castle_seg7_painting_textures_07023618[] = { +ALIGNED8 static const Texture *const inside_castle_seg7_painting_textures_07023618[] = { inside_castle_seg7_texture_07020800, inside_castle_seg7_texture_0701F800, }; diff --git a/levels/castle_inside/texture.inc.c b/levels/castle_inside/texture.inc.c index a0f40ca4..a3157f23 100644 --- a/levels/castle_inside/texture.inc.c +++ b/levels/castle_inside/texture.inc.c @@ -1,216 +1,216 @@ -ALIGNED8 static const u8 texture_castle_light[] = { +ALIGNED8 static const Texture texture_castle_light[] = { #include "levels/castle_inside/castle_light.ia16.inc.c" }; // 0x07000800 - 0x07001000 -ALIGNED8 static const u8 inside_castle_seg7_texture_07000800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07000800[] = { #include "levels/castle_inside/1.rgba16.inc.c" }; // 0x07001000 - 0x07002000 -ALIGNED8 static const u8 inside_castle_seg7_texture_07001000[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07001000[] = { #include "levels/castle_inside/2.ia16.inc.c" }; // 0x07002000 - 0x07003000 -ALIGNED8 static const u8 inside_castle_seg7_texture_07002000[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07002000[] = { #include "levels/castle_inside/3.rgba16.inc.c" }; // 0x07003000 - 0x07003800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07003000[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07003000[] = { #include "levels/castle_inside/4.rgba16.inc.c" }; // 0x07003800 - 0x07004800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07003800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07003800[] = { #include "levels/castle_inside/5.rgba16.inc.c" }; // 0x07004800 - 0x07005800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07004800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07004800[] = { #include "levels/castle_inside/6.rgba16.inc.c" }; // 0x07005800 - 0x07006000 -ALIGNED8 static const u8 inside_castle_seg7_texture_07005800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07005800[] = { #include "levels/castle_inside/7.rgba16.inc.c" }; // 0x07006000 - 0x07006800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07006000[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07006000[] = { #include "levels/castle_inside/8.rgba16.inc.c" }; // 0x07006800 - 0x07007000 -ALIGNED8 static const u8 inside_castle_seg7_texture_07006800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07006800[] = { #include "levels/castle_inside/9.rgba16.inc.c" }; // 0x07007000 - 0x07007800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07007000[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07007000[] = { #include "levels/castle_inside/10.rgba16.inc.c" }; // 0x07007800 - 0x07008000 -ALIGNED8 static const u8 inside_castle_seg7_texture_07007800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07007800[] = { #include "levels/castle_inside/11.rgba16.inc.c" }; // 0x07008000 - 0x07008800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07008000[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07008000[] = { #include "levels/castle_inside/12.rgba16.inc.c" }; // 0x07008800 - 0x07009000 -ALIGNED8 static const u8 inside_castle_seg7_texture_07008800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07008800[] = { #include "levels/castle_inside/13.rgba16.inc.c" }; // 0x07009000 - 0x07009800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07009000[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07009000[] = { #include "levels/castle_inside/14.rgba16.inc.c" }; // 0x07009800 - 0x0700A000 -ALIGNED8 static const u8 inside_castle_seg7_texture_07009800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07009800[] = { #include "levels/castle_inside/15.rgba16.inc.c" }; // 0x0700A000 - 0x0700A800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0700A000[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0700A000[] = { #include "levels/castle_inside/16.ia16.inc.c" }; // 0x0700A800 - 0x0700B800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0700A800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0700A800[] = { #include "levels/castle_inside/17.rgba16.inc.c" }; // 0x0700B800 - 0x0700C800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0700B800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0700B800[] = { #include "levels/castle_inside/18.rgba16.inc.c" }; // 0x0700C800 - 0x0700D800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0700C800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0700C800[] = { #include "levels/castle_inside/19.rgba16.inc.c" }; // 0x0700D800 - 0x0700E800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0700D800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0700D800[] = { #include "levels/castle_inside/20.rgba16.inc.c" }; // 0x0700E800 - 0x0700F800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0700E800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0700E800[] = { #include "levels/castle_inside/21.rgba16.inc.c" }; // 0x0700F800 - 0x07010800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0700F800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0700F800[] = { #include "levels/castle_inside/22.rgba16.inc.c" }; #ifdef VERSION_JP // 0x07010800 - 0x07011800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07010800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07010800[] = { #include "levels/castle_inside/23.rgba16.inc.c" }; // 0x07011800 - 0x0701200 -ALIGNED8 static const u8 inside_castle_seg7_texture_07011800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07011800[] = { #include "levels/castle_inside/24.rgba16.inc.c" }; #else // 0x07010800 - 0x07011800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07010800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07010800[] = { #include "levels/castle_inside/23_us.rgba16.inc.c" }; // 0x07011800 - 0x0701200 -ALIGNED8 static const u8 inside_castle_seg7_texture_07011800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07011800[] = { #include "levels/castle_inside/24_us.rgba16.inc.c" }; #endif // 0x07012800 - 0x07013800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07012800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07012800[] = { #include "levels/castle_inside/25.rgba16.inc.c" }; // 0x07013800 - 0x07014800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07013800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07013800[] = { #include "levels/castle_inside/26.rgba16.inc.c" }; // 0x07014800 - 0x07015800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07014800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07014800[] = { #include "levels/castle_inside/27.rgba16.inc.c" }; // 0x07015800 - 0x07016800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07015800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07015800[] = { #include "levels/castle_inside/28.rgba16.inc.c" }; // 0x07016800 - 0x07017000 -ALIGNED8 static const u8 inside_castle_seg7_texture_07016800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07016800[] = { #include "levels/castle_inside/29.rgba16.inc.c" }; // 0x07017000 - 0x07017800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07017000[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07017000[] = { #include "levels/castle_inside/30.rgba16.inc.c" }; // 0x07017800 - 0x07018800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07017800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07017800[] = { #include "levels/castle_inside/31.rgba16.inc.c" }; // 0x07018800 - 0x07019800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07018800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07018800[] = { #include "levels/castle_inside/32.rgba16.inc.c" }; // 0x07019800 - 0x0701A800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07019800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07019800[] = { #include "levels/castle_inside/33.rgba16.inc.c" }; // 0x0701A800 - 0x0701B800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0701A800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0701A800[] = { #include "levels/castle_inside/34.rgba16.inc.c" }; // 0x0701B800 - 0x0701C800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0701B800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0701B800[] = { #include "levels/castle_inside/35.rgba16.inc.c" }; // 0x0701C800 - 0x0701D800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0701C800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0701C800[] = { #include "levels/castle_inside/36.rgba16.inc.c" }; // 0x0701D800 - 0x0701E800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0701D800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0701D800[] = { #include "levels/castle_inside/37.rgba16.inc.c" }; // 0x0701E800 - 0x0701F800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0701E800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0701E800[] = { #include "levels/castle_inside/38.rgba16.inc.c" }; // 0x0701F800 - 0x07020800 -ALIGNED8 static const u8 inside_castle_seg7_texture_0701F800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_0701F800[] = { #include "levels/castle_inside/39.rgba16.inc.c" }; // 0x07020800 - 0x07021800 -ALIGNED8 static const u8 inside_castle_seg7_texture_07020800[] = { +ALIGNED8 static const Texture inside_castle_seg7_texture_07020800[] = { #include "levels/castle_inside/40.rgba16.inc.c" }; diff --git a/levels/ccm/snowman_base/model.inc.c b/levels/ccm/snowman_base/model.inc.c index dcc374ae..6b41acd2 100644 --- a/levels/ccm/snowman_base/model.inc.c +++ b/levels/ccm/snowman_base/model.inc.c @@ -5,7 +5,7 @@ static const Lights1 ccm_seg7_lights_07011940 = gdSPDefLights1( ); // 0x07011958 - 0x07012158 -ALIGNED8 static const u8 ccm_seg7_texture_07011958[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07011958[] = { #include "levels/ccm/12.rgba16.inc.c" }; diff --git a/levels/ccm/texture.inc.c b/levels/ccm/texture.inc.c index 0e674fdd..94c95bf8 100644 --- a/levels/ccm/texture.inc.c +++ b/levels/ccm/texture.inc.c @@ -1,59 +1,59 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 ccm_seg7_texture_07000000[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07000000[] = { #include "levels/ccm/0.rgba16.inc.c" }; // 0x07000800 - 0x07000900 -ALIGNED8 static const u8 ccm_seg7_texture_07000800[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07000800[] = { #include "levels/ccm/1.rgba16.inc.c" }; // 0x07000900 - 0x07001100 -ALIGNED8 static const u8 ccm_seg7_texture_07000900[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07000900[] = { #include "levels/ccm/2.rgba16.inc.c" }; // 0x07001100 - 0x07001900 -ALIGNED8 static const u8 ccm_seg7_texture_07001100[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07001100[] = { #include "levels/ccm/3.rgba16.inc.c" }; // 0x07001900 - 0x07002100 -ALIGNED8 static const u8 ccm_seg7_texture_07001900[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07001900[] = { #include "levels/ccm/4.rgba16.inc.c" }; // 0x07002100 - 0x07002900 -ALIGNED8 static const u8 ccm_seg7_texture_07002100[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07002100[] = { #include "levels/ccm/5.rgba16.inc.c" }; // 0x07002900 - 0x07003100 -ALIGNED8 static const u8 ccm_seg7_texture_07002900[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07002900[] = { #include "levels/ccm/6.rgba16.inc.c" }; // 0x07003100 - 0x07003900 -ALIGNED8 static const u8 ccm_seg7_texture_07003100[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07003100[] = { #include "levels/ccm/7.rgba16.inc.c" }; // 0x07003900 - 0x07003B00 -ALIGNED8 static const u8 ccm_seg7_texture_07003900[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07003900[] = { #include "levels/ccm/8.ia16.inc.c" }; // 0x07003B00 - 0x07004300 -ALIGNED8 static const u8 ccm_seg7_texture_07003B00[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07003B00[] = { #include "levels/ccm/9.ia16.inc.c" }; // 0x07004300 - 0x07004B00 -ALIGNED8 static const u8 ccm_seg7_texture_07004300[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07004300[] = { #include "levels/ccm/10.rgba16.inc.c" }; // 0x07004B00 - 0x07005300 -ALIGNED8 static const u8 ccm_seg7_texture_07004B00[] = { +ALIGNED8 static const Texture ccm_seg7_texture_07004B00[] = { #include "levels/ccm/11.rgba16.inc.c" }; diff --git a/levels/cotmc/texture.inc.c b/levels/cotmc/texture.inc.c index 68c8776e..644a9f04 100644 --- a/levels/cotmc/texture.inc.c +++ b/levels/cotmc/texture.inc.c @@ -1,24 +1,24 @@ // 0x07000000 - 0x07001000 -ALIGNED8 static const u8 cotmc_seg7_texture_07000000[] = { +ALIGNED8 static const Texture cotmc_seg7_texture_07000000[] = { #include "levels/cotmc/0.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 cotmc_seg7_texture_07001000[] = { +ALIGNED8 static const Texture cotmc_seg7_texture_07001000[] = { #include "levels/cotmc/1.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 cotmc_seg7_texture_07001800[] = { +ALIGNED8 static const Texture cotmc_seg7_texture_07001800[] = { #include "levels/cotmc/2.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 cotmc_seg7_texture_07002000[] = { +ALIGNED8 static const Texture cotmc_seg7_texture_07002000[] = { #include "levels/cotmc/3.rgba16.inc.c" }; // 0x07002800 - 0x07003000 -ALIGNED8 static const u8 cotmc_seg7_texture_07002800[] = { +ALIGNED8 static const Texture cotmc_seg7_texture_07002800[] = { #include "levels/cotmc/4.rgba16.inc.c" }; diff --git a/levels/ddd/script.c b/levels/ddd/script.c index fdccdfcc..ac8aaa99 100644 --- a/levels/ddd/script.c +++ b/levels/ddd/script.c @@ -18,8 +18,8 @@ static const LevelScript script_func_local_1[] = { OBJECT(/*model*/ MODEL_SUSHI, /*pos*/ -3071, -270, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSushiShark), OBJECT(/*model*/ MODEL_SUSHI, /*pos*/ -3071, -4270, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvSushiShark), - OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3071, -130, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFish3), - OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3071, -4270, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFish2), + OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3071, -130, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFewBlueFishSpawner), + OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3071, -4270, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvManyBlueFishSpawner), OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3071, -2000, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvChirpChirp), OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3071, -3000, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvChirpChirp), OBJECT(/*model*/ MODEL_DL_WHIRLPOOL, /*pos*/ -3174, -4915, 102, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvWhirlpool), diff --git a/levels/ddd/texture.inc.c b/levels/ddd/texture.inc.c index 990e0aab..caa01f31 100644 --- a/levels/ddd/texture.inc.c +++ b/levels/ddd/texture.inc.c @@ -1,24 +1,24 @@ // 0x07000000 - 0x07001000 -ALIGNED8 static const u8 ddd_seg7_texture_07000000[] = { +ALIGNED8 static const Texture ddd_seg7_texture_07000000[] = { #include "levels/ddd/0.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 ddd_seg7_texture_07001000[] = { +ALIGNED8 static const Texture ddd_seg7_texture_07001000[] = { #include "levels/ddd/1.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 ddd_seg7_texture_07001800[] = { +ALIGNED8 static const Texture ddd_seg7_texture_07001800[] = { #include "levels/ddd/2.rgba16.inc.c" }; // 0x07002000 - 0x07003000 -ALIGNED8 static const u8 ddd_seg7_texture_07002000[] = { +ALIGNED8 static const Texture ddd_seg7_texture_07002000[] = { #include "levels/ddd/3.rgba16.inc.c" }; // 0x07003000 - 0x07003800 -ALIGNED8 static const u8 ddd_seg7_texture_07003000[] = { +ALIGNED8 static const Texture ddd_seg7_texture_07003000[] = { #include "levels/ddd/4.rgba16.inc.c" }; diff --git a/levels/ending/leveldata.c b/levels/ending/leveldata.c index 0ea6be6f..94b93872 100644 --- a/levels/ending/leveldata.c +++ b/levels/ending/leveldata.c @@ -1,11 +1,8 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "moving_texture_macros.h" -#include "level_misc_macros.h" -#include "macro_preset_names.h" -#include "special_preset_names.h" -#include "textures.h" +#include +#include + +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" @@ -13,32 +10,32 @@ #include "levels/ending/cake_eu.inc.c" // 0x07023000 - 0x07023FFF -ALIGNED8 static const u8 cake_end_texture_eu_35[] = { +ALIGNED8 static const Texture cake_end_texture_eu_35[] = { #include "levels/ending/eu_023000.rgba16.inc.c" }; // 0x07024000 - 0x07024FFF -ALIGNED8 static const u8 cake_end_texture_eu_36[] = { +ALIGNED8 static const Texture cake_end_texture_eu_36[] = { #include "levels/ending/eu_024000.rgba16.inc.c" }; // 0x07025000 - 0x07025FFF -ALIGNED8 static const u8 cake_end_texture_eu_37[] = { +ALIGNED8 static const Texture cake_end_texture_eu_37[] = { #include "levels/ending/eu_025000.rgba16.inc.c" }; // 0x07026000 - 0x07026FFF -ALIGNED8 static const u8 cake_end_texture_eu_38[] = { +ALIGNED8 static const Texture cake_end_texture_eu_38[] = { #include "levels/ending/eu_026000.rgba16.inc.c" }; // 0x07027000 - 0x07027FFF -ALIGNED8 static const u8 cake_end_texture_eu_39[] = { +ALIGNED8 static const Texture cake_end_texture_eu_39[] = { #include "levels/ending/eu_027000.rgba16.inc.c" }; // 0x07028000 - 0x07028FFF -ALIGNED8 static const u8 cake_end_texture_eu_40[] = { +ALIGNED8 static const Texture cake_end_texture_eu_40[] = { #include "levels/ending/eu_028000.rgba16.inc.c" }; diff --git a/levels/entry.c b/levels/entry.c index 5ab06cdf..681fe93d 100644 --- a/levels/entry.c +++ b/levels/entry.c @@ -23,6 +23,6 @@ const LevelScript level_script_entry[] = { //SLEEP(/*frames*/ 2), //BLACKOUT(/*active*/ FALSE), //SET_REG(/*value*/ 0), - //EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ level_intro_entry_1), + //EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ level_intro_splash_screen), //JUMP(/*target*/ level_script_entry), }; diff --git a/levels/hmc/areas/1/painting.inc.c b/levels/hmc/areas/1/painting.inc.c index f2ff45df..86e688a1 100644 --- a/levels/hmc/areas/1/painting.inc.c +++ b/levels/hmc/areas/1/painting.inc.c @@ -501,7 +501,7 @@ UNUSED static const u64 hmc_unused_0 = 0; // 0x07024CE0 - 0x070254E0 -ALIGNED8 static const u8 hmc_seg7_texture_07024CE0[] = { +ALIGNED8 static const Texture hmc_seg7_texture_07024CE0[] = { #include "levels/hmc/7.rgba16.inc.c" }; @@ -516,7 +516,7 @@ static const Gfx hmc_seg7_painting_dl_070254E0[] = { }; // 0x07025518 - 0x07025594 -const u8 *const hmc_seg7_painting_textures_07025518[] = { +const Texture *const hmc_seg7_painting_textures_07025518[] = { hmc_seg7_texture_07024CE0, }; diff --git a/levels/hmc/texture.inc.c b/levels/hmc/texture.inc.c index 51e8a10c..3bb680e5 100644 --- a/levels/hmc/texture.inc.c +++ b/levels/hmc/texture.inc.c @@ -1,34 +1,34 @@ // 0x07000000 - 0x07001000 -ALIGNED8 static const u8 hmc_seg7_texture_07000000[] = { +ALIGNED8 static const Texture hmc_seg7_texture_07000000[] = { #include "levels/hmc/0.rgba16.inc.c" }; // 0x07001000 - 0x07002000 -ALIGNED8 static const u8 hmc_seg7_texture_07001000[] = { +ALIGNED8 static const Texture hmc_seg7_texture_07001000[] = { #include "levels/hmc/1.rgba16.inc.c" }; // 0x07002000 - 0x07003000 -ALIGNED8 static const u8 hmc_seg7_texture_07002000[] = { +ALIGNED8 static const Texture hmc_seg7_texture_07002000[] = { #include "levels/hmc/2.rgba16.inc.c" }; // 0x07003000 - 0x07003800 -ALIGNED8 static const u8 hmc_seg7_texture_07003000[] = { +ALIGNED8 static const Texture hmc_seg7_texture_07003000[] = { #include "levels/hmc/3.rgba16.inc.c" }; // 0x07003800 - 0x07004000 -ALIGNED8 static const u8 hmc_seg7_texture_07003800[] = { +ALIGNED8 static const Texture hmc_seg7_texture_07003800[] = { #include "levels/hmc/4.rgba16.inc.c" }; // 0x07004000 - 0x07004800 -ALIGNED8 static const u8 hmc_seg7_texture_07004000[] = { +ALIGNED8 static const Texture hmc_seg7_texture_07004000[] = { #include "levels/hmc/5.rgba16.inc.c" }; // 0x07004800 - 0x07005800 -ALIGNED8 static const u8 hmc_seg7_texture_07004800[] = { +ALIGNED8 static const Texture hmc_seg7_texture_07004800[] = { #include "levels/hmc/6.rgba16.inc.c" }; diff --git a/levels/intro/geo.c b/levels/intro/geo.c index 8ac70024..30a87806 100644 --- a/levels/intro/geo.c +++ b/levels/intro/geo.c @@ -32,27 +32,30 @@ const GeoLayout intro_geo_0002D0[] = { GEO_OPEN_NODE(), GEO_CAMERA(0, 0, 0, 3200, 0, 0, 0, 0x00000000), GEO_OPEN_NODE(), - GEO_ASM(0, geo_title_screen), + GEO_ASM(0, geo_intro_super_mario_64_logo), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_ZBUFFER(0), GEO_OPEN_NODE(), - GEO_ASM(0, geo_fade_transition), + GEO_ASM(0, geo_intro_tm_copyright), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_END(), }; // 0x0E00035C -const GeoLayout intro_geo_00035C[] = { +const GeoLayout intro_geo_mario_head_regular[] = { GEO_NODE_SCREEN_AREA(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2), GEO_OPEN_NODE(), GEO_ZBUFFER(0), GEO_OPEN_NODE(), GEO_NODE_ORTHO(100), GEO_OPEN_NODE(), - GEO_ASM(0, geo_intro_backdrop), + GEO_ASM(0, geo_intro_regular_backdrop), +#ifdef VERSION_SH + GEO_ASM(0, geo_intro_face_easter_egg), +#endif GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_ZBUFFER(1), @@ -62,19 +65,28 @@ const GeoLayout intro_geo_00035C[] = { GEO_ASM(2, geo_draw_mario_head_goddard), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), +#ifdef VERSION_SH + GEO_ZBUFFER(0), + GEO_OPEN_NODE(), + GEO_ASM(0, geo_intro_rumble_pak_graphic), + GEO_CLOSE_NODE(), +#endif GEO_CLOSE_NODE(), GEO_END(), }; // 0x0E0003B8 -const GeoLayout intro_geo_0003B8[] = { +const GeoLayout intro_geo_mario_head_dizzy[] = { GEO_NODE_SCREEN_AREA(0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2), GEO_OPEN_NODE(), GEO_ZBUFFER(0), GEO_OPEN_NODE(), GEO_NODE_ORTHO(100), GEO_OPEN_NODE(), - GEO_ASM(0, geo_game_over_tile), + GEO_ASM(0, geo_intro_gameover_backdrop), +#ifdef VERSION_SH + GEO_ASM(0, geo_intro_face_easter_egg), +#endif GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_ZBUFFER(1), @@ -84,6 +96,12 @@ const GeoLayout intro_geo_0003B8[] = { GEO_ASM(3, geo_draw_mario_head_goddard), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), +#ifdef VERSION_SH + GEO_ZBUFFER(0), + GEO_OPEN_NODE(), + GEO_ASM(1, geo_intro_rumble_pak_graphic), + GEO_CLOSE_NODE(), +#endif GEO_CLOSE_NODE(), GEO_END(), }; @@ -96,7 +114,7 @@ const GeoLayout intro_geo_000414[] = { GEO_OPEN_NODE(), GEO_NODE_ORTHO(100), GEO_OPEN_NODE(), - GEO_ASM(0, geo_intro_backdrop), + GEO_ASM(0, geo_intro_regular_backdrop), GEO_CLOSE_NODE(), GEO_CLOSE_NODE(), GEO_ZBUFFER(1), diff --git a/levels/intro/header.h b/levels/intro/header.h index e0f6292d..99277e86 100644 --- a/levels/intro/header.h +++ b/levels/intro/header.h @@ -5,8 +5,8 @@ // geo extern const GeoLayout intro_geo_0002D0[]; -extern const GeoLayout intro_geo_00035C[]; -extern const GeoLayout intro_geo_0003B8[]; +extern const GeoLayout intro_geo_mario_head_regular[]; +extern const GeoLayout intro_geo_mario_head_dizzy[]; extern const GeoLayout intro_geo_000414[]; // leveldata @@ -16,9 +16,9 @@ extern const f32 intro_seg7_table_0700C790[]; extern const f32 intro_seg7_table_0700C880[]; // script -extern const LevelScript level_intro_entry_1[]; -extern const LevelScript level_intro_entry_2[]; -extern const LevelScript level_intro_entry_3[]; +extern const LevelScript level_intro_splash_screen[]; +extern const LevelScript level_intro_mario_head_regular[]; +extern const LevelScript level_intro_mario_head_dizzy[]; extern const LevelScript level_intro_entry_4[]; extern const LevelScript script_intro_L1[]; extern const LevelScript script_intro_L2[]; diff --git a/levels/intro/leveldata.c b/levels/intro/leveldata.c index 49972a2f..7a4474d2 100644 --- a/levels/intro/leveldata.c +++ b/levels/intro/leveldata.c @@ -1,11 +1,8 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "moving_texture_macros.h" -#include "level_misc_macros.h" -#include "macro_preset_names.h" -#include "special_preset_names.h" -#include "textures.h" +#include +#include + +#include "macros.h" +#include "types.h" #include "make_const_nonconst.h" @@ -2580,12 +2577,12 @@ static const Vtx intro_seg7_vertex_07007DF0[] = { }; // 0x07007EA0 - 0x07007EA2 -ALIGNED8 static const u8 intro_seg7_texture_07007EA0[] = { +ALIGNED8 static const Texture intro_seg7_texture_07007EA0[] = { #include "levels/intro/0.rgba16.inc.c" }; // 0x070086A0 - 0x070086A2 -ALIGNED8 static const u8 intro_seg7_texture_070086A0[] = { +ALIGNED8 static const Texture intro_seg7_texture_070086A0[] = { #include "levels/intro/1.rgba16.inc.c" }; @@ -3336,25 +3333,31 @@ static const Vtx intro_seg7_vertex_0700B460[] = { {{{ 268, 196, -1}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}}, }; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) // 0x0700B4A0 - 0x0700B4A2 -ALIGNED8 static const u8 intro_seg7_texture_0700B4A0[] = { +ALIGNED8 static const Texture intro_seg7_texture_0700B4A0[] = { #include "levels/intro/2_eu_copyright.rgba16.inc.c" }; -// 0x0700C4A0 - 0x0700D4A0 -ALIGNED8 static const u8 intro_seg7_texture_0700C4A0[] = { -#include "levels/intro/3_eu_tm.rgba16.inc.c" -}; - #else // 0x0700B4A0 - 0x0700B4A2 -ALIGNED8 static const u8 intro_seg7_texture_0700B4A0[] = { +ALIGNED8 static const Texture intro_seg7_texture_0700B4A0[] = { #include "levels/intro/2_copyright.rgba16.inc.c" }; +#endif +#if defined(VERSION_EU) // 0x0700C4A0 - 0x0700D4A0 ALIGNED8 static const u8 intro_seg7_texture_0700C4A0[] = { +#include "levels/intro/3_eu_tm.rgba16.inc.c" +}; +#elif defined(VERSION_SH) +ALIGNED8 static const u8 intro_seg7_texture_0700C4A0[] = { +#include "levels/intro/3_sh_tm.rgba16.inc.c" +}; +#else +// 0x0700C4A0 - 0x0700D4A0 +ALIGNED8 static const Texture intro_seg7_texture_0700C4A0[] = { #include "levels/intro/3_tm.rgba16.inc.c" }; #endif diff --git a/levels/intro/script.c b/levels/intro/script.c index 4975dbb2..a130cc04 100644 --- a/levels/intro/script.c +++ b/levels/intro/script.c @@ -18,18 +18,21 @@ #include "make_const_nonconst.h" #include "levels/intro/header.h" -const LevelScript level_intro_entry_1[] = { +const LevelScript level_intro_splash_screen[] = { INIT_LEVEL(), FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), LOAD_MIO0(/*seg*/ 0x07, _intro_segment_7SegmentRomStart, _intro_segment_7SegmentRomEnd), - ALLOC_LEVEL_POOL(), + // Load "Super Mario 64" logo + ALLOC_LEVEL_POOL(), AREA(/*index*/ 1, intro_geo_0002D0), END_AREA(), - FREE_LEVEL_POOL(), + + // Start animation LOAD_AREA(/*area*/ 1), + CALL(/*arg*/ 0, /*func*/ lvl_intro_update), SLEEP(/*frames*/ 75), TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00), @@ -37,22 +40,22 @@ const LevelScript level_intro_entry_1[] = { CMD2A(/*unk2*/ 1), CLEAR_LEVEL(), SLEEP(/*frames*/ 2), - EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_2), + EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_mario_head_regular), }; -const LevelScript level_intro_entry_2[] = { +const LevelScript level_intro_mario_head_regular[] = { INIT_LEVEL(), BLACKOUT(/*active*/ TRUE), FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), LOAD_MARIO_HEAD(/*loadHeadID*/ REGULAR_FACE), LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), LOAD_MIO0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_mio0SegmentRomStart, _title_screen_bg_mio0SegmentRomEnd), + ALLOC_LEVEL_POOL(), - - AREA(/*index*/ 1, intro_geo_00035C), + AREA(/*index*/ 1, intro_geo_mario_head_regular), END_AREA(), - FREE_LEVEL_POOL(), + SLEEP(/*frames*/ 2), BLACKOUT(/*active*/ FALSE), LOAD_AREA(/*area*/ 1), @@ -65,7 +68,7 @@ const LevelScript level_intro_entry_2[] = { JUMP(script_intro_L4), }; -const LevelScript level_intro_entry_3[] = { +const LevelScript level_intro_mario_head_dizzy[] = { INIT_LEVEL(), BLACKOUT(/*active*/ TRUE), FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), @@ -74,7 +77,7 @@ const LevelScript level_intro_entry_3[] = { LOAD_MIO0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_mio0SegmentRomStart, _title_screen_bg_mio0SegmentRomEnd), ALLOC_LEVEL_POOL(), - AREA(/*index*/ 1, intro_geo_0003B8), + AREA(/*index*/ 1, intro_geo_mario_head_dizzy), END_AREA(), FREE_LEVEL_POOL(), @@ -154,5 +157,5 @@ const LevelScript script_intro_L5[] = { SLEEP(/*frames*/ 16), CLEAR_LEVEL(), SLEEP(/*frames*/ 2), - EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_1), + EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_splash_screen), }; diff --git a/levels/jrb/script.c b/levels/jrb/script.c index 7f58f465..1d58a481 100644 --- a/levels/jrb/script.c +++ b/levels/jrb/script.c @@ -94,7 +94,7 @@ static const LevelScript script_func_local_2[] = { static const LevelScript script_func_local_3[] = { OBJECT_WITH_ACTS(/*model*/ MODEL_NONE, /*pos*/ 4900, 2400, 800, /*angle*/ 0, 0, 0, /*behParam*/ 0x03000000, /*beh*/ bhvHiddenRedCoinStar, /*acts*/ ALL_ACTS), -#ifdef VERSION_JP +#if defined(VERSION_JP) || defined(VERSION_SH) OBJECT_WITH_ACTS(/*model*/ MODEL_STAR, /*pos*/ 1540, 2160, 2130, /*angle*/ 0, 0, 0, /*behParam*/ 0x04000000, /*beh*/ bhvStar, /*acts*/ ALL_ACTS), #else OBJECT_WITH_ACTS(/*model*/ MODEL_EXCLAMATION_BOX, /*pos*/ 1540, 2160, 2130, /*angle*/ 0, 0, 0, /*behParam*/ 0x04080000, /*beh*/ bhvExclamationBox, /*acts*/ ALL_ACTS), diff --git a/levels/jrb/texture.inc.c b/levels/jrb/texture.inc.c index ee6df27e..731cfe3d 100644 --- a/levels/jrb/texture.inc.c +++ b/levels/jrb/texture.inc.c @@ -1,19 +1,19 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 jrb_seg7_texture_07000000[] = { +ALIGNED8 static const Texture jrb_seg7_texture_07000000[] = { #include "levels/jrb/0.rgba16.inc.c" }; // 0x07000800 - 0x07001800 -ALIGNED8 static const u8 jrb_seg7_texture_07000800[] = { +ALIGNED8 static const Texture jrb_seg7_texture_07000800[] = { #include "levels/jrb/1.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 jrb_seg7_texture_07001800[] = { +ALIGNED8 static const Texture jrb_seg7_texture_07001800[] = { #include "levels/jrb/2.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 jrb_seg7_texture_07002000[] = { +ALIGNED8 static const Texture jrb_seg7_texture_07002000[] = { #include "levels/jrb/3.rgba16.inc.c" }; diff --git a/levels/lll/texture.inc.c b/levels/lll/texture.inc.c index 1d7117d5..67ed21cd 100644 --- a/levels/lll/texture.inc.c +++ b/levels/lll/texture.inc.c @@ -1,164 +1,164 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 lll_seg7_texture_07000000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07000000[] = { #include "levels/lll/0.rgba16.inc.c" }; // 0x07000800 - 0x07001000 -ALIGNED8 static const u8 lll_seg7_texture_07000800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07000800[] = { #include "levels/lll/1.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 lll_seg7_texture_07001000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07001000[] = { #include "levels/lll/2.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 lll_seg7_texture_07001800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07001800[] = { #include "levels/lll/3.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 lll_seg7_texture_07002000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07002000[] = { #include "levels/lll/4.rgba16.inc.c" }; // 0x07002800 - 0x07003000 -ALIGNED8 static const u8 lll_seg7_texture_07002800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07002800[] = { #include "levels/lll/5.rgba16.inc.c" }; // 0x07003000 - 0x07003800 -ALIGNED8 static const u8 lll_seg7_texture_07003000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07003000[] = { #include "levels/lll/6.rgba16.inc.c" }; // 0x07003800 - 0x07004000 -ALIGNED8 static const u8 lll_seg7_texture_07003800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07003800[] = { #include "levels/lll/7.rgba16.inc.c" }; // 0x07004000 - 0x07004800 -ALIGNED8 static const u8 lll_seg7_texture_07004000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07004000[] = { #include "levels/lll/8.rgba16.inc.c" }; // 0x07004800 - 0x07005000 -ALIGNED8 static const u8 lll_seg7_texture_07004800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07004800[] = { #include "levels/lll/9.rgba16.inc.c" }; // 0x07005000 - 0x07005800 -ALIGNED8 static const u8 lll_seg7_texture_07005000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07005000[] = { #include "levels/lll/10.rgba16.inc.c" }; // 0x07005800 - 0x07006000 -ALIGNED8 static const u8 lll_seg7_texture_07005800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07005800[] = { #include "levels/lll/11.rgba16.inc.c" }; // 0x07006000 - 0x07006800 -ALIGNED8 static const u8 lll_seg7_texture_07006000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07006000[] = { #include "levels/lll/12.rgba16.inc.c" }; // 0x07006800 - 0x07007000 -ALIGNED8 static const u8 lll_seg7_texture_07006800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07006800[] = { #include "levels/lll/13.rgba16.inc.c" }; // 0x07007000 - 0x07007800 -ALIGNED8 static const u8 lll_seg7_texture_07007000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07007000[] = { #include "levels/lll/14.rgba16.inc.c" }; // 0x07007800 - 0x07008000 -ALIGNED8 static const u8 lll_seg7_texture_07007800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07007800[] = { #include "levels/lll/15.rgba16.inc.c" }; // 0x07008000 - 0x07008800 -ALIGNED8 static const u8 lll_seg7_texture_07008000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07008000[] = { #include "levels/lll/16.rgba16.inc.c" }; // 0x07008800 - 0x07009000 -ALIGNED8 static const u8 lll_seg7_texture_07008800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07008800[] = { #include "levels/lll/17.rgba16.inc.c" }; // 0x07009000 - 0x07009800 -ALIGNED8 static const u8 lll_seg7_texture_07009000[] = { +ALIGNED8 static const Texture lll_seg7_texture_07009000[] = { #include "levels/lll/18.rgba16.inc.c" }; // 0x07009800 - 0x0700A000 -ALIGNED8 static const u8 lll_seg7_texture_07009800[] = { +ALIGNED8 static const Texture lll_seg7_texture_07009800[] = { #include "levels/lll/19.rgba16.inc.c" }; // 0x0700A000 - 0x0700A800 -ALIGNED8 static const u8 lll_seg7_texture_0700A000[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700A000[] = { #include "levels/lll/20.rgba16.inc.c" }; // 0x0700A800 - 0x0700B000 -ALIGNED8 static const u8 lll_seg7_texture_0700A800[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700A800[] = { #include "levels/lll/21.rgba16.inc.c" }; // 0x0700B000 - 0x0700B800 -ALIGNED8 static const u8 lll_seg7_texture_0700B000[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700B000[] = { #include "levels/lll/22.rgba16.inc.c" }; // 0x0700B800 - 0x0700C000 -ALIGNED8 static const u8 lll_seg7_texture_0700B800[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700B800[] = { #include "levels/lll/23.rgba16.inc.c" }; // 0x0700C000 - 0x0700C800 -ALIGNED8 static const u8 lll_seg7_texture_0700C000[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700C000[] = { #include "levels/lll/24.rgba16.inc.c" }; // 0x0700C800 - 0x0700D000 -ALIGNED8 static const u8 lll_seg7_texture_0700C800[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700C800[] = { #include "levels/lll/25.rgba16.inc.c" }; // 0x0700D000 - 0x0700D200 -ALIGNED8 static const u8 lll_seg7_texture_0700D000[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700D000[] = { #include "levels/lll/26.rgba16.inc.c" }; // 0x0700D200 - 0x0700D400 -ALIGNED8 static const u8 lll_seg7_texture_0700D200[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700D200[] = { #include "levels/lll/27.ia16.inc.c" }; // 0x0700D400 - 0x0700DC00 -ALIGNED8 static const u8 lll_seg7_texture_0700D400[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700D400[] = { #include "levels/lll/28.rgba16.inc.c" }; // 0x0700DC00 - 0x0700E400 -ALIGNED8 static const u8 lll_seg7_texture_0700DC00[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700DC00[] = { #include "levels/lll/29.rgba16.inc.c" }; // 0x0700E400 - 0x0700EC00 -ALIGNED8 static const u8 lll_seg7_texture_0700E400[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700E400[] = { #include "levels/lll/30.rgba16.inc.c" }; // 0x0700EC00 - 0x0700F400 -ALIGNED8 static const u8 lll_seg7_texture_0700EC00[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700EC00[] = { #include "levels/lll/31.rgba16.inc.c" }; // 0x0700F400 - 0x0700FC00 -ALIGNED8 static const u8 lll_seg7_texture_0700F400[] = { +ALIGNED8 static const Texture lll_seg7_texture_0700F400[] = { #include "levels/lll/32.rgba16.inc.c" }; diff --git a/levels/menu/leveldata.c b/levels/menu/leveldata.c index 4ccfea80..d5b3e511 100644 --- a/levels/menu/leveldata.c +++ b/levels/menu/leveldata.c @@ -1,11 +1,10 @@ -#include -#include "sm64.h" +#include +#include + +#include "macros.h" #include "surface_terrains.h" -#include "moving_texture_macros.h" -#include "level_misc_macros.h" -#include "macro_preset_names.h" -#include "special_preset_names.h" -#include "textures.h" +#include "types.h" + #ifdef VERSION_EU #include "text_strings.h" #endif @@ -18,22 +17,22 @@ static const Lights1 lights_menu_save_button = gdSPDefLights1( ); // 0x07000018 - 0x07000818 -ALIGNED8 static const u8 texture_menu_stone[] = { +ALIGNED8 static const Texture texture_menu_stone[] = { #include "levels/menu/main_menu_seg7.00018.rgba16.inc.c" }; // 0x07000818 - 0x07001018 -ALIGNED8 static const u8 texture_menu_dark_stone[] = { +ALIGNED8 static const Texture texture_menu_dark_stone[] = { #include "levels/menu/main_menu_seg7.00818.rgba16.inc.c" }; // 0x07001018 - 0x07002018 -ALIGNED8 static const u8 texture_menu_mario_save[] = { +ALIGNED8 static const Texture texture_menu_mario_save[] = { #include "levels/menu/main_menu_seg7.01018.rgba16.inc.c" }; // 0x07002018 - 0x07003018 -ALIGNED8 static const u8 texture_menu_mario_new[] = { +ALIGNED8 static const Texture texture_menu_mario_new[] = { #include "levels/menu/main_menu_seg7.02018.rgba16.inc.c" }; @@ -196,27 +195,27 @@ static const Lights1 lights_menu_main_button = gdSPDefLights1( ); // 0x07003468 - 0x07003468 -ALIGNED8 static const u8 texture_menu_erase[] = { +ALIGNED8 static const Texture texture_menu_erase[] = { #include "levels/menu/main_menu_seg7.03468.rgba16.inc.c" }; // 0x07003C68 - 0x07003C68 -ALIGNED8 static const u8 texture_menu_copy[] = { +ALIGNED8 static const Texture texture_menu_copy[] = { #include "levels/menu/main_menu_seg7.03C68.rgba16.inc.c" }; // 0x07004468 - 0x07004468 -ALIGNED8 static const u8 texture_menu_file[] = { +ALIGNED8 static const Texture texture_menu_file[] = { #include "levels/menu/main_menu_seg7.04468.rgba16.inc.c" }; // 0x07004C68 - 0x07004C68 -ALIGNED8 static const u8 texture_menu_score[] = { +ALIGNED8 static const Texture texture_menu_score[] = { #include "levels/menu/main_menu_seg7.04C68.rgba16.inc.c" }; // 0x07005468 - 0x07005468 -ALIGNED8 static const u8 texture_menu_sound[] = { +ALIGNED8 static const Texture texture_menu_sound[] = { #include "levels/menu/main_menu_seg7.05468.rgba16.inc.c" }; @@ -415,12 +414,12 @@ static const Vtx vertex_menu_hand[] = { }; // 0x07006328 - 0x07006B28 -ALIGNED8 static const u8 texture_menu_idle_hand[] = { +ALIGNED8 static const Texture texture_menu_idle_hand[] = { #include "levels/menu/main_menu_seg7.06328.rgba16.inc.c" }; // 0x07006B28 - 0x07007328 -ALIGNED8 static const u8 texture_menu_grabbing_hand[] = { +ALIGNED8 static const Texture texture_menu_grabbing_hand[] = { #include "levels/menu/main_menu_seg7.06B28.rgba16.inc.c" }; @@ -457,148 +456,148 @@ const Gfx dl_menu_grabbing_hand[] = { }; // 0x070073D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_hu[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_hu[] = { #include "levels/menu/main_menu_seg7.073D0.rgba16.inc.c" }; // 0x070075D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_small_a[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_small_a[] = { #include "levels/menu/main_menu_seg7.075D0.rgba16.inc.c" }; // 0x070077D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_i[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_i[] = { #include "levels/menu/main_menu_seg7.077D0.rgba16.inc.c" }; // 0x070079D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_ru[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_ru[] = { #include "levels/menu/main_menu_seg7.079D0.rgba16.inc.c" }; // 0x07007BD0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_se[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_se[] = { #include "levels/menu/main_menu_seg7.07BD0.rgba16.inc.c" }; // 0x07007DD0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_re[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_re[] = { #include "levels/menu/main_menu_seg7.07DD0.rgba16.inc.c" }; // 0x07007FD0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_ku[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_ku[] = { #include "levels/menu/main_menu_seg7.07FD0.rgba16.inc.c" }; // 0x070081D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_to[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_to[] = { #include "levels/menu/main_menu_seg7.081D0.rgba16.inc.c" }; // 0x070083D0 -ALIGNED8 static const u8 texture_menu_hud_char_hiragana_wo[] = { +ALIGNED8 static const Texture texture_menu_hud_char_hiragana_wo[] = { #include "levels/menu/main_menu_seg7.083D0.rgba16.inc.c" }; // 0x070085D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_ko[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_ko[] = { #include "levels/menu/main_menu_seg7.085D0.rgba16.inc.c" }; // 0x070087D0 -ALIGNED8 static const u8 texture_menu_hud_char_kana_handakuten_pi[] = { +ALIGNED8 static const Texture texture_menu_hud_char_kana_handakuten_pi[] = { #include "levels/menu/main_menu_seg7.087D0.rgba16.inc.c" }; // 0x070089D0 -ALIGNED8 static const u8 texture_menu_hud_char_choonpu[] = { +ALIGNED8 static const Texture texture_menu_hud_char_choonpu[] = { #include "levels/menu/main_menu_seg7.089D0.rgba16.inc.c" }; // 0x07008BD0 -ALIGNED8 static const u8 texture_menu_hud_char_hiragana_su[] = { +ALIGNED8 static const Texture texture_menu_hud_char_hiragana_su[] = { #include "levels/menu/main_menu_seg7.08BD0.rgba16.inc.c" }; // 0x07008DD0 -ALIGNED8 static const u8 texture_menu_hud_char_hiragana_ru[] = { +ALIGNED8 static const Texture texture_menu_hud_char_hiragana_ru[] = { #include "levels/menu/main_menu_seg7.08DD0.rgba16.inc.c" }; // 0x07008FD0 -ALIGNED8 static const u8 texture_menu_hud_char_hiragana_ke[] = { +ALIGNED8 static const Texture texture_menu_hud_char_hiragana_ke[] = { #include "levels/menu/main_menu_seg7.08FD0.rgba16.inc.c" }; // 0x070091D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_ma[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_ma[] = { #include "levels/menu/main_menu_seg7.091D0.rgba16.inc.c" }; // 0x070093D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_ri[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_ri[] = { #include "levels/menu/main_menu_seg7.093D0.rgba16.inc.c" }; // 0x070095D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_o[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_o[] = { #include "levels/menu/main_menu_seg7.095D0.rgba16.inc.c" }; // 0x070097D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_su[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_su[] = { #include "levels/menu/main_menu_seg7.097D0.rgba16.inc.c" }; // 0x070099D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_a[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_a[] = { #include "levels/menu/main_menu_seg7.099D0.rgba16.inc.c" }; // 0x07009BD0 -ALIGNED8 static const u8 texture_menu_hud_char_hiragana_mi[] = { +ALIGNED8 static const Texture texture_menu_hud_char_hiragana_mi[] = { #include "levels/menu/main_menu_seg7.09BD0.rgba16.inc.c" }; // 0x07009DD0 -ALIGNED8 static const u8 texture_menu_hud_char_hira_dakuten_do[] = { +ALIGNED8 static const Texture texture_menu_hud_char_hira_dakuten_do[] = { #include "levels/menu/main_menu_seg7.09DD0.rgba16.inc.c" }; // 0x07009FD0 -ALIGNED8 static const u8 texture_menu_hud_char_hiragana_no[] = { +ALIGNED8 static const Texture texture_menu_hud_char_hiragana_no[] = { #include "levels/menu/main_menu_seg7.09FD0.rgba16.inc.c" }; // 0x0700A1D0 -ALIGNED8 static const u8 texture_menu_hud_char_question[] = { +ALIGNED8 static const Texture texture_menu_hud_char_question[] = { #include "levels/menu/main_menu_seg7.0A1D0.rgba16.inc.c" }; // 0x0700A3D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_sa[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_sa[] = { #include "levels/menu/main_menu_seg7.0A3D0.rgba16.inc.c" }; // 0x0700A5D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_u[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_u[] = { #include "levels/menu/main_menu_seg7.0A5D0.rgba16.inc.c" }; // 0x0700A7D0 -ALIGNED8 static const u8 texture_menu_hud_char_katakana_n[] = { +ALIGNED8 static const Texture texture_menu_hud_char_katakana_n[] = { #include "levels/menu/main_menu_seg7.0A7D0.rgba16.inc.c" }; // 0x0700A9D0 -ALIGNED8 static const u8 texture_menu_hud_char_kana_dakuten_do[] = { +ALIGNED8 static const Texture texture_menu_hud_char_kana_dakuten_do[] = { #include "levels/menu/main_menu_seg7.0A9D0.rgba16.inc.c" }; // Menu HUD print table, only used in JP // 0x0700ABD0 -const u8 *const menu_hud_lut[] = { +const Texture *const menu_hud_lut[] = { texture_menu_hud_char_katakana_hu, texture_menu_hud_char_katakana_small_a, texture_menu_hud_char_katakana_i, texture_menu_hud_char_katakana_ru, texture_menu_hud_char_katakana_se, texture_menu_hud_char_katakana_re, texture_menu_hud_char_katakana_ku, texture_menu_hud_char_katakana_to, texture_menu_hud_char_hiragana_wo, texture_menu_hud_char_katakana_ko, texture_menu_hud_char_kana_handakuten_pi, texture_menu_hud_char_choonpu, @@ -608,951 +607,951 @@ const u8 *const menu_hud_lut[] = { texture_menu_hud_char_katakana_sa, texture_menu_hud_char_katakana_u, texture_menu_hud_char_katakana_n, texture_menu_hud_char_kana_dakuten_do, }; -#ifdef VERSION_JP +#if defined(VERSION_JP) || defined(VERSION_SH) UNUSED static const u64 menu_unused_0 = 0; // 0x0700AC48 -ALIGNED8 static const u8 texture_menu_font_char_jp_0[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_0[] = { #include "levels/menu/main_menu_seg7.0AC48.ia8.inc.c" }; // 0x0700AC88 -ALIGNED8 static const u8 texture_menu_font_char_jp_1[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_1[] = { #include "levels/menu/main_menu_seg7.0AC88.ia8.inc.c" }; // 0x0700ACC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_2[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_2[] = { #include "levels/menu/main_menu_seg7.0ACC8.ia8.inc.c" }; // 0x0700AD08 -ALIGNED8 static const u8 texture_menu_font_char_jp_3[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_3[] = { #include "levels/menu/main_menu_seg7.0AD08.ia8.inc.c" }; // 0x0700AD48 -ALIGNED8 static const u8 texture_menu_font_char_jp_4[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_4[] = { #include "levels/menu/main_menu_seg7.0AD48.ia8.inc.c" }; // 0x0700AD88 -ALIGNED8 static const u8 texture_menu_font_char_jp_5[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_5[] = { #include "levels/menu/main_menu_seg7.0AD88.ia8.inc.c" }; // 0x0700ADC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_6[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_6[] = { #include "levels/menu/main_menu_seg7.0ADC8.ia8.inc.c" }; // 0x0700AE08 -ALIGNED8 static const u8 texture_menu_font_char_jp_7[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_7[] = { #include "levels/menu/main_menu_seg7.0AE08.ia8.inc.c" }; // 0x0700AE48 -ALIGNED8 static const u8 texture_menu_font_char_jp_8[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_8[] = { #include "levels/menu/main_menu_seg7.0AE48.ia8.inc.c" }; // 0x0700AE88 -ALIGNED8 static const u8 texture_menu_font_char_jp_9[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_9[] = { #include "levels/menu/main_menu_seg7.0AE88.ia8.inc.c" }; // 0x0700AEC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_a[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_a[] = { #include "levels/menu/main_menu_seg7.0AEC8.ia8.inc.c" }; // 0x0700AF08 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_i[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_i[] = { #include "levels/menu/main_menu_seg7.0AF08.ia8.inc.c" }; // 0x0700AF48 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_u[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_u[] = { #include "levels/menu/main_menu_seg7.0AF48.ia8.inc.c" }; // 0x0700AF88 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_c[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_c[] = { #include "levels/menu/main_menu_seg7.0AF88.ia8.inc.c" }; // 0x0700AFC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_o[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_o[] = { #include "levels/menu/main_menu_seg7.0AFC8.ia8.inc.c" }; // 0x0700B008 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ka[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ka[] = { #include "levels/menu/main_menu_seg7.0B008.ia8.inc.c" }; // 0x0700B048 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ki[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ki[] = { #include "levels/menu/main_menu_seg7.0B048.ia8.inc.c" }; // 0x0700B088 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ku[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ku[] = { #include "levels/menu/main_menu_seg7.0B088.ia8.inc.c" }; // 0x0700B0C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ke[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ke[] = { #include "levels/menu/main_menu_seg7.0B0C8.ia8.inc.c" }; // 0x0700B108 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ko[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ko[] = { #include "levels/menu/main_menu_seg7.0B108.ia8.inc.c" }; // 0x0700B148 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_sa[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_sa[] = { #include "levels/menu/main_menu_seg7.0B148.ia8.inc.c" }; // 0x0700B188 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_shi[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_shi[] = { #include "levels/menu/main_menu_seg7.0B188.ia8.inc.c" }; // 0x0700B1C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_su[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_su[] = { #include "levels/menu/main_menu_seg7.0B1C8.ia8.inc.c" }; // 0x0700B208 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_se[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_se[] = { #include "levels/menu/main_menu_seg7.0B208.ia8.inc.c" }; // 0x0700B248 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_so[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_so[] = { #include "levels/menu/main_menu_seg7.0B248.ia8.inc.c" }; // 0x0700B288 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ta[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ta[] = { #include "levels/menu/main_menu_seg7.0B288.ia8.inc.c" }; // 0x0700B2C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_chi[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_chi[] = { #include "levels/menu/main_menu_seg7.0B2C8.ia8.inc.c" }; // 0x0700B308 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_tsu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_tsu[] = { #include "levels/menu/main_menu_seg7.0B308.ia8.inc.c" }; // 0x0700B348 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_te[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_te[] = { #include "levels/menu/main_menu_seg7.0B348.ia8.inc.c" }; // 0x0700B388 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_to[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_to[] = { #include "levels/menu/main_menu_seg7.0B388.ia8.inc.c" }; // 0x0700B3C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_na[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_na[] = { #include "levels/menu/main_menu_seg7.0B3C8.ia8.inc.c" }; // 0x0700B408 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ni[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ni[] = { #include "levels/menu/main_menu_seg7.0B408.ia8.inc.c" }; // 0x0700B448 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_nu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_nu[] = { #include "levels/menu/main_menu_seg7.0B448.ia8.inc.c" }; // 0x0700B488 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ne[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ne[] = { #include "levels/menu/main_menu_seg7.0B488.ia8.inc.c" }; // 0x0700B4C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_no[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_no[] = { #include "levels/menu/main_menu_seg7.0B4C8.ia8.inc.c" }; // 0x0700B508 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ha[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ha[] = { #include "levels/menu/main_menu_seg7.0B508.ia8.inc.c" }; // 0x0700B548 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_hi[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_hi[] = { #include "levels/menu/main_menu_seg7.0B548.ia8.inc.c" }; // 0x0700B588 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_hu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_hu[] = { #include "levels/menu/main_menu_seg7.0B588.ia8.inc.c" }; // 0x0700B5C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_he[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_he[] = { #include "levels/menu/main_menu_seg7.0B5C8.ia8.inc.c" }; // 0x0700B608 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ho[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ho[] = { #include "levels/menu/main_menu_seg7.0B608.ia8.inc.c" }; // 0x0700B648 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ma[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ma[] = { #include "levels/menu/main_menu_seg7.0B648.ia8.inc.c" }; // 0x0700B688 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_mi[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_mi[] = { #include "levels/menu/main_menu_seg7.0B688.ia8.inc.c" }; // 0x0700B6C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_mu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_mu[] = { #include "levels/menu/main_menu_seg7.0B6C8.ia8.inc.c" }; // 0x0700B708 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_me[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_me[] = { #include "levels/menu/main_menu_seg7.0B708.ia8.inc.c" }; // 0x0700B748 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_mo[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_mo[] = { #include "levels/menu/main_menu_seg7.0B748.ia8.inc.c" }; // 0x0700B788 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ya[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ya[] = { #include "levels/menu/main_menu_seg7.0B788.ia8.inc.c" }; // 0x0700B7C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_yu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_yu[] = { #include "levels/menu/main_menu_seg7.0B7C8.ia8.inc.c" }; // 0x0700B808 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_yo[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_yo[] = { #include "levels/menu/main_menu_seg7.0B808.ia8.inc.c" }; // 0x0700B848 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ra[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ra[] = { #include "levels/menu/main_menu_seg7.0B848.ia8.inc.c" }; // 0x0700B888 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ri[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ri[] = { #include "levels/menu/main_menu_seg7.0B888.ia8.inc.c" }; // 0x0700B8C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ru[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ru[] = { #include "levels/menu/main_menu_seg7.0B8C8.ia8.inc.c" }; // 0x0700B908 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_re[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_re[] = { #include "levels/menu/main_menu_seg7.0B908.ia8.inc.c" }; // 0x0700B948 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_ro[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_ro[] = { #include "levels/menu/main_menu_seg7.0B948.ia8.inc.c" }; // 0x0700B988 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_wa[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_wa[] = { #include "levels/menu/main_menu_seg7.0B988.ia8.inc.c" }; // 0x0700B9C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_wo[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_wo[] = { #include "levels/menu/main_menu_seg7.0B9C8.ia8.inc.c" }; // 0x0700BA08 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_n[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_n[] = { #include "levels/menu/main_menu_seg7.0BA08.ia8.inc.c" }; // 0x0700BA48 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_small_a[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_small_a[] = { #include "levels/menu/main_menu_seg7.0BA48.ia8.inc.c" }; // 0x0700BA88 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_small_i[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_small_i[] = { #include "levels/menu/main_menu_seg7.0BA88.ia8.inc.c" }; // 0x0700BAC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_small_u[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_small_u[] = { #include "levels/menu/main_menu_seg7.0BAC8.ia8.inc.c" }; // 0x0700BB08 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_small_e[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_small_e[] = { #include "levels/menu/main_menu_seg7.0BB08.ia8.inc.c" }; // 0x0700BB48 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_small_o[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_small_o[] = { #include "levels/menu/main_menu_seg7.0BB48.ia8.inc.c" }; // 0x0700BB88 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_small_ka[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_small_ka[] = { #include "levels/menu/main_menu_seg7.0BB88.ia8.inc.c" }; // 0x0700BBC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_small_yu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_small_yu[] = { #include "levels/menu/main_menu_seg7.0BBC8.ia8.inc.c" }; // 0x0700BC08 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_small_yo[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_small_yo[] = { #include "levels/menu/main_menu_seg7.0BC08.ia8.inc.c" }; // 0x0700BC48 -ALIGNED8 static const u8 texture_menu_font_char_jp_hiragana_small_tsu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_hiragana_small_tsu[] = { #include "levels/menu/main_menu_seg7.0BC48.ia8.inc.c" }; // 0x0700BC88 -ALIGNED8 static const u8 texture_menu_font_char_jp_handakuten[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_handakuten[] = { #include "levels/menu/main_menu_seg7.0BC88.ia8.inc.c" }; // 0x0700BCC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_dakuten[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_dakuten[] = { #include "levels/menu/main_menu_seg7.0BCC8.ia8.inc.c" }; // 0x0700BD08 -ALIGNED8 static const u8 texture_menu_font_char_jp_long_vowel[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_long_vowel[] = { #include "levels/menu/main_menu_seg7.0BD08.ia8.inc.c" }; // 0x0700BD48 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_a[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_a[] = { #include "levels/menu/main_menu_seg7.0BD48.ia8.inc.c" }; // 0x0700BD88 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_i[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_i[] = { #include "levels/menu/main_menu_seg7.0BD88.ia8.inc.c" }; // 0x0700BDC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_u[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_u[] = { #include "levels/menu/main_menu_seg7.0BDC8.ia8.inc.c" }; // 0x0700BE08 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_e[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_e[] = { #include "levels/menu/main_menu_seg7.0BE08.ia8.inc.c" }; // 0x0700BE48 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_o[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_o[] = { #include "levels/menu/main_menu_seg7.0BE48.ia8.inc.c" }; // 0x0700BE88 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ka[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ka[] = { #include "levels/menu/main_menu_seg7.0BE88.ia8.inc.c" }; // 0x0700BEC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ki[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ki[] = { #include "levels/menu/main_menu_seg7.0BEC8.ia8.inc.c" }; // 0x0700BF08 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ku[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ku[] = { #include "levels/menu/main_menu_seg7.0BF08.ia8.inc.c" }; // 0x0700BF48 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ke[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ke[] = { #include "levels/menu/main_menu_seg7.0BF48.ia8.inc.c" }; // 0x0700BF88 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ko[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ko[] = { #include "levels/menu/main_menu_seg7.0BF88.ia8.inc.c" }; // 0x0700BFC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_sa[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_sa[] = { #include "levels/menu/main_menu_seg7.0BFC8.ia8.inc.c" }; // 0x0700C008 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_shi[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_shi[] = { #include "levels/menu/main_menu_seg7.0C008.ia8.inc.c" }; // 0x0700C048 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_su[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_su[] = { #include "levels/menu/main_menu_seg7.0C048.ia8.inc.c" }; // 0x0700C088 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_se[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_se[] = { #include "levels/menu/main_menu_seg7.0C088.ia8.inc.c" }; // 0x0700C0C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_so[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_so[] = { #include "levels/menu/main_menu_seg7.0C0C8.ia8.inc.c" }; // 0x0700C108 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ta[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ta[] = { #include "levels/menu/main_menu_seg7.0C108.ia8.inc.c" }; // 0x0700C148 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_chi[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_chi[] = { #include "levels/menu/main_menu_seg7.0C148.ia8.inc.c" }; // 0x0700C188 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_tsu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_tsu[] = { #include "levels/menu/main_menu_seg7.0C188.ia8.inc.c" }; // 0x0700C1C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_te[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_te[] = { #include "levels/menu/main_menu_seg7.0C1C8.ia8.inc.c" }; // 0x0700C208 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_to[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_to[] = { #include "levels/menu/main_menu_seg7.0C208.ia8.inc.c" }; // 0x0700C248 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_na[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_na[] = { #include "levels/menu/main_menu_seg7.0C248.ia8.inc.c" }; // 0x0700C288 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ni[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ni[] = { #include "levels/menu/main_menu_seg7.0C288.ia8.inc.c" }; // 0x0700C2C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_nu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_nu[] = { #include "levels/menu/main_menu_seg7.0C2C8.ia8.inc.c" }; // 0x0700C308 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ne[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ne[] = { #include "levels/menu/main_menu_seg7.0C308.ia8.inc.c" }; // 0x0700C348 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_no[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_no[] = { #include "levels/menu/main_menu_seg7.0C348.ia8.inc.c" }; // 0x0700C388 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ha[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ha[] = { #include "levels/menu/main_menu_seg7.0C388.ia8.inc.c" }; // 0x0700C3C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_hi[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_hi[] = { #include "levels/menu/main_menu_seg7.0C3C8.ia8.inc.c" }; // 0x0700C408 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_hu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_hu[] = { #include "levels/menu/main_menu_seg7.0C408.ia8.inc.c" }; // 0x0700C448 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_he[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_he[] = { #include "levels/menu/main_menu_seg7.0C448.ia8.inc.c" }; // 0x0700C488 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ho[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ho[] = { #include "levels/menu/main_menu_seg7.0C488.ia8.inc.c" }; // 0x0700C4C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ma[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ma[] = { #include "levels/menu/main_menu_seg7.0C4C8.ia8.inc.c" }; // 0x0700C508 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_mi[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_mi[] = { #include "levels/menu/main_menu_seg7.0C508.ia8.inc.c" }; // 0x0700C548 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_mu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_mu[] = { #include "levels/menu/main_menu_seg7.0C548.ia8.inc.c" }; // 0x0700C588 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_me[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_me[] = { #include "levels/menu/main_menu_seg7.0C588.ia8.inc.c" }; // 0x0700C5C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_mo[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_mo[] = { #include "levels/menu/main_menu_seg7.0C5C8.ia8.inc.c" }; // 0x0700C608 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ya[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ya[] = { #include "levels/menu/main_menu_seg7.0C608.ia8.inc.c" }; // 0x0700C648 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_yu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_yu[] = { #include "levels/menu/main_menu_seg7.0C648.ia8.inc.c" }; // 0x0700C688 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_yo[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_yo[] = { #include "levels/menu/main_menu_seg7.0C688.ia8.inc.c" }; // 0x0700C6C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ra[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ra[] = { #include "levels/menu/main_menu_seg7.0C6C8.ia8.inc.c" }; // 0x0700C708 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ri[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ri[] = { #include "levels/menu/main_menu_seg7.0C708.ia8.inc.c" }; // 0x0700C748 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ru[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ru[] = { #include "levels/menu/main_menu_seg7.0C748.ia8.inc.c" }; // 0x0700C788 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_re[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_re[] = { #include "levels/menu/main_menu_seg7.0C788.ia8.inc.c" }; // 0x0700C7C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_ro[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_ro[] = { #include "levels/menu/main_menu_seg7.0C7C8.ia8.inc.c" }; // 0x0700C808 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_wa[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_wa[] = { #include "levels/menu/main_menu_seg7.0C808.ia8.inc.c" }; // 0x0700C848 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_wo[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_wo[] = { #include "levels/menu/main_menu_seg7.0C848.ia8.inc.c" }; // 0x0700C888 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_n[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_n[] = { #include "levels/menu/main_menu_seg7.0C888.ia8.inc.c" }; // 0x0700C8C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_small_a[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_small_a[] = { #include "levels/menu/main_menu_seg7.0C8C8.ia8.inc.c" }; // 0x0700C908 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_small_i[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_small_i[] = { #include "levels/menu/main_menu_seg7.0C908.ia8.inc.c" }; // 0x0700C948 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_small_u[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_small_u[] = { #include "levels/menu/main_menu_seg7.0C948.ia8.inc.c" }; // 0x0700C988 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_small_e[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_small_e[] = { #include "levels/menu/main_menu_seg7.0C988.ia8.inc.c" }; // 0x0700C9C8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_small_o[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_small_o[] = { #include "levels/menu/main_menu_seg7.0C9C8.ia8.inc.c" }; // 0x0700CA08 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_small_ka[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_small_ka[] = { #include "levels/menu/main_menu_seg7.0CA08.ia8.inc.c" }; // 0x0700CA48 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_small_yu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_small_yu[] = { #include "levels/menu/main_menu_seg7.0CA48.ia8.inc.c" }; // 0x0700CA88 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_small_yo[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_small_yo[] = { #include "levels/menu/main_menu_seg7.0CA88.ia8.inc.c" }; // 0x0700CAC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_katakana_small_tsu[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_katakana_small_tsu[] = { #include "levels/menu/main_menu_seg7.0CAC8.ia8.inc.c" }; // 0x0700CB08 -ALIGNED8 static const u8 texture_menu_font_char_jp_A[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_A[] = { #include "levels/menu/main_menu_seg7.0CB08.ia8.inc.c" }; // 0x0700CB48 -ALIGNED8 static const u8 texture_menu_font_char_jp_B[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_B[] = { #include "levels/menu/main_menu_seg7.0CB48.ia8.inc.c" }; // 0x0700CB88 -ALIGNED8 static const u8 texture_menu_font_char_jp_C[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_C[] = { #include "levels/menu/main_menu_seg7.0CB88.ia8.inc.c" }; // 0x0700CBC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_D[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_D[] = { #include "levels/menu/main_menu_seg7.0CBC8.ia8.inc.c" }; // 0x0700CC08 -ALIGNED8 static const u8 texture_menu_font_char_jp_coin[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_coin[] = { #include "levels/menu/main_menu_seg7.0CC08.ia8.inc.c" }; // 0x0700CC48 -ALIGNED8 static const u8 texture_menu_font_char_jp_star_filled[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_star_filled[] = { #include "levels/menu/main_menu_seg7.0CC48.ia8.inc.c" }; // 0x0700CC88 -ALIGNED8 static const u8 texture_menu_font_char_jp_multiply[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_multiply[] = { #include "levels/menu/main_menu_seg7.0CC88.ia8.inc.c" }; // 0x0700CCC8 -ALIGNED8 static const u8 texture_menu_font_char_jp_exclamation[] = { +ALIGNED8 static const Texture texture_menu_font_char_jp_exclamation[] = { #include "levels/menu/main_menu_seg7.0CCC8.ia8.inc.c" }; #else // 0x0700AC40 -ALIGNED8 static const u8 texture_menu_font_char_0[] = { +ALIGNED8 static const Texture texture_menu_font_char_0[] = { #include "levels/menu/main_menu_seg7_us.0AC40.ia8.inc.c" }; // 0x0700AC80 -ALIGNED8 static const u8 texture_menu_font_char_1[] = { +ALIGNED8 static const Texture texture_menu_font_char_1[] = { #include "levels/menu/main_menu_seg7_us.0AC80.ia8.inc.c" }; // 0x0700ACC0 -ALIGNED8 static const u8 texture_menu_font_char_2[] = { +ALIGNED8 static const Texture texture_menu_font_char_2[] = { #include "levels/menu/main_menu_seg7_us.0ACC0.ia8.inc.c" }; // 0x0700AD00 -ALIGNED8 static const u8 texture_menu_font_char_3[] = { +ALIGNED8 static const Texture texture_menu_font_char_3[] = { #include "levels/menu/main_menu_seg7_us.0AD00.ia8.inc.c" }; // 0x0700AD40 -ALIGNED8 static const u8 texture_menu_font_char_4[] = { +ALIGNED8 static const Texture texture_menu_font_char_4[] = { #include "levels/menu/main_menu_seg7_us.0AD40.ia8.inc.c" }; // 0x0700AD80 -ALIGNED8 static const u8 texture_menu_font_char_5[] = { +ALIGNED8 static const Texture texture_menu_font_char_5[] = { #include "levels/menu/main_menu_seg7_us.0AD80.ia8.inc.c" }; // 0x0700ADC0 -ALIGNED8 static const u8 texture_menu_font_char_6[] = { +ALIGNED8 static const Texture texture_menu_font_char_6[] = { #include "levels/menu/main_menu_seg7_us.0ADC0.ia8.inc.c" }; // 0x0700AE00 -ALIGNED8 static const u8 texture_menu_font_char_7[] = { +ALIGNED8 static const Texture texture_menu_font_char_7[] = { #include "levels/menu/main_menu_seg7_us.0AE00.ia8.inc.c" }; // 0x0700AE40 -ALIGNED8 static const u8 texture_menu_font_char_8[] = { +ALIGNED8 static const Texture texture_menu_font_char_8[] = { #include "levels/menu/main_menu_seg7_us.0AE40.ia8.inc.c" }; // 0x0700AE80 -ALIGNED8 static const u8 texture_menu_font_char_9[] = { +ALIGNED8 static const Texture texture_menu_font_char_9[] = { #include "levels/menu/main_menu_seg7_us.0AE80.ia8.inc.c" }; // 0x0700AEC0 -ALIGNED8 static const u8 texture_menu_font_char_A[] = { +ALIGNED8 static const Texture texture_menu_font_char_A[] = { #include "levels/menu/main_menu_seg7_us.0AEC0.ia8.inc.c" }; // 0x0700AF00 -ALIGNED8 static const u8 texture_menu_font_char_B[] = { +ALIGNED8 static const Texture texture_menu_font_char_B[] = { #include "levels/menu/main_menu_seg7_us.0AF00.ia8.inc.c" }; // 0x0700AF40 -ALIGNED8 static const u8 texture_menu_font_char_C[] = { +ALIGNED8 static const Texture texture_menu_font_char_C[] = { #include "levels/menu/main_menu_seg7_us.0AF40.ia8.inc.c" }; #ifdef VERSION_EU // 0x0700AF80 -ALIGNED8 static const u8 texture_menu_font_char_D[] = { +ALIGNED8 static const Texture texture_menu_font_char_D[] = { #include "levels/menu/main_menu_seg7_eu.0AF80.ia8.inc.c" }; #else // 0x0700AF80 -ALIGNED8 static const u8 texture_menu_font_char_D[] = { +ALIGNED8 static const Texture texture_menu_font_char_D[] = { #include "levels/menu/main_menu_seg7_us.0AF80.ia8.inc.c" }; #endif // 0x0700AFC0 -ALIGNED8 static const u8 texture_menu_font_char_E[] = { +ALIGNED8 static const Texture texture_menu_font_char_E[] = { #include "levels/menu/main_menu_seg7_us.0AFC0.ia8.inc.c" }; // 0x0700B000 -ALIGNED8 static const u8 texture_menu_font_char_F[] = { +ALIGNED8 static const Texture texture_menu_font_char_F[] = { #include "levels/menu/main_menu_seg7_us.0B000.ia8.inc.c" }; // 0x0700B040 -ALIGNED8 static const u8 texture_menu_font_char_G[] = { +ALIGNED8 static const Texture texture_menu_font_char_G[] = { #include "levels/menu/main_menu_seg7_us.0B040.ia8.inc.c" }; // 0x0700B080 -ALIGNED8 static const u8 texture_menu_font_char_H[] = { +ALIGNED8 static const Texture texture_menu_font_char_H[] = { #include "levels/menu/main_menu_seg7_us.0B080.ia8.inc.c" }; // 0x0700B0C0 -ALIGNED8 static const u8 texture_menu_font_char_I[] = { +ALIGNED8 static const Texture texture_menu_font_char_I[] = { #include "levels/menu/main_menu_seg7_us.0B0C0.ia8.inc.c" }; // 0x0700B100 -ALIGNED8 static const u8 texture_menu_font_char_J[] = { +ALIGNED8 static const Texture texture_menu_font_char_J[] = { #include "levels/menu/main_menu_seg7_us.0B100.ia8.inc.c" }; // 0x0700B140 -ALIGNED8 static const u8 texture_menu_font_char_K[] = { +ALIGNED8 static const Texture texture_menu_font_char_K[] = { #include "levels/menu/main_menu_seg7_us.0B140.ia8.inc.c" }; // 0x0700B180 -ALIGNED8 static const u8 texture_menu_font_char_L[] = { +ALIGNED8 static const Texture texture_menu_font_char_L[] = { #include "levels/menu/main_menu_seg7_us.0B180.ia8.inc.c" }; // 0x0700B1C0 -ALIGNED8 static const u8 texture_menu_font_char_M[] = { +ALIGNED8 static const Texture texture_menu_font_char_M[] = { #include "levels/menu/main_menu_seg7_us.0B1C0.ia8.inc.c" }; // 0x0700B200 -ALIGNED8 static const u8 texture_menu_font_char_N[] = { +ALIGNED8 static const Texture texture_menu_font_char_N[] = { #include "levels/menu/main_menu_seg7_us.0B200.ia8.inc.c" }; // 0x0700B240 -ALIGNED8 static const u8 texture_menu_font_char_O[] = { +ALIGNED8 static const Texture texture_menu_font_char_O[] = { #include "levels/menu/main_menu_seg7_us.0B240.ia8.inc.c" }; // 0x0700B280 -ALIGNED8 static const u8 texture_menu_font_char_P[] = { +ALIGNED8 static const Texture texture_menu_font_char_P[] = { #include "levels/menu/main_menu_seg7_us.0B280.ia8.inc.c" }; // 0x0700B2C0 -ALIGNED8 static const u8 texture_menu_font_char_Q[] = { +ALIGNED8 static const Texture texture_menu_font_char_Q[] = { #include "levels/menu/main_menu_seg7_us.0B2C0.ia8.inc.c" }; // 0x0700B300 -ALIGNED8 static const u8 texture_menu_font_char_R[] = { +ALIGNED8 static const Texture texture_menu_font_char_R[] = { #include "levels/menu/main_menu_seg7_us.0B300.ia8.inc.c" }; // 0x0700B340 -ALIGNED8 static const u8 texture_menu_font_char_S[] = { +ALIGNED8 static const Texture texture_menu_font_char_S[] = { #include "levels/menu/main_menu_seg7_us.0B340.ia8.inc.c" }; // 0x0700B380 -ALIGNED8 static const u8 texture_menu_font_char_T[] = { +ALIGNED8 static const Texture texture_menu_font_char_T[] = { #include "levels/menu/main_menu_seg7_us.0B380.ia8.inc.c" }; // 0x0700B3C0 -ALIGNED8 static const u8 texture_menu_font_char_U[] = { +ALIGNED8 static const Texture texture_menu_font_char_U[] = { #include "levels/menu/main_menu_seg7_us.0B3C0.ia8.inc.c" }; // 0x0700B400 -ALIGNED8 static const u8 texture_menu_font_char_V[] = { +ALIGNED8 static const Texture texture_menu_font_char_V[] = { #include "levels/menu/main_menu_seg7_us.0B400.ia8.inc.c" }; // 0x0700B440 -ALIGNED8 static const u8 texture_menu_font_char_W[] = { +ALIGNED8 static const Texture texture_menu_font_char_W[] = { #include "levels/menu/main_menu_seg7_us.0B440.ia8.inc.c" }; // 0x0700B480 -ALIGNED8 static const u8 texture_menu_font_char_X[] = { +ALIGNED8 static const Texture texture_menu_font_char_X[] = { #include "levels/menu/main_menu_seg7_us.0B480.ia8.inc.c" }; // 0x0700B4C0 -ALIGNED8 static const u8 texture_menu_font_char_Y[] = { +ALIGNED8 static const Texture texture_menu_font_char_Y[] = { #include "levels/menu/main_menu_seg7_us.0B4C0.ia8.inc.c" }; // 0x0700B500 -ALIGNED8 static const u8 texture_menu_font_char_Z[] = { +ALIGNED8 static const Texture texture_menu_font_char_Z[] = { #include "levels/menu/main_menu_seg7_us.0B500.ia8.inc.c" }; // 0x0700B540 -ALIGNED8 static const u8 texture_menu_font_char_coin[] = { +ALIGNED8 static const Texture texture_menu_font_char_coin[] = { #include "levels/menu/main_menu_seg7_us.0B540.ia8.inc.c" }; // 0x0700B580 -ALIGNED8 static const u8 texture_menu_font_char_multiply[] = { +ALIGNED8 static const Texture texture_menu_font_char_multiply[] = { #include "levels/menu/main_menu_seg7_us.0B580.ia8.inc.c" }; // 0x0700B5C0 -ALIGNED8 static const u8 texture_menu_font_char_star_filled[] = { +ALIGNED8 static const Texture texture_menu_font_char_star_filled[] = { #include "levels/menu/main_menu_seg7_us.0B5C0.ia8.inc.c" }; // 0x0700B600 -ALIGNED8 static const u8 texture_menu_font_char_dash[] = { +ALIGNED8 static const Texture texture_menu_font_char_dash[] = { #include "levels/menu/main_menu_seg7_us.0B600.ia8.inc.c" }; #ifdef VERSION_EU // 0x0700B640 -ALIGNED8 static const u8 texture_menu_font_char_comma[] = { +ALIGNED8 static const Texture texture_menu_font_char_comma[] = { #include "levels/menu/main_menu_seg7_eu.0B640.ia8.inc.c" }; // 0x0700B680 -ALIGNED8 static const u8 texture_menu_font_char_apostrophe[] = { +ALIGNED8 static const Texture texture_menu_font_char_apostrophe[] = { #include "levels/menu/main_menu_seg7_eu.0B680.ia8.inc.c" }; #else // 0x0700B640 -ALIGNED8 static const u8 texture_menu_font_char_comma[] = { +ALIGNED8 static const Texture texture_menu_font_char_comma[] = { #include "levels/menu/main_menu_seg7_us.0B640.ia8.inc.c" }; // 0x0700B680 -ALIGNED8 static const u8 texture_menu_font_char_apostrophe[] = { +ALIGNED8 static const Texture texture_menu_font_char_apostrophe[] = { #include "levels/menu/main_menu_seg7_us.0B680.ia8.inc.c" }; #endif // 0x0700B6C0 -ALIGNED8 static const u8 texture_menu_font_char_exclamation[] = { +ALIGNED8 static const Texture texture_menu_font_char_exclamation[] = { #include "levels/menu/main_menu_seg7_us.0B6C0.ia8.inc.c" }; // 0x0700B700 -ALIGNED8 static const u8 texture_menu_font_char_question[] = { +ALIGNED8 static const Texture texture_menu_font_char_question[] = { #include "levels/menu/main_menu_seg7_us.0B700.ia8.inc.c" }; // 0x0700B740 -ALIGNED8 static const u8 texture_menu_font_char_mface1[] = { +ALIGNED8 static const Texture texture_menu_font_char_mface1[] = { #include "levels/menu/main_menu_seg7_us.0B740.ia8.inc.c" }; // 0x0700B780 -ALIGNED8 static const u8 texture_menu_font_char_mface2[] = { +ALIGNED8 static const Texture texture_menu_font_char_mface2[] = { #include "levels/menu/main_menu_seg7_us.0B780.ia8.inc.c" }; // 0x0700B7C0 -ALIGNED8 static const u8 texture_menu_font_char_period[] = { +ALIGNED8 static const Texture texture_menu_font_char_period[] = { #include "levels/menu/main_menu_seg7_us.0B7C0.ia8.inc.c" }; // 0x0700B800 -ALIGNED8 static const u8 texture_menu_font_char_ampersand[] = { +ALIGNED8 static const Texture texture_menu_font_char_ampersand[] = { #include "levels/menu/main_menu_seg7_us.0B800.ia8.inc.c" }; #endif #ifdef VERSION_EU // 0x0700B840 -ALIGNED8 static const u8 texture_menu_font_char_umlaut[] = { +ALIGNED8 static const Texture texture_menu_font_char_umlaut[] = { #include "levels/menu/main_menu_seg7_eu.0B840.ia8.inc.c" }; // 0x0700B880 -ALIGNED8 static const u8 texture_menu_font_char_cedilla_mayus[] = { +ALIGNED8 static const Texture texture_menu_font_char_cedilla_mayus[] = { #include "levels/menu/main_menu_seg7_eu.0B880.ia8.inc.c" }; // 0x0700B8C0 -ALIGNED8 static const u8 texture_menu_font_char_colon[] = { +ALIGNED8 static const Texture texture_menu_font_char_colon[] = { #include "levels/menu/main_menu_seg7_eu.0B8C0.ia8.inc.c" }; #endif // Menu small font print table // 0x0700CD08 -const u8 *const menu_font_lut[] = { -#ifdef VERSION_JP +const Texture *const menu_font_lut[] = { +#if defined(VERSION_JP) || defined(VERSION_SH) texture_menu_font_char_jp_0, texture_menu_font_char_jp_1, texture_menu_font_char_jp_2, texture_menu_font_char_jp_3, texture_menu_font_char_jp_4, texture_menu_font_char_jp_5, texture_menu_font_char_jp_6, texture_menu_font_char_jp_7, texture_menu_font_char_jp_8, texture_menu_font_char_jp_9, texture_menu_font_char_jp_A, texture_menu_font_char_jp_B, @@ -1723,34 +1722,34 @@ UNUSED static const u64 menu_unused_1 = 0; #ifdef VERSION_EU // 0x0700BDA0 - 0x0700CDA0 -ALIGNED8 static const u8 texture_menu_course_upper[] = { +ALIGNED8 static const Texture texture_menu_course_upper[] = { #include "levels/menu/main_menu_seg7_eu.0BDA0.rgba16.inc.c" }; // 0x0700CDA0 - 0x0700DDA0 -ALIGNED8 static const u8 texture_menu_niveau_upper[] = { +ALIGNED8 static const Texture texture_menu_niveau_upper[] = { #include "levels/menu/main_menu_seg7_eu.0CDA0.rgba16.inc.c" }; // 0x0700DDA0 - 0x0700EDA0 -ALIGNED8 static const u8 texture_menu_kurs_upper[] = { +ALIGNED8 static const Texture texture_menu_kurs_upper[] = { #include "levels/menu/main_menu_seg7_eu.0DDA0.rgba16.inc.c" }; // 0x0700EDA0 - 0x0700FDA0 -ALIGNED8 static const u8 texture_menu_course_lower[] = { +ALIGNED8 static const Texture texture_menu_course_lower[] = { #include "levels/menu/main_menu_seg7_eu.0EDA0.rgba16.inc.c" }; #else // 0x0700D1A8 - 0x0700E1A8 -ALIGNED8 static const u8 texture_menu_course_upper[] = { +ALIGNED8 static const Texture texture_menu_course_upper[] = { #include "levels/menu/main_menu_seg7.0D1A8.rgba16.inc.c" }; // 0x0700E1A8 - 0x0700F1A8 -ALIGNED8 static const u8 texture_menu_course_lower[] = { +ALIGNED8 static const Texture texture_menu_course_lower[] = { #include "levels/menu/main_menu_seg7.0E1A8.rgba16.inc.c" }; #endif diff --git a/levels/pss/texture.inc.c b/levels/pss/texture.inc.c index 37955f28..220ce2aa 100644 --- a/levels/pss/texture.inc.c +++ b/levels/pss/texture.inc.c @@ -1,14 +1,14 @@ // 0x07000000 - 0x07000002 -ALIGNED8 static const u8 pss_seg7_texture_07000000[] = { +ALIGNED8 static const Texture pss_seg7_texture_07000000[] = { #include "levels/pss/0.rgba16.inc.c" }; // 0x07000800 - 0x07000802 -ALIGNED8 static const u8 pss_seg7_texture_07000800[] = { +ALIGNED8 static const Texture pss_seg7_texture_07000800[] = { #include "levels/pss/1.ia16.inc.c" }; // 0x07001000 - 0x07001002 -ALIGNED8 static const u8 pss_seg7_texture_07001000[] = { +ALIGNED8 static const Texture pss_seg7_texture_07001000[] = { #include "levels/pss/2.rgba16.inc.c" }; diff --git a/levels/rr/texture.inc.c b/levels/rr/texture.inc.c index c57ea13b..52e689cf 100644 --- a/levels/rr/texture.inc.c +++ b/levels/rr/texture.inc.c @@ -1,14 +1,14 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 texture_quarter_flying_carpet[] = { +ALIGNED8 static const Texture texture_quarter_flying_carpet[] = { #include "levels/rr/quarter_flying_carpet.rgba16.inc.c" }; // 0x07000800 - 0x07001800 -ALIGNED8 static const u8 rr_seg7_texture_07000800[] = { +ALIGNED8 static const Texture rr_seg7_texture_07000800[] = { #include "levels/rr/1.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 rr_seg7_texture_07001800[] = { +ALIGNED8 static const Texture rr_seg7_texture_07001800[] = { #include "levels/rr/2.rgba16.inc.c" }; diff --git a/levels/sa/script.c b/levels/sa/script.c index 9b206a3f..fd777f2e 100644 --- a/levels/sa/script.c +++ b/levels/sa/script.c @@ -16,8 +16,8 @@ #include "levels/sa/header.h" static const LevelScript script_func_local_1[] = { - OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -1000, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvLargeFishGroup), - OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -1000, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00020000, /*beh*/ bhvLargeFishGroup), + OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -1000, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00000000, /*beh*/ bhvFishSpawner), + OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -1000, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x00020000, /*beh*/ bhvFishSpawner), RETURN(), }; diff --git a/levels/scripts.c b/levels/scripts.c index 43fbf5d7..58ec70fb 100644 --- a/levels/scripts.c +++ b/levels/scripts.c @@ -48,8 +48,8 @@ static const LevelScript script_exec_level_table[2 static const LevelScript script_L1[4]; static const LevelScript script_L2[4]; -static const LevelScript script_L3[4]; -static const LevelScript script_L4[4]; +static const LevelScript goto_mario_head_regular[4]; +static const LevelScript goto_mario_head_dizzy[4]; static const LevelScript script_L5[4]; #define STUB_LEVEL(_0, _1, _2, _3, _4, _5, _6, _7, _8) @@ -152,26 +152,26 @@ const LevelScript level_main_scripts_entry[] = { SLEEP(/*frames*/ 1), LOOP_UNTIL(/*op*/ OP_LT, /*arg*/ 0), JUMP_IF(/*op*/ OP_EQ, /*arg*/ -1, script_L2), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ -2, script_L3), - JUMP_IF(/*op*/ OP_EQ, /*arg*/ -3, script_L4), + JUMP_IF(/*op*/ OP_EQ, /*arg*/ -2, goto_mario_head_regular), + JUMP_IF(/*op*/ OP_EQ, /*arg*/ -3, goto_mario_head_dizzy), JUMP_IF(/*op*/ OP_EQ, /*arg*/ -8, script_L1), JUMP_IF(/*op*/ OP_EQ, /*arg*/ -9, script_L5), }; static const LevelScript script_L1[] = { - EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_1), + EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_splash_screen), }; static const LevelScript script_L2[] = { EXIT_AND_EXECUTE(/*seg*/ 0x0E, _endingSegmentRomStart, _endingSegmentRomEnd, level_ending_entry), }; -static const LevelScript script_L3[] = { - EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_2), +static const LevelScript goto_mario_head_regular[] = { + EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_mario_head_regular), }; -static const LevelScript script_L4[] = { - EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_3), +static const LevelScript goto_mario_head_dizzy[] = { + EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_mario_head_dizzy), }; static const LevelScript script_L5[] = { diff --git a/levels/sl/texture.inc.c b/levels/sl/texture.inc.c index e3079f40..1fc94696 100644 --- a/levels/sl/texture.inc.c +++ b/levels/sl/texture.inc.c @@ -1,24 +1,24 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 sl_seg7_texture_07000000[] = { +ALIGNED8 static const Texture sl_seg7_texture_07000000[] = { #include "levels/sl/0.rgba16.inc.c" }; // 0x07000800 - 0x07001000 -ALIGNED8 static const u8 sl_seg7_texture_07000800[] = { +ALIGNED8 static const Texture sl_seg7_texture_07000800[] = { #include "levels/sl/1.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 sl_seg7_texture_07001000[] = { +ALIGNED8 static const Texture sl_seg7_texture_07001000[] = { #include "levels/sl/2.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 sl_seg7_texture_07001800[] = { +ALIGNED8 static const Texture sl_seg7_texture_07001800[] = { #include "levels/sl/3.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 sl_seg7_texture_07002000[] = { +ALIGNED8 static const Texture sl_seg7_texture_07002000[] = { #include "levels/sl/4.rgba16.inc.c" }; diff --git a/levels/ssl/areas/2/4/model.inc.c b/levels/ssl/areas/2/4/model.inc.c index bc58a62e..d733fbc5 100644 --- a/levels/ssl/areas/2/4/model.inc.c +++ b/levels/ssl/areas/2/4/model.inc.c @@ -7,7 +7,7 @@ static const Lights1 ssl_lights_quicksand_pit = gdSPDefLights1( ); // 0x07004018 - 0x07004818 -ALIGNED8 const u8 ssl_quicksand[] = { +ALIGNED8 const Texture ssl_quicksand[] = { #include "levels/ssl/7.rgba16.inc.c" }; diff --git a/levels/ssl/leveldata.c b/levels/ssl/leveldata.c index 9d432753..78808757 100644 --- a/levels/ssl/leveldata.c +++ b/levels/ssl/leveldata.c @@ -1,12 +1,15 @@ -#include -#include "sm64.h" -#include "surface_terrains.h" -#include "moving_texture_macros.h" -#include "level_misc_macros.h" -#include "macro_preset_names.h" -#include "special_preset_names.h" -#include "textures.h" +#include +#include + #include "dialog_ids.h" +#include "level_misc_macros.h" +#include "macros.h" +#include "macro_preset_names.h" +#include "moving_texture_macros.h" +#include "special_preset_names.h" +#include "surface_terrains.h" +#include "textures.h" +#include "types.h" #include "make_const_nonconst.h" // LEVEL DATA diff --git a/levels/ssl/texture.inc.c b/levels/ssl/texture.inc.c index 3b145fa5..032ca1ea 100644 --- a/levels/ssl/texture.inc.c +++ b/levels/ssl/texture.inc.c @@ -1,34 +1,34 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 ssl_seg7_texture_07000000[] = { +ALIGNED8 static const Texture ssl_seg7_texture_07000000[] = { #include "levels/ssl/0.rgba16.inc.c" }; // 0x07000800 - 0x07001000 -ALIGNED8 static const u8 ssl_seg7_texture_07000800[] = { +ALIGNED8 static const Texture ssl_seg7_texture_07000800[] = { #include "levels/ssl/1.ia16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 const u8 ssl_pyramid_sand[] = { +ALIGNED8 const Texture ssl_pyramid_sand[] = { #include "levels/ssl/2.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 ssl_seg7_texture_07001800[] = { +ALIGNED8 static const Texture ssl_seg7_texture_07001800[] = { #include "levels/ssl/3.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 ssl_seg7_texture_07002000[] = { +ALIGNED8 static const Texture ssl_seg7_texture_07002000[] = { #include "levels/ssl/4.rgba16.inc.c" }; // 0x07002800 - 0x07003800 -ALIGNED8 static const u8 ssl_seg7_texture_07002800[] = { +ALIGNED8 static const Texture ssl_seg7_texture_07002800[] = { #include "levels/ssl/5.rgba16.inc.c" }; // 0x07003800 - 0x07004000 -ALIGNED8 static const u8 ssl_seg7_texture_07003800[] = { +ALIGNED8 static const Texture ssl_seg7_texture_07003800[] = { #include "levels/ssl/6.rgba16.inc.c" }; diff --git a/levels/ssl/tox_box/model.inc.c b/levels/ssl/tox_box/model.inc.c index f5fb66d0..d2a1f50f 100644 --- a/levels/ssl/tox_box/model.inc.c +++ b/levels/ssl/tox_box/model.inc.c @@ -5,22 +5,22 @@ static const Lights1 ssl_seg7_lights_0700BF90 = gdSPDefLights1( ); // 0x0700BFA8 - 0x0700C7A8 -ALIGNED8 static const u8 ssl_seg7_texture_0700BFA8[] = { +ALIGNED8 static const Texture ssl_seg7_texture_0700BFA8[] = { #include "levels/ssl/8.rgba16.inc.c" }; // 0x0700C7A8 - 0x0700D7A8 -ALIGNED8 static const u8 ssl_seg7_texture_0700C7A8[] = { +ALIGNED8 static const Texture ssl_seg7_texture_0700C7A8[] = { #include "levels/ssl/9.rgba16.inc.c" }; // 0x0700D7A8 - 0x0700E7A8 -ALIGNED8 static const u8 ssl_seg7_texture_0700D7A8[] = { +ALIGNED8 static const Texture ssl_seg7_texture_0700D7A8[] = { #include "levels/ssl/10.rgba16.inc.c" }; // 0x0700E7A8 - 0x0700F7A8 -ALIGNED8 static const u8 ssl_seg7_texture_0700E7A8[] = { +ALIGNED8 static const Texture ssl_seg7_texture_0700E7A8[] = { #include "levels/ssl/11.rgba16.inc.c" }; diff --git a/levels/thi/texture.inc.c b/levels/thi/texture.inc.c index fd73bf42..546a4410 100644 --- a/levels/thi/texture.inc.c +++ b/levels/thi/texture.inc.c @@ -1,9 +1,9 @@ // 0x07000000 - 0x07000002 -ALIGNED8 static const u8 thi_seg7_texture_07000000[] = { +ALIGNED8 static const Texture thi_seg7_texture_07000000[] = { #include "levels/thi/0.rgba16.inc.c" }; // 0x07000800 - 0x07000802 -ALIGNED8 static const u8 thi_seg7_texture_07000800[] = { +ALIGNED8 static const Texture thi_seg7_texture_07000800[] = { #include "levels/thi/1.rgba16.inc.c" }; diff --git a/levels/totwc/texture.inc.c b/levels/totwc/texture.inc.c index 91e22689..e3c4561e 100644 --- a/levels/totwc/texture.inc.c +++ b/levels/totwc/texture.inc.c @@ -1,19 +1,19 @@ // 0x07000000 - 0x07001000 -ALIGNED8 static const u8 totwc_seg7_texture_07000000[] = { +ALIGNED8 static const Texture totwc_seg7_texture_07000000[] = { #include "levels/totwc/0.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 totwc_seg7_texture_07001000[] = { +ALIGNED8 static const Texture totwc_seg7_texture_07001000[] = { #include "levels/totwc/1.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 totwc_seg7_texture_07001800[] = { +ALIGNED8 static const Texture totwc_seg7_texture_07001800[] = { #include "levels/totwc/2.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 totwc_seg7_texture_07002000[] = { +ALIGNED8 static const Texture totwc_seg7_texture_07002000[] = { #include "levels/totwc/3.ia16.inc.c" }; diff --git a/levels/ttc/areas/1/movtext.inc.c b/levels/ttc/areas/1/movtext.inc.c index 897a0259..b96bc92d 100644 --- a/levels/ttc/areas/1/movtext.inc.c +++ b/levels/ttc/areas/1/movtext.inc.c @@ -5,7 +5,7 @@ static const Lights1 ttc_lights_surface_treadmill = gdSPDefLights1( ); // 0x07015F90 - 0x07016790 -ALIGNED8 const u8 ttc_yellow_triangle[] = { +ALIGNED8 const Texture ttc_yellow_triangle[] = { #include "levels/ttc/2.rgba16.inc.c" }; diff --git a/levels/ttc/texture.inc.c b/levels/ttc/texture.inc.c index c7dfb516..984abbbc 100644 --- a/levels/ttc/texture.inc.c +++ b/levels/ttc/texture.inc.c @@ -1,9 +1,9 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 ttc_seg7_texture_07000000[] = { +ALIGNED8 static const Texture ttc_seg7_texture_07000000[] = { #include "levels/ttc/0.rgba16.inc.c" }; // 0x07000800 - 0x07001000 -ALIGNED8 static const u8 ttc_seg7_texture_07000800[] = { +ALIGNED8 static const Texture ttc_seg7_texture_07000800[] = { #include "levels/ttc/1.rgba16.inc.c" }; diff --git a/levels/ttm/areas/1/painting.inc.c b/levels/ttm/areas/1/painting.inc.c index f66a4a16..2477f654 100644 --- a/levels/ttm/areas/1/painting.inc.c +++ b/levels/ttm/areas/1/painting.inc.c @@ -545,7 +545,7 @@ static const Gfx ttm_seg7_painting_dl_07012E98[] = { }; // 0x07012EF8 - 0x07012F78 -static const u8 *const ttm_seg7_painting_textures_07012EF8[] = { +ALIGNED8 static const Texture *const ttm_seg7_painting_textures_07012EF8[] = { ttm_seg7_texture_07004000, ttm_seg7_texture_07003000, }; diff --git a/levels/ttm/slide_exit_podium/model.inc.c b/levels/ttm/slide_exit_podium/model.inc.c index 3b39c911..0ed6e4f0 100644 --- a/levels/ttm/slide_exit_podium/model.inc.c +++ b/levels/ttm/slide_exit_podium/model.inc.c @@ -17,7 +17,7 @@ static const Lights1 ttm_seg7_lights_0702AD18 = gdSPDefLights1( ); // 0x0702AD30 - 0x0702B530 -ALIGNED8 static const u8 ttm_seg7_texture_0702AD30[] = { +ALIGNED8 static const Texture ttm_seg7_texture_0702AD30[] = { #include "levels/ttm/8.rgba16.inc.c" }; diff --git a/levels/ttm/texture.inc.c b/levels/ttm/texture.inc.c index b1f02d37..43b1b090 100644 --- a/levels/ttm/texture.inc.c +++ b/levels/ttm/texture.inc.c @@ -1,39 +1,39 @@ // 0x07000000 - 0x07001000 -ALIGNED8 static const u8 ttm_seg7_texture_07000000[] = { +ALIGNED8 static const Texture ttm_seg7_texture_07000000[] = { #include "levels/ttm/0.ia16.inc.c" }; // 0x07000800 - 0x07001800 -ALIGNED8 static const u8 ttm_seg7_texture_07000800[] = { +ALIGNED8 static const Texture ttm_seg7_texture_07000800[] = { #include "levels/ttm/1.rgba16.inc.c" }; // 0x07001000 - 0x07002000 -ALIGNED8 static const u8 ttm_seg7_texture_07001000[] = { +ALIGNED8 static const Texture ttm_seg7_texture_07001000[] = { #include "levels/ttm/2.rgba16.inc.c" }; // 0x07001800 - 0x07002800 -ALIGNED8 static const u8 ttm_seg7_texture_07001800[] = { +ALIGNED8 static const Texture ttm_seg7_texture_07001800[] = { #include "levels/ttm/3.rgba16.inc.c" }; // 0x07002000 - 0x07003000 -ALIGNED8 static const u8 ttm_seg7_texture_07002000[] = { +ALIGNED8 static const Texture ttm_seg7_texture_07002000[] = { #include "levels/ttm/4.rgba16.inc.c" }; // 0x07002800 - 0x07003800 -ALIGNED8 static const u8 ttm_seg7_texture_07002800[] = { +ALIGNED8 static const Texture ttm_seg7_texture_07002800[] = { #include "levels/ttm/5.rgba16.inc.c" }; // 0x07003000 - 0x07004000 -ALIGNED8 static const u8 ttm_seg7_texture_07003000[] = { +ALIGNED8 static const Texture ttm_seg7_texture_07003000[] = { #include "levels/ttm/6.rgba16.inc.c" }; // 0x07004000 - 0x07005000 -ALIGNED8 static const u8 ttm_seg7_texture_07004000[] = { +ALIGNED8 static const Texture ttm_seg7_texture_07004000[] = { #include "levels/ttm/7.rgba16.inc.c" }; diff --git a/levels/vcutm/texture.inc.c b/levels/vcutm/texture.inc.c index 40640dc5..e7878138 100644 --- a/levels/vcutm/texture.inc.c +++ b/levels/vcutm/texture.inc.c @@ -1,19 +1,19 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 vcutm_seg7_texture_07000000[] = { +ALIGNED8 static const Texture vcutm_seg7_texture_07000000[] = { #include "levels/vcutm/0.rgba16.inc.c" }; // 0x07000800 - 0x07001800 -ALIGNED8 static const u8 vcutm_seg7_texture_07000800[] = { +ALIGNED8 static const Texture vcutm_seg7_texture_07000800[] = { #include "levels/vcutm/1.rgba16.inc.c" }; // 0x07001800 - 0x07002800 -ALIGNED8 static const u8 vcutm_seg7_texture_07001800[] = { +ALIGNED8 static const Texture vcutm_seg7_texture_07001800[] = { #include "levels/vcutm/2.rgba16.inc.c" }; // 0x07002800 - 0x07003000 -ALIGNED8 static const u8 vcutm_seg7_texture_07002800[] = { +ALIGNED8 static const Texture vcutm_seg7_texture_07002800[] = { #include "levels/vcutm/3.rgba16.inc.c" }; diff --git a/levels/wdw/texture.inc.c b/levels/wdw/texture.inc.c index e730692f..0e510b06 100644 --- a/levels/wdw/texture.inc.c +++ b/levels/wdw/texture.inc.c @@ -1,24 +1,24 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 wdw_seg7_texture_07000000[] = { +ALIGNED8 static const Texture wdw_seg7_texture_07000000[] = { #include "levels/wdw/0.rgba16.inc.c" }; // 0x07000800 - 0x07001000 -ALIGNED8 static const u8 wdw_seg7_texture_07000800[] = { +ALIGNED8 static const Texture wdw_seg7_texture_07000800[] = { #include "levels/wdw/1.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 wdw_seg7_texture_07001000[] = { +ALIGNED8 static const Texture wdw_seg7_texture_07001000[] = { #include "levels/wdw/2.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 wdw_seg7_texture_07001800[] = { +ALIGNED8 static const Texture wdw_seg7_texture_07001800[] = { #include "levels/wdw/3.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 wdw_seg7_texture_07002000[] = { +ALIGNED8 static const Texture wdw_seg7_texture_07002000[] = { #include "levels/wdw/4.rgba16.inc.c" }; diff --git a/levels/wf/texture.inc.c b/levels/wf/texture.inc.c index 7a432682..2b58e2b8 100644 --- a/levels/wf/texture.inc.c +++ b/levels/wf/texture.inc.c @@ -1,29 +1,29 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 wf_seg7_texture_07000000[] = { +ALIGNED8 static const Texture wf_seg7_texture_07000000[] = { #include "levels/wf/0.rgba16.inc.c" }; // 0x07000800 - 0x07001000 -ALIGNED8 static const u8 wf_seg7_texture_07000800[] = { +ALIGNED8 static const Texture wf_seg7_texture_07000800[] = { #include "levels/wf/1.rgba16.inc.c" }; // 0x07001000 - 0x07001800 -ALIGNED8 static const u8 wf_seg7_texture_07001000[] = { +ALIGNED8 static const Texture wf_seg7_texture_07001000[] = { #include "levels/wf/2.rgba16.inc.c" }; // 0x07001800 - 0x07002000 -ALIGNED8 static const u8 wf_seg7_texture_07001800[] = { +ALIGNED8 static const Texture wf_seg7_texture_07001800[] = { #include "levels/wf/3.rgba16.inc.c" }; // 0x07002000 - 0x07002800 -ALIGNED8 static const u8 wf_seg7_texture_07002000[] = { +ALIGNED8 static const Texture wf_seg7_texture_07002000[] = { #include "levels/wf/4.rgba16.inc.c" }; // 0x07002800 - 0x07002900 -ALIGNED8 static const u8 wf_seg7_texture_07002800[] = { +ALIGNED8 static const Texture wf_seg7_texture_07002800[] = { #include "levels/wf/5.ia8.inc.c" }; diff --git a/levels/wmotr/texture.inc.c b/levels/wmotr/texture.inc.c index 2c2f21d8..9f0d7f10 100644 --- a/levels/wmotr/texture.inc.c +++ b/levels/wmotr/texture.inc.c @@ -1,24 +1,24 @@ // 0x07000000 - 0x07000800 -ALIGNED8 static const u8 wmotr_seg7_texture_07000000[] = { +ALIGNED8 static const Texture wmotr_seg7_texture_07000000[] = { #include "levels/wmotr/0.rgba16.inc.c" }; // 0x07000800 - 0x07000C00 -ALIGNED8 static const u8 wmotr_seg7_texture_07000800[] = { +ALIGNED8 static const Texture wmotr_seg7_texture_07000800[] = { #include "levels/wmotr/1.rgba16.inc.c" }; // 0x07000C00 - 0x07001400 -ALIGNED8 static const u8 wmotr_seg7_texture_07000C00[] = { +ALIGNED8 static const Texture wmotr_seg7_texture_07000C00[] = { #include "levels/wmotr/2.rgba16.inc.c" }; // 0x07001400 - 0x07001600 -ALIGNED8 static const u8 wmotr_seg7_texture_07001400[] = { +ALIGNED8 static const Texture wmotr_seg7_texture_07001400[] = { #include "levels/wmotr/3.rgba16.inc.c" }; // 0x07001600 - 0x07001800 -ALIGNED8 static const u8 wmotr_seg7_texture_07001600[] = { +ALIGNED8 static const Texture wmotr_seg7_texture_07001600[] = { #include "levels/wmotr/4.rgba16.inc.c" }; diff --git a/lib/src/guLookAtRef.c b/lib/src/guLookAtRef.c index 915b572f..b32b110b 100644 --- a/lib/src/guLookAtRef.c +++ b/lib/src/guLookAtRef.c @@ -1,13 +1,13 @@ /************************************************************************** - * * - * Copyright (C) 1994, Silicon Graphics, Inc. * - * * + * * + * Copyright (C) 1994, Silicon Graphics, Inc. * + * * * These coded instructions, statements, and computer programs contain * * unpublished proprietary information of Silicon Graphics, Inc., and * * are protected by Federal copyright law. They may not be disclosed * * to third parties or copied or duplicated in any form, in whole or * * in part, without the prior written consent of Silicon Graphics, Inc. * - * * + * * **************************************************************************/ /* Minor modifications */ diff --git a/lib/src/guMtxF2L.c b/lib/src/guMtxF2L.c index e76ab6e7..5ea8ded1 100644 --- a/lib/src/guMtxF2L.c +++ b/lib/src/guMtxF2L.c @@ -17,6 +17,7 @@ void guMtxIdentF(float mf[4][4]) { } } } + void guMtxIdent(Mtx *m) { guMtxIdentF(m->m); } diff --git a/lib/src/guPerspectiveF.c b/lib/src/guPerspectiveF.c index 3b552161..f56fbb8f 100644 --- a/lib/src/guPerspectiveF.c +++ b/lib/src/guPerspectiveF.c @@ -30,6 +30,7 @@ void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect, fl } } } + void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near, float far, float scale) { float mat[4][4]; diff --git a/lib/src/guScaleF.c b/lib/src/guScaleF.c index 1b40887c..15de4c69 100644 --- a/lib/src/guScaleF.c +++ b/lib/src/guScaleF.c @@ -7,6 +7,7 @@ void guScaleF(float mf[4][4], float x, float y, float z) { mf[2][2] = z; mf[3][3] = 1.0; } + void guScale(Mtx *m, float x, float y, float z) { float mf[4][4]; guScaleF(mf, x, y, z); diff --git a/lib/src/guTranslateF.c b/lib/src/guTranslateF.c index 3a17675e..179a6a7d 100644 --- a/lib/src/guTranslateF.c +++ b/lib/src/guTranslateF.c @@ -6,6 +6,7 @@ void guTranslateF(float m[4][4], float x, float y, float z) { m[3][1] = y; m[3][2] = z; } + void guTranslate(Mtx *m, float x, float y, float z) { float mf[4][4]; guTranslateF(mf, x, y, z); diff --git a/lib/src/leointerrupt.c b/lib/src/leointerrupt.c new file mode 100644 index 00000000..2aeea1e5 --- /dev/null +++ b/lib/src/leointerrupt.c @@ -0,0 +1,182 @@ +#include "libultra_internal.h" +#include "PR/rcp.h" +#include "bstring.h" +#include "piint.h" +#include "osint.h" + +u8 leoDiskStack[OS_PIM_STACKSIZE]; //technically should have a OS_LEO_STACKSIZE or something.. + +#ifdef VERSION_SH +// TODO: so many magic constants :'( +static void __osLeoResume(void); +static void __osLeoAbnormalResume(void); + +s32 __osLeoInterrupt() { + u32 stat; + volatile u32 pi_stat; + u32 bm_stat; + __OSTranxInfo *info; + __OSBlockInfo *blockInfo; + stat = 0; + info = &__osDiskHandle->transferInfo; + blockInfo = &info->block[info->blockNum]; + pi_stat = IO_READ(PI_STATUS_REG); + if (pi_stat & PI_STATUS_DMA_BUSY) { + __OSGlobalIntMask = __OSGlobalIntMask & ~SR_IBIT4; //cartridge interrupt + blockInfo->errStatus = LEO_ERROR_29; + __osLeoResume(); + return 1; + } + WAIT_ON_IOBUSY(pi_stat); + stat = IO_READ(LEO_STATUS); + if (stat & LEO_STATUS_MECHANIC_INTERRUPT) { + WAIT_ON_IOBUSY(pi_stat); + IO_WRITE(LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_CLR_MECHANIC_INTR); + blockInfo->errStatus = LEO_ERROR_GOOD; + return 0; + } + if (info->cmdType == LEO_CMD_TYPE_2) { + return 1; + } + if (stat & LEO_STATUS_BUFFER_MANAGER_ERROR) { + WAIT_ON_IOBUSY(pi_stat); + stat = IO_READ(LEO_STATUS); + blockInfo->errStatus = LEO_ERROR_22; + __osLeoResume(); + IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); + __OSGlobalIntMask |= OS_IM_PI; + return 1; + } + if (info->cmdType == LEO_CMD_TYPE_1) { + if ((stat & LEO_STATUS_DATA_REQUEST) == 0) { + if (info->sectorNum + 1 != info->transferMode * 85) { + blockInfo->errStatus = LEO_ERROR_24; + __osLeoAbnormalResume(); + return 1; + } + IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); + __OSGlobalIntMask |= OS_IM_PI; + blockInfo->errStatus = LEO_ERROR_GOOD; + __osLeoResume(); + return 1; + } + blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr + blockInfo->sectorSize); + info->sectorNum++; + osEPiRawStartDma(__osDiskHandle, OS_WRITE, LEO_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); + return 1; + } + if (info->cmdType == LEO_CMD_TYPE_0) { + if (info->transferMode == LEO_SECTOR_MODE) { + if ((s32)blockInfo->C1ErrNum + 17 < info->sectorNum) { + blockInfo->errStatus = LEO_ERROR_GOOD; + __osLeoAbnormalResume(); + return 1; + } + if ((stat & LEO_STATUS_DATA_REQUEST) == 0) { + blockInfo->errStatus = LEO_ERROR_23; + __osLeoAbnormalResume(); + return 1; + } + } else { + blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr + blockInfo->sectorSize); + } + bm_stat = IO_READ(LEO_BM_STATUS); + if ((bm_stat & LEO_BM_STATUS_C1SINGLE && bm_stat & LEO_BM_STATUS_C1DOUBLE) || bm_stat & LEO_BM_STATUS_MICRO) { + if (blockInfo->C1ErrNum > 3) { + if (info->transferMode != LEO_SECTOR_MODE || info->sectorNum > 0x52) { + blockInfo->errStatus = LEO_ERROR_23; + __osLeoAbnormalResume(); + return 1; + } + } else { + int errNum = blockInfo->C1ErrNum; + blockInfo->C1ErrSector[errNum] = info->sectorNum + 1; + } + blockInfo->C1ErrNum += 1; + } + if (stat & LEO_STATUS_C2_TRANSFER) { + if (info->sectorNum != 87) { + blockInfo->errStatus = LEO_ERROR_24; + __osLeoAbnormalResume(); + } + if (info->transferMode == LEO_TRACK_MODE && info->blockNum == 0) { + info->blockNum = 1; + info->sectorNum = -1; + info->block[1].dramAddr = (void *)((u32)info->block[1].dramAddr - info->block[1].sectorSize); + + blockInfo->errStatus = LEO_ERROR_22; + } else { + IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); + __OSGlobalIntMask |= OS_IM_PI; + info->cmdType = LEO_CMD_TYPE_2; + blockInfo->errStatus = LEO_ERROR_GOOD; + } + osEPiRawStartDma(__osDiskHandle, OS_READ, LEO_C2_BUFF, blockInfo->C2Addr, blockInfo->sectorSize * 4); + return 1; + } + + if (info->sectorNum == -1 && info->transferMode == LEO_TRACK_MODE && info->blockNum == 1) { + __OSBlockInfo *bptr = &info->block[0]; + if (bptr->C1ErrNum == 0) { + if (((u32 *)bptr->C2Addr)[0] | ((u32 *)bptr->C2Addr)[1] | ((u32 *)bptr->C2Addr)[2] | ((u32 *)bptr->C2Addr)[3]) { + bptr->errStatus = LEO_ERROR_24; + __osLeoAbnormalResume(); + return 1; + } + } + bptr->errStatus = 0; + __osLeoResume(); + } + info->sectorNum++; + if (stat & LEO_STATUS_DATA_REQUEST) { + if (info->sectorNum > 0x54) { + blockInfo->errStatus = LEO_ERROR_24; + __osLeoAbnormalResume(); + return 1; + } + osEPiRawStartDma(__osDiskHandle, 0, LEO_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); + blockInfo->errStatus = LEO_ERROR_GOOD; + return 1; + } + if (info->sectorNum <= 0x54) { + blockInfo->errStatus = LEO_ERROR_24; + __osLeoAbnormalResume(); + return 1; + } + return 1; + } + blockInfo->errStatus = LEO_ERROR_4; + __osLeoAbnormalResume(); + return 1; +} + +static void __osLeoAbnormalResume(void) { + __OSTranxInfo *info; + u32 pi_stat; + info = &__osDiskHandle->transferInfo; + WAIT_ON_IOBUSY(pi_stat); + IO_WRITE(LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_RESET); + WAIT_ON_IOBUSY(pi_stat); + IO_WRITE(LEO_BM_CTL, info->bmCtlShadow); + __osLeoResume(); + IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); + __OSGlobalIntMask |= OS_IM_PI; +} + +static void __osLeoResume(void) { + __OSEventState *es; + OSMesgQueue *mq; + s32 last; + es = &__osEventStateTab[OS_EVENT_PI]; + mq = es->messageQueue; + if (mq == NULL || MQ_IS_FULL(mq)) { + return; + } + last = (mq->first + mq->validCount) % mq->msgCount; + mq->msg[last] = es->message; + mq->validCount++; + if (mq->mtqueue->next != NULL) { + __osEnqueueThread(&D_80334898, __osPopThread(&mq->mtqueue)); + } +} +#endif diff --git a/lib/src/libultra_internal.h b/lib/src/libultra_internal.h index 440daa73..5639c6ac 100644 --- a/lib/src/libultra_internal.h +++ b/lib/src/libultra_internal.h @@ -49,11 +49,11 @@ extern u32 D_80365E3C; typedef struct { u32 initialized; // probably something like initialized? OSThread *mgrThread; - OSMesgQueue *unk08; - OSMesgQueue *unk0c; - OSMesgQueue *unk10; + OSMesgQueue *cmdQueue; + OSMesgQueue *eventQueue; + OSMesgQueue *accessQueue; s32 (*dma_func)(s32, u32, void *, size_t); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s32 (*edma_func)(OSPiHandle*, s32, u32, void *, size_t); #else u64 force_align; diff --git a/lib/src/new_func.h b/lib/src/new_func.h index c72a6b23..f966f6d3 100644 --- a/lib/src/new_func.h +++ b/lib/src/new_func.h @@ -13,12 +13,16 @@ extern u32 EU_D_80302090; extern OSPiHandle *__osDiskHandle; //possibly __osPiTable -extern volatile u32 D_8030208C; +extern volatile u32 __OSGlobalIntMask; s32 osEPiRawStartDma(OSPiHandle *arg0, s32 dir, u32 cart_addr, void *dram_addr, u32 size); void func_802F4B08(void); void func_802F4A20(void); -void func_802F7140(u32); -void func_802F71A0(OSPiHandle*, u32, u32); //osEPi something +void __osResetGlobalIntMask(u32 mask); +void __osEPiRawWriteIo(OSPiHandle*, u32, u32); void func_802F71F0(void); +#ifdef VERSION_SH +void __osSetGlobalIntMask(s32 arg0); +s32 __osEPiRawReadIo(OSPiHandle *arg0, u32 devAddr, u32 *arg2); +#endif #endif diff --git a/lib/src/os.h b/lib/src/os.h new file mode 100644 index 00000000..3126f481 --- /dev/null +++ b/lib/src/os.h @@ -0,0 +1,800 @@ + +/*==================================================================== + * os.h + * + * Copyright 1995, Silicon Graphics, Inc. + * All Rights Reserved. + * + * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, + * Inc.; the contents of this file may not be disclosed to third + * parties, copied or duplicated in any form, in whole or in part, + * without the prior written permission of Silicon Graphics, Inc. + * + * RESTRICTED RIGHTS LEGEND: + * Use, duplication or disclosure by the Government is subject to + * restrictions as set forth in subdivision (c)(1)(ii) of the Rights + * in Technical Data and Computer Software clause at DFARS + * 252.227-7013, and/or in similar or successor clauses in the FAR, + * DOD or NASA FAR Supplement. Unpublished - rights reserved under the + * Copyright Laws of the United States. + *====================================================================*/ + +/************************************************************************** + * + * $Revision: 1.149 $ + * $Date: 1997/12/15 04:30:52 $ + * $Source: /disk6/Master/cvsmdev2/PR/include/os.h,v $ + * + **************************************************************************/ + + +#ifndef _OS_H_ +#define _OS_H_ + +#ifdef _LANGUAGE_C_PLUS_PLUS +extern "C" { +#endif + +#include +#include "PR/os_message.h" + +#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) + +/************************************************************************** + * + * Type definitions + * + */ + +/* + * Structure for device manager block + */ +typedef struct { + s32 active; /* Status flag */ + OSThread *thread; /* Calling thread */ + OSMesgQueue *cmdQueue; /* Command queue */ + OSMesgQueue *evtQueue; /* Event queue */ + OSMesgQueue *acsQueue; /* Access queue */ + /* Raw DMA routine */ + s32 (*dma)(s32, u32, void *, u32); + s32 (*edma)(OSPiHandle *, s32, u32, void *, u32); +} OSDevMgr; + +/* + * Structure for file system + */ + + + +typedef struct { + int status; + OSMesgQueue *queue; + int channel; + u8 id[32]; + u8 label[32]; + int version; + int dir_size; + int inode_table; /* block location */ + int minode_table; /* mirrioring inode_table */ + int dir_table; /* block location */ + int inode_start_page; /* page # */ + u8 banks; + u8 activebank; +} OSPfs; + + +typedef struct { + u32 file_size; /* bytes */ + u32 game_code; + u16 company_code; + char ext_name[4]; + char game_name[16]; +} OSPfsState; + +/* + * Structure for Profiler + */ +typedef struct { + u16 *histo_base; /* histogram base */ + u32 histo_size; /* histogram size */ + u32 *text_start; /* start of text segment */ + u32 *text_end; /* end of text segment */ +} OSProf; + +#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ + +/************************************************************************** + * + * Global definitions + * + */ + +/* Thread states */ + +#define OS_STATE_STOPPED 1 +#define OS_STATE_RUNNABLE 2 +#define OS_STATE_RUNNING 4 +#define OS_STATE_WAITING 8 + +/* Events */ +#ifdef _FINALROM +#define OS_NUM_EVENTS 15 +#else +#define OS_NUM_EVENTS 23 +#endif + +#define OS_EVENT_SW1 0 /* CPU SW1 interrupt */ +#define OS_EVENT_SW2 1 /* CPU SW2 interrupt */ +#define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */ +#define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */ +#define OS_EVENT_SP 4 /* SP task done interrupt */ +#define OS_EVENT_SI 5 /* SI (controller) interrupt */ +#define OS_EVENT_AI 6 /* AI interrupt */ +#define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */ +#define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */ +#define OS_EVENT_DP 9 /* DP full sync interrupt */ +#define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */ +#define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */ +#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 */ +#ifndef _FINALROM +#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */ +#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */ +#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */ +#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */ +#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */ +#define OS_EVENT_RDB_DBG_DONE 20 +#define OS_EVENT_RDB_FLUSH_PROF 21 +#define OS_EVENT_RDB_ACK_PROF 22 +#endif + +/* Flags for debugging purpose */ + +#define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */ +#define OS_FLAG_FAULT 2 /* CPU fault has occurred */ + +/* Interrupt masks */ + +#define OS_IM_NONE 0x00000001 +#define OS_IM_SW1 0x00000501 +#define OS_IM_SW2 0x00000601 +#define OS_IM_CART 0x00000c01 +#define OS_IM_PRENMI 0x00001401 +#define OS_IM_RDBWRITE 0x00002401 +#define OS_IM_RDBREAD 0x00004401 +#define OS_IM_COUNTER 0x00008401 +#define OS_IM_CPU 0x0000ff01 +#define OS_IM_SP 0x00010401 +#define OS_IM_SI 0x00020401 +#define OS_IM_AI 0x00040401 +#define OS_IM_VI 0x00080401 +#define OS_IM_PI 0x00100401 +#define OS_IM_DP 0x00200401 +#define OS_IM_ALL 0x003fff01 +#define RCP_IMASK 0x003f0000 +#define RCP_IMASKSHIFT 16 + +/* Recommended thread priorities for the system threads */ + +#define OS_PRIORITY_MAX 255 +#define OS_PRIORITY_VIMGR 254 +#define OS_PRIORITY_RMON 250 +#define OS_PRIORITY_RMONSPIN 200 +#define OS_PRIORITY_PIMGR 150 +#define OS_PRIORITY_SIMGR 140 +#define OS_PRIORITY_APPMAX 127 +#define OS_PRIORITY_IDLE 0 /* Must be 0 */ + + +/* Flags to turn blocking on/off when sending/receiving message */ + +#define OS_MESG_NOBLOCK 0 +#define OS_MESG_BLOCK 1 + +/* Flags to indicate direction of data transfer */ + +#define OS_READ 0 /* device -> RDRAM */ +#define OS_WRITE 1 /* device <- RDRAM */ +#define OS_OTHERS 2 /* for Leo disk only */ + +/* + * I/O message types + */ +#define OS_MESG_TYPE_BASE (10) +#define OS_MESG_TYPE_LOOPBACK (OS_MESG_TYPE_BASE+0) +#define OS_MESG_TYPE_DMAREAD (OS_MESG_TYPE_BASE+1) +#define OS_MESG_TYPE_DMAWRITE (OS_MESG_TYPE_BASE+2) +#define OS_MESG_TYPE_VRETRACE (OS_MESG_TYPE_BASE+3) +#define OS_MESG_TYPE_COUNTER (OS_MESG_TYPE_BASE+4) +#define OS_MESG_TYPE_EDMAREAD (OS_MESG_TYPE_BASE+5) +#define OS_MESG_TYPE_EDMAWRITE (OS_MESG_TYPE_BASE+6) + +/* + * I/O message priority + */ +#define OS_MESG_PRI_NORMAL 0 +#define OS_MESG_PRI_HIGH 1 + +/* + * Page size argument for TLB routines + */ +#define OS_PM_4K 0x0000000 +#define OS_PM_16K 0x0006000 +#define OS_PM_64K 0x001e000 +#define OS_PM_256K 0x007e000 +#define OS_PM_1M 0x01fe000 +#define OS_PM_4M 0x07fe000 +#define OS_PM_16M 0x1ffe000 + +/* + * Stack size for I/O device managers: PIM (PI Manager), VIM (VI Manager), + * SIM (SI Manager) + * + */ +#define OS_PIM_STACKSIZE 4096 +#define OS_VIM_STACKSIZE 4096 +#define OS_SIM_STACKSIZE 4096 + +#define OS_MIN_STACKSIZE 72 + +/* + * Values for osTvType + */ +#define OS_TV_PAL 0 +#define OS_TV_NTSC 1 +#define OS_TV_MPAL 2 + +/* + * Video Interface (VI) mode type + */ +#define OS_VI_NTSC_LPN1 0 /* NTSC */ +#define OS_VI_NTSC_LPF1 1 +#define OS_VI_NTSC_LAN1 2 +#define OS_VI_NTSC_LAF1 3 +#define OS_VI_NTSC_LPN2 4 +#define OS_VI_NTSC_LPF2 5 +#define OS_VI_NTSC_LAN2 6 +#define OS_VI_NTSC_LAF2 7 +#define OS_VI_NTSC_HPN1 8 +#define OS_VI_NTSC_HPF1 9 +#define OS_VI_NTSC_HAN1 10 +#define OS_VI_NTSC_HAF1 11 +#define OS_VI_NTSC_HPN2 12 +#define OS_VI_NTSC_HPF2 13 + +#define OS_VI_PAL_LPN1 14 /* PAL */ +#define OS_VI_PAL_LPF1 15 +#define OS_VI_PAL_LAN1 16 +#define OS_VI_PAL_LAF1 17 +#define OS_VI_PAL_LPN2 18 +#define OS_VI_PAL_LPF2 19 +#define OS_VI_PAL_LAN2 20 +#define OS_VI_PAL_LAF2 21 +#define OS_VI_PAL_HPN1 22 +#define OS_VI_PAL_HPF1 23 +#define OS_VI_PAL_HAN1 24 +#define OS_VI_PAL_HAF1 25 +#define OS_VI_PAL_HPN2 26 +#define OS_VI_PAL_HPF2 27 + +#define OS_VI_MPAL_LPN1 28 /* MPAL - mainly Brazil */ +#define OS_VI_MPAL_LPF1 29 +#define OS_VI_MPAL_LAN1 30 +#define OS_VI_MPAL_LAF1 31 +#define OS_VI_MPAL_LPN2 32 +#define OS_VI_MPAL_LPF2 33 +#define OS_VI_MPAL_LAN2 34 +#define OS_VI_MPAL_LAF2 35 +#define OS_VI_MPAL_HPN1 36 +#define OS_VI_MPAL_HPF1 37 +#define OS_VI_MPAL_HAN1 38 +#define OS_VI_MPAL_HAF1 39 +#define OS_VI_MPAL_HPN2 40 +#define OS_VI_MPAL_HPF2 41 + +/* + * Video Interface (VI) special features + */ +#define OS_VI_GAMMA_ON 0x0001 +#define OS_VI_GAMMA_OFF 0x0002 +#define OS_VI_GAMMA_DITHER_ON 0x0004 +#define OS_VI_GAMMA_DITHER_OFF 0x0008 +#define OS_VI_DIVOT_ON 0x0010 +#define OS_VI_DIVOT_OFF 0x0020 +#define OS_VI_DITHER_FILTER_ON 0x0040 +#define OS_VI_DITHER_FILTER_OFF 0x0080 + +/* + * Video Interface (VI) mode attribute bit + */ +#define OS_VI_BIT_NONINTERLACE 0x0001 /* lo-res */ +#define OS_VI_BIT_INTERLACE 0x0002 /* lo-res */ +#define OS_VI_BIT_NORMALINTERLACE 0x0004 /* hi-res */ +#define OS_VI_BIT_DEFLICKINTERLACE 0x0008 /* hi-res */ +#define OS_VI_BIT_ANTIALIAS 0x0010 +#define OS_VI_BIT_POINTSAMPLE 0x0020 +#define OS_VI_BIT_16PIXEL 0x0040 +#define OS_VI_BIT_32PIXEL 0x0080 +#define OS_VI_BIT_LORES 0x0100 +#define OS_VI_BIT_HIRES 0x0200 +#define OS_VI_BIT_NTSC 0x0400 +#define OS_VI_BIT_PAL 0x0800 + +/* + * Leo Disk + */ + +/* transfer mode */ + +#define LEO_BLOCK_MODE 1 +#define LEO_TRACK_MODE 2 +#define LEO_SECTOR_MODE 3 + +/* + * Controllers number + */ + +#ifndef _HW_VERSION_1 +#define MAXCONTROLLERS 4 +#else +#define MAXCONTROLLERS 6 +#endif + +/* controller errors */ +#define CONT_NO_RESPONSE_ERROR 0x8 +#define CONT_OVERRUN_ERROR 0x4 +#ifdef _HW_VERSION_1 +#define CONT_FRAME_ERROR 0x2 +#define CONT_COLLISION_ERROR 0x1 +#endif + +/* Controller type */ + +#define CONT_ABSOLUTE 0x0001 +#define CONT_RELATIVE 0x0002 +#define CONT_JOYPORT 0x0004 +#define CONT_EEPROM 0x8000 +#define CONT_EEP16K 0x4000 +#define CONT_TYPE_MASK 0x1f07 +#define CONT_TYPE_NORMAL 0x0005 +#define CONT_TYPE_MOUSE 0x0002 + +/* Controller status */ + +#define CONT_CARD_ON 0x01 +#define CONT_CARD_PULL 0x02 +#define CONT_ADDR_CRC_ER 0x04 +#define CONT_EEPROM_BUSY 0x80 + +/* EEPROM TYPE */ + +#define EEPROM_TYPE_4K 0x01 +#define EEPROM_TYPE_16K 0x02 + +/* Buttons */ + +#define CONT_A 0x8000 +#define CONT_B 0x4000 +#define CONT_G 0x2000 +#define CONT_START 0x1000 +#define CONT_UP 0x0800 +#define CONT_DOWN 0x0400 +#define CONT_LEFT 0x0200 +#define CONT_RIGHT 0x0100 +#define CONT_L 0x0020 +#define CONT_R 0x0010 +#define CONT_E 0x0008 +#define CONT_D 0x0004 +#define CONT_C 0x0002 +#define CONT_F 0x0001 + +/* Nintendo's official button names */ + +#define A_BUTTON CONT_A +#define B_BUTTON CONT_B +#define L_TRIG CONT_L +#define R_TRIG CONT_R +#define Z_TRIG CONT_G +#define START_BUTTON CONT_START +#define U_JPAD CONT_UP +#define L_JPAD CONT_LEFT +#define R_JPAD CONT_RIGHT +#define D_JPAD CONT_DOWN +#define U_CBUTTONS CONT_E +#define L_CBUTTONS CONT_C +#define R_CBUTTONS CONT_F +#define D_CBUTTONS CONT_D + +/* File System size */ +#define OS_PFS_VERSION 0x0200 +#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8) +#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255) + +#define PFS_FILE_NAME_LEN 16 +#define PFS_FILE_EXT_LEN 4 +#define BLOCKSIZE 32 /* bytes */ +#define PFS_ONE_PAGE 8 /* blocks */ +#define PFS_MAX_BANKS 62 + +/* File System flag */ + +#define PFS_READ 0 +#define PFS_WRITE 1 +#define PFS_CREATE 2 + +/* File System status */ +#define PFS_INITIALIZED 0x1 +#define PFS_CORRUPTED 0x2 /* File system was corrupted */ + +/* File System error number */ + +#define PFS_ERR_NOPACK 1 /* no memory card is plugged or */ +#define PFS_ERR_NEW_PACK 2 /* ram pack has been changed to a */ + /* different one */ +#define PFS_ERR_INCONSISTENT 3 /* need to run Pfschecker */ +#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR +#define PFS_ERR_INVALID 5 /* invalid parameter or file not exist*/ +#define PFS_ERR_BAD_DATA 6 /* the data read from pack are bad*/ +#define PFS_DATA_FULL 7 /* no free pages on ram pack */ +#define PFS_DIR_FULL 8 /* no free directories on ram pack*/ +#define PFS_ERR_EXIST 9 /* file exists */ +#define PFS_ERR_ID_FATAL 10 /* dead ram pack */ +#define PFS_ERR_DEVICE 11 /* wrong device type*/ + +/* definition for EEPROM */ + +#define EEPROM_MAXBLOCKS 64 +#define EEP16K_MAXBLOCKS 256 +#define EEPROM_BLOCK_SIZE 8 + +/* + * PI/EPI + */ +#define PI_DOMAIN1 0 +#define PI_DOMAIN2 1 + +/* + * Profiler constants + */ +#define PROF_MIN_INTERVAL 50 /* microseconds */ + +/* + * Boot addresses + */ +#define BOOT_ADDRESS_ULTRA 0x80000400 +#define BOOT_ADDRESS_COSIM 0x80002000 +#define BOOT_ADDRESS_EMU 0x20010000 +#define BOOT_ADDRESS_INDY 0x88100000 + +/* + * Size of buffer the retains contents after NMI + */ +#define OS_APP_NMI_BUFSIZE 64 + +#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) + +/************************************************************************** + * + * Macro definitions + * + */ + +/* PARTNER-N64 */ +#ifdef PTN64 +#define osReadHost osReadHost_pt +#define osWriteHost osWriteHost_pt +#endif + +/* Get count of valid messages in queue */ +#define MQ_GET_COUNT(mq) ((mq)->validCount) + +/* Figure out if message queue is empty or full */ +#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0) +#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount) + +/* + * CPU counter increments at 3/4 of bus clock rate: + * + * Bus Clock Proc Clock Counter (1/2 Proc Clock) + * --------- ---------- ------------------------ + * 62.5 Mhz 93.75 Mhz 46.875 Mhz + */ +extern u64 osClockRate; + +#define OS_CLOCK_RATE 62500000LL +#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4) +#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625000LL))/(1000000000LL/15625000LL)) +#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL)) +#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL/15625000LL))/(OS_CPU_COUNTER/15625000LL)) +#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(OS_CPU_COUNTER/15625LL)) + +/************************************************************************** + * + * Extern variables + * + */ +extern OSViMode osViModeTable[]; /* Global VI mode table */ + +extern OSViMode osViModeNtscLpn1; /* Individual VI NTSC modes */ +extern OSViMode osViModeNtscLpf1; +extern OSViMode osViModeNtscLan1; +extern OSViMode osViModeNtscLaf1; +extern OSViMode osViModeNtscLpn2; +extern OSViMode osViModeNtscLpf2; +extern OSViMode osViModeNtscLan2; +extern OSViMode osViModeNtscLaf2; +extern OSViMode osViModeNtscHpn1; +extern OSViMode osViModeNtscHpf1; +extern OSViMode osViModeNtscHan1; +extern OSViMode osViModeNtscHaf1; +extern OSViMode osViModeNtscHpn2; +extern OSViMode osViModeNtscHpf2; + +extern OSViMode osViModePalLpn1; /* Individual VI PAL modes */ +extern OSViMode osViModePalLpf1; +extern OSViMode osViModePalLan1; +extern OSViMode osViModePalLaf1; +extern OSViMode osViModePalLpn2; +extern OSViMode osViModePalLpf2; +extern OSViMode osViModePalLan2; +extern OSViMode osViModePalLaf2; +extern OSViMode osViModePalHpn1; +extern OSViMode osViModePalHpf1; +extern OSViMode osViModePalHan1; +extern OSViMode osViModePalHaf1; +extern OSViMode osViModePalHpn2; +extern OSViMode osViModePalHpf2; + +extern OSViMode osViModeMpalLpn1; /* Individual VI MPAL modes */ +extern OSViMode osViModeMpalLpf1; +extern OSViMode osViModeMpalLan1; +extern OSViMode osViModeMpalLaf1; +extern OSViMode osViModeMpalLpn2; +extern OSViMode osViModeMpalLpf2; +extern OSViMode osViModeMpalLan2; +extern OSViMode osViModeMpalLaf2; +extern OSViMode osViModeMpalHpn1; +extern OSViMode osViModeMpalHpf1; +extern OSViMode osViModeMpalHan1; +extern OSViMode osViModeMpalHaf1; +extern OSViMode osViModeMpalHpn2; +extern OSViMode osViModeMpalHpf2; + +extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */ +extern u32 osRomBase; /* Rom base address of the game image */ +extern u32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */ +extern u32 osResetType; /* 0 = cold reset, 1 = NMI */ +extern s32 osCicId; +extern s32 osVersion; +extern u32 osMemSize; /* Memory Size */ +extern s32 osAppNMIBuffer[]; + +extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */ +extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */ +extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/ + + + +/************************************************************************** + * + * Function prototypes + * + */ + +/* Thread operations */ + +extern void osCreateThread(OSThread *, OSId, void (*)(void *), + void *, void *, OSPri); +extern void osDestroyThread(OSThread *); +extern void osYieldThread(void); +extern void osStartThread(OSThread *); +extern void osStopThread(OSThread *); +extern OSId osGetThreadId(OSThread *); +extern void osSetThreadPri(OSThread *, OSPri); +extern OSPri osGetThreadPri(OSThread *); + +/* Message operations */ + +extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32); +extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32); +extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32); +extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32); + +/* Event operations */ + +extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg); + +/* Interrupt operations */ + +extern OSIntMask osGetIntMask(void); +extern OSIntMask osSetIntMask(OSIntMask); + +/* RDB port operations */ + +extern void osInitRdb(u8 *sendBuf, u32 sendSize); + +/* Cache operations and macros */ + +extern void osInvalDCache(void *, size_t); +extern void osInvalICache(void *, size_t); +extern void osWritebackDCache(void *, size_t); +extern void osWritebackDCacheAll(void); + +#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10)) +#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10)) + +/* TLB management routines */ + +extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32); +extern void osMapTLBRdb(void); +extern void osUnmapTLB(s32); +extern void osUnmapTLBAll(void); +extern void osSetTLBASID(s32); + +/* Address translation routines and macros */ + +extern u32 osVirtualToPhysical(void *); +extern void * osPhysicalToVirtual(u32); + +#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000)) +#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000)) + +#define OS_PHYSICAL_TO_K0(x) (void *)(((u32)(x)+0x80000000)) +#define OS_PHYSICAL_TO_K1(x) (void *)(((u32)(x)+0xa0000000)) + +/* I/O operations */ + +/* Audio interface (Ai) */ +extern u32 osAiGetStatus(void); +extern u32 osAiGetLength(void); +extern s32 osAiSetFrequency(u32); +extern s32 osAiSetNextBuffer(void *, u32); + +/* Display processor interface (Dp) */ +extern u32 osDpGetStatus(void); +extern void osDpSetStatus(u32); +extern void osDpGetCounters(u32 *); +extern s32 osDpSetNextBuffer(void *, u64); + +/* Peripheral interface (Pi) */ +extern u32 osPiGetStatus(void); +extern s32 osPiGetDeviceType(void); +extern s32 osPiRawWriteIo(u32, u32); +extern s32 osPiRawReadIo(u32, u32 *); +extern s32 osPiRawStartDma(s32, u32, void *, u32); +extern s32 osPiWriteIo(u32, u32); +extern s32 osPiReadIo(u32, u32 *); +extern s32 osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32, + OSMesgQueue *); +extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32); + +/* Video interface (Vi) */ +extern u32 osViGetStatus(void); +extern u32 osViGetCurrentMode(void); +extern u32 osViGetCurrentLine(void); +extern u32 osViGetCurrentField(void); +extern void *osViGetCurrentFramebuffer(void); +extern void *osViGetNextFramebuffer(void); +extern void osViSetXScale(f32); +extern void osViSetYScale(f32); +extern void osViSetSpecialFeatures(u32); +extern void osViSetMode(OSViMode *); +extern void osViSetEvent(OSMesgQueue *, OSMesg, u32); +extern void osViSwapBuffer(void *); +extern void osViBlack(u8); +extern void osViFade(u8, u16); +extern void osViRepeatLine(u8); +extern void osCreateViManager(OSPri); + +/* Timer interface */ + +extern OSTime osGetTime(void); +extern void osSetTime(OSTime); +extern u32 osSetTimer(OSTimer *, OSTime, OSTime, + OSMesgQueue *, OSMesg); +extern int osStopTimer(OSTimer *); + +/* Controller interface */ + +extern s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *); +extern s32 osContReset(OSMesgQueue *, OSContStatus *); +extern s32 osContStartQuery(OSMesgQueue *); +extern s32 osContStartReadData(OSMesgQueue *); +#ifndef _HW_VERSION_1 +extern s32 osContSetCh(u8); +#endif +extern void osContGetQuery(OSContStatus *); +extern void osContGetReadData(OSContPad *); + +/* file system interface */ + +extern s32 osPfsInitPak(OSMesgQueue *, OSPfs *, int); +extern s32 osPfsRepairId(OSPfs *); +extern s32 osPfsInit(OSMesgQueue *, OSPfs *, int); +extern s32 osPfsReFormat(OSPfs *, OSMesgQueue *, int); +extern s32 osPfsChecker(OSPfs *); +extern s32 osPfsAllocateFile(OSPfs *, u16, u32, u8 *, u8 *, int, s32 *); +extern s32 osPfsFindFile(OSPfs *, u16, u32, u8 *, u8 *, s32 *); +extern s32 osPfsDeleteFile(OSPfs *, u16, u32, u8 *, u8 *); +extern s32 osPfsReadWriteFile(OSPfs *, s32, u8, int, int, u8 *); +extern s32 osPfsFileState(OSPfs *, s32, OSPfsState *); +extern s32 osPfsGetLabel(OSPfs *, u8 *, int *); +extern s32 osPfsSetLabel(OSPfs *, u8 *); +extern s32 osPfsIsPlug(OSMesgQueue *, u8 *); +extern s32 osPfsFreeBlocks(OSPfs *, s32 *); +extern s32 osPfsNumFiles(OSPfs *, s32 *, s32 *); + +/* EEPROM interface */ + +extern s32 osEepromProbe(OSMesgQueue *); +extern s32 osEepromRead(OSMesgQueue *, u8, u8 *); +extern s32 osEepromWrite(OSMesgQueue *, u8, u8 *); +extern s32 osEepromLongRead(OSMesgQueue *, u8, u8 *, int); +extern s32 osEepromLongWrite(OSMesgQueue *, u8, u8 *, int); + +/* MOTOR interface */ + +extern s32 osMotorInit(OSMesgQueue *, OSPfs *, int); +extern s32 osMotorStop(OSPfs *); +extern s32 osMotorStart(OSPfs *); + +/* Enhanced PI interface */ + +extern OSPiHandle *osCartRomInit(void); +extern OSPiHandle *osLeoDiskInit(void); +extern OSPiHandle *osDriveRomInit(void); + +extern s32 osEPiDeviceType(OSPiHandle *, OSPiInfo *); +extern s32 osEPiRawWriteIo(OSPiHandle *, u32 , u32); +extern s32 osEPiRawReadIo(OSPiHandle *, u32 , u32 *); +extern s32 osEPiRawStartDma(OSPiHandle *, s32 , u32 , void *, u32 ); +extern s32 osEPiWriteIo(OSPiHandle *, u32 , u32 ); +extern s32 osEPiReadIo(OSPiHandle *, u32 , u32 *); +extern s32 osEPiStartDma(OSPiHandle *, OSIoMesg *, s32); +extern s32 osEPiLinkHandle(OSPiHandle *); + +/* Profiler Interface */ + +extern void osProfileInit(OSProf *, u32 profcnt); +extern void osProfileStart(u32); +extern void osProfileFlush(void); +extern void osProfileStop(void); + +/* Game <> Host data transfer functions */ + +extern s32 osTestHost(void); +extern void osReadHost(void *, u32); +extern void osWriteHost(void *, u32); +extern void osAckRamromRead(void); +extern void osAckRamromWrite(void); + + +/* byte string operations */ + +extern void bcopy(const void *, void *, size_t); +extern int bcmp(const void *, const void *, int); +extern void bzero(void *, size_t); + +/* Miscellaneous operations */ + +extern void osInitialize(void); +extern u32 osGetCount(void); +extern void osExit(void); +extern u32 osGetMemSize(void); + +/* Printf */ + +extern int sprintf(char *s, const char *fmt, ...); +extern void osSyncPrintf(const char *fmt, ...); +extern void osAsyncPrintf(const char *fmt, ...); +extern int osSyncGetChars(char *buf); +extern int osAsyncGetChars(char *buf); + +#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ + +#ifdef _LANGUAGE_C_PLUS_PLUS +} +#endif + +#endif /* !_OS_H */ diff --git a/lib/src/osContInternal.h b/lib/src/osContInternal.h index 3131f0e3..0f628205 100644 --- a/lib/src/osContInternal.h +++ b/lib/src/osContInternal.h @@ -1,6 +1,8 @@ #ifndef _ULTRA64_CONTROLLER_INTERNAL_H_ #define _ULTRA64_CONTROLLER_INTERNAL_H_ + #include + typedef struct { u8 padOrEnd; diff --git a/lib/src/unk_shindou_file_3.c b/lib/src/unk_shindou_file_3.c new file mode 100644 index 00000000..318e4068 --- /dev/null +++ b/lib/src/unk_shindou_file_3.c @@ -0,0 +1,28 @@ +#include "libultra_internal.h" +#include "controller.h" + +#ifdef VERSION_SH +s32 func_8030A5C0(OSMesgQueue *arg0, s32 arg1) { // TODO: This is almost certainly __osPfsGetStatus. + s32 sp34 = 0; + OSMesg sp30; + u8 sp2f; + OSContStatus sp1c[4]; + __osPfsRequestData(0); + sp34 = __osSiRawStartDma(1, &__osPfsPifRam); + osRecvMesg(arg0, &sp30, 1); + sp34 = __osSiRawStartDma(0, &__osPfsPifRam); + osRecvMesg(arg0, &sp30, 1); + __osPfsGetInitData(&sp2f, sp1c); + if (sp1c[arg1].status & CONT_CARD_ON && sp1c[arg1].status & CONT_CARD_PULL) { + return 2; + } + if (sp1c[arg1].errnum || !(sp1c[arg1].status & CONT_CARD_ON)) { + return 1; + } + if (sp1c[arg1].status & CONT_ADDR_CRC_ER) { + return 4; + } + return sp34; + +} +#endif diff --git a/rename_sym.sh b/rename_sym.sh index fd7da9eb..326dcb2e 100755 --- a/rename_sym.sh +++ b/rename_sym.sh @@ -10,4 +10,4 @@ fi #echo "Replace $1 with $2?" #read -grep -rl "$1" text/**/*.{c,h} assets/**/*.c enhancements/*.patch lib/**/*.{c,h,s} asm/**/*.s bin/**/*.c data/*.c levels/**/*.c actors/**/*.c src/**/*.{c,h} include/**/*.{h,in} undefined_syms.txt | xargs sed -i "s/\b$1\b/$2/g" +grep -rl "$1" text/**/*.{c,h} assets/**/*.c enhancements/*.patch lib/**/*.{c,h,s} asm/**/*.s bin/**/*.c data/*.c levels/**/*.{c,h} actors/**/*.c src/**/*.{c,h} include/**/*.{h,in} undefined_syms.txt | xargs sed -i "s/\b$1\b/$2/g" diff --git a/sm64.ld b/sm64.ld index 382c8422..f9d769db 100755 --- a/sm64.ld +++ b/sm64.ld @@ -95,7 +95,7 @@ SECTIONS BUILD_DIR/src/game/game_init.o(.text); BUILD_DIR/src/game/sound_init.o(.text); #ifdef VERSION_SH - BUILD_DIR/src/game/thread6.o(.text); + BUILD_DIR/src/game/rumble_init.o(.text); #endif BUILD_DIR/src/game/level_update.o(.text); BUILD_DIR/src/game/interaction.o(.text); @@ -147,9 +147,15 @@ SECTIONS BUILD_DIR/src/audio/synthesis.o(.text); BUILD_DIR/src/audio/heap.o(.text); BUILD_DIR/src/audio/load.o(.text); +#ifdef VERSION_SH + BUILD_DIR/src/audio/unk_shindou_audio_file.o(.text); +#endif BUILD_DIR/src/audio/playback.o(.text); BUILD_DIR/src/audio/effects.o(.text); BUILD_DIR/src/audio/seqplayer.o(.text); +#ifdef VERSION_SH + BUILD_DIR/libultra.a:osDriveRomInit.o(.text); +#endif BUILD_DIR/src/audio/external.o(.text); BUILD_DIR/src/audio/port_eu.o(.text); @@ -188,6 +194,9 @@ SECTIONS BUILD_DIR/libultra.a:osContStartReadData.o(.text); BUILD_DIR/libultra.a:osContInit.o(.text); BUILD_DIR/libultra.a:osEepromProbe.o(.text); +#ifdef VERSION_SH + BUILD_DIR/libultra.a:motor.o(.text); +#endif BUILD_DIR/libultra.a:osInvalDCache.o(.text); BUILD_DIR/libultra.a:osPiStartDma.o(.text); BUILD_DIR/libultra.a:bzero.o(.text) @@ -204,9 +213,19 @@ SECTIONS BUILD_DIR/libultra.a:guRotateF.o(.text) BUILD_DIR/libultra.a:guScaleF.o(.text) BUILD_DIR/libultra.a:osAiSetFrequency.o(.text) +#ifdef VERSION_SH + BUILD_DIR/libultra.a:osCartRomInit.o(.text) + BUILD_DIR/libultra.a:epidma.o(.text) +#else BUILD_DIR/libultra.a:alBnkfNew.o(.text) +#endif BUILD_DIR/libultra.a:osAiGetLength.o(.text) BUILD_DIR/libultra.a:osAiSetNextBuffer.o(.text) +#ifdef VERSION_SH + BUILD_DIR/libultra.a:osGetCount.o(.text) + BUILD_DIR/libultra.a:__osDisableInt.o(.text) + BUILD_DIR/libultra.a:__osRestoreInt.o(.text) +#endif BUILD_DIR/libultra.a:_Litob.o(.text) BUILD_DIR/libultra.a:_Ldtob.o(.text) BUILD_DIR/libultra.a:__osSetSR.o(.text) @@ -222,9 +241,11 @@ SECTIONS BUILD_DIR/libultra.a:D_802F4380.o(.text) BUILD_DIR/libultra.a:func_802F4A20.o(.text) BUILD_DIR/libultra.a:osTimer.o(.text) +#ifdef VERSION_EU BUILD_DIR/libultra.a:__osDisableInt.o(.text) BUILD_DIR/libultra.a:__osRestoreInt.o(.text) BUILD_DIR/libultra.a:osGetCount.o(.text) +#endif BUILD_DIR/libultra.a:__osViInit.o(.text) BUILD_DIR/libultra.a:__osDequeueThread.o(.text) BUILD_DIR/libultra.a:osVirtualToPhysical.o(.text) @@ -236,6 +257,9 @@ SECTIONS BUILD_DIR/libultra.a:osGetThreadPri.o(.text) BUILD_DIR/libultra.a:__osViGetCurrentContext.o(.text); BUILD_DIR/libultra.a:__osViSwapContext.o(.text) +#ifdef VERSION_SH + BUILD_DIR/libultra.a:osLeoDiskInit.o(.text) +#endif BUILD_DIR/libultra.a:__osPiCreateAccessQueue.o(.text) BUILD_DIR/libultra.a:osPiRawStartDma.o(.text) BUILD_DIR/libultra.a:osEPiRawStartDma.o(.text) @@ -244,6 +268,12 @@ SECTIONS BUILD_DIR/libultra.a:__osSiRawStartDma.o(.text) BUILD_DIR/libultra.a:osSetTimer.o(.text) BUILD_DIR/libultra.a:osEepromWrite.o(.text) +#ifdef VERSION_SH + BUILD_DIR/libultra.a:osPfsIsPlug.o(.text) + BUILD_DIR/libultra.a:crc.o(.text) + BUILD_DIR/libultra.a:contramwrite.o(.text) + BUILD_DIR/libultra.a:contramread.o(.text) +#endif BUILD_DIR/libultra.a:osJamMesg.o(.text) BUILD_DIR/libultra.a:osPiGetCmdQueue.o(.text) BUILD_DIR/libultra.a:osEepromRead.o(.text) @@ -252,15 +282,27 @@ SECTIONS BUILD_DIR/libultra.a:__osAiDeviceBusy.o(.text); BUILD_DIR/libultra.a:ldiv.o(.text) BUILD_DIR/libultra.a:__osSiDeviceBusy.o(.text); +#ifdef VERSION_SH + BUILD_DIR/libultra.a:leointerrupt.o(.text) +#endif BUILD_DIR/libultra.a:osSetIntMask.o(.text) BUILD_DIR/libultra.a:osDestroyThread.o(.text) +#ifndef VERSION_SH BUILD_DIR/libultra.a:osLeoDiskInit.o(.text) +#endif BUILD_DIR/libultra.a:__osSetCompare.o(.text) - BUILD_DIR/libultra.a:__osProbeTLB.o(.text) BUILD_DIR/libultra.a:__osDequeueThread.o(.text) - BUILD_DIR/libultra.a:func_802F7140.o(.text) - BUILD_DIR/libultra.a:func_802F71A0.o(.text) + BUILD_DIR/libultra.a:__osProbeTLB.o(.text) + BUILD_DIR/libultra.a:__osResetGlobalIntMask.o(.text) + BUILD_DIR/libultra.a:__osEPiRawWriteIo.o(.text) +#ifdef VERSION_SH + BUILD_DIR/libultra.a:__osEPiRawReadIo.o(.text) + BUILD_DIR/libultra.a:__osSetGlobalIntMask.o(.text) +#endif BUILD_DIR/libultra.a:func_802F71F0.o(.text) +#ifdef VERSION_SH + BUILD_DIR/libultra.a:unk_shindou_file_3.o(.text) +#endif BUILD_DIR/lib/rsp.o(.text); #else BUILD_DIR/src/game*.o(.text); @@ -344,7 +386,7 @@ SECTIONS BUILD_DIR/libultra.a:__osSiRawWriteIo.o(.text); BUILD_DIR/libultra.a:osMapTLBRdb.o(.text); BUILD_DIR/libultra.a:osPiRawReadIo.o(.text); -#if VERSION_JP +#ifdef VERSION_JP . += 0x40; #endif BUILD_DIR/libultra.a:__osSiCreateAccessQueue.o(.text); @@ -379,6 +421,9 @@ SECTIONS BUILD_DIR/src/game/main.o(.data*); BUILD_DIR/src/game/game_init.o(.data*); BUILD_DIR/src/game/sound_init.o(.data*); +#ifdef VERSION_SH + BUILD_DIR/src/game/rumble_init.o(.data*); +#endif BUILD_DIR/src/game/level_update.o(.data*); BUILD_DIR/src/game/interaction.o(.data*); BUILD_DIR/src/game/mario.o(.data*); @@ -422,22 +467,34 @@ SECTIONS #endif BUILD_DIR/src/audio/synthesis.o(.data*); BUILD_DIR/src/audio/heap.o(.data*); +#ifndef VERSION_SH BUILD_DIR/src/audio/load.o(.data*); +#endif BUILD_DIR/src/audio/playback.o(.data*); BUILD_DIR/src/audio/effects.o(.data*); BUILD_DIR/src/audio/seqplayer.o(.data*); +#ifdef VERSION_SH + BUILD_DIR/src/audio/data.o(.data*); + BUILD_DIR/src/audio/shindou_debug_prints.o(.data*); + BUILD_DIR/src/audio/unk_shindou_audio_file.o(.data*); + BUILD_DIR/src/audio/external.o(.data*); + BUILD_DIR/src/audio/audio_session_presets_sh.o(.data*); +#else BUILD_DIR/src/audio/external.o(.data*); BUILD_DIR/src/audio/port_eu.o(.data*); BUILD_DIR/src/audio/data.o(.data*); - BUILD_DIR/src/audio*.o(.data*); +#endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) BUILD_DIR/libultra.a:_Printf.o(.data*); BUILD_DIR/libultra.a:osInitialize.o(.data*); BUILD_DIR/libultra.a:osCreateViManager.o(.data*); BUILD_DIR/libultra.a:osViTable.o(.data*); BUILD_DIR/libultra.a:osCreatePiManager.o(.data*); BUILD_DIR/libultra.a:osContInit.o(.data*); +#ifdef VERSION_SH + BUILD_DIR/libultra.a:motor.o(.data*); +#endif BUILD_DIR/libultra.a:osAiSetNextBuffer.o(.data*); BUILD_DIR/libultra.a:_Litob.o(.data*); BUILD_DIR/libultra.a:__osExceptionPreamble.o(.data*); @@ -499,6 +556,8 @@ SECTIONS BUILD_DIR/src/game/object_collision.o(.rodata*); BUILD_DIR/src/game/spawn_object.o(.rodata*); #endif + BUILD_DIR/libultra.a:__osDisableInt.o(.text) + BUILD_DIR/libultra.a:__osRestoreInt.o(.text) BUILD_DIR/src/game/spawn_sound.o(.rodata*); BUILD_DIR/src/game/debug.o(.rodata*); BUILD_DIR/src/game/screen_transition.o(.rodata*); @@ -515,12 +574,15 @@ SECTIONS BUILD_DIR/src/game/hud.o(.rodata*); BUILD_DIR/src/game/obj_behaviors.o(.rodata*); BUILD_DIR/src/game/obj_behaviors_2.o(.rodata*); -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) BUILD_DIR/src/game*.o(.rodata*); #endif BUILD_DIR/src/audio/synthesis.o(.rodata*); BUILD_DIR/src/audio/heap.o(.rodata*); BUILD_DIR/src/audio/load.o(.rodata*); +#ifdef VERSION_SH + BUILD_DIR/src/audio/unk_shindou_audio_file.o(.rodata*); +#endif BUILD_DIR/src/audio/playback.o(.rodata*); BUILD_DIR/src/audio/effects.o(.rodata*); BUILD_DIR/src/audio/seqplayer.o(.rodata*); @@ -528,7 +590,7 @@ SECTIONS BUILD_DIR/src/audio/port_eu.o(.rodata*); BUILD_DIR/src/audio*.o(.rodata*); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) BUILD_DIR/libultra.a:_Printf.o(.rodata*); #endif @@ -538,7 +600,7 @@ SECTIONS BUILD_DIR/libultra.a:sinf.o(.rodata*); BUILD_DIR/libultra.a:guRotateF.o(.rodata*); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) BUILD_DIR/libultra.a:_Litob.o(.rodata*); BUILD_DIR/libultra.a:_Ldtob.o(.rodata*); BUILD_DIR/libultra.a:__osExceptionPreamble.o(.rodata*); @@ -556,6 +618,9 @@ SECTIONS BUILD_DIR/libultra.a:guLookAtRef.o(.rodata*); /* Fast3DEX2 only */ #ifndef VERSION_EU BUILD_DIR/libultra.a:*.o(.rodata*); +#endif +#ifdef VERSION_SH + BUILD_DIR/src/audio/load.o(.data*); #endif BUILD_DIR/lib/rsp.o(.rodata*); } @@ -566,6 +631,9 @@ SECTIONS BUILD_DIR/src/game/main.o(.bss*); BUILD_DIR/src/game/game_init.o(.bss*); BUILD_DIR/src/game/sound_init.o(.bss*); +#ifdef VERSION_SH + BUILD_DIR/src/game/rumble_init.o(.bss*); +#endif BUILD_DIR/src/game/level_update.o(.bss*); BUILD_DIR/src/game/interaction.o(.bss*); BUILD_DIR/src/game/mario.o(.bss*); @@ -602,9 +670,18 @@ SECTIONS BUILD_DIR/src/game*.o(.bss*); #endif BUILD_DIR/src/audio/external.o(.bss*); - BUILD_DIR/src/audio/port_eu.o(.bss*); - #ifdef VERSION_EU + BUILD_DIR/src/audio/port_eu.o(.bss*); +#endif +#ifdef VERSION_SH + BUILD_DIR/src/audio/globals_start.o(.bss*); + BUILD_DIR/src/audio/synthesis.o(.bss*); + BUILD_DIR/src/audio/heap.o(.bss*); + BUILD_DIR/src/audio/load.o(.bss*); + BUILD_DIR/src/audio/data.o(.bss*); +#endif + +#if defined(VERSION_EU) || defined(VERSION_SH) BUILD_DIR/libultra.a:osInitialize.o(.bss*); BUILD_DIR/libultra.a:osSetEventMesg.o(.bss*); BUILD_DIR/libultra.a:osSpTaskLoadGo.o(.bss*); @@ -612,14 +689,33 @@ SECTIONS BUILD_DIR/libultra.a:osCreatePiManager.o(.bss*); BUILD_DIR/libultra.a:osContStartReadData.o(.bss*); BUILD_DIR/libultra.a:osContInit.o(.bss*); +#ifdef VERSION_SH + BUILD_DIR/libultra.a:motor.o(.bss*); +#endif BUILD_DIR/libultra.a:guRotateF.o(.bss*); - BUILD_DIR/libultra.a:unk_stack_data.o(.bss*); +#ifdef VERSION_SH + BUILD_DIR/libultra.a:osCartRomInit.o(.bss*); +#endif +#ifndef VERSION_SH + BUILD_DIR/libultra.a:leointerrupt.o(.bss*); +#endif BUILD_DIR/libultra.a:osTimer.o(.bss*); +#ifdef VERSION_SH + BUILD_DIR/libultra.a:osLeoDiskInit.o(.bss*) +#endif BUILD_DIR/libultra.a:__osPiCreateAccessQueue.o(.bss*); BUILD_DIR/libultra.a:__osSiCreateAccessQueue.o(.bss*); +#ifdef VERSION_SH + BUILD_DIR/libultra.a:osPfsIsPlug.o(.bss*); +#endif BUILD_DIR/libultra.a:osEepromWrite.o(.bss*); BUILD_DIR/libultra.a:kdebugserver.o(.bss*); +#ifdef VERSION_SH + BUILD_DIR/libultra.a:leointerrupt.o(.bss*); +#endif +#ifndef VERSION_SH BUILD_DIR/libultra.a:osLeoDiskInit.o(.bss*) +#endif BUILD_DIR/libultra.a:_Printf.o(.bss*); BUILD_DIR/libultra.a:osAiSetNextBuffer.o(.bss*); BUILD_DIR/libultra.a:EU_D_802f4330.o(.bss*); @@ -637,11 +733,10 @@ SECTIONS BUILD_DIR/libultra.a:__osPiCreateAccessQueue.o(.bss*); BUILD_DIR/libultra.a:__osSiCreateAccessQueue.o(.bss*); BUILD_DIR/libultra.a:osEepromWrite.o(.bss*); - BUILD_DIR/libultra.a:unk_stack_data.o(.bss*); + BUILD_DIR/libultra.a:kdebugserver_stack.o(.bss*); BUILD_DIR/libultra.a:kdebugserver.o(.bss*); - BUILD_DIR/libultra.a:*.o(.bss*); #endif - + BUILD_DIR/libultra.a:*.o(.bss*); . = ALIGN(0x8); } END_NOLOAD(main) @@ -861,23 +956,33 @@ SECTIONS { BUILD_DIR/src/buffers/buffers.o(.bss*); BUILD_DIR/src/audio/globals_start.o(.bss*); +#ifndef VERSION_SH BUILD_DIR/src/audio/synthesis.o(.bss*); BUILD_DIR/src/audio/heap.o(.bss*); +#endif BUILD_DIR/src/audio/load.o(.bss*); +#ifdef VERSION_SH + BUILD_DIR/src/audio/unk_shindou_audio_file.o(.bss*); +#else BUILD_DIR/src/audio/data.o(.bss*); +#endif BUILD_DIR/src/audio*.o(.bss*); #ifdef VERSION_EU . = ALIGN(0x200); #else . = ALIGN(0x1000); +#endif +#ifdef VERSION_SH + . = . + 0xB000; #endif BUILD_DIR/src/buffers/gfx_output_buffer.o(.bss*); } END_NOLOAD(buffers) +#ifndef VERSION_SH ASSERT((. <= SEG_MAIN), "Error: buffers segment extended into main") - +#endif /* 0x268020 0x268020-0 [0] */ BEGIN_SEG(intro, 0x14000000) { @@ -989,3 +1094,5 @@ SECTIONS *(*); } } +EXTERN(osPfsIsPlug) +EXTERN(__osLeoInterrupt) diff --git a/sound/sequences.json b/sound/sequences.json index ad0005b5..fad90d17 100644 --- a/sound/sequences.json +++ b/sound/sequences.json @@ -34,5 +34,5 @@ "1F_cutscene_victory": ["1A"], "20_cutscene_ending": ["23"], "21_menu_file_select": ["24"], - "22_cutscene_lakitu": {"ifdef": ["VERSION_US", "VERSION_EU"], "banks": ["1B"]} + "22_cutscene_lakitu": {"ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "banks": ["1B"]} } diff --git a/sound/sequences/00_sound_player.s b/sound/sequences/00_sound_player.s index 17934ef8..a8f08285 100644 --- a/sound/sequences/00_sound_player.s +++ b/sound/sequences/00_sound_player.s @@ -3,9 +3,20 @@ .align 0 sequence_start: +.ifdef VERSION_SH + .set VERSION_EU_SH, 1 +.endif +.ifdef VERSION_EU + .set VERSION_EU_SH, 1 +.endif + seq_setmutebhv 0x60 seq_setmutescale 0 -seq_setvol 127 +.ifdef VERSION_SH + seq_setvol 100 +.else + seq_setvol 127 +.endif seq_settempo 120 #seq_initchannels 0xfff seq_initchannels_extended 0xfff @@ -1368,7 +1379,7 @@ chan_end layer_portamento 0x81, 27, 255 layer_note1 41, 0xb, 127 layer_somethingon -layer_transpose 252 +layer_transpose -4 layer_portamento 0x85, 32, 255 layer_note1 44, 0x5, 100 layer_jump .layer_fn_64A @@ -1800,7 +1811,7 @@ chan_end .layer_A97: layer_setinstr 13 -layer_transpose 244 +layer_transpose -12 .layer_A9B: layer_somethingon @@ -2075,7 +2086,7 @@ chan_setlayer 0, .layer_C3C chan_end .layer_C3C: -.ifdef VERSION_EU +.ifdef VERSION_EU_SH layer_transpose 2 .endif layer_portamento 0x82, 41, 127 @@ -2089,7 +2100,7 @@ chan_setlayer 0, .layer_C4C chan_end .layer_C4C: -layer_transpose 254 +layer_transpose -2 .layer_C4E: layer_note1 38, 0x18, 127 layer_end @@ -2101,7 +2112,7 @@ chan_setlayer 0, .layer_C5A chan_end .layer_C5A: -layer_transpose 254 +layer_transpose -2 .layer_C5C: layer_portamento 0x82, 39, 200 layer_note1 38, 0x24, 120 @@ -2114,7 +2125,7 @@ chan_setlayer 0, .layer_C6C chan_end .layer_C6C: -.ifdef VERSION_EU +.ifdef VERSION_EU_SH layer_transpose 1 .endif layer_portamento 0x82, 44, 200 @@ -2128,7 +2139,7 @@ chan_setlayer 0, .layer_C7C chan_end .layer_C7C: -layer_transpose 254 +layer_transpose -2 layer_somethingon layer_portamento 0x85, 39, 255 layer_note1 42, 0x1e, 110 @@ -2142,7 +2153,7 @@ chan_setlayer 0, .layer_C92 chan_end .layer_C92: -layer_transpose 254 +layer_transpose -2 layer_portamento 0x81, 41, 255 layer_note1 38, 0x2b, 115 layer_end @@ -2154,7 +2165,7 @@ chan_setlayer 0, .layer_CA4 chan_end .layer_CA4: -layer_transpose 254 +layer_transpose -2 layer_note1 44, 0x1e, 110 layer_end @@ -2165,7 +2176,7 @@ chan_setlayer 0, .layer_CB2 chan_end .layer_CB2: -layer_transpose 253 +layer_transpose -3 layer_note1 39, 0x1c, 127 layer_end @@ -2176,7 +2187,7 @@ chan_setlayer 0, .layer_CC0 chan_end .layer_CC0: -layer_transpose 254 +layer_transpose -2 layer_note1 40, 0x30, 110 layer_end @@ -2187,7 +2198,7 @@ chan_setlayer 0, .layer_CCE chan_end .layer_CCE: -layer_transpose 254 +layer_transpose -2 layer_note1 40, 0x44, 105 layer_end @@ -2198,7 +2209,7 @@ chan_setlayer 0, .layer_CDC chan_end .layer_CDC: -layer_transpose 254 +layer_transpose -2 layer_note1 41, 0x30, 120 layer_end @@ -2209,7 +2220,7 @@ chan_setlayer 0, .layer_CEA chan_end .layer_CEA: -layer_transpose 254 +layer_transpose -2 layer_note1 38, 0x30, 127 layer_end @@ -2231,7 +2242,7 @@ chan_setlayer 0, .layer_D09 chan_end .layer_D09: -layer_transpose 254 +layer_transpose -2 layer_note1 39, 0x7f, 105 layer_end @@ -2242,7 +2253,7 @@ chan_setlayer 0, .layer_D17 chan_end .layer_D17: -layer_transpose 254 +layer_transpose -2 layer_note1 39, 0x60, 64 layer_end @@ -2253,7 +2264,7 @@ chan_setlayer 0, .layer_D25 chan_end .layer_D25: -layer_transpose 254 +layer_transpose -2 layer_note1 39, 0x5c, 52 layer_end @@ -2264,7 +2275,7 @@ chan_setlayer 0, .layer_D33 chan_end .layer_D33: -layer_transpose 254 +layer_transpose -2 layer_note1 39, 0xaa, 127 layer_end @@ -2275,7 +2286,7 @@ chan_setlayer 0, .layer_D42 chan_end .layer_D42: -layer_transpose 255 +layer_transpose -1 layer_note1 39, 0x4d, 120 layer_end @@ -2286,7 +2297,7 @@ chan_setlayer 0, .layer_D50 chan_end .layer_D50: -layer_transpose 254 +layer_transpose -2 layer_note1 43, 0x1e, 105 layer_end @@ -2297,7 +2308,7 @@ chan_setlayer 0, .layer_D5E chan_end .layer_D5E: -layer_transpose 254 +layer_transpose -2 layer_note1 39, 0xc8, 127 layer_end @@ -2308,7 +2319,7 @@ chan_setlayer 0, .layer_D6D chan_end .layer_D6D: -layer_transpose 254 +layer_transpose -2 layer_note1 39, 0x8c, 110 layer_end @@ -2319,7 +2330,7 @@ chan_setlayer 0, .layer_D7C chan_end .layer_D7C: -layer_transpose 254 +layer_transpose -2 layer_portamento 0x82, 35, 255 layer_note1 38, 0x30, 127 layer_end @@ -2331,7 +2342,7 @@ chan_setlayer 0, .layer_D8E chan_end .layer_D8E: -layer_transpose 254 +layer_transpose -2 layer_note1 39, 0x3c, 100 layer_end @@ -2342,7 +2353,7 @@ chan_setlayer 0, .layer_D9C chan_end .layer_D9C: -layer_transpose 254 +layer_transpose -2 layer_delay 0x4 layer_note1 38, 0x3c, 100 layer_end @@ -2354,7 +2365,7 @@ chan_setlayer 0, .layer_DAC chan_end .layer_DAC: -layer_transpose 254 +layer_transpose -2 layer_delay 0x8 layer_note1 40, 0x3c, 100 layer_end @@ -2366,7 +2377,7 @@ chan_setlayer 0, .layer_DBC chan_end .layer_DBC: -layer_transpose 254 +layer_transpose -2 layer_note1 39, 0x10, 115 layer_end @@ -2377,7 +2388,7 @@ chan_setlayer 0, .layer_DCA chan_end .layer_DCA: -layer_transpose 254 +layer_transpose -2 layer_portamento 0x81, 38, 255 layer_note1 41, 0x18, 115 layer_end @@ -2389,7 +2400,7 @@ chan_setlayer 0, .layer_DDC chan_end .layer_DDC: -layer_transpose 254 +layer_transpose -2 layer_somethingon layer_portamento 0x85, 38, 255 layer_note1 41, 0xc, 115 @@ -2408,7 +2419,7 @@ chan_setlayer 1, .layer_538 chan_end .layer_DFE: -layer_transpose 254 +layer_transpose -2 layer_jump .layer_C5C .sound_mario_punch_hoo: @@ -2423,7 +2434,7 @@ chan_setlayer 1, .layer_548 chan_end .layer_E17: -layer_transpose 254 +layer_transpose -2 layer_portamento 0x81, 42, 255 layer_note1 38, 0x30, 115 layer_end @@ -2474,7 +2485,7 @@ chan_setlayer 1, .layer_536 chan_end .layer_E62: -layer_transpose 255 +layer_transpose -1 layer_jump .layer_C4E .ifndef VERSION_JP @@ -2694,7 +2705,7 @@ layer_jump .layer_C4E layer_end .endif -.ifdef VERSION_EU +.ifdef VERSION_EU_SH .chan_unused_F9A_eu: chan_setbank 8 chan_setinstr 0 @@ -3032,7 +3043,7 @@ chan_setlayer 1, .layer_119D chan_end .layer_119D: -layer_transpose 244 +layer_transpose -12 .layer_fn_119F: layer_portamento 0x83, 27, 255 @@ -3403,11 +3414,17 @@ chan_setbank 9 chan_setinstr 3 chan_setval 40 chan_call .set_reverb +.ifdef VERSION_SH + chan_setreverb 40 +.endif chan_setlayer 0, .layer_141A chan_end .layer_141A: layer_transpose 24 +.ifdef VERSION_SH + layer_note1 51, 0xc, 90 +.endif layer_note1 39, 0x4, 90 layer_note1 51, 0xc, 90 layer_note1 39, 0x4, 50 @@ -3575,7 +3592,7 @@ chan_setlayer 0, .layer_1539 chan_end .layer_1537: -layer_transpose 253 +layer_transpose -3 .layer_1539: layer_note1 39, 0x6, 120 @@ -3764,7 +3781,7 @@ layer_end .layer_1665: layer_delay 0x4 -layer_transpose 244 +layer_transpose -12 .layer_1669: layer_note1 27, 0x4f, 93 @@ -3797,7 +3814,7 @@ layer_end .layer_16A6: layer_delay 0x4 -layer_transpose 244 +layer_transpose -12 .layer_16AA: layer_note1 46, 0xe, 116 @@ -3904,7 +3921,7 @@ chan_end .layer_1751: layer_call .layer_fn_1756 -layer_transpose 252 +layer_transpose -4 .layer_fn_1756: layer_note1 27, 0x5, 105 @@ -4045,7 +4062,7 @@ chan_setlayer 0, .layer_1844 chan_end .layer_1844: -layer_transpose 250 +layer_transpose -6 layer_portamento 0x81, 43, 127 layer_note1 31, 0xfa, 115 layer_end @@ -4150,7 +4167,7 @@ layer_end chan_setlayer 1, .layer_1902 chan_setlayer 2, .layer_1907 .else - .ifdef VERSION_EU + .ifdef VERSION_EU_SH chan_setbank 9 chan_setinstr 3 .else @@ -4291,7 +4308,7 @@ chan_setinstr 5 chan_end .layer_19FE: -layer_transpose 250 +layer_transpose -6 .layer_1A00: layer_note1 15, 0xc, 127 @@ -4346,7 +4363,7 @@ chan_end .layer_1A44: layer_transpose 7 layer_call .layer_fn_1A4B -layer_transpose 254 +layer_transpose -2 .layer_fn_1A4B: layer_portamento 0x83, 31, 255 @@ -4566,7 +4583,7 @@ chan_setlayer 1, .layer_1B8C chan_end .layer_1B8A: -layer_transpose 244 +layer_transpose -12 .layer_1B8C: layer_somethingon @@ -4785,7 +4802,7 @@ chan_setlayer 1, .layer_1D13 chan_end .layer_1D11: -layer_transpose 250 +layer_transpose -6 .layer_1D13: layer_somethingon @@ -4890,7 +4907,7 @@ chan_setlayer 2, .layer_1DE2 chan_end .layer_1DD4: -layer_transpose 244 +layer_transpose -12 layer_somethingon layer_portamento 0x82, 39, 255 .layer_1DDB: @@ -5309,7 +5326,7 @@ chan_end .layer_2087: layer_portamento 0x81, 33, 255 layer_note1 57, 0x4, 127 -layer_transpose 252 +layer_transpose -4 layer_portamento 0x81, 57, 255 layer_note1 33, 0x6, 127 layer_delay 0x14 @@ -5715,7 +5732,7 @@ chan_setlayer 0, .layer_22F3 chan_end .layer_unused_22F1: -layer_transpose 244 +layer_transpose -12 .layer_22F3: layer_somethingon @@ -5734,7 +5751,7 @@ chan_setlayer 0, .layer_230F chan_end .layer_230F: -layer_transpose 232 +layer_transpose -24 layer_somethingon layer_portamento 0x85, 25, 255 layer_note1 3, 0xf, 85 @@ -5751,7 +5768,7 @@ chan_setlayer 0, .layer_232C chan_end .layer_232C: -layer_transpose 253 +layer_transpose -3 layer_somethingon layer_portamento 0x85, 24, 255 layer_note1 17, 0xa, 100 @@ -5932,7 +5949,7 @@ chan_setlayer 0, .layer_2449 chan_end .layer_2449: -layer_transpose 248 +layer_transpose -8 layer_call .layer_fn_244E .layer_fn_244E: @@ -5987,13 +6004,13 @@ chan_setlayer 0, .layer_249F chan_end .layer_249F: -layer_transpose 251 +layer_transpose -5 layer_call .layer_fn_24AF layer_delay 0xb -layer_transpose 248 +layer_transpose -8 layer_call .layer_fn_24AF layer_delay 0xa -layer_transpose 246 +layer_transpose -10 .layer_fn_24AF: layer_portamento 0x85, 29, 255 @@ -6010,7 +6027,7 @@ chan_setlayer 0, .layer_24C7 chan_end .layer_24C7: -layer_transpose 244 +layer_transpose -12 layer_portamento 0x85, 25, 255 layer_note1 39, 0x4, 127 layer_note1 29, 0x30, 127 @@ -6553,9 +6570,9 @@ layer_setinstr 15 .layer_2856: layer_transpose 6 layer_call .layer_fn_119F -layer_transpose 247 +layer_transpose -9 layer_call .layer_fn_119F -layer_transpose 236 +layer_transpose -20 layer_jump .layer_fn_119F .sound_obj_chuckya_death: @@ -6628,7 +6645,7 @@ chan_setlayer 0, .layer_28EB chan_end .layer_28EB: -layer_transpose 254 +layer_transpose -2 layer_note0 31, 0xa, 127, 70 layer_note0 30, 0xb, 127, 70 layer_note0 29, 0xa, 127, 70 @@ -7462,11 +7479,11 @@ chan_setlayer 1, .layer_2E9E chan_end .layer_2E9E: -layer_transpose 244 +layer_transpose -12 layer_jump .layer_2EA5 .layer_2EA3: -layer_transpose 232 +layer_transpose -24 .layer_2EA5: layer_call .layer_fn_2EAB layer_call .layer_fn_2EAB @@ -7495,7 +7512,13 @@ layer_end chan_reservenotes 4 chan_setbank 9 chan_setinstr 2 -chan_setval 30 +.ifdef VERSION_SH + chan_setval 15 + .set EXIT_PIPE_NOTE_VELOCITY, 106 +.else + chan_setval 30 + .set EXIT_PIPE_NOTE_VELOCITY, 126 +.endif chan_call .set_reverb chan_setenvelope .envelope_3464 chan_setdecayrelease 220 @@ -7511,36 +7534,36 @@ layer_jump .layer_2EF6 layer_transpose 12 .layer_2EF6: layer_portamento 0x85, 15, 128 -layer_note1 15, 0x3, 126 -layer_note1 19, 0x3, 126 -layer_note1 22, 0x3, 126 -layer_note1 27, 0x3, 126 -layer_note1 22, 0x3, 126 -layer_note1 27, 0x3, 126 -layer_note1 31, 0x3, 126 -layer_note1 34, 0x3, 126 -layer_note1 39, 0x3, 126 -layer_note1 34, 0x3, 126 -layer_note1 23, 0x3, 126 -layer_note1 27, 0x3, 126 -layer_note1 30, 0x3, 126 -layer_note1 35, 0x3, 126 -layer_note1 30, 0x3, 126 -layer_note1 35, 0x3, 126 -layer_note1 39, 0x3, 126 -layer_note1 42, 0x3, 126 -layer_note1 47, 0x3, 126 -layer_note1 42, 0x3, 126 -layer_note1 25, 0x3, 126 -layer_note1 29, 0x3, 126 -layer_note1 32, 0x3, 126 -layer_note1 37, 0x3, 126 -layer_note1 32, 0x3, 126 -layer_note1 37, 0x3, 126 -layer_note1 41, 0x3, 126 -layer_note1 44, 0x3, 126 -layer_note1 49, 0x3, 126 -layer_note1 44, 0x3, 126 +layer_note1 15, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 19, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 22, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 27, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 22, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 27, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 31, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 34, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 39, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 34, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 23, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 27, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 30, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 35, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 30, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 35, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 39, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 42, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 47, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 42, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 25, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 29, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 32, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 37, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 32, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 37, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 41, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 44, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 49, 0x3, EXIT_PIPE_NOTE_VELOCITY +layer_note1 44, 0x3, EXIT_PIPE_NOTE_VELOCITY layer_end .sound_menu_bowser_laugh: @@ -7570,7 +7593,7 @@ chan_setlayer 0, .layer_2F7C chan_end .layer_2F7C: -layer_transpose 244 +layer_transpose -12 layer_portamento 0x83, 3, 255 layer_note1 15, 0xa, 127 layer_somethingon @@ -7604,10 +7627,10 @@ chan_setlayer 1, .layer_2FB9 chan_end .layer_2FB9: -layer_transpose 232 +layer_transpose -24 layer_setpan 24 layer_call .layer_fn_300D -layer_transpose 244 +layer_transpose -12 layer_setpan 44 layer_call .layer_fn_300D layer_transpose 0 @@ -7657,9 +7680,9 @@ layer_note1 48, 0x2, 20 layer_end .layer_3032: -layer_transpose 232 +layer_transpose -24 layer_call .layer_fn_3072 -layer_transpose 244 +layer_transpose -12 layer_call .layer_fn_3072 layer_transpose 0 layer_call .layer_fn_3072 @@ -7813,24 +7836,44 @@ chan_end .layer_3148: layer_call .transpose_by_coin_index - layer_note0 46, 0xc, 75, 20 - layer_note0 45, 0xc, 75, 20 - layer_note0 46, 0xc, 75, 20 - layer_note0 58, 0x10, 80, 80 - layer_note0 58, 0x10, 45, 80 - layer_note0 58, 0x10, 20, 80 - layer_note0 58, 0x10, 15, 80 + .ifdef VERSION_SH + layer_note0 46, 0xc, 65, 20 + layer_note0 45, 0xc, 65, 20 + layer_note0 46, 0xc, 65, 20 + layer_note0 58, 0x10, 70, 80 + layer_note0 58, 0x10, 35, 80 + layer_note0 58, 0x10, 10, 80 + layer_note0 58, 0x10, 5, 80 + .else + layer_note0 46, 0xc, 75, 20 + layer_note0 45, 0xc, 75, 20 + layer_note0 46, 0xc, 75, 20 + layer_note0 58, 0x10, 80, 80 + layer_note0 58, 0x10, 45, 80 + layer_note0 58, 0x10, 20, 80 + layer_note0 58, 0x10, 15, 80 + .endif layer_end .layer_3168: layer_call .transpose_by_coin_index - layer_note0 41, 0xc, 75, 20 - layer_note0 40, 0xc, 75, 20 - layer_note0 41, 0xc, 75, 20 - layer_note0 53, 0x10, 80, 80 - layer_note0 53, 0x10, 45, 80 - layer_note0 53, 0x10, 20, 80 - layer_note0 53, 0x10, 15, 80 + .ifdef VERSION_SH + layer_note0 41, 0xc, 65, 20 + layer_note0 40, 0xc, 65, 20 + layer_note0 41, 0xc, 65, 20 + layer_note0 53, 0x10, 70, 80 + layer_note0 53, 0x10, 35, 80 + layer_note0 53, 0x10, 10, 80 + layer_note0 53, 0x10, 5, 80 + .else + layer_note0 41, 0xc, 75, 20 + layer_note0 40, 0xc, 75, 20 + layer_note0 41, 0xc, 75, 20 + layer_note0 53, 0x10, 80, 80 + layer_note0 53, 0x10, 45, 80 + layer_note0 53, 0x10, 20, 80 + layer_note0 53, 0x10, 15, 80 + .endif layer_end .transpose_by_coin_index: @@ -8126,7 +8169,11 @@ envelope_goto 2 .envelope_341C: envelope_line 25 32760 envelope_line 60 10000 -envelope_goto 2 +.ifdef VERSION_SH + envelope_hang +.else + envelope_goto 2 +.endif .envelope_3428: envelope_line 1 10000 diff --git a/sound/sound_banks/07.json b/sound/sound_banks/07.json index 226e4e22..4b37d3c3 100644 --- a/sound/sound_banks/07.json +++ b/sound/sound_banks/07.json @@ -106,10 +106,10 @@ "sound": "0C" }, "inst13": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope5", - "sound": "0D" + "sound": "0D_chain_chomp_bark" } }, "instrument_list": [ diff --git a/sound/sound_banks/08_mario.json b/sound/sound_banks/08_mario.json index d7df1504..0bf286ee 100644 --- a/sound/sound_banks/08_mario.json +++ b/sound/sound_banks/08_mario.json @@ -13,148 +13,148 @@ "inst0": { "release_rate": 208, "envelope": "envelope0", - "sound": "00" + "sound": "00_mario_jump_hoo" }, "inst1": { "release_rate": 208, "envelope": "envelope0", - "sound": "01" + "sound": "01_mario_jump_wah" }, "inst2": { "release_rate": 208, "envelope": "envelope0", - "sound": "02" + "sound": "02_mario_yah" }, "inst3": { "release_rate": 208, "envelope": "envelope0", - "sound": "03" + "sound": "03_mario_haha" }, "inst4": { "release_rate": 208, "envelope": "envelope0", - "sound": "04" + "sound": "04_mario_yahoo" }, "inst5": { "release_rate": 208, "envelope": "envelope0", - "sound": "05" + "sound": "05_mario_uh" }, "inst6": { "release_rate": 208, "envelope": "envelope0", - "sound": "06" + "sound": "06_mario_hrmm" }, "inst7": { "release_rate": 208, "envelope": "envelope0", - "sound": "07" + "sound": "07_mario_wah2" }, "inst8": { "release_rate": 208, "envelope": "envelope0", - "sound": "08" + "sound": "08_mario_whoa" }, "inst9": { "release_rate": 208, "envelope": "envelope0", - "sound": "09" + "sound": "09_mario_eeuh" }, "inst10": { "release_rate": 208, "envelope": "envelope0", - "sound": "0A" + "sound": "0A_mario_attacked" }, "inst11": { "release_rate": 208, "envelope": "envelope0", - "sound": "0B" + "sound": "0B_mario_ooof" }, "inst12": { "release_rate": 208, "envelope": "envelope0", - "sound": "0C" + "sound": "0C_mario_here_we_go" }, "inst13": { "release_rate": 208, "envelope": "envelope0", - "sound": "0D" + "sound": "0D_mario_yawning" }, "inst14": { "release_rate": 208, "envelope": "envelope0", - "sound": "0E" + "sound": "0E_mario_snoring1" }, "inst15": { "release_rate": 208, "envelope": "envelope0", - "sound": "0F" + "sound": "0F_mario_snoring2" }, "inst16": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "10" + "sound": "10_mario_doh" }, "inst17": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "11" + "sound": "11_mario_game_over" }, "inst18": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "12" + "sound": "12_mario_hello" }, "inst19": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "13" + "sound": "13_mario_press_start_to_play" }, "inst20": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "14" + "sound": "14_mario_twirl_bounce" }, "inst21": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "15" + "sound": "15_mario_snoring3" }, "inst22": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "16" + "sound": {"ifdef": ["VERSION_SH"], "then": "16_mario_bye_bye", "else": "16_mario_so_longa_bowser"} }, "inst23": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "17" + "sound": "17_mario_ima_tired" }, "inst24": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "18" + "sound": "18_mario_waha" }, "inst25": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "19" + "sound": "19_mario_yippee" }, "inst26": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "1A" + "sound": "1A_mario_lets_a_go" } }, "instrument_list": [ diff --git a/sound/sound_banks/09.json b/sound/sound_banks/09.json index f1dccf5f..0057a08e 100644 --- a/sound/sound_banks/09.json +++ b/sound/sound_banks/09.json @@ -50,12 +50,12 @@ "inst4": { "release_rate": 208, "envelope": "envelope0", - "sound": "04" + "sound": "04_camera_buzz" }, "inst5": { "release_rate": 208, "envelope": "envelope0", - "sound": "05" + "sound": "05_camera_shutter" }, "inst6": { "release_rate": 208, diff --git a/sound/sound_banks/0A_mario_peach.json b/sound/sound_banks/0A_mario_peach.json index 5c5b9a23..79286d5d 100644 --- a/sound/sound_banks/0A_mario_peach.json +++ b/sound/sound_banks/0A_mario_peach.json @@ -13,126 +13,126 @@ "inst0": { "release_rate": 208, "envelope": "envelope0", - "sound": "00" + "sound": "00_mario_waaaooow" }, "inst1": { "release_rate": 208, "envelope": "envelope0", - "sound": "01" + "sound": "01_mario_hoohoo" }, "inst2": { "release_rate": 208, "envelope": "envelope0", - "sound": "02" + "sound": "02_mario_panting" }, "inst3": { "release_rate": 208, "envelope": "envelope0", - "sound": "03" + "sound": "03_mario_dying" }, "inst4": { "release_rate": 208, "envelope": "envelope0", - "sound": "04" + "sound": "04_mario_on_fire" }, "inst5": { "release_rate": 208, "envelope": "envelope0", - "sound": "05" + "sound": "05_mario_uh2" }, "inst6": { "release_rate": 208, "envelope": "envelope0", - "sound": "06" + "sound": "06_mario_coughing" }, "inst7": { "release_rate": 208, "envelope": "envelope0", - "sound": "07" + "sound": "07_mario_its_a_me_mario" }, "inst8": { "release_rate": 208, "envelope": "envelope0", - "sound": "08" + "sound": "08_mario_punch_yah" }, "inst9": { "release_rate": 208, "envelope": "envelope0", - "sound": "09" + "sound": "09_mario_punch_hoo" }, "inst10": { "release_rate": 208, "envelope": "envelope0", - "sound": "0A" + "sound": "0A_mario_mama_mia" }, "inst11": { "release_rate": 208, "envelope": "envelope0", - "sound": "0B" + "sound": "0B_mario_okey_dokey" }, "inst12": { "release_rate": 208, "envelope": "envelope0", - "sound": "0C" + "sound": "0C_mario_drowning" }, "inst13": { "release_rate": 208, "envelope": "envelope0", - "sound": "0D" + "sound": "0D_mario_thank_you_playing_my_game" }, "inst14": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "0E" + "sound": "0E_peach_dear_mario" }, "inst15": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "0F" + "sound": "0F_peach_mario" }, "inst16": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "10" + "sound": "10_peach_power_of_the_stars" }, "inst17": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "11" + "sound": "11_peach_thanks_to_you" }, "inst18": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "12" + "sound": "12_peach_thank_you_mario" }, "inst19": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "13" + "sound": "13_peach_something_special" }, "inst20": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "14" + "sound": "14_peach_bake_a_cake" }, "inst21": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "15" + "sound": "15_peach_for_mario" }, "inst22": { - "ifdef": ["VERSION_US", "VERSION_EU"], + "ifdef": ["VERSION_US", "VERSION_EU", "VERSION_SH"], "release_rate": 208, "envelope": "envelope0", - "sound": "16" + "sound": "16_peach_mario2" } }, "instrument_list": [ diff --git a/sound/sound_banks/0B.json b/sound/sound_banks/0B.json index a142fcc8..1ec7d90a 100644 --- a/sound/sound_banks/0B.json +++ b/sound/sound_banks/0B.json @@ -51,41 +51,41 @@ "normal_range_lo": 29, "normal_range_hi": 63, "envelope": "envelope0", - "sound_lo": "3B", - "sound": "3C", + "sound_lo": "3B_banjo_2", + "sound": "3C_acoustic_guitar", "sound_hi": "3D" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "2E" + "sound": "2E_accordion" }, "inst2": { "release_rate": 208, "envelope": "envelope2", - "sound": "2E" + "sound": "2E_accordion" }, "inst3": { "release_rate": 208, "envelope": "envelope3", - "sound": "16" + "sound": "16_french_horns" }, "inst4": { "release_rate": 208, "envelope": "envelope4", - "sound": "16" + "sound": "16_french_horns" }, "inst5": { "release_rate": 10, "normal_range_lo": 24, "envelope": "envelope5", - "sound_lo": "0E", - "sound": "0F" + "sound_lo": "0E_hihat_closed", + "sound": "0F_hihat_open" }, "inst6": { "release_rate": 208, "envelope": "envelope6", - "sound": "2F" + "sound": "2F_sleigh_bells" } }, "instrument_list": [ diff --git a/sound/sound_banks/0C.json b/sound/sound_banks/0C.json index 54a18f54..2b35bbe1 100644 --- a/sound/sound_banks/0C.json +++ b/sound/sound_banks/0C.json @@ -93,8 +93,8 @@ "normal_range_lo": 29, "normal_range_hi": 63, "envelope": "envelope0", - "sound_lo": "3B", - "sound": "3C", + "sound_lo": "3B_banjo_2", + "sound": "3C_acoustic_guitar", "sound_hi": "3D" }, "inst1": { @@ -102,8 +102,8 @@ "normal_range_lo": 29, "normal_range_hi": 61, "envelope": "envelope1", - "sound_lo": "3B", - "sound": "3C", + "sound_lo": "3B_banjo_2", + "sound": "3C_acoustic_guitar", "sound_hi": "3D" }, "inst2": { @@ -111,8 +111,8 @@ "normal_range_lo": 29, "normal_range_hi": 61, "envelope": "envelope2", - "sound_lo": "3B", - "sound": "3C", + "sound_lo": "3B_banjo_2", + "sound": "3C_acoustic_guitar", "sound_hi": "3D" }, "inst3": { @@ -120,8 +120,8 @@ "normal_range_lo": 29, "normal_range_hi": 61, "envelope": "envelope3", - "sound_lo": "3B", - "sound": "3C", + "sound_lo": "3B_banjo_2", + "sound": "3C_acoustic_guitar", "sound_hi": "3D" }, "inst4": { @@ -129,8 +129,8 @@ "normal_range_lo": 29, "normal_range_hi": 61, "envelope": "envelope4", - "sound_lo": "3B", - "sound": "3C", + "sound_lo": "3B_banjo_2", + "sound": "3C_acoustic_guitar", "sound_hi": "3D" }, "inst5": { @@ -138,43 +138,43 @@ "normal_range_lo": 29, "normal_range_hi": 61, "envelope": "envelope5", - "sound_lo": "3B", - "sound": "3C", + "sound_lo": "3B_banjo_2", + "sound": "3C_acoustic_guitar", "sound_hi": "3D" }, "inst6": { "release_rate": 208, "envelope": "envelope6", - "sound": "21" + "sound": "21_sine_bass" }, "inst7": { "release_rate": 114, "envelope": "envelope7", - "sound": "34" + "sound": "34_alto_flute" }, "inst8": { "release_rate": 208, "envelope": "envelope8", - "sound": "34" + "sound": "34_alto_flute" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope9", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope9", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope9", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope9", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope9", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -191,14 +191,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope9", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope9", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope9", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -209,49 +209,49 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope9", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope9", "sound": "0D_clave"} ], "inst9": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope10", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" }, "inst10": { "release_rate": 10, "normal_range_lo": 18, "envelope": "envelope11", - "sound_lo": "12", - "sound": "13" + "sound_lo": "12_snare_drum_1", + "sound": "13_snare_drum_2" }, "inst11": { "release_rate": 208, "normal_range_lo": 60, "normal_range_hi": 60, "envelope": "envelope12", - "sound_lo": "1E", - "sound": "1F", - "sound_hi": "20" + "sound_lo": "1E_closed_triangle", + "sound": "1F_open_triangle", + "sound_hi": "20_cabasa" }, "inst12": { "release_rate": 10, "envelope": "envelope13", - "sound": "42" + "sound": "42_vibraphone" } }, "instrument_list": [ diff --git a/sound/sound_banks/0D.json b/sound/sound_banks/0D.json index 800e7a15..6d02f429 100644 --- a/sound/sound_banks/0D.json +++ b/sound/sound_banks/0D.json @@ -75,14 +75,14 @@ "normal_range_lo": 41, "envelope": "envelope0", "sound_lo": "00", - "sound": "01" + "sound": "01_banjo_1" }, "inst1": { "release_rate": 100, "normal_range_lo": 41, "envelope": "envelope1", "sound_lo": "00", - "sound": "01" + "sound": "01_banjo_1" }, "inst2": { "release_rate": 180, @@ -97,36 +97,36 @@ "inst4": { "release_rate": 76, "envelope": "envelope4", - "sound": "03" + "sound": "03_human_whistle" }, "inst5": { "release_rate": 53, "envelope": "envelope5", - "sound": "04" + "sound": "04_bright_piano" }, "inst6": { "release_rate": 208, "envelope": "envelope6", - "sound": "05" + "sound": "05_acoustic_bass" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope7", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope7", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope7", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope7", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope7", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -143,14 +143,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope7", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope7", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope7", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -161,42 +161,42 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope7", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope7", "sound": "0D_clave"} ], "inst7": { "release_rate": 10, "normal_range_lo": 24, "envelope": "envelope8", - "sound_lo": "0E", - "sound": "0F" + "sound_lo": "0E_hihat_closed", + "sound": "0F_hihat_open" }, "inst8": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope9", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" }, "inst9": { "release_rate": 10, "normal_range_lo": 18, "envelope": "envelope10", - "sound_lo": "12", - "sound": "13" + "sound_lo": "12_snare_drum_1", + "sound": "13_snare_drum_2" } }, "instrument_list": [ diff --git a/sound/sound_banks/0E.json b/sound/sound_banks/0E.json index 6eabfbea..c4404e47 100644 --- a/sound/sound_banks/0E.json +++ b/sound/sound_banks/0E.json @@ -51,49 +51,49 @@ "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope0", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst1": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope1", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst2": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope2", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst3": { "release_rate": 43, "normal_range_hi": 47, "envelope": "envelope3", - "sound": "46", - "sound_hi": "47" + "sound": "46_pizzicato_strings_1", + "sound_hi": "47_pizzicato_strings_2" }, "inst4": { "release_rate": 119, "envelope": "envelope4", - "sound": "2D" + "sound": "2D_trombone" }, "inst5": { "release_rate": 10, "envelope": "envelope5", - "sound": "26" + "sound": "26_crystal_rhodes" }, "inst6": { "release_rate": 10, "envelope": "envelope6", - "sound": "26" + "sound": "26_crystal_rhodes" } }, "instrument_list": [ diff --git a/sound/sound_banks/0F.json b/sound/sound_banks/0F.json index d916c70a..4924e196 100644 --- a/sound/sound_banks/0F.json +++ b/sound/sound_banks/0F.json @@ -40,17 +40,17 @@ "inst1": { "release_rate": 10, "envelope": "envelope1", - "sound": "22" + "sound": "22_boys_choir" }, "inst2": { "release_rate": 90, "envelope": "envelope2", - "sound": "28" + "sound": "28_sitar_1" }, "inst3": { "release_rate": 10, "envelope": "envelope3", - "sound": "39" + "sound": "39_sitar_2" } }, "instrument_list": [ diff --git a/sound/sound_banks/10.json b/sound/sound_banks/10.json index 9eee4af6..1edec836 100644 --- a/sound/sound_banks/10.json +++ b/sound/sound_banks/10.json @@ -49,12 +49,12 @@ "inst0": { "release_rate": 10, "envelope": "envelope0", - "sound": "3E" + "sound": "3E_monk_choir" }, "inst1": { "release_rate": 10, "envelope": "envelope1", - "sound": "3E" + "sound": "3E_monk_choir" }, "inst2": { "release_rate": 208, @@ -64,36 +64,36 @@ "inst3": { "release_rate": 10, "envelope": "envelope3", - "sound": "40" + "sound": "40_bell" }, "inst4": { "release_rate": 10, "envelope": "envelope4", - "sound": "40" + "sound": "40_bell" }, "inst5": { "release_rate": 10, "envelope": "envelope5", - "sound": "40" + "sound": "40_bell" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope6", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope6", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope6", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope6", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope6", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope6", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -110,14 +110,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope6", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope6", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope6", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope6", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope6", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope6", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope6", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -128,19 +128,19 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope6", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope6", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope6", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope6", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope6", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope6", "sound": "0D_clave"} ] }, "instrument_list": [ diff --git a/sound/sound_banks/11.json b/sound/sound_banks/11.json index fcda2bbb..69dc21c1 100644 --- a/sound/sound_banks/11.json +++ b/sound/sound_banks/11.json @@ -87,39 +87,39 @@ "normal_range_lo": 19, "normal_range_hi": 19, "envelope": "envelope0", - "sound_lo": "38", + "sound_lo": "38_electric_kick_drum", "sound": {"sample": "08", "tuning": 2.121321}, - "sound_hi": "38" + "sound_hi": "38_electric_kick_drum" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "21" + "sound": "21_sine_bass" }, "inst2": { "release_rate": 208, "envelope": "envelope2", - "sound": "35" + "sound": "35_gospel_organ" }, "inst3": { "release_rate": 10, "envelope": "envelope3", - "sound": "48" + "sound": "48_steel_drum" }, "inst4": { "release_rate": 208, "envelope": "envelope4", - "sound": "19" + "sound": "19_brass" }, "inst5": { "release_rate": 208, "envelope": "envelope5", - "sound": "1A" + "sound": "1A_slap_bass" }, "inst6": { "release_rate": 128, "envelope": "envelope6", - "sound": "1B" + "sound": "1B_organ_2" }, "inst7": { "release_rate": 208, @@ -127,23 +127,23 @@ "sound": "1C" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope8", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope8", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope8", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope8", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope8", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -160,14 +160,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope8", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope8", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope8", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -178,51 +178,51 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope8", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope8", "sound": "0D_clave"} ], "inst8": { "release_rate": 10, "normal_range_lo": 24, "envelope": "envelope9", - "sound_lo": "0E", - "sound": "0F" + "sound_lo": "0E_hihat_closed", + "sound": "0F_hihat_open" }, "inst9": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope10", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" }, "inst10": { "release_rate": 10, "normal_range_lo": 18, "envelope": "envelope11", - "sound_lo": "12", - "sound": "13" + "sound_lo": "12_snare_drum_1", + "sound": "13_snare_drum_2" }, "inst11": { "release_rate": 208, "normal_range_lo": 60, "normal_range_hi": 60, "envelope": "envelope12", - "sound_lo": "1E", - "sound": "1F", - "sound_hi": "20" + "sound_lo": "1E_closed_triangle", + "sound": "1F_open_triangle", + "sound_hi": "20_cabasa" } }, "instrument_list": [ diff --git a/sound/sound_banks/12.json b/sound/sound_banks/12.json index eb4ad110..93f34b34 100644 --- a/sound/sound_banks/12.json +++ b/sound/sound_banks/12.json @@ -61,61 +61,61 @@ "inst0": { "release_rate": 10, "envelope": "envelope0", - "sound": "30" + "sound": "30_rarefaction-lahna" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "31" + "sound": "31_rarefaction-convolution" }, "inst2": { "release_rate": 208, "envelope": "envelope2", - "sound": "31" + "sound": "31_rarefaction-convolution" }, "inst3": { "release_rate": 10, "normal_range_lo": 14, "normal_range_hi": 15, "envelope": "envelope3", - "sound_lo": {"sample": "32", "tuning": 2.244924}, - "sound": "33", - "sound_hi": {"sample": "32", "tuning": 2.828428} + "sound_lo": {"sample": "32_metal_rimshot", "tuning": 2.244924}, + "sound": "33_kick_drum_2", + "sound_hi": {"sample": "32_metal_rimshot", "tuning": 2.828428} }, "inst4": { "release_rate": 10, "normal_range_lo": 24, "envelope": "envelope4", - "sound_lo": "0E", - "sound": "0F" + "sound_lo": "0E_hihat_closed", + "sound": "0F_hihat_open" }, "inst5": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope5", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" }, "inst6": { "release_rate": 208, "envelope": "envelope6", - "sound": "29" + "sound": "29_orchestra_hit" }, "inst7": { "release_rate": 114, "envelope": "envelope7", - "sound": "34" + "sound": "34_alto_flute" }, "inst8": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope8", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" } }, "instrument_list": [ diff --git a/sound/sound_banks/13.json b/sound/sound_banks/13.json index 150054ec..53da9e97 100644 --- a/sound/sound_banks/13.json +++ b/sound/sound_banks/13.json @@ -57,42 +57,42 @@ "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope0", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst1": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope1", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst2": { "release_rate": 208, "envelope": "envelope2", - "sound": "21" + "sound": "21_sine_bass" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope3", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope3", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope3", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope3", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope3", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope3", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -109,14 +109,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope3", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope3", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope3", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope3", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope3", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope3", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope3", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -127,45 +127,45 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope3", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope3", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope3", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope3", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope3", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope3", "sound": "0D_clave"} ], "inst3": { "release_rate": 10, "normal_range_lo": 24, "envelope": "envelope4", - "sound_lo": "0E", - "sound": "0F" + "sound_lo": "0E_hihat_closed", + "sound": "0F_hihat_open" }, "inst4": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope5", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" }, "inst5": { "release_rate": 10, "envelope": "envelope6", - "sound": "26" + "sound": "26_crystal_rhodes" }, "inst6": { "release_rate": 10, "envelope": "envelope7", - "sound": "26" + "sound": "26_crystal_rhodes" } }, "instrument_list": [ diff --git a/sound/sound_banks/14_piranha_music_box.json b/sound/sound_banks/14_piranha_music_box.json index a63ec956..2a920394 100644 --- a/sound/sound_banks/14_piranha_music_box.json +++ b/sound/sound_banks/14_piranha_music_box.json @@ -1,6 +1,6 @@ { "date": "1996-03-19", - "sample_bank": "piranha_music_box", + "sample_bank": {"ifdef": ["VERSION_SH"], "then": "instruments", "else": "piranha_music_box"}, "envelopes": { "envelope0": [ [6, 32700], @@ -37,27 +37,27 @@ "inst0": { "release_rate": 119, "envelope": "envelope0", - "sound": "00_pling" + "sound": {"ifdef": ["VERSION_SH"], "then": "3A_music_box", "else": "00_music_box"} }, "inst1": { "release_rate": 119, "envelope": "envelope1", - "sound": "00_pling" + "sound": {"ifdef": ["VERSION_SH"], "then": "3A_music_box", "else": "00_music_box"} }, "inst2": { "release_rate": 119, "envelope": "envelope2", - "sound": "00_pling" + "sound": {"ifdef": ["VERSION_SH"], "then": "3A_music_box", "else": "00_music_box"} }, "inst3": { "release_rate": 119, "envelope": "envelope3", - "sound": "00_pling" + "sound": {"ifdef": ["VERSION_SH"], "then": "3A_music_box", "else": "00_music_box"} }, "inst4": { "release_rate": 119, "envelope": "envelope4", - "sound": "00_pling" + "sound": {"ifdef": ["VERSION_SH"], "then": "3A_music_box", "else": "00_music_box"} } }, "instrument_list": [ diff --git a/sound/sound_banks/15.json b/sound/sound_banks/15.json index cc2cd97b..c89e2e94 100644 --- a/sound/sound_banks/15.json +++ b/sound/sound_banks/15.json @@ -74,29 +74,29 @@ "normal_range_lo": 60, "normal_range_hi": 60, "envelope": "envelope1", - "sound_lo": "1E", - "sound": "1F", - "sound_hi": "20" + "sound_lo": "1E_closed_triangle", + "sound": "1F_open_triangle", + "sound_hi": "20_cabasa" }, "inst2": { "release_rate": 10, "envelope": "envelope2", - "sound": "21" + "sound": "21_sine_bass" }, "inst3": { "release_rate": 208, "envelope": "envelope3", - "sound": "1A" + "sound": "1A_slap_bass" }, "inst4": { "release_rate": 114, "envelope": "envelope4", - "sound": "21" + "sound": "21_sine_bass" }, "inst5": { "release_rate": 53, "envelope": "envelope5", - "sound": "04" + "sound": "04_bright_piano" }, "inst6": { "release_rate": 208, @@ -106,31 +106,31 @@ "inst7": { "release_rate": 10, "envelope": "envelope7", - "sound": "22" + "sound": "22_boys_choir" }, "inst8": { "release_rate": 10, "envelope": "envelope8", - "sound": "22" + "sound": "22_boys_choir" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope9", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope9", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope9", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope9", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope9", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope9", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -147,14 +147,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope9", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope9", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope9", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope9", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -165,19 +165,19 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope9", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope9", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope9", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope9", "sound": "0D_clave"} ] }, "instrument_list": [ diff --git a/sound/sound_banks/16_course_start.json b/sound/sound_banks/16_course_start.json index ea87c063..cd348d2f 100644 --- a/sound/sound_banks/16_course_start.json +++ b/sound/sound_banks/16_course_start.json @@ -1,6 +1,6 @@ { "date": "1996-03-19", - "sample_bank": "course_start", + "sample_bank": {"ifdef": ["VERSION_SH"], "then": "instruments", "else": "course_start"}, "envelopes": { "envelope0": [ [2, 32700], @@ -19,12 +19,12 @@ "inst0": { "release_rate": 208, "envelope": "envelope0", - "sound": "00_la" + "sound": {"ifdef": ["VERSION_SH"], "then": "45b_la", "else": "00_la"} }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "00_la" + "sound": {"ifdef": ["VERSION_SH"], "then": "45b_la", "else": "00_la"} } }, "instrument_list": [ diff --git a/sound/sound_banks/17.json b/sound/sound_banks/17.json index 8d951bb3..d0fab404 100644 --- a/sound/sound_banks/17.json +++ b/sound/sound_banks/17.json @@ -63,56 +63,56 @@ "normal_range_lo": 29, "normal_range_hi": 63, "envelope": "envelope0", - "sound_lo": "3B", - "sound": "3C", + "sound_lo": "3B_banjo_2", + "sound": "3C_acoustic_guitar", "sound_hi": "3D" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "05" + "sound": "05_acoustic_bass" }, "inst2": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope2", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst3": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope3", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst4": { "release_rate": 10, "envelope": "envelope4", - "sound": "26" + "sound": "26_crystal_rhodes" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope5", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope5", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope5", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope5", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope5", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope5", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -129,14 +129,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope5", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope5", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope5", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope5", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope5", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope5", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope5", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -147,44 +147,44 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope5", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope5", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope5", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope5", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope5", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope5", "sound": "0D_clave"} ], "inst5": { "release_rate": 10, "normal_range_lo": 24, "envelope": "envelope6", - "sound_lo": "0E", - "sound": "0F" + "sound_lo": "0E_hihat_closed", + "sound": "0F_hihat_open" }, "inst6": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope7", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" }, "inst7": { "release_rate": 208, "normal_range_lo": 60, "normal_range_hi": 60, "envelope": "envelope8", - "sound_lo": "1E", - "sound": "1F", - "sound_hi": "20" + "sound_lo": "1E_closed_triangle", + "sound": "1F_open_triangle", + "sound_hi": "20_cabasa" } }, "instrument_list": [ diff --git a/sound/sound_banks/18.json b/sound/sound_banks/18.json index ddbb5b47..6f09dbb4 100644 --- a/sound/sound_banks/18.json +++ b/sound/sound_banks/18.json @@ -61,41 +61,41 @@ "inst0": { "release_rate": 208, "envelope": "envelope0", - "sound": "35" + "sound": "35_gospel_organ" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "36" + "sound": "36_sawtooth_synth" }, "inst2": { "release_rate": 208, "envelope": "envelope2", - "sound": "37" + "sound": "37_square_synth" }, "inst3": { "release_rate": 208, "envelope": "envelope3", - "sound": "29" + "sound": "29_orchestra_hit" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope4", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope4", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope4", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope4", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope4", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -112,14 +112,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope4", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope4", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope4", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -130,51 +130,51 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope4", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope4", "sound": "0D_clave"} ], "inst4": { "release_rate": 10, "normal_range_lo": 24, "envelope": "envelope5", - "sound_lo": "0E", - "sound": "0F" + "sound_lo": "0E_hihat_closed", + "sound": "0F_hihat_open" }, "inst5": { "release_rate": 208, "normal_range_lo": 60, "normal_range_hi": 60, "envelope": "envelope6", - "sound_lo": "1E", - "sound": "1F", - "sound_hi": "20" + "sound_lo": "1E_closed_triangle", + "sound": "1F_open_triangle", + "sound_hi": "20_cabasa" }, "inst6": { "release_rate": 10, "normal_range_lo": 18, "envelope": "envelope7", - "sound_lo": "12", - "sound": "13" + "sound_lo": "12_snare_drum_1", + "sound": "13_snare_drum_2" }, "inst7": { "release_rate": 10, "normal_range_lo": 19, "normal_range_hi": 19, "envelope": "envelope8", - "sound_lo": "38", + "sound_lo": "38_electric_kick_drum", "sound": {"sample": "08", "tuning": 2.121321}, - "sound_hi": "38" + "sound_hi": "38_electric_kick_drum" } }, "instrument_list": [ diff --git a/sound/sound_banks/19.json b/sound/sound_banks/19.json index 64299791..1591ea88 100644 --- a/sound/sound_banks/19.json +++ b/sound/sound_banks/19.json @@ -79,31 +79,31 @@ "inst0": { "release_rate": 10, "envelope": "envelope0", - "sound": "22" + "sound": "22_boys_choir" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "19" + "sound": "19_brass" }, "inst2": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope2", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst3": { "release_rate": 90, "envelope": "envelope3", - "sound": "28" + "sound": "28_sitar_1" }, "inst4": { "release_rate": 208, "envelope": "envelope4", - "sound": "29" + "sound": "29_orchestra_hit" }, "inst5": { "release_rate": 100, @@ -117,31 +117,31 @@ "inst6": { "release_rate": 208, "envelope": "envelope6", - "sound": "19" + "sound": "19_brass" }, "inst7": { "release_rate": 10, "envelope": "envelope7", - "sound": "22" + "sound": "22_boys_choir" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope8", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope8", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope8", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope8", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope8", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope8", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -158,14 +158,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope8", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope8", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope8", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope8", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -176,40 +176,40 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope8", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope8", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope8", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope8", "sound": "0D_clave"} ], "inst8": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope9", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" }, "inst9": { "release_rate": 10, "envelope": "envelope10", - "sound": "18" + "sound": "18_timpani" }, "inst10": { "release_rate": 10, "normal_range_lo": 18, "envelope": "envelope11", - "sound_lo": "12", - "sound": "13" + "sound_lo": "12_snare_drum_1", + "sound": "13_snare_drum_2" } }, "instrument_list": [ diff --git a/sound/sound_banks/1A.json b/sound/sound_banks/1A.json index 2e923295..a648d86a 100644 --- a/sound/sound_banks/1A.json +++ b/sound/sound_banks/1A.json @@ -61,55 +61,55 @@ "inst0": { "release_rate": 67, "envelope": "envelope0", - "sound": "17" + "sound": "17_trumpet" }, "inst1": { "release_rate": 119, "envelope": "envelope1", - "sound": "2D" + "sound": "2D_trombone" }, "inst2": { "release_rate": 208, "envelope": "envelope2", - "sound": "16" + "sound": "16_french_horns" }, "inst3": { "release_rate": 24, "normal_range_lo": 42, "envelope": "envelope3", - "sound_lo": "14", - "sound": "15" + "sound_lo": "14_strings_5", + "sound": "15_strings_4" }, "inst4": { "release_rate": 208, "envelope": "envelope4", - "sound": "19" + "sound": "19_brass" }, "inst5": { "release_rate": 10, "envelope": "envelope5", - "sound": "26" + "sound": "26_crystal_rhodes" }, "inst6": { "release_rate": 10, "envelope": "envelope6", - "sound": "18" + "sound": "18_timpani" }, "inst7": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope7", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" }, "inst8": { "release_rate": 10, "normal_range_lo": 18, "envelope": "envelope8", - "sound_lo": "12", - "sound": "13" + "sound_lo": "12_snare_drum_1", + "sound": "13_snare_drum_2" } }, "instrument_list": [ diff --git a/sound/sound_banks/1B.json b/sound/sound_banks/1B.json index 7b375adb..472df84a 100644 --- a/sound/sound_banks/1B.json +++ b/sound/sound_banks/1B.json @@ -62,63 +62,63 @@ "release_rate": 24, "normal_range_lo": 42, "envelope": "envelope0", - "sound_lo": "14", - "sound": "15" + "sound_lo": "14_strings_5", + "sound": "15_strings_4" }, "inst1": { "release_rate": 24, "normal_range_lo": 42, "envelope": "envelope1", - "sound_lo": "14", - "sound": "15" + "sound_lo": "14_strings_5", + "sound": "15_strings_4" }, "inst2": { "release_rate": 208, "envelope": "envelope2", - "sound": "16" + "sound": "16_french_horns" }, "inst3": { "release_rate": 67, "envelope": "envelope3", - "sound": "17" + "sound": "17_trumpet" }, "inst4": { "release_rate": 24, "normal_range_lo": 42, "envelope": "envelope4", - "sound_lo": "14", - "sound": "15" + "sound_lo": "14_strings_5", + "sound": "15_strings_4" }, "inst5": { "release_rate": 10, "envelope": "envelope5", - "sound": "18" + "sound": "18_timpani" }, "inst6": { "release_rate": 10, "normal_range_lo": 18, "envelope": "envelope6", - "sound_lo": "12", - "sound": "13" + "sound_lo": "12_snare_drum_1", + "sound": "13_snare_drum_2" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope7", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope7", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope7", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope7", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope7", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope7", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -135,14 +135,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope7", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope7", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope7", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope7", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -153,28 +153,28 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope7", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope7", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope7", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope7", "sound": "0D_clave"} ], "inst7": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope8", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" } }, "instrument_list": [ diff --git a/sound/sound_banks/1C_endless_stairs.json b/sound/sound_banks/1C_endless_stairs.json index 1d34fccb..2f4f5058 100644 --- a/sound/sound_banks/1C_endless_stairs.json +++ b/sound/sound_banks/1C_endless_stairs.json @@ -43,38 +43,38 @@ "inst0": { "release_rate": 119, "envelope": "envelope0", - "sound": "3A" + "sound": "3A_music_box" }, "inst1": { "release_rate": 119, "envelope": "envelope1", - "sound": "3A" + "sound": "3A_music_box" }, "inst2": { "release_rate": 119, "envelope": "envelope2", - "sound": "3A" + "sound": "3A_music_box" }, "inst3": { "release_rate": 24, "normal_range_lo": 42, "envelope": "envelope3", - "sound_lo": "14", - "sound": "15" + "sound_lo": "14_strings_5", + "sound": "15_strings_4" }, "inst4": { "release_rate": 24, "normal_range_lo": 42, "envelope": "envelope4", - "sound_lo": "14", - "sound": "15" + "sound_lo": "14_strings_5", + "sound": "15_strings_4" }, "inst5": { "release_rate": 24, "normal_range_lo": 42, "envelope": "envelope5", - "sound_lo": "14", - "sound": "15" + "sound_lo": "14_strings_5", + "sound": "15_strings_4" } }, "instrument_list": [ diff --git a/sound/sound_banks/1D_bowser_organ.json b/sound/sound_banks/1D_bowser_organ.json index e67b568a..64f26213 100644 --- a/sound/sound_banks/1D_bowser_organ.json +++ b/sound/sound_banks/1D_bowser_organ.json @@ -1,6 +1,6 @@ { "date": "1996-03-19", - "sample_bank": "bowser_organ", + "sample_bank": {"ifdef": ["VERSION_SH"], "then": "instruments", "else": "bowser_organ"}, "envelopes": { "envelope0": [ [2, 32700], @@ -44,41 +44,41 @@ "release_rate": 19, "normal_range_hi": 50, "envelope": "envelope0", - "sound": "00", - "sound_hi": "01" + "sound": {"ifdef": ["VERSION_SH"], "then": "34b_organ", "else": "00_organ_1"}, + "sound_hi": {"ifdef": ["VERSION_SH"], "then": "34c_organ_lq", "else": "01_organ_1_lq"} }, "inst1": { "release_rate": 19, "normal_range_hi": 50, "envelope": "envelope1", - "sound": "00", - "sound_hi": "01" + "sound": {"ifdef": ["VERSION_SH"], "then": "34b_organ", "else": "00_organ_1"}, + "sound_hi": {"ifdef": ["VERSION_SH"], "then": "34c_organ_lq", "else": "01_organ_1_lq"} }, "inst2": { "release_rate": 19, "normal_range_hi": 50, "envelope": "envelope2", - "sound": "00", - "sound_hi": "01" + "sound": {"ifdef": ["VERSION_SH"], "then": "34b_organ", "else": "00_organ_1"}, + "sound_hi": {"ifdef": ["VERSION_SH"], "then": "34c_organ_lq", "else": "01_organ_1_lq"} }, "inst3": { "release_rate": 19, "normal_range_hi": 50, "envelope": "envelope3", - "sound": "00", - "sound_hi": "01" + "sound": {"ifdef": ["VERSION_SH"], "then": "34b_organ", "else": "00_organ_1"}, + "sound_hi": {"ifdef": ["VERSION_SH"], "then": "34c_organ_lq", "else": "01_organ_1_lq"} }, "inst4": { "release_rate": 19, "normal_range_hi": 50, "envelope": "envelope4", - "sound": "00", - "sound_hi": "01" + "sound": {"ifdef": ["VERSION_SH"], "then": "34b_organ", "else": "00_organ_1"}, + "sound_hi": {"ifdef": ["VERSION_SH"], "then": "34c_organ_lq", "else": "01_organ_1_lq"} }, "inst5": { "release_rate": 10, "envelope": "envelope5", - "sound": "02" + "sound": {"ifdef": ["VERSION_SH"], "then": "22_boys_choir", "else": "02_boys_choir"} } }, "instrument_list": [ diff --git a/sound/sound_banks/1E.json b/sound/sound_banks/1E.json index 120d83b7..2b458354 100644 --- a/sound/sound_banks/1E.json +++ b/sound/sound_banks/1E.json @@ -31,30 +31,30 @@ "inst0": { "release_rate": 255, "envelope": "envelope0", - "sound": "27" + "sound": "27_harpsichord" }, "inst1": { "release_rate": 255, "envelope": "envelope1", - "sound": "27" + "sound": "27_harpsichord" }, "inst2": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope2", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst3": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope3", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" } }, "instrument_list": [ diff --git a/sound/sound_banks/1F.json b/sound/sound_banks/1F.json index cb2c3a5b..66d2697f 100644 --- a/sound/sound_banks/1F.json +++ b/sound/sound_banks/1F.json @@ -31,24 +31,24 @@ "inst0": { "release_rate": 208, "envelope": "envelope0", - "sound": "2E" + "sound": "2E_accordion" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "2E" + "sound": "2E_accordion" }, "inst2": { "release_rate": 208, "envelope": "envelope2", - "sound": "2F" + "sound": "2F_sleigh_bells" }, "inst3": { "release_rate": 10, "normal_range_lo": 18, "envelope": "envelope3", - "sound_lo": "12", - "sound": "13" + "sound_lo": "12_snare_drum_1", + "sound": "13_snare_drum_2" } }, "instrument_list": [ diff --git a/sound/sound_banks/20.json b/sound/sound_banks/20.json index 5fec8fd3..498a3824 100644 --- a/sound/sound_banks/20.json +++ b/sound/sound_banks/20.json @@ -25,21 +25,21 @@ "inst0": { "release_rate": 208, "envelope": "envelope0", - "sound": "16" + "sound": "16_french_horns" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "16" + "sound": "16_french_horns" }, "inst2": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope2", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" } }, "instrument_list": [ diff --git a/sound/sound_banks/21.json b/sound/sound_banks/21.json index 98cae0e6..c33c4e87 100644 --- a/sound/sound_banks/21.json +++ b/sound/sound_banks/21.json @@ -25,17 +25,17 @@ "inst0": { "release_rate": 208, "envelope": "envelope0", - "sound": "2E" + "sound": "2E_accordion" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "2E" + "sound": "2E_accordion" }, "inst2": { "release_rate": 10, "envelope": "envelope2", - "sound": "26" + "sound": "26_crystal_rhodes" } }, "instrument_list": [ diff --git a/sound/sound_banks/22.json b/sound/sound_banks/22.json index 930893ca..3a80b4aa 100644 --- a/sound/sound_banks/22.json +++ b/sound/sound_banks/22.json @@ -49,17 +49,17 @@ "inst0": { "release_rate": 208, "envelope": "envelope0", - "sound": "19" + "sound": "19_brass" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "1A" + "sound": "1A_slap_bass" }, "inst2": { "release_rate": 128, "envelope": "envelope2", - "sound": "1B" + "sound": "1B_organ_2" }, "inst3": { "release_rate": 208, @@ -67,23 +67,23 @@ "sound": "1C" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope4", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope4", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope4", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope4", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope4", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope4", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -100,14 +100,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope4", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope4", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope4", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope4", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -118,35 +118,35 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope4", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope4", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope4", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope4", "sound": "0D_clave"} ], "inst4": { "release_rate": 10, "normal_range_lo": 24, "envelope": "envelope5", - "sound_lo": "0E", - "sound": "0F" + "sound_lo": "0E_hihat_closed", + "sound": "0F_hihat_open" }, "inst5": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope6", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" } }, "instrument_list": [ diff --git a/sound/sound_banks/23.json b/sound/sound_banks/23.json index 000479c9..848d2f79 100644 --- a/sound/sound_banks/23.json +++ b/sound/sound_banks/23.json @@ -45,42 +45,42 @@ "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope0", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst1": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope1", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst2": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope2", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst3": { "release_rate": 10, "envelope": "envelope3", - "sound": "26" + "sound": "26_crystal_rhodes" }, "inst4": { "release_rate": 10, "envelope": "envelope4", - "sound": "26" + "sound": "26_crystal_rhodes" }, "inst5": { "release_rate": 255, "envelope": "envelope5", - "sound": "27" + "sound": "27_harpsichord" } }, "instrument_list": [ diff --git a/sound/sound_banks/24.json b/sound/sound_banks/24.json index 039b78c6..d205b003 100644 --- a/sound/sound_banks/24.json +++ b/sound/sound_banks/24.json @@ -37,38 +37,38 @@ "inst0": { "release_rate": 43, "envelope": "envelope0", - "sound": "41" + "sound": "41_pan_flute" }, "inst1": { "release_rate": 24, "normal_range_lo": 42, "envelope": "envelope1", - "sound_lo": "14", - "sound": "15" + "sound_lo": "14_strings_5", + "sound": "15_strings_4" }, "inst2": { "release_rate": 43, "envelope": "envelope3", - "sound": "41" + "sound": "41_pan_flute" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope2", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope2", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope2", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope2", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope2", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope2", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -85,14 +85,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope2", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope2", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope2", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope2", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope2", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope2", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope2", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -103,24 +103,24 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope2", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope2", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope2", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope2", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope2", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope2", "sound": "0D_clave"} ], "inst3": { "release_rate": 10, "envelope": "envelope4", - "sound": "22" + "sound": "22_boys_choir" } }, "instrument_list": [ diff --git a/sound/sound_banks/25.json b/sound/sound_banks/25.json index 905d6dde..82db2dc8 100644 --- a/sound/sound_banks/25.json +++ b/sound/sound_banks/25.json @@ -97,12 +97,12 @@ "inst0": { "release_rate": 19, "envelope": "envelope0", - "sound": "43" + "sound": "43_harmonica" }, "inst1": { "release_rate": 208, "envelope": "envelope1", - "sound": "1A" + "sound": "1A_slap_bass" }, "inst2": { "release_rate": 208, @@ -112,92 +112,92 @@ "inst3": { "release_rate": 10, "envelope": "envelope3", - "sound": "26" + "sound": "26_crystal_rhodes" }, "inst4": { "release_rate": 34, "envelope": "envelope4", - "sound": "44" + "sound": "44_grand_piano" }, "inst5": { "release_rate": 53, "normal_range_hi": 50, "envelope": "envelope5", - "sound": "16", - "sound_hi": "45" + "sound": "16_french_horns", + "sound_hi": "45_french_horns_lq" }, "inst6": { "release_rate": 10, "normal_range_lo": 24, "envelope": "envelope6", - "sound_lo": "0E", - "sound": "0F" + "sound_lo": "0E_hihat_closed", + "sound": "0F_hihat_open" }, "inst7": { "release_rate": 10, "normal_range_lo": 28, "normal_range_hi": 28, "envelope": "envelope7", - "sound_lo": "10", - "sound": "11", - "sound_hi": "10" + "sound_lo": "10_cymbal_bell", + "sound": "11_splash_cymbal", + "sound_hi": "10_cymbal_bell" }, "inst8": { "release_rate": 208, "normal_range_lo": 60, "normal_range_hi": 60, "envelope": "envelope8", - "sound_lo": "1E", - "sound": "1F", - "sound_hi": "20" + "sound_lo": "1E_closed_triangle", + "sound": "1F_open_triangle", + "sound_hi": "20_cabasa" }, "inst9": { "release_rate": 43, "envelope": "envelope9", - "sound": "41" + "sound": "41_pan_flute" }, "inst10": { "release_rate": 15, "normal_range_lo": 27, "normal_range_hi": 46, "envelope": "envelope10", - "sound_lo": "23", - "sound": "24", - "sound_hi": "25" + "sound_lo": "23_strings_1", + "sound": "24_strings_2", + "sound_hi": "25_strings_3" }, "inst11": { "release_rate": 10, "envelope": "envelope12", - "sound": "44" + "sound": "44_grand_piano" }, "inst12": { "release_rate": 10, "envelope": "envelope13", - "sound": "26" + "sound": "26_crystal_rhodes" }, "inst13": { "release_rate": 34, "envelope": "envelope14", - "sound": "43" + "sound": "43_harmonica" }, "percussion": [ - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.210224}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.2227245}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.2359685}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.25}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.264866}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.2806155}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.297302}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.3149805}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.33371}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.3535535}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.374577}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.3968505}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.4204485}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.4454495}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.4719375}}, - {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06", "tuning": 0.5}}, - {"release_rate": 10, "pan": 57, "envelope": "envelope11", "sound": "07"}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.210224}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2227245}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2359685}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.25}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.264866}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.2806155}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.297302}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3149805}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.33371}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3535535}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.374577}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.3968505}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4204485}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4454495}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.4719375}}, + {"release_rate": 10, "pan": 62, "envelope": "envelope11", "sound": {"sample": "06_kick_drum_1", "tuning": 0.5}}, + {"release_rate": 10, "pan": 57, "envelope": "envelope11", "sound": "07_rimshot"}, {"release_rate": 10, "pan": 65, "envelope": "envelope11", "sound": {"sample": "08", "tuning": 1.1905508}}, {"release_rate": 10, "pan": 66, "envelope": "envelope11", "sound": {"sample": "08", "tuning": 0.8418465}}, {"release_rate": 10, "pan": 66, "envelope": "envelope11", "sound": {"sample": "08", "tuning": 0.8919052}}, @@ -214,14 +214,14 @@ {"release_rate": 10, "pan": 83, "envelope": "envelope11", "sound": {"sample": "09", "tuning": 1.33484}}, {"release_rate": 10, "pan": 83, "envelope": "envelope11", "sound": {"sample": "09", "tuning": 1.414214}}, {"release_rate": 10, "pan": 83, "envelope": "envelope11", "sound": {"sample": "09", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A", "tuning": 1.587401}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A", "tuning": 1.681793}}, - {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A", "tuning": 1.781798}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A_tambourine", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A_tambourine", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A_tambourine", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A_tambourine", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A_tambourine", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A_tambourine", "tuning": 1.587401}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A_tambourine", "tuning": 1.681793}}, + {"release_rate": 10, "pan": 35, "envelope": "envelope11", "sound": {"sample": "0A_tambourine", "tuning": 1.781798}}, {"release_rate": 10, "pan": 54, "envelope": "envelope11", "sound": {"sample": "0B", "tuning": 0.5469096}}, {"release_rate": 10, "pan": 54, "envelope": "envelope11", "sound": {"sample": "0B", "tuning": 0.5794306}}, {"release_rate": 10, "pan": 54, "envelope": "envelope11", "sound": {"sample": "0B", "tuning": 0.61388505}}, @@ -232,19 +232,19 @@ {"release_rate": 10, "pan": 54, "envelope": "envelope11", "sound": {"sample": "0B", "tuning": 0.81943786}}, {"release_rate": 10, "pan": 70, "envelope": "envelope11", "sound": {"sample": "0B", "tuning": 1.5468929}}, {"release_rate": 10, "pan": 70, "envelope": "envelope11", "sound": {"sample": "0B", "tuning": 1.6388757}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 0.793701}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 0.840897}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 0.890899}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 0.943875}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 1.0}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 1.059463}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 1.122462}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 1.189207}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 1.259921}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 1.33484}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 1.414214}}, - {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C", "tuning": 1.498307}}, - {"release_rate": 10, "pan": 128, "envelope": "envelope11", "sound": "0D"} + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 0.793701}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 0.840897}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 0.890899}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 0.943875}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 1.0}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 1.059463}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 1.122462}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 1.189207}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 1.259921}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 1.33484}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 1.414214}}, + {"release_rate": 10, "pan": 82, "envelope": "envelope11", "sound": {"sample": "0C_conga_stick", "tuning": 1.498307}}, + {"release_rate": 10, "pan": 128, "envelope": "envelope11", "sound": "0D_clave"} ] }, "instrument_list": [ diff --git a/sound/sound_data.c b/sound/sound_data.c index 598cc1e3..28e5af04 100644 --- a/sound/sound_data.c +++ b/sound/sound_data.c @@ -1,3 +1,5 @@ +#include "sound_data.h" + unsigned char gSoundDataADSR[] = { #include "sound/sound_data.ctl.inc.c" }; @@ -10,6 +12,8 @@ unsigned char gMusicData[] = { #include "sound/sequences.bin.inc.c" }; +#ifndef VERSION_SH unsigned char gBankSetsData[] = { #include "sound/bank_sets.inc.c" }; +#endif \ No newline at end of file diff --git a/sound/sound_data.h b/sound/sound_data.h new file mode 100644 index 00000000..65de8290 --- /dev/null +++ b/sound/sound_data.h @@ -0,0 +1,14 @@ +#ifndef SOUND_DATA_H +#define SOUND_DATA_H + +extern unsigned char gSoundDataADSR[]; + +extern unsigned char gSoundDataRaw[]; + +extern unsigned char gMusicData[]; + +#ifndef VERSION_SH +extern unsigned char gBankSetsData[]; +#endif + +#endif \ No newline at end of file diff --git a/src/audio/audio_session_presets_sh.c b/src/audio/audio_session_presets_sh.c new file mode 100644 index 00000000..958ec15a --- /dev/null +++ b/src/audio/audio_session_presets_sh.c @@ -0,0 +1,45 @@ +#include "internal.h" +#include "data.h" + +#ifdef VERSION_SH + +struct ReverbSettingsEU sReverbSettings[] = { + {0x01, 0x30, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000}, + {0x01, 0x28, 0x47ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000}, + {0x01, 0x40, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000}, + {0x01, 0x38, 0x3fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000}, + {0x01, 0x30, 0x4fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000}, + {0x01, 0x28, 0x37ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000}, +}; + +struct AudioSessionSettingsEU gAudioSessionPresets[] = { + { 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, + 0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 }, + { 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, + 0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 }, + { 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, + 0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 }, + { 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, + 0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 }, + { 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, + 0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 }, + { 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00, + 0x00000000, 0x00003f00, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 }, + { 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00, + 0x00000000, 0x00004400, 0x00002a80, 0x00000000, 0x00000000, 0x00000000 }, + { 0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280, + 0x00000000, 0x00004000, 0x00001b00, 0x00000000, 0x00000000, 0x00000000 } +}; + +s8 gUnusedCount80333EE8 = UNUSED_COUNT_80333EE8; +s16 gTatumsPerBeat = TATUMS_PER_BEAT; +s32 gAudioHeapSize = DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE); +s32 gAudioInitPoolSize = DOUBLE_SIZE_ON_64_BIT(AUDIO_INIT_POOL_SIZE); + +// Used in audio_init: +u32 D_SH_80315EF0 = 0; +u16 D_SH_80315EF4 = 0; +u16 D_SH_80315EF8 = 0; +u16 D_SH_80315EFC = 0; + +#endif diff --git a/src/audio/seq_channel_layer_process_script.h b/src/audio/copt/seq_channel_layer_process_script_copt.inc.c similarity index 71% rename from src/audio/seq_channel_layer_process_script.h rename to src/audio/copt/seq_channel_layer_process_script_copt.inc.c index 2f287b4c..4fd4b511 100644 --- a/src/audio/seq_channel_layer_process_script.h +++ b/src/audio/copt/seq_channel_layer_process_script_copt.inc.c @@ -1,14 +1,15 @@ //! Copt inlining for US/JP. Here be dragons +// This version is basically identical to EU #include #include -#include "heap.h" -#include "data.h" -#include "load.h" -#include "seqplayer.h" -#include "external.h" -#include "effects.h" +#include "audio/heap.h" +#include "audio/data.h" +#include "audio/load.h" +#include "audio/seqplayer.h" +#include "audio/external.h" +#include "audio/effects.h" #define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80) #define PORTAMENTO_MODE(x) ((x).mode & ~0x80) @@ -132,54 +133,26 @@ struct Instrument **instOut = _instOut;\ } #endif -#ifdef VERSION_EU - #define PORTAMENTO_TGT_NOTE cmd - #define DRUM_INDEX cmd - #define SEMITONE cmd - #define USED_SEMITONE vel -#else - #define PORTAMENTO_TGT_NOTE portamentoTargetNote - #define DRUM_INDEX cmdSemitone - #define SEMITONE cmdSemitone - #define USED_SEMITONE usedSemitone -#endif - void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { - struct SequencePlayer *seqPlayer; // sp5C, t4 + struct SequencePlayer *seqPlayer; // sp5C, t4 struct SequenceChannel *seqChannel; // sp58, t5 - struct M64ScriptState *state; // v0 - struct Portamento *portamento; // v0 - struct AudioBankSound *sound; // v0 - struct Instrument *instrument; // v1 + struct M64ScriptState *state; + struct Portamento *portamento; + struct AudioBankSound *sound; + struct Instrument *instrument; struct Drum *drum; - UNUSED s32 pad[1]; - u8 sameSound; // sp3F - UNUSED u8 allocNewNote; // sp3D, t0 - u8 cmd; // a0 sp3E, EU s2 - UNUSED u8 loBits; - u16 sp3A; // t2, a0, a1 - UNUSED s32 pad2[1]; - s32 vel; // sp30, t3 - UNUSED s32 pad3[1]; - f32 freqScale; // sp28, f0 + s32 temp_a0_5; + u8 sameSound; + u8 cmd; // a0 sp3E, EU s2 + u8 cmdSemitone; // sp3D, t0 + u16 sp3A; // t2, a0, a1 + f32 tuning; // f0 + s32 vel; // sp30, t3 + s32 usedSemitone; // a1 + f32 freqScale; // sp28, f0 f32 sp24; - u8 temp8; - UNUSED u8 semitone; // v0 - s32 usedSemitone; // a1 f32 temp_f12; f32 temp_f2; - s32 temp_a0_5; - UNUSED u8 drumIndex; // t0 - UNUSED s32 cmdBase; // t1 - u8 temp_a0_6; - u8 portamentoTargetNote; // t7 - UNUSED s32 bankId; // a3 - u8 instId; // v0 - u8 cmdSemitone; // v1 - f32 tuning; // f0 - - // inlined copt var that gets pulled out to the rest of the function - unsigned char _Kqi6; //! Copt: manually inline these functions in the scope of this routine #ifdef __sgi @@ -190,12 +163,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { #endif sameSound = TRUE; - if (layer->enabled == FALSE) { + if ((*layer).enabled == FALSE) { return; } - if (layer->delay > 1) { - layer->delay--; + if ((*layer).delay > 1) { + (*layer).delay--; if (!layer->stopSomething && layer->delay <= layer->duration) { seq_channel_layer_note_decay(layer); layer->stopSomething = TRUE; @@ -212,28 +185,22 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { layer->portamento.mode = 0; } - seqChannel = (*(layer)).seqChannel; - seqPlayer = (*(seqChannel)).seqPlayer; + seqChannel = (*layer).seqChannel; + seqPlayer = (*seqChannel).seqPlayer; for (;;) { state = &layer->scriptState; //M64_READ_U8(state, cmd); - // manually inlined because we need _Kqi6 :( { u8 *_ptr_pc; - _ptr_pc = (*state).pc; - ((*state).pc)++; - //cmd = *_ptr_pc; - - _Kqi6 = *_ptr_pc; - cmd = _Kqi6; + _ptr_pc = (*state).pc++; + cmd = *_ptr_pc; } if (cmd <= 0xc0) { break; } - switch (_Kqi6) - { + switch (cmd) { case 0xff: // layer_end; function return or end of script if (state->depth == 0) { // N.B. this function call is *not* inlined even though it's @@ -251,7 +218,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { break; case 0xf8: // layer_loop; loop start, N iterations (or 256 if N = 0) - M64_READ_U8(state, state->remLoopIters[state->depth]) + M64_READ_U8(state, state->remLoopIters[state->depth]); state->depth++, state->stack[state->depth - 1] = state->pc; break; @@ -280,11 +247,11 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { case 0xc2: // layer_transpose; set transposition in semitones case 0xc9: // layer_setshortnoteduration - temp_a0_6 = *(state->pc++); + temp_a0_5 = *(state->pc++); if (cmd == 0xc9) { - layer->noteDuration = temp_a0_6; + layer->noteDuration = temp_a0_5; } else { - layer->transposition = temp_a0_6; + layer->transposition = temp_a0_5; } break; @@ -292,43 +259,51 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { case 0xc5: // layer_somethingoff //! copt needs a ternary: //layer->continuousNotes = (cmd == 0xc4) ? TRUE : FALSE; - if (cmd == 0xc4) { - temp8 = TRUE; - } else { - temp8 = FALSE; + { + u8 setting; + if (cmd == 0xc4) { + setting = TRUE; + } else { + setting = FALSE; + } + layer->continuousNotes = setting; + seq_channel_layer_note_decay(layer); } - layer->continuousNotes = temp8; - seq_channel_layer_note_decay(layer); break; case 0xc3: // layer_setshortnotedefaultplaypercentage - M64_READ_COMPRESSED_U16(state, sp3A) + M64_READ_COMPRESSED_U16(state, sp3A); layer->shortNoteDefaultPlayPercentage = sp3A; break; case 0xc6: // layer_setinstr - M64_READ_U8(state, instId); - if (instId < 127) { - GET_INSTRUMENT(seqChannel, instId, &(*layer).instrument, &(*layer).adsr, instId, 1); + M64_READ_U8(state, cmdSemitone); + + if (cmdSemitone < 127) { + GET_INSTRUMENT(seqChannel, cmdSemitone, &(*layer).instrument, &(*layer).adsr, cmdSemitone, 1); } break; case 0xc7: // layer_portamento M64_READ_U8(state, (*layer).portamento.mode); - M64_READ_U8(state, PORTAMENTO_TGT_NOTE); - PORTAMENTO_TGT_NOTE = PORTAMENTO_TGT_NOTE + (*layer).transposition + (*seqPlayer).transposition + (*seqChannel).transposition; - if (PORTAMENTO_TGT_NOTE >= 0x80) { - PORTAMENTO_TGT_NOTE = 0; + M64_READ_U8(state, cmdSemitone); + + cmdSemitone = cmdSemitone + (*seqChannel).transposition; + cmdSemitone += (*layer).transposition; + cmdSemitone += (*seqPlayer).transposition; + + if (cmdSemitone >= 0x80) { + cmdSemitone = 0; } - layer->portamentoTargetNote = PORTAMENTO_TGT_NOTE; + layer->portamentoTargetNote = cmdSemitone; // If special, the next param is u8 instead of var - if (PORTAMENTO_IS_SPECIAL((*(layer)).portamento)) { + if (PORTAMENTO_IS_SPECIAL((*layer).portamento)) { layer->portamentoTime = *((state)->pc++); break; } - M64_READ_COMPRESSED_U16(state, sp3A) + M64_READ_COMPRESSED_U16(state, sp3A); layer->portamentoTime = sp3A; break; @@ -340,16 +315,16 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { switch (cmd & 0xf0) { case 0xd0: // layer_setshortnotevelocityfromtable sp3A = seqPlayer->shortNoteVelocityTable[cmd & 0xf]; - (*(layer)).velocitySquare = (f32)(sp3A * sp3A); + (*layer).velocitySquare = (f32)(sp3A * sp3A); break; case 0xe0: // layer_setshortnotedurationfromtable - (*(layer)).noteDuration = seqPlayer->shortNoteDurationTable[cmd & 0xf]; + (*layer).noteDuration = seqPlayer->shortNoteDurationTable[cmd & 0xf]; break; } } } - if (cmd == 0xc0) // layer_delay - { + + if (cmd == 0xc0) { // layer_delay M64_READ_COMPRESSED_U16(state, layer->delay); layer->stopSomething = TRUE; } else { @@ -358,44 +333,44 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { if (seqChannel->largeNotes == TRUE) { switch (cmd & 0xc0) { case 0x00: // layer_note0 (play percentage, velocity, duration) - M64_READ_COMPRESSED_U16(state, sp3A) + M64_READ_COMPRESSED_U16(state, sp3A); vel = *((*state).pc++); - layer->noteDuration = *(state->pc++); + layer->noteDuration = *((*state).pc++); layer->playPercentage = sp3A; goto l1090; case 0x40: // layer_note1 (play percentage, velocity) - M64_READ_COMPRESSED_U16(state, sp3A) - vel = *(state->pc++); + M64_READ_COMPRESSED_U16(state, sp3A); + vel = *((*state).pc++); layer->noteDuration = 0; layer->playPercentage = sp3A; goto l1090; - case 0x80: // layer_note2 (velocity, duration; uses last play percentage) sp3A = layer->playPercentage; - vel = *(state->pc++); - layer->noteDuration = *(state->pc++); + vel = *((*state).pc++); + layer->noteDuration = *((*state).pc++); goto l1090; } l1090: - cmdSemitone = (cmd - (cmd & 0xc0)); + cmdSemitone = cmd - (cmd & 0xc0); layer->velocitySquare = vel * vel; } else { switch (cmd & 0xc0) { case 0x00: // play note, type 0 (play percentage) - M64_READ_COMPRESSED_U16(state, sp3A) + M64_READ_COMPRESSED_U16(state, sp3A); layer->playPercentage = sp3A; - break; + goto l1138; case 0x40: // play note, type 1 (uses default play percentage) sp3A = layer->shortNoteDefaultPlayPercentage; - break; + goto l1138; case 0x80: // play note, type 2 (uses last play percentage) sp3A = layer->playPercentage; - break; + goto l1138; } +l1138: cmdSemitone = cmd - (cmd & 0xc0); } @@ -409,20 +384,19 @@ l1090: layer->stopSomething = TRUE; } else { if (seqChannel->instOrWave == 0) { // drum - //DRUM_INDEX = cmdSemitone; - DRUM_INDEX += (*seqChannel).transposition + (*layer).transposition; - if (DRUM_INDEX >= gCtlEntries[seqChannel->bankId].numDrums) { - DRUM_INDEX = gCtlEntries[seqChannel->bankId].numDrums; - if (DRUM_INDEX == 0) { + cmdSemitone += (*seqChannel).transposition + (*layer).transposition; + if (cmdSemitone >= gCtlEntries[seqChannel->bankId].numDrums) { + cmdSemitone = gCtlEntries[seqChannel->bankId].numDrums; + if (cmdSemitone == 0) { // this goto looks a bit like a function return... layer->stopSomething = TRUE; goto skip; } - DRUM_INDEX--; + cmdSemitone--; } - drum = gCtlEntries[seqChannel->bankId].drums[DRUM_INDEX]; + drum = gCtlEntries[seqChannel->bankId].drums[cmdSemitone]; if (drum == NULL) { layer->stopSomething = TRUE; } else { @@ -435,9 +409,8 @@ l1090: skip:; } else { // instrument - //SEMITONE = cmdSemitone; - SEMITONE += (*(seqPlayer)).transposition + (*(seqChannel)).transposition + (*(layer)).transposition; - if (SEMITONE >= 0x80) { + cmdSemitone += (*seqPlayer).transposition + (*seqChannel).transposition + (*layer).transposition; + if (cmdSemitone >= 0x80) { layer->stopSomething = TRUE; } else { instrument = layer->instrument; @@ -447,16 +420,16 @@ l1090: if (layer->portamento.mode != 0) { //! copt needs a ternary: - //usedSemitone = (layer->portamentoTargetNote < SEMITONE) ? SEMITONE : layer->portamentoTargetNote; - if (layer->portamentoTargetNote < SEMITONE) { - USED_SEMITONE = SEMITONE; + //usedSemitone = (layer->portamentoTargetNote < cmdSemitone) ? cmdSemitone : layer->portamentoTargetNote; + if (layer->portamentoTargetNote < cmdSemitone) { + usedSemitone = cmdSemitone; } else { - USED_SEMITONE = layer->portamentoTargetNote; + usedSemitone = layer->portamentoTargetNote; } if (instrument != NULL) { - sound = (u8) USED_SEMITONE < instrument->normalRangeLo ? &instrument->lowNotesSound - : (u8) USED_SEMITONE <= instrument->normalRangeHi ? + sound = (u8) usedSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound + : (u8) usedSemitone <= instrument->normalRangeHi ? &instrument->normalNotesSound : &instrument->highNotesSound; sameSound = (sound == (*layer).sound); @@ -467,7 +440,7 @@ l1090: tuning = 1.0f; } - temp_f2 = gNoteFrequencies[SEMITONE] * tuning; + temp_f2 = gNoteFrequencies[cmdSemitone] * tuning; temp_f12 = gNoteFrequencies[layer->portamentoTargetNote] * tuning; portamento = &layer->portamento; @@ -487,29 +460,29 @@ l1090: } l13cc: portamento->extent = sp24 / freqScale - US_FLOAT(1.0); - if (PORTAMENTO_IS_SPECIAL((*(layer)).portamento)) { - portamento->speed = US_FLOAT(32512.0) * FLOAT_CAST((*(seqPlayer)).tempo) - / ((f32)(*(layer)).delay * (f32) gTempoInternalToExternal - * FLOAT_CAST((*(layer)).portamentoTime)); + if (PORTAMENTO_IS_SPECIAL((*layer).portamento)) { + portamento->speed = US_FLOAT(32512.0) * FLOAT_CAST((*seqPlayer).tempo) + / ((f32)(*layer).delay * (f32) gTempoInternalToExternal + * FLOAT_CAST((*layer).portamentoTime)); } else { - portamento->speed = US_FLOAT(127.0) / FLOAT_CAST((*(layer)).portamentoTime); + portamento->speed = US_FLOAT(127.0) / FLOAT_CAST((*layer).portamentoTime); } portamento->cur = 0.0f; layer->freqScale = freqScale; - if (PORTAMENTO_MODE((*(layer)).portamento) == PORTAMENTO_MODE_5) { - layer->portamentoTargetNote = SEMITONE; + if (PORTAMENTO_MODE((*layer).portamento) == PORTAMENTO_MODE_5) { + layer->portamentoTargetNote = cmdSemitone; } } else if (instrument != NULL) { - sound = SEMITONE < instrument->normalRangeLo ? - &instrument->lowNotesSound : SEMITONE <= instrument->normalRangeHi ? + sound = cmdSemitone < instrument->normalRangeLo ? + &instrument->lowNotesSound : cmdSemitone <= instrument->normalRangeHi ? &instrument->normalNotesSound : &instrument->highNotesSound; - sameSound = (sound == (*(layer)).sound); + sameSound = (sound == (*layer).sound); layer->sound = sound; - layer->freqScale = gNoteFrequencies[SEMITONE] * (*(sound)).tuning; + layer->freqScale = gNoteFrequencies[cmdSemitone] * (*sound).tuning; } else { layer->sound = NULL; - layer->freqScale = gNoteFrequencies[SEMITONE]; + layer->freqScale = gNoteFrequencies[cmdSemitone]; } } } @@ -524,20 +497,20 @@ l13cc: return; } - cmd = FALSE; + cmdSemitone = FALSE; if (!layer->continuousNotes) { - cmd = TRUE; + cmdSemitone = TRUE; } else if (layer->note == NULL || layer->status == SOUND_LOAD_STATUS_NOT_LOADED) { - cmd = TRUE; + cmdSemitone = TRUE; } else if (sameSound == FALSE) { seq_channel_layer_note_decay(layer); - cmd = TRUE; + cmdSemitone = TRUE; } else if (layer->sound == NULL) { init_synthetic_wave(layer->note, layer); } - if (cmd != FALSE) { - (*(layer)).note = alloc_note(layer); + if (cmdSemitone != FALSE) { + (*layer).note = alloc_note(layer); } if (layer->note != NULL && layer->note->parentLayer == layer) { diff --git a/src/audio/data.c b/src/audio/data.c index 15ef5dfa..57e093f7 100644 --- a/src/audio/data.c +++ b/src/audio/data.c @@ -55,7 +55,7 @@ struct AudioSessionSettingsEU gAudioSessionPresets[] = { // - memory used for persistent banks // - memory used for temporary sequences // - memory used for temporary banks -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) struct AudioSessionSettings gAudioSessionPresets[18] = { #ifdef VERSION_JP { 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 }, @@ -89,7 +89,7 @@ struct AudioSessionSettings gAudioSessionPresets[18] = { }; #endif // gAudioCosineTable[k] = round((2**15 - 1) * cos(pi/2 * k / 127)). Unused. -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) u16 gAudioCosineTable[128] = { 0x7FFF, 32764, 32757, 32744, 32727, 32704, 32677, 32644, 32607, 32564, 32517, 32464, 32407, 32344, 32277, 32205, 32127, 32045, 31958, 31866, 31770, 31668, 31561, 31450, 31334, 31213, @@ -107,7 +107,8 @@ u16 gAudioCosineTable[128] = { // Transforms a pitch scale factor in -127..127 into a frequency scale factor // between -1 and +1 octave. // gPitchBendFrequencyScale[k] = 0.5 * 2^(k/127) -#ifdef VERSION_EU +#ifndef VERSION_SH +#if defined(VERSION_EU) f32 gPitchBendFrequencyScale[256] = { 0.5f, #else @@ -175,7 +176,7 @@ u8 gDefaultShortNoteDurationTable[16] = { 229, 203, 177, 151, 139, 126, 113, 100, 87, 74, 61, 48, 36, 23, 10, 0, }; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) // gVibratoCurve[k] = k*8 s8 gVibratoCurve[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }; #endif @@ -185,11 +186,14 @@ struct AdsrEnvelope gDefaultEnvelope[] = { { BE_TO_HOST16(1000), BE_TO_HOST16(32000) }, // stay there for 4.16 seconds { BE_TO_HOST16(ADSR_HANG), 0 } // then continue staying there }; +#endif #ifdef VERSION_EU struct NoteSubEu gZeroNoteSub = { 0 }; struct NoteSubEu gDefaultNoteSub = { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { NULL } }; +#endif +#if defined(VERSION_EU) || defined(VERSION_SH) s16 sSawtoothWaves[256] = { 0, 1023, 2047, 3071, 4095, 5119, 6143, 7167, 8191, 9215, 10239, 11263, 0x2FFF, 13311, 0x37FF, 15359, 0x3FFF, 17407, 0x47FF, 19455, 0x4FFF, 21503, @@ -382,19 +386,144 @@ s16 sSawtoothWave[0x40] = { s16 *gWaveSamples[4] = { sSawtoothWave, sTriangleWave, sSineWave, sSquareWave }; #endif +#ifdef VERSION_SH +s32 unk_sh_data_0[2] = {0, 0}; +f32 gPitchBendFrequencyScale[256] = { + 0.5f, 0.5f, 0.502736f, 0.505488f, 0.508254f, 0.511036f, 0.513833f, 0.516645f, 0.519472f, + 0.522315f, 0.525174f, 0.528048f, 0.530938f, 0.533843f, 0.536765f, 0.539702f, 0.542656f, 0.545626f, + 0.548612f, 0.551614f, 0.554633f, 0.557669f, 0.560721f, 0.563789f, 0.566875f, 0.569977f, 0.573097f, + 0.576233f, 0.579387f, 0.582558f, 0.585746f, 0.588951f, 0.592175f, 0.595415f, 0.598674f, 0.601950f, + 0.605245f, 0.608557f, 0.611888f, 0.615236f, 0.618603f, 0.621989f, 0.625393f, 0.628815f, 0.632257f, + 0.635717f, 0.639196f, 0.642694f, 0.646212f, 0.649748f, 0.653304f, 0.656880f, 0.660475f, 0.664089f, + 0.667724f, 0.671378f, 0.675052f, 0.678747f, 0.682461f, 0.686196f, 0.689952f, 0.693727f, 0.697524f, + 0.701341f, 0.705180f, 0.709039f, 0.712919f, 0.716821f, 0.720744f, 0.724689f, 0.728655f, 0.732642f, + 0.736652f, 0.740684f, 0.744737f, 0.748813f, 0.752911f, 0.757031f, 0.761175f, 0.765340f, 0.769529f, + 0.773740f, 0.777975f, 0.782232f, 0.786513f, 0.790818f, 0.795146f, 0.799497f, 0.803873f, 0.808272f, + 0.812696f, 0.817144f, 0.821616f, 0.826112f, 0.830633f, 0.835179f, 0.839750f, 0.844346f, 0.848966f, + 0.853613f, 0.858284f, 0.862982f, 0.867704f, 0.872453f, 0.877228f, 0.882029f, 0.886856f, 0.891709f, + 0.896590f, 0.901496f, 0.906430f, 0.911391f, 0.916379f, 0.921394f, 0.926436f, 0.931507f, 0.936604f, + 0.941730f, 0.946884f, 0.952066f, 0.957277f, 0.962516f, 0.967783f, 0.973080f, 0.978405f, 0.983760f, + 0.989144f, 0.994557f, 1.0f, 1.005473f, 1.010975f, 1.016508f, 1.022071f, 1.027665f, 1.033289f, + 1.038944f, 1.044630f, 1.050347f, 1.056095f, 1.061875f, 1.067687f, 1.073530f, 1.079405f, 1.085312f, + 1.091252f, 1.097224f, 1.103229f, 1.109267f, 1.115337f, 1.121441f, 1.127579f, 1.133750f, 1.139955f, + 1.146193f, 1.152466f, 1.158773f, 1.165115f, 1.171491f, 1.177903f, 1.184349f, 1.190831f, 1.197348f, + 1.203901f, 1.210489f, 1.217114f, 1.223775f, 1.230473f, 1.237207f, 1.243978f, 1.250786f, 1.257631f, + 1.264514f, 1.271434f, 1.278392f, 1.285389f, 1.292423f, 1.299497f, 1.306608f, 1.313759f, 1.320949f, + 1.328178f, 1.335447f, 1.342756f, 1.350104f, 1.357493f, 1.364922f, 1.372392f, 1.379903f, 1.387455f, + 1.395048f, 1.402683f, 1.410360f, 1.418078f, 1.425839f, 1.433642f, 1.441488f, 1.449377f, 1.457309f, + 1.465285f, 1.473304f, 1.481367f, 1.489474f, 1.497626f, 1.505822f, 1.514063f, 1.522349f, 1.530681f, + 1.539058f, 1.547481f, 1.555950f, 1.564465f, 1.573027f, 1.581636f, 1.590292f, 1.598995f, 1.607746f, + 1.616545f, 1.625392f, 1.634287f, 1.643231f, 1.652224f, 1.661266f, 1.670358f, 1.679500f, 1.688691f, + 1.697933f, 1.707225f, 1.716569f, 1.725963f, 1.735409f, 1.744906f, 1.754456f, 1.764058f, 1.773712f, + 1.783419f, 1.793179f, 1.802993f, 1.812860f, 1.822782f, 1.832757f, 1.842788f, 1.852873f, 1.863013f, + 1.873209f, 1.883461f, 1.893768f, 1.904132f, 1.914553f, 1.925031f, 1.935567f, 1.946159f, 1.956810f, + 1.967520f, 1.978287f, 1.989114f, 2.0f +}; +#endif + +#ifdef VERSION_SH +f32 unk_sh_data_1[] = { + 0.890899f, 0.890899f, 0.89171f, 0.892521f, 0.893333f, 0.894146f, 0.89496f, 0.895774f, + 0.89659f, 0.897406f, 0.898222f, 0.89904f, 0.899858f, 0.900677f, 0.901496f, 0.902317f, + 0.903138f, 0.90396f, 0.904783f, 0.905606f, 0.90643f, 0.907255f, 0.908081f, 0.908907f, + 0.909734f, 0.910562f, 0.911391f, 0.91222f, 0.91305f, 0.913881f, 0.914713f, 0.915545f, + 0.916379f, 0.917213f, 0.918047f, 0.918883f, 0.919719f, 0.920556f, 0.921394f, 0.922232f, + 0.923072f, 0.923912f, 0.924752f, 0.925594f, 0.926436f, 0.927279f, 0.928123f, 0.928968f, + 0.929813f, 0.93066f, 0.931507f, 0.932354f, 0.933203f, 0.934052f, 0.934902f, 0.935753f, + 0.936604f, 0.937457f, 0.93831f, 0.939164f, 0.940019f, 0.940874f, 0.94173f, 0.942587f, + 0.943445f, 0.944304f, 0.945163f, 0.946023f, 0.946884f, 0.947746f, 0.948608f, 0.949472f, + 0.950336f, 0.951201f, 0.952066f, 0.952933f, 0.9538f, 0.954668f, 0.955537f, 0.956406f, + 0.957277f, 0.958148f, 0.95902f, 0.959893f, 0.960766f, 0.961641f, 0.962516f, 0.963392f, + 0.964268f, 0.965146f, 0.966024f, 0.966903f, 0.967783f, 0.968664f, 0.969546f, 0.970428f, + 0.971311f, 0.972195f, 0.97308f, 0.973965f, 0.974852f, 0.975739f, 0.976627f, 0.977516f, + 0.978405f, 0.979296f, 0.980187f, 0.981079f, 0.981972f, 0.982865f, 0.98376f, 0.984655f, + 0.985551f, 0.986448f, 0.987346f, 0.988244f, 0.989144f, 0.990044f, 0.990945f, 0.991847f, + 0.992749f, 0.993653f, 0.994557f, 0.995462f, 0.996368f, 0.997275f, 0.998182f, 0.999091f, + 1.0f, 1.00091f, 1.001821f, 1.002733f, 1.003645f, 1.004559f, 1.005473f, 1.006388f, + 1.007304f, 1.00822f, 1.009138f, 1.010056f, 1.010975f, 1.011896f, 1.012816f, 1.013738f, + 1.014661f, 1.015584f, 1.016508f, 1.017433f, 1.018359f, 1.019286f, 1.020214f, 1.021142f, + 1.022071f, 1.023002f, 1.023933f, 1.024864f, 1.025797f, 1.026731f, 1.027665f, 1.0286f, + 1.029536f, 1.030473f, 1.031411f, 1.03235f, 1.033289f, 1.03423f, 1.035171f, 1.036113f, + 1.037056f, 1.038f, 1.038944f, 1.03989f, 1.040836f, 1.041783f, 1.042731f, 1.04368f, + 1.04463f, 1.045581f, 1.046532f, 1.047485f, 1.048438f, 1.049392f, 1.050347f, 1.051303f, + 1.05226f, 1.053217f, 1.054176f, 1.055135f, 1.056095f, 1.057056f, 1.058018f, 1.058981f, + 1.059945f, 1.06091f, 1.061875f, 1.062842f, 1.063809f, 1.064777f, 1.065746f, 1.066716f, + 1.067687f, 1.068658f, 1.069631f, 1.070604f, 1.071578f, 1.072554f, 1.07353f, 1.074507f, + 1.075485f, 1.076463f, 1.077443f, 1.078424f, 1.079405f, 1.080387f, 1.08137f, 1.082355f, + 1.08334f, 1.084325f, 1.085312f, 1.0863f, 1.087289f, 1.088278f, 1.089268f, 1.09026f, + 1.091252f, 1.092245f, 1.093239f, 1.094234f, 1.09523f, 1.096226f, 1.097224f, 1.098223f, + 1.099222f, 1.100222f, 1.101224f, 1.102226f, 1.103229f, 1.104233f, 1.105238f, 1.106244f, + 1.10725f, 1.108258f, 1.109267f, 1.110276f, 1.111287f, 1.112298f, 1.11331f, 1.114323f, + 1.115337f, 1.116352f, 1.117368f, 1.118385f, 1.119403f, 1.120422f, 1.121441f, 1.122462f, +}; + +// Shindou moved these variables down here. :/ +// clang-format off +f32 gNoteFrequencies[128] = { + 0.105112f, 0.111362f, 0.117984f, 0.125f, 0.132433f, 0.140308f, 0.148651f, 0.15749f, 0.166855f, 0.176777f, 0.187288f, 0.198425f, + 0.210224f, 0.222725f, 0.235969f, 0.25f, 0.264866f, 0.280616f, 0.297302f, 0.31498f, 0.33371f, 0.353553f, 0.374577f, 0.39685f, + 0.420448f, 0.445449f, 0.471937f, 0.5f, 0.529732f, 0.561231f, 0.594604f, 0.629961f, 0.66742f, 0.707107f, 0.749154f, 0.793701f, + 0.840897f, 0.890899f, 0.943875f, 1.0f, 1.059463f, 1.122462f, 1.189207f, 1.259921f, 1.33484f, 1.414214f, 1.498307f, 1.587401f, + 1.681793f, 1.781798f, 1.887749f, 2.0f, 2.118926f, 2.244924f, 2.378414f, 2.519842f, 2.66968f, 2.828428f, 2.996615f, 3.174803f, + 3.363586f, 3.563596f, 3.775498f, 4.0f, 4.237853f, 4.489849f, 4.756829f, 5.039685f, 5.33936f, 5.656855f, 5.993229f, 6.349606f, + 6.727173f, 7.127192f, 7.550996f, 8.0f, 8.475705f, 8.979697f, 9.513658f, 10.07937f, 10.67872f, 11.31371f, 11.986459f, 12.699211f, + 13.454346f, 14.254383f, 15.101993f, 16.0f, 16.95141f, 17.959394f, 19.027315f, 20.15874f, 21.35744f, 22.62742f, 23.972918f, 25.398422f, + 26.908691f, 28.508766f, 30.203985f, 32.0f, 33.90282f, 35.91879f, 38.05463f, 40.31748f, 42.71488f, 45.25484f, 47.945835f, 50.796844f, + 53.817383f, 57.017532f, 60.40797f, 64.0f, 67.80564f, 71.83758f, 76.10926f, 80.63496f, 85.42976f, 45.25484f, 47.945835f, 50.796844f, + 53.817383f, 57.017532f, 60.40797f, 64.0f, 67.80564f, 71.83758f, 76.10926f, 80.63496f +}; +// clang-format on + +u8 gDefaultShortNoteVelocityTable[16] = { + 12, 25, 38, 51, 57, 64, 71, 76, 83, 89, 96, 102, 109, 115, 121, 127, +}; + +u8 gDefaultShortNoteDurationTable[16] = { + 229, 203, 177, 151, 139, 126, 113, 100, 87, 74, 61, 48, 36, 23, 10, 0, +}; + +struct AdsrEnvelope gDefaultEnvelope[] = { + { BSWAP16(4), BSWAP16(32000) }, // go from 0 to 32000 over the course of 16ms + { BSWAP16(1000), BSWAP16(32000) }, // stay there for 4.16 seconds + { BSWAP16(ADSR_HANG), 0 } // then continue staying there +}; + +u8 unk_sh_data2[4] = { 0, 0, 0, 0 }; + +struct NoteSubEu gZeroNoteSub = { 0 }; +struct NoteSubEu gDefaultNoteSub = { + 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { NULL }, +#ifdef VERSION_SH + 0 +#endif +}; + +u16 gHeadsetPanQuantization[0x40] = { +0x3C, 0x3A, 0x38, 0x36, 0x34, 0x32, 0x30, 0x2E, +0x2C, 0x2A, 0x28, 0x26, 0x24, 0x22, 0x20, 0x1E, +0x1C, 0x1A, 0x18, 0x16, 0x14, 0x12, 0x10, 0x0E, +0x0C, 0x0A, 0x08, 0x06, 0x04, 0x02, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; +#endif + #ifdef VERSION_EU u8 euUnknownData_8030194c[4] = { 0x40, 0x20, 0x10, 0x08 }; u16 gHeadsetPanQuantization[0x12] = { 0x40, 0x40, 0x30, 0x30, 0x20, 0x20, 0x10, 0, 0, 0, 0x30, 0x30, }; -s32 euUnknownData_80301950[32] = { //maybe envelope of some kind? - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 500, 0, 0, 0, 500, 0, 0, 0, 500, 0, 0, 0, 500, 0, 0, -}; -#else +#elif !defined(VERSION_SH) u16 gHeadsetPanQuantization[12] = { 0x40, 0x30, 0x20, 0x10, 0, 0, 0, 0, 0, 0, 0x20, 0x20 }; #endif +#if defined(VERSION_EU) || defined(VERSION_SH) +s16 euUnknownData_80301950[64] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0, +}; +#endif + // Linearly interpolated between // f(0/2 * 127) = 1 // f(1/2 * 127) = 1/sqrt(2) @@ -460,7 +589,7 @@ f32 gDefaultPanVolume[128] = { 0.012368f, 0.0f }; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) // gVolRampingLhs136[k] = 2^16 * max(1, (256*k)^(1/17) f32 gVolRampingLhs136[128] = { 65536.0f, 90811.555f, 94590.766f, 96873.96f, 98527.26f, 99829.06f, 100905.47f, @@ -588,18 +717,196 @@ f32 gVolRampingRhs128[128] = { }; #endif +#ifdef VERSION_SH +u16 unk_sh_data_3[] = { + // 30 entries + // pattern: + // A B + // C D + // C B + // A E + 0x1000, 0x1000, + 0x1000, 0x1000, + 0x1000, 0x1000, + 0x1000, 0x1000, + + 0x0E6F, 0x1091, + 0x11EF, 0x1267, + 0x11EF, 0x1091, + 0x0E6F, 0x0BB8, + + 0x0C1D, 0x111D, + 0x1494, 0x15D2, + 0x1494, 0x111D, + 0x0C1D, 0x068E, + + 0x0838, 0x116E, + 0x18A6, 0x1B61, + 0x18A6, 0x116E, + 0x0838, 0x0001, + + 0x0227, 0x0F42, + 0x1B75, 0x206B, + 0x1B75, 0x0F42, + 0x0227, 0xFA2B, + + 0xFC28, 0x0AAE, + 0x1BE7, 0x2394, + 0x1BE7, 0x0AAE, + 0xFC28, 0xF874, + + 0xF809, 0x0582, + 0x1C36, 0x2788, + 0x1C36, 0x0582, + 0xF809, 0xFAEB, + + 0xF5F0, 0x0001, + 0x1E34, 0x2F71, + 0x1E34, 0x0001, + 0xF5F0, 0x0000, + + 0xF8AD, 0xFAF3, + 0x19ED, 0x2EB6, + 0x19ED, 0xFAF3, + 0xF8AD, 0x04AC, + + 0xFCC0, 0xF6FF, + 0x178B, 0x3207, + 0x178B, 0xF6FF, + 0xFCC0, 0x065F, + + 0x01A5, 0xF44E, + 0x1510, 0x36B4, + 0x1510, 0xF44E, + 0x01A5, 0x047B, + + 0x05C1, 0xF3CC, + 0x1145, 0x3988, + 0x1145, 0xF3CC, + 0x05C1, 0x0001, + + 0x07B9, 0xF517, + 0x0D20, 0x3C4C, + 0x0D20, 0xF517, + 0x07B9, 0xFBD4, + + 0x07C0, 0xF71C, + 0x09A1, 0x4528, + 0x09A1, 0xF71C, + 0x07C0, 0xF9B7, + + 0x058F, 0xFA43, + 0x05DC, 0x585F, + 0x05DC, 0xFA43, + 0x058F, 0xFAB3, +}; + +u16 unk_sh_data_4[] = { + 0xFA73, 0xFA42, + 0xFA27, 0x5866, + 0xFA27, 0xFA42, + 0xFA73, 0xFAB2, + + 0xF842, 0xF71B, + 0xF661, 0x452B, + 0xF661, 0xF71B, + 0xF842, 0xF9B5, + + 0xF848, 0xF516, + 0xF2E1, 0x3C4D, + 0xF2E1, 0xF516, + 0xF848, 0xFBD2, + + 0xFA3F, 0xF3CA, + 0xEEBD, 0x3989, + 0xEEBD, 0xF3CA, + 0xFA3F, 0xFFFF, + + 0xFE5B, 0xF44C, + 0xEAF2, 0x36B5, + 0xEAF2, 0xF44C, + 0xFE5B, 0x0479, + + 0x0340, 0xF6FD, + 0xE877, 0x3207, + 0xE877, 0xF6FD, + 0x0340, 0x065E, + + 0x0753, 0xFAF1, + 0xE615, 0x2EB5, + 0xE615, 0xFAF1, + 0x0753, 0x04AB, + + 0x0A12, 0xFFFF, + 0xE1CD, 0x2F71, + 0xE1CD, 0xFFFF, + 0x0A12, 0x0000, + + 0x07FA, 0x057F, + 0xE3CA, 0x2789, + 0xE3CA, 0x057F, + 0x07FA, 0xFAEA, + + 0x03DB, 0x0AAC, + 0xE41A, 0x2394, + 0xE41A, 0x0AAC, + 0x03DB, 0xF873, + + 0xFDDC, 0x0F41, + 0xE489, 0x206E, + 0xE489, 0x0F41, + 0xFDDC, 0xFA28, + + 0xF7CA, 0x116E, + 0xE758, 0x1B63, + 0xE758, 0x116E, + 0xF7CA, 0xFFFF, + + 0xF3E4, 0x111D, + 0xEB6A, 0x15D4, + 0xEB6A, 0x111D, + 0xF3E4, 0x068B, + + 0xF192, 0x1092, + 0xEE11, 0x1268, + 0xEE11, 0x1092, + 0xF192, 0x0BB6, + + 0xF05F, 0x1026, + 0xEF89, 0x1093, + 0xEF89, 0x1026, + 0xF05F, 0x0EEB, + + 0x0000, 0x0000, + 0x0000, 0x0000, + 0x7FFF, 0xD001, + 0x3FFF, 0xF001, + 0x5FFF, 0x9001, + 0x7FFF, 0x8001 +}; + +char shindouDebugPrint1[] = "Terminate-Canceled Channel %d,Phase %d\n"; +char shindouDebugPrint2[] = "S->W\n"; +char shindouDebugPrint3[] = "W->S\n"; +char shindouDebugPrint4[] = "S-Resample Pitch %x (old %d -> delay %d)\n"; +// These debug prints are continued in shindou_debug_prints_1.c. +#endif + +#ifndef VERSION_SH s16 gTatumsPerBeat = TATUMS_PER_BEAT; s8 gUnusedCount80333EE8 = UNUSED_COUNT_80333EE8; s32 gAudioHeapSize = DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE); s32 gAudioInitPoolSize = DOUBLE_SIZE_ON_64_BIT(AUDIO_INIT_POOL_SIZE); volatile s32 gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED; +#endif -#ifdef VERSION_EU +#if defined(VERSION_EU) u8 bufferDelete2[12] = { 0 }; u8 D_EU_80302010 = 0; u8 D_EU_80302014 = 0; + struct OSMesgQueue *OSMesgQueues[4] = { &OSMesgQueue0, &OSMesgQueue1, &OSMesgQueue2, &OSMesgQueue3 }; -#else +#elif defined(VERSION_JP) || defined(VERSION_US) s8 sUnused8033EF8 = 24; #endif @@ -607,7 +914,7 @@ s8 sUnused8033EF8 = 24; volatile s32 gAudioFrameCount; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s32 gCurrAudioFrameDmaCount; #else volatile s32 gCurrAudioFrameDmaCount; @@ -622,7 +929,7 @@ u64 *gAudioCmd; struct SPTask *gAudioTask; struct SPTask gAudioTasks[2]; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) f32 D_EU_802298D0; s32 gRefreshRate; #endif @@ -630,15 +937,38 @@ s32 gRefreshRate; s16 *gAiBuffers[NUMAIBUFFERS]; s16 gAiBufferLengths[NUMAIBUFFERS]; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) u32 gUnused80226E58[0x10]; u16 gUnused80226E98[0x10]; #endif u32 gAudioRandom; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s32 gAudioErrorFlags; #endif +#ifdef VERSION_SH +volatile u32 gAudioLoadLockSH; +struct EuAudioCmd sAudioCmd[0x100]; +u8 D_SH_80350F18; +u8 D_SH_80350F19; + +OSMesg D_SH_80350F1C[1]; +OSMesgQueue D_SH_80350F20; // address written to D_SH_80350F38 +OSMesgQueue *D_SH_80350F38; + +OSMesg D_SH_80350F40[4]; +OSMesgQueue D_SH_80350F50; // address written to D_SH_80350F68 +OSMesgQueue *D_SH_80350F68; + +OSMesg D_SH_80350F6C[1]; +OSMesgQueue D_SH_80350F70; // address written to D_SH_80350F88 +OSMesgQueue *D_SH_80350F88; + +OSMesg D_SH_80350F8C[1]; +OSMesgQueue D_SH_80350F90; // address written to D_SH_80350F90 +OSMesgQueue *D_SH_80350FA8; +#endif + u64 gAudioGlobalsEndMarker; diff --git a/src/audio/data.h b/src/audio/data.h index b6731145..16be47c9 100644 --- a/src/audio/data.h +++ b/src/audio/data.h @@ -13,14 +13,14 @@ #define NUMAIBUFFERS 3 // constant .data -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) extern struct AudioSessionSettingsEU gAudioSessionPresets[]; #else extern struct AudioSessionSettings gAudioSessionPresets[18]; #endif extern u16 D_80332388[128]; // unused -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) extern f32 gPitchBendFrequencyScale[256]; #else extern f32 gPitchBendFrequencyScale[255]; @@ -32,17 +32,21 @@ extern u8 gDefaultShortNoteDurationTable[16]; extern s8 gVibratoCurve[16]; extern struct AdsrEnvelope gDefaultEnvelope[3]; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) extern s16 gEuUnknownWave7[256]; extern s16 *gWaveSamples[6]; #else extern s16 *gWaveSamples[4]; #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) extern u8 euUnknownData_8030194c[4]; +#ifdef VERSION_EU extern u16 gHeadsetPanQuantization[0x12]; -extern s32 euUnknownData_80301950[32]; +#else +extern u16 gHeadsetPanQuantization[0x40]; +#endif +extern s16 euUnknownData_80301950[64]; extern struct NoteSubEu gZeroNoteSub; extern struct NoteSubEu gDefaultNoteSub; #else @@ -70,7 +74,7 @@ extern volatile s32 gAudioLoadLock; extern volatile s32 gAudioFrameCount; // number of DMAs performed during this frame -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) extern s32 gCurrAudioFrameDmaCount; #else extern volatile s32 gCurrAudioFrameDmaCount; @@ -85,7 +89,7 @@ extern u64 *gAudioCmd; extern struct SPTask *gAudioTask; extern struct SPTask gAudioTasks[2]; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) extern f32 D_EU_802298D0; extern s32 gRefreshRate; #endif @@ -121,4 +125,34 @@ extern u32 gAudioRandom; // Normal Heap Size, Extended Heap Size, Extended Audio Init Pool Size #define AUDIO_HEAP_SIZE (AUDIO_HEAP_BASE + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE) +#ifdef VERSION_SH +extern f32 unk_sh_data_1[]; + +extern volatile u32 gAudioLoadLockSH; + +extern u8 D_SH_80350F18; +extern u8 D_SH_80350F19; + +extern OSMesg D_SH_80350F1C[1]; +extern OSMesgQueue D_SH_80350F20; // address written to D_SH_80350F38 +extern OSMesgQueue *D_SH_80350F38; + +extern OSMesg D_SH_80350F40[4]; +extern OSMesgQueue D_SH_80350F50; // address written to D_SH_80350F68 +extern OSMesgQueue *D_SH_80350F68; + +extern OSMesg D_SH_80350F6C[1]; +extern OSMesgQueue D_SH_80350F70; // address written to D_SH_80350F88 +extern OSMesgQueue *D_SH_80350F88; + +extern OSMesg D_SH_80350F8C[1]; +extern OSMesgQueue D_SH_80350F90; // address written to D_SH_80350F90 +extern OSMesgQueue *D_SH_80350FA8; + +extern u32 D_SH_80315EF0; +extern u16 D_SH_80315EF4; +extern u16 D_SH_80315EF8; +extern u16 D_SH_80315EFC; +#endif + #endif // AUDIO_DATA_H diff --git a/src/audio/effects.c b/src/audio/effects.c index 5010cf95..801d98b5 100644 --- a/src/audio/effects.c +++ b/src/audio/effects.c @@ -11,8 +11,8 @@ #define US_FLOAT2(x) x #endif -#ifdef VERSION_EU -static void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 recalculateVolume) { +#if defined(VERSION_EU) || defined(VERSION_SH) +void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 recalculateVolume) { f32 channelVolume; s32 i; @@ -22,7 +22,11 @@ static void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) { channelVolume = seqChannel->seqPlayer->muteVolumeScale * channelVolume; } +#ifdef VERSION_SH + seqChannel->appliedVolume = channelVolume * channelVolume; +#else seqChannel->appliedVolume = channelVolume; +#endif } if (seqChannel->changes.as_bitfields.pan) { @@ -82,9 +86,9 @@ static void sequence_channel_process_sound(struct SequenceChannel *seqChannel) { void sequence_player_process_sound(struct SequencePlayer *seqPlayer) { s32 i; - if (seqPlayer->fadeTimer != 0) { + if (seqPlayer->fadeRemainingFrames != 0) { seqPlayer->fadeVolume += seqPlayer->fadeVelocity; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->recalculateVolume = TRUE; #endif @@ -95,8 +99,8 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) { seqPlayer->fadeVolume = 0; } - if (--seqPlayer->fadeTimer == 0) { -#ifdef VERSION_EU + if (--seqPlayer->fadeRemainingFrames == 0) { +#if defined(VERSION_EU) || defined(VERSION_SH) if (seqPlayer->state == 2) { sequence_player_disable(seqPlayer); return; @@ -119,7 +123,7 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) { } } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (seqPlayer->recalculateVolume) { seqPlayer->appliedFadeVolume = seqPlayer->fadeVolume * seqPlayer->fadeVolumeScale; } @@ -129,7 +133,7 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) { for (i = 0; i < CHANNELS_MAX; i++) { if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE && seqPlayer->channels[i]->enabled == TRUE) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) sequence_channel_process_sound(seqPlayer->channels[i], seqPlayer->recalculateVolume); #else sequence_channel_process_sound(seqPlayer->channels[i]); @@ -137,7 +141,7 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) { } } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->recalculateVolume = FALSE; #endif } @@ -145,7 +149,7 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) { f32 get_portamento_freq_scale(struct Portamento *p) { u32 v0; f32 result; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) if (p->mode == 0) { return 1.0f; } @@ -154,7 +158,7 @@ f32 get_portamento_freq_scale(struct Portamento *p) { p->cur += p->speed; v0 = (u32) p->cur; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (v0 > 127) #else if (v0 >= 127) @@ -163,7 +167,7 @@ f32 get_portamento_freq_scale(struct Portamento *p) { v0 = 127; } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) result = US_FLOAT(1.0) + p->extent * (gPitchBendFrequencyScale[v0 + 128] - US_FLOAT(1.0)); #else result = US_FLOAT(1.0) + p->extent * (gPitchBendFrequencyScale[v0 + 127] - US_FLOAT(1.0)); @@ -171,7 +175,7 @@ f32 get_portamento_freq_scale(struct Portamento *p) { return result; } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s16 get_vibrato_pitch_change(struct VibratoState *vib) { s32 index; vib->time += (s32) vib->rate; @@ -251,7 +255,7 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) { pitchChange = get_vibrato_pitch_change(vib); extent = (f32) vib->extent / US_FLOAT(4096.0); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) result = US_FLOAT(1.0) + extent * (gPitchBendFrequencyScale[pitchChange + 128] - US_FLOAT(1.0)); #else result = US_FLOAT(1.0) + extent * (gPitchBendFrequencyScale[pitchChange + 127] - US_FLOAT(1.0)); @@ -260,7 +264,7 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) { } void note_vibrato_update(struct Note *note) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (note->portamento.mode != 0) { note->portamentoFreqScale = get_portamento_freq_scale(¬e->portamento); } @@ -280,7 +284,7 @@ void note_vibrato_update(struct Note *note) { void note_vibrato_init(struct Note *note) { struct VibratoState *vib; UNUSED struct SequenceChannel *seqChannel; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) struct NotePlaybackState *seqPlayerState = (struct NotePlaybackState *) ¬e->priority; #endif @@ -289,7 +293,7 @@ void note_vibrato_init(struct Note *note) { vib = ¬e->vibratoState; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) if (note->parentLayer->seqChannel->vibratoExtentStart == 0 && note->parentLayer->seqChannel->vibratoExtentTarget == 0 && note->parentLayer->portamento.mode == 0) { @@ -301,7 +305,7 @@ void note_vibrato_init(struct Note *note) { vib->active = TRUE; vib->time = 0; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) vib->curve = gWaveSamples[2]; vib->seqChannel = note->parentLayer->seqChannel; if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) { @@ -343,9 +347,12 @@ void note_vibrato_init(struct Note *note) { void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16 *volOut) { adsr->action = 0; adsr->state = ADSR_STATE_DISABLED; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) adsr->delay = 0; adsr->envelope = envelope; +#ifdef VERSION_SH + adsr->sustain = 0.0f; +#endif adsr->current = 0.0f; #else adsr->initial = 0; @@ -356,13 +363,13 @@ void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16 #endif } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) f32 adsr_update(struct AdsrState *adsr) { #else s32 adsr_update(struct AdsrState *adsr) { #endif u8 action = adsr->action; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) u8 state = adsr->state; switch (state) { #else @@ -372,7 +379,7 @@ s32 adsr_update(struct AdsrState *adsr) { return 0; case ADSR_STATE_INITIAL: { -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) adsr->current = adsr->initial; adsr->target = adsr->initial; #endif @@ -385,12 +392,15 @@ s32 adsr_update(struct AdsrState *adsr) { case ADSR_STATE_START_LOOP: adsr->envIndex = 0; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) adsr->currentHiRes = adsr->current << 0x10; #endif adsr->state = ADSR_STATE_LOOP; // fallthrough +#ifdef VERSION_SH + restart: +#endif case ADSR_STATE_LOOP: adsr->delay = BE_TO_HOST16(adsr->envelope[adsr->envIndex].delay); switch (adsr->delay) { @@ -402,17 +412,32 @@ s32 adsr_update(struct AdsrState *adsr) { break; case ADSR_GOTO: adsr->envIndex = BE_TO_HOST16(adsr->envelope[adsr->envIndex].arg); +#ifdef VERSION_SH + goto restart; +#else break; +#endif case ADSR_RESTART: adsr->state = ADSR_STATE_INITIAL; break; default: -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (adsr->delay >= 4) { - adsr->delay = adsr->delay * gAudioBufferParameters.updatesPerFrame / 4; + adsr->delay = adsr->delay * gAudioBufferParameters.updatesPerFrame +#ifdef VERSION_SH + / gAudioBufferParameters.presetUnk4 +#endif + / 4; } +#if defined(VERSION_SH) + if (adsr->delay == 0) { + adsr->delay = 1; + } + adsr->target = (f32) BE_TO_HOST16(adsr->envelope[adsr->envIndex].arg) / 32767.0f; +#elif defined(VERSION_EU) adsr->target = (f32) BE_TO_HOST16(adsr->envelope[adsr->envIndex].arg) / 32767.0; +#endif adsr->target = adsr->target * adsr->target; adsr->velocity = (adsr->target - adsr->current) / adsr->delay; #else @@ -429,7 +454,7 @@ s32 adsr_update(struct AdsrState *adsr) { // fallthrough case ADSR_STATE_FADE: -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) adsr->current += adsr->velocity; #else adsr->currentHiRes += adsr->velocity; @@ -446,14 +471,14 @@ s32 adsr_update(struct AdsrState *adsr) { case ADSR_STATE_DECAY: case ADSR_STATE_RELEASE: { adsr->current -= adsr->fadeOutVel; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (adsr->sustain != 0.0f && state == ADSR_STATE_DECAY) { #else if (adsr->sustain != 0 && adsr->state == ADSR_STATE_DECAY) { #endif if (adsr->current < adsr->sustain) { adsr->current = adsr->sustain; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) adsr->delay = 128; #else adsr->delay = adsr->sustain / 16; @@ -463,7 +488,12 @@ s32 adsr_update(struct AdsrState *adsr) { break; } -#ifdef VERSION_EU +#if defined(VERSION_SH) + if (adsr->current < 0.00001f) { + adsr->current = 0.0f; + adsr->state = ADSR_STATE_DISABLED; + } +#elif defined(VERSION_EU) if (adsr->current < 0) { adsr->current = 0.0f; adsr->state = ADSR_STATE_DISABLED; @@ -492,14 +522,14 @@ s32 adsr_update(struct AdsrState *adsr) { if ((action & ADSR_ACTION_RELEASE)) { adsr->state = ADSR_STATE_RELEASE; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) adsr->action = action & ~ADSR_ACTION_RELEASE; #else adsr->action = action & ~(ADSR_ACTION_RELEASE | ADSR_ACTION_DECAY); #endif } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (adsr->current < 0.0f) { return 0.0f; } diff --git a/src/audio/effects.h b/src/audio/effects.h index b858dbbd..b9524768 100644 --- a/src/audio/effects.h +++ b/src/audio/effects.h @@ -35,7 +35,7 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer); void note_vibrato_update(struct Note *note); void note_vibrato_init(struct Note *note); void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, s16 *volOut); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) f32 adsr_update(struct AdsrState *adsr); #else s32 adsr_update(struct AdsrState *adsr); diff --git a/src/audio/external.c b/src/audio/external.c index 5efb72c9..0d962c5f 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -14,18 +14,17 @@ #include "dialog_ids.h" #include "level_table.h" -#ifdef VERSION_EU -#define EU_FLOAT(x) x ## f +#if defined(VERSION_EU) || defined(VERSION_SH) +#define EU_FLOAT(x) x##f #else #define EU_FLOAT(x) x #endif // N.B. sound banks are different from the audio banks referred to in other // files. We should really fix our naming to be less ambiguous... -#define MAX_BG_MUSIC_QUEUE_SIZE 6 -#define SOUND_BANK_COUNT 12 +#define MAX_BACKGROUND_MUSIC_QUEUE_SIZE 6 +#define MAX_CHANNELS_PER_SOUND_BANK 1 #define SOUND_INDEX_COUNT 40 -#define MAX_CHANNELS_PER_SOUND 1 #define SEQUENCE_NONE 0xFF @@ -42,7 +41,7 @@ struct ChannelVolumeScaleFade { f32 velocity; u8 target; f32 current; - u16 remDuration; + u16 remainingFrames; }; // size = 0x10 struct SoundCharacteristics { @@ -53,19 +52,22 @@ struct SoundCharacteristics { u32 priority; u32 soundBits; // packed bits, same as first arg to play_sound u8 soundStatus; - u8 unk19; // ttl? sometimes set to 10 + u8 freshness; u8 prev; u8 next; f32 customFreqScale; }; // size = 0x1C +// Also the number of frames a discrete sound can be in the WAITING state before being deleted +#define SOUND_MAX_FRESHNESS 10 + struct SequenceQueueItem { u8 seqId; u8 priority; }; // size = 0x2 // data -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) // moved to bss in data.c s32 gAudioErrorFlags2 = 0; #else @@ -118,7 +120,8 @@ u8 sDialogSpeaker[] = { /*16*/ _, YOSHI, _, _, _, _, _, _, WIGLR, _ }; #undef _ -STATIC_ASSERT(ARRAY_COUNT(sDialogSpeaker) == DIALOG_COUNT, "change this array if you are adding dialogs"); +STATIC_ASSERT(ARRAY_COUNT(sDialogSpeaker) == DIALOG_COUNT, + "change this array if you are adding dialogs"); s32 sDialogSpeakerVoice[] = { SOUND_OBJ_UKIKI_CHATTER_LONG, @@ -132,7 +135,7 @@ s32 sDialogSpeakerVoice[] = { SOUND_OBJ2_BOSS_DIALOG_GRUNT, SOUND_OBJ_WIGGLER_TALK, SOUND_GENERAL_YOSHI_TALK, -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) NO_SOUND, NO_SOUND, NO_SOUND, @@ -168,10 +171,8 @@ u8 sSoundRequestCount = 0; (s16)(1 << (15 - cond1) | 1 << (15 - cond2) | 1 << (15 - cond3) | res), val1, val2, val3 s16 sDynBbh[] = { - SEQ_LEVEL_SPOOKY, - DYN1(MARIO_IS_IN_ROOM, BBH_OUTSIDE_ROOM, 6), - DYN1(MARIO_IS_IN_ROOM, BBH_NEAR_MERRY_GO_ROUND_ROOM, 6), - 5, + SEQ_LEVEL_SPOOKY, DYN1(MARIO_IS_IN_ROOM, BBH_OUTSIDE_ROOM, 6), + DYN1(MARIO_IS_IN_ROOM, BBH_NEAR_MERRY_GO_ROUND_ROOM, 6), 5, }; s16 sDynDdd[] = { SEQ_LEVEL_WATER, @@ -190,16 +191,12 @@ s16 sDynJrb[] = { 5, // bogus entry, ignored (was JRB originally intended to have spooky music?) }; s16 sDynWdw[] = { - SEQ_LEVEL_UNDERGROUND, - DYN2(MARIO_Y_LT, -670, MARIO_IS_IN_AREA, AREA_WDW_MAIN & 0xf, 4), - DYN1(MARIO_IS_IN_AREA, AREA_WDW_TOWN & 0xf, 4), - 3, + SEQ_LEVEL_UNDERGROUND, DYN2(MARIO_Y_LT, -670, MARIO_IS_IN_AREA, AREA_WDW_MAIN & 0xf, 4), + DYN1(MARIO_IS_IN_AREA, AREA_WDW_TOWN & 0xf, 4), 3, }; s16 sDynHmc[] = { - SEQ_LEVEL_UNDERGROUND, - DYN2(MARIO_X_GE, 0, MARIO_Y_LT, -203, 4), - DYN2(MARIO_X_LT, 0, MARIO_Y_LT, -2400, 4), - 3, + SEQ_LEVEL_UNDERGROUND, DYN2(MARIO_X_GE, 0, MARIO_Y_LT, -203, 4), + DYN2(MARIO_X_LT, 0, MARIO_Y_LT, -2400, 4), 3, }; s16 sDynUnk38[] = { SEQ_LEVEL_UNDERGROUND, @@ -218,8 +215,8 @@ u8 sBackgroundMusicForDynamics = SEQUENCE_NONE; #define _ sDynNone s16 *sLevelDynamics[LEVEL_COUNT] = { - _, // LEVEL_NONE - #include "levels/level_defines.h" + _, // LEVEL_NONE +#include "levels/level_defines.h" }; #undef _ #undef STUB_LEVEL @@ -248,7 +245,7 @@ struct MusicDynamic sMusicDynamics[8] = { #define STUB_LEVEL(_0, _1, _2, _3, echo1, echo2, echo3, _7, _8) { echo1, echo2, echo3 }, #define DEFINE_LEVEL(_0, _1, _2, _3, _4, _5, echo1, echo2, echo3, _9, _10) { echo1, echo2, echo3 }, -u8 gAreaEchoLevel[LEVEL_COUNT][3] = { +u8 sLevelAreaReverbs[LEVEL_COUNT][3] = { { 0x00, 0x00, 0x00 }, // LEVEL_NONE #include "levels/level_defines.h" }; @@ -258,9 +255,9 @@ u8 gAreaEchoLevel[LEVEL_COUNT][3] = { #define STUB_LEVEL(_0, _1, _2, volume, _4, _5, _6, _7, _8) volume, #define DEFINE_LEVEL(_0, _1, _2, _3, _4, volume, _6, _7, _8, _9, _10) volume, -u16 D_80332028[LEVEL_COUNT] = { - 20000, // LEVEL_NONE - #include "levels/level_defines.h" +u16 sLevelAcousticReaches[LEVEL_COUNT] = { + 20000, // LEVEL_NONE +#include "levels/level_defines.h" }; #undef STUB_LEVEL @@ -268,6 +265,20 @@ u16 D_80332028[LEVEL_COUNT] = { #define AUDIO_MAX_DISTANCE US_FLOAT(22000.0) +#ifdef VERSION_JP +#define LOW_VOLUME_REVERB 48.0 +#else +#define LOW_VOLUME_REVERB 40.0f +#endif + +#ifdef VERSION_JP +#define VOLUME_RANGE_UNK1 0.8f +#define VOLUME_RANGE_UNK2 1.0f +#else +#define VOLUME_RANGE_UNK1 0.9f +#define VOLUME_RANGE_UNK2 0.8f +#endif + // Default volume for background music sequences (playing on player 0). u8 sBackgroundMusicDefaultVolume[] = { 127, // SEQ_SOUND_PLAYER @@ -310,11 +321,11 @@ u8 sBackgroundMusicDefaultVolume[] = { STATIC_ASSERT(ARRAY_COUNT(sBackgroundMusicDefaultVolume) == SEQ_COUNT, "change this array if you are adding sequences"); -u8 sPlayer0CurSeqId = SEQUENCE_NONE; +u8 sCurrentBackgroundMusicSeqId = SEQUENCE_NONE; u8 sMusicDynamicDelay = 0; -u8 D_803320A4[SOUND_BANK_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // pointers to head of list -u8 D_803320B0[SOUND_BANK_COUNT] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; // pointers to head of list -u8 D_803320BC[SOUND_BANK_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // only used for debugging +u8 sSoundBankUsedListBack[SOUND_BANK_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +u8 sSoundBankFreeListFront[SOUND_BANK_COUNT] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; +u8 sNumSoundsInBank[SOUND_BANK_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // only used for debugging u8 sMaxChannelsForSoundBank[SOUND_BANK_COUNT] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; // Banks 2 and 7 both grew from 0x30 sounds to 0x40 in size in US. @@ -328,19 +339,25 @@ u8 sNumSoundsPerBank[SOUND_BANK_COUNT] = { }; #undef BANK27_SIZE -f32 gDefaultSoundArgs[3] = { 0.0f, 0.0f, 0.0f }; +// sBackgroundMusicMaxTargetVolume and sBackgroundMusicTargetVolume use the 0x80 +// bit to indicate that they are set, and the rest of the bits for the actual value +#define TARGET_VOLUME_IS_PRESENT_FLAG 0x80 +#define TARGET_VOLUME_VALUE_MASK 0x7f +#define TARGET_VOLUME_UNSET 0x00 + +f32 gGlobalSoundSource[3] = { 0.0f, 0.0f, 0.0f }; f32 sUnusedSoundArgs[3] = { 1.0f, 1.0f, 1.0f }; u8 sSoundBankDisabled[16] = { 0 }; u8 D_80332108 = 0; u8 sHasStartedFadeOut = FALSE; -u16 D_80332110 = 0; +u16 sSoundBanksThatLowerBackgroundMusic = 0; u8 sUnused80332114 = 0; // never read, set to 0 u16 sUnused80332118 = 0; // never read, set to 0 -u8 D_8033211C = 0; +u8 sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_UNSET; u8 D_80332120 = 0; u8 D_80332124 = 0; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) u8 D_EU_80300558 = 0; #endif @@ -350,39 +367,64 @@ u8 sBackgroundMusicQueueSize = 0; u8 sUnused8033323C = 0; // never read, set to 0 #endif + // bss -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) s16 *gCurrAiBuffer; #endif +#ifdef VERSION_SH +s8 D_SH_80343CD0_pad[0x20]; +s32 D_SH_80343CF0; +s8 D_SH_80343CF8_pad[0x8]; +struct UnkStruct80343D00 D_SH_80343D00; +s8 D_SH_8034DC8_pad[0x8]; +OSPiHandle DriveRomHandle; // used in osDriveRomInit.c. Why here? +s8 D_SH_80343E48_pad[0x8]; +#endif + struct Sound sSoundRequests[0x100]; // Curiously, this has size 3, despite SEQUENCE_PLAYERS == 4 on EU struct ChannelVolumeScaleFade D_80360928[3][CHANNELS_MAX]; u8 sUsedChannelsForSoundBank[SOUND_BANK_COUNT]; -u8 sCurrentSound[SOUND_BANK_COUNT][MAX_CHANNELS_PER_SOUND]; // index into gSoundBanks -// list item memory for D_803320A4 and D_803320B0 -struct SoundCharacteristics gSoundBanks[SOUND_BANK_COUNT][SOUND_INDEX_COUNT] = { 0 }; -u8 D_80363808[SOUND_BANK_COUNT]; -u8 D_80363812; -static u8 sCapVolumeTo40; -struct SequenceQueueItem sBackgroundMusicQueue[MAX_BG_MUSIC_QUEUE_SIZE]; +u8 sCurrentSound[SOUND_BANK_COUNT][MAX_CHANNELS_PER_SOUND_BANK]; // index into sSoundBanks + +/** + * For each sound bank, a pool containing the currently active sounds for that bank. + * The free and used slots in these pools are linked lists. The element sSoundBanks[bank][0] + * is used as a list header for the used list, and never holds an actual sound. See also + * sSoundBankUsedListBack and sSoundBankFreeListFront. + */ +struct SoundCharacteristics sSoundBanks[SOUND_BANK_COUNT][SOUND_INDEX_COUNT] = { 0 }; + +u8 sSoundMovingSpeed[SOUND_BANK_COUNT]; +u8 sBackgroundMusicTargetVolume; +static u8 sLowerBackgroundMusicVolume; +struct SequenceQueueItem sBackgroundMusicQueue[MAX_BACKGROUND_MUSIC_QUEUE_SIZE]; + +#if defined(VERSION_EU) || defined(VERSION_SH) +s32 unk_sh_8034754C; +#endif #ifdef VERSION_EU -s32 unk; OSMesgQueue OSMesgQueue0; OSMesgQueue OSMesgQueue1; OSMesgQueue OSMesgQueue2; OSMesgQueue OSMesgQueue3; extern OSMesgQueue *OSMesgQueues[]; + struct EuAudioCmd sAudioCmd[0x100]; + OSMesg OSMesg0; s32 pad1; // why is there 1 s32 here OSMesg OSMesg1; -s32 pad2[2]; // it's not just that the struct is bigger than we think, because there are 2 here +s32 pad2[2]; // it's not just that the struct is bigger than we think, because there are 2 here OSMesg OSMesg2; // and none here. wth nintendo OSMesg OSMesg3; +#else // VERSION_SH +extern OSMesgQueue *D_SH_80350F88; +extern OSMesgQueue *D_SH_80350FA8; #endif - #ifdef VERSION_JP typedef u16 FadeT; #else @@ -394,16 +436,11 @@ extern void func_802ad728(u32 bits, f32 arg); extern void func_802ad74c(u32 bits, u32 arg); extern void func_802ad770(u32 bits, s8 arg); -void func_8031E0E4(u8 bankIndex, u8 item); - -// Local functions that could be static but are defined in/called from GLOBAL_ASM blocks, -// or not part of the large block of static functions. -void update_game_sound(void); -void play_sequence(u8 player, u8 seqId, u16 fadeTimer); -void fade_channel_volume_scale(u8 player, u8 channelId, u8 targetScale, u16 fadeTimer); -void func_8031F96C(u8 player); +static void update_background_music_after_sound(u8 bank, u8 soundIndex); +static void update_game_sound(void); +static void fade_channel_volume_scale(u8 player, u8 channelId, u8 targetScale, u16 fadeTimer); void process_level_music_dynamics(void); -u8 func_803200E4(u16 fadeTimer); +static u8 begin_background_music_fade(u16 fadeDuration); void func_80320ED8(void); #ifndef VERSION_JP @@ -452,9 +489,15 @@ void unused_8031E4F0(void) { stubbed_printf("\n"); stubbed_printf("BNK "); - for (i = 0; i < 40; i += 4) { +#ifdef VERSION_SH +#define count 1 +#else +#define count 4 +#endif + for (i = 0; i < 40; i += count) { stubbed_printf("%1x", 0); } +#undef count stubbed_printf("\n"); stubbed_printf("FIXHEAP "); @@ -476,44 +519,60 @@ void unused_8031E568(void) { } #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) const char unusedErrorStr1[] = "Error : Queue is not empty ( %x ) \n"; const char unusedErrorStr2[] = "specchg error\n"; #endif - /** * Fade out a sequence player + * Called from threads: thread5_game_loop */ -#if defined(VERSION_EU) - +#if defined(VERSION_EU) || defined(VERSION_SH) void audio_reset_session_eu(s32 presetId) { OSMesg mesg; +#ifdef VERSION_SH + osRecvMesg(D_SH_80350FA8, &mesg, OS_MESG_NOBLOCK); + osSendMesg(D_SH_80350F88, (OSMesg) presetId, OS_MESG_NOBLOCK); + osRecvMesg(D_SH_80350FA8, &mesg, OS_MESG_BLOCK); + if ((s32) mesg != presetId) { + osRecvMesg(D_SH_80350FA8, &mesg, OS_MESG_BLOCK); + } +#else osRecvMesg(OSMesgQueues[3], &mesg, OS_MESG_NOBLOCK); osSendMesg(OSMesgQueues[2], (OSMesg) presetId, OS_MESG_NOBLOCK); osRecvMesg(OSMesgQueues[3], &mesg, OS_MESG_BLOCK); if ((s32) mesg != presetId) { osRecvMesg(OSMesgQueues[3], &mesg, OS_MESG_BLOCK); } +#endif } +#endif -#else - -void sequence_player_fade_out_internal(s32 player, FadeT fadeOutTime) { +#if defined(VERSION_JP) || defined(VERSION_US) +/** + * Called from threads: thread3_main, thread5_game_loop + */ +static void seq_player_fade_to_zero_volume(s32 player, FadeT fadeDuration) { struct SequencePlayer *seqPlayer = &gSequencePlayers[player]; + #ifndef VERSION_JP - if (fadeOutTime == 0) { - fadeOutTime++; + // fadeDuration is never 0 in practice + if (fadeDuration == 0) { + fadeDuration++; } #endif - seqPlayer->fadeVelocity = -(seqPlayer->fadeVolume / fadeOutTime); + seqPlayer->fadeVelocity = -(seqPlayer->fadeVolume / fadeDuration); seqPlayer->state = SEQUENCE_PLAYER_STATE_FADE_OUT; - seqPlayer->fadeTimer = fadeOutTime; + seqPlayer->fadeRemainingFrames = fadeDuration; } -void func_8031D690(s32 player, FadeT fadeInTime) { +/** + * Called from threads: thread4_sound, thread5_game_loop + */ +static void func_8031D690(s32 player, FadeT fadeInTime) { struct SequencePlayer *seqPlayer = &gSequencePlayers[player]; if (fadeInTime == 0 || seqPlayer->state == SEQUENCE_PLAYER_STATE_FADE_OUT) { @@ -521,17 +580,20 @@ void func_8031D690(s32 player, FadeT fadeInTime) { } seqPlayer->state = SEQUENCE_PLAYER_STATE_2; - seqPlayer->fadeTimer = fadeInTime; + seqPlayer->fadeRemainingFrames = fadeInTime; seqPlayer->fadeVolume = 0.0f; seqPlayer->fadeVelocity = 0.0f; } #endif -void func_8031D6E4(s32 player, FadeT fadeTimer, u8 fadePercentage) { +/** + * Called from threads: thread5_game_loop + */ +static void seq_player_fade_to_percentage_of_volume(s32 player, FadeT fadeDuration, u8 percentage) { struct SequencePlayer *seqPlayer = &gSequencePlayers[player]; - f32 fadeVolume; + f32 targetVolume; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (seqPlayer->state == 2) { return; } @@ -541,26 +603,31 @@ void func_8031D6E4(s32 player, FadeT fadeTimer, u8 fadePercentage) { } #endif - fadeVolume = (FLOAT_CAST(fadePercentage) / EU_FLOAT(100.0) * seqPlayer->fadeVolume); + targetVolume = (FLOAT_CAST(percentage) / EU_FLOAT(100.0)) * seqPlayer->fadeVolume; seqPlayer->volume = seqPlayer->fadeVolume; - seqPlayer->fadeTimer = 0; - if (fadeTimer == 0) { - seqPlayer->fadeVolume = fadeVolume; + + seqPlayer->fadeRemainingFrames = 0; + if (fadeDuration == 0) { + seqPlayer->fadeVolume = targetVolume; return; } - seqPlayer->fadeVelocity = (fadeVolume - seqPlayer->fadeVolume) / fadeTimer; -#ifdef VERSION_EU + seqPlayer->fadeVelocity = (targetVolume - seqPlayer->fadeVolume) / fadeDuration; +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->state = 0; #else seqPlayer->state = SEQUENCE_PLAYER_STATE_4; #endif - seqPlayer->fadeTimer = fadeTimer; + + seqPlayer->fadeRemainingFrames = fadeDuration; } -void func_8031D7B0(s32 player, FadeT fadeTimer) { +/** + * Called from threads: thread3_main, thread4_sound, thread5_game_loop + */ +static void seq_player_fade_to_normal_volume(s32 player, FadeT fadeDuration) { struct SequencePlayer *seqPlayer = &gSequencePlayers[player]; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (seqPlayer->state == 2) { return; } @@ -570,54 +637,71 @@ void func_8031D7B0(s32 player, FadeT fadeTimer) { } #endif - seqPlayer->fadeTimer = 0; - if (fadeTimer == 0) { + seqPlayer->fadeRemainingFrames = 0; + if (fadeDuration == 0) { seqPlayer->fadeVolume = seqPlayer->volume; return; } - seqPlayer->fadeVelocity = (seqPlayer->volume - seqPlayer->fadeVolume) / fadeTimer; -#ifdef VERSION_EU + seqPlayer->fadeVelocity = (seqPlayer->volume - seqPlayer->fadeVolume) / fadeDuration; +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->state = 0; #else seqPlayer->state = SEQUENCE_PLAYER_STATE_2; #endif - seqPlayer->fadeTimer = fadeTimer; + + seqPlayer->fadeRemainingFrames = fadeDuration; } -void func_8031D838(s32 player, FadeT fadeInTime, u8 targetVolume) { +/** + * Called from threads: thread3_main, thread4_sound, thread5_game_loop + */ +static void seq_player_fade_to_target_volume(s32 player, FadeT fadeDuration, u8 targetVolume) { struct SequencePlayer *seqPlayer = &gSequencePlayers[player]; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) if (seqPlayer->state == SEQUENCE_PLAYER_STATE_FADE_OUT) { return; } #endif - seqPlayer->fadeTimer = 0; - if (fadeInTime == 0) { + seqPlayer->fadeRemainingFrames = 0; + if (fadeDuration == 0) { seqPlayer->fadeVolume = (FLOAT_CAST(targetVolume) / EU_FLOAT(127.0)); return; } - seqPlayer->fadeVelocity = - (((f32)(FLOAT_CAST(targetVolume) / EU_FLOAT(127.0)) - seqPlayer->fadeVolume) / (f32) fadeInTime); -#ifdef VERSION_EU + seqPlayer->fadeVelocity = + (((f32)(FLOAT_CAST(targetVolume) / EU_FLOAT(127.0)) - seqPlayer->fadeVolume) + / (f32) fadeDuration); +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->state = 0; #else seqPlayer->state = SEQUENCE_PLAYER_STATE_4; #endif - seqPlayer->fadeTimer = fadeInTime; + + seqPlayer->fadeRemainingFrames = fadeDuration; } +#if defined(VERSION_EU) || defined(VERSION_SH) #ifdef VERSION_EU extern void func_802ad7a0(void); +#else +extern void func_sh_802F64C8(void); +#endif +/** + * Called from threads: thread5_game_loop + */ void maybe_tick_game_sound(void) { if (sGameLoopTicked != 0) { update_game_sound(); sGameLoopTicked = 0; } +#ifdef VERSION_EU func_802ad7a0(); +#else + func_sh_802F64C8(); // moved in SH +#endif } void func_eu_802e9bec(s32 player, s32 channel, s32 arg2) { @@ -628,6 +712,9 @@ void func_eu_802e9bec(s32 player, s32 channel, s32 arg2) { #else +/** + * Called from threads: thread4_sound + */ struct SPTask *create_next_audio_frame_task(void) { return NULL; } @@ -645,6 +732,9 @@ void create_next_audio_buffer(s16 *samples, u32 num_samples) { } #endif +/** + * Called from threads: thread5_game_loop + */ void play_sound(s32 soundBits, f32 *pos) { sSoundRequests[sSoundRequestCount].soundBits = soundBits; sSoundRequests[sSoundRequestCount].position = pos; @@ -659,67 +749,101 @@ void play_sound_with_freq_scale(s32 soundBits, f32* pos, f32 freqScale) { sSoundRequestCount++; } -void process_sound_request(u32 bits, f32 *pos, f32 freqScale) { - u8 bankIndex; - u8 index; +/** + * Called from threads: thread4_sound, thread5_game_loop (EU only) + */ +static void process_sound_request(u32 bits, f32 *pos, f32 freqScale) { + u8 bank; + u8 soundIndex; u8 counter = 0; u8 soundId; f32 dist; const f32 one = 1.0f; - bankIndex = (bits & SOUNDARGS_MASK_BANK) >> SOUNDARGS_SHIFT_BANK; + bank = (bits & SOUNDARGS_MASK_BANK) >> SOUNDARGS_SHIFT_BANK; soundId = (bits & SOUNDARGS_MASK_SOUNDID) >> SOUNDARGS_SHIFT_SOUNDID; - if (soundId >= sNumSoundsPerBank[bankIndex] || sSoundBankDisabled[bankIndex]) { + + if (soundId >= sNumSoundsPerBank[bank] || sSoundBankDisabled[bank]) { return; } - index = gSoundBanks[bankIndex][0].next; - while (index != 0xff && index != 0) { - if (gSoundBanks[bankIndex][index].x == pos) { - if ((gSoundBanks[bankIndex][index].soundBits & SOUNDARGS_MASK_PRIORITY) <= (bits & SOUNDARGS_MASK_PRIORITY)) { - if ((gSoundBanks[bankIndex][index].soundBits & SOUND_LO_BITFLAG_UNK8) != 0 || (bits & SOUNDARGS_MASK_SOUNDID) != (gSoundBanks[bankIndex][index].soundBits & SOUNDARGS_MASK_SOUNDID)) { - func_8031E0E4(bankIndex, index); - gSoundBanks[bankIndex][index].soundBits = bits; - gSoundBanks[bankIndex][index].soundStatus = bits & SOUNDARGS_MASK_STATUS; + soundIndex = sSoundBanks[bank][0].next; + while (soundIndex != 0xff && soundIndex != 0) { + // If an existing sound from the same source exists in the bank, then we should either + // interrupt that sound and replace it with the new sound, or we should drop the new sound. + if (sSoundBanks[bank][soundIndex].x == pos) { + // If the existing sound has lower or equal priority, then we should replace it. + // Otherwise the new sound will be dropped. + if ((sSoundBanks[bank][soundIndex].soundBits & SOUNDARGS_MASK_PRIORITY) + <= (bits & SOUNDARGS_MASK_PRIORITY)) { + + // If the existing sound is discrete or is a different continuous sound, then + // interrupt it and play the new sound instead. + // Otherwise the new sound is continuous and equals the existing sound, so we just + // need to update the sound's freshness. + if ((sSoundBanks[bank][soundIndex].soundBits & SOUND_DISCRETE) != 0 + || (bits & SOUNDARGS_MASK_SOUNDID) + != (sSoundBanks[bank][soundIndex].soundBits & SOUNDARGS_MASK_SOUNDID)) { + update_background_music_after_sound(bank, soundIndex); + sSoundBanks[bank][soundIndex].soundBits = bits; + // In practice, the starting status is always WAITING + sSoundBanks[bank][soundIndex].soundStatus = bits & SOUNDARGS_MASK_STATUS; } - gSoundBanks[bankIndex][index].unk19 = 10; - gSoundBanks[bankIndex][index].customFreqScale = freqScale; + + // Reset freshness: + // - For discrete sounds, this gives the sound SOUND_MAX_FRESHNESS frames to play + // before it gets deleted for being stale + // - For continuous sounds, this gives it another 2 frames before play_sound must + // be called again to keep it playing + sSoundBanks[bank][soundIndex].freshness = SOUND_MAX_FRESHNESS; + sSoundBanks[bank][soundIndex].customFreqScale = freqScale; } - index = 0; + + // Prevent allocating a new node - if the existing sound had higher piority, then the + // new sound will be dropped + soundIndex = 0; } else { - index = gSoundBanks[bankIndex][index].next; + soundIndex = sSoundBanks[bank][soundIndex].next; } counter++; } if (counter == 0) { - D_80363808[bankIndex] = 32; + sSoundMovingSpeed[bank] = 32; } - if (gSoundBanks[bankIndex][D_803320B0[bankIndex]].next != 0xff && index != 0) { - index = D_803320B0[bankIndex]; + // If free list has more than one element remaining + if (sSoundBanks[bank][sSoundBankFreeListFront[bank]].next != 0xff && soundIndex != 0) { + // Allocate from free list + soundIndex = sSoundBankFreeListFront[bank]; + dist = sqrtf(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]) * one; - gSoundBanks[bankIndex][index].x = &pos[0]; - gSoundBanks[bankIndex][index].y = &pos[1]; - gSoundBanks[bankIndex][index].z = &pos[2]; - gSoundBanks[bankIndex][index].distance = dist; - gSoundBanks[bankIndex][index].soundBits = bits; - gSoundBanks[bankIndex][index].soundStatus = bits & SOUNDARGS_MASK_STATUS; - gSoundBanks[bankIndex][index].unk19 = 10; - gSoundBanks[bankIndex][index].customFreqScale = freqScale; - gSoundBanks[bankIndex][index].prev = D_803320A4[bankIndex]; - gSoundBanks[bankIndex][D_803320A4[bankIndex]].next = D_803320B0[bankIndex]; - D_803320A4[bankIndex] = D_803320B0[bankIndex]; - D_803320B0[bankIndex] = gSoundBanks[bankIndex][D_803320B0[bankIndex]].next; - gSoundBanks[bankIndex][D_803320B0[bankIndex]].prev = 0xff; - gSoundBanks[bankIndex][index].next = 0xff; + sSoundBanks[bank][soundIndex].x = &pos[0]; + sSoundBanks[bank][soundIndex].y = &pos[1]; + sSoundBanks[bank][soundIndex].z = &pos[2]; + sSoundBanks[bank][soundIndex].distance = dist; + sSoundBanks[bank][soundIndex].soundBits = bits; + // In practice, the starting status is always WAITING + sSoundBanks[bank][soundIndex].soundStatus = bits & SOUNDARGS_MASK_STATUS; + sSoundBanks[bank][soundIndex].freshness = SOUND_MAX_FRESHNESS; + sSoundBanks[bank][soundIndex].customFreqScale = freqScale; + + // Append to end of used list and pop from front of free list + sSoundBanks[bank][soundIndex].prev = sSoundBankUsedListBack[bank]; + sSoundBanks[bank][sSoundBankUsedListBack[bank]].next = sSoundBankFreeListFront[bank]; + sSoundBankUsedListBack[bank] = sSoundBankFreeListFront[bank]; + sSoundBankFreeListFront[bank] = sSoundBanks[bank][sSoundBankFreeListFront[bank]].next; + sSoundBanks[bank][sSoundBankFreeListFront[bank]].prev = 0xff; + sSoundBanks[bank][soundIndex].next = 0xff; } } /** * Processes all sound requests + * + * Called from threads: thread4_sound, thread5_game_loop (EU only) */ -void process_all_sound_requests(void) { +static void process_all_sound_requests(void) { struct Sound *sound; while (sSoundRequestCount != sNumProcessedSoundRequests) { @@ -729,164 +853,229 @@ void process_all_sound_requests(void) { } } -void func_8031DFE8(u8 bankIndex, u8 item) { - // move item from list D_803320A4 to list D_803320B0 - if (D_803320A4[bankIndex] == item) { - D_803320A4[bankIndex] = gSoundBanks[bankIndex][item].prev; +/** + * Called from threads: thread4_sound, thread5_game_loop (EU only) + */ +static void delete_sound_from_bank(u8 bank, u8 soundIndex) { + if (sSoundBankUsedListBack[bank] == soundIndex) { + // Remove from end of used list + sSoundBankUsedListBack[bank] = sSoundBanks[bank][soundIndex].prev; } else { - gSoundBanks[bankIndex][gSoundBanks[bankIndex][item].next].prev = - gSoundBanks[bankIndex][item].prev; + // Set sound.next.prev to sound.prev + sSoundBanks[bank][sSoundBanks[bank][soundIndex].next].prev = sSoundBanks[bank][soundIndex].prev; } - gSoundBanks[bankIndex][gSoundBanks[bankIndex][item].prev].next = gSoundBanks[bankIndex][item].next; - gSoundBanks[bankIndex][item].next = D_803320B0[bankIndex]; - gSoundBanks[bankIndex][item].prev = -1; - gSoundBanks[bankIndex][D_803320B0[bankIndex]].prev = item; - D_803320B0[bankIndex] = item; + // Set sound.prev.next to sound.next + sSoundBanks[bank][sSoundBanks[bank][soundIndex].prev].next = sSoundBanks[bank][soundIndex].next; + + // Push to front of free list + sSoundBanks[bank][soundIndex].next = sSoundBankFreeListFront[bank]; + sSoundBanks[bank][soundIndex].prev = 0xff; + sSoundBanks[bank][sSoundBankFreeListFront[bank]].prev = soundIndex; + sSoundBankFreeListFront[bank] = soundIndex; } -void func_8031E0E4(u8 bankIndex, u8 item) { - if (gSoundBanks[bankIndex][item].soundBits & SOUND_LO_BITFLAG_UNK1) { - D_80332110 &= (1 << bankIndex) ^ 0xffff; - func_803200E4(50); +/** + * Called from threads: thread3_main, thread4_sound, thread5_game_loop + */ +static void update_background_music_after_sound(u8 bank, u8 soundIndex) { + if (sSoundBanks[bank][soundIndex].soundBits & SOUND_LOWER_BACKGROUND_MUSIC) { + sSoundBanksThatLowerBackgroundMusic &= (1 << bank) ^ 0xffff; + begin_background_music_fade(50); } } -void func_8031E16C(u8 bankIndex) { - u32 val2; - u8 spDB; +/** + * Called from threads: thread4_sound, thread5_game_loop (EU only) + */ +static void select_current_sounds(u8 bank) { + u32 isDiscreteAndStatus; + u8 latestSoundIndex; u8 i; u8 j; u8 soundIndex; - u32 sp98[16] = { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000, - 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000, - 0x10000000, 0x10000000, 0x10000000, 0x10000000 }; - u8 sp88[16] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - u8 sp78[16] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - u8 sp77 = 0; - u8 val; + u32 liveSoundPriorities[16] = { 0x10000000, 0x10000000, 0x10000000, 0x10000000, + 0x10000000, 0x10000000, 0x10000000, 0x10000000, + 0x10000000, 0x10000000, 0x10000000, 0x10000000, + 0x10000000, 0x10000000, 0x10000000, 0x10000000 }; + u8 liveSoundIndices[16] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + u8 liveSoundStatuses[16] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + u8 numSoundsInBank = 0; + u8 requestedPriority; - soundIndex = gSoundBanks[bankIndex][0].next; + // + // Delete stale sounds and prioritize remaining sounds into the liveSound arrays + // + soundIndex = sSoundBanks[bank][0].next; while (soundIndex != 0xff) { - spDB = soundIndex; + latestSoundIndex = soundIndex; - if ((gSoundBanks[bankIndex][soundIndex].soundBits - & (SOUND_LO_BITFLAG_UNK8 | SOUNDARGS_MASK_STATUS)) - == (SOUND_LO_BITFLAG_UNK8 | SOUND_STATUS_STARTING)) { - if (gSoundBanks[bankIndex][soundIndex].unk19-- == 0) { - gSoundBanks[bankIndex][soundIndex].soundBits = NO_SOUND; + // If a discrete sound goes 10 frames without being played (because it is too low + // priority), then mark it for deletion + if ((sSoundBanks[bank][soundIndex].soundBits & (SOUND_DISCRETE | SOUNDARGS_MASK_STATUS)) + == (SOUND_DISCRETE | SOUND_STATUS_WAITING)) { + if (sSoundBanks[bank][soundIndex].freshness-- == 0) { + sSoundBanks[bank][soundIndex].soundBits = NO_SOUND; } - } else if ((gSoundBanks[bankIndex][soundIndex].soundBits & SOUND_LO_BITFLAG_UNK8) == 0) { - if (gSoundBanks[bankIndex][soundIndex].unk19-- == 8) { - func_8031E0E4(bankIndex, soundIndex); - gSoundBanks[bankIndex][soundIndex].soundBits = NO_SOUND; + } + // If a continuous sound goes 2 frames without play_sound being called, then mark it for + // deletion + else if ((sSoundBanks[bank][soundIndex].soundBits & SOUND_DISCRETE) == 0) { + if (sSoundBanks[bank][soundIndex].freshness-- == SOUND_MAX_FRESHNESS - 2) { + update_background_music_after_sound(bank, soundIndex); + sSoundBanks[bank][soundIndex].soundBits = NO_SOUND; } } - if (gSoundBanks[bankIndex][soundIndex].soundBits == NO_SOUND - && gSoundBanks[bankIndex][soundIndex].soundStatus == SOUND_STATUS_STARTING) { - spDB = gSoundBanks[bankIndex][soundIndex].prev; - gSoundBanks[bankIndex][soundIndex].soundStatus = SOUND_STATUS_STOPPED; - func_8031DFE8(bankIndex, soundIndex); + // If a sound was marked for deletion and hasn't started playing yet, delete it now + if (sSoundBanks[bank][soundIndex].soundBits == NO_SOUND + && sSoundBanks[bank][soundIndex].soundStatus == SOUND_STATUS_WAITING) { + // Since the current sound will be deleted, the next iteration should process + // sound.prev.next + latestSoundIndex = sSoundBanks[bank][soundIndex].prev; + sSoundBanks[bank][soundIndex].soundStatus = SOUND_STATUS_STOPPED; + delete_sound_from_bank(bank, soundIndex); } - if (gSoundBanks[bankIndex][soundIndex].soundStatus != SOUND_STATUS_STOPPED - && soundIndex == spDB) { - gSoundBanks[bankIndex][soundIndex].distance = - sqrtf((*gSoundBanks[bankIndex][soundIndex].x * *gSoundBanks[bankIndex][soundIndex].x) - + (*gSoundBanks[bankIndex][soundIndex].y * *gSoundBanks[bankIndex][soundIndex].y) - + (*gSoundBanks[bankIndex][soundIndex].z * *gSoundBanks[bankIndex][soundIndex].z)) + // If the current sound was not just deleted, consider it as a candidate for the currently + // playing sound + if (sSoundBanks[bank][soundIndex].soundStatus != SOUND_STATUS_STOPPED + && soundIndex == latestSoundIndex) { + + // Recompute distance each frame since the sound's position may have changed + sSoundBanks[bank][soundIndex].distance = + sqrtf((*sSoundBanks[bank][soundIndex].x * *sSoundBanks[bank][soundIndex].x) + + (*sSoundBanks[bank][soundIndex].y * *sSoundBanks[bank][soundIndex].y) + + (*sSoundBanks[bank][soundIndex].z * *sSoundBanks[bank][soundIndex].z)) * 1; - val = (gSoundBanks[bankIndex][soundIndex].soundBits & SOUNDARGS_MASK_PRIORITY) - >> SOUNDARGS_SHIFT_PRIORITY; - if (gSoundBanks[bankIndex][soundIndex].soundBits & SOUND_NO_PRIORITY_LOSS) { - gSoundBanks[bankIndex][soundIndex].priority = 0x4c * (0xff - val); - } else if (*gSoundBanks[bankIndex][soundIndex].z > 0.0f) { - gSoundBanks[bankIndex][soundIndex].priority = - (u32) gSoundBanks[bankIndex][soundIndex].distance - + (u32)(*gSoundBanks[bankIndex][soundIndex].z / US_FLOAT(6.0)) - + 0x4c * (0xff - val); + requestedPriority = (sSoundBanks[bank][soundIndex].soundBits & SOUNDARGS_MASK_PRIORITY) + >> SOUNDARGS_SHIFT_PRIORITY; + + // Recompute priority, possibly based on the sound's source position relative to the + // camera. + // (Note that the sound's priority is the opposite of requestedPriority; lower is + // more important) + if (sSoundBanks[bank][soundIndex].soundBits & SOUND_NO_PRIORITY_LOSS) { + sSoundBanks[bank][soundIndex].priority = 0x4c * (0xff - requestedPriority); + } else if (*sSoundBanks[bank][soundIndex].z > 0.0f) { + sSoundBanks[bank][soundIndex].priority = + (u32) sSoundBanks[bank][soundIndex].distance + + (u32)(*sSoundBanks[bank][soundIndex].z / US_FLOAT(6.0)) + + 0x4c * (0xff - requestedPriority); } else { - gSoundBanks[bankIndex][soundIndex].priority = - (u32) gSoundBanks[bankIndex][soundIndex].distance + 0x4c * (0xff - val); + sSoundBanks[bank][soundIndex].priority = + (u32) sSoundBanks[bank][soundIndex].distance + 0x4c * (0xff - requestedPriority); } - for (i = 0; i < sMaxChannelsForSoundBank[bankIndex]; i++) { - if (sp98[i] >= gSoundBanks[bankIndex][soundIndex].priority) { - for (j = sMaxChannelsForSoundBank[bankIndex] - 1; j > i; j--) { - sp98[j] = sp98[j - 1]; - sp88[j] = sp88[j - 1]; - sp78[j] = sp78[j - 1]; + // Insert the sound into the liveSound arrays, keeping the arrays sorted by priority. + // If more than sMaxChannelsForSoundBank[bank] sounds are live, then the + // sound with lowest priority will be removed from the arrays. + // In practice sMaxChannelsForSoundBank is always 1, so this code is overly general. + for (i = 0; i < sMaxChannelsForSoundBank[bank]; i++) { + // If the correct position is found + if (liveSoundPriorities[i] >= sSoundBanks[bank][soundIndex].priority) { + // Shift remaining sounds to the right + for (j = sMaxChannelsForSoundBank[bank] - 1; j > i; j--) { + liveSoundPriorities[j] = liveSoundPriorities[j - 1]; + liveSoundIndices[j] = liveSoundIndices[j - 1]; + liveSoundStatuses[j] = liveSoundStatuses[j - 1]; } - sp98[i] = gSoundBanks[bankIndex][soundIndex].priority; - sp88[i] = soundIndex; - sp78[i] = gSoundBanks[bankIndex][soundIndex].soundStatus; - i = sMaxChannelsForSoundBank[bankIndex]; + // Insert the sound at index i + liveSoundPriorities[i] = sSoundBanks[bank][soundIndex].priority; + liveSoundIndices[i] = soundIndex; + liveSoundStatuses[i] = sSoundBanks[bank][soundIndex].soundStatus; // unused + // Break + i = sMaxChannelsForSoundBank[bank]; } } - sp77++; + + numSoundsInBank++; } - soundIndex = gSoundBanks[bankIndex][spDB].next; + + soundIndex = sSoundBanks[bank][latestSoundIndex].next; } - D_803320BC[bankIndex] = sp77; - sUsedChannelsForSoundBank[bankIndex] = sMaxChannelsForSoundBank[bankIndex]; + sNumSoundsInBank[bank] = numSoundsInBank; + sUsedChannelsForSoundBank[bank] = sMaxChannelsForSoundBank[bank]; - for (i = 0; i < sUsedChannelsForSoundBank[bankIndex]; i++) { - for (soundIndex = 0; soundIndex < sUsedChannelsForSoundBank[bankIndex]; soundIndex++) { - if (sp88[soundIndex] != 0xff && sCurrentSound[bankIndex][i] == sp88[soundIndex]) { - sp88[soundIndex] = 0xff; - soundIndex = 0xfe; + // + // Remove any sounds from liveSoundIndices that are already playing. + // Stop any currently playing sounds that are not in liveSoundIndices. + // + for (i = 0; i < sUsedChannelsForSoundBank[bank]; i++) { + // Check if sCurrentSound[bank][i] is present in the liveSound arrays. + for (soundIndex = 0; soundIndex < sUsedChannelsForSoundBank[bank]; soundIndex++) { + if (liveSoundIndices[soundIndex] != 0xff + && sCurrentSound[bank][i] == liveSoundIndices[soundIndex]) { + // If found, remove it from liveSoundIndices + liveSoundIndices[soundIndex] = 0xff; + soundIndex = 0xfe; // Break. Afterward soundIndex will be 0xff } } + // If it is not present in the liveSound arrays, then stop playing it if (soundIndex != 0xff) { - if (sCurrentSound[bankIndex][i] != 0xff) { - if (gSoundBanks[bankIndex][sCurrentSound[bankIndex][i]].soundBits == NO_SOUND) { - if (gSoundBanks[bankIndex][sCurrentSound[bankIndex][i]].soundStatus - == SOUND_STATUS_PLAYING) { - gSoundBanks[bankIndex][sCurrentSound[bankIndex][i]].soundStatus = - SOUND_STATUS_STOPPED; - func_8031DFE8(bankIndex, sCurrentSound[bankIndex][i]); + if (sCurrentSound[bank][i] != 0xff) { + // If the sound was marked for deletion and is playing, delete it + if (sSoundBanks[bank][sCurrentSound[bank][i]].soundBits == NO_SOUND) { + if (sSoundBanks[bank][sCurrentSound[bank][i]].soundStatus == SOUND_STATUS_PLAYING) { + sSoundBanks[bank][sCurrentSound[bank][i]].soundStatus = SOUND_STATUS_STOPPED; + delete_sound_from_bank(bank, sCurrentSound[bank][i]); } } - val2 = gSoundBanks[bankIndex][sCurrentSound[bankIndex][i]].soundBits - & (SOUND_LO_BITFLAG_UNK8 | SOUNDARGS_MASK_STATUS); - if (val2 >= (SOUND_LO_BITFLAG_UNK8 | SOUND_STATUS_PLAYING) - && gSoundBanks[bankIndex][sCurrentSound[bankIndex][i]].soundStatus - != SOUND_STATUS_STOPPED) { + + // If the sound is discrete and is playing, then delete it + isDiscreteAndStatus = sSoundBanks[bank][sCurrentSound[bank][i]].soundBits + & (SOUND_DISCRETE | SOUNDARGS_MASK_STATUS); + if (isDiscreteAndStatus >= (SOUND_DISCRETE | SOUND_STATUS_PLAYING) + && sSoundBanks[bank][sCurrentSound[bank][i]].soundStatus != SOUND_STATUS_STOPPED) { +//! @bug On JP, if a discrete sound that lowers the background music is +// interrupted in this way, it will keep the background music low afterward. +// There are only a few of these sounds, and it probably isn't possible to do +// it in practice without using a time stop glitch like triple star spawn. #ifndef VERSION_JP - func_8031E0E4(bankIndex, sCurrentSound[bankIndex][i]); + update_background_music_after_sound(bank, sCurrentSound[bank][i]); #endif - gSoundBanks[bankIndex][sCurrentSound[bankIndex][i]].soundBits = NO_SOUND; - gSoundBanks[bankIndex][sCurrentSound[bankIndex][i]].soundStatus = SOUND_STATUS_STOPPED; - func_8031DFE8(bankIndex, sCurrentSound[bankIndex][i]); - } else { - if (val2 == SOUND_STATUS_PLAYING - && gSoundBanks[bankIndex][sCurrentSound[bankIndex][i]].soundStatus + + sSoundBanks[bank][sCurrentSound[bank][i]].soundBits = NO_SOUND; + sSoundBanks[bank][sCurrentSound[bank][i]].soundStatus = SOUND_STATUS_STOPPED; + delete_sound_from_bank(bank, sCurrentSound[bank][i]); + } + // If the sound is continuous and is playing, then stop playing it but don't delete + // it. (A continuous sound shouldn't be deleted until it stops being requested) + else { + if (isDiscreteAndStatus == SOUND_STATUS_PLAYING + && sSoundBanks[bank][sCurrentSound[bank][i]].soundStatus != SOUND_STATUS_STOPPED) { - gSoundBanks[bankIndex][sCurrentSound[bankIndex][i]].soundStatus = - SOUND_STATUS_STARTING; + sSoundBanks[bank][sCurrentSound[bank][i]].soundStatus = SOUND_STATUS_WAITING; } } } - sCurrentSound[bankIndex][i] = 0xff; + sCurrentSound[bank][i] = 0xff; } } - for (soundIndex = 0; soundIndex < sUsedChannelsForSoundBank[bankIndex]; soundIndex++) { - if (sp88[soundIndex] != 0xff) { - for (i = 0; i < sUsedChannelsForSoundBank[bankIndex]; i++) { - if (sCurrentSound[bankIndex][i] == 0xff) { - sCurrentSound[bankIndex][i] = sp88[soundIndex]; - gSoundBanks[bankIndex][sp88[soundIndex]].soundBits = - (gSoundBanks[bankIndex][sp88[soundIndex]].soundBits & ~SOUNDARGS_MASK_STATUS) - + 1; - sp88[i] = 0xff; - i = 0xfe; // "break;" + // + // Start playing the remaining sounds from liveSoundIndices. + // + for (soundIndex = 0; soundIndex < sUsedChannelsForSoundBank[bank]; soundIndex++) { + if (liveSoundIndices[soundIndex] != 0xff) { + for (i = 0; i < sUsedChannelsForSoundBank[bank]; i++) { + if (sCurrentSound[bank][i] == 0xff) { + sCurrentSound[bank][i] = liveSoundIndices[soundIndex]; + + // Set (soundBits & status) to WAITING (soundStatus will be updated + // shortly after in update_game_sound) + sSoundBanks[bank][liveSoundIndices[soundIndex]].soundBits = + (sSoundBanks[bank][liveSoundIndices[soundIndex]].soundBits + & ~SOUNDARGS_MASK_STATUS) + + SOUND_STATUS_WAITING; + + liveSoundIndices[i] = 0xff; // doesn't do anything + i = 0xfe; // break } } } @@ -901,8 +1090,10 @@ void func_8031E16C(u8 bankIndex) { * 0.0 - fully left * 0.5 - center pan * 1.0 - fully right + * + * Called from threads: thread4_sound, thread5_game_loop (EU only) */ -f32 get_sound_pan(f32 x, f32 z) { +static f32 get_sound_pan(f32 x, f32 z) { f32 absX; f32 absZ; f32 pan; @@ -923,7 +1114,7 @@ f32 get_sound_pan(f32 x, f32 z) { // 3. far left pan: between 7:30 and 10:30 // 4. center pan: between 4:30 and 7:30 or between 10:30 and 1:30 if (x == US_FLOAT(0.0) && z == US_FLOAT(0.0)) { - // x and y being 0 results in a center pan + // x and z being 0 results in a center pan pan = US_FLOAT(0.5); } else if (x >= US_FLOAT(0.0) && absX >= absZ) { // far right pan @@ -939,37 +1130,44 @@ f32 get_sound_pan(f32 x, f32 z) { return pan; } -f32 get_sound_dynamics(u8 bankIndex, u8 item, f32 arg2) { - f32 f0; +/** + * Called from threads: thread4_sound, thread5_game_loop (EU only) + */ +static f32 get_sound_volume(u8 bank, u8 soundIndex, f32 volumeRange) { + f32 maxSoundDistance; f32 intensity; #ifndef VERSION_JP - s32 div = bankIndex < 3 ? 2 : 3; + s32 div = bank < 3 ? 2 : 3; #endif - if (!(gSoundBanks[bankIndex][item].soundBits & SOUND_NO_VOLUME_LOSS)) { + if (!(sSoundBanks[bank][soundIndex].soundBits & SOUND_NO_VOLUME_LOSS)) { #ifdef VERSION_JP - f0 = D_80332028[gCurrLevelNum]; - if (f0 < gSoundBanks[bankIndex][item].distance) { + // Intensity linearly lowers from 1 at the camera to 0 at maxSoundDistance + maxSoundDistance = sLevelAcousticReaches[gCurrLevelNum]; + if (maxSoundDistance < sSoundBanks[bank][soundIndex].distance) { intensity = 0.0f; } else { - intensity = 1.0 - gSoundBanks[bankIndex][item].distance / f0; + intensity = 1.0 - sSoundBanks[bank][soundIndex].distance / maxSoundDistance; } #else - if (gSoundBanks[bankIndex][item].distance > AUDIO_MAX_DISTANCE) { + // Intensity linearly lowers from 1 at the camera to 1 - volumeRange at maxSoundDistance, + // then it goes from 1 - volumeRange at maxSoundDistance to 0 at AUDIO_MAX_DISTANCE + if (sSoundBanks[bank][soundIndex].distance > AUDIO_MAX_DISTANCE) { intensity = 0.0f; } else { - f0 = D_80332028[gCurrLevelNum] / div; - if (f0 < gSoundBanks[bankIndex][item].distance) { - intensity = ((AUDIO_MAX_DISTANCE - gSoundBanks[bankIndex][item].distance) - / (AUDIO_MAX_DISTANCE - f0)) - * (1.0f - arg2); + maxSoundDistance = sLevelAcousticReaches[gCurrLevelNum] / div; + if (maxSoundDistance < sSoundBanks[bank][soundIndex].distance) { + intensity = ((AUDIO_MAX_DISTANCE - sSoundBanks[bank][soundIndex].distance) + / (AUDIO_MAX_DISTANCE - maxSoundDistance)) + * (1.0f - volumeRange); } else { - intensity = 1.0f - gSoundBanks[bankIndex][item].distance / f0 * arg2; + intensity = + 1.0f - sSoundBanks[bank][soundIndex].distance / maxSoundDistance * volumeRange; } } #endif - if (gSoundBanks[bankIndex][item].soundBits & SOUND_VIBRATO) { + if (sSoundBanks[bank][soundIndex].soundBits & SOUND_VIBRATO) { #ifdef VERSION_JP if (intensity != 0.0) #else @@ -983,34 +1181,41 @@ f32 get_sound_dynamics(u8 bankIndex, u8 item, f32 arg2) { intensity = 1.0f; } - return arg2 * intensity * intensity + 1.0f - arg2; + // Rise quadratically from 1 - volumeRange to 1 + return volumeRange * intensity * intensity + 1.0f - volumeRange; } -f32 get_sound_freq_scale(u8 bankIndex, u8 item) { - f32 f2; +/** + * Called from threads: thread4_sound, thread5_game_loop (EU only) + */ +static f32 get_sound_freq_scale(u8 bank, u8 item) { + f32 amount; - if (!(gSoundBanks[bankIndex][item].soundBits & SOUND_NO_FREQUENCY_LOSS)) { - f2 = gSoundBanks[bankIndex][item].distance / AUDIO_MAX_DISTANCE; - if (gSoundBanks[bankIndex][item].soundBits & SOUND_VIBRATO) { - f2 += (f32)(gAudioRandom & 0xff) / US_FLOAT(64.0); + if (!(sSoundBanks[bank][item].soundBits & SOUND_CONSTANT_FREQUENCY)) { + amount = sSoundBanks[bank][item].distance / AUDIO_MAX_DISTANCE; + if (sSoundBanks[bank][item].soundBits & SOUND_VIBRATO) { + amount += (f32)(gAudioRandom & 0xff) / US_FLOAT(64.0); } } else { - f2 = 0.0f; + amount = 0.0f; } - return f2 / US_FLOAT(15.0) + US_FLOAT(1.0); + + // Goes from 1 at the camera to 1 + 1/15 at AUDIO_MAX_DISTANCE (and continues rising + // farther than that) + return amount / US_FLOAT(15.0) + US_FLOAT(1.0); } -#ifdef VERSION_JP -#define VAL 48.0 -#else -#define VAL 40.0f -#endif -u8 get_sound_reverb(UNUSED u8 bankIndex, UNUSED u8 item, u8 channelIndex) { + +/** + * Called from threads: thread4_sound, thread5_game_loop (EU only) + */ +static u8 get_sound_reverb(UNUSED u8 bank, UNUSED u8 soundIndex, u8 channelIndex) { u8 area; u8 level; u8 reverb; #ifndef VERSION_JP - if (gSoundBanks[bankIndex][item].soundBits & SOUND_NO_ECHO) { + // Disable level reverb if NO_ECHO is set + if (sSoundBanks[bank][soundIndex].soundBits & SOUND_NO_ECHO) { level = 0; area = 0; } else { @@ -1023,9 +1228,14 @@ u8 get_sound_reverb(UNUSED u8 bankIndex, UNUSED u8 item, u8 channelIndex) { #ifndef VERSION_JP } #endif + + // reverb = reverb adjustment + level reverb + a volume-dependent value + // The volume-dependent value is 0 when volume is at maximum, and raises to + // LOW_VOLUME_REVERB when the volume is 0 reverb = (u8)((u8) gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[5] - + gAreaEchoLevel[level][area] - + (US_FLOAT(1.0) - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume) * VAL); + + sLevelAreaReverbs[level][area] + + (US_FLOAT(1.0) - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume) + * LOW_VOLUME_REVERB); if (reverb > 0x7f) { reverb = 0x7f; @@ -1033,345 +1243,382 @@ u8 get_sound_reverb(UNUSED u8 bankIndex, UNUSED u8 item, u8 channelIndex) { return reverb; } -#undef VAL static void noop_8031EEC8(void) { } +/** + * Called from the game loop thread to inform the audio thread that a new game + * frame has started. + * + * Called from threads: thread5_game_loop + */ void audio_signal_game_loop_tick(void) { sGameLoopTicked = 1; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) maybe_tick_game_sound(); #endif noop_8031EEC8(); } -#ifdef VERSION_JP -#define ARG2_VAL1 0.8f -#define ARG2_VAL2 1.0f -#else -#define ARG2_VAL1 0.9f -#define ARG2_VAL2 0.8f -#endif - -void update_game_sound(void) { +/** + * Called from threads: thread4_sound, thread5_game_loop (EU and SH only) + */ +static void update_game_sound(void) { u8 soundStatus; - u8 j; + u8 i; u8 soundId; - u8 bankIndex; + u8 bank; u8 channelIndex = 0; - u8 index; -#ifndef VERSION_EU - f32 ret; + u8 soundIndex; +#if defined(VERSION_JP) || defined(VERSION_US) + f32 value; #endif process_all_sound_requests(); process_level_music_dynamics(); + if (gSequencePlayers[SEQ_PLAYER_SFX].channels[0] == &gSequenceChannelNone) { return; } - for (bankIndex = 0; bankIndex < SOUND_BANK_COUNT; bankIndex++) { - func_8031E16C(bankIndex); - for (j = 0; j < MAX_CHANNELS_PER_SOUND; j++) { - index = sCurrentSound[bankIndex][j]; - if (index < SOUND_INDEX_COUNT && gSoundBanks[bankIndex][index].soundStatus != SOUND_STATUS_STOPPED) { - soundStatus = gSoundBanks[bankIndex][index].soundBits & SOUNDARGS_MASK_STATUS; - soundId = (gSoundBanks[bankIndex][index].soundBits >> SOUNDARGS_SHIFT_SOUNDID); - gSoundBanks[bankIndex][index].soundStatus = soundStatus; - if (soundStatus == SOUND_STATUS_STARTING) { - if (gSoundBanks[bankIndex][index].soundBits & SOUND_LO_BITFLAG_UNK1) { - D_80332110 |= 1 << bankIndex; - func_803200E4(50); + for (bank = 0; bank < SOUND_BANK_COUNT; bank++) { + select_current_sounds(bank); + + for (i = 0; i < MAX_CHANNELS_PER_SOUND_BANK; i++) { + soundIndex = sCurrentSound[bank][i]; + + if (soundIndex < SOUND_INDEX_COUNT && sSoundBanks[bank][soundIndex].soundStatus != SOUND_STATUS_STOPPED) { + soundStatus = sSoundBanks[bank][soundIndex].soundBits & SOUNDARGS_MASK_STATUS; + soundId = (sSoundBanks[bank][soundIndex].soundBits >> SOUNDARGS_SHIFT_SOUNDID); + + sSoundBanks[bank][soundIndex].soundStatus = soundStatus; + + if (soundStatus == SOUND_STATUS_WAITING) { + if (sSoundBanks[bank][soundIndex].soundBits & SOUND_LOWER_BACKGROUND_MUSIC) { + sSoundBanksThatLowerBackgroundMusic |= 1 << bank; + begin_background_music_fade(50); } - gSoundBanks[bankIndex][index].soundBits++; - gSoundBanks[bankIndex][index].soundStatus = SOUND_STATUS_PLAYING; + // Set sound status to PLAYING + sSoundBanks[bank][soundIndex].soundBits++; + sSoundBanks[bank][soundIndex].soundStatus = SOUND_STATUS_PLAYING; + + // Begin playing the sound gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[4] = soundId; gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 1; - switch (bankIndex) { - case 1: - if (!(gSoundBanks[bankIndex][index].soundBits & SOUND_NO_FREQUENCY_LOSS)) { - if (D_80363808[bankIndex] > 8) { -#ifdef VERSION_EU - func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), - get_sound_dynamics(bankIndex, index, ARG2_VAL1)); + switch (bank) { + case SOUND_BANK_MOVING: + if (!(sSoundBanks[bank][soundIndex].soundBits & SOUND_CONSTANT_FREQUENCY)) { + if (sSoundMovingSpeed[bank] > 8) { +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad728( + 0x02020000 | ((channelIndex & 0xff) << 8), + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1)); #else - ret = get_sound_dynamics(bankIndex, index, ARG2_VAL1); - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = ret; + value = get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1); + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = + value; #endif } else { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), - get_sound_dynamics(bankIndex, index, ARG2_VAL1) * - ((D_80363808[bankIndex] + 8.0f) / 16)); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1) + * ((sSoundMovingSpeed[bank] + 8.0f) / 16)); #else - ret = get_sound_dynamics(bankIndex, index, ARG2_VAL1); + value = get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = - (D_80363808[bankIndex] + 8.0f) / 16 * ret; + (sSoundMovingSpeed[bank] + 8.0f) / 16 * value; #endif } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), - get_sound_pan(*gSoundBanks[bankIndex][index].x, - *gSoundBanks[bankIndex][index].z)); + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z)); #else - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan( - *gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z); + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z); #endif - if ((gSoundBanks[bankIndex][index].soundBits & SOUNDARGS_MASK_SOUNDID) + if ((sSoundBanks[bank][soundIndex].soundBits & SOUNDARGS_MASK_SOUNDID) == (SOUND_MOVING_FLYING & SOUNDARGS_MASK_SOUNDID)) { -#ifdef VERSION_EU - func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index) + - ((f32) D_80363808[bankIndex] / US_FLOAT(80.0))); +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad728( + 0x04020000 | ((channelIndex & 0xff) << 8), + get_sound_freq_scale(bank, soundIndex) + + ((f32) sSoundMovingSpeed[bank] / US_FLOAT(80.0))); #else - ret = get_sound_freq_scale(bankIndex, index); + value = get_sound_freq_scale(bank, soundIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = - ((f32) D_80363808[bankIndex] / US_FLOAT(80.0)) + ret; + ((f32) sSoundMovingSpeed[bank] / US_FLOAT(80.0)) + value; #endif } else { -#ifdef VERSION_EU - func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index) + - ((f32) D_80363808[bankIndex] / US_FLOAT(400.0))); +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad728( + 0x04020000 | ((channelIndex & 0xff) << 8), + get_sound_freq_scale(bank, soundIndex) + + ((f32) sSoundMovingSpeed[bank] / US_FLOAT(400.0))); #else - ret = get_sound_freq_scale(bankIndex, index); + value = get_sound_freq_scale(bank, soundIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = - ((f32) D_80363808[bankIndex] / US_FLOAT(400.0)) + ret; + ((f32) sSoundMovingSpeed[bank] / US_FLOAT(400.0)) + value; #endif } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8), - get_sound_reverb(bankIndex, index, channelIndex)); + get_sound_reverb(bank, soundIndex, channelIndex)); #else gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb = - get_sound_reverb(bankIndex, index, channelIndex); + get_sound_reverb(bank, soundIndex, channelIndex); #endif break; } // fallthrough - case 7: -#ifdef VERSION_EU + case SOUND_BANK_MENU: +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), 1); func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), 64); func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index)); + get_sound_freq_scale(bank, soundIndex)); #else gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = 1.0f; gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = 0.5f; gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = 1.0f; #endif break; - case 0: - case 2: - case 10: // custom luigi audio bank 10 - case 11: // custom wario audio bank 11 -#ifdef VERSION_EU + case SOUND_BANK_ACTION: + case SOUND_BANK_MARIO_VOICE: + case SOUND_BANK_LUIGI_VOICE: + case SOUND_BANK_WARIO_VOICE: +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8), - get_sound_reverb(bankIndex, index, channelIndex)); + get_sound_reverb(bank, soundIndex, channelIndex)); func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), - get_sound_dynamics(bankIndex, index, ARG2_VAL1)); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1)); func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), - get_sound_pan(*gSoundBanks[bankIndex][index].x, - *gSoundBanks[bankIndex][index].z) * 127.0f + 0.5f); + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z) + * 127.0f + + 0.5f); func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index)); + get_sound_freq_scale(bank, soundIndex)); #else gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = - get_sound_dynamics(bankIndex, index, ARG2_VAL1); - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan( - *gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1); + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = - get_sound_freq_scale(bankIndex, index); + get_sound_freq_scale(bank, soundIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb = - get_sound_reverb(bankIndex, index, channelIndex); + get_sound_reverb(bank, soundIndex, channelIndex); #endif break; - case 3: - case 4: - case 5: - case 6: - case 8: - case 9: -#ifdef VERSION_EU + case SOUND_BANK_GENERAL: + case SOUND_BANK_ENV: + case SOUND_BANK_OBJ: + case SOUND_BANK_AIR: + case SOUND_BANK_GENERAL2: + case SOUND_BANK_OBJ2: +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8), - get_sound_reverb(bankIndex, index, channelIndex)); + get_sound_reverb(bank, soundIndex, channelIndex)); func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), - get_sound_dynamics(bankIndex, index, ARG2_VAL2)); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2)); func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), - get_sound_pan(*gSoundBanks[bankIndex][index].x, - *gSoundBanks[bankIndex][index].z) * 127.0f + 0.5f); + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z) + * 127.0f + + 0.5f); func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index)); + get_sound_freq_scale(bank, soundIndex)); #else gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb = - get_sound_reverb(bankIndex, index, channelIndex); + get_sound_reverb(bank, soundIndex, channelIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = - get_sound_dynamics(bankIndex, index, ARG2_VAL2); - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan( - *gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2); + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = - get_sound_freq_scale(bankIndex, index); + get_sound_freq_scale(bank, soundIndex); #endif break; } } #ifdef VERSION_JP + // If the sound was marked for deletion (bits set to NO_SOUND), then stop playing it + // and delete it else if (soundStatus == SOUND_STATUS_STOPPED) { - func_8031E0E4(bankIndex, index); + update_background_music_after_sound(bank, soundIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 0; - func_8031DFE8(bankIndex, index); + delete_sound_from_bank(bank, soundIndex); } #else else if (gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->layers[0] == NULL) { - func_8031E0E4(bankIndex, index); - gSoundBanks[bankIndex][index].soundStatus = SOUND_STATUS_STOPPED; - func_8031DFE8(bankIndex, index); + update_background_music_after_sound(bank, soundIndex); + sSoundBanks[bank][soundIndex].soundStatus = SOUND_STATUS_STOPPED; + delete_sound_from_bank(bank, soundIndex); } else if (soundStatus == SOUND_STATUS_STOPPED - && gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->layers[0]->finished + && gSequencePlayers[SEQ_PLAYER_SFX] + .channels[channelIndex] + ->layers[0] + ->finished == FALSE) { - func_8031E0E4(bankIndex, index); + update_background_music_after_sound(bank, soundIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 0; - func_8031DFE8(bankIndex, index); + delete_sound_from_bank(bank, soundIndex); } #endif - else if (gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->layers[0]->enabled == FALSE) { - func_8031E0E4(bankIndex, index); - gSoundBanks[bankIndex][index].soundStatus = SOUND_STATUS_STOPPED; - func_8031DFE8(bankIndex, index); + // If sound has finished playing, then delete it + else if (gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->layers[0]->enabled + == FALSE) { + update_background_music_after_sound(bank, soundIndex); + sSoundBanks[bank][soundIndex].soundStatus = SOUND_STATUS_STOPPED; + delete_sound_from_bank(bank, soundIndex); } else { // Exactly the same code as before. Unfortunately we can't // make a macro out of this, because then everything ends up // on the same line after preprocessing, and the compiler, // somehow caring about line numbers, makes it not match (it // computes function arguments in the wrong order). - switch (bankIndex) { - case 1: - if (!(gSoundBanks[bankIndex][index].soundBits & SOUND_NO_FREQUENCY_LOSS)) { - if (D_80363808[bankIndex] > 8) { -#ifdef VERSION_EU - func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), - get_sound_dynamics(bankIndex, index, ARG2_VAL1)); + switch (bank) { + case SOUND_BANK_MOVING: + if (!(sSoundBanks[bank][soundIndex].soundBits & SOUND_CONSTANT_FREQUENCY)) { + if (sSoundMovingSpeed[bank] > 8) { +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad728( + 0x02020000 | ((channelIndex & 0xff) << 8), + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1)); #else - ret = get_sound_dynamics(bankIndex, index, ARG2_VAL1); - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = ret; + value = get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1); + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = + value; #endif } else { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), - get_sound_dynamics(bankIndex, index, ARG2_VAL1) * - ((D_80363808[bankIndex] + 8.0f) / 16)); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1) + * ((sSoundMovingSpeed[bank] + 8.0f) / 16)); #else - ret = get_sound_dynamics(bankIndex, index, ARG2_VAL1); + value = get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = - (D_80363808[bankIndex] + 8.0f) / 16 * ret; + (sSoundMovingSpeed[bank] + 8.0f) / 16 * value; #endif } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), - get_sound_pan(*gSoundBanks[bankIndex][index].x, - *gSoundBanks[bankIndex][index].z)); + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z)); #else - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan( - *gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z); + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z); #endif - if ((gSoundBanks[bankIndex][index].soundBits & SOUNDARGS_MASK_SOUNDID) + if ((sSoundBanks[bank][soundIndex].soundBits & SOUNDARGS_MASK_SOUNDID) == (SOUND_MOVING_FLYING & SOUNDARGS_MASK_SOUNDID)) { -#ifdef VERSION_EU - func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index) + - ((f32) D_80363808[bankIndex] / US_FLOAT(80.0))); +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad728( + 0x04020000 | ((channelIndex & 0xff) << 8), + get_sound_freq_scale(bank, soundIndex) + + ((f32) sSoundMovingSpeed[bank] / US_FLOAT(80.0))); #else - ret = get_sound_freq_scale(bankIndex, index); + value = get_sound_freq_scale(bank, soundIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = - ((f32) D_80363808[bankIndex] / US_FLOAT(80.0)) + ret; + ((f32) sSoundMovingSpeed[bank] / US_FLOAT(80.0)) + value; #endif } else { -#ifdef VERSION_EU - func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index) + - ((f32) D_80363808[bankIndex] / US_FLOAT(400.0))); +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad728( + 0x04020000 | ((channelIndex & 0xff) << 8), + get_sound_freq_scale(bank, soundIndex) + + ((f32) sSoundMovingSpeed[bank] / US_FLOAT(400.0))); #else - ret = get_sound_freq_scale(bankIndex, index); + value = get_sound_freq_scale(bank, soundIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = - ((f32) D_80363808[bankIndex] / US_FLOAT(400.0)) + ret; + ((f32) sSoundMovingSpeed[bank] / US_FLOAT(400.0)) + value; #endif } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8), - get_sound_reverb(bankIndex, index, channelIndex)); + get_sound_reverb(bank, soundIndex, channelIndex)); #else gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb = - get_sound_reverb(bankIndex, index, channelIndex); + get_sound_reverb(bank, soundIndex, channelIndex); #endif break; } // fallthrough - case 7: -#ifdef VERSION_EU + case SOUND_BANK_MENU: +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), 1); func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), 64); func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index)); + get_sound_freq_scale(bank, soundIndex)); #else gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = 1.0f; gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = 0.5f; gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = 1.0f; #endif break; - case 0: - case 2: -#ifdef VERSION_EU + case SOUND_BANK_ACTION: + case SOUND_BANK_MARIO_VOICE: +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8), - get_sound_reverb(bankIndex, index, channelIndex)); + get_sound_reverb(bank, soundIndex, channelIndex)); func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), - get_sound_dynamics(bankIndex, index, ARG2_VAL1)); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1)); func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), - get_sound_pan(*gSoundBanks[bankIndex][index].x, - *gSoundBanks[bankIndex][index].z) * 127.0f + 0.5f); + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z) + * 127.0f + + 0.5f); func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index)); + get_sound_freq_scale(bank, soundIndex)); #else gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = - get_sound_dynamics(bankIndex, index, ARG2_VAL1); - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan( - *gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1); + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = - get_sound_freq_scale(bankIndex, index); + get_sound_freq_scale(bank, soundIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb = - get_sound_reverb(bankIndex, index, channelIndex); + get_sound_reverb(bank, soundIndex, channelIndex); #endif break; - case 3: - case 4: - case 5: - case 6: - case 8: - case 9: -#ifdef VERSION_EU + case SOUND_BANK_GENERAL: + case SOUND_BANK_ENV: + case SOUND_BANK_OBJ: + case SOUND_BANK_AIR: + case SOUND_BANK_GENERAL2: + case SOUND_BANK_OBJ2: +#if defined(VERSION_EU) || defined(VERSION_SH) func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8), - get_sound_reverb(bankIndex, index, channelIndex)); + get_sound_reverb(bank, soundIndex, channelIndex)); func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), - get_sound_dynamics(bankIndex, index, ARG2_VAL2)); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2)); func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), - get_sound_pan(*gSoundBanks[bankIndex][index].x, - *gSoundBanks[bankIndex][index].z) * 127.0f + 0.5f); + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z) + * 127.0f + + 0.5f); func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8), - get_sound_freq_scale(bankIndex, index)); + get_sound_freq_scale(bank, soundIndex)); #else gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb = - get_sound_reverb(bankIndex, index, channelIndex); + get_sound_reverb(bank, soundIndex, channelIndex); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = - get_sound_dynamics(bankIndex, index, ARG2_VAL2); - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan( - *gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z); + get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2); + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = + get_sound_pan(*sSoundBanks[bank][soundIndex].x, + *sSoundBanks[bank][soundIndex].z); gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale = - get_sound_freq_scale(bankIndex, index); + get_sound_freq_scale(bank, soundIndex); #endif break; } @@ -1379,113 +1626,140 @@ void update_game_sound(void) { } // add custom pitch bend - if (index < SOUND_INDEX_COUNT && gSoundBanks[bankIndex][index].customFreqScale != 0) { - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale *= gSoundBanks[bankIndex][index].customFreqScale; + if (soundIndex < SOUND_INDEX_COUNT && sSoundBanks[bank][soundIndex].customFreqScale != 0) { + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale *= sSoundBanks[bank][soundIndex].customFreqScale; } + + // Increment to the next channel that this bank owns channelIndex++; } - // sUsedChannelsForSoundBank[i] = sMaxChannelsForSoundBank[i] = 1, so this doesn't do anything - channelIndex += sMaxChannelsForSoundBank[bankIndex] - sUsedChannelsForSoundBank[bankIndex]; + // Increment to the first channel index of the next bank + // (In practice sUsedChannelsForSoundBank[i] = sMaxChannelsForSoundBank[i] = 1, so this + // doesn't do anything) + channelIndex += sMaxChannelsForSoundBank[bank] - sUsedChannelsForSoundBank[bank]; } } -#undef ARG2_VAL1 -#undef ARG2_VAL2 -void play_sequence(u8 player, u8 seqId, u16 fadeTimer) { - u8 temp_ret; +/** + * Called from threads: thread4_sound, thread5_game_loop + */ +static void seq_player_play_sequence(u8 player, u8 seqId, u16 arg2) { + u8 targetVolume; u8 i; - if (player == 0) { - sPlayer0CurSeqId = seqId & 0x7f; + if (player == SEQ_PLAYER_LEVEL) { + sCurrentBackgroundMusicSeqId = seqId & SEQ_BASE_ID; sBackgroundMusicForDynamics = SEQUENCE_NONE; sCurrentMusicDynamic = 0xff; sMusicDynamicDelay = 2; } - for (i = 0; i < 0x10; i++) { - D_80360928[player][i].remDuration = 0; + for (i = 0; i < CHANNELS_MAX; i++) { + D_80360928[player][i].remainingFrames = 0; } -#ifdef VERSION_EU - func_802ad770(0x46000000 | ((u8)(u32)player) << 16, seqId & 0x80); - func_802ad74c(0x82000000 | ((u8)(u32)player) << 16 | ((u8)(seqId & 0x7f)) << 8, fadeTimer); +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad770(0x46000000 | ((u8)(u32) player) << 16, seqId & SEQ_VARIATION); + func_802ad74c(0x82000000 | ((u8)(u32) player) << 16 | ((u8)(seqId & SEQ_BASE_ID)) << 8, arg2); - if (player == 0) { - temp_ret = func_803200E4(0); - if (temp_ret != 0xff) { - gSequencePlayers[SEQ_PLAYER_LEVEL].fadeVolumeScale = (f32) temp_ret / US_FLOAT(127.0); + if (player == SEQ_PLAYER_LEVEL) { + targetVolume = begin_background_music_fade(0); + if (targetVolume != 0xff) { + gSequencePlayers[SEQ_PLAYER_LEVEL].fadeVolumeScale = (f32) targetVolume / US_FLOAT(127.0); } } #else - gSequencePlayers[player].seqVariation = seqId & 0x80; - load_sequence(player, seqId & 0x7f, 0); - if (player == 0) { - temp_ret = func_803200E4(0); - if (temp_ret != 0xff) { + gSequencePlayers[player].seqVariation = seqId & SEQ_VARIATION; + load_sequence(player, seqId & SEQ_BASE_ID, 0); + + if (player == SEQ_PLAYER_LEVEL) { + targetVolume = begin_background_music_fade(0); + if (targetVolume != 0xff) { gSequencePlayers[SEQ_PLAYER_LEVEL].state = SEQUENCE_PLAYER_STATE_4; - gSequencePlayers[SEQ_PLAYER_LEVEL].fadeVolume = (f32) temp_ret / US_FLOAT(127.0); + gSequencePlayers[SEQ_PLAYER_LEVEL].fadeVolume = (f32) targetVolume / US_FLOAT(127.0); } } else { - func_8031D690(player, fadeTimer); + func_8031D690(player, arg2); } #endif } -void sequence_player_fade_out(u8 player, u16 fadeTimer) { +/** + * Called from threads: thread5_game_loop + */ +void seq_player_fade_out(u8 player, u16 fadeDuration) { +#if defined(VERSION_EU) || defined(VERSION_SH) #ifdef VERSION_EU - if (!player) { - sPlayer0CurSeqId = SEQUENCE_NONE; - } - func_802ad74c(0x83000000 | (player & 0xff) << 16, fadeTimer); + u32 fd = fadeDuration; #else - if (player == 0) { - sPlayer0CurSeqId = SEQUENCE_NONE; + s32 fd = fadeDuration; // will also match if we change function signature func_802ad74c to use s32 as arg1 +#endif + if (!player) { + sCurrentBackgroundMusicSeqId = SEQUENCE_NONE; } - sequence_player_fade_out_internal(player, fadeTimer); + func_802ad74c(0x83000000 | (player & 0xff) << 16, fd); +#else + if (player == SEQ_PLAYER_LEVEL) { + sCurrentBackgroundMusicSeqId = SEQUENCE_NONE; + } + seq_player_fade_to_zero_volume(player, fadeDuration); #endif } -void fade_volume_scale(u8 player, u8 targetScale, u16 fadeTimer) { +/** + * Called from threads: thread5_game_loop + */ +void fade_volume_scale(u8 player, u8 targetScale, u16 fadeDuration) { u8 i; for (i = 0; i < CHANNELS_MAX; i++) { - fade_channel_volume_scale(player, i, targetScale, fadeTimer); + fade_channel_volume_scale(player, i, targetScale, fadeDuration); } } -void fade_channel_volume_scale(u8 player, u8 channelId, u8 targetScale, u16 fadeTimer) { +/** + * Called from threads: thread3_main, thread4_sound, thread5_game_loop + */ +static void fade_channel_volume_scale(u8 player, u8 channelIndex, u8 targetScale, u16 fadeDuration) { struct ChannelVolumeScaleFade *temp; - if (gSequencePlayers[player].channels[channelId] != &gSequenceChannelNone) { - temp = &D_80360928[player][channelId]; - temp->remDuration = fadeTimer; + if (gSequencePlayers[player].channels[channelIndex] != &gSequenceChannelNone) { + temp = &D_80360928[player][channelIndex]; + temp->remainingFrames = fadeDuration; temp->velocity = ((f32)(targetScale / US_FLOAT(127.0)) - - gSequencePlayers[player].channels[channelId]->volumeScale) - / fadeTimer; + - gSequencePlayers[player].channels[channelIndex]->volumeScale) + / fadeDuration; temp->target = targetScale; - temp->current = gSequencePlayers[player].channels[channelId]->volumeScale; + temp->current = gSequencePlayers[player].channels[channelIndex]->volumeScale; } } -void func_8031F96C(u8 player) { +/** + * Called from threads: thread4_sound, thread5_game_loop (EU only) + */ +static void func_8031F96C(u8 player) { u8 i; // Loop over channels for (i = 0; i < CHANNELS_MAX; i++) { if (gSequencePlayers[player].channels[i] != &gSequenceChannelNone - && D_80360928[player][i].remDuration != 0) { + && D_80360928[player][i].remainingFrames != 0) { D_80360928[player][i].current += D_80360928[player][i].velocity; -#ifdef VERSION_EU - func_802ad728(0x01000000 | (player & 0xff) << 16 | (i & 0xff) << 8, D_80360928[player][i].current); +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad728(0x01000000 | (player & 0xff) << 16 | (i & 0xff) << 8, + D_80360928[player][i].current); #else gSequencePlayers[player].channels[i]->volumeScale = D_80360928[player][i].current; #endif - D_80360928[player][i].remDuration--; - if (D_80360928[player][i].remDuration == 0) { -#ifdef VERSION_EU + D_80360928[player][i].remainingFrames--; + if (D_80360928[player][i].remainingFrames == 0) { +#if defined(VERSION_EU) func_802ad728(0x01000000 | (player & 0xff) << 16 | (i & 0xff) << 8, - FLOAT_CAST(D_80360928[player][i].target) / 127.0); + FLOAT_CAST(D_80360928[player][i].target) / 127.0); +#elif defined(VERSION_SH) + func_802ad728(0x01000000 | (player & 0xff) << 16 | (i & 0xff) << 8, + FLOAT_CAST(D_80360928[player][i].target) / 127.0f); #else gSequencePlayers[player].channels[i]->volumeScale = D_80360928[player][i].target / 127.0f; @@ -1495,21 +1769,22 @@ void func_8031F96C(u8 player) { } } -#ifdef NON_MATCHING - +/** + * Called from threads: thread4_sound, thread5_game_loop (EU only) + */ void process_level_music_dynamics(void) { - s32 conditionBits; // s0 - u32 tempBits; // v1 - u8 musicDynIndex; // sp57 87 - u8 condIndex; // a0, v1 - u8 i; // s1 - u8 j; // v0 - s16 conditionValues[8]; // sp44 68 - u8 conditionTypes[8]; // sp3C 60 - s16 dur1; // sp3A 58 - s16 dur2; // sp38 56 - u16 bit; // a1 (in first loop), s0, v1 - // room for 16 bits without affecting stack + u32 conditionBits; + u16 tempBits; + UNUSED u16 pad; + u8 musicDynIndex; + u8 condIndex; + u8 i; + u8 j; + s16 conditionValues[8]; + u8 conditionTypes[8]; + s16 dur1; + s16 dur2; + u16 bit; func_8031F96C(0); func_8031F96C(2); @@ -1517,17 +1792,15 @@ void process_level_music_dynamics(void) { if (sMusicDynamicDelay != 0) { sMusicDynamicDelay--; } else { - sBackgroundMusicForDynamics = sPlayer0CurSeqId; + sBackgroundMusicForDynamics = sCurrentBackgroundMusicSeqId; } if (sBackgroundMusicForDynamics != sLevelDynamics[gCurrLevelNum][0]) { return; } - // conditionBits uses a3 instead of s0 - // s16 cast is unnecessary, u16 cast fixes regalloc in the switch - conditionBits = ((s16) sLevelDynamics[gCurrLevelNum][1]) & 0xff00; - musicDynIndex = ((u16) sLevelDynamics[gCurrLevelNum][1]) & 0xff; + conditionBits = sLevelDynamics[gCurrLevelNum][1] & 0xff00; + musicDynIndex = (u8) sLevelDynamics[gCurrLevelNum][1] & 0xff; i = 2; while (conditionBits & 0xff00) { j = 0; @@ -1544,47 +1817,54 @@ void process_level_music_dynamics(void) { bit = bit >> 1; } - // condIndex uses a0 (the same register as 'bit') instead of v1 for (j = 0; j < condIndex; j++) { switch (conditionTypes[j]) { case MARIO_X_GE: { - if (((s16) gMarioStates[0].pos[0]) < conditionValues[j]) + if (((s16) gMarioStates[0].pos[0]) < conditionValues[j]) { j = condIndex + 1; + } break; } case MARIO_Y_GE: { - if (((s16) gMarioStates[0].pos[1]) < conditionValues[j]) + if (((s16) gMarioStates[0].pos[1]) < conditionValues[j]) { j = condIndex + 1; + } break; } case MARIO_Z_GE: { - if (((s16) gMarioStates[0].pos[2]) < conditionValues[j]) + if (((s16) gMarioStates[0].pos[2]) < conditionValues[j]) { j = condIndex + 1; + } break; } case MARIO_X_LT: { - if (((s16) gMarioStates[0].pos[0]) >= conditionValues[j]) + if (((s16) gMarioStates[0].pos[0]) >= conditionValues[j]) { j = condIndex + 1; + } break; } case MARIO_Y_LT: { - if (((s16) gMarioStates[0].pos[1]) >= conditionValues[j]) + if (((s16) gMarioStates[0].pos[1]) >= conditionValues[j]) { j = condIndex + 1; + } break; } case MARIO_Z_LT: { - if (((s16) gMarioStates[0].pos[2]) >= conditionValues[j]) + if (((s16) gMarioStates[0].pos[2]) >= conditionValues[j]) { j = condIndex + 1; + } break; } case MARIO_IS_IN_AREA: { - if (gCurrAreaIndex != conditionValues[j]) + if (gCurrAreaIndex != conditionValues[j]) { j = condIndex + 1; + } break; } case MARIO_IS_IN_ROOM: { - if (gMarioCurrentRoom != conditionValues[j]) + if (gMarioCurrentRoom != conditionValues[j]) { j = condIndex + 1; + } break; } } @@ -1594,10 +1874,8 @@ void process_level_music_dynamics(void) { // The area matches. Break out of the loop. tempBits = 0; } else { - // s16 cast is unnecessary, u16 cast fixes regalloc - // While conditionBits didn't need a cast above, the opposite is the case here - tempBits = ((u16) sLevelDynamics[gCurrLevelNum][i]) & 0xff00; - musicDynIndex = ((s16) sLevelDynamics[gCurrLevelNum][i]) & 0xff; + tempBits = sLevelDynamics[gCurrLevelNum][i] & 0xff00; + musicDynIndex = sLevelDynamics[gCurrLevelNum][i] & 0xff; i++; } @@ -1605,8 +1883,7 @@ void process_level_music_dynamics(void) { } if (sCurrentMusicDynamic != musicDynIndex) { - // bit keeps using a0, should use v1 - bit = 1; + tempBits = 1; if (sCurrentMusicDynamic == 0xff) { dur1 = 1; dur2 = 1; @@ -1616,25 +1893,23 @@ void process_level_music_dynamics(void) { } for (i = 0; i < CHANNELS_MAX; i++) { - if (sMusicDynamics[musicDynIndex].bits1 & bit) { - // The instructions setting a0 and a1 are swapped, but get fixed pretty easily by a - // branch or anything that changes regalloc - fade_channel_volume_scale(SEQ_PLAYER_LEVEL, i, sMusicDynamics[musicDynIndex].volScale1, dur1); + conditionBits = tempBits; + tempBits = 0; + if (sMusicDynamics[musicDynIndex].bits1 & conditionBits) { + fade_channel_volume_scale(SEQ_PLAYER_LEVEL, i, sMusicDynamics[musicDynIndex].volScale1, + dur1); } - if (sMusicDynamics[musicDynIndex].bits2 & bit) { - fade_channel_volume_scale(SEQ_PLAYER_LEVEL, i, sMusicDynamics[musicDynIndex].volScale2, dur2); + if (sMusicDynamics[musicDynIndex].bits2 & conditionBits) { + fade_channel_volume_scale(SEQ_PLAYER_LEVEL, i, sMusicDynamics[musicDynIndex].volScale2, + dur2); } - bit <<= 1; + tempBits = conditionBits << 1; } sCurrentMusicDynamic = musicDynIndex; } } -#else -GLOBAL_ASM("asm/non_matchings/process_level_music_dynamics.s") -#endif - void unused_8031FED0(u8 player, u32 bits, s8 arg2) { u8 i; @@ -1657,139 +1932,174 @@ void unused_8031FED0(u8 player, u32 bits, s8 arg2) { } } -void func_8031FFB4(u8 player, u16 fadeTimer, u8 arg2) { - if (player == 0) { - sCapVolumeTo40 = TRUE; - func_803200E4(fadeTimer); +/** + * Lower a sequence player's volume over fadeDuration frames. + * If player is SEQ_PLAYER_LEVEL (background music), the given percentage is ignored + * and a max target volume of 40 is used. + * + * Called from threads: thread5_game_loop + */ +void seq_player_lower_volume(u8 player, u16 fadeDuration, u8 percentage) { + if (player == SEQ_PLAYER_LEVEL) { + sLowerBackgroundMusicVolume = TRUE; + begin_background_music_fade(fadeDuration); } else if (gSequencePlayers[player].enabled == TRUE) { - func_8031D6E4(player, fadeTimer, arg2); + seq_player_fade_to_percentage_of_volume(player, fadeDuration, percentage); } } -void sequence_player_unlower(u8 player, u16 fadeTimer) { - sCapVolumeTo40 = FALSE; - if (player == 0) { +/** + * Remove the lowered volume constraint set by seq_player_lower_volume. + * If player is SEQ_PLAYER_LEVEL (background music), the music won't necessarily + * raise back to normal volume if other constraints have been set, e.g. + * sBackgroundMusicTargetVolume. + * + * Called from threads: thread5_game_loop + */ +void seq_player_unlower_volume(u8 player, u16 fadeDuration) { + sLowerBackgroundMusicVolume = FALSE; + if (player == SEQ_PLAYER_LEVEL) { if (gSequencePlayers[player].state != SEQUENCE_PLAYER_STATE_FADE_OUT) { - func_803200E4(fadeTimer); + begin_background_music_fade(fadeDuration); } } else { if (gSequencePlayers[player].enabled == TRUE) { - func_8031D7B0(player, fadeTimer); + seq_player_fade_to_normal_volume(player, fadeDuration); } } } -// returns fade volume or 0xff for background music -u8 func_803200E4(u16 fadeTimer) { - u8 vol = 0xff; - u8 temp; +/** + * Begin a volume fade to adjust the background music to the correct volume. + * The target volume is determined by global variables like sBackgroundMusicTargetVolume + * and sLowerBackgroundMusicVolume. + * If none of the relevant global variables are set, then the default background music + * volume for the sequence is used. + * + * Called from threads: thread3_main, thread4_sound, thread5_game_loop + */ +static u8 begin_background_music_fade(u16 fadeDuration) { + u8 targetVolume = 0xff; - if (sPlayer0CurSeqId == SEQUENCE_NONE || sPlayer0CurSeqId == SEQ_EVENT_CUTSCENE_CREDITS) { + if (sCurrentBackgroundMusicSeqId == SEQUENCE_NONE + || sCurrentBackgroundMusicSeqId == SEQ_EVENT_CUTSCENE_CREDITS) { return 0xff; } - if (gSequencePlayers[SEQ_PLAYER_LEVEL].volume == 0.0f && fadeTimer) { + if (gSequencePlayers[SEQ_PLAYER_LEVEL].volume == 0.0f && fadeDuration) { gSequencePlayers[SEQ_PLAYER_LEVEL].volume = gSequencePlayers[SEQ_PLAYER_LEVEL].fadeVolume; } - if (D_80363812 != 0) { - vol = (D_80363812 & 0x7f); + if (sBackgroundMusicTargetVolume != TARGET_VOLUME_UNSET) { + targetVolume = (sBackgroundMusicTargetVolume & TARGET_VOLUME_VALUE_MASK); } - if (D_8033211C != 0) { - temp = (D_8033211C & 0x7f); - if (vol > temp) { - vol = temp; + if (sBackgroundMusicMaxTargetVolume != TARGET_VOLUME_UNSET) { + u8 maxTargetVolume = (sBackgroundMusicMaxTargetVolume & TARGET_VOLUME_VALUE_MASK); + if (targetVolume > maxTargetVolume) { + targetVolume = maxTargetVolume; } } - if (sCapVolumeTo40 && vol > 40) { - vol = 40; + if (sLowerBackgroundMusicVolume && targetVolume > 40) { + targetVolume = 40; } - if (D_80332110 != 0 && vol > 20) { - vol = 20; + if (sSoundBanksThatLowerBackgroundMusic != 0 && targetVolume > 20) { + targetVolume = 20; } if (gSequencePlayers[SEQ_PLAYER_LEVEL].enabled == TRUE) { - if (vol != 0xff) { - func_8031D838(SEQ_PLAYER_LEVEL, fadeTimer, vol); + if (targetVolume != 0xff) { + seq_player_fade_to_target_volume(SEQ_PLAYER_LEVEL, fadeDuration, targetVolume); } else { #if defined(VERSION_JP) || defined(VERSION_US) - gSequencePlayers[SEQ_PLAYER_LEVEL].volume = sBackgroundMusicDefaultVolume[sPlayer0CurSeqId] / 127.0f; + gSequencePlayers[SEQ_PLAYER_LEVEL].volume = + sBackgroundMusicDefaultVolume[sCurrentBackgroundMusicSeqId] / 127.0f; #endif - func_8031D7B0(SEQ_PLAYER_LEVEL, fadeTimer); + seq_player_fade_to_normal_volume(SEQ_PLAYER_LEVEL, fadeDuration); } } - return vol; + + return targetVolume; } -void set_sound_disabled(u8 disabled) { +/** + * Called from threads: thread5_game_loop + */ +void set_audio_muted(u8 muted) { u8 i; for (i = 0; i < SEQUENCE_PLAYERS; i++) { -#ifdef VERSION_EU - if (disabled) +#if defined(VERSION_EU) || defined(VERSION_SH) + if (muted) func_802ad74c(0xf1000000, 0); else func_802ad74c(0xf2000000, 0); #else - gSequencePlayers[i].muted = disabled; + gSequencePlayers[i].muted = muted; #endif } } +/** + * Called from threads: thread4_sound + */ void sound_init(void) { u8 i; u8 j; for (i = 0; i < SOUND_BANK_COUNT; i++) { + // Set each sound in the bank to STOPPED for (j = 0; j < 40; j++) { - gSoundBanks[i][j].soundStatus = SOUND_STATUS_STOPPED; + sSoundBanks[i][j].soundStatus = SOUND_STATUS_STOPPED; } - for (j = 0; j < MAX_CHANNELS_PER_SOUND; j++) { + // Remove current sounds + for (j = 0; j < MAX_CHANNELS_PER_SOUND_BANK; j++) { sCurrentSound[i][j] = 0xff; } - D_803320A4[i] = 0; - D_803320B0[i] = 1; - D_803320BC[i] = 0; + sSoundBankUsedListBack[i] = 0; + sSoundBankFreeListFront[i] = 1; + sNumSoundsInBank[i] = 0; } for (i = 0; i < SOUND_BANK_COUNT; i++) { - gSoundBanks[i][0].prev = 0xff; - gSoundBanks[i][0].next = 0xff; + // Set used list to empty + sSoundBanks[i][0].prev = 0xff; + sSoundBanks[i][0].next = 0xff; + // Set free list to contain every sound slot for (j = 1; j < 40 - 1; j++) { - gSoundBanks[i][j].prev = j - 1; - gSoundBanks[i][j].next = j + 1; + sSoundBanks[i][j].prev = j - 1; + sSoundBanks[i][j].next = j + 1; } - - gSoundBanks[i][j].prev = j - 1; - gSoundBanks[i][j].next = 0xff; + sSoundBanks[i][j].prev = j - 1; + sSoundBanks[i][j].next = 0xff; } for (j = 0; j < 3; j++) { for (i = 0; i < CHANNELS_MAX; i++) { - D_80360928[j][i].remDuration = 0; + D_80360928[j][i].remainingFrames = 0; } } - for (i = 0; i < MAX_BG_MUSIC_QUEUE_SIZE; i++) { + for (i = 0; i < MAX_BACKGROUND_MUSIC_QUEUE_SIZE; i++) { sBackgroundMusicQueue[i].priority = 0; } - sound_banks_enable(2, 0xffff); + sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL_BITS); + sUnused80332118 = 0; - D_80363812 = 0; - sCapVolumeTo40 = FALSE; - D_80332110 = 0; + sBackgroundMusicTargetVolume = TARGET_VOLUME_UNSET; + sLowerBackgroundMusicVolume = FALSE; + sSoundBanksThatLowerBackgroundMusic = 0; sUnused80332114 = 0; - sPlayer0CurSeqId = 0xff; + sCurrentBackgroundMusicSeqId = 0xff; gSoundMode = SOUND_MODE_STEREO; sBackgroundMusicQueueSize = 0; - D_8033211C = 0; + sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_UNSET; D_80332120 = 0; D_80332124 = 0; sNumProcessedSoundRequests = 0; @@ -1797,76 +2107,97 @@ void sound_init(void) { } // (unused) -void get_currently_playing_sound(u8 bankIndex, u8 *numPlayingSounds, u8 *arg2, u8 *soundId) { +void get_currently_playing_sound(u8 bank, u8 *numPlayingSounds, u8 *numSoundsInBank, u8 *soundId) { u8 i; u8 count = 0; - for (i = 0; i < sMaxChannelsForSoundBank[bankIndex]; i++) { - if (sCurrentSound[bankIndex][i] != 0xff) { + for (i = 0; i < sMaxChannelsForSoundBank[bank]; i++) { + if (sCurrentSound[bank][i] != 0xff) { count++; } } - *numPlayingSounds = count; - *arg2 = D_803320BC[bankIndex]; - if (sCurrentSound[bankIndex][0] != 0xff) { - *soundId = (u8)(gSoundBanks[bankIndex][sCurrentSound[bankIndex][0]].soundBits >> SOUNDARGS_SHIFT_SOUNDID); + + *numSoundsInBank = sNumSoundsInBank[bank]; + + if (sCurrentSound[bank][0] != 0xff) { + *soundId = (u8)(sSoundBanks[bank][sCurrentSound[bank][0]].soundBits >> SOUNDARGS_SHIFT_SOUNDID); } else { *soundId = 0xff; } } -void func_803205E8(u32 soundBits, f32 *vec) { - u8 bankIndex; - u8 item; +/** + * Called from threads: thread5_game_loop + */ +void stop_sound(u32 soundBits, f32 *pos) { + u8 bank = (soundBits & SOUNDARGS_MASK_BANK) >> SOUNDARGS_SHIFT_BANK; + u8 soundIndex = sSoundBanks[bank][0].next; - bankIndex = (soundBits & SOUNDARGS_MASK_BANK) >> SOUNDARGS_SHIFT_BANK; - item = gSoundBanks[bankIndex][0].next; - while (item != 0xff) { + while (soundIndex != 0xff) { + // If sound has same id and source position pointer if ((u16)(soundBits >> SOUNDARGS_SHIFT_SOUNDID) - == (u16)(gSoundBanks[bankIndex][item].soundBits >> SOUNDARGS_SHIFT_SOUNDID) - && gSoundBanks[bankIndex][item].x == vec) { - func_8031E0E4(bankIndex, item); - gSoundBanks[bankIndex][item].soundBits = NO_SOUND; - item = 0xff; + == (u16)(sSoundBanks[bank][soundIndex].soundBits >> SOUNDARGS_SHIFT_SOUNDID) + && sSoundBanks[bank][soundIndex].x == pos) { + + // Mark sound for deletion + update_background_music_after_sound(bank, soundIndex); + sSoundBanks[bank][soundIndex].soundBits = NO_SOUND; + soundIndex = 0xff; // break } else { - item = gSoundBanks[bankIndex][item].next; + soundIndex = sSoundBanks[bank][soundIndex].next; } } } -void func_803206F8(f32 *arg0) { - u8 bankIndex; - u8 item; +/** + * Called from threads: thread5_game_loop + */ +void stop_sounds_from_source(f32 *pos) { + u8 bank; + u8 soundIndex; - for (bankIndex = 0; bankIndex < SOUND_BANK_COUNT; bankIndex++) { - item = gSoundBanks[bankIndex][0].next; - while (item != 0xff) { - if (gSoundBanks[bankIndex][item].x == arg0) { - func_8031E0E4(bankIndex, item); - gSoundBanks[bankIndex][item].soundBits = NO_SOUND; + for (bank = 0; bank < SOUND_BANK_COUNT; bank++) { + soundIndex = sSoundBanks[bank][0].next; + while (soundIndex != 0xff) { + if (sSoundBanks[bank][soundIndex].x == pos) { + update_background_music_after_sound(bank, soundIndex); + sSoundBanks[bank][soundIndex].soundBits = NO_SOUND; } - item = gSoundBanks[bankIndex][item].next; + soundIndex = sSoundBanks[bank][soundIndex].next; } } } -static void func_803207DC(u8 bankIndex) { - u8 item = gSoundBanks[bankIndex][0].next; +/** + * Called from threads: thread3_main, thread5_game_loop + */ +static void stop_sounds_in_bank(u8 bank) { + u8 soundIndex = sSoundBanks[bank][0].next; - while (item != 0xff) { - func_8031E0E4(bankIndex, item); - gSoundBanks[bankIndex][item].soundBits = NO_SOUND; - item = gSoundBanks[bankIndex][item].next; + while (soundIndex != 0xff) { + update_background_music_after_sound(bank, soundIndex); + sSoundBanks[bank][soundIndex].soundBits = NO_SOUND; + soundIndex = sSoundBanks[bank][soundIndex].next; } } -void func_80320890(void) { - func_803207DC(1); - func_803207DC(4); - func_803207DC(6); +/** + * Stops sounds in all of the sound banks that predominantly consist of continuous + * sounds. Misses some specific continuous sounds in other banks like bird chirping + * and the ticking sound after pressing a switch. + * + * Called from threads: thread3_main, thread5_game_loop + */ +void stop_sounds_in_continuous_banks(void) { + stop_sounds_in_bank(SOUND_BANK_MOVING); + stop_sounds_in_bank(SOUND_BANK_ENV); + stop_sounds_in_bank(SOUND_BANK_AIR); } +/** + * Called from threads: thread3_main, thread5_game_loop + */ void sound_banks_disable(UNUSED u8 player, u16 bankMask) { u8 i; @@ -1878,7 +2209,10 @@ void sound_banks_disable(UNUSED u8 player, u16 bankMask) { } } -void disable_all_sequence_players(void) { +/** + * Called from threads: thread5_game_loop + */ +static void disable_all_sequence_players(void) { u8 i; for (i = 0; i < SEQUENCE_PLAYERS; i++) { @@ -1886,6 +2220,9 @@ void disable_all_sequence_players(void) { } } +/** + * Called from threads: thread5_game_loop + */ void sound_banks_enable(UNUSED u8 player, u16 bankMask) { u8 i; @@ -1906,10 +2243,19 @@ u8 unused_803209D8(u8 player, u8 channelIndex, u8 arg2) { return ret; } -void func_80320A4C(u8 bankIndex, u8 arg1) { - D_80363808[bankIndex] = arg1; +/** + * Set the moving speed for a sound bank, which may affect the volume and pitch + * of the sound. + * + * Called from threads: thread5_game_loop + */ +void set_sound_moving_speed(u8 bank, u8 speed) { + sSoundMovingSpeed[bank] = speed; } +/** + * Called from threads: thread5_game_loop + */ void play_dialog_sound(u8 dialogID) { u8 speaker; @@ -1919,10 +2265,12 @@ void play_dialog_sound(u8 dialogID) { speaker = sDialogSpeaker[dialogID]; if (speaker != 0xff) { - play_sound(sDialogSpeakerVoice[speaker], gDefaultSoundArgs); - if (speaker == 2) // SOUND_OBJ_BOWSER_INTRO_LAUGH - { - play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_KOOPA_MESSAGE, 0); + play_sound(sDialogSpeakerVoice[speaker], gGlobalSoundSource); + + // Play music during bowser message that appears when first entering the + // castle or when trying to enter a door without enough stars + if (speaker == BOWS1) { + seq_player_play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_KOOPA_MESSAGE, 0); } } @@ -1938,6 +2286,9 @@ void set_sequence_player_volume(s32 player, f32 volume) { gSequencePlayers[player].volumeScale = volume; } +/** + * Called from threads: thread5_game_loop + */ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) { u8 seqId = seqArgs & 0xff; u8 priority = seqArgs >> 8; @@ -1946,14 +2297,13 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) { // Except for the background music player, we don't support queued // sequences. Just play them immediately, stopping any old sequence. - - if (player != 0) { - play_sequence(player, seqId, fadeTimer); + if (player != SEQ_PLAYER_LEVEL) { + seq_player_play_sequence(player, seqId, fadeTimer); return; } // Abort if the queue is already full. - if (sBackgroundMusicQueueSize == MAX_BG_MUSIC_QUEUE_SIZE) { + if (sBackgroundMusicQueueSize == MAX_BACKGROUND_MUSIC_QUEUE_SIZE) { return; } @@ -1963,7 +2313,7 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) { for (i = 0; i < sBackgroundMusicQueueSize; i++) { if (sBackgroundMusicQueue[i].seqId == seqId) { if (i == 0) { - play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer); + seq_player_play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer); } else if (!gSequencePlayers[SEQ_PLAYER_LEVEL].enabled) { stop_background_music(sBackgroundMusicQueue[0].seqId); } @@ -1975,14 +2325,14 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) { for (i = 0; i < sBackgroundMusicQueueSize; i++) { if (sBackgroundMusicQueue[i].priority <= priority) { foundIndex = i; - i = sBackgroundMusicQueueSize; + i = sBackgroundMusicQueueSize; // break } } // If the sequence ends up first in the queue, start it, and make space for - // more entries in the queue. + // one more entry in the queue. if (foundIndex == 0) { - play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer); + seq_player_play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer); sBackgroundMusicQueueSize++; } @@ -1998,6 +2348,9 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) { sBackgroundMusicQueue[foundIndex].seqId = seqId; } +/** + * Called from threads: thread5_game_loop + */ void stop_background_music(u16 seqId) { u8 foundIndex; u8 i; @@ -2018,9 +2371,9 @@ void stop_background_music(u16 seqId) { sBackgroundMusicQueueSize--; if (i == 0) { if (sBackgroundMusicQueueSize != 0) { - play_sequence(SEQ_PLAYER_LEVEL, sBackgroundMusicQueue[1].seqId, 0); + seq_player_play_sequence(SEQ_PLAYER_LEVEL, sBackgroundMusicQueue[1].seqId, 0); } else { - sequence_player_fade_out(SEQ_PLAYER_LEVEL, 20); + seq_player_fade_out(SEQ_PLAYER_LEVEL, 20); } } foundIndex = i; @@ -2039,18 +2392,27 @@ void stop_background_music(u16 seqId) { sBackgroundMusicQueue[i].priority = 0; } +/** + * Called from threads: thread5_game_loop + */ void fadeout_background_music(u16 seqId, u16 fadeOut) { if (sBackgroundMusicQueueSize != 0 && sBackgroundMusicQueue[0].seqId == (u8)(seqId & 0xff)) { - sequence_player_fade_out(SEQ_PLAYER_LEVEL, fadeOut); + seq_player_fade_out(SEQ_PLAYER_LEVEL, fadeOut); } } +/** + * Called from threads: thread5_game_loop + */ void drop_queued_background_music(void) { if (sBackgroundMusicQueueSize != 0) { sBackgroundMusicQueueSize = 1; } } +/** + * Called from threads: thread5_game_loop + */ u16 get_current_background_music(void) { if (sBackgroundMusicQueueSize != 0) { return (sBackgroundMusicQueue[0].priority << 8) + sBackgroundMusicQueue[0].seqId; @@ -2058,67 +2420,81 @@ u16 get_current_background_music(void) { return -1; } +/** + * Called from threads: thread4_sound, thread5_game_loop (EU only) + */ void func_80320ED8(void) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (D_EU_80300558 != 0) { D_EU_80300558--; } - if (gSequencePlayers[SEQ_PLAYER_ENV].enabled || D_8033211C == 0 || D_EU_80300558 != 0) { + if (gSequencePlayers[SEQ_PLAYER_ENV].enabled + || sBackgroundMusicMaxTargetVolume == TARGET_VOLUME_UNSET || D_EU_80300558 != 0) { #else - if (gSequencePlayers[SEQ_PLAYER_ENV].enabled || D_8033211C == 0) { + if (gSequencePlayers[SEQ_PLAYER_ENV].enabled + || sBackgroundMusicMaxTargetVolume == TARGET_VOLUME_UNSET) { #endif return; } - D_8033211C = 0; - func_803200E4(50); + sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_UNSET; + begin_background_music_fade(50); - if (D_80363812 != 0 + if (sBackgroundMusicTargetVolume != TARGET_VOLUME_UNSET && (D_80332120 == SEQ_EVENT_MERRY_GO_ROUND || D_80332120 == SEQ_EVENT_PIRANHA_PLANT)) { - play_sequence(SEQ_PLAYER_ENV, D_80332120, 1); + seq_player_play_sequence(SEQ_PLAYER_ENV, D_80332120, 1); if (D_80332124 != 0xff) { - func_8031D838(SEQ_PLAYER_ENV, 1, D_80332124); + seq_player_fade_to_target_volume(SEQ_PLAYER_ENV, 1, D_80332124); } } } +/** + * Called from threads: thread5_game_loop + */ void play_secondary_music(u8 seqId, u8 bgMusicVolume, u8 volume, u16 fadeTimer) { UNUSED u32 dummy; sUnused80332118 = 0; - if (sPlayer0CurSeqId == 0xff || sPlayer0CurSeqId == SEQ_MENU_TITLE_SCREEN) { + if (sCurrentBackgroundMusicSeqId == 0xff || sCurrentBackgroundMusicSeqId == SEQ_MENU_TITLE_SCREEN) { return; } - if (D_80363812 == 0) { - D_80363812 = bgMusicVolume + 0x80; - func_803200E4(fadeTimer); - play_sequence(SEQ_PLAYER_ENV, seqId, fadeTimer >> 1); + if (sBackgroundMusicTargetVolume == TARGET_VOLUME_UNSET) { + sBackgroundMusicTargetVolume = bgMusicVolume + TARGET_VOLUME_IS_PRESENT_FLAG; + begin_background_music_fade(fadeTimer); + seq_player_play_sequence(SEQ_PLAYER_ENV, seqId, fadeTimer >> 1); if (volume < 0x80) { - func_8031D838(SEQ_PLAYER_ENV, fadeTimer, volume); + seq_player_fade_to_target_volume(SEQ_PLAYER_ENV, fadeTimer, volume); } D_80332124 = volume; D_80332120 = seqId; } else if (volume != 0xff) { - D_80363812 = bgMusicVolume + 0x80; - func_803200E4(fadeTimer); - func_8031D838(SEQ_PLAYER_ENV, fadeTimer, volume); + sBackgroundMusicTargetVolume = bgMusicVolume + TARGET_VOLUME_IS_PRESENT_FLAG; + begin_background_music_fade(fadeTimer); + seq_player_fade_to_target_volume(SEQ_PLAYER_ENV, fadeTimer, volume); D_80332124 = volume; } } +/** + * Called from threads: thread5_game_loop + */ void func_80321080(u16 fadeTimer) { - if (D_80363812 != 0) { - D_80363812 = 0; + if (sBackgroundMusicTargetVolume != TARGET_VOLUME_UNSET) { + sBackgroundMusicTargetVolume = TARGET_VOLUME_UNSET; D_80332120 = 0; D_80332124 = 0; - func_803200E4(fadeTimer); - sequence_player_fade_out(SEQ_PLAYER_ENV, fadeTimer); + begin_background_music_fade(fadeTimer); + seq_player_fade_out(SEQ_PLAYER_ENV, fadeTimer); } } -void func_803210D4(u16 fadeOutTime) { +/** + * Called from threads: thread3_main, thread5_game_loop + */ +void func_803210D4(u16 fadeDuration) { u8 i; if (sHasStartedFadeOut) { @@ -2126,99 +2502,124 @@ void func_803210D4(u16 fadeOutTime) { } if (gSequencePlayers[SEQ_PLAYER_LEVEL].enabled == TRUE) { -#ifdef VERSION_EU - func_802ad74c(0x83000000, fadeOutTime); +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad74c(0x83000000, fadeDuration); #else - sequence_player_fade_out_internal(SEQ_PLAYER_LEVEL, fadeOutTime); + seq_player_fade_to_zero_volume(SEQ_PLAYER_LEVEL, fadeDuration); #endif } + if (gSequencePlayers[SEQ_PLAYER_ENV].enabled == TRUE) { -#ifdef VERSION_EU - func_802ad74c(0x83010000, fadeOutTime); +#if defined(VERSION_EU) || defined(VERSION_SH) + func_802ad74c(0x83010000, fadeDuration); #else - sequence_player_fade_out_internal(SEQ_PLAYER_ENV, fadeOutTime); + seq_player_fade_to_zero_volume(SEQ_PLAYER_ENV, fadeDuration); #endif } for (i = 0; i < SOUND_BANK_COUNT; i++) { - if (i != 7) { - fade_channel_volume_scale(SEQ_PLAYER_SFX, i, 0, fadeOutTime / 16); + if (i != SOUND_BANK_MENU) { + fade_channel_volume_scale(SEQ_PLAYER_SFX, i, 0, fadeDuration / 16); } } + sHasStartedFadeOut = TRUE; } +/** + * Called from threads: thread5_game_loop + */ void play_course_clear(void) { - play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_CUTSCENE_COLLECT_STAR, 0); - D_8033211C = 0x80 | 0; -#ifdef VERSION_EU + seq_player_play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_CUTSCENE_COLLECT_STAR, 0); + sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_IS_PRESENT_FLAG | 0; +#if defined(VERSION_EU) || defined(VERSION_SH) D_EU_80300558 = 2; #endif - func_803200E4(50); + begin_background_music_fade(50); } +/** + * Called from threads: thread5_game_loop + */ void play_peachs_jingle(void) { - play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_PEACH_MESSAGE, 0); - D_8033211C = 0x80 | 0; -#ifdef VERSION_EU + seq_player_play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_PEACH_MESSAGE, 0); + sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_IS_PRESENT_FLAG | 0; +#if defined(VERSION_EU) || defined(VERSION_SH) D_EU_80300558 = 2; #endif - func_803200E4(50); + begin_background_music_fade(50); } /** * Plays the puzzle jingle. Plays the dadada dadada *dadada* jingle * that usually plays when you solve a "puzzle", like chests, talking to * yoshi, releasing chain chomp, opening the pyramid top, etc. + * + * Called from threads: thread5_game_loop */ void play_puzzle_jingle(void) { - play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_SOLVE_PUZZLE, 0); - D_8033211C = 0x80 | 20; -#ifdef VERSION_EU + seq_player_play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_SOLVE_PUZZLE, 0); + sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_IS_PRESENT_FLAG | 20; +#if defined(VERSION_EU) || defined(VERSION_SH) D_EU_80300558 = 2; #endif - func_803200E4(50); + begin_background_music_fade(50); } +/** + * Called from threads: thread5_game_loop + */ void play_star_fanfare(void) { - play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_HIGH_SCORE, 0); - D_8033211C = 0x80 | 20; -#ifdef VERSION_EU + seq_player_play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_HIGH_SCORE, 0); + sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_IS_PRESENT_FLAG | 20; +#if defined(VERSION_EU) || defined(VERSION_SH) D_EU_80300558 = 2; #endif - func_803200E4(50); + begin_background_music_fade(50); } +/** + * Called from threads: thread5_game_loop + */ void play_power_star_jingle(u8 arg0) { if (!arg0) { - D_80363812 = 0; + sBackgroundMusicTargetVolume = 0; } - play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_CUTSCENE_STAR_SPAWN, 0); - D_8033211C = 0x80 | 20; -#ifdef VERSION_EU + seq_player_play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_CUTSCENE_STAR_SPAWN, 0); + sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_IS_PRESENT_FLAG | 20; +#if defined(VERSION_EU) || defined(VERSION_SH) D_EU_80300558 = 2; #endif - func_803200E4(50); + begin_background_music_fade(50); } +/** + * Called from threads: thread5_game_loop + */ void play_race_fanfare(void) { - play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_RACE, 0); - D_8033211C = 0x80 | 20; -#ifdef VERSION_EU + seq_player_play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_RACE, 0); + sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_IS_PRESENT_FLAG | 20; +#if defined(VERSION_EU) || defined(VERSION_SH) D_EU_80300558 = 2; #endif - func_803200E4(50); + begin_background_music_fade(50); } +/** + * Called from threads: thread5_game_loop + */ void play_toads_jingle(void) { - play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_TOAD_MESSAGE, 0); - D_8033211C = 0x80 | 20; -#ifdef VERSION_EU + seq_player_play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_TOAD_MESSAGE, 0); + sBackgroundMusicMaxTargetVolume = TARGET_VOLUME_IS_PRESENT_FLAG | 20; +#if defined(VERSION_EU) || defined(VERSION_SH) D_EU_80300558 = 2; #endif - func_803200E4(50); + begin_background_music_fade(50); } +/** + * Called from threads: thread5_game_loop + */ void sound_reset(u8 presetId) { #ifndef VERSION_JP if (presetId >= 8) { @@ -2229,7 +2630,10 @@ void sound_reset(u8 presetId) { sGameLoopTicked = 0; disable_all_sequence_players(); sound_init(); -#if defined(VERSION_JP) || defined(VERSION_US) || defined(VERSION_SH) +#ifdef VERSION_SH + func_802ad74c(0xF2000000, 0); +#endif +#if defined(VERSION_JP) || defined(VERSION_US) audio_reset_session(&gAudioSessionPresets[presetId]); #else audio_reset_session_eu(presetId); @@ -2240,18 +2644,21 @@ void sound_reset(u8 presetId) { preload_sequence(SEQ_EVENT_PEACH_MESSAGE, PRELOAD_BANKS | PRELOAD_SEQUENCE); preload_sequence(SEQ_EVENT_CUTSCENE_STAR_SPAWN, PRELOAD_BANKS | PRELOAD_SEQUENCE); } - play_sequence(SEQ_PLAYER_SFX, SEQ_SOUND_PLAYER, 0); + seq_player_play_sequence(SEQ_PLAYER_SFX, SEQ_SOUND_PLAYER, 0); D_80332108 = (D_80332108 & 0xf0) + presetId; gSoundMode = D_80332108 >> 4; sHasStartedFadeOut = FALSE; } +/** + * Called from threads: thread5_game_loop + */ void audio_set_sound_mode(u8 soundMode) { D_80332108 = (D_80332108 & 0xf) + (soundMode << 4); gSoundMode = soundMode; } -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) void unused_80321460(UNUSED s32 arg0, UNUSED s32 arg1, UNUSED s32 arg2, UNUSED s32 arg3) { } diff --git a/src/audio/external.h b/src/audio/external.h index 340498e7..f169bcd4 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -5,7 +5,7 @@ #include "types.h" -// Sequence arguments, passed to play_sequence. seqId may be bit-OR'ed with +// Sequence arguments, passed to seq_player_play_sequence. seqId may be bit-OR'ed with // SEQ_VARIATION; this will load the same sequence, but set a variation // bit which may be read by the sequence script. #define SEQUENCE_ARGS(priority, seqId) ((priority << 8) | seqId) @@ -14,12 +14,12 @@ #define SOUND_MODE_MONO 3 #define SOUND_MODE_HEADSET 1 -#define SEQ_PLAYER_LEVEL 0 -#define SEQ_PLAYER_ENV 1 -#define SEQ_PLAYER_SFX 2 +#define SEQ_PLAYER_LEVEL 0 // Level background music +#define SEQ_PLAYER_ENV 1 // Misc music like the puzzle jingle +#define SEQ_PLAYER_SFX 2 // Sound effects extern s32 gAudioErrorFlags; -extern f32 gDefaultSoundArgs[3]; +extern f32 gGlobalSoundSource[3]; // defined in data.c, used by the game extern u32 gAudioRandom; @@ -27,21 +27,25 @@ extern u32 gAudioRandom; extern u8 gAudioSPTaskYieldBuffer[]; // ucode yield data ptr; only used in JP struct SPTask *create_next_audio_frame_task(void); +#ifdef VERSION_SH +struct SPTask *func_sh_802f5a80(void); +#endif void play_sound(s32 soundBits, f32 *pos); void play_sound_with_freq_scale(s32 soundBits, f32* pos, f32 freqScale); void audio_signal_game_loop_tick(void); -void sequence_player_fade_out(u8 player, u16 fadeTimer); -void fade_volume_scale(u8 player, u8 targetScale, u16 fadeTimer); -void func_8031FFB4(u8 player, u16 fadeTimer, u8 arg2); -void sequence_player_unlower(u8 player, u16 fadeTimer); -void set_sound_disabled(u8 disabled); +void seq_player_fade_out(u8 player, u16 fadeDuration); +void fade_volume_scale(u8 player, u8 targetScale, u16 fadeDuration); +void seq_player_lower_volume(u8 player, u16 fadeDuration, u8 percentage); +void seq_player_unlower_volume(u8 player, u16 fadeDuration); +void set_audio_muted(u8 muted); void sound_init(void); -void func_803205E8(u32 soundBits, f32 *vec); -void func_803206F8(f32 *arg0); -void func_80320890(void); +void get_currently_playing_sound(u8 bank, u8 *numPlayingSounds, u8 *numSoundsInBank, u8 *soundId); +void stop_sound(u32 soundBits, f32 *pos); +void stop_sounds_from_source(f32 *pos); +void stop_sounds_in_continuous_banks(void); void sound_banks_disable(u8 player, u16 bankMask); void sound_banks_enable(u8 player, u16 bankMask); -void func_80320A4C(u8 bankIndex, u8 arg1); +void set_sound_moving_speed(u8 bank, u8 speed); void play_dialog_sound(u8 dialogID); void set_sequence_player_volume(s32 player, f32 volume); void play_music(u8 player, u16 seqArgs, u16 fadeTimer); @@ -64,7 +68,8 @@ void audio_set_sound_mode(u8 arg0); void audio_init(void); // in load.c -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) +struct SPTask *unused_80321460(); struct SPTask *unused_80321460(void); #endif diff --git a/src/audio/heap.c b/src/audio/heap.c index 8d5a4622..95ec20ed 100644 --- a/src/audio/heap.c +++ b/src/audio/heap.c @@ -22,7 +22,7 @@ struct PoolSplit2 { u32 wantTemporary; }; // size = 0x8 -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) s16 gVolume; s8 gReverbDownsampleRate; u8 sReverbDownsampleRateLog; // never read @@ -40,15 +40,24 @@ struct SoundMultiPool gSeqLoadedPool; struct SoundMultiPool gBankLoadedPool; struct SoundMultiPool gUnusedLoadedPool; +#ifdef VERSION_SH +struct Unk1Pool gUnkPool1; +struct UnkPool gUnkPool2; +struct UnkPool gUnkPool3; +#endif + struct PoolSplit sSessionPoolSplit; struct PoolSplit2 sSeqAndBankPoolSplit; struct PoolSplit sPersistentCommonPoolSplit; struct PoolSplit sTemporaryCommonPoolSplit; +#ifdef VERSION_SH +u8 gUnkLoadStatus[0x40]; +#endif u8 gBankLoadStatus[0x40]; u8 gSeqLoadStatus[0x100]; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) volatile u8 gAudioResetStatus; u8 gAudioResetPresetIdToLoad; s32 gAudioResetFadeOutFramesLeft; @@ -58,8 +67,19 @@ u8 gAudioUnusedBuffer[0x1000]; extern s32 gMaxAudioCmds; -#ifdef VERSION_EU -/** +#ifdef VERSION_SH +void *get_bank_or_seq_inner(s32 poolIdx, s32 arg1, s32 bankId); +struct UnkEntry *func_sh_802f1ec4(u32 size); +void func_sh_802f2158(struct UnkEntry *entry); +struct UnkEntry *unk_pool2_alloc(u32 size); +void func_sh_802F2320(struct UnkEntry *entry, struct AudioBankSample *sample); +void func_sh_802f23ec(void); + +void unk_pools_init(u32 size1, u32 size2); +#endif + +#if defined(VERSION_EU) +/** * Assuming 'k' in [9, 24], * Computes a newton's method step for f(x) = x^k - d */ @@ -89,7 +109,7 @@ f64 root_newton_step(f64 x, s32 k, f64 d) return x - fx / deriv; } -/** +/** * Assuming 'k' in [9, 24], * Computes d ^ (1/k) * @@ -124,9 +144,7 @@ f64 kth_root(f64 d, s32 k) { return root; } -#endif -#ifdef VERSION_EU void build_vol_rampings_table(s32 UNUSED unused, s32 len) { s32 i; s32 step; @@ -152,6 +170,25 @@ void build_vol_rampings_table(s32 UNUSED unused, s32 len) { void reset_bank_and_seq_load_status(void) { s32 i; +#ifdef VERSION_SH + for (i = 0; i < 64; i++) { + if (gBankLoadStatus[i] != SOUND_LOAD_STATUS_5) { + gBankLoadStatus[i] = SOUND_LOAD_STATUS_NOT_LOADED; + } + } + + for (i = 0; i < 64; i++) { + if (gUnkLoadStatus[i] != SOUND_LOAD_STATUS_5) { + gUnkLoadStatus[i] = SOUND_LOAD_STATUS_NOT_LOADED; + } + } + + for (i = 0; i < 256; i++) { + if (gSeqLoadStatus[i] != SOUND_LOAD_STATUS_5) { + gSeqLoadStatus[i] = SOUND_LOAD_STATUS_NOT_LOADED; + } + } +#else for (i = 0; i < 64; i++) { gBankLoadStatus[i] = SOUND_LOAD_STATUS_NOT_LOADED; } @@ -159,6 +196,7 @@ void reset_bank_and_seq_load_status(void) { for (i = 0; i < 256; i++) { gSeqLoadStatus[i] = SOUND_LOAD_STATUS_NOT_LOADED; } +#endif } void discard_bank(s32 bankId) { @@ -167,19 +205,24 @@ void discard_bank(s32 bankId) { for (i = 0; i < gMaxSimultaneousNotes; i++) { struct Note *note = &gNotes[i]; -#ifdef VERSION_EU - if (note->noteSubEu.bankId == bankId) +#if defined(VERSION_EU) + if (note->noteSubEu.bankId == bankId) { +#elif defined(VERSION_SH) + if (note->unkSH33 == bankId) { #else - if (note->bankId == bankId) + if (note->bankId == bankId) { #endif - { // (These prints are unclear. Arguments are picked semi-randomly.) eu_stubbed_printf_1("Warning:Kill Note %x \n", i); +#ifdef VERSION_SH + if (note->unkSH34 == NOTE_PRIORITY_DISABLED && note->priority) { +#else if (note->priority >= NOTE_PRIORITY_MIN) { +#endif eu_stubbed_printf_3("Kill Voice %d (ID %d) %d\n", note->waveId, bankId, note->priority); eu_stubbed_printf_0("Warning: Running Sequence's data disappear!\n"); - note->parentLayer->enabled = FALSE; + note->parentLayer->enabled = FALSE; // is 0x48, should be 0x44 note->parentLayer->finished = TRUE; } note_disable(note); @@ -194,7 +237,7 @@ void discard_sequence(s32 seqId) { for (i = 0; i < SEQUENCE_PLAYERS; i++) { if (gSequencePlayers[i].enabled && gSequencePlayers[i].seqId == seqId) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) sequence_player_disable(&gSequencePlayers[i]); #else sequence_player_disable(gSequencePlayers + i); @@ -217,7 +260,9 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) { fprintf(stderr, "soundAlloc failed: tried to alloc %u bytes at %p (%i free)\n", ALIGN16(size), (void*)pool, pool->start + pool->size - pool->cur); return NULL; } +#ifdef VERSION_SH pool->numAllocatedEntries++; +#endif return start; #else u32 alignedSize = ALIGN16(size); @@ -238,10 +283,27 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) { #endif } -void sound_alloc_pool_init(struct SoundAllocPool *pool, void *memAddr, u32 size) { - pool->cur = pool->start = (u8*)ALIGN16((uintptr_t)memAddr); #ifdef VERSION_SH - pool->size = size - ((uintptr_t)memAddr & 0xf); +void *sound_alloc_uninitialized(struct SoundAllocPool *pool, u32 size) { + u8 *start; + u32 alignedSize = ALIGN16(size); + + start = pool->cur; + if (start + alignedSize <= pool->start + pool->size) { + pool->cur += alignedSize; + } else { + return NULL; + } + + pool->numAllocatedEntries++; + return start; +} +#endif + +void sound_alloc_pool_init(struct SoundAllocPool *pool, void *memAddr, u32 size) { + pool->cur = pool->start = (u8 *) ALIGN16((uintptr_t) memAddr); +#ifdef VERSION_SH + pool->size = size - ((uintptr_t) memAddr & 0xf); #else pool->size = size; #endif @@ -259,12 +321,12 @@ void temporary_pool_clear(struct TemporaryPool *temporary) { temporary->pool.cur = temporary->pool.start; temporary->nextSide = 0; temporary->entries[0].ptr = temporary->pool.start; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) temporary->entries[1].ptr = temporary->pool.start + temporary->pool.size; #else temporary->entries[1].ptr = temporary->pool.size + temporary->pool.start; #endif - temporary->entries[0].id = -1; + temporary->entries[0].id = -1; // should be at 1e not 1c temporary->entries[1].id = -1; } @@ -273,28 +335,35 @@ void unused_803160F8(struct SoundAllocPool *pool) { pool->cur = pool->start; } +extern s32 D_SH_80315EE8; void sound_init_main_pools(s32 sizeForAudioInitPool) { sound_alloc_pool_init(&gAudioInitPool, gAudioHeap, sizeForAudioInitPool); sound_alloc_pool_init(&gAudioSessionPool, gAudioHeap + sizeForAudioInitPool, gAudioHeapSize - sizeForAudioInitPool); } +#ifdef VERSION_SH +#define SOUND_ALLOC_FUNC sound_alloc_uninitialized +#else +#define SOUND_ALLOC_FUNC soundAlloc +#endif + void session_pools_init(struct PoolSplit *a) { gAudioSessionPool.cur = gAudioSessionPool.start; - sound_alloc_pool_init(&gNotesAndBuffersPool, soundAlloc(&gAudioSessionPool, a->wantSeq), a->wantSeq); - sound_alloc_pool_init(&gSeqAndBankPool, soundAlloc(&gAudioSessionPool, a->wantCustom), a->wantCustom); + sound_alloc_pool_init(&gNotesAndBuffersPool, SOUND_ALLOC_FUNC(&gAudioSessionPool, a->wantSeq), a->wantSeq); + sound_alloc_pool_init(&gSeqAndBankPool, SOUND_ALLOC_FUNC(&gAudioSessionPool, a->wantCustom), a->wantCustom); } void seq_and_bank_pool_init(struct PoolSplit2 *a) { gSeqAndBankPool.cur = gSeqAndBankPool.start; - sound_alloc_pool_init(&gPersistentCommonPool, soundAlloc(&gSeqAndBankPool, a->wantPersistent), a->wantPersistent); - sound_alloc_pool_init(&gTemporaryCommonPool, soundAlloc(&gSeqAndBankPool, a->wantTemporary), a->wantTemporary); + sound_alloc_pool_init(&gPersistentCommonPool, SOUND_ALLOC_FUNC(&gSeqAndBankPool, a->wantPersistent), a->wantPersistent); + sound_alloc_pool_init(&gTemporaryCommonPool, SOUND_ALLOC_FUNC(&gSeqAndBankPool, a->wantTemporary), a->wantTemporary); } void persistent_pools_init(struct PoolSplit *a) { gPersistentCommonPool.cur = gPersistentCommonPool.start; - sound_alloc_pool_init(&gSeqLoadedPool.persistent.pool, soundAlloc(&gPersistentCommonPool, a->wantSeq), a->wantSeq); - sound_alloc_pool_init(&gBankLoadedPool.persistent.pool, soundAlloc(&gPersistentCommonPool, a->wantBank), a->wantBank); - sound_alloc_pool_init(&gUnusedLoadedPool.persistent.pool, soundAlloc(&gPersistentCommonPool, a->wantUnused), + sound_alloc_pool_init(&gSeqLoadedPool.persistent.pool, SOUND_ALLOC_FUNC(&gPersistentCommonPool, a->wantSeq), a->wantSeq); + sound_alloc_pool_init(&gBankLoadedPool.persistent.pool, SOUND_ALLOC_FUNC(&gPersistentCommonPool, a->wantBank), a->wantBank); + sound_alloc_pool_init(&gUnusedLoadedPool.persistent.pool, SOUND_ALLOC_FUNC(&gPersistentCommonPool, a->wantUnused), a->wantUnused); persistent_pool_clear(&gSeqLoadedPool.persistent); persistent_pool_clear(&gBankLoadedPool.persistent); @@ -303,28 +372,36 @@ void persistent_pools_init(struct PoolSplit *a) { void temporary_pools_init(struct PoolSplit *a) { gTemporaryCommonPool.cur = gTemporaryCommonPool.start; - sound_alloc_pool_init(&gSeqLoadedPool.temporary.pool, soundAlloc(&gTemporaryCommonPool, a->wantSeq), a->wantSeq); - sound_alloc_pool_init(&gBankLoadedPool.temporary.pool, soundAlloc(&gTemporaryCommonPool, a->wantBank), a->wantBank); - sound_alloc_pool_init(&gUnusedLoadedPool.temporary.pool, soundAlloc(&gTemporaryCommonPool, a->wantUnused), + sound_alloc_pool_init(&gSeqLoadedPool.temporary.pool, SOUND_ALLOC_FUNC(&gTemporaryCommonPool, a->wantSeq), a->wantSeq); + sound_alloc_pool_init(&gBankLoadedPool.temporary.pool, SOUND_ALLOC_FUNC(&gTemporaryCommonPool, a->wantBank), a->wantBank); + sound_alloc_pool_init(&gUnusedLoadedPool.temporary.pool, SOUND_ALLOC_FUNC(&gTemporaryCommonPool, a->wantUnused), a->wantUnused); temporary_pool_clear(&gSeqLoadedPool.temporary); temporary_pool_clear(&gBankLoadedPool.temporary); temporary_pool_clear(&gUnusedLoadedPool.temporary); } +#undef SOUND_ALLOC_FUNC -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) static void unused_803163D4(void) { } #endif +#ifdef VERSION_SH +void *alloc_bank_or_seq(s32 poolIdx, s32 size, s32 arg3, s32 id) { +#else void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id) { +#endif // arg3 = 0, 1 or 2? +#ifdef VERSION_SH + struct SoundMultiPool *arg0; +#define isSound poolIdx +#endif struct TemporaryPool *tp; - struct PersistentPool *persistent = &arg0->persistent; struct SoundAllocPool *pool; void *ret; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) u16 UNUSED _firstVal; u16 UNUSED _secondVal; #else @@ -332,9 +409,12 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg u16 secondVal; #endif u32 nullID = -1; + UNUSED s32 i; u8 *table = NULL; +#ifndef VERSION_SH u8 isSound; -#ifndef VERSION_EU +#endif +#if defined(VERSION_JP) || defined(VERSION_US) u16 firstVal; u16 secondVal; u32 bothDiscardable; @@ -343,8 +423,28 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg u32 leftAvail, rightAvail; #endif +#ifdef VERSION_SH + switch (poolIdx) { + case 0: + arg0 = &gSeqLoadedPool; + table = gSeqLoadStatus; + break; + + case 1: + arg0 = &gBankLoadedPool; + table = gBankLoadStatus; + break; + + case 2: + arg0 = &gUnusedLoadedPool; + table = gUnkLoadStatus; + break; + } +#endif + if (arg3 == 0) { tp = &arg0->temporary; +#ifndef VERSION_SH if (arg0 == &gSeqLoadedPool) { table = gSeqLoadStatus; isSound = FALSE; @@ -352,15 +452,29 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg table = gBankLoadStatus; isSound = TRUE; } +#endif if (table == NULL) { return NULL; } +#ifdef VERSION_SH + if (tp->entries[0].id == (s8)nullID) { + firstVal = SOUND_LOAD_STATUS_NOT_LOADED; + } else { + firstVal = table[tp->entries[0].id]; + } + if (tp->entries[1].id == (s8)nullID) { + secondVal = SOUND_LOAD_STATUS_NOT_LOADED; + } else { + secondVal = table[tp->entries[1].id]; + } +#else firstVal = (tp->entries[0].id == (s8)nullID ? SOUND_LOAD_STATUS_NOT_LOADED : table[tp->entries[0].id]); secondVal = (tp->entries[1].id == (s8)nullID ? SOUND_LOAD_STATUS_NOT_LOADED : table[tp->entries[1].id]); +#endif -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) leftNotLoaded = (firstVal == SOUND_LOAD_STATUS_NOT_LOADED); leftDiscardable = (firstVal == SOUND_LOAD_STATUS_DISCARDABLE); leftAvail = (firstVal != SOUND_LOAD_STATUS_IN_PROGRESS); @@ -388,12 +502,45 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg return NULL; } #else +#ifdef VERSION_EU if (0) { // It's unclear where these string literals go. eu_stubbed_printf_0("DataHeap Not Allocate \n"); eu_stubbed_printf_1("StayHeap Not Allocate %d\n", 0); eu_stubbed_printf_1("AutoHeap Not Allocate %d\n", 0); } +#endif + +#ifdef VERSION_SH + if (poolIdx == 1) { + if (firstVal == SOUND_LOAD_STATUS_4) { + for (i = 0; i < gMaxSimultaneousNotes; i++) { + if (gNotes[i].unkSH33 == tp->entries[0].id && gNotes[i].noteSubEu.enabled) { + break; + } + } + if (i == gMaxSimultaneousNotes) { + if (gBankLoadStatus[tp->entries[0].id] != SOUND_LOAD_STATUS_5) { + gBankLoadStatus[tp->entries[0].id] = SOUND_LOAD_STATUS_DISCARDABLE; + } + firstVal = SOUND_LOAD_STATUS_DISCARDABLE; + } + } + if (secondVal == SOUND_LOAD_STATUS_4) { + for (i = 0; i < gMaxSimultaneousNotes; i++) { + if (gNotes[i].unkSH33 == tp->entries[1].id && gNotes[i].noteSubEu.enabled) { + break; + } + } + if (i == gMaxSimultaneousNotes) { + if (gBankLoadStatus[tp->entries[1].id] != SOUND_LOAD_STATUS_5) { + gBankLoadStatus[tp->entries[1].id] = SOUND_LOAD_STATUS_DISCARDABLE; + } + secondVal = SOUND_LOAD_STATUS_DISCARDABLE; + } + } + } +#endif if (firstVal == SOUND_LOAD_STATUS_NOT_LOADED) { tp->nextSide = 0; @@ -408,6 +555,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg } else if (secondVal == SOUND_LOAD_STATUS_DISCARDABLE) { tp->nextSide = 1; } else { +#ifdef VERSION_EU eu_stubbed_printf_0("WARNING: NO STOP AUTO AREA.\n"); eu_stubbed_printf_0(" AND TRY FORCE TO STOP SIDE \n"); if (firstVal != SOUND_LOAD_STATUS_IN_PROGRESS) { @@ -419,6 +567,76 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg eu_stubbed_printf_0("TWO SIDES ARE LOADING... ALLOC CANCELED.\n"); return NULL; } +#else + if (poolIdx == 0) { + if (firstVal == SOUND_LOAD_STATUS_COMPLETE) { + for (i = 0; i < SEQUENCE_PLAYERS; i++) { + if (gSequencePlayers[i].enabled && gSequencePlayers[i].seqId == tp->entries[0].id) { + break; + } + } + if (i == SEQUENCE_PLAYERS) { + tp->nextSide = 0; + goto out; + } + } + if (secondVal == SOUND_LOAD_STATUS_COMPLETE) { + for (i = 0; i < SEQUENCE_PLAYERS; i++) { + if (gSequencePlayers[i].enabled && gSequencePlayers[i].seqId == tp->entries[1].id) { + break; + } + } + if (i == SEQUENCE_PLAYERS) { + tp->nextSide = 1; + goto out; + } + } + } else if (poolIdx == 1) { + if (firstVal == SOUND_LOAD_STATUS_COMPLETE) { + for (i = 0; i < gMaxSimultaneousNotes; i++) { + if (gNotes[i].unkSH33 == tp->entries[0].id && gNotes[i].noteSubEu.enabled) { + break; + } + } + if (i == gMaxSimultaneousNotes) { + tp->nextSide = 0; + goto out; + } + } + if (secondVal == SOUND_LOAD_STATUS_COMPLETE) { + for (i = 0; i < gMaxSimultaneousNotes; i++) { + if (gNotes[i].unkSH33 == tp->entries[1].id && gNotes[i].noteSubEu.enabled) { + break; + } + } + if (i == gMaxSimultaneousNotes) { + tp->nextSide = 1; + goto out; + } + } + } + if (tp->nextSide == 0) { + if (firstVal == SOUND_LOAD_STATUS_IN_PROGRESS) { + if (secondVal != SOUND_LOAD_STATUS_IN_PROGRESS) { + tp->nextSide = 1; + goto out; + } + } else { + goto out; + } + } else { + if (secondVal == SOUND_LOAD_STATUS_IN_PROGRESS) { + if (firstVal != SOUND_LOAD_STATUS_IN_PROGRESS) { + tp->nextSide = 0; + goto out; + } + } else { + goto out; + } + } + return NULL; + out:; +#endif } } #endif @@ -439,6 +657,9 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg pool->cur = pool->start + size; +#ifdef VERSION_SH + if (tp->entries[1].id != (s32)nullID) +#endif if (tp->entries[1].ptr < pool->cur) { eu_stubbed_printf_0("WARNING: Before Area Overlaid After."); @@ -456,7 +677,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg } tp->entries[1].id = (s32)nullID; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) tp->entries[1].ptr = pool->start + pool->size; #else tp->entries[1].ptr = pool->size + pool->start; @@ -467,7 +688,9 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg break; case 1: -#ifdef VERSION_EU +#if defined(VERSION_SH) + tp->entries[1].ptr = (u8 *) ((uintptr_t) (pool->start + pool->size - size) & ~0x0f); +#elif defined(VERSION_EU) tp->entries[1].ptr = pool->start + pool->size - size - 0x10; #else tp->entries[1].ptr = pool->size + pool->start - size - 0x10; @@ -475,6 +698,9 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg tp->entries[1].id = id; tp->entries[1].size = size; +#ifdef VERSION_SH + if (tp->entries[0].id != (s32)nullID) +#endif if (tp->entries[1].ptr < pool->cur) { eu_stubbed_printf_0("WARNING: After Area Overlaid Before."); @@ -508,28 +734,37 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg return ret; } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) +#ifdef VERSION_SH + ret = sound_alloc_uninitialized(&arg0->persistent.pool, size); +#else ret = soundAlloc(&arg0->persistent.pool, arg1 * size); +#endif arg0->persistent.entries[arg0->persistent.numEntries].ptr = ret; if (ret == NULL) #else - persistent->entries[persistent->numEntries].ptr = soundAlloc(&persistent->pool, arg1 * size); + arg0->persistent.entries[arg0->persistent.numEntries].ptr = soundAlloc(&arg0->persistent.pool, arg1 * size); - if (persistent->entries[persistent->numEntries].ptr == NULL) + if (arg0->persistent.entries[arg0->persistent.numEntries].ptr == NULL) #endif { switch (arg3) { case 2: +#if defined(VERSION_EU) eu_stubbed_printf_0("MEMORY:StayHeap OVERFLOW."); -#ifdef VERSION_EU return alloc_bank_or_seq(arg0, arg1, size, 0, id); +#elif defined(VERSION_SH) + return alloc_bank_or_seq(poolIdx, size, 0, id); #else // Prevent tail call optimization. ret = alloc_bank_or_seq(arg0, arg1, size, 0, id); return ret; #endif case 1: +#ifdef VERSION_SH + case 0: +#endif eu_stubbed_printf_1("MEMORY:StayHeap OVERFLOW (REQ:%d)", arg1 * size); return NULL; } @@ -537,15 +772,76 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg // TODO: why is this guaranteed to write <= 32 entries...? // Because the buffer is small enough that more don't fit? - persistent->entries[persistent->numEntries].id = id; - persistent->entries[persistent->numEntries].size = size; -#ifdef VERSION_EU - return persistent->entries[persistent->numEntries++].ptr; + arg0->persistent.entries[arg0->persistent.numEntries].id = id; + arg0->persistent.entries[arg0->persistent.numEntries].size = size; +#if defined(VERSION_EU) || defined(VERSION_SH) + return arg0->persistent.entries[arg0->persistent.numEntries++].ptr; #else - persistent->numEntries++; return persistent->entries[persistent->numEntries - 1].ptr; + arg0->persistent.numEntries++; return arg0->persistent.entries[arg0->persistent.numEntries - 1].ptr; +#endif +#ifdef VERSION_SH +#undef isSound #endif } +#ifdef VERSION_SH +void *get_bank_or_seq(s32 poolIdx, s32 arg1, s32 id) { + void *ret; + + ret = unk_pool1_lookup(poolIdx, id); + if (ret != NULL) { + return ret; + } + if (arg1 == 3) { + return NULL; + } + return get_bank_or_seq_inner(poolIdx, arg1, id); +} +void *get_bank_or_seq_inner(s32 poolIdx, s32 arg1, s32 bankId) { + u32 i; + struct SoundMultiPool* loadedPool; + struct TemporaryPool* temporary; + struct PersistentPool* persistent; + + switch (poolIdx) { + case 0: + loadedPool = &gSeqLoadedPool; + break; + case 1: + loadedPool = &gBankLoadedPool; + break; + case 2: + loadedPool = &gUnusedLoadedPool; + break; + } + + temporary = &loadedPool->temporary; + if (arg1 == 0) { + if (temporary->entries[0].id == bankId) { + temporary->nextSide = 1; + return temporary->entries[0].ptr; + } else if (temporary->entries[1].id == bankId) { + temporary->nextSide = 0; + return temporary->entries[1].ptr; + } else { + return NULL; + } + } + + persistent = &loadedPool->persistent; + for (i = 0; i < persistent->numEntries; i++) { + if (persistent->entries[i].id == bankId) { + return persistent->entries[i].ptr; + } + } + + if (arg1 == 2) { + return get_bank_or_seq(poolIdx, 0, bankId); + } + return NULL; +} +#endif +#ifndef VERSION_SH void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id) { u32 i; UNUSED void *ret; @@ -572,7 +868,7 @@ void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id) { } if (arg1 == 2) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) return get_bank_or_seq(arg0, 0, id); #else // Prevent tail call optimization by using a temporary. @@ -584,8 +880,9 @@ void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id) { return NULL; } } +#endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) void func_eu_802e27e4_unused(f32 arg0, f32 arg1, u16 *arg2) { s32 i; f32 tmp[16]; @@ -605,6 +902,7 @@ void func_eu_802e27e4_unused(f32 arg0, f32 arg1, u16 *arg2) { arg2[i] = tmp[i]; } +#ifdef VERSION_EU for (i = 0; i < 8; i++) { eu_stubbed_printf_1("%d ", arg2[i]); } @@ -614,30 +912,102 @@ void func_eu_802e27e4_unused(f32 arg0, f32 arg1, u16 *arg2) { eu_stubbed_printf_1("%d ", arg2[i]); } eu_stubbed_printf_0("\n"); +#endif +} +#endif + +#ifdef VERSION_SH +void fill_zero_filter(s16 filter[]) { + s32 i; + for (i = 0; i < 8; i++) { + filter[i] = 0; + } +} + +extern s16 unk_sh_data_3[15 * 8]; +extern s16 unk_sh_data_4[15 * 8]; +void func_sh_802F0DE8(s16 filter[8], s32 arg1) { + s32 i; + s16 *ptr = &unk_sh_data_3[8 * (arg1 - 1)]; + for (i = 0; i < 8; i++) { + filter[i] = ptr[i]; + } +} + +void func_sh_802F0E40(s16 filter[8], s32 arg1) { // Unused + s32 i; + s16 *ptr = &unk_sh_data_4[8 * (arg1 - 1)]; + for (i = 0; i < 8; i++) { + filter[i] = ptr[i]; + } +} + +void fill_filter(s16 filter[8], s32 arg1, s32 arg2) { + s32 i; + s16 *ptr; + if (arg1 != 0) { + func_sh_802F0DE8(filter, arg1); + } else { + fill_zero_filter(filter); + } + if (arg2 != 0) { + ptr = &unk_sh_data_4[8 * (arg2 - 1)]; + for (i = 0; i < 8; i++) { + filter[i] += ptr[i]; + } + } } #endif void decrease_reverb_gain(void) { -#ifdef VERSION_EU +#if defined(VERSION_EU) s32 i; for (i = 0; i < gNumSynthesisReverbs; i++) { gSynthesisReverbs[i].reverbGain -= gSynthesisReverbs[i].reverbGain / 8; } -#else +#elif defined(VERSION_JP) || defined(VERSION_US) gSynthesisReverb.reverbGain -= gSynthesisReverb.reverbGain / 4; +#else + s32 i, j; + s32 v0 = gAudioBufferParameters.presetUnk4 == 2 ? 2 : 1; + for (i = 0; i < gNumSynthesisReverbs; i++) { + for (j = 0; j < v0; j++) { + gSynthesisReverbs[i].reverbGain -= gSynthesisReverbs[i].reverbGain / 3; + } + } #endif } -#ifdef VERSION_EU +#if defined(VERSION_SH) +void clear_curr_ai_buffer(void) { + s32 currIndex = gCurrAiBufferIndex; + s32 i; + gAiBufferLengths[currIndex] = gAudioBufferParameters.minAiBufferLength; + for (i = 0; i < (s32) (AIBUFFER_LEN / sizeof(s16)); i++) { + gAiBuffers[currIndex][i] = 0; + } +} +#endif + + +#if defined(VERSION_EU) || defined(VERSION_SH) s32 audio_shut_down_and_reset_step(void) { s32 i; s32 j; +#ifdef VERSION_SH + s32 num = gAudioBufferParameters.presetUnk4 == 2 ? 2 : 1; +#endif + switch (gAudioResetStatus) { case 5: for (i = 0; i < SEQUENCE_PLAYERS; i++) { sequence_player_disable(&gSequencePlayers[i]); } +#ifdef VERSION_SH + gAudioResetFadeOutFramesLeft = 4 / num; +#else gAudioResetFadeOutFramesLeft = 4; +#endif gAudioResetStatus--; break; case 4: @@ -651,13 +1021,21 @@ s32 audio_shut_down_and_reset_step(void) { gNotes[i].adsr.action |= ADSR_ACTION_RELEASE; } } +#ifdef VERSION_SH + gAudioResetFadeOutFramesLeft = 16 / num; +#else gAudioResetFadeOutFramesLeft = 16; +#endif gAudioResetStatus--; } break; case 3: if (gAudioResetFadeOutFramesLeft != 0) { gAudioResetFadeOutFramesLeft--; +#ifdef VERSION_SH + if (1) { + } +#endif decrease_reverb_gain(); } else { for (i = 0; i < NUMAIBUFFERS; i++) { @@ -665,21 +1043,43 @@ s32 audio_shut_down_and_reset_step(void) { gAiBuffers[i][j] = 0; } } +#ifdef VERSION_SH + gAudioResetFadeOutFramesLeft = 4 / num; +#else gAudioResetFadeOutFramesLeft = 4; +#endif gAudioResetStatus--; } break; case 2: +#ifdef VERSION_SH + clear_curr_ai_buffer(); +#endif if (gAudioResetFadeOutFramesLeft != 0) { gAudioResetFadeOutFramesLeft--; } else { gAudioResetStatus--; +#ifdef VERSION_SH + func_sh_802f23ec(); +#endif } break; case 1: audio_reset_session(); gAudioResetStatus = 0; +#ifdef VERSION_SH + for (i = 0; i < NUMAIBUFFERS; i++) { + gAiBufferLengths[i] = gAudioBufferParameters.maxAiBufferLength; + for (j = 0; j < (s32) (AIBUFFER_LEN / sizeof(s16)); j++) { + gAiBuffers[i][j] = 0; + } + } +#endif } +#ifdef VERSION_SH + if (gAudioResetFadeOutFramesLeft) { + } +#endif if (gAudioResetStatus < 3) { return 0; } @@ -694,7 +1094,7 @@ void wait_for_audio_frames(UNUSED s32 frames) { } #endif -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) void audio_reset_session(struct AudioSessionSettings *preset) { #else void audio_reset_session(void) { @@ -702,7 +1102,7 @@ void audio_reset_session(void) { struct ReverbSettingsEU *reverbSettings; #endif s16 *mem; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) s8 updatesPerFrame; s32 reverbWindowSize; s32 k; @@ -713,7 +1113,7 @@ void audio_reset_session(void) { s32 temporaryMem; s32 totalMem; s32 wantMisc; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) s32 frames; s32 remainingDmas; #else @@ -721,7 +1121,7 @@ void audio_reset_session(void) { #endif eu_stubbed_printf_1("Heap Reconstruct Start %x\n", gAudioResetPresetIdToLoad); -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) { decrease_reverb_gain(); for (i = 0; i < gMaxSimultaneousNotes; i++) { @@ -780,18 +1180,27 @@ void audio_reset_session(void) { #endif gSampleDmaNumListItems = 0; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) gAudioBufferParameters.frequency = preset->frequency; gAudioBufferParameters.aiFrequency = osAiSetFrequency(gAudioBufferParameters.frequency); gAudioBufferParameters.samplesPerFrameTarget = ALIGN16(gAudioBufferParameters.frequency / gRefreshRate); gAudioBufferParameters.minAiBufferLength = gAudioBufferParameters.samplesPerFrameTarget - 0x10; gAudioBufferParameters.maxAiBufferLength = gAudioBufferParameters.samplesPerFrameTarget + 0x10; +#ifdef VERSION_SH + gAudioBufferParameters.updatesPerFrame = (gAudioBufferParameters.samplesPerFrameTarget + 0x10) / 192 + 1; + gAudioBufferParameters.samplesPerUpdate = (gAudioBufferParameters.samplesPerFrameTarget / gAudioBufferParameters.updatesPerFrame) & -8; +#else gAudioBufferParameters.updatesPerFrame = (gAudioBufferParameters.samplesPerFrameTarget + 0x10) / 160 + 1; gAudioBufferParameters.samplesPerUpdate = (gAudioBufferParameters.samplesPerFrameTarget / gAudioBufferParameters.updatesPerFrame) & 0xfff8; +#endif gAudioBufferParameters.samplesPerUpdateMax = gAudioBufferParameters.samplesPerUpdate + 8; gAudioBufferParameters.samplesPerUpdateMin = gAudioBufferParameters.samplesPerUpdate - 8; gAudioBufferParameters.resampleRate = 32000.0f / FLOAT_CAST(gAudioBufferParameters.frequency); +#ifdef VERSION_SH + gAudioBufferParameters.unkUpdatesPerFrameScaled = (1.0f / 256.0f) / gAudioBufferParameters.updatesPerFrame; +#else gAudioBufferParameters.unkUpdatesPerFrameScaled = (3.0f / 1280.0f) / gAudioBufferParameters.updatesPerFrame; +#endif gAudioBufferParameters.updatesPerFrameInv = 1.0f / gAudioBufferParameters.updatesPerFrame; gMaxSimultaneousNotes = preset->maxSimultaneousNotes; @@ -804,7 +1213,14 @@ void audio_reset_session(void) { gAudioBufferParameters.minAiBufferLength *= gAudioBufferParameters.presetUnk4; gAudioBufferParameters.updatesPerFrame *= gAudioBufferParameters.presetUnk4; +#ifdef VERSION_SH + if (gAudioBufferParameters.presetUnk4 >= 2) { + gAudioBufferParameters.maxAiBufferLength -= 0x10; + } + gMaxAudioCmds = gMaxSimultaneousNotes * 0x14 * gAudioBufferParameters.updatesPerFrame + preset->numReverbs * 0x20 + 0x1E0; +#else gMaxAudioCmds = gMaxSimultaneousNotes * 0x10 * gAudioBufferParameters.updatesPerFrame + preset->numReverbs * 0x20 + 0x300; +#endif #else reverbWindowSize = preset->reverbWindowSize; gAiFrequency = osAiSetFrequency(preset->frequency); @@ -849,7 +1265,10 @@ void audio_reset_session(void) { gMaxAudioCmds = gMaxSimultaneousNotes * 20 * updatesPerFrame + 320; #endif -#ifdef VERSION_EU +#if defined(VERSION_SH) + persistentMem = DOUBLE_SIZE_ON_64_BIT(preset->persistentSeqMem + preset->persistentBankMem + preset->unk18 + preset->unkMem28 + 0x10); + temporaryMem = DOUBLE_SIZE_ON_64_BIT(preset->temporarySeqMem + preset->temporaryBankMem + preset->unk24 + preset->unkMem2C + 0x10); +#elif defined(VERSION_EU) persistentMem = DOUBLE_SIZE_ON_64_BIT(preset->persistentSeqMem + preset->persistentBankMem); temporaryMem = DOUBLE_SIZE_ON_64_BIT(preset->temporarySeqMem + preset->temporaryBankMem); #else @@ -866,15 +1285,26 @@ void audio_reset_session(void) { seq_and_bank_pool_init(&sSeqAndBankPoolSplit); sPersistentCommonPoolSplit.wantSeq = DOUBLE_SIZE_ON_64_BIT(preset->persistentSeqMem); sPersistentCommonPoolSplit.wantBank = DOUBLE_SIZE_ON_64_BIT(preset->persistentBankMem); +#ifdef VERSION_SH + sPersistentCommonPoolSplit.wantUnused = preset->unk18; +#else sPersistentCommonPoolSplit.wantUnused = 0; +#endif persistent_pools_init(&sPersistentCommonPoolSplit); sTemporaryCommonPoolSplit.wantSeq = DOUBLE_SIZE_ON_64_BIT(preset->temporarySeqMem); sTemporaryCommonPoolSplit.wantBank = DOUBLE_SIZE_ON_64_BIT(preset->temporaryBankMem); +#ifdef VERSION_SH + sTemporaryCommonPoolSplit.wantUnused = preset->unk24; +#else sTemporaryCommonPoolSplit.wantUnused = 0; +#endif temporary_pools_init(&sTemporaryCommonPoolSplit); +#ifdef VERSION_SH + unk_pools_init(preset->unkMem28, preset->unkMem2C); +#endif reset_bank_and_seq_load_status(); -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) for (j = 0; j < 2; j++) { gAudioCmdBuffers[j] = soundAlloc(&gNotesAndBuffersPool, gMaxAudioCmds * sizeof(u64)); } @@ -884,7 +1314,7 @@ void audio_reset_session(void) { note_init_all(); init_note_free_list(); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) gNoteSubsEu = soundAlloc(&gNotesAndBuffersPool, (gAudioBufferParameters.updatesPerFrame * gMaxSimultaneousNotes) * sizeof(struct NoteSubEu)); for (j = 0; j != 2; j++) { @@ -898,9 +1328,21 @@ void audio_reset_session(void) { for (j = 0; j < gNumSynthesisReverbs; j++) { reverb = &gSynthesisReverbs[j]; reverbSettings = &preset->reverbSettings[j]; +#ifdef VERSION_SH + reverb->downsampleRate = reverbSettings->downsampleRate; + reverb->windowSize = reverbSettings->windowSize * 64; + reverb->windowSize /= reverb->downsampleRate; +#else reverb->windowSize = reverbSettings->windowSize * 64; reverb->downsampleRate = reverbSettings->downsampleRate; +#endif reverb->reverbGain = reverbSettings->gain; +#ifdef VERSION_SH + reverb->panRight = reverbSettings->unk4; + reverb->panLeft = reverbSettings->unk6; + reverb->unk5 = reverbSettings->unk8; + reverb->unk08 = reverbSettings->unkA; +#endif reverb->useReverb = 8; reverb->ringBuffer.left = soundAlloc(&gNotesAndBuffersPool, reverb->windowSize * 2); reverb->ringBuffer.right = soundAlloc(&gNotesAndBuffersPool, reverb->windowSize * 2); @@ -909,8 +1351,13 @@ void audio_reset_session(void) { reverb->curFrame = 0; reverb->bufSizePerChannel = reverb->windowSize; reverb->framesLeftToIgnore = 2; +#ifdef VERSION_SH + reverb->resampleFlags = A_INIT; +#endif if (reverb->downsampleRate != 1) { +#ifndef VERSION_SH reverb->resampleFlags = A_INIT; +#endif reverb->resampleRate = 0x8000 / reverb->downsampleRate; reverb->resampleStateLeft = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16)); reverb->resampleStateRight = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16)); @@ -925,6 +1372,22 @@ void audio_reset_session(void) { reverb->items[1][i].toDownsampleRight = mem + DEFAULT_LEN_1CH / sizeof(s16); } } +#ifdef VERSION_SH + if (reverbSettings->unkC != 0) { + reverb->unk108 = sound_alloc_uninitialized(&gNotesAndBuffersPool, 16 * sizeof(s16)); + reverb->unk100 = sound_alloc_uninitialized(&gNotesAndBuffersPool, 8 * sizeof(s16)); + func_sh_802F0DE8(reverb->unk100, reverbSettings->unkC); + } else { + reverb->unk100 = NULL; + } + if (reverbSettings->unkE != 0) { + reverb->unk10C = sound_alloc_uninitialized(&gNotesAndBuffersPool, 16 * sizeof(s16)); + reverb->unk104 = sound_alloc_uninitialized(&gNotesAndBuffersPool, 8 * sizeof(s16)); + func_sh_802F0DE8(reverb->unk104, reverbSettings->unkE); + } else { + reverb->unk104 = NULL; + } +#endif } #else @@ -961,19 +1424,306 @@ void audio_reset_session(void) { init_sample_dma_buffers(gMaxSimultaneousNotes); -#ifdef VERSION_EU +#if defined(VERSION_EU) build_vol_rampings_table(0, gAudioBufferParameters.samplesPerUpdate); #endif +#ifdef VERSION_SH + D_SH_8034F68C = 0; + D_SH_803479B4 = 4096; +#endif + osWritebackDCacheAll(); -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) { gAudioLoadLock = AUDIO_LOCK_NOT_LOADING; } #endif } +#ifdef VERSION_SH +void *unk_pool1_lookup(s32 poolIdx, s32 id) { + s32 i; + + for (i = 0; i < gUnkPool1.pool.numAllocatedEntries; i++) { + if (gUnkPool1.entries[i].poolIndex == poolIdx && gUnkPool1.entries[i].id == id) { + return gUnkPool1.entries[i].ptr; + } + } + return NULL; +} + +void *unk_pool1_alloc(s32 poolIndex, s32 arg1, u32 size) { + void *ret; + s32 pos; + + pos = gUnkPool1.pool.numAllocatedEntries; + ret = sound_alloc_uninitialized(&gUnkPool1.pool, size); + gUnkPool1.entries[pos].ptr = ret; + if (ret == NULL) { + return NULL; + } + gUnkPool1.entries[pos].poolIndex = poolIndex; + gUnkPool1.entries[pos].id = arg1; + gUnkPool1.entries[pos].size = size; + +#ifdef AVOID_UB + //! @bug UB: missing return. "ret" is in v0 at this point, but doing an + // explicit return uses an additional register. + return ret; +#endif +} + +u8 *func_sh_802f1d40(u32 size, s32 bank, u8 *arg2, s8 medium) { + struct UnkEntry *ret; + + ret = func_sh_802f1ec4(size); + if (ret != NULL) { + ret->bankId = bank; + ret->dstAddr = arg2; + ret->medium = medium; + return ret->srcAddr; + } + return NULL; +} +u8 *func_sh_802f1d90(u32 size, s32 bank, u8 *arg2, s8 medium) { + struct UnkEntry *ret; + + ret = unk_pool2_alloc(size); + if (ret != NULL) { + ret->bankId = bank; + ret->dstAddr = arg2; + ret->medium = medium; + return ret->srcAddr; + } + return NULL; +} +u8 *func_sh_802f1de0(u32 size, s32 bank, u8 *arg2, s8 medium) { // duplicated function? + struct UnkEntry *ret; + + ret = unk_pool2_alloc(size); + if (ret != NULL) { + ret->bankId = bank; + ret->dstAddr = arg2; + ret->medium = medium; + return ret->srcAddr; + } + return NULL; +} +void unk_pools_init(u32 size1, u32 size2) { + void *mem; + + mem = sound_alloc_uninitialized(&gPersistentCommonPool, size1); + if (mem == NULL) { + gUnkPool2.pool.size = 0; + } else { + sound_alloc_pool_init(&gUnkPool2.pool, mem, size1); + } + mem = sound_alloc_uninitialized(&gTemporaryCommonPool, size2); + + if (mem == NULL) { + gUnkPool3.pool.size = 0; + } else { + sound_alloc_pool_init(&gUnkPool3.pool, mem, size2); + } + + gUnkPool2.numEntries = 0; + gUnkPool3.numEntries = 0; +} + +struct UnkEntry *func_sh_802f1ec4(u32 size) { + u8 *temp_s2; + u8 *phi_s3; + u8 *memLocation; + u8 *cur; + + s32 i; + s32 chosenIndex; + + struct UnkStructSH8034EC88 *unkStruct; + struct UnkPool *pool = &gUnkPool3; + + u8 *itemStart; + u8 *itemEnd; + + phi_s3 = pool->pool.cur; + memLocation = sound_alloc_uninitialized(&pool->pool, size); + if (memLocation == NULL) { + cur = pool->pool.cur; + pool->pool.cur = pool->pool.start; + memLocation = sound_alloc_uninitialized(&pool->pool, size); + if (memLocation == NULL) { + pool->pool.cur = cur; + return NULL; + } + phi_s3 = pool->pool.start; + } + temp_s2 = pool->pool.cur; + + chosenIndex = -1; + for (i = 0; i < D_SH_8034F68C; i++) { + unkStruct = &D_SH_8034EC88[i]; + if (unkStruct->isFree == FALSE) { + itemStart = unkStruct->ramAddr; + itemEnd = unkStruct->ramAddr + unkStruct->sample->size - 1; + if (itemEnd < phi_s3 && itemStart < phi_s3) { + continue; + + } + if (itemEnd >= temp_s2 && itemStart >= temp_s2) { + continue; + + } + + unkStruct->isFree = TRUE; + } + } + + for (i = 0; i < pool->numEntries; i++) { + if (pool->entries[i].used == FALSE) { + continue; + } + itemStart = pool->entries[i].srcAddr; + itemEnd = itemStart + pool->entries[i].size - 1; + + if (itemEnd < phi_s3 && itemStart < phi_s3) { + continue; + } + + if (itemEnd >= temp_s2 && itemStart >= temp_s2) { + continue; + } + + func_sh_802f2158(&pool->entries[i]); + if (chosenIndex == -1) { + chosenIndex = i; + } + } + + if (chosenIndex == -1) { + chosenIndex = pool->numEntries++; + } + pool->entries[chosenIndex].used = TRUE; + pool->entries[chosenIndex].srcAddr = memLocation; + pool->entries[chosenIndex].size = size; + + return &pool->entries[chosenIndex]; +} + +void func_sh_802f2158(struct UnkEntry *entry) { + s32 idx; + s32 seqCount; + s32 bankId1; + s32 bankId2; + s32 instId; + s32 drumId; + struct Drum *drum; + struct Instrument *inst; + + seqCount = gAlCtlHeader->seqCount; + for (idx = 0; idx < seqCount; idx++) { + bankId1 = gCtlEntries[idx].bankId1; + bankId2 = gCtlEntries[idx].bankId2; + if ((bankId1 != 0xff && entry->bankId == bankId1) || (bankId2 != 0xff && entry->bankId == bankId2) || entry->bankId == 0) { + if (get_bank_or_seq(1, 2, idx) != NULL) { + if (IS_BANK_LOAD_COMPLETE(idx) != FALSE) { + for (instId = 0; instId < gCtlEntries[idx].numInstruments; instId++) { + inst = get_instrument_inner(idx, instId); + if (inst != NULL) { + if (inst->normalRangeLo != 0) { + func_sh_802F2320(entry, inst->lowNotesSound.sample); + } + if (inst->normalRangeHi != 127) { + func_sh_802F2320(entry, inst->highNotesSound.sample); + } + func_sh_802F2320(entry, inst->normalNotesSound.sample); + } + } + for (drumId = 0; drumId < gCtlEntries[idx].numDrums; drumId++) { + drum = get_drum(idx, drumId); + if (drum != NULL) { + func_sh_802F2320(entry, drum->sound.sample); + } + } + } + } + } + } +} + +void func_sh_802F2320(struct UnkEntry *entry, struct AudioBankSample *sample) { + if (sample != NULL && sample->sampleAddr == entry->srcAddr) { + sample->sampleAddr = entry->dstAddr; + sample->medium = entry->medium; + } +} + +struct UnkEntry *unk_pool2_alloc(u32 size) { + void *data; + struct UnkEntry *ret; + s32 *numEntries = &gUnkPool2.numEntries; + + data = sound_alloc_uninitialized(&gUnkPool2.pool, size); + if (data == NULL) { + return NULL; + } + ret = &gUnkPool2.entries[*numEntries]; + ret->used = TRUE; + ret->srcAddr = data; + ret->size = size; + (*numEntries)++; + return ret; +} + +void func_sh_802f23ec(void) { + s32 i; + s32 idx; + s32 seqCount; + u32 bankId1; // non symmetric fake match? can also change 0xff to 0xffU for same effect + s32 bankId2; + s32 instId; + s32 drumId; + struct Drum *drum; + struct Instrument *inst; + UNUSED s32 pad; + struct UnkEntry *entry; //! @bug: not initialized but nevertheless used + + seqCount = gAlCtlHeader->seqCount; + for (idx = 0; idx < seqCount; idx++) { + bankId1 = gCtlEntries[idx].bankId1; + bankId2 = gCtlEntries[idx].bankId2; + if ((bankId1 != 0xff && entry->bankId == bankId1) || (bankId2 != 0xff && entry->bankId == bankId2) || entry->bankId == 0) { + if (get_bank_or_seq(1, 3, idx) != NULL) { + if (IS_BANK_LOAD_COMPLETE(idx) != FALSE) { + for (i = 0; i < gUnkPool2.numEntries; i++) { + entry = &gUnkPool2.entries[i]; + for (instId = 0; instId < gCtlEntries[idx].numInstruments; instId++) { + inst = get_instrument_inner(idx, instId); + if (inst != NULL) { + if (inst->normalRangeLo != 0) { + func_sh_802F2320(entry, inst->lowNotesSound.sample); + } + if (inst->normalRangeHi != 127) { + func_sh_802F2320(entry, inst->highNotesSound.sample); + } + func_sh_802F2320(entry, inst->normalNotesSound.sample); + } + } + for (drumId = 0; drumId < gCtlEntries[idx].numDrums; drumId++) { + drum = get_drum(idx, drumId); + if (drum != NULL) { + func_sh_802F2320(entry, drum->sound.sample); + } + } + } + } + } + } + } +} +#endif + #ifdef VERSION_EU u8 audioString22[] = "SFrame Sample %d %d %d\n"; u8 audioString23[] = "AHPBASE %x\n"; diff --git a/src/audio/heap.h b/src/audio/heap.h index 2ccf53fd..e01dc8d4 100644 --- a/src/audio/heap.h +++ b/src/audio/heap.h @@ -9,6 +9,8 @@ #define SOUND_LOAD_STATUS_IN_PROGRESS 1 #define SOUND_LOAD_STATUS_COMPLETE 2 #define SOUND_LOAD_STATUS_DISCARDABLE 3 +#define SOUND_LOAD_STATUS_4 4 +#define SOUND_LOAD_STATUS_5 5 #define IS_BANK_LOAD_COMPLETE(bankId) (gBankLoadStatus[bankId] >= SOUND_LOAD_STATUS_COMPLETE) #define IS_SEQ_LOAD_COMPLETE(seqId) (gSeqLoadStatus[seqId] >= SOUND_LOAD_STATUS_COMPLETE) @@ -24,7 +26,12 @@ struct SoundAllocPool struct SeqOrBankEntry { u8 *ptr; u32 size; +#ifdef VERSION_SH + s16 poolIndex; + s16 id; +#else s32 id; // seqId or bankId +#endif }; // size = 0xC struct PersistentPool @@ -36,9 +43,20 @@ struct PersistentPool struct TemporaryPool { - /*0x00*/ u32 nextSide; - /*0x04*/ struct SoundAllocPool pool; - /*0x14*/ struct SeqOrBankEntry entries[2]; + /*EU, SH*/ + /*0x00, 0x00*/ u32 nextSide; + /*0x04, */ struct SoundAllocPool pool; + /*0x04, pool.start */ + /*0x08, pool.cur */ + /*0x0C, 0x0C pool.size */ + /*0x10, 0x10 pool.numAllocatedEntries */ + /*0x14, */ struct SeqOrBankEntry entries[2]; + /*0x14, 0x14 entries[0].ptr */ + /*0x18, entries[0].size*/ + /*0x1C, 0x1E entries[0].id */ + /*0x20, 0x20 entries[1].ptr */ + /*0x24, entries[1].size*/ + /*0x28, 0x2A entries[1].id */ }; // size = 0x2C struct SoundMultiPool @@ -48,27 +66,77 @@ struct SoundMultiPool /* */ u32 pad2[4]; }; // size = 0x1D0 +struct Unk1Pool +{ + struct SoundAllocPool pool; + struct SeqOrBankEntry entries[32]; +}; + +struct UnkEntry +{ + s8 used; + s8 medium; + s8 bankId; + u32 pad; + u8 *srcAddr; + u8 *dstAddr; + u32 size; +}; + +struct UnkPool +{ + /*0x00*/ struct SoundAllocPool pool; + /*0x10*/ struct UnkEntry entries[64]; + /*0x510*/ s32 numEntries; + /*0x514*/ u32 unk514; +}; + extern u8 gAudioHeap[]; extern s16 gVolume; extern s8 gReverbDownsampleRate; extern struct SoundAllocPool gAudioInitPool; extern struct SoundAllocPool gNotesAndBuffersPool; +extern struct SoundAllocPool gPersistentCommonPool; +extern struct SoundAllocPool gTemporaryCommonPool; extern struct SoundMultiPool gSeqLoadedPool; extern struct SoundMultiPool gBankLoadedPool; +#ifdef VERSION_SH +extern struct Unk1Pool gUnkPool1; +extern struct UnkPool gUnkPool2; +extern struct UnkPool gUnkPool3; +#endif extern u8 gBankLoadStatus[64]; extern u8 gSeqLoadStatus[256]; extern volatile u8 gAudioResetStatus; extern u8 gAudioResetPresetIdToLoad; +#if defined(VERSION_EU) || defined(VERSION_SH) +extern volatile u8 gAudioResetStatus; +#endif + void *soundAlloc(struct SoundAllocPool *pool, u32 size); +void *sound_alloc_uninitialized(struct SoundAllocPool *pool, u32 size); void sound_init_main_pools(s32 sizeForAudioInitPool); +void sound_alloc_pool_init(struct SoundAllocPool *pool, void *memAddr, u32 size); +#ifdef VERSION_SH +void *alloc_bank_or_seq(s32 poolIdx, s32 size, s32 arg3, s32 id); +void *get_bank_or_seq(s32 poolIdx, s32 arg1, s32 id); +#else void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id); -void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 arg2); -#ifdef VERSION_EU +void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id); +#endif +#if defined(VERSION_EU) || defined(VERSION_SH) s32 audio_shut_down_and_reset_step(void); void audio_reset_session(void); #else void audio_reset_session(struct AudioSessionSettings *preset); #endif +#ifdef VERSION_SH +void fill_filter(s16 filter[8], s32 arg1, s32 arg2); +u8 *func_sh_802f1d40(u32 size, s32 bank, u8 *arg2, s8 medium); +u8 *func_sh_802f1d90(u32 size, s32 bank, u8 *arg2, s8 medium); +void *unk_pool1_lookup(s32 poolIdx, s32 id); +#endif + #endif // AUDIO_HEAP_H diff --git a/src/audio/internal.h b/src/audio/internal.h index 3faa4c4d..c1d086e2 100644 --- a/src/audio/internal.h +++ b/src/audio/internal.h @@ -5,7 +5,7 @@ #include "types.h" -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) #define SEQUENCE_PLAYERS 4 #define SEQUENCE_CHANNELS 48 #define SEQUENCE_LAYERS 64 @@ -117,13 +117,12 @@ struct NotePool struct VibratoState { /*0x00, 0x00*/ struct SequenceChannel *seqChannel; /*0x04, 0x04*/ u32 time; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) /* , 0x08*/ s16 *curve; /* , 0x0C*/ f32 extent; /* , 0x10*/ f32 rate; /* , 0x14*/ u8 active; -#endif -#ifndef VERSION_EU +#else /*0x08, */ s8 *curve; /*0x0C, */ u8 active; /*0x0E, */ u16 rate; @@ -168,12 +167,22 @@ struct AdpcmBook struct AudioBankSample { +#ifdef VERSION_SH + /* 0x00 */ u32 codec : 4; + /* 0x00 */ u32 medium : 2; + /* 0x00 */ u32 bit1 : 1; + /* 0x00 */ u32 isPatched : 1; + /* 0x01 */ u32 size : 24; +#else u8 unused; u8 loaded; +#endif u8 *sampleAddr; struct AdpcmLoop *loop; struct AdpcmBook *book; +#ifndef VERSION_SH u32 sampleSize; // never read. either 0 or 1 mod 9, depending on padding +#endif }; struct AudioBankSound @@ -211,9 +220,15 @@ struct AudioBank struct CtlEntry { +#ifndef VERSION_SH u8 unused; +#endif u8 numInstruments; u8 numDrums; +#ifdef VERSION_SH + u8 bankId1; + u8 bankId2; +#endif struct Instrument **instruments; struct Drum **drums; }; // size = 0xC @@ -228,9 +243,9 @@ struct M64ScriptState { // Also known as a Group, according to debug strings. struct SequencePlayer { - /*US/JP, EU */ -#ifdef VERSION_EU - /*0x000, 0x000*/ u8 enabled : 1; + /*US/JP, EU, SH */ +#if defined(VERSION_EU) || defined(VERSION_SH) + /*0x000, 0x000, 0x000*/ u8 enabled : 1; #else /*0x000, 0x000*/ volatile u8 enabled : 1; #endif @@ -238,49 +253,55 @@ struct SequencePlayer /*0x000, 0x000*/ u8 muted : 1; /*0x000, 0x000*/ u8 seqDmaInProgress : 1; /*0x000, 0x000*/ u8 bankDmaInProgress : 1; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) /* 0x000*/ u8 recalculateVolume : 1; #endif -#ifndef VERSION_EU +#ifdef VERSION_SH + /* 0x000*/ u8 unkSh: 1; +#endif +#if defined(VERSION_JP) || defined(VERSION_US) /*0x001 */ s8 seqVariation; #endif - /*0x002, 0x001*/ u8 state; + /*0x002, 0x001, 0x001*/ u8 state; /*0x003, 0x002*/ u8 noteAllocPolicy; /*0x004, 0x003*/ u8 muteBehavior; /*0x005, 0x004*/ u8 seqId; /*0x006, 0x005*/ u8 defaultBank[1]; // must be an array to get a comparison // to match; other u8's might also be part of that array /*0x007, 0x006*/ u8 loadingBankId; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) /*0x008, ?????*/ u8 loadingBankNumInstruments; /*0x009, ?????*/ u8 loadingBankNumDrums; #endif -#ifdef VERSION_EU - /* , 0x007*/ s8 seqVariationEu[1]; +#if defined(VERSION_EU) || defined(VERSION_SH) + /* , 0x007, 0x007*/ s8 seqVariationEu[1]; #endif /*0x00A, 0x008*/ u16 tempo; // beats per minute in JP, tatums per minute in US/EU /*0x00C, 0x00A*/ u16 tempoAcc; -#ifndef VERSION_EU - /*0x00E, 0x010*/ u16 fadeTimer; +#if defined(VERSION_JP) || defined(VERSION_US) + /*0x00E, 0x010*/ u16 fadeRemainingFrames; #endif - /*0x010, 0x00C*/ s16 transposition; - /*0x012, 0x00E*/ u16 delay; -#ifdef VERSION_EU - /*0x00E, 0x010*/ u16 fadeTimer; - /* , 0x012*/ u16 fadeTimerUnkEu; +#ifdef VERSION_SH + /* 0x00C*/ s16 tempoAdd; +#endif + /*0x010, 0x00C, 0x00E*/ s16 transposition; + /*0x012, 0x00E, 0x010*/ u16 delay; +#if defined(VERSION_EU) || defined(VERSION_SH) + /*0x00E, 0x010, 0x012*/ u16 fadeRemainingFrames; + /* , 0x012, 0x014*/ u16 fadeTimerUnkEu; #endif /*0x014, 0x014*/ u8 *seqData; // buffer of some sort - /*0x018, 0x018*/ f32 fadeVolume; // set to 1.0f + /*0x018, 0x018, 0x1C*/ f32 fadeVolume; // set to 1.0f /*0x01C, 0x01C*/ f32 fadeVelocity; // set to 0.0f - /*0x020, 0x020*/ f32 volume; // set to 0.0f + /*0x020, 0x020, 0x024*/ f32 volume; // set to 0.0f /*0x024, 0x024*/ f32 muteVolumeScale; // set to 0.5f -#ifdef VERSION_EU - /* , 0x028*/ f32 fadeVolumeScale; +#if defined(VERSION_EU) || defined(VERSION_SH) + /* , 0x028, 0x02C*/ f32 fadeVolumeScale; /* , 0x02C*/ f32 appliedFadeVolume; #else /* */ u8 pad2[4]; #endif - /*0x02C, 0x030*/ struct SequenceChannel *channels[CHANNELS_MAX]; + /*0x02C, 0x030, 0x034*/ struct SequenceChannel *channels[CHANNELS_MAX]; /*0x06C, 0x070*/ struct M64ScriptState scriptState; /*0x088, 0x08C*/ u8 *shortNoteVelocityTable; /*0x08C, 0x090*/ u8 *shortNoteDurationTable; @@ -292,18 +313,18 @@ struct SequencePlayer /*0x118, 0x120*/ OSMesg bankDmaMesg; /*0x11C, 0x124*/ OSIoMesg bankDmaIoMesg; /*0x130, 0x13C*/ u8 *bankDmaCurrMemAddr; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) /*0x134, ?????*/ struct AudioBank *loadingBank; #endif /*0x138, 0x140*/ uintptr_t bankDmaCurrDevAddr; /*0x13C, 0x144*/ ssize_t bankDmaRemaining; /* ext */ f32 volumeScale; -}; // size = 0x140, 0x148 on EU +}; // size = 0x140, 0x148 on EU, 0x14C on SH struct AdsrSettings { u8 releaseRate; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) u8 sustain; #else u16 sustain; // sustain level, 2^16 = max @@ -314,14 +335,14 @@ struct AdsrSettings struct AdsrState { /*0x00, 0x00*/ u8 action; /*0x01, 0x01*/ u8 state; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) /*0x02, */ s16 initial; // always 0 /*0x04, */ s16 target; /*0x06, */ s16 current; #endif /*0x08, 0x02*/ s16 envIndex; /*0x0A, 0x04*/ s16 delay; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) /* , 0x08*/ f32 sustain; /* , 0x0C*/ f32 velocity; /* , 0x10*/ f32 fadeOutVel; @@ -338,24 +359,58 @@ struct AdsrState { /*0x1C, 0x20*/ struct AdsrEnvelope *envelope; }; // size = 0x20, 0x24 in EU +struct ReverbBitsData { + /* 0x00 */ u8 bit0 : 1; + /* 0x00 */ u8 bit1 : 1; + /* 0x00 */ u8 bit2 : 1; + /* 0x00 */ u8 usesHeadsetPanEffects : 1; + /* 0x00 */ u8 stereoHeadsetEffects : 2; + /* 0x00 */ u8 strongRight : 1; + /* 0x00 */ u8 strongLeft : 1; +}; + +union ReverbBits { + /* 0x00 */ struct ReverbBitsData s; + /* 0x00 */ u8 asByte; +}; +struct ReverbInfo { + u8 reverb; + u8 bankId; + u8 pan; + union ReverbBits reverbBits; + f32 freqScale; + f32 velocity; + s32 unused; + s16 *filter; +}; + struct NoteAttributes { - s8 reverb; -#ifdef VERSION_EU + u8 reverb; +#ifdef VERSION_SH + u8 unk1; +#endif +#if defined(VERSION_EU) || defined(VERSION_SH) u8 pan; +#endif +#ifdef VERSION_SH + union ReverbBits reverbBits; #endif f32 freqScale; f32 velocity; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) f32 pan; #endif +#ifdef VERSION_SH + s16 *filter; +#endif }; // size = 0x10 // Also known as a SubTrack, according to debug strings. // Confusingly, a SubTrack is a container of Tracks. struct SequenceChannel { - /* U/J, EU */ + /* U/J, EU, SH */ /*0x00, 0x00*/ u8 enabled : 1; /*0x00, 0x00*/ u8 finished : 1; /*0x00, 0x00*/ u8 stopScript : 1; @@ -364,7 +419,7 @@ struct SequenceChannel /*0x00, 0x00*/ u8 stereoHeadsetEffects : 1; /*0x00, ????*/ u8 largeNotes : 1; // notes specify duration and velocity /*0x00, ????*/ u8 unused : 1; // never read, set to 0 -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) /* , 0x01*/ union { struct { u8 freqScale : 1; @@ -375,32 +430,38 @@ struct SequenceChannel } changes; #endif /*0x01, 0x02*/ u8 noteAllocPolicy; - /*0x02, 0x03*/ u8 muteBehavior; - /*0x03, 0x04*/ u8 reverb; // or dry/wet mix + /*0x02, 0x03, 0x03*/ u8 muteBehavior; + /*0x03, 0x04, 0x04*/ u8 reverb; // or dry/wet mix /*0x04, ????*/ u8 notePriority; // 0-3 +#ifdef VERSION_SH + u8 unkSH06; // some priority +#endif /*0x05, 0x06*/ u8 bankId; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) /* , 0x07*/ u8 reverbIndex; - /* , 0x08*/ u8 bookOffset; + /* , 0x08, 0x09*/ u8 bookOffset; /* , 0x09*/ u8 newPan; /* , 0x0A*/ u8 panChannelWeight; // proportion of pan that comes from the channel (0..128) #else /*0x06, */ u8 updatesPerFrameUnused; #endif - /*0x08, 0x0C*/ u16 vibratoRateStart; // initially 0x800 - /*0x0A, 0x0E*/ u16 vibratoExtentStart; - /*0x0C, 0x10*/ u16 vibratoRateTarget; // initially 0x800 - /*0x0E, 0x12*/ u16 vibratoExtentTarget; - /*0x10, 0x14*/ u16 vibratoRateChangeDelay; - /*0x12, 0x16*/ u16 vibratoExtentChangeDelay; - /*0x14, 0x18*/ u16 vibratoDelay; - /*0x16, 0x1A*/ u16 delay; - /*0x18, 0x1C*/ s16 instOrWave; // either 0 (none), instrument index + 1, or +#ifdef VERSION_SH + /* 0x0C*/ u8 unkSH0C; // bankId +#endif + /*0x08, 0x0C, 0x0E*/ u16 vibratoRateStart; // initially 0x800 + /*0x0A, 0x0E, 0x10*/ u16 vibratoExtentStart; + /*0x0C, 0x10, 0x12*/ u16 vibratoRateTarget; // initially 0x800 + /*0x0E, 0x12, 0x14*/ u16 vibratoExtentTarget; + /*0x10, 0x14, 0x16*/ u16 vibratoRateChangeDelay; + /*0x12, 0x16, 0x18*/ u16 vibratoExtentChangeDelay; + /*0x14, 0x18, 0x1A*/ u16 vibratoDelay; + /*0x16, 0x1A, 0x1C*/ u16 delay; + /*0x18, 0x1C, 0x1E*/ s16 instOrWave; // either 0 (none), instrument index + 1, or // 0x80..0x83 for sawtooth/triangle/sine/square waves. - /*0x1A, 0x1E*/ s16 transposition; - /*0x1C, 0x20*/ f32 volumeScale; - /*0x20, 0x24*/ f32 volume; -#ifndef VERSION_EU + /*0x1A, 0x1E, 0x20*/ s16 transposition; + /*0x1C, 0x20, 0x24*/ f32 volumeScale; + /*0x20, 0x24, 0x28*/ f32 volume; +#if defined(VERSION_JP) || defined(VERSION_US) /*0x24, */ f32 pan; /*0x28, */ f32 panChannelWeight; // proportion of pan that comes from the channel (0..1) #else @@ -414,33 +475,44 @@ struct SequenceChannel /*0x3C, 0x40*/ struct Instrument *instrument; /*0x40, 0x44*/ struct SequencePlayer *seqPlayer; /*0x44, 0x48*/ struct SequenceChannelLayer *layers[LAYERS_MAX]; - /*0x54, 0x58*/ s8 soundScriptIO[8]; // bridge between sound script and audio lib. For player 2, +#ifndef VERSION_SH + /*0x54, 0x58 */ s8 soundScriptIO[8]; // bridge between sound script and audio lib. For player 2, // [0] contains enabled, [4] contains sound ID, [5] contains reverb adjustment +#endif /*0x5C, 0x60*/ struct M64ScriptState scriptState; /*0x78, 0x7C*/ struct AdsrSettings adsr; /*0x80, 0x84*/ struct NotePool notePool; -}; // size = 0xC0, 0xC4 in EU +#ifdef VERSION_SH + /* 0xC0*/ s8 soundScriptIO[8]; // bridge between sound script and audio lib. For player 2, + // [0] contains enabled, [4] contains sound ID, [5] contains reverb adjustment + /* 0xC8*/ u16 unkC8; + /* 0xCC*/ s16 *filter; +#endif +}; // size = 0xC0, 0xC4 in EU, 0xD0 in SH // Also known as a Track, according to debug strings. struct SequenceChannelLayer { - /* U/J, EU */ + /* U/J, EU, SH */ /*0x00, 0x00*/ u8 enabled : 1; /*0x00, 0x00*/ u8 finished : 1; /*0x00, 0x00*/ u8 stopSomething : 1; // ? /*0x00, 0x00*/ u8 continuousNotes : 1; // keep the same note for consecutive notes with the same sound -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) /* , 0x00*/ u8 unusedEu0b8 : 1; /* , 0x00*/ u8 notePropertiesNeedInit : 1; /* , 0x00*/ u8 ignoreDrumPan : 1; - /* , 0x01*/ u8 instOrWave; +#ifdef VERSION_SH + /* , , 0x01 */ union ReverbBits reverbBits; #endif - /*0x01, 0x02*/ u8 status; + /* , 0x01, 0x02*/ u8 instOrWave; +#endif + /*0x01, 0x02, 0x03*/ u8 status; // 0x03 in SH /*0x02, 0x03*/ u8 noteDuration; // set to 0x80 /*0x03, 0x04*/ u8 portamentoTargetNote; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) /* , 0x05*/ u8 pan; // 0..128 - /* , 0x06*/ u8 notePan; + /* , 0x06, 0x07*/ u8 notePan; #endif /*0x04, 0x08*/ struct Portamento portamento; /*0x14, 0x18*/ struct AdsrSettings adsr; @@ -448,40 +520,47 @@ struct SequenceChannelLayer /*0x1E, 0x22*/ s16 transposition; // #semitones added to play commands // (m64 instruction encoding only allows referring to the limited range // 0..0x3f; this makes 0x40..0x7f accessible as well) - /*0x20, 0x24*/ f32 freqScale; - /*0x24, 0x28*/ f32 velocitySquare; -#ifndef VERSION_EU + /*0x20, 0x24, 0x24*/ f32 freqScale; +#ifdef VERSION_SH + /* 0x28*/ f32 unkSH28; +#endif + /*0x24, 0x28, 0x2C*/ f32 velocitySquare; +#if defined(VERSION_JP) || defined(VERSION_US) /*0x28, */ f32 pan; // 0..1 #endif - /*0x2C, 0x2C*/ f32 noteVelocity; -#ifndef VERSION_EU + /*0x2C, 0x2C, 0x30*/ f32 noteVelocity; +#if defined(VERSION_JP) || defined(VERSION_US) /*0x30*/ f32 notePan; #endif - /*0x34, 0x30*/ f32 noteFreqScale; + /*0x34, 0x30, 0x34*/ f32 noteFreqScale; /*0x38, 0x34*/ s16 shortNoteDefaultPlayPercentage; /*0x3A, 0x36*/ s16 playPercentage; // it's not really a percentage... /*0x3C, 0x38*/ s16 delay; /*0x3E, 0x3A*/ s16 duration; /*0x40, 0x3C*/ s16 delayUnused; // set to 'delay', never read - /*0x44, 0x40*/ struct Note *note; + /*0x44, 0x40, 0x44*/ struct Note *note; /*0x48, 0x44*/ struct Instrument *instrument; /*0x4C, 0x48*/ struct AudioBankSound *sound; - /*0x50, 0x4C*/ struct SequenceChannel *seqChannel; + /*0x50, 0x4C, 0x50*/ struct SequenceChannel *seqChannel; /*0x54, 0x50*/ struct M64ScriptState scriptState; /*0x70, 0x6C*/ struct AudioListItem listItem; -#ifdef VERSION_EU +#if defined(VERSION_EU) u8 pad2[4]; #endif }; // size = 0x80 -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) struct NoteSynthesisState { /*0x00*/ u8 restart; /*0x01*/ u8 sampleDmaIndex; /*0x02*/ u8 prevHeadsetPanRight; /*0x03*/ u8 prevHeadsetPanLeft; - /*0x04*/ u16 samplePosFrac; +#ifdef VERSION_SH + /* 0x04*/ u8 reverbVol; + /* 0x05*/ u8 unk5; +#endif + /*0x04, 0x06*/ u16 samplePosFrac; /*0x08*/ s32 samplePosInt; /*0x0C*/ struct NoteSynthesisBuffers *synthesisBuffers; /*0x10*/ s16 curVolLeft; @@ -489,20 +568,24 @@ struct NoteSynthesisState }; struct NotePlaybackState { - /* U/J, EU */ - /*0x04, 0x00*/ u8 priority; - /* 0x01*/ u8 waveId; - /* 0x02*/ u8 sampleCountIndex; - /*0x08, 0x04*/ s16 adsrVolScale; - /*0x18, 0x08*/ f32 portamentoFreqScale; - /*0x1C, 0x0C*/ f32 vibratoFreqScale; - /*0x28, 0x10*/ struct SequenceChannelLayer *prevParentLayer; - /*0x2C, 0x14*/ struct SequenceChannelLayer *parentLayer; - /*0x30, 0x18*/ struct SequenceChannelLayer *wantedParentLayer; - /* , 0x1C*/ struct NoteAttributes attributes; - /*0x54, 0x28*/ struct AdsrState adsr; - /*0x74, 0x4C*/ struct Portamento portamento; - /*0x84, 0x5C*/ struct VibratoState vibratoState; + /* U/J, EU, SH */ + /*0x04, 0x00, 0x00*/ u8 priority; + /* 0x01, 0x01*/ u8 waveId; + /* 0x02, 0x02*/ u8 sampleCountIndex; +#ifdef VERSION_SH + /* 0x03*/ u8 unkSH33; // bankId? + /* 0x04*/ u8 unkSH34; +#endif + /*0x08, 0x04, 0x06*/ s16 adsrVolScale; + /*0x18, 0x08, 0x08*/ f32 portamentoFreqScale; + /*0x1C, 0x0C, 0x0C*/ f32 vibratoFreqScale; + /*0x28, 0x10, */ struct SequenceChannelLayer *prevParentLayer; + /*0x2C, 0x14, 0x14*/ struct SequenceChannelLayer *parentLayer; + /*0x30, 0x18, 0x18*/ struct SequenceChannelLayer *wantedParentLayer; + /* , 0x1C, 0x1C*/ struct NoteAttributes attributes; + /*0x54, 0x28, 0x2C*/ struct AdsrState adsr; + /*0x74, 0x4C, */ struct Portamento portamento; + /*0x84, 0x5C, */ struct VibratoState vibratoState; }; struct NoteSubEu { @@ -529,13 +612,15 @@ struct NoteSubEu s16 *samples; struct AudioBankSound *audioBankSound; } sound; +#ifdef VERSION_SH + /*0x10*/ s16 *filter; +#endif }; struct Note { - /* U/J, EU */ - /*0xA4, 0x00*/ struct AudioListItem listItem; - /* 0x10*/ struct NoteSynthesisState synthesisState; - + /* U/J, EU, SH */ + /*0xA4, 0x00, 0x00*/ struct AudioListItem listItem; + /* 0x10, 0x10*/ struct NoteSynthesisState synthesisState; // The next members are actually part of a struct (NotePlaybackState), but // that results in messy US/EU ifdefs. Instead we cast to a struct pointer // when needed... This breaks alignment on non-N64 platforms, which we hack @@ -545,22 +630,26 @@ struct Note u8 pad0[12]; #endif - /*0x04, 0x30*/ u8 priority; - /* 0x31*/ u8 waveId; - /* 0x32*/ u8 sampleCountIndex; - /*0x08, 0x34*/ s16 adsrVolScale; - /*0x18, 0x38*/ f32 portamentoFreqScale; - /*0x1C, 0x3C*/ f32 vibratoFreqScale; - /*0x28, 0x40*/ struct SequenceChannelLayer *prevParentLayer; - /*0x2C, 0x44*/ struct SequenceChannelLayer *parentLayer; - /*0x30, 0x48*/ struct SequenceChannelLayer *wantedParentLayer; - /* , 0x4C*/ struct NoteAttributes attributes; - /*0x54, 0x58*/ struct AdsrState adsr; + /*0x04, 0x30, 0x30*/ u8 priority; + /* 0x31, 0x31*/ u8 waveId; + /* 0x32, 0x32*/ u8 sampleCountIndex; +#ifdef VERSION_SH + /* 0x33*/ u8 unkSH33; // bankId? + /* 0x34*/ u8 unkSH34; +#endif + /*0x08, 0x34, 0x36*/ s16 adsrVolScale; + /*0x18, 0x38, */ f32 portamentoFreqScale; + /*0x1C, 0x3C, */ f32 vibratoFreqScale; + /*0x28, 0x40, */ struct SequenceChannelLayer *prevParentLayer; + /*0x2C, 0x44, 0x44*/ struct SequenceChannelLayer *parentLayer; + /*0x30, 0x48, 0x48*/ struct SequenceChannelLayer *wantedParentLayer; + /* , 0x4C, 0x4C*/ struct NoteAttributes attributes; + /*0x54, 0x58, 0x5C*/ struct AdsrState adsr; /*0x74, 0x7C*/ struct Portamento portamento; /*0x84, 0x8C*/ struct VibratoState vibratoState; u8 pad3[8]; - /* , 0xB0*/ struct NoteSubEu noteSubEu; -}; // size = 0xC0 + /* , 0xB0, 0xB4*/ struct NoteSubEu noteSubEu; +}; // size = 0xC0, known to be 0xC8 on SH #else // volatile Note, needed in synthesis_process_notes struct vNote @@ -624,37 +713,66 @@ struct NoteSynthesisBuffers { s16 adpcmdecState[0x10]; s16 finalResampleState[0x10]; +#ifdef VERSION_SH + s16 unk[0x10]; + s16 filterBuffer[0x20]; + s16 panSamplesBuffer[0x20]; +#else s16 mixEnvelopeState[0x28]; s16 panResampleState[0x10]; s16 panSamplesBuffer[0x20]; s16 dummyResampleState[0x10]; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) s16 samples[0x40]; #endif +#endif }; +#ifdef VERSION_EU struct ReverbSettingsEU { u8 downsampleRate; u8 windowSize; // To be multiplied by 64 u16 gain; }; +#else +struct ReverbSettingsEU +{ + u8 downsampleRate; // always 1 + u8 windowSize; // To be multiplied by 16 + u16 gain; + u16 unk4; // always zero + u16 unk6; // always zero + s8 unk8; // always -1 + u16 unkA; // always 0x3000 + s16 unkC; // always zero + s16 unkE; // always zero +}; +#endif struct AudioSessionSettingsEU { - u32 frequency; - u8 unk1; // always 1 - u8 maxSimultaneousNotes; - u8 numReverbs; // always 1 - u8 unk2; // always 0 - struct ReverbSettingsEU *reverbSettings; - u16 volume; - u16 unk3; // always 0 - u32 persistentSeqMem; - u32 persistentBankMem; - u32 temporarySeqMem; - u32 temporaryBankMem; -}; + /* 0x00 */ u32 frequency; + /* 0x04 */ u8 unk1; // always 1 + /* 0x05 */ u8 maxSimultaneousNotes; + /* 0x06 */ u8 numReverbs; // always 1 + /* 0x07 */ u8 unk2; // always 0 + /* 0x08 */ struct ReverbSettingsEU *reverbSettings; + /* 0x0C */ u16 volume; + /* 0x0E */ u16 unk3; // always 0 + /* 0x10 */ u32 persistentSeqMem; + /* 0x14 */ u32 persistentBankMem; +#ifdef VERSION_SH + /* 0x18 */ u32 unk18; // always 0 +#endif + /* 0x18, 0x1C */ u32 temporarySeqMem; + /* 0x1C, 0x20 */ u32 temporaryBankMem; +#ifdef VERSION_SH + /* 0x24 */ u32 unk24; // always 0 + /* 0x28 */ u32 unkMem28; // always 0 + /* 0x2C */ u32 unkMem2C; // always 0 +#endif +}; // 0x30 on shindou struct AudioSessionSettings { @@ -725,4 +843,31 @@ struct EuAudioCmd { } u2; }; +#ifdef VERSION_SH +struct PendingDmaSample { + u8 medium; + u8 bankId; + u8 idx; + uintptr_t devAddr; + void *vAddr; + u8 *resultSampleAddr; + s32 state; + s32 remaining; + s8 *io; + /*0x1C*/ struct AudioBankSample sample; + /*0x2C*/ OSMesgQueue queue; + /*0x44*/ OSMesg mesgs[1]; + /*0x48*/ OSIoMesg ioMesg; +}; + +struct UnkStruct80343D00 { + u32 someIndex; // array into one of the two slots below + struct PendingDmaSample arr[2]; +}; + +// in external.c +extern s32 D_SH_80343CF0; +extern struct UnkStruct80343D00 D_SH_80343D00; +#endif + #endif // AUDIO_INTERNAL_H diff --git a/src/audio/load.c b/src/audio/load.c index 517e133c..00bd0327 100644 --- a/src/audio/load.c +++ b/src/audio/load.c @@ -6,6 +6,8 @@ #include "load.h" #include "seqplayer.h" +#include "sound_data.h" + #include "pc/platform.h" #include "pc/fs/fs.h" @@ -23,10 +25,15 @@ struct SharedDma { // EU only void port_eu_init(void); +// SH only +#if defined(VERSION_SH) +void func_sh_802f6a9c(void); +void func_sh_802f51d4(struct AudioBankSound *sound, struct AudioBank *memBase, struct PatchStruct *patchInfo); +#endif struct Note *gNotes; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) static u8 pad[4]; #endif @@ -38,6 +45,35 @@ struct SequenceChannel gSequenceChannelNone; struct AudioListItem gLayerFreeList; struct NotePool gNoteFreeLists; +#ifdef VERSION_SH +struct AudioBankSample *D_SH_8034EA88[0x80]; +struct UnkStructSH8034EC88 D_SH_8034EC88[0x80]; +s32 D_SH_8034F688; // index into D_SH_8034EA88 +s32 D_SH_8034F68C; // index or size for D_SH_8034EC88 + +struct PendingDmaAudioBank { + s8 inProgress; + s8 timer; + s8 medium; + struct AudioBank *audioBank; + uintptr_t devAddr; + void *vAddr; + s32 remaining; + u32 transferSize; + u32 encodedInfo; + OSMesgQueue *retQueue; + OSMesgQueue dmaRetQueue; + OSMesg mesgs[1]; + OSIoMesg ioMesg; +}; +struct PendingDmaAudioBank D_SH_8034F690[16]; + +OSMesgQueue gUnkQueue1; +OSMesg gUnkMesgBufs1[0x10]; +OSMesgQueue gUnkQueue2; +OSMesg gUnkMesgBufs2[0x10]; +#endif + OSMesgQueue gCurrAudioFrameDmaQueue; OSMesg gCurrAudioFrameDmaMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE]; OSIoMesg gCurrAudioFrameDmaIoMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE]; @@ -48,18 +84,22 @@ OSIoMesg gAudioDmaIoMesg; #define SAMPLE_DMA_COUNT 0x90 +#ifdef VERSION_SH +struct SharedDma *sSampleDmas; // sh: 0x803503D0 +#else struct SharedDma sSampleDmas[SAMPLE_DMA_COUNT]; -u32 gSampleDmaNumListItems; -u32 sSampleDmaListSize1; -u32 sUnused80226B40; // set to 0, never read +#endif +u32 gSampleDmaNumListItems; // sh: 0x803503D4 +u32 sSampleDmaListSize1; // sh: 0x803503D8 +u32 sUnused80226B40; // set to 0, never read, sh: 0x803503DC // Circular buffer of DMAs with ttl = 0. tail <= head, wrapping around mod 256. u8 sSampleDmaReuseQueue1[256]; u8 sSampleDmaReuseQueue2[256]; u8 sSampleDmaReuseQueueTail1; u8 sSampleDmaReuseQueueTail2; -u8 sSampleDmaReuseQueueHead1; -u8 sSampleDmaReuseQueueHead2; +u8 sSampleDmaReuseQueueHead1; // sh: 0x803505E2 +u8 sSampleDmaReuseQueueHead2; // sh: 0x803505E3 // bss correct up to here @@ -69,20 +109,24 @@ ALSeqFile *gAlTbl; u8 *gAlBankSets; u16 gSequenceCount; -struct CtlEntry *gCtlEntries; +struct CtlEntry *gCtlEntries; // sh: 0x803505F8 -#ifdef VERSION_EU +#if defined(VERSION_EU) u32 padEuBss1; struct AudioBufferParametersEU gAudioBufferParameters; -#else +#elif defined(VERSION_US) || defined(VERSION_JP) s32 gAiFrequency; #endif +#ifdef VERSION_SH +struct AudioBufferParametersEU gAudioBufferParameters; +#endif + u32 sDmaBufSize; s32 gMaxAudioCmds; s32 gMaxSimultaneousNotes; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s16 gTempoInternalToExternal; #else s32 gSamplesPerFrameTarget; @@ -95,22 +139,36 @@ s8 gAudioUpdatesPerFrame; s8 gSoundMode; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s8 gAudioUpdatesPerFrame; #endif extern u64 gAudioGlobalsStartMarker; extern u64 gAudioGlobalsEndMarker; -extern u8 gSoundDataADSR[]; // sound_data.ctl -extern u8 gSoundDataRaw[]; // sound_data.tbl -extern u8 gMusicData[]; // sequences.s -extern u8 gBankSetsData[]; // bank_sets.s +ALSeqFile *get_audio_file_header(s32 arg0); +#ifdef VERSION_SH +void *func_sh_802f3688(s32 arg0); +void *get_bank_or_seq_wrapper(s32 arg0, s32 arg1); +void func_sh_802f3d78(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 arg3); +void func_sh_802f3c38(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 medium); +void func_sh_802f4a4c(s32 audioResetStatus); +void func_sh_802f4bd8(struct PendingDmaSample *arg0, s32 len); +void func_sh_802f4c5c(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 arg3); +struct PendingDmaAudioBank *func_sh_802f4cb4(uintptr_t devAddr, void *vAddr, s32 size, s32 medium, s32 numChunks, OSMesgQueue *retQueue, s32 encodedInfo); +void func_sh_802f4dcc(s32 audioResetStatus); +void func_sh_802f4e50(struct PendingDmaAudioBank *arg0, u32 arg1); +void func_sh_802f50ec(struct PendingDmaAudioBank *arg0, size_t len); +void func_sh_802f517c(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 arg3); +s32 func_sh_802f5310(s32 bankId, struct AudioBank *mem, struct PatchStruct *patchInfo, s32 arg3); +void *func_sh_802F3564(s32 arg0); +#endif /** * Performs an immediate DMA copy */ +#if !defined(VERSION_SH) void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes) { eu_stubbed_printf_3("Romcopy %x -> %x ,size %x\n", devAddr, vAddr, nbytes); osInvalDCache(vAddr, nbytes); @@ -119,6 +177,7 @@ void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes) { osRecvMesg(&gAudioDmaMesgQueue, NULL, OS_MESG_BLOCK); eu_stubbed_printf_0("Romcopyend\n"); } +#endif #ifdef VERSION_EU u8 audioString34[] = "CAUTION:WAVE CACHE FULL %d"; @@ -142,17 +201,20 @@ u8 audioString49[] = "BANK LOAD MISS! FOR %d\n"; /** * Performs an asynchronus (normal priority) DMA copy */ +#if !defined(VERSION_SH) void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg) { osInvalDCache(vAddr, nbytes); osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, devAddr, vAddr, nbytes, queue); } +#endif /** * Performs a partial asynchronous (normal priority) DMA copy. This is limited * to 0x1000 bytes transfer at once. */ +#ifndef VERSION_SH void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg) { -#ifdef VERSION_EU +#if defined(VERSION_EU) ssize_t transfer = (*remaining >= 0x1000 ? 0x1000 : *remaining); #else ssize_t transfer = (*remaining < 0x1000 ? *remaining : 0x1000); @@ -163,12 +225,13 @@ void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remai *devAddr += transfer; *vAddr += transfer; } +#endif void decrease_sample_dma_ttls() { u32 i; for (i = 0; i < sSampleDmaListSize1; i++) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) struct SharedDma *temp = &sSampleDmas[i]; #else struct SharedDma *temp = sSampleDmas + i; @@ -183,7 +246,7 @@ void decrease_sample_dma_ttls() { } for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) struct SharedDma *temp = &sSampleDmas[i]; #else struct SharedDma *temp = sSampleDmas + i; @@ -200,19 +263,40 @@ void decrease_sample_dma_ttls() { sUnused80226B40 = 0; } -void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) { +extern char shindouDebugPrint62[]; +#ifdef VERSION_SH +void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef, s32 medium) { + UNUSED s32 sp60; +#else +void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) { +#endif +#ifdef VERSION_SH + struct SharedDma *dma; + s32 hasDma = FALSE; +#else s32 hasDma = FALSE; struct SharedDma *dma; +#endif uintptr_t dmaDevAddr; +#ifdef VERSION_SH + UNUSED u32 pad; + u32 dmaIndex = 0; + u32 transfer; +#else u32 transfer; u32 i; u32 dmaIndex = 0; +#endif ssize_t bufferPos; +#ifdef VERSION_SH + u32 i; +#else UNUSED u32 pad; +#endif - if (arg2 != 0 || *arg3 >= sSampleDmaListSize1) { + if (arg2 != 0 || *dmaIndexRef >= sSampleDmaListSize1) { for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) dma = &sSampleDmas[i]; #else dma = sSampleDmas + i; @@ -232,8 +316,8 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) { sSampleDmaReuseQueueTail2++; } dma->ttl = 60; - *arg3 = (u8) i; -#ifdef VERSION_EU + *dmaIndexRef = (u8) i; +#if defined(VERSION_EU) || defined(VERSION_SH) return &dma->buffer[(devAddr - dma->source)]; #else return (devAddr - dma->source) + dma->buffer; @@ -250,11 +334,11 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) { hasDma = TRUE; } } else { -#ifdef VERSION_EU +#if defined(VERSION_EU) dma = sSampleDmas; - dma += *arg3; + dma += *dmaIndexRef; #else - dma = sSampleDmas + *arg3; + dma = sSampleDmas + *dmaIndexRef; #endif bufferPos = devAddr - dma->source; if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) { @@ -263,7 +347,7 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) { // Move the DMA out of the reuse queue, by swapping it with the // tail, and then incrementing the tail. if (dma->reuseIndex != sSampleDmaReuseQueueTail1) { -#ifdef VERSION_EU +#if defined(VERSION_EU) if (1) { } #endif @@ -275,7 +359,7 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) { sSampleDmaReuseQueueTail1++; } dma->ttl = 2; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) return dma->buffer + (devAddr - dma->source); #else return (devAddr - dma->source) + dma->buffer; @@ -284,6 +368,9 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) { } if (!hasDma) { +#ifdef VERSION_SH + if (1) {} +#endif // Allocate a DMA from reuse queue 1. This queue will hopefully never // be empty, since TTL 2 is so small. dmaIndex = sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1++]; @@ -299,44 +386,64 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) { #ifdef VERSION_US osInvalDCache(dma->buffer, transfer); #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, - OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue); - *arg3 = dmaIndex; + OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue); + *dmaIndexRef = dmaIndex; + return (devAddr - dmaDevAddr) + dma->buffer; +#elif defined (VERSION_SH) + func_sh_802f3dd0(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ, + dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue, medium, shindouDebugPrint62); + *dmaIndexRef = dmaIndex; return (devAddr - dmaDevAddr) + dma->buffer; #else gCurrAudioFrameDmaCount++; osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount - 1], OS_MESG_PRI_NORMAL, OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue); - *arg3 = dmaIndex; + *dmaIndexRef = dmaIndex; return dma->buffer + (devAddr - dmaDevAddr); #endif } void init_sample_dma_buffers(UNUSED s32 arg0) { -#ifdef VERSION_EU +#if defined(VERSION_EU) sDmaBufSize = 0x400 * 4; - for (s32 i = 0; i < gMaxSimultaneousNotes * 3 * gAudioBufferParameters.presetUnk4; i++) { +#elif defined(VERSION_SH) + sDmaBufSize = 0x2D0 * 4; + sSampleDmas = sound_alloc_uninitialized(&gNotesAndBuffersPool, + gMaxSimultaneousNotes * 4 * sizeof(struct SharedDma) * gAudioBufferParameters.presetUnk4); #else - sDmaBufSize = (144 * 9) * 4; - for (s32 i = 0; i < gMaxSimultaneousNotes * 3; i++) { + sDmaBufSize = 144 * 9 * 4; #endif + +#if defined(VERSION_EU) || defined(VERSION_SH) + for (s32 i = 0; i < gMaxSimultaneousNotes * 3 * gAudioBufferParameters.presetUnk4; i++) +#else + for (s32 i = 0; i < gMaxSimultaneousNotes * 3; i++) +#endif + { +#if defined(VERSION_SH) + if ((sSampleDmas[gSampleDmaNumListItems].buffer = sound_alloc_uninitialized(&gNotesAndBuffersPool, sDmaBufSize)) == NULL) { + break; + } +#else sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, sDmaBufSize); if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) { -#ifdef VERSION_EU +#if defined(VERSION_EU) break; #else goto out1; #endif } +#endif + sSampleDmas[gSampleDmaNumListItems].bufSize = sDmaBufSize; sSampleDmas[gSampleDmaNumListItems].source = 0; sSampleDmas[gSampleDmaNumListItems].sizeUnused = 0; sSampleDmas[gSampleDmaNumListItems].unused2 = 0; sSampleDmas[gSampleDmaNumListItems].ttl = 0; - sSampleDmas[gSampleDmaNumListItems].bufSize = sDmaBufSize; gSampleDmaNumListItems++; } -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) out1: #endif @@ -353,28 +460,41 @@ out1: sSampleDmaReuseQueueHead1 = (u8) gSampleDmaNumListItems; sSampleDmaListSize1 = gSampleDmaNumListItems; -#ifdef VERSION_EU +#if defined(VERSION_SH) + sDmaBufSize = 0x2D0 * 4; +#elif defined(VERSION_EU) sDmaBufSize = 0x200 * 4; #else - sDmaBufSize = (160 * 9) * 4; + sDmaBufSize = 160 * 9 * 4; #endif for (s32 i = 0; i < gMaxSimultaneousNotes; i++) { +#if defined(VERSION_SH) + if ((sSampleDmas[gSampleDmaNumListItems].buffer = sound_alloc_uninitialized(&gNotesAndBuffersPool, sDmaBufSize)) == NULL) { + break; + } +#else sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, sDmaBufSize); if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) { -#ifdef VERSION_EU +#if defined(VERSION_EU) break; #else goto out2; #endif } +#endif +#if defined(VERSION_SH) + sSampleDmas[gSampleDmaNumListItems].bufSize = sDmaBufSize; +#endif sSampleDmas[gSampleDmaNumListItems].source = 0; sSampleDmas[gSampleDmaNumListItems].sizeUnused = 0; sSampleDmas[gSampleDmaNumListItems].unused2 = 0; sSampleDmas[gSampleDmaNumListItems].ttl = 0; +#ifndef VERSION_SH sSampleDmas[gSampleDmaNumListItems].bufSize = sDmaBufSize; +#endif gSampleDmaNumListItems++; } -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) out2: #endif @@ -391,9 +511,6 @@ out2: sSampleDmaReuseQueueTail2 = 0; sSampleDmaReuseQueueHead2 = gSampleDmaNumListItems - sSampleDmaListSize1; -#ifdef VERSION_EU -#undef j -#endif } #ifndef static @@ -401,11 +518,58 @@ out2: #undef static #endif -#ifndef VERSION_EU +#if defined(VERSION_SH) +void patch_seq_file(ALSeqFile *seqFile, u8 *data, u16 arg2) { + ALSeqFile *phi_a2; + s32 i; + + seqFile->unk2 = arg2; + seqFile->data = data; + for (i = 0; i < seqFile->seqCount; i++) { + if (seqFile->seqArray[i].len != 0 && seqFile->seqArray[i].magic[0] == 2) { + seqFile->seqArray[i].offset += (uintptr_t)data; + } + } +} + +void *func_sh_802f2e24(s32 arg0, s32 *arg1) { + s32 phi_s2; + s32 phi_s0; + s32 phi_s1; + void *sp28; + + phi_s0 = ((u16 *)gAlBankSets)[func_sh_802f39a0(0, arg0)]; + phi_s1 = gAlBankSets[phi_s0++]; + phi_s2 = 0xFF; + while (phi_s1 > 0) { + phi_s2 = gAlBankSets[phi_s0++]; + phi_s2 = (s32) phi_s2; + sp28 = func_sh_802f3688(phi_s2); + phi_s1--; + } + *arg1 = phi_s2; + return sp28; +} +#endif + +#if defined(VERSION_JP) || defined(VERSION_US) // This function gets optimized out on US due to being static and never called static #endif +#if defined(VERSION_SH) +void preload_sequence(s32 arg0, s32 arg1) { + UNUSED s32 pad; + s32 sp18; + arg0 = func_sh_802f39a0(0, arg0); + if (arg1 & PRELOAD_BANKS) { + func_sh_802f2e24(arg0, &sp18); + } + if (arg1 & PRELOAD_SEQUENCE) { + func_sh_802F3564(arg0); + } +} +#else void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED u8 *offsetBase) { struct AudioBankSample *sample; void *patched; @@ -421,7 +585,7 @@ void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED sample->book = PATCH(sample->book, memBase); sample->loaded = 1; } -#ifdef VERSION_EU +#if defined(VERSION_EU) else if (sample->loaded == 0x80) { PATCH(sample->sampleAddr, offsetBase); mem = soundAlloc(&gNotesAndBuffersPool, sample->sampleSize); @@ -441,8 +605,9 @@ void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED #undef PATCH } +#endif -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) #define PATCH_SOUND(_sound, mem, offset) \ { \ struct AudioBankSound *sound = _sound; \ @@ -467,33 +632,457 @@ void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED } #endif -// on US/JP this inlines patch_sound, using some -sopt compiler flag -void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums) { - struct Instrument *instrument; - struct Instrument **itInstrs; - struct Instrument **end; - struct AudioBank *temp; - u32 i; - void *patched; +#if defined(VERSION_SH) +s32 func_sh_802f2f38(struct AudioBankSample *sample, s32 bankId) { + u8 *sp24; + + if (sample->isPatched == TRUE && sample->medium != 0) { + sp24 = func_sh_802f1d90(sample->size, bankId, sample->sampleAddr, sample->medium); + if (sp24 == NULL) { + return -1; + } + if (sample->medium == 1) { + func_sh_802f3d78(sample->sampleAddr, sp24, sample->size, gAlTbl->unk2); + } else { + func_sh_802f3c38(sample->sampleAddr, sp24, sample->size, sample->medium); + } + sample->medium = 0; + sample->sampleAddr = sp24; + } +} + +s32 func_sh_802f3024(s32 bankId, s32 instId, s32 arg2) { + struct Instrument *instr; struct Drum *drum; - struct Drum **drums; -#ifdef VERSION_EU - u32 numDrums2; + + if (instId < 0x7F) { + instr = get_instrument_inner(bankId, instId); + if (instr == NULL) { + return -1; + } + if (instr->normalRangeLo != 0) { + func_sh_802f2f38(instr->lowNotesSound.sample, bankId); + } + func_sh_802f2f38(instr->normalNotesSound.sample, bankId); + if (instr->normalRangeHi != 0x7F) { + func_sh_802f2f38(instr->highNotesSound.sample, bankId); + } + //! missing return + } else if (instId == 0x7F) { + drum = get_drum(bankId, arg2); + if (drum == NULL) { + return -1; + } + func_sh_802f2f38(drum->sound.sample, bankId); + return 0; + } +} + +void func_sh_802f30f4(s32 arg0, s32 arg1, s32 arg2, OSMesgQueue *arg3) { + if (func_802f3f08(2, func_sh_802f39a0(2, arg0), arg1, arg2, arg3) == 0) { + osSendMesg(arg3, 0, 0); + } +} + +void func_sh_802f3158(s32 index, s32 numChunks, s32 arg2, OSMesgQueue *retQueue) { + s32 val; + s32 v; + + val = ((u16 *) gAlBankSets)[func_sh_802f39a0(0, index)]; + v = gAlBankSets[val++]; + + while (v > 0) { + func_802f3f08(1, func_sh_802f39a0(1, gAlBankSets[val++]), numChunks, arg2, retQueue); + v--; + } +} + +u8 *func_sh_802f3220(u32 index, u32 *a1) { + s32 val; + + val = ((u16 *) gAlBankSets)[func_sh_802f39a0(0, index)]; + *a1 = gAlBankSets[val++]; + if (*a1 == 0) { + return NULL; + } + return &gAlBankSets[val]; +} + +void func_sh_802f3288(s32 idx) { + s32 s0; + s32 s2; + + idx = ((u16*)gAlBankSets)[func_sh_802f39a0(0, idx)]; + s2 = gAlBankSets[idx++]; + while (s2 > 0) { + s2--; + s0 = func_sh_802f39a0(1, gAlBankSets[idx++]); + + if (unk_pool1_lookup(1, s0) == 0) { + func_sh_802f3368(s0); + if (gBankLoadStatus[s0] != 5) { + gBankLoadStatus[s0] = 0; + } + + continue; + } + + } +} + +s32 func_sh_802f3368(s32 arg0) { + struct SoundMultiPool *pool = &gBankLoadedPool; + struct TemporaryPool *temporary = &pool->temporary; + struct PersistentPool *persistent; + u32 i; + + if (temporary->entries[0].id == arg0) { + temporary->entries[0].id = -1; + } else if (arg0 == temporary->entries[1].id) { + temporary->entries[1].id = -1; + } + + persistent = &pool->persistent; + for (i = 0; i < persistent->numEntries; i++) { + if (persistent->entries[i].id == arg0) { + persistent->entries[i].id = -1; + } + + } + + discard_bank(arg0); +} + + +void func_sh_802F3430(s32 arg0, s32 arg1, s32 arg2); +void func_sh_802F3410(s32 arg0, s32 arg1, s32 arg2) { + func_sh_802F3430(arg0, arg1, arg2); +} + +void func_sh_802F3430(s32 arg0, s32 arg1, s32 arg2) { + struct SequencePlayer *seqPlayer; + u8 *seqData; + u32 temp; + u32 s0; + s32 s1; + u8 bank; + u32 id; + + seqPlayer = &gSequencePlayers[arg0]; + + temp = func_sh_802f39a0(0, arg1); + sequence_player_disable(seqPlayer); + id = temp; + + s0 = ((u16 *) gAlBankSets)[id]; + s1 = gAlBankSets[s0++]; + bank = 0xff; + + while (s1 > 0) { + bank = gAlBankSets[s0++]; + func_sh_802f3688(bank); + s1--; + } + + seqData = func_sh_802F3564(id); + init_sequence_player(arg0); + seqPlayer->seqId = id; + seqPlayer->defaultBank[0] = bank; + seqPlayer->enabled = 1; + seqPlayer->seqData = seqData; + seqPlayer->scriptState.pc = seqData; + seqPlayer->scriptState.depth = 0; + seqPlayer->delay = 0; + seqPlayer->finished = 0; + + if (id) { + } + + for (id = 0; id < 0x10; id++) { + } + +} + +void *func_sh_802F3564(s32 arg0) { + void *a = func_sh_802f39a0(0, arg0); + s32 b; + return func_sh_802f3764(0, a, &b); +} + +extern u8 gUnkLoadStatus[0x40]; + +void *func_sh_802f3598(s32 idx, s32 *medium) { + void *ret; + ALSeqFile *f; + s32 temp; + s32 sp28; + + f = get_audio_file_header(2); + idx = func_sh_802f39a0(2, idx); + ret = get_bank_or_seq_wrapper(2, idx); + if (ret != NULL) { + if (gUnkLoadStatus[idx] != SOUND_LOAD_STATUS_5) { + gUnkLoadStatus[idx] = SOUND_LOAD_STATUS_COMPLETE; + } + + *medium = 0; + return ret; + } + + temp = f->seqArray[idx].magic[1]; + if (temp == 4) { + *medium = f->seqArray[idx].magic[0]; + return f->seqArray[idx].offset; + } else { + ret = func_sh_802f3764(2, idx, &sp28); + if (ret != 0) { + *medium = 0; + return ret; + } + + *medium = f->seqArray[idx].magic[0]; + } + return f->seqArray[idx].offset; + +} + +void *func_sh_802f3688(s32 idx) { + void *ret; + s32 bankId1; + s32 bankId2; + s32 sp38; + struct PatchStruct patchInfo; + + idx = func_sh_802f39a0(1, idx); + bankId1 = gCtlEntries[idx].bankId1; + bankId2 = gCtlEntries[idx].bankId2; + + patchInfo.bankId1 = bankId1; + patchInfo.bankId2 = bankId2; + + if (patchInfo.bankId1 != 0xFF) { + patchInfo.baseAddr1 = func_sh_802f3598(patchInfo.bankId1, &patchInfo.medium1); + } else { + patchInfo.baseAddr1 = NULL; + } + + if (bankId2 != 0xFF) { + patchInfo.baseAddr2 = func_sh_802f3598(bankId2, &patchInfo.medium2); + } else { + patchInfo.baseAddr2 = NULL; + } + + if ((ret = func_sh_802f3764(1, idx, &sp38)) == NULL) { + return NULL; + } + + if (sp38 == 1) { + func_sh_802f5310(idx, ret, &patchInfo, 0); + } + + return ret; +} + +void *func_sh_802f3764(s32 poolIdx, s32 idx, s32 *arg2) { + s32 size; + ALSeqFile *f; + void *vAddr; + s32 sp30; + UNUSED u32 pad2; + u8 *devAddr; + s8 loadStatus; + s32 sp18; + + vAddr = get_bank_or_seq_wrapper(poolIdx, idx); + if (vAddr != NULL) { + *arg2 = 0; + loadStatus = SOUND_LOAD_STATUS_COMPLETE; + } else { + f = get_audio_file_header(poolIdx); + size = f->seqArray[idx].len; + size = ALIGN16(size); + sp30 = f->seqArray[idx].magic[0]; + sp18 = f->seqArray[idx].magic[1]; + devAddr = f->seqArray[idx].offset; + + + switch (sp18) + { + case 0: + vAddr = unk_pool1_alloc(poolIdx, idx, size); + if (vAddr == NULL) { + return vAddr; + } + break; + case 1: + vAddr = alloc_bank_or_seq(poolIdx, size, 1, idx); + if (vAddr == NULL) { + return vAddr; + } + break; + case 2: + vAddr = alloc_bank_or_seq(poolIdx, size, 0, idx); + if (vAddr == NULL) { + return vAddr; + } + break; + + case 3: + case 4: + vAddr = alloc_bank_or_seq(poolIdx, size, 2, idx); + if (vAddr == NULL) { + return vAddr; + } + break; + } + + *arg2 = 1; + if (sp30 == 1) { + func_sh_802f3d78((uintptr_t) devAddr, vAddr, size, f->unk2); + } else { + func_sh_802f3c38((uintptr_t) devAddr, vAddr, size, sp30); + } + + switch (sp18) + { + case 0: + loadStatus = SOUND_LOAD_STATUS_5; + break; + + default: + loadStatus = SOUND_LOAD_STATUS_COMPLETE; + break; + } + } + + switch (poolIdx) + { + case 0: + if (gSeqLoadStatus[idx] != SOUND_LOAD_STATUS_5) { + gSeqLoadStatus[idx] = loadStatus; + } + break; + + case 1: + if (gBankLoadStatus[idx] != SOUND_LOAD_STATUS_5) { + gBankLoadStatus[idx] = loadStatus; + } + break; + + case 2: + if (gUnkLoadStatus[idx] != SOUND_LOAD_STATUS_5) { + gUnkLoadStatus[idx] = loadStatus; + } + break; + } + + return vAddr; +} + +s32 func_sh_802f39a0(s32 arg0, s32 idx) { + ALSeqFile *f; + + f = get_audio_file_header(arg0); + if (f->seqArray[idx].len == 0) { + idx = (s32) f->seqArray[idx].offset; // TODO: something doesn't seem right here... + } + return idx; +} + +void *get_bank_or_seq_wrapper(s32 poolIdx, s32 id) { + void *ret; + + ret = unk_pool1_lookup(poolIdx, id); + if (ret != NULL) { + return ret; + } + ret = get_bank_or_seq(poolIdx, 2, id); + if (ret != 0) { + return ret; + } + return NULL; +} + +ALSeqFile *get_audio_file_header(s32 index) { + ALSeqFile *ret; + switch(index) { + default: + ret = NULL; + break; + case 0: + ret = gSeqFileHeader; + break; + case 1: + ret = gAlCtlHeader; + break; + case 2: + ret = gAlTbl; + break; + } + return ret; +} #endif -#define PATCH(x, base) (patched = (void *)((uintptr_t) (x) + (uintptr_t) base)) +// on US/JP this inlines patch_sound, using some -sopt compiler flag +#if defined(VERSION_SH) +void patch_audio_bank(s32 bankId, struct AudioBank *mem, struct PatchStruct *patchInfo) { +#else +void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums) { +#endif + struct Instrument *instrument; +#if defined(VERSION_SH) + void **itInstrs; +#else + struct Instrument **itInstrs; +#endif + struct Instrument **end; +#if defined(VERSION_SH) + s32 i; +#else + struct AudioBank *temp; // Maybe Shindou also has this; I'm not sure. + u32 i; +#endif + void *patched; + struct Drum *drum; +#ifndef VERSION_SH + struct Drum **drums; +#endif +#if defined(VERSION_EU) + u32 numDrums2; +#elif defined(VERSION_SH) + s32 numDrums2; + s32 numInstruments2; +#endif + +#define BASE_OFFSET(x, base) (void *)((uintptr_t) (x) + (uintptr_t) base) +#define PATCH(x, base) (patched = BASE_OFFSET(x, base)) #define PATCH_MEM(x) x = PATCH(x, mem) +#if defined(VERSION_SH) + numDrums2 = gCtlEntries[bankId].numDrums; + numInstruments2 = gCtlEntries[bankId].numInstruments; + itInstrs = mem->drums; + if (mem->drums) { + } +#else drums = mem->drums; -#ifndef VERSION_EU +#endif +#if defined(VERSION_JP) || defined(VERSION_US) if (drums != NULL && numDrums > 0) { mem->drums = (void *)((uintptr_t) drums + (uintptr_t) mem); if (numDrums > 0) //! unneeded when -sopt is enabled for (i = 0; i < numDrums; i++) { #else +#if defined(VERSION_EU) numDrums2 = numDrums; if (drums != NULL && numDrums2 > 0) { mem->drums = PATCH(drums, mem); +#elif defined(VERSION_SH) + if (itInstrs != NULL && numDrums2 != 0) { + if (1) { + mem->drums = PATCH(itInstrs, mem); + } +#endif for (i = 0; i < numDrums2; i++) { #endif patched = mem->drums[i]; @@ -501,15 +1090,19 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 drum = PATCH(patched, mem); mem->drums[i] = drum; if (drum->loaded == 0) { -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) //! copt replaces drum with 'patched' for these two lines PATCH_SOUND(&(*(struct Drum *)patched).sound, mem, offset); patched = (*(struct Drum *)patched).envelope; - drum->envelope = (void *)((uintptr_t) mem + (uintptr_t) patched); + drum->envelope = BASE_OFFSET(mem, patched); #else +#if defined(VERSION_EU) patch_sound(&drum->sound, (u8 *) mem, offset); +#elif defined(VERSION_SH) + func_sh_802f51d4(&drum->sound, mem, patchInfo); +#endif patched = drum->envelope; - drum->envelope = (void *)((uintptr_t) patched + (uintptr_t) mem); + drum->envelope = BASE_OFFSET(patched, mem); #endif drum->loaded = 1; } @@ -518,60 +1111,169 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 } } +#ifndef VERSION_SH temp = mem; -#ifndef VERSION_EU +#endif +#if defined(VERSION_JP) || defined(VERSION_US) if (numInstruments >= 1) #endif +#if defined(VERSION_SH) + if (numInstruments2 > 0) { + itInstrs = mem->instruments; + end = numInstruments2 + (struct Instrument **) itInstrs; +#else if (numInstruments > 0) { //! Doesn't affect EU, but required for US/JP struct Instrument **tempInst; itInstrs = temp->instruments; tempInst = temp->instruments; end = numInstruments + tempInst; +#endif -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) l2: #else do { #endif if (*itInstrs != NULL) { - *itInstrs = (void *)((uintptr_t) *itInstrs + (uintptr_t) mem); +#ifdef VERSION_SH + *itInstrs = BASE_OFFSET(mem, *itInstrs); +#else + *itInstrs = BASE_OFFSET(*itInstrs, mem); +#endif instrument = *itInstrs; if (instrument->loaded == 0) { -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) PATCH_SOUND(&instrument->lowNotesSound, (u8 *) mem, offset); PATCH_SOUND(&instrument->normalNotesSound, (u8 *) mem, offset); PATCH_SOUND(&instrument->highNotesSound, (u8 *) mem, offset); -#else +#elif defined(VERSION_EU) patch_sound(&instrument->lowNotesSound, (u8 *) mem, offset); patch_sound(&instrument->normalNotesSound, (u8 *) mem, offset); patch_sound(&instrument->highNotesSound, (u8 *) mem, offset); +#elif defined(VERSION_SH) + if (instrument->normalRangeLo != 0) { + func_sh_802f51d4(&instrument->lowNotesSound, mem, patchInfo); + } + func_sh_802f51d4(&instrument->normalNotesSound, mem, patchInfo); + if (instrument->normalRangeHi != 0x7F) { + func_sh_802f51d4(&instrument->highNotesSound, mem, patchInfo); + } #endif patched = instrument->envelope; -#ifndef VERSION_EU - instrument->envelope = (void *)((uintptr_t) mem + (uintptr_t) patched); -#else - instrument->envelope = (void *)((uintptr_t) patched + (uintptr_t) mem); -#endif + +#if defined(VERSION_JP) || defined(VERSION_US) + instrument->envelope = BASE_OFFSET(mem, patched); instrument->loaded = 1; +#else + instrument->envelope = BASE_OFFSET(patched, mem); + instrument->loaded = 1; +#endif } } +#ifndef VERSION_SH itInstrs++; -#ifndef VERSION_EU +#else + itInstrs = ((struct Instrument **) itInstrs) + 1; +#endif +#if defined(VERSION_JP) || defined(VERSION_US) //! goto generated by copt, required to match US/JP if (end != itInstrs) { goto l2; } #else +#ifdef VERSION_EU } while (end != itInstrs); +#else + } while ((struct Instrument **) itInstrs != (0, end)); //! This is definitely fake +#endif #endif } +#if defined(VERSION_SH) + gCtlEntries[bankId].drums = mem->drums; + gCtlEntries[bankId].instruments = mem->instruments; +#endif #undef PATCH_MEM #undef PATCH +#undef BASE_OFFSET #undef PATCH_SOUND } +#if defined(VERSION_SH) +void func_sh_802f3ed4(UNUSED s32 arg0, UNUSED s32 arg1, UNUSED void *vAddr, UNUSED size_t nbytes); + +extern char shindouDebugPrint81[]; +extern char shindouDebugPrint82[]; +void func_sh_802f3c38(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 medium) { + nbytes = ALIGN16(nbytes); + osInvalDCache(vAddr, nbytes); + +lock: + if (gAudioLoadLockSH != 0) { + goto lock; + } + + if (nbytes >= 0x400U) { + func_sh_802f3dd0(&gAudioDmaIoMesg, 1, 0, devAddr, vAddr, 0x400, &gAudioDmaMesgQueue, medium, shindouDebugPrint81); + osRecvMesg(&gAudioDmaMesgQueue, NULL, 1); + nbytes = nbytes - 0x400; + devAddr = devAddr + 0x400; + vAddr = (u8*)vAddr + 0x400; + goto lock; + } + + if (nbytes != 0) { + func_sh_802f3dd0(&gAudioDmaIoMesg, 1, 0, devAddr, vAddr, nbytes, &gAudioDmaMesgQueue, medium, shindouDebugPrint82); + osRecvMesg(&gAudioDmaMesgQueue, NULL, 1); + } +} + +void func_sh_802f3d78(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 arg3) { + uintptr_t sp1C; + + sp1C = devAddr; + osInvalDCache(vAddr, nbytes); + func_sh_802f3ed4(func_sh_802f3ec4(arg3, &sp1C), sp1C, vAddr, nbytes); +} + +s32 func_sh_802f3dd0(OSIoMesg *m, s32 pri, s32 direction, uintptr_t devAddr, void *dramAddr, s32 size, OSMesgQueue *retQueue, s32 medium, const char *arg8) { + OSPiHandle *handle; + if (gAudioLoadLockSH >= 0x11U) { + return -1; + } + switch (medium) { + case 2: + handle = osCartRomInit(); + break; + case 3: + handle = osDriveRomInit(); + break; + default: + return 0; + } + if ((size & 0xf) != 0) { + size = ALIGN16(size); + } + m->hdr.pri = pri; + m->hdr.retQueue = retQueue; + m->dramAddr = dramAddr; + m->devAddr = devAddr; + m->size = size; + handle->transferInfo.cmdType = 2; + osEPiStartDma(handle, m, direction); + return 0; +} + +s32 func_sh_802f3ec4(UNUSED s32 arg0, UNUSED uintptr_t *arg1) { + return 0; +} + +void func_sh_802f3ed4(UNUSED s32 arg0, UNUSED s32 arg1, UNUSED void *vAddr, UNUSED size_t nbytes) { +} +#endif + +#ifndef VERSION_SH struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) { UNUSED u32 pad1[4]; u32 buf[4]; @@ -603,7 +1305,9 @@ struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) { gBankLoadStatus[bankId] = SOUND_LOAD_STATUS_COMPLETE; return ret; } +#endif +#ifndef VERSION_SH struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *seqPlayer) { u32 numInstruments, numDrums; UNUSED u32 pad1[2]; @@ -613,7 +1317,7 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s struct AudioBank *ret; u8 *ctlData; OSMesgQueue *mesgQueue; -#ifdef VERSION_EU +#if defined(VERSION_EU) UNUSED u32 pad3; #endif @@ -630,7 +1334,7 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s numInstruments = buf[0]; numDrums = buf[1]; seqPlayer->loadingBankId = (u8) bankId; -#ifdef VERSION_EU +#if defined(VERSION_EU) gCtlEntries[bankId].numInstruments = numInstruments; gCtlEntries[bankId].numDrums = numDrums; gCtlEntries[bankId].instruments = ret->instruments; @@ -650,7 +1354,7 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s #endif mesgQueue = &seqPlayer->bankDmaMesgQueue; osCreateMesgQueue(mesgQueue, &seqPlayer->bankDmaMesg, 1); -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) seqPlayer->bankDmaMesg = NULL; #endif seqPlayer->bankDmaInProgress = TRUE; @@ -659,7 +1363,9 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s gBankLoadStatus[bankId] = SOUND_LOAD_STATUS_IN_PROGRESS; return ret; } +#endif +#ifndef VERSION_SH void *sequence_dma_immediate(s32 seqId, s32 arg1) { s32 seqLength; void *ptr; @@ -677,7 +1383,9 @@ void *sequence_dma_immediate(s32 seqId, s32 arg1) { gSeqLoadStatus[seqId] = SOUND_LOAD_STATUS_COMPLETE; return ptr; } +#endif +#ifndef VERSION_SH void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer) { s32 seqLength; void *ptr; @@ -704,7 +1412,7 @@ void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer) audio_dma_copy_immediate((uintptr_t) seqData, ptr, 0x40); mesgQueue = &seqPlayer->seqDmaMesgQueue; osCreateMesgQueue(mesgQueue, &seqPlayer->seqDmaMesg, 1); -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) seqPlayer->seqDmaMesg = NULL; #endif seqPlayer->seqDmaInProgress = TRUE; @@ -714,7 +1422,9 @@ void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer) } return ptr; } +#endif +#ifndef VERSION_SH u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) { void *temp; u32 bankId; @@ -724,7 +1434,7 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) { *nullCount = 0; *nonNullCount = 0; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) offset = ((u16 *) gAlBankSets)[seqId]; for (i = gAlBankSets[offset++], ret = 0; i != 0; i--) { bankId = gAlBankSets[offset++]; @@ -736,10 +1446,12 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) { #endif if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE) { -#ifdef VERSION_EU +#ifndef VERSION_SH +#if defined(VERSION_EU) || defined(VERSION_SH) temp = get_bank_or_seq(&gBankLoadedPool, 2, bankId); #else temp = get_bank_or_seq(&gBankLoadedPool, 2, gAlBankSets[offset - 1]); +#endif #endif } else { temp = NULL; @@ -755,7 +1467,9 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) { return ret; } +#endif +#ifndef VERSION_SH struct AudioBank *load_banks_immediate(s32 seqId, u8 *arg1) { void *ret = NULL; u32 bankId = 0; @@ -790,7 +1504,9 @@ struct AudioBank *load_banks_immediate(s32 seqId, u8 *arg1) { *arg1 = bankId; return ret; } +#endif +#ifndef VERSION_SH void preload_sequence(u32 seqId, u8 preloadMask) { void *sequenceData; u8 temp; @@ -812,7 +1528,6 @@ void preload_sequence(u32 seqId, u8 preloadMask) { } else { sequenceData = NULL; } - if (sequenceData == NULL && sequence_dma_immediate(seqId, 2) == NULL) { gAudioLoadLock = AUDIO_LOCK_NOT_LOADING; return; @@ -821,7 +1536,9 @@ void preload_sequence(u32 seqId, u8 preloadMask) { gAudioLoadLock = AUDIO_LOCK_NOT_LOADING; } +#endif +#ifndef VERSION_SH void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync); void load_sequence(u32 player, u32 seqId, s32 loadAsync) { @@ -833,7 +1550,9 @@ void load_sequence(u32 player, u32 seqId, s32 loadAsync) { gAudioLoadLock = AUDIO_LOCK_NOT_LOADING; } } +#endif +#ifndef VERSION_SH void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) { void *sequenceData; struct SequencePlayer *seqPlayer = &gSequencePlayers[player]; @@ -847,16 +1566,26 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) { if (loadAsync) { s32 numMissingBanks = 0; s32 dummy = 0; +#ifdef VERSION_SH + s32 bankId = 0xBA17; // dummy code to avoid problems +#else s32 bankId = get_missing_bank(seqId, &dummy, &numMissingBanks); +#endif if (numMissingBanks == 1) { +#ifndef VERSION_SH eu_stubbed_printf_0("Ok,one bank slow load Start \n"); if (bank_load_async(bankId, 2, seqPlayer) == NULL) { return; } +#endif // @bug This should set the last bank (i.e. the first in the JSON) // as default, not the missing one. This code path never gets // taken, though -- all sequence loading is synchronous. seqPlayer->defaultBank[0] = bankId; +#ifdef VERSION_SH + } + } +#else } else { eu_stubbed_printf_1("Sorry,too many %d bank is none.fast load Start \n", numMissingBanks); if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL) { @@ -866,24 +1595,29 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) { } else if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL) { return; } +#endif eu_stubbed_printf_2("Seq %d:Default Load Id is %d\n", seqId, seqPlayer->defaultBank[0]); eu_stubbed_printf_0("Seq Loading Start\n"); seqPlayer->seqId = seqId; +#ifndef VERSION_SH sequenceData = get_bank_or_seq(&gSeqLoadedPool, 2, seqId); +#endif if (sequenceData == NULL) { if (seqPlayer->seqDmaInProgress) { eu_stubbed_printf_0("Error:Before Sequence-SlowDma remain.\n"); eu_stubbed_printf_0(" Cancel Seq Start.\n"); return; } - +#ifndef VERSION_SH if (loadAsync) { sequenceData = sequence_dma_async(seqId, 2, seqPlayer); } else { + sequenceData = sequence_dma_immediate(seqId, 2); } +#endif if (sequenceData == NULL) { return; @@ -898,6 +1632,135 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) { seqPlayer->seqData = sequenceData; seqPlayer->scriptState.pc = sequenceData; } +#endif + +#if defined(VERSION_SH) +void *func_sh_802f3ee8(uintptr_t devAddr, void *vAddr) { + s32 b; + return func_sh_802f3764(devAddr, vAddr, &b); +} + +void *func_802f3f08(s32 poolIdx, s32 idx, s32 numChunks, s32 arg3, OSMesgQueue *retQueue) { + s32 size; + ALSeqFile *f; + void *vAddr; + s32 medium; + s32 sp18; + uintptr_t devAddr; + s32 loadStatus; + + switch (poolIdx) { + case 0: + if (gSeqLoadStatus[idx] == SOUND_LOAD_STATUS_IN_PROGRESS) { + return 0; + } + break; + case 1: + if (gBankLoadStatus[idx] == SOUND_LOAD_STATUS_IN_PROGRESS) { + return 0; + } + break; + case 2: + if (gUnkLoadStatus[idx] == SOUND_LOAD_STATUS_IN_PROGRESS) { + return 0; + } + break; + + } + vAddr = get_bank_or_seq_wrapper(poolIdx, idx); + if (vAddr != NULL) { + loadStatus = 2; + osSendMesg(retQueue, (OSMesg) (arg3 << 0x18), 0); + } else { + f = get_audio_file_header(poolIdx); + size = f->seqArray[idx].len; + size = ALIGN16(size); + medium = f->seqArray[idx].magic[0]; + sp18 = f->seqArray[idx].magic[1]; + devAddr = (uintptr_t) f->seqArray[idx].offset; + loadStatus = 2; + + switch (sp18) { + case 0: + vAddr = unk_pool1_alloc(poolIdx, idx, size); + if (vAddr == NULL) { + return vAddr; + } + loadStatus = 5; + break; + case 1: + vAddr = alloc_bank_or_seq(poolIdx, size, 1, idx); + if (vAddr == NULL) { + return vAddr; + } + break; + case 2: + vAddr = alloc_bank_or_seq(poolIdx, size, 0, idx); + if (vAddr == NULL) { + return vAddr; + } + break; + + case 4: + case 3: + vAddr = alloc_bank_or_seq(poolIdx, size, 2, idx); + if (vAddr == NULL) { + return vAddr; + } + break; + } + + func_sh_802f4cb4(devAddr, vAddr, size, medium, numChunks, retQueue, (arg3 << 0x18) | (poolIdx << 0x10) | (idx << 8) | loadStatus); + loadStatus = SOUND_LOAD_STATUS_IN_PROGRESS; + } + + switch (poolIdx) { + case 0: + if (gSeqLoadStatus[idx] != 5) { + gSeqLoadStatus[idx] = loadStatus; + } + break; + + case 1: + if (gBankLoadStatus[idx] != 5) { + gBankLoadStatus[idx] = loadStatus; + } + break; + + case 2: + if (gUnkLoadStatus[idx] != 5) { + gUnkLoadStatus[idx] = loadStatus; + } + break; + } + + return vAddr; +} + +void func_802f41e4(s32 audioResetStatus) { + func_sh_802f4a4c(audioResetStatus); + func_sh_802f573c(audioResetStatus); + func_sh_802f4dcc(audioResetStatus); +} +#endif + +#if defined(VERSION_SH) +u8 gShindouSoundBanksHeader[] = { +#include "sound/ctl_header.inc.c" +}; + +u8 gBankSetsData[] = { +#include "sound/bank_sets.inc.c" +}; + +u8 gShindouSampleBanksHeader[] = { +#include "sound/tbl_header.inc.c" +}; + +u8 gShindouSequencesHeader[] = { +#include "sound/sequences_header.inc.c" +}; +#endif #ifdef EXTERNAL_DATA # define LOAD_DATA(x) load_sound_res((const char *)x) @@ -916,28 +1779,39 @@ static inline void *load_sound_res(const char *path) { // (void) must be omitted from parameters void audio_init() { -#ifdef VERSION_EU +#if defined(VERSION_EU) UNUSED s8 pad[16]; +#elif defined(VERSION_SH) + UNUSED s8 pad[24]; #else UNUSED s8 pad[32]; +#endif +#if defined(VERSION_JP) || defined(VERSION_US) u8 buf[0x10] = { 0 }; #endif s32 i, UNUSED j, UNUSED k; UNUSED s32 lim1; // lim1 unused in EU -#ifdef VERSION_EU - u8 buf[0x10]; +#if defined(VERSION_EU) || defined(VERSION_SH) + UNUSED u8 buf[0x10]; s32 UNUSED lim2, lim3; #else s32 lim2, UNUSED lim3; #endif - u32 size; + UNUSED u32 size; UNUSED u64 *ptr64; void *data; UNUSED s32 pad2; +#ifdef VERSION_SH + s32 seqCount; +#endif +#ifdef VERSION_SH + gAudioLoadLockSH = 0; +#else gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED; +#endif -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) lim1 = gUnusedCount80333EE8; for (i = 0; i < lim1; i++) { gUnused80226E58[i] = 0; @@ -953,9 +1827,17 @@ void audio_init() { ((u64 *) gAudioHeap)[i] = 0; } +#ifdef VERSION_EU D_EU_802298D0 = 20.03042f; gRefreshRate = 50; port_eu_init(); + if (k) { + } +#else + D_EU_802298D0 = 16.713f; + gRefreshRate = 60; + func_sh_802f6a9c(); +#endif #endif #ifdef TARGET_N64 @@ -982,6 +1864,10 @@ void audio_init() { osCreateMesgQueue(&gAudioDmaMesgQueue, &gAudioDmaMesg, 1); osCreateMesgQueue(&gCurrAudioFrameDmaQueue, gCurrAudioFrameDmaMesgBufs, ARRAY_COUNT(gCurrAudioFrameDmaMesgBufs)); +#ifdef VERSION_SH + osCreateMesgQueue(&gUnkQueue1, gUnkMesgBufs1, 0x10); + osCreateMesgQueue(&gUnkQueue2, gUnkMesgBufs2, 0x10); +#endif gCurrAudioFrameDmaCount = 0; gSampleDmaNumListItems = 0; @@ -989,10 +1875,18 @@ void audio_init() { bzero(&gAiBuffers, sizeof(gAiBuffers)); for (i = 0; i < NUMAIBUFFERS; i++) { +#ifdef VERSION_SH + gAiBuffers[i] = sound_alloc_uninitialized(&gAudioInitPool, AIBUFFER_LEN); +#else gAiBuffers[i] = soundAlloc(&gAudioInitPool, AIBUFFER_LEN); +#endif + + for (j = 0; j < (s32) (AIBUFFER_LEN / sizeof(s16)); j++) { + gAiBuffers[i][j] = 0; + } } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) gAudioResetPresetIdToLoad = 0; gAudioResetStatus = 1; audio_shut_down_and_reset_step(); @@ -1006,11 +1900,35 @@ void audio_init() { eu_stubbed_printf_0("Main Heap Initialize.\n"); // Load header for sequence data (assets/music_data.sbk.s) +#ifdef VERSION_SH + gSeqFileHeader = (ALSeqFile *) gShindouSequencesHeader; + gAlCtlHeader = (ALSeqFile *) gShindouSoundBanksHeader; + gAlTbl = (ALSeqFile *) gShindouSampleBanksHeader; + gAlBankSets = gBankSetsData; + gSequenceCount = (s16) gSeqFileHeader->seqCount; + patch_seq_file(gSeqFileHeader, gMusicData, D_SH_80315EF4); + patch_seq_file(gAlCtlHeader, gSoundDataADSR, D_SH_80315EF8); + patch_seq_file(gAlTbl, gSoundDataRaw, D_SH_80315EFC); + seqCount = gAlCtlHeader->seqCount; + gCtlEntries = sound_alloc_uninitialized(&gAudioInitPool, seqCount * sizeof(struct CtlEntry)); + for (i = 0; i < seqCount; i++) { + gCtlEntries[i].bankId1 = (u8) ((gAlCtlHeader->seqArray[i].ctl.as_s16.bankAndFf >> 8) & 0xff); + gCtlEntries[i].bankId2 = (u8) (gAlCtlHeader->seqArray[i].ctl.as_s16.bankAndFf & 0xff); + gCtlEntries[i].numInstruments = (u8) ((gAlCtlHeader->seqArray[i].ctl.as_s16.numInstrumentsAndDrums >> 8) & 0xff); + gCtlEntries[i].numDrums = (u8) (gAlCtlHeader->seqArray[i].ctl.as_s16.numInstrumentsAndDrums & 0xff); + } + data = sound_alloc_uninitialized(&gAudioInitPool, D_SH_80315EF0); + if (data == NULL) { + D_SH_80315EF0 = 0; + } + sound_alloc_pool_init(&gUnkPool1.pool, data, D_SH_80315EF0); + init_sequence_players(); +#else gSeqFileHeader = (ALSeqFile *) buf; data = LOAD_DATA(gMusicData); audio_dma_copy_immediate((uintptr_t) data, gSeqFileHeader, 0x10); gSequenceCount = gSeqFileHeader->seqCount; -#ifdef VERSION_EU +#if defined(VERSION_EU) size = gSequenceCount * sizeof(ALSeqData) + 4; size = ALIGN16(size); #else @@ -1049,7 +1967,6 @@ void audio_init() { init_sequence_players(); gAudioLoadLock = AUDIO_LOCK_NOT_LOADING; - // Should probably contain the sizes of the data banks, but those aren't // easily accessible from here. eu_stubbed_printf_0("---------- Init Completed. ------------\n"); @@ -1057,4 +1974,539 @@ void audio_init() { eu_stubbed_printf_1(" Seqdrv :[%6d]\n", 0); // gMusicData eu_stubbed_printf_1(" audiodata :[%6d]\n", 0); // gSoundDataRaw eu_stubbed_printf_0("---------------------------------------\n"); +#endif } + +#if defined(VERSION_SH) +s32 func_802f47c8(s32 bankId, u8 idx, s8 *io) { + struct AudioBankSample *sample = func_sh_802f4978(bankId, idx); + struct PendingDmaSample *temp; + if (sample == NULL) { + *io = 0; + return -1; + } + if (sample->medium == 0) { + *io = 2; + return 0; + } + temp = &D_SH_80343D00.arr[D_SH_80343D00.someIndex]; + if (temp->state == 3) { + temp->state = 0; + } + temp->sample = *sample; + temp->io = io; + temp->vAddr = func_sh_802f1d40(sample->size, bankId, sample->sampleAddr, sample->medium); + if (temp->vAddr == NULL) { + if (sample->medium == 1 || sample->codec == 2) { + *io = 0; + return -1; + } else { + *io = 3; + return -1; + } + } + temp->state = 1; + temp->remaining = ALIGN16(sample->size); + temp->resultSampleAddr = (u8 *) temp->vAddr; + temp->devAddr = (uintptr_t) sample->sampleAddr; + temp->medium = sample->medium; + temp->bankId = bankId; + temp->idx = idx; + D_SH_80343D00.someIndex ^= 1; + return 0; +} + +struct AudioBankSample *func_sh_802f4978(s32 bankId, s32 idx) { + struct Drum *drum; + struct Instrument *inst; + struct AudioBankSample *ret; + + if (idx < 128) { + inst = get_instrument_inner(bankId, idx); + if (inst == 0) { + return NULL; + } + ret = inst->normalNotesSound.sample; + } else { + drum = get_drum(bankId, idx - 128); + if (drum == 0) { + return NULL; + } + ret = drum->sound.sample; + } + return ret; +} +void stub_sh_802f49dc(void) { + +} + +void func_sh_802f49e4(struct PendingDmaSample *arg0) { + struct AudioBankSample *sample = func_sh_802f4978(arg0->bankId, arg0->idx); + if (sample != NULL) { + arg0->sample = *sample; + sample->sampleAddr = arg0->resultSampleAddr; + sample->medium = 0; + } +} + +void func_sh_802f4a4c(s32 audioResetStatus) { + ALSeqFile *alTbl; + struct PendingDmaSample *entry; + + s32 i; + + alTbl = gAlTbl; + + for (i = 0; i < 2; i++) { + entry = &D_SH_80343D00.arr[i]; + switch (entry->state) { + case 2: + osRecvMesg(&entry->queue, NULL, 1); + if (audioResetStatus != 0) { + entry->state = 3; + break; + } + // fallthrough + case 1: + entry->state = 2; + if (entry->remaining == 0) { + func_sh_802f49e4(entry); + entry->state = 3; + *entry->io = 1; + } else if (entry->remaining < 0x1000) { + if (1 == entry->medium) { + func_sh_802f4c5c(entry->devAddr, entry->vAddr, entry->remaining, alTbl->unk2); + } else { + func_sh_802f4bd8(entry, entry->remaining); + } + entry->remaining = 0; + } else { + if (1 == entry->medium) { + func_sh_802f4c5c(entry->devAddr, entry->vAddr, 0x1000, alTbl->unk2); + } else { + func_sh_802f4bd8(entry, 0x1000); + } + entry->remaining = (s32) (entry->remaining - 0x1000); + entry->vAddr = (u8 *) entry->vAddr + 0x1000; + entry->devAddr = entry->devAddr + 0x1000; + } + break; + } + } +} + +extern char shindouDebugPrint102[]; +void func_sh_802f4bd8(struct PendingDmaSample *arg0, s32 len) { // len must be signed + osInvalDCache(arg0->vAddr, len); + osCreateMesgQueue(&arg0->queue, arg0->mesgs, 1); + func_sh_802f3dd0(&arg0->ioMesg, 0, 0, arg0->devAddr, arg0->vAddr, len, &arg0->queue, arg0->medium, shindouDebugPrint102); +} + +void func_sh_802f4c5c(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 arg3) { + uintptr_t sp1C; + + sp1C = devAddr; + osInvalDCache(vAddr, nbytes); + func_sh_802f3ed4(func_sh_802f3ec4(arg3, &sp1C), sp1C, vAddr, nbytes); +} + +struct PendingDmaAudioBank *func_sh_802f4cb4(uintptr_t devAddr, void *vAddr, s32 size, s32 medium, s32 numChunks, OSMesgQueue *retQueue, s32 encodedInfo) { + struct PendingDmaAudioBank *item; + s32 i; + + for (i = 0; i < ARRAY_COUNT(D_SH_8034F690); i++) { + if (D_SH_8034F690[i].inProgress == 0) { + item = &D_SH_8034F690[i]; + break; + } + } + if (i == ARRAY_COUNT(D_SH_8034F690)) { + return NULL; + } + + item->inProgress = 1; + item->devAddr = devAddr; + item->audioBank = vAddr; + item->vAddr = vAddr; + item->remaining = size; + if (numChunks == 0) { + item->transferSize = 0x1000; + } else { + item->transferSize = ((size / numChunks) + 0xFF) & ~0xFF; + if (item->transferSize < 0x100) { + item->transferSize = 0x100; + } + } + item->retQueue = retQueue; + item->timer = 3; + item->medium = medium; + item->encodedInfo = encodedInfo; + osCreateMesgQueue(&item->dmaRetQueue, item->mesgs, 1); + return item; +} + +void func_sh_802f4dcc(s32 audioResetStatus) { + s32 i; + + if (gAudioLoadLockSH != 1) { + for (i = 0; i < ARRAY_COUNT(D_SH_8034F690); i++) { + if (D_SH_8034F690[i].inProgress == 1) { + func_sh_802f4e50(&D_SH_8034F690[i], audioResetStatus); + } + } + } +} + +#ifndef NON_MATCHING +GLOBAL_ASM("asm/non_matchings/sh/audio/load/func_sh_802f4e50.s") +#else +void func_sh_802f4e50(struct PendingDmaAudioBank *arg0, u32 arg1) { + ALSeqFile *sp5C; + s32 temp_a0; + s32 sp44; + s32 id; + struct PatchStruct sp2C; + u8 t0; + u32 sp24; + + sp5C = gAlTbl; + if (arg0->timer >= 2) { + arg0->timer = arg0->timer - 1; + return; + } + if (arg0->timer == 1) { + arg0->timer = 0; + } else { + if (arg1 != 0) { + osRecvMesg(&arg0->dmaRetQueue, NULL, OS_MESG_BLOCK); + arg0->inProgress = 0; + return; + } + if (osRecvMesg(&arg0->dmaRetQueue, NULL, OS_MESG_NOBLOCK) == -1) { + return; + } + } + sp24 = arg0->remaining; + if (sp24 == 0) { + arg1 = arg0->encodedInfo; + sp24 = (arg1 >> 8) & 0xff; + t0 = (arg0->encodedInfo) >> 0x10; + switch (t0) { + case 0: + if (gSeqLoadStatus[sp24] != 5) { + gSeqLoadStatus[sp24] = (arg0->encodedInfo) & 0xff; + } + break; + case 2: + if (gUnkLoadStatus[sp24] != 5) { + gUnkLoadStatus[sp24] = (arg0->encodedInfo) & 0xff; + } + break; + case 1: + if (gBankLoadStatus[sp24] != 5) { + gBankLoadStatus[sp24] = (arg0->encodedInfo) & 0xff; + } + temp_a0 = gCtlEntries[sp24].bankId1; + sp44 = gCtlEntries[sp24].bankId2; + sp2C.bankId1 = temp_a0; + sp2C.bankId2 = sp44; + if (temp_a0 != 0xFF) { + sp2C.baseAddr1 = func_sh_802f3598(temp_a0, &sp2C.medium1); + } else { + sp2C.baseAddr1 = NULL; + } + if (sp44 != 0xFF) { + sp2C.baseAddr2 = func_sh_802f3598(sp44, &sp2C.medium2); + } else { + sp2C.baseAddr2 = NULL; + } + func_sh_802f5310(sp24, arg0->audioBank, &sp2C, 1); + break; + + } + arg1 = arg0->encodedInfo; + arg0->inProgress = 0; + osSendMesg(arg0->retQueue, (OSMesg) arg1, 0); + } else { + sp24 = arg0->remaining; + if (sp24 < arg0->transferSize) { + if (1 == arg0->medium) { + func_sh_802f517c(arg0->devAddr, arg0->vAddr, sp24, sp5C->unk2); + } else { + func_sh_802f50ec(arg0, sp24); + } + arg0->remaining = 0; + } else { + if (1 == arg0->medium) { + func_sh_802f517c(arg0->devAddr, arg0->vAddr, arg0->transferSize, sp5C->unk2); + } else { + func_sh_802f50ec(arg0, arg0->transferSize); + } + + arg0->remaining = arg0->remaining - arg0->transferSize; + arg0->devAddr = arg0->devAddr + arg0->transferSize; + arg0->vAddr = ((u8 *) arg0->vAddr) + arg0->transferSize; + } + } +} +#endif + +extern char shindouDebugPrint110[]; +void func_sh_802f50ec(struct PendingDmaAudioBank *arg0, size_t len) { + len += 0xf; + len &= ~0xf; + osInvalDCache(arg0->vAddr, len); + osCreateMesgQueue(&arg0->dmaRetQueue, arg0->mesgs, 1); + func_sh_802f3dd0(&arg0->ioMesg, 0, 0, arg0->devAddr, arg0->vAddr, len, &arg0->dmaRetQueue, arg0->medium, shindouDebugPrint110); +} + + +void func_sh_802f517c(uintptr_t devAddr, void *vAddr, size_t nbytes, s32 arg3) { + uintptr_t sp1C; + + sp1C = devAddr; + osInvalDCache(vAddr, nbytes); + func_sh_802f3ed4(func_sh_802f3ec4(arg3, &sp1C), sp1C, vAddr, nbytes); +} + +void func_sh_802f51d4(struct AudioBankSound *sound, struct AudioBank *memBase, struct PatchStruct *patchInfo) { + struct AudioBankSample *sample; + void *patched; + +#define PATCH(x, base) (patched = (void *)((uintptr_t) (x) + (uintptr_t) base)) + + if ((uintptr_t) sound->sample <= 0x80000000) { + sample = sound->sample = PATCH(sound->sample, memBase); + if (sample->size != 0 && sample->isPatched != TRUE) { + sample->loop = PATCH(sample->loop, memBase); + sample->book = PATCH(sample->book, memBase); + switch (sample->medium) { + case 0: + sample->sampleAddr = PATCH(sample->sampleAddr, patchInfo->baseAddr1); + sample->medium = patchInfo->medium1; + break; + case 1: + sample->sampleAddr = PATCH(sample->sampleAddr, patchInfo->baseAddr2); + sample->medium = patchInfo->medium2; + break; + + case 2: + case 3: + break; + } + sample->isPatched = TRUE; + if (sample->bit1 && sample->medium != 0) { + D_SH_8034EA88[D_SH_8034F688++] = sample; + } + } + } +#undef PATCH +} + +s32 func_sh_802f5310(s32 bankId, struct AudioBank *mem, struct PatchStruct *patchInfo, s32 arg3) { + UNUSED u32 pad[2]; + u8 *addr; + UNUSED u32 pad1[3]; + s32 sp4C; + struct AudioBankSample *temp_s0; + s32 i; + s32 count; + s32 temp; + + sp4C = 0; + if (D_SH_8034F68C != 0) { + sp4C = 1; + } else { + D_SH_80343CF0 = 0; + } + D_SH_8034F688 = 0; + patch_audio_bank(bankId, mem, patchInfo); + + count = 0; + for (i = 0; i < D_SH_8034F688; i++) { + count += ALIGN16(D_SH_8034EA88[i]->size); + } + + for (i = 0; i < D_SH_8034F688; i++) { + if (D_SH_8034F68C != 0x78) { + temp_s0 = D_SH_8034EA88[i]; + switch (arg3) { + case 0: + temp = temp_s0->medium = patchInfo->medium1; + if (temp != 0) { + if (temp_s0->size) { + } + addr = func_sh_802f1d90(temp_s0->size, patchInfo->bankId1, temp_s0->sampleAddr, temp_s0->medium); + } else { + temp = temp_s0->medium = patchInfo->medium2; + if (temp != 0) { + addr = func_sh_802f1d90(temp_s0->size, patchInfo->bankId2, temp_s0->sampleAddr, temp_s0->medium); + } + } + break; + + case 1: + temp = temp_s0->medium = patchInfo->medium1; + if (temp != 0) { + addr = func_sh_802f1d40(temp_s0->size, patchInfo->bankId1, temp_s0->sampleAddr, temp_s0->medium); + } else { + temp = temp_s0->medium = patchInfo->medium2; + if (temp != 0) { + addr = func_sh_802f1d40(temp_s0->size, patchInfo->bankId2, temp_s0->sampleAddr, temp_s0->medium); + } + } + break; + } + switch ((uintptr_t) addr) { + case 0: + break; + default: + switch (arg3) { + case 0: + if (temp_s0->medium == 1) { + func_sh_802f3d78((uintptr_t) temp_s0->sampleAddr, addr, temp_s0->size, gAlTbl->unk2); + temp_s0->sampleAddr = addr; + temp_s0->medium = 0; + } else { + func_sh_802f3c38((uintptr_t) temp_s0->sampleAddr, addr, temp_s0->size, temp_s0->medium); + temp_s0->sampleAddr = addr; + temp_s0->medium = 0; + } + break; + + case 1: + D_SH_8034EC88[D_SH_8034F68C].sample = temp_s0; + D_SH_8034EC88[D_SH_8034F68C].ramAddr = addr; + D_SH_8034EC88[D_SH_8034F68C].encodedInfo = (D_SH_8034F68C << 24) | 0xffffff; + D_SH_8034EC88[D_SH_8034F68C].isFree = FALSE; + D_SH_8034EC88[D_SH_8034F68C].endAndMediumIdentification = temp_s0->sampleAddr + temp_s0->size + temp_s0->medium; + D_SH_8034F68C++; + break; + } + } + continue; + } + break; + } + + D_SH_8034F688 = 0; + if (D_SH_8034F68C != 0 && sp4C == 0) { + temp_s0 = D_SH_8034EC88[D_SH_8034F68C - 1].sample; + temp = (temp_s0->size >> 12); + temp += 1; + count = (uintptr_t) temp_s0->sampleAddr; + func_sh_802f4cb4( + count, + D_SH_8034EC88[D_SH_8034F68C - 1].ramAddr, + temp_s0->size, + temp_s0->medium, + temp, + &gUnkQueue2, + D_SH_8034EC88[D_SH_8034F68C - 1].encodedInfo); + } +} + +s32 func_sh_802f573c(s32 audioResetStatus) { + struct AudioBankSample *sample; + u32 idx; + u8 *sampleAddr; + u32 size; + s32 unk; + u8 *added; + + if (D_SH_8034F68C > 0) { + if (audioResetStatus != 0) { + if (osRecvMesg(&gUnkQueue2, (OSMesg *) &idx, OS_MESG_NOBLOCK)){ + } + D_SH_8034F68C = 0; + return 0; + } + if (osRecvMesg(&gUnkQueue2, (OSMesg *) &idx, OS_MESG_NOBLOCK) == -1) { + return 0; + } + idx >>= 0x18; + if (D_SH_8034EC88[idx].isFree == FALSE) { + sample = D_SH_8034EC88[idx].sample; + added = (sample->sampleAddr + sample->size + sample->medium); + if (added == D_SH_8034EC88[idx].endAndMediumIdentification) { + sample->sampleAddr = D_SH_8034EC88[idx].ramAddr; + sample->medium = 0; + } + D_SH_8034EC88[idx].isFree = TRUE; + } + + next: + if (D_SH_8034F68C > 0) { + if (D_SH_8034EC88[D_SH_8034F68C - 1].isFree == TRUE) { + D_SH_8034F68C--; + goto next; + } + sample = D_SH_8034EC88[D_SH_8034F68C - 1].sample; + sampleAddr = sample->sampleAddr; + size = sample->size; + unk = size >> 0xC; + unk += 1; + added = ((sampleAddr + size) + sample->medium); + if (added != D_SH_8034EC88[D_SH_8034F68C - 1].endAndMediumIdentification) { + D_SH_8034EC88[D_SH_8034F68C - 1].isFree = TRUE; + D_SH_8034F68C--; + goto next; + } + size = sample->size; + func_sh_802f4cb4(sampleAddr, D_SH_8034EC88[D_SH_8034F68C - 1].ramAddr, size, sample->medium, + unk, &gUnkQueue2, D_SH_8034EC88[D_SH_8034F68C - 1].encodedInfo); + } + } + return 1; +} + +s32 func_sh_802f5900(struct AudioBankSample *sample, s32 numLoaded, struct AudioBankSample *arg2[]) { + s32 i; + + for (i = 0; i < numLoaded; i++) { + if (sample->sampleAddr == arg2[i]->sampleAddr) { + break; + } + } + if (i == numLoaded) { + arg2[numLoaded++] = sample; + } + return numLoaded; +} + +s32 func_sh_802f5948(s32 bankId, struct AudioBankSample *list[]) { + s32 i; + struct Drum *drum; + struct Instrument *inst; + s32 numLoaded; + s32 numDrums; + s32 numInstruments; + + numLoaded = 0; + numDrums = gCtlEntries[bankId].numDrums; + numInstruments = gCtlEntries[bankId].numInstruments; + + for (i = 0; i < numDrums; i++) { + drum = get_drum(bankId, i); + if (drum == NULL) { + continue; + } + numLoaded = func_sh_802f5900(drum->sound.sample, numLoaded, list); + } + for (i = 0; i < numInstruments; i++) { + inst = get_instrument_inner(bankId, i); + if (inst == NULL) { + continue; + + } + if (inst->normalRangeLo != 0) { + numLoaded = func_sh_802f5900(inst->lowNotesSound.sample, numLoaded, list); + } + if (inst->normalRangeHi != 127) { + numLoaded = func_sh_802f5900(inst->highNotesSound.sample, numLoaded, list); + } + numLoaded = func_sh_802f5900(inst->normalNotesSound.sample, numLoaded, list); + } + return numLoaded; +} +#endif diff --git a/src/audio/load.h b/src/audio/load.h index d87a6987..7aef6b56 100644 --- a/src/audio/load.h +++ b/src/audio/load.h @@ -30,16 +30,21 @@ extern struct NotePool gNoteFreeLists; extern OSMesgQueue gCurrAudioFrameDmaQueue; extern u32 gSampleDmaNumListItems; +extern ALSeqFile *gAlCtlHeader; extern ALSeqFile *gAlTbl; extern ALSeqFile *gSeqFileHeader; extern u8 *gAlBankSets; extern struct CtlEntry *gCtlEntries; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) extern struct AudioBufferParametersEU gAudioBufferParameters; #endif extern s32 gAiFrequency; extern u32 sDmaBufSize; +#ifdef VERSION_SH +extern s16 gCurrAiBufferLength; +extern s32 D_SH_8034F68C; +#endif extern s32 gMaxAudioCmds; extern s32 gMaxSimultaneousNotes; @@ -49,12 +54,55 @@ extern s16 gTempoInternalToExternal; extern s8 gAudioUpdatesPerFrame; // = 4 extern s8 gSoundMode; +#ifdef VERSION_SH +extern OSMesgQueue gUnkQueue1; + +struct UnkStructSH8034EC88 { + u8 *endAndMediumIdentification; + struct AudioBankSample *sample; + u8 *ramAddr; + u32 encodedInfo; + s32 isFree; +}; + +struct PatchStruct { + s32 bankId1; + s32 bankId2; + void *baseAddr1; + void *baseAddr2; + s32 medium1; + s32 medium2; +}; + +extern struct UnkStructSH8034EC88 D_SH_8034EC88[0x80]; +#endif + void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg); void decrease_sample_dma_ttls(void); -void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3); +#ifdef VERSION_SH +void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef, s32 medium); +#else +void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef); +#endif void init_sample_dma_buffers(s32 arg0); +#if defined(VERSION_SH) +void patch_audio_bank(s32 bankId, struct AudioBank *mem, struct PatchStruct *patchInfo); +#else void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums); +#endif +#ifndef VERSION_SH void preload_sequence(u32 seqId, u8 preloadMask); +#endif void load_sequence(u32 player, u32 seqId, s32 loadAsync); +#ifdef VERSION_SH +void func_sh_802f3158(s32 index, s32 arg1, s32 arg2, OSMesgQueue *retQueue); +u8 *func_sh_802f3220(u32 index, u32 *a1); +struct AudioBankSample *func_sh_802f4978(s32 bankId, s32 idx); +void *func_802f3f08(s32 poolIdx, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue *retQueue); +s32 func_sh_802f3368(s32 arg0); +void *func_sh_802f3764(s32 arg0, s32 idx, s32 *arg2); + +#endif + #endif // AUDIO_LOAD_H diff --git a/src/audio/playback.c b/src/audio/playback.c index afb62305..5d179740 100644 --- a/src/audio/playback.c +++ b/src/audio/playback.c @@ -9,21 +9,54 @@ #include "effects.h" #include "external.h" -#ifdef VERSION_EU -void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb) { +void note_set_resampling_rate(struct Note *note, f32 resamplingRateInput); + +#if defined(VERSION_EU) || defined(VERSION_SH) +#ifdef VERSION_SH +void note_set_vel_pan_reverb(struct Note *note, struct ReverbInfo *reverbInfo) +#else +void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb) +#endif +{ struct NoteSubEu *sub = ¬e->noteSubEu; f32 volRight, volLeft; + u8 strongRight; + u8 strongLeft; + s32 smallPanIndex; +#ifdef VERSION_EU u16 unkMask = ~0x80; +#else + UNUSED u32 pad; + UNUSED u32 pad1; + f32 velocity; + u8 pan; + u8 reverb; + struct ReverbBitsData reverbBits; +#endif +#ifdef VERSION_SH + note_set_resampling_rate(note, reverbInfo->freqScale); + velocity = reverbInfo->velocity; + pan = reverbInfo->pan; + reverb = reverbInfo->reverb; + reverbBits = reverbInfo->reverbBits.s; + pan &= 0x7f; +#else pan &= unkMask; - if (sub->stereoHeadsetEffects && gSoundMode == SOUND_MODE_HEADSET) { - s32 smallPanIndex = pan >> 3; - if (smallPanIndex > 0xf) { - smallPanIndex = 0xf; +#endif + + if (note->noteSubEu.stereoHeadsetEffects && gSoundMode == SOUND_MODE_HEADSET) { +#ifdef VERSION_SH + smallPanIndex = pan >> 1; +#else + smallPanIndex = pan >> 3; +#endif + if (smallPanIndex >= ARRAY_COUNT(gHeadsetPanQuantization)) { + smallPanIndex = ARRAY_COUNT(gHeadsetPanQuantization) - 1; } sub->headsetPanLeft = gHeadsetPanQuantization[smallPanIndex]; - sub->headsetPanRight = gHeadsetPanQuantization[15 - smallPanIndex]; + sub->headsetPanRight = gHeadsetPanQuantization[ARRAY_COUNT(gHeadsetPanQuantization) - 1 - smallPanIndex]; sub->stereoStrongRight = FALSE; sub->stereoStrongLeft = FALSE; sub->usesHeadsetPanEffects = TRUE; @@ -31,10 +64,18 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb) volLeft = gHeadsetPanVolume[pan]; volRight = gHeadsetPanVolume[127 - pan]; } else if (sub->stereoHeadsetEffects && gSoundMode == SOUND_MODE_STEREO) { - u8 strongLeft = FALSE; - u8 strongRight = FALSE; +#ifdef VERSION_SH + strongRight = FALSE; + strongLeft = FALSE; + sub->headsetPanRight = 0; + sub->headsetPanLeft = 0; +#else + strongLeft = FALSE; + strongRight = FALSE; sub->headsetPanLeft = 0; sub->headsetPanRight = 0; +#endif + sub->usesHeadsetPanEffects = FALSE; volLeft = gStereoPanVolume[pan]; @@ -47,6 +88,28 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb) sub->stereoStrongRight = strongRight; sub->stereoStrongLeft = strongLeft; + +#ifdef VERSION_SH + switch (reverbBits.stereoHeadsetEffects) { + case 0: + sub->stereoStrongRight = reverbBits.strongRight; + sub->stereoStrongLeft = reverbBits.strongLeft; + break; + + case 1: + break; + + case 2: + sub->stereoStrongRight = reverbBits.strongRight | strongRight; + sub->stereoStrongLeft = reverbBits.strongLeft | strongLeft; + break; + + case 3: + sub->stereoStrongRight = reverbBits.strongRight ^ strongRight; + sub->stereoStrongLeft = reverbBits.strongLeft ^ strongLeft; + break; + } +#endif } else if (gSoundMode == SOUND_MODE_MONO) { volLeft = 0.707f; volRight = 0.707f; @@ -55,6 +118,19 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb) volRight = gDefaultPanVolume[127 - pan]; } +#ifdef VERSION_SH +if (velocity < 0.0f) { + velocity = 0.0f; + } + if (velocity > 1.0f) { + velocity = 1.0f; + } + + sub->targetVolLeft = ((s32) (velocity * volLeft * 4095.999f)); + sub->targetVolRight = ((s32) (velocity * volRight * 4095.999f)); + sub->bankId = reverbInfo->bankId; + sub->filter = reverbInfo->filter; +#else if (velocity < 0.0f) { stubbed_printf("Audio: setvol: volume minus %f\n", velocity); velocity = 0.0f; @@ -66,9 +142,14 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb) sub->targetVolLeft = ((s32) (velocity * volLeft) & 0xffff) >> 5; sub->targetVolRight = ((s32) (velocity * volRight) & 0xffff) >> 5; +#endif if (sub->reverbVol != reverb) { +#ifdef VERSION_SH + sub->reverbVol = reverb >> 1; +#else sub->reverbVol = reverb; +#endif sub->envMixerNeedsInit = TRUE; return; } @@ -80,27 +161,35 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb) } } +#ifdef VERSION_SH +#define MIN_RESAMPLING_RATE 1.99998f +#else +#define MIN_RESAMPLING_RATE 1.99996f +#endif + void note_set_resampling_rate(struct Note *note, f32 resamplingRateInput) { f32 resamplingRate = 0.0f; struct NoteSubEu *tempSub = ¬e->noteSubEu; +#ifdef VERSION_EU if (resamplingRateInput < 0.0f) { stubbed_printf("Audio: setpitch: pitch minus %f\n", resamplingRateInput); resamplingRateInput = 0.0f; } +#endif if (resamplingRateInput < 2.0f) { tempSub->hasTwoAdpcmParts = 0; - if (1.99996f < resamplingRateInput) { - resamplingRate = 1.99996f; + if (MIN_RESAMPLING_RATE < resamplingRateInput) { + resamplingRate = MIN_RESAMPLING_RATE; } else { resamplingRate = resamplingRateInput; } } else { tempSub->hasTwoAdpcmParts = 1; - if (3.99992f < resamplingRateInput) { - resamplingRate = 1.99996f; + if (2 * MIN_RESAMPLING_RATE < resamplingRateInput) { + resamplingRate = MIN_RESAMPLING_RATE; } else { resamplingRate = resamplingRateInput * 0.5f; } @@ -108,6 +197,7 @@ void note_set_resampling_rate(struct Note *note, f32 resamplingRateInput) { note->noteSubEu.resamplingRateFixedPoint = (s32) (resamplingRate * 32768.0f); } +#ifdef VERSION_EU struct AudioBankSound *instrument_get_audio_bank_sound(struct Instrument *instrument, s32 semitone) { struct AudioBankSound *sound; if (semitone < instrument->normalRangeLo) { @@ -143,6 +233,7 @@ struct Instrument *get_instrument_inner(s32 bankId, s32 instId) { return inst; } +#ifdef VERSION_EU if (((uintptr_t) gBankLoadedPool.persistent.pool.start <= (uintptr_t) inst && (uintptr_t) inst <= (uintptr_t)(gBankLoadedPool.persistent.pool.start + gBankLoadedPool.persistent.pool.size)) @@ -155,16 +246,29 @@ struct Instrument *get_instrument_inner(s32 bankId, s32 instId) { stubbed_printf("Audio: voiceman: BAD Voicepointer %x,%d,%d\n", inst, bankId, instId); gAudioErrorFlags = ((bankId << 8) + instId) + 0x2000000; return NULL; +#else + return inst; +#endif } struct Drum *get_drum(s32 bankId, s32 drumId) { struct Drum *drum; + +#ifdef VERSION_SH + if (IS_BANK_LOAD_COMPLETE(bankId) == FALSE) { + stubbed_printf("Audio: voiceman: No bank error %d\n", bankId); + gAudioErrorFlags = bankId + 0x10000000; + return NULL; + } +#endif + if (drumId >= gCtlEntries[bankId].numDrums) { stubbed_printf("Audio: voiceman: Percussion Overflow %d,%d\n", drumId, gCtlEntries[bankId].numDrums); gAudioErrorFlags = ((bankId << 8) + drumId) + 0x4000000; return NULL; } + drum = gCtlEntries[bankId].drums[drumId]; if (drum == NULL) { stubbed_printf("Audio: voiceman: Percpointer NULL %d,%d\n", bankId, drumId); @@ -172,9 +276,10 @@ struct Drum *get_drum(s32 bankId, s32 drumId) { } return drum; } +#endif #endif // VERSION_EU -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) void note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLayer); #else s32 note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLayer); @@ -186,8 +291,11 @@ void note_init(struct Note *note) { } else { adsr_init(¬e->adsr, note->parentLayer->adsr.envelope, ¬e->adsrVolScale); } +#ifdef VERSION_SH + note->unkSH34 = 0; +#endif note->adsr.state = ADSR_STATE_INITIAL; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) note->noteSubEu = gDefaultNoteSub; #else note_init_volume(note); @@ -195,49 +303,66 @@ void note_init(struct Note *note) { #endif } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) #define note_disable2 note_disable void note_disable(struct Note *note) { if (note->noteSubEu.needsInit == TRUE) { note->noteSubEu.needsInit = FALSE; - } else { + } +#ifdef VERSION_EU + else { note_set_vel_pan_reverb(note, 0, 0x40, 0); } +#endif note->priority = NOTE_PRIORITY_DISABLED; +#ifdef VERSION_SH + note->unkSH34 = 0; +#endif note->parentLayer = NO_LAYER; note->prevParentLayer = NO_LAYER; note->noteSubEu.enabled = FALSE; note->noteSubEu.finished = FALSE; +#ifdef VERSION_SH + note->adsr.state = ADSR_STATE_DISABLED; + note->adsr.current = 0; +#endif } #else void note_disable2(struct Note *note) { note_disable(note); } -#endif // VERSION_EU +#endif // VERSION_EU || VERSION_SH void process_notes(void) { f32 scale; +#ifndef VERSION_SH f32 frequency; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) u8 reverb; #endif f32 velocity; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) f32 pan; f32 cap; +#endif #endif struct Note *note; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) struct NotePlaybackState *playbackState; struct NoteSubEu *noteSubEu; +#ifndef VERSION_SH UNUSED u8 pad[12]; u8 reverb; UNUSED u8 pad3; u8 pan; +#else + u8 pad[8]; + struct ReverbInfo reverbInfo; +#endif u8 bookOffset; #endif struct NoteAttributes *attributes; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) struct AudioListItem *it; #endif s32 i; @@ -256,9 +381,41 @@ void process_notes(void) { for (i = 0; i < gMaxSimultaneousNotes; i++) { note = &gNotes[i]; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) playbackState = (struct NotePlaybackState *) ¬e->priority; if (note->parentLayer != NO_LAYER) { +#ifdef VERSION_SH + if (note != playbackState->parentLayer->note && playbackState->unkSH34 == 0) { + playbackState->adsr.action |= ADSR_ACTION_RELEASE; + playbackState->adsr.fadeOutVel = gAudioBufferParameters.updatesPerFrameInv; + playbackState->priority = 1; + playbackState->unkSH34 = 2; + goto d; + } else if (!playbackState->parentLayer->enabled && playbackState->unkSH34 == 0 && + playbackState->priority >= 1) { + // do nothing + } else if (playbackState->parentLayer->seqChannel->seqPlayer == NULL) { + sequence_channel_disable(playbackState->parentLayer->seqChannel); + playbackState->priority = 1; + playbackState->unkSH34 = 1; + continue; + } else if (playbackState->parentLayer->seqChannel->seqPlayer->muted && + (playbackState->parentLayer->seqChannel->muteBehavior + & (MUTE_BEHAVIOR_STOP_NOTES))) { + // do nothing + } else { + goto d; + } + + seq_channel_layer_note_release(playbackState->parentLayer); + audio_list_remove(¬e->listItem); + audio_list_push_front(¬e->listItem.pool->decaying, ¬e->listItem); + playbackState->priority = 1; + playbackState->unkSH34 = 2; + } else if (playbackState->unkSH34 == 0 && playbackState->priority >= 1) { + continue; + } +#else if (!playbackState->parentLayer->enabled && playbackState->priority >= NOTE_PRIORITY_MIN) { goto c; } else if (playbackState->parentLayer->seqChannel->seqPlayer == NULL) { @@ -283,10 +440,18 @@ void process_notes(void) { } else if (playbackState->priority >= NOTE_PRIORITY_MIN) { continue; } +#endif d: if (playbackState->priority != NOTE_PRIORITY_DISABLED) { +#ifdef VERSION_SH + if (1) {} +#endif noteSubEu = ¬e->noteSubEu; +#ifdef VERSION_SH + if (playbackState->unkSH34 >= 1 || noteSubEu->finished) { +#else if (playbackState->priority == NOTE_PRIORITY_STOPPING || noteSubEu->finished) { +#endif if (playbackState->adsr.state == ADSR_STATE_DISABLED || noteSubEu->finished) { if (playbackState->wantedParentLayer != NO_LAYER) { note_disable(note); @@ -312,8 +477,10 @@ void process_notes(void) { goto skip; } } +#ifndef VERSION_SH if (1) { } +#endif } else if (playbackState->adsr.state == ADSR_STATE_DISABLED) { note_disable(note); audio_list_remove(¬e->listItem); @@ -324,6 +491,37 @@ void process_notes(void) { scale = adsr_update(&playbackState->adsr); note_vibrato_update(note); attributes = &playbackState->attributes; +#ifdef VERSION_SH + if (playbackState->unkSH34 == 1 || playbackState->unkSH34 == 2) { + reverbInfo.freqScale = attributes->freqScale; + reverbInfo.velocity = attributes->velocity; + reverbInfo.pan = attributes->pan; + reverbInfo.reverb = attributes->reverb; + reverbInfo.reverbBits = attributes->reverbBits; + reverbInfo.bankId = attributes->unk1; + reverbInfo.filter = attributes->filter; + bookOffset = noteSubEu->bookOffset; + } else { + reverbInfo.freqScale = playbackState->parentLayer->noteFreqScale; + reverbInfo.velocity = playbackState->parentLayer->noteVelocity; + reverbInfo.pan = playbackState->parentLayer->notePan; + reverbInfo.reverbBits = playbackState->parentLayer->reverbBits; + reverbInfo.reverb = playbackState->parentLayer->seqChannel->reverb; + reverbInfo.bankId = playbackState->parentLayer->seqChannel->unkSH0C; + reverbInfo.filter = playbackState->parentLayer->seqChannel->filter; + bookOffset = playbackState->parentLayer->seqChannel->bookOffset & 0x7; + if (playbackState->parentLayer->seqChannel->seqPlayer->muted + && (playbackState->parentLayer->seqChannel->muteBehavior & 8)) { + reverbInfo.freqScale = 0.0f; + reverbInfo.velocity = 0.0f; + } + } + + reverbInfo.freqScale *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale; + reverbInfo.freqScale *= gAudioBufferParameters.resampleRate; + reverbInfo.velocity *= scale; + note_set_vel_pan_reverb(note, &reverbInfo); +#else if (playbackState->priority == NOTE_PRIORITY_STOPPING) { frequency = attributes->freqScale; velocity = attributes->velocity; @@ -345,6 +543,7 @@ void process_notes(void) { velocity = velocity * scale * scale; note_set_resampling_rate(note, frequency); note_set_vel_pan_reverb(note, velocity, pan, reverb); +#endif noteSubEu->bookOffset = bookOffset; skip:; } @@ -419,18 +618,88 @@ void process_notes(void) { #undef POP } +#if defined(VERSION_SH) +// These three are matching but have been moved from above in shindou: +struct AudioBankSound *instrument_get_audio_bank_sound(struct Instrument *instrument, s32 semitone) { + struct AudioBankSound *sound; + if (semitone < instrument->normalRangeLo) { + sound = &instrument->lowNotesSound; + } else if (semitone <= instrument->normalRangeHi) { + sound = &instrument->normalNotesSound; + } else { + sound = &instrument->highNotesSound; + } + return sound; +} +struct Instrument *get_instrument_inner(s32 bankId, s32 instId) { + struct Instrument *inst; + + if (IS_BANK_LOAD_COMPLETE(bankId) == FALSE) { + gAudioErrorFlags = bankId + 0x10000000; + return NULL; + } + + if (instId >= gCtlEntries[bankId].numInstruments) { + gAudioErrorFlags = ((bankId << 8) + instId) + 0x3000000; + return NULL; + } + + inst = gCtlEntries[bankId].instruments[instId]; + if (inst == NULL) { + gAudioErrorFlags = ((bankId << 8) + instId) + 0x1000000; + return inst; + } + + return inst; +} + +struct Drum *get_drum(s32 bankId, s32 drumId) { + struct Drum *drum; + + if (IS_BANK_LOAD_COMPLETE(bankId) == FALSE) { + gAudioErrorFlags = bankId + 0x10000000; + return NULL; + } + + if (drumId >= gCtlEntries[bankId].numDrums) { + gAudioErrorFlags = ((bankId << 8) + drumId) + 0x4000000; + return NULL; + } + +#ifndef NO_SEGMENTED_MEMORY + if ((uintptr_t) gCtlEntries[bankId].drums < 0x80000000U) { + return NULL; + } +#endif + + drum = gCtlEntries[bankId].drums[drumId]; + if (drum == NULL) { + gAudioErrorFlags = ((bankId << 8) + drumId) + 0x5000000; + } + return drum; +} +#endif + void seq_channel_layer_decay_release_internal(struct SequenceChannelLayer *seqLayer, s32 target) { struct Note *note; struct NoteAttributes *attributes; - if (seqLayer == NO_LAYER || seqLayer->note == NULL) { + if (seqLayer == NO_LAYER) { + return; + } + +#ifdef VERSION_SH + seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED; +#endif + + if (seqLayer->note == NULL) { return; } note = seqLayer->note; attributes = ¬e->attributes; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) if (seqLayer->seqChannel != NULL && seqLayer->seqChannel->noteAllocPolicy == 0) { seqLayer->note = NULL; } @@ -441,7 +710,8 @@ void seq_channel_layer_decay_release_internal(struct SequenceChannelLayer *seqLa } if (note->parentLayer != seqLayer) { -#ifdef VERSION_EU + +#if defined(VERSION_EU) || defined(VERSION_SH) if (note->parentLayer == NO_LAYER && note->wantedParentLayer == NO_LAYER && note->prevParentLayer == seqLayer && target != ADSR_STATE_DECAY) { // Just guessing that this printf goes here... it's hard to parse. @@ -453,27 +723,52 @@ void seq_channel_layer_decay_release_internal(struct SequenceChannelLayer *seqLa return; } +#ifndef VERSION_SH seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED; +#endif if (note->adsr.state != ADSR_STATE_DECAY) { attributes->freqScale = seqLayer->noteFreqScale; attributes->velocity = seqLayer->noteVelocity; attributes->pan = seqLayer->notePan; +#ifdef VERSION_SH + attributes->reverbBits = seqLayer->reverbBits; +#endif if (seqLayer->seqChannel != NULL) { attributes->reverb = seqLayer->seqChannel->reverb; +#ifdef VERSION_SH + attributes->unk1 = seqLayer->seqChannel->unkSH0C; + attributes->filter = seqLayer->seqChannel->filter; + if (seqLayer->seqChannel->seqPlayer->muted && (seqLayer->seqChannel->muteBehavior & 8) != 0) { + note->noteSubEu.finished = TRUE; + } + note->priority = seqLayer->seqChannel->unkSH06; +#endif } - note->priority = NOTE_PRIORITY_STOPPING; +#ifdef VERSION_SH + else { +#endif + note->priority = NOTE_PRIORITY_STOPPING; +#ifdef VERSION_SH + } +#endif note->prevParentLayer = note->parentLayer; note->parentLayer = NO_LAYER; if (target == ADSR_STATE_RELEASE) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) note->adsr.fadeOutVel = gAudioBufferParameters.updatesPerFrameInv; #else note->adsr.fadeOutVel = 0x8000 / gAudioUpdatesPerFrame; #endif note->adsr.action |= ADSR_ACTION_RELEASE; +#ifdef VERSION_SH + note->unkSH34 = 2; +#endif } else { +#ifdef VERSION_SH + note->unkSH34 = 1; +#endif note->adsr.action |= ADSR_ACTION_DECAY; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (seqLayer->adsr.releaseRate == 0) { note->adsr.fadeOutVel = seqLayer->seqChannel->adsr.releaseRate * gAudioBufferParameters.unkUpdatesPerFrameScaled; } else { @@ -505,15 +800,16 @@ void seq_channel_layer_note_release(struct SequenceChannelLayer *seqLayer) { seq_channel_layer_decay_release_internal(seqLayer, ADSR_STATE_RELEASE); } - -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s32 build_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLayer, s32 waveId) { f32 freqScale; f32 ratio; u8 sampleCountIndex; if (waveId < 128) { +#ifdef VERSION_EU stubbed_printf("Audio:Wavemem: Bad voiceno (%d)\n", waveId); +#endif waveId = 128; } @@ -601,7 +897,7 @@ void build_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLay #endif void init_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLayer) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s32 sampleCountIndex; s32 waveSampleCountIndex; s32 waveId = seqLayer->instOrWave; @@ -610,7 +906,11 @@ void init_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLaye } sampleCountIndex = note->sampleCountIndex; waveSampleCountIndex = build_synthetic_wave(note, seqLayer, waveId); +#if defined(VERSION_EU) || defined(VERSION_SH) note->synthesisState.samplePosInt = note->synthesisState.samplePosInt * euUnknownData_8030194c[waveSampleCountIndex] / euUnknownData_8030194c[sampleCountIndex]; +#else // Not a real change. Just temporary so I can remove this variable. + note->synthesisState.samplePosInt = note->synthesisState.samplePosInt * gDefaultShortNoteVelocityTable[waveSampleCountIndex] / gDefaultShortNoteVelocityTable[sampleCountIndex]; +#endif #else s32 sampleCount = note->sampleCount; build_synthetic_wave(note, seqLayer); @@ -680,7 +980,7 @@ void note_pool_clear(struct NotePool *pool) { break; } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) for (;;) { cur = source->next; if (cur == source) { @@ -795,7 +1095,7 @@ struct Note *pop_node_with_lower_prio(struct AudioListItem *list, s32 limit) { } } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (best == NULL) { return NULL; } @@ -809,11 +1109,13 @@ struct Note *pop_node_with_lower_prio(struct AudioListItem *list, s32 limit) { } #endif +#ifndef VERSION_SH audio_list_remove(best); +#endif return best->u.value; } -#if defined(VERSION_EU) +#if defined(VERSION_EU) || defined(VERSION_SH) void note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLayer) { UNUSED s32 pad[4]; s16 instId; @@ -844,7 +1146,11 @@ void note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLaye if (sub->isSyntheticWave) { build_synthetic_wave(note, seqLayer, instId); } +#ifdef VERSION_SH + note->unkSH33 = seqLayer->seqChannel->bankId; +#else sub->bankId = seqLayer->seqChannel->bankId; +#endif sub->stereoHeadsetEffects = seqLayer->seqChannel->stereoHeadsetEffects; sub->reverbIndex = seqLayer->seqChannel->reverbIndex & 3; } @@ -879,8 +1185,13 @@ void func_80319728(struct Note *note, struct SequenceChannelLayer *seqLayer) { void note_release_and_take_ownership(struct Note *note, struct SequenceChannelLayer *seqLayer) { note->wantedParentLayer = seqLayer; +#ifdef VERSION_SH + note->priority = seqLayer->seqChannel->notePriority; +#else note->priority = NOTE_PRIORITY_STOPPING; -#ifdef VERSION_EU +#endif + +#if defined(VERSION_EU) || defined(VERSION_SH) note->adsr.fadeOutVel = gAudioBufferParameters.updatesPerFrameInv; #else note->adsr.fadeOutVel = 0x8000 / gAudioUpdatesPerFrame; @@ -891,7 +1202,7 @@ void note_release_and_take_ownership(struct Note *note, struct SequenceChannelLa struct Note *alloc_note_from_disabled(struct NotePool *pool, struct SequenceChannelLayer *seqLayer) { struct Note *note = audio_list_pop_back(&pool->disabled); if (note != NULL) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) note_init_for_layer(note, seqLayer); #else if (note_init_for_layer(note, seqLayer) == TRUE) { @@ -914,15 +1225,52 @@ struct Note *alloc_note_from_decaying(struct NotePool *pool, struct SequenceChan } struct Note *alloc_note_from_active(struct NotePool *pool, struct SequenceChannelLayer *seqLayer) { - struct Note *note = - pop_node_with_lower_prio(&pool->active, seqLayer->seqChannel->notePriority); - if (note == NULL) { +#ifdef VERSION_SH + struct Note *rNote; +#endif + struct Note *aNote; +#ifdef VERSION_SH + s32 rPriority, aPriority; + rPriority = aPriority = 0x10; + + rNote = pop_node_with_lower_prio(&pool->releasing, seqLayer->seqChannel->notePriority); + + if (rNote != NULL) { + rPriority = rNote->priority; + } +#endif + + aNote = pop_node_with_lower_prio(&pool->active, seqLayer->seqChannel->notePriority); + + if (aNote == NULL) { eu_stubbed_printf_0("Audio: C-Alloc : lowerPrio is NULL\n"); } else { - func_80319728(note, seqLayer); - audio_list_push_back(&pool->releasing, ¬e->listItem); +#ifdef VERSION_SH + aPriority = aNote->priority; +#else + func_80319728(aNote, seqLayer); + audio_list_push_back(&pool->releasing, &aNote->listItem); +#endif } - return note; + +#ifdef VERSION_SH + if (rNote == NULL && aNote == NULL) { + return NULL; + } + + if (aPriority < rPriority) { + audio_list_remove(&aNote->listItem); + func_80319728(aNote, seqLayer); + audio_list_push_back(&pool->releasing, &aNote->listItem); + aNote->priority = seqLayer->seqChannel->notePriority; + return aNote; + } + rNote->wantedParentLayer = seqLayer; + rNote->priority = seqLayer->seqChannel->notePriority; + return rNote; +#else + return aNote; +#endif } struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) { @@ -932,13 +1280,13 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) { if (policy & NOTE_ALLOC_LAYER) { ret = seqLayer->note; if (ret != NULL && ret->prevParentLayer == seqLayer -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) && ret->wantedParentLayer == NO_LAYER #endif ) { note_release_and_take_ownership(ret, seqLayer); audio_list_remove(&ret->listItem); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) audio_list_push_back(&ret->listItem.pool->releasing, &ret->listItem); #else audio_list_push_back(&gNoteFreeLists.releasing, &ret->listItem); @@ -951,9 +1299,13 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) { if (!(ret = alloc_note_from_disabled(&seqLayer->seqChannel->notePool, seqLayer)) && !(ret = alloc_note_from_decaying(&seqLayer->seqChannel->notePool, seqLayer)) && !(ret = alloc_note_from_active(&seqLayer->seqChannel->notePool, seqLayer))) { +#ifdef VERSION_SH + goto null_return; +#else eu_stubbed_printf_0("Sub Limited Warning: Drop Voice"); seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED; return NULL; +#endif } return ret; } @@ -965,9 +1317,13 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) { && !(ret = alloc_note_from_decaying(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer)) && !(ret = alloc_note_from_active(&seqLayer->seqChannel->notePool, seqLayer)) && !(ret = alloc_note_from_active(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer))) { +#ifdef VERSION_SH + goto null_return; +#else eu_stubbed_printf_0("Warning: Drop Voice"); seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED; return NULL; +#endif } return ret; } @@ -976,9 +1332,13 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) { if (!(ret = alloc_note_from_disabled(&gNoteFreeLists, seqLayer)) && !(ret = alloc_note_from_decaying(&gNoteFreeLists, seqLayer)) && !(ret = alloc_note_from_active(&gNoteFreeLists, seqLayer))) { +#ifdef VERSION_SH + goto null_return; +#else eu_stubbed_printf_0("Warning: Drop Voice"); seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED; return NULL; +#endif } return ret; } @@ -992,14 +1352,24 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer) { && !(ret = alloc_note_from_active(&seqLayer->seqChannel->notePool, seqLayer)) && !(ret = alloc_note_from_active(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer)) && !(ret = alloc_note_from_active(&gNoteFreeLists, seqLayer))) { +#ifdef VERSION_SH + goto null_return; +#else eu_stubbed_printf_0("Warning: Drop Voice"); seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED; return NULL; +#endif } return ret; + +#ifdef VERSION_SH +null_return: + seqLayer->status = SOUND_LOAD_STATUS_NOT_LOADED; + return NULL; +#endif } -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) void reclaim_notes(void) { struct Note *note; s32 i; @@ -1044,7 +1414,7 @@ void note_init_all(void) { for (i = 0; i < gMaxSimultaneousNotes; i++) { note = &gNotes[i]; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) note->noteSubEu = gZeroNoteSub; #else note->enabled = FALSE; @@ -1053,10 +1423,13 @@ void note_init_all(void) { note->stereoHeadsetEffects = FALSE; #endif note->priority = NOTE_PRIORITY_DISABLED; +#ifdef VERSION_SH + note->unkSH34 = 0; +#endif note->parentLayer = NO_LAYER; note->wantedParentLayer = NO_LAYER; note->prevParentLayer = NO_LAYER; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) note->waveId = 0; #else note->reverb = 0; @@ -1075,7 +1448,9 @@ void note_init_all(void) { note->vibratoState.active = FALSE; note->portamento.cur = 0.0f; note->portamento.speed = 0.0f; -#ifdef VERSION_EU +#if defined(VERSION_SH) + note->synthesisState.synthesisBuffers = sound_alloc_uninitialized(&gNotesAndBuffersPool, sizeof(struct NoteSynthesisBuffers)); +#elif defined(VERSION_EU) note->synthesisState.synthesisBuffers = soundAlloc(&gNotesAndBuffersPool, sizeof(struct NoteSynthesisBuffers)); #else note->synthesisBuffers = soundAlloc(&gNotesAndBuffersPool, sizeof(struct NoteSynthesisBuffers)); diff --git a/src/audio/playback.h b/src/audio/playback.h index 9c73e6e3..d0eaf2ba 100644 --- a/src/audio/playback.h +++ b/src/audio/playback.h @@ -30,12 +30,17 @@ struct Note *alloc_note(struct SequenceChannelLayer *seqLayer); void reclaim_notes(void); void note_init_all(void); -#ifdef VERSION_EU +#if defined(VERSION_SH) +void note_set_vel_pan_reverb(struct Note *note, struct ReverbInfo *reverbInfo); +#elif defined(VERSION_EU) +void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb); +#endif + +#if defined(VERSION_EU) || defined(VERSION_SH) struct AudioBankSound *instrument_get_audio_bank_sound(struct Instrument *instrument, s32 semitone); struct Instrument *get_instrument_inner(s32 bankId, s32 instId); struct Drum *get_drum(s32 bankId, s32 drumId); void note_init_volume(struct Note *note); -void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb); void note_set_frequency(struct Note *note, f32 frequency); void note_enable(struct Note *note); void note_disable(struct Note *note); diff --git a/src/audio/port_eu.c b/src/audio/port_eu.c index 8f221dce..91c62028 100644 --- a/src/audio/port_eu.c +++ b/src/audio/port_eu.c @@ -28,7 +28,7 @@ extern OSMesgQueue *OSMesgQueues[]; extern struct EuAudioCmd sAudioCmd[0x100]; void func_8031D690(s32 player, FadeT fadeInTime); -void sequence_player_fade_out_internal(s32 player, FadeT fadeOutTime); +void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime); void port_eu_init_queues(void); void decrease_sample_dma_ttls(void); s32 audio_shut_down_and_reset_step(void); @@ -79,7 +79,7 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) { sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]); } else { - sequence_player_fade_out_internal(cmd->u.s.arg1, cmd->u2.as_s32); + seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32); } } break; @@ -114,13 +114,13 @@ extern OSMesg OSMesg1; extern OSMesg OSMesg2; extern OSMesg OSMesg3; -void sequence_player_fade_out_internal(s32 player, FadeT fadeOutTime) { +void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime) { if (fadeOutTime == 0) { fadeOutTime = 1; } gSequencePlayers[player].fadeVelocity = -(gSequencePlayers[player].fadeVolume / fadeOutTime); gSequencePlayers[player].state = 2; - gSequencePlayers[player].fadeTimer = fadeOutTime; + gSequencePlayers[player].fadeRemainingFrames = fadeOutTime; } @@ -128,7 +128,7 @@ void func_8031D690(s32 player, FadeT fadeInTime) { if (fadeInTime != 0) { gSequencePlayers[player].state = 1; gSequencePlayers[player].fadeTimerUnkEu = fadeInTime; - gSequencePlayers[player].fadeTimer = fadeInTime; + gSequencePlayers[player].fadeRemainingFrames = fadeInTime; gSequencePlayers[player].fadeVolume = 0.0f; gSequencePlayers[player].fadeVelocity = 0.0f; } diff --git a/src/audio/seqplayer.c b/src/audio/seqplayer.c index 794a3c52..2158d6e3 100644 --- a/src/audio/seqplayer.c +++ b/src/audio/seqplayer.c @@ -20,6 +20,13 @@ #define PORTAMENTO_MODE_4 4 #define PORTAMENTO_MODE_5 5 +#ifdef VERSION_SH +void seq_channel_layer_process_script_part1(struct SequenceChannelLayer *layer); +s32 seq_channel_layer_process_script_part2(struct SequenceChannelLayer *layer); +s32 seq_channel_layer_process_script_part3(struct SequenceChannelLayer *layer, s32 cmd); +s32 seq_channel_layer_process_script_part4(struct SequenceChannelLayer *layer, s32 cmd); +s32 seq_channel_layer_process_script_part5(struct SequenceChannelLayer *layer, s32 cmd); +#endif void seq_channel_layer_process_script(struct SequenceChannelLayer *layer); void sequence_channel_process_script(struct SequenceChannel *seqChannel); u8 get_instrument(struct SequenceChannel *seqChannel, u8 instId, struct Instrument **instOut, @@ -36,7 +43,7 @@ void sequence_channel_init(struct SequenceChannel *seqChannel) { seqChannel->stereoHeadsetEffects = FALSE; seqChannel->transposition = 0; seqChannel->largeNotes = FALSE; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqChannel->bookOffset = 0; seqChannel->changes.as_u8 = 0xff; seqChannel->scriptState.depth = 0; @@ -54,12 +61,18 @@ void sequence_channel_init(struct SequenceChannel *seqChannel) { seqChannel->noteUnused = NULL; #endif seqChannel->reverb = 0; +#ifdef VERSION_SH + seqChannel->unkSH0C = 0; +#endif seqChannel->notePriority = NOTE_PRIORITY_DEFAULT; +#ifdef VERSION_SH + seqChannel->unkSH06 = 1; +#endif seqChannel->delay = 0; seqChannel->adsr.envelope = gDefaultEnvelope; seqChannel->adsr.releaseRate = 0x20; seqChannel->adsr.sustain = 0; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) seqChannel->updatesPerFrameUnused = gAudioUpdatesPerFrame; #endif seqChannel->vibratoRateTarget = 0x800; @@ -69,7 +82,10 @@ void sequence_channel_init(struct SequenceChannel *seqChannel) { seqChannel->vibratoRateChangeDelay = 0; seqChannel->vibratoExtentChangeDelay = 0; seqChannel->vibratoDelay = 0; -#ifdef VERSION_EU +#ifdef VERSION_SH + seqChannel->filter = NULL; +#endif +#if defined(VERSION_EU) || defined(VERSION_SH) seqChannel->volume = 1.0f; seqChannel->volumeScale = 1.0f; seqChannel->freqScale = 1.0f; @@ -87,7 +103,7 @@ s32 seq_channel_set_layer(struct SequenceChannel *seqChannel, s32 layerIndex) { struct SequenceChannelLayer *layer; if (seqChannel->layers[layerIndex] == NULL) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) struct SequenceChannelLayer *layer; #endif layer = audio_list_pop_back(&gLayerFreeList); @@ -108,14 +124,17 @@ s32 seq_channel_set_layer(struct SequenceChannel *seqChannel, s32 layerIndex) { layer->stopSomething = FALSE; layer->continuousNotes = FALSE; layer->finished = FALSE; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) layer->ignoreDrumPan = FALSE; +#endif +#ifdef VERSION_SH + layer->reverbBits.asByte = 0x40; #endif layer->portamento.mode = 0; layer->scriptState.depth = 0; layer->status = SOUND_LOAD_STATUS_NOT_LOADED; layer->noteDuration = 0x80; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) layer->pan = 0x40; #endif layer->transposition = 0; @@ -124,9 +143,12 @@ s32 seq_channel_set_layer(struct SequenceChannel *seqChannel, s32 layerIndex) { layer->delayUnused = 0; layer->note = NULL; layer->instrument = NULL; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) layer->freqScale = 1.0f; layer->velocitySquare = 0.0f; +#ifdef VERSION_SH + layer->unkSH28 = 1.0f; +#endif layer->instOrWave = 0xff; #else layer->velocitySquare = 0.0f; @@ -147,7 +169,7 @@ void seq_channel_layer_free(struct SequenceChannel *seqChannel, s32 layerIndex) struct SequenceChannelLayer *layer = seqChannel->layers[layerIndex]; if (layer != NULL) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) audio_list_push_back(&gLayerFreeList, &layer->listItem); #else struct AudioListItem *item = &layer->listItem; @@ -180,7 +202,7 @@ struct SequenceChannel *allocate_sequence_channel(void) { s32 i; for (i = 0; i < ARRAY_COUNT(gSequenceChannels); i++) { if (gSequenceChannels[i].seqPlayer == NULL) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) return &gSequenceChannels[i]; #else return gSequenceChannels + i; @@ -215,7 +237,7 @@ void sequence_player_init_channels(struct SequencePlayer *seqPlayer, u16 channel seqChannel->noteAllocPolicy = seqPlayer->noteAllocPolicy; } } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) channelBits = channelBits >> 1; #else channelBits >>= 1; @@ -236,15 +258,17 @@ void sequence_player_disable_channels(struct SequencePlayer *seqPlayer, u16 chan sequence_channel_disable(seqChannel); seqChannel->seqPlayer = NULL; } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) else { +#ifdef VERSION_EU stubbed_printf("Audio:Track: Warning SUBTRACK PARENT CHANGED\n"); +#endif } #endif seqPlayer->channels[i] = &gSequenceChannelNone; } } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) channelBits = channelBits >> 1; #else channelBits >>= 1; @@ -328,7 +352,6 @@ void sequence_player_disable_channels_extended(struct SequencePlayer* seqPlayer, void sequence_channel_enable(struct SequencePlayer *seqPlayer, u8 channelIndex, void *script) { struct SequenceChannel *seqChannel = seqPlayer->channels[channelIndex]; s32 i; - if (IS_SEQUENCE_CHANNEL_VALID(seqChannel) == FALSE) { #ifdef VERSION_EU struct SequencePlayer *bgMusic = &gSequencePlayers[0]; @@ -364,18 +387,30 @@ void sequence_player_disable(struct SequencePlayer *seqPlayer) { seqPlayer->finished = TRUE; seqPlayer->enabled = FALSE; - if (IS_SEQ_LOAD_COMPLETE(seqPlayer->seqId)) { + if (IS_SEQ_LOAD_COMPLETE(seqPlayer->seqId) +#ifdef VERSION_SH + && gSeqLoadStatus[seqPlayer->seqId] != 5 +#endif + ) { gSeqLoadStatus[seqPlayer->seqId] = SOUND_LOAD_STATUS_DISCARDABLE; } - if (IS_BANK_LOAD_COMPLETE(seqPlayer->defaultBank[0])) { + if (IS_BANK_LOAD_COMPLETE(seqPlayer->defaultBank[0]) +#ifdef VERSION_SH + && gBankLoadStatus[seqPlayer->defaultBank[0]] != 5 +#endif + ) { +#ifdef VERSION_SH + gBankLoadStatus[seqPlayer->defaultBank[0]] = 4; +#else gBankLoadStatus[seqPlayer->defaultBank[0]] = SOUND_LOAD_STATUS_DISCARDABLE; +#endif } // (Note that if this is called from alloc_bank_or_seq, the side will get swapped // later in that function. Thus, we signal that we want to load into the slot // of the bank that we no longer need.) -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (seqPlayer->defaultBank[0] == gBankLoadedPool.temporary.entries[0].id) { gBankLoadedPool.temporary.nextSide = 1; } else if (seqPlayer->defaultBank[0] == gBankLoadedPool.temporary.entries[1].id) { @@ -430,7 +465,7 @@ void init_layer_freelist(void) { gLayerFreeList.pool = NULL; for (i = 0; i < ARRAY_COUNT(gSequenceLayers); i++) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) gSequenceLayers[i].listItem.u.value = &gSequenceLayers[i]; #else gSequenceLayers[i].listItem.u.value = gSequenceLayers + i; @@ -441,7 +476,7 @@ void init_layer_freelist(void) { } u8 m64_read_u8(struct M64ScriptState *state) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) return *(state->pc++); #else u8 *midiArg = state->pc++; @@ -484,58 +519,76 @@ s32 m64_read_s32(struct M64ScriptState* state) { return ret; } -#if defined(VERSION_EU) +#if defined(VERSION_SH) void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { - struct SequencePlayer *seqPlayer; // sp5C, t4 - struct SequenceChannel *seqChannel; // sp58, t5 + s32 cmd; + + if (layer->enabled == FALSE) { + return; + } + + if (layer->delay > 1) { + layer->delay--; + if (!layer->stopSomething && layer->delay <= layer->duration) { + seq_channel_layer_note_decay(layer); + layer->stopSomething = TRUE; + } + return; + } + + seq_channel_layer_process_script_part1(layer); + cmd = seq_channel_layer_process_script_part2(layer); + if (cmd != -1) { + cmd = seq_channel_layer_process_script_part3(layer, cmd); + if (cmd != -1) { + cmd = seq_channel_layer_process_script_part4(layer, cmd); + } + if (cmd != -1) { + seq_channel_layer_process_script_part5(layer, cmd); + } + + if (layer->stopSomething == TRUE) { + if (layer->note != NULL || layer->continuousNotes) { + seq_channel_layer_note_decay(layer); + } + } + } +} +#elif defined(VERSION_EU) +void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { + struct SequencePlayer *seqPlayer; + struct SequenceChannel *seqChannel; #ifdef VERSION_EU - UNUSED u64 pad0; + UNUSED u32 pad0; #endif - struct M64ScriptState *state; // v0 - struct Portamento *portamento; // v0 - struct AudioBankSound *sound; // v0 - struct Instrument *instrument; // v1 + struct M64ScriptState *state; + struct Portamento *portamento; + struct AudioBankSound *sound; + struct Instrument *instrument; struct Drum *drum; + s32 temp_a0_5; #ifdef VERSION_EU - u16 sp3A; // t2, a0, a1 + u16 sp3A; s32 sameSound; - UNUSED s32 pad[1]; -#else - UNUSED s32 pad[1]; - u8 sameSound; // sp3F #endif - UNUSED u8 allocNewNote; // sp3D, t0 - u8 cmd; // a0 sp3E, EU s2 - UNUSED u8 loBits; + UNUSED u32 pad1; #ifndef VERSION_EU - u16 sp3A; // t2, a0, a1 + u8 sameSound; #endif - UNUSED s32 pad2[1]; - s32 vel; // sp30, t3 - UNUSED s32 pad3[1]; -#ifdef VERSION_EU - UNUSED f32 velFloat; -#endif - f32 freqScale; // sp28, f0 + u8 cmd; + UNUSED u8 cmdSemitone; #ifndef VERSION_EU - f32 sp24; + u16 sp3A; +#endif + f32 tuning; + s32 vel; + UNUSED s32 usedSemitone; + f32 freqScale; +#ifndef VERSION_EU + UNUSED f32 sp24; #endif - UNUSED u8 temp8; - UNUSED u8 semitone; // v0 - UNUSED s32 usedSemitone; // a1 f32 temp_f12; f32 temp_f2; - s32 temp_a0_5; - UNUSED u8 drumIndex; // t0 - UNUSED s32 cmdBase; // t1 - u8 temp_a0_6; - UNUSED u8 portamentoTargetNote; // t7 -#ifndef VERSION_EU - UNUSED s32 bankId; // a3 -#endif - UNUSED u8 instId; // v0 - UNUSED u8 cmdSemitone; // v1 - f32 tuning; // f0 sameSound = TRUE; if (layer->enabled == FALSE) { @@ -562,7 +615,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { seqChannel = layer->seqChannel; seqPlayer = seqChannel->seqPlayer; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) layer->notePropertiesNeedInit = TRUE; #endif @@ -615,7 +668,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { state->pc = seqPlayer->seqData + sp3A; break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xf4: state->pc += (s8)m64_read_u8(state); break; @@ -627,7 +680,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { if (cmd == 0xc1) { layer->velocitySquare = (f32)(temp_a0_5 * temp_a0_5); } else { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) layer->pan = temp_a0_5; #else layer->pan = (f32) temp_a0_5 / US_FLOAT(128.0); @@ -637,11 +690,11 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { case 0xc2: // layer_transpose; set transposition in semitones case 0xc9: // layer_setshortnoteduration - temp_a0_6 = *(state->pc++); + temp_a0_5 = *(state->pc++); if (cmd == 0xc9) { - layer->noteDuration = temp_a0_6; + layer->noteDuration = temp_a0_5; } else { - layer->transposition = temp_a0_6; + layer->transposition = temp_a0_5; } break; @@ -662,7 +715,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { case 0xc6: // layer_setinstr cmd = m64_read_u8(state); -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) if (cmd < 127) { cmd = get_instrument(seqChannel, cmd, &layer->instrument, &layer->adsr); } @@ -718,7 +771,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { layer->portamento.mode = 0; break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xcb: sp3A = m64_read_s16(state); layer->adsr.envelope = (struct AdsrEnvelope *) (seqPlayer->seqData + sp3A); @@ -777,7 +830,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { // the remaining bits are used for the semitone cmd -= (cmd & 0xc0); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) layer->velocitySquare = (f32)(vel) * (f32)vel; #else layer->velocitySquare = vel * vel; @@ -803,20 +856,20 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { } layer->delay = sp3A; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) layer->duration = layer->noteDuration * sp3A >> 8; #else layer->duration = layer->noteDuration * sp3A / 256; #endif if ((seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES) != 0) || seqChannel->stopSomething2 -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) || !seqChannel->hasInstrument #endif ) { layer->stopSomething = TRUE; } else { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s32 temp = layer->instOrWave; if (temp == 0xff) temp = seqChannel->instOrWave; if (temp == 0) @@ -827,7 +880,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { // cmd is reused for the drum semitone cmd += seqChannel->transposition + layer->transposition; -#ifdef VERSION_EU +#if defined(VERSION_EU) drum = get_drum(seqChannel->bankId, cmd); #else if (cmd >= gCtlEntries[seqChannel->bankId].numDrums) { @@ -848,7 +901,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { } else { layer->adsr.envelope = drum->envelope; layer->adsr.releaseRate = drum->releaseRate; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (!layer->ignoreDrumPan) { layer->pan = drum->pan; } @@ -858,7 +911,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { layer->sound = &drum->sound; layer->freqScale = layer->sound->tuning; } -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) || defined(VERSION_SH) skip:; #endif } else { // instrument @@ -868,7 +921,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { if (cmd >= 0x80) { layer->stopSomething = TRUE; } else { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (layer->instOrWave == 0xffu) { instrument = seqChannel->instrument; } else { @@ -889,7 +942,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { } if (instrument != NULL) { -#ifdef VERSION_EU +#if defined(VERSION_EU) sound = instrument_get_audio_bank_sound(instrument, vel); #else sound = (u8) vel < instrument->normalRangeLo ? &instrument->lowNotesSound @@ -912,7 +965,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { case PORTAMENTO_MODE_1: case PORTAMENTO_MODE_3: case PORTAMENTO_MODE_5: -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) sp24 = temp_f2; #endif freqScale = temp_f12; @@ -920,17 +973,17 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { case PORTAMENTO_MODE_2: case PORTAMENTO_MODE_4: -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) default: #endif freqScale = temp_f2; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) sp24 = temp_f12; #endif break; } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) portamento->extent = temp_f2 / freqScale - 1.0f; #else portamento->extent = sp24 / freqScale - US_FLOAT(1.0); @@ -949,7 +1002,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { layer->portamentoTargetNote = cmd; } } else if (instrument != NULL) { -#ifdef VERSION_EU +#if defined(VERSION_EU) sound = instrument_get_audio_bank_sound(instrument, cmd); #else sound = cmd < instrument->normalRangeLo ? @@ -985,7 +1038,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { seq_channel_layer_note_decay(layer); cmd = TRUE; } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) else if (layer != layer->note->parentLayer) { cmd = TRUE; } @@ -1001,27 +1054,453 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) { if (layer->note != NULL && layer->note->parentLayer == layer) { note_vibrato_init(layer->note); } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (seqChannel) { } #endif } +#ifdef VERSION_EU u8 audioString106[] = "Audio: Note:Velocity Error %d\n"; u8 audioString107[] = "Error: Your assignchannel is stolen.\n"; +#endif -#elif defined(NON_MATCHING) -// US/JP version with macros to simulate inlining by copt. Edit if you dare. -#include "seq_channel_layer_process_script.h" -#elif defined(VERSION_JP) -GLOBAL_ASM("asm/non_matchings/seq_channel_layer_process_script_jp.s") #else -GLOBAL_ASM("asm/non_matchings/seq_channel_layer_process_script_us.s") +// US/JP version with macros to simulate inlining by copt. Edit if you dare. +#include "copt/seq_channel_layer_process_script_copt.inc.c" +#endif + +#ifdef VERSION_SH +void seq_channel_layer_process_script_part1(struct SequenceChannelLayer *layer) { + if (!layer->continuousNotes) { + seq_channel_layer_note_decay(layer); + } else if (layer->note != NULL && layer->note->wantedParentLayer == layer) { + seq_channel_layer_note_decay(layer); + } + + if (PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_1 || + PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_2) { + layer->portamento.mode = 0; + } + + layer->notePropertiesNeedInit = TRUE; +} + +s32 seq_channel_layer_process_script_part5(struct SequenceChannelLayer *layer, s32 cmd) { + if (!layer->stopSomething && layer->sound != NULL && layer->sound->sample->codec == 2 && + layer->sound->sample->medium != 0) { + layer->stopSomething = TRUE; + return -1; + } + + if (layer->continuousNotes == 1 && layer->note != NULL && layer->status && cmd == 1 && + layer->note->parentLayer == layer) { + if (layer->sound == NULL) { + init_synthetic_wave(layer->note, layer); + } + } else { + if (cmd == 0) { + seq_channel_layer_note_decay(layer); + } + layer->note = alloc_note(layer); + } + if (layer->note != NULL && layer->note->parentLayer == layer) { + note_vibrato_init(layer->note); + } + return 0; +} + +s32 seq_channel_layer_process_script_part2(struct SequenceChannelLayer *layer) { + struct SequenceChannel *seqChannel = layer->seqChannel; + struct SequencePlayer *seqPlayer = seqChannel->seqPlayer; + struct M64ScriptState *state; + s32 temp_a0_5; + u16 sp3A; + u8 cmd; + + for (;;) { + state = &layer->scriptState; + cmd = m64_read_u8(state); + + if (cmd <= 0xc0) { + return cmd; + } + + switch (cmd) { + case 0xff: // layer_end; function return or end of script + if (state->depth == 0) { + // N.B. this function call is *not* inlined even though it's + // within the same file, unlike in the rest of this function. + seq_channel_layer_disable(layer); + return -1; + } + state->pc = state->stack[--state->depth]; + break; + + case 0xfc: // layer_call + if (0 && state->depth >= 4) { + eu_stubbed_printf_0("Macro Level Over Error!\n"); + } + sp3A = m64_read_s16(state); + state->stack[state->depth++] = state->pc; + state->pc = seqPlayer->seqData + sp3A; + break; + + case 0xf8: // layer_loop; loop start, N iterations (or 256 if N = 0) + if (0 && state->depth >= 4) { + eu_stubbed_printf_0("Macro Level Over Error!\n"); + } + state->remLoopIters[state->depth] = m64_read_u8(state); + state->stack[state->depth++] = state->pc; + break; + + case 0xf7: // layer_loopend + if (--state->remLoopIters[state->depth - 1] != 0) { + state->pc = state->stack[state->depth - 1]; + } else { + state->depth--; + } + break; + + case 0xfb: // layer_jump + sp3A = m64_read_s16(state); + state->pc = seqPlayer->seqData + sp3A; + break; + + case 0xf4: + state->pc += (s8)m64_read_u8(state); + break; + + case 0xc1: // layer_setshortnotevelocity + case 0xca: // layer_setpan + temp_a0_5 = *(state->pc++); + if (cmd == 0xc1) { + layer->velocitySquare = (f32) (temp_a0_5 * temp_a0_5) / (f32) (127 * 127); + } else { + layer->pan = temp_a0_5; + } + break; + + case 0xc2: // layer_transpose; set transposition in semitones + case 0xc9: // layer_setshortnoteduration + temp_a0_5 = *(state->pc++); + if (cmd == 0xc9) { + layer->noteDuration = temp_a0_5; + } else { + layer->transposition = temp_a0_5; + } + break; + + case 0xc4: // layer_somethingon + case 0xc5: // layer_somethingoff + if (cmd == 0xc4) { + layer->continuousNotes = TRUE; + } else { + layer->continuousNotes = FALSE; + } + seq_channel_layer_note_decay(layer); + break; + + case 0xc3: // layer_setshortnotedefaultplaypercentage + sp3A = m64_read_compressed_u16(state); + layer->shortNoteDefaultPlayPercentage = sp3A; + break; + + case 0xc6: // layer_setinstr + cmd = m64_read_u8(state); + if (cmd >= 0x7f) { + if (cmd == 0x7f) { + layer->instOrWave = 0; + } else { + layer->instOrWave = cmd; + layer->instrument = NULL; + } + + if (1) { + } + + if (cmd == 0xff) { + layer->adsr.releaseRate = 0; + } + break; + } + + if ((layer->instOrWave = get_instrument(seqChannel, cmd, &layer->instrument, &layer->adsr)) == 0) { + eu_stubbed_printf_1("WARNING: NPRG: cannot change %d\n", cmd); + layer->instOrWave = 0xff; + } + break; + + case 0xc7: // layer_portamento + layer->portamento.mode = m64_read_u8(state); + + // cmd is reused for the portamento's semitone + cmd = m64_read_u8(state) + seqChannel->transposition + + layer->transposition + seqPlayer->transposition; + + if (cmd >= 0x80) { + cmd = 0; + } + + layer->portamentoTargetNote = cmd; + + // If special, the next param is u8 instead of var + if (PORTAMENTO_IS_SPECIAL(layer->portamento)) { + layer->portamentoTime = *((state)->pc++); + break; + } + + sp3A = m64_read_compressed_u16(state); + layer->portamentoTime = sp3A; + break; + + case 0xc8: // layer_disableportamento + layer->portamento.mode = 0; + break; + + case 0xcb: + sp3A = m64_read_s16(state); + layer->adsr.envelope = (struct AdsrEnvelope *) (seqPlayer->seqData + sp3A); + layer->adsr.releaseRate = m64_read_u8(state); + break; + + case 0xcc: + layer->ignoreDrumPan = TRUE; + break; + + case 0xcd: + layer->reverbBits.asByte = m64_read_u8(state); + break; + + case 0xce: + cmd = m64_read_u8(state) + 0x80; + layer->unkSH28 = unk_sh_data_1[cmd]; + // missing break :) + + default: + switch (cmd & 0xf0) { + case 0xd0: // layer_setshortnotevelocityfromtable + sp3A = seqPlayer->shortNoteVelocityTable[cmd & 0xf]; + layer->velocitySquare = (f32) (sp3A * sp3A) / (f32) (127 * 127); + break; + case 0xe0: // layer_setshortnotedurationfromtable + layer->noteDuration = seqPlayer->shortNoteDurationTable[cmd & 0xf]; + break; + default: + eu_stubbed_printf_1("Audio:Track:NOTE:UNDEFINED NOTE COM. %x\n", cmd); + break; + } + } + } + return cmd; +} + +s32 seq_channel_layer_process_script_part4(struct SequenceChannelLayer *layer, s32 cmd1) { + s32 sameSound = TRUE; + struct SequenceChannel *seqChannel = layer->seqChannel; + struct Portamento *portamento; + struct AudioBankSound *sound; + struct Instrument *instrument; + struct Drum *drum; + f32 tuning; + s32 vel; + f32 freqScale; + f32 sp24; + f32 temp_f12; + UNUSED s32 pad[2]; + struct SequencePlayer *seqPlayer = seqChannel->seqPlayer; + u8 cmd = cmd1; + f32 temp_f2; + + s32 temp = layer->instOrWave; + if (temp == 0xff) { + if (!seqChannel->hasInstrument) { + return -1; + } + temp = seqChannel->instOrWave; + } + if (temp == 0) { // drum + // cmd is reused for the drum semitone + cmd += seqChannel->transposition + layer->transposition; + + drum = get_drum(seqChannel->bankId, cmd); + if (drum == NULL) { + layer->stopSomething = TRUE; + layer->delayUnused = layer->delay; + return -1; + } else { + layer->adsr.envelope = drum->envelope; + layer->adsr.releaseRate = drum->releaseRate; + if (!layer->ignoreDrumPan) { + layer->pan = drum->pan; + } + layer->sound = &drum->sound; + layer->freqScale = layer->sound->tuning; + } + } else { // instrument + // cmd is reused for the instrument semitone + cmd += seqPlayer->transposition + seqChannel->transposition + layer->transposition; + + if (cmd >= 0x80) { + layer->stopSomething = TRUE; + return -1; + } else { + if (layer->instOrWave == 0xff) { + instrument = seqChannel->instrument; + } else { + instrument = layer->instrument; + } + + if (layer->portamento.mode != 0) { + if (layer->portamentoTargetNote < cmd) { + vel = cmd; + } else { + vel = layer->portamentoTargetNote; + } + + if (instrument != NULL) { + sound = instrument_get_audio_bank_sound(instrument, vel); + sameSound = (sound == layer->sound); + layer->sound = sound; + tuning = sound->tuning; + } else { + layer->sound = NULL; + tuning = 1.0f; + } + + temp_f2 = gNoteFrequencies[cmd] * tuning; + temp_f12 = gNoteFrequencies[layer->portamentoTargetNote] * tuning; + + portamento = &layer->portamento; + switch (PORTAMENTO_MODE(layer->portamento)) { + case PORTAMENTO_MODE_1: + case PORTAMENTO_MODE_3: + case PORTAMENTO_MODE_5: + sp24 = temp_f2; + freqScale = temp_f12; + break; + + case PORTAMENTO_MODE_2: + case PORTAMENTO_MODE_4: + freqScale = temp_f2; + sp24 = temp_f12; + break; + + default: + freqScale = temp_f2; + sp24 = temp_f2; + break; + } + + portamento->extent = sp24 / freqScale - 1.0f; + + if (PORTAMENTO_IS_SPECIAL(layer->portamento)) { + portamento->speed = US_FLOAT(32512.0) * FLOAT_CAST(seqPlayer->tempo) + / ((f32) layer->delay * (f32) gTempoInternalToExternal + * FLOAT_CAST(layer->portamentoTime)); + } else { + portamento->speed = US_FLOAT(127.0) / FLOAT_CAST(layer->portamentoTime); + } + portamento->cur = 0.0f; + layer->freqScale = freqScale; + if (PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_5) { + layer->portamentoTargetNote = cmd; + } + } else if (instrument != NULL) { + sound = instrument_get_audio_bank_sound(instrument, cmd); + sameSound = (sound == layer->sound); + layer->sound = sound; + layer->freqScale = gNoteFrequencies[cmd] * sound->tuning; + } else { + layer->sound = NULL; + layer->freqScale = gNoteFrequencies[cmd]; + } + } + } + layer->delayUnused = layer->delay; + layer->freqScale *= layer->unkSH28; + return sameSound; +} + +s32 seq_channel_layer_process_script_part3(struct SequenceChannelLayer *layer, s32 cmd) { + struct M64ScriptState *state = &layer->scriptState; + u16 sp3A; + s32 vel; + struct SequenceChannel *seqChannel = layer->seqChannel; + struct SequencePlayer *seqPlayer = seqChannel->seqPlayer; + + if (cmd == 0xc0) { // layer_delay + layer->delay = m64_read_compressed_u16(state); + layer->stopSomething = TRUE; + return -1; + } + + layer->stopSomething = FALSE; + + if (seqChannel->largeNotes == TRUE) { + switch (cmd & 0xc0) { + case 0x00: // layer_note0 (play percentage, velocity, duration) + sp3A = m64_read_compressed_u16(state); + vel = *(state->pc++); + layer->noteDuration = *(state->pc++); + layer->playPercentage = sp3A; + break; + + case 0x40: // layer_note1 (play percentage, velocity) + sp3A = m64_read_compressed_u16(state); + vel = *(state->pc++); + layer->noteDuration = 0; + layer->playPercentage = sp3A; + break; + + case 0x80: // layer_note2 (velocity, duration; uses last play percentage) + sp3A = layer->playPercentage; + vel = *(state->pc++); + layer->noteDuration = *(state->pc++); + break; + } + if (vel >= 0x80 || vel < 0) { + vel = 0x7f; + } + layer->velocitySquare = ((f32) vel * (f32) vel) / (f32) (0x7f * 0x7f); + // the remaining bits are used for the semitone + cmd -= (cmd & 0xc0); + } else { + switch (cmd & 0xc0) { + case 0x00: // play note, type 0 (play percentage) + sp3A = m64_read_compressed_u16(state); + layer->playPercentage = sp3A; + break; + + case 0x40: // play note, type 1 (uses default play percentage) + sp3A = layer->shortNoteDefaultPlayPercentage; + break; + + case 0x80: // play note, type 2 (uses last play percentage) + sp3A = layer->playPercentage; + break; + } + + // the remaining bits are used for the semitone + cmd -= cmd & 0xc0; + } + + layer->delay = sp3A; + layer->duration = layer->noteDuration * sp3A >> 8; + if ((seqPlayer->muted && (seqChannel->muteBehavior & 0x50) != 0) + || seqChannel->stopSomething2) + { + layer->stopSomething = TRUE; + return -1; + } + + return cmd; +} #endif u8 get_instrument(struct SequenceChannel *seqChannel, u8 instId, struct Instrument **instOut, struct AdsrSettings *adsr) { struct Instrument *inst = NULL; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) inst = get_instrument_inner(seqChannel->bankId, instId); if (inst == NULL) { @@ -1086,7 +1565,7 @@ void set_instrument(struct SequenceChannel *seqChannel, u8 instId) { seqChannel->instOrWave = 0; seqChannel->instrument = (struct Instrument *) 1; } else { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if ((seqChannel->instOrWave = get_instrument(seqChannel, instId, &seqChannel->instrument, &seqChannel->adsr)) == 0) #else @@ -1106,24 +1585,17 @@ void sequence_channel_set_volume(struct SequenceChannel *seqChannel, u8 volume) seqChannel->volume = FLOAT_CAST(volume) / US_FLOAT(127.0); } -#ifdef NON_MATCHING void sequence_channel_process_script(struct SequenceChannel *seqChannel) { struct M64ScriptState *state; struct SequencePlayer *seqPlayer; + u8 cmd; + s8 temp; + u8 loBits; u16 sp5A; - UNUSED u8 t0; - UNUSED u8 sp38; - u8 cmd; // v1, s1 - u8 loBits; // t0, a0 - s32 offset; - s8 value = 0; // sp53, 4b - u8 temp; - s8 tempSigned; - UNUSED u8 temp2; + s32 sp38; + s8 value = 0; s32 i; -#ifdef VERSION_EU - u8 *arr; -#endif + u8 *seqData; if (!seqChannel->enabled) { return; @@ -1151,12 +1623,10 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { if (seqChannel->delay == 0) { for (;;) { cmd = m64_read_u8(state); -#ifndef VERSION_EU +#if !defined(VERSION_EU) && !defined(VERSION_SH) if (cmd == 0xff) // chan_end { - // This fixes a reordering in 'case 0x90', somehow - sp5A = state->depth; - if (sp5A == 0) { + if (state->depth == 0) { sequence_channel_disable(seqChannel); break; } @@ -1178,12 +1648,15 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { } #endif - // (new_var = cmd fixes order of s1/s2, but causes a reordering - // towards the bottom of the function) - if (cmd > 0xc0) { +#ifdef VERSION_SH + if (cmd >= 0xb0) +#else + if (cmd > 0xc0) +#endif + { switch (cmd) { case 0xff: // chan_end -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (state->depth == 0) { sequence_channel_disable(seqChannel); goto out; @@ -1193,7 +1666,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { #endif break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xfe: // chan_delay1 goto out; @@ -1210,7 +1683,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { eu_stubbed_printf_0("Audio:Track :Call Macro Level Over Error!\n"); } sp5A = m64_read_s16(state); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) state->stack[state->depth++] = state->pc; #else state->depth++, state->stack[state->depth - 1] = state->pc; @@ -1224,7 +1697,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { break; } state->remLoopIters[state->depth] = m64_read_u8(state); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) state->stack[state->depth++] = state->pc; #else state->depth++, state->stack[state->depth - 1] = state->pc; @@ -1258,31 +1731,29 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { state->pc = seqPlayer->seqData + sp5A; break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xf4: // chan_jump_rel case 0xf3: // chan_beqz_rel case 0xf2: // chan_bltz_rel - tempSigned = m64_read_u8(state); + temp = m64_read_u8(state); if (cmd == 0xf3 && value != 0) break; if (cmd == 0xf2 && value >= 0) break; - state->pc += tempSigned; + state->pc += temp; break; #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xf1: // chan_reservenotes #else case 0xf2: // chan_reservenotes #endif - // seqChannel->notePool should live in a saved register note_pool_clear(&seqChannel->notePool); - temp = m64_read_u8(state); - note_pool_fill(&seqChannel->notePool, temp); + note_pool_fill(&seqChannel->notePool, m64_read_u8(state)); break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xf0: // chan_unreservenotes #else case 0xf1: // chan_unreservenotes @@ -1297,26 +1768,37 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { case 0xc5: // chan_dynsetdyntable if (value != -1) { - sp5A = (*seqChannel->dynTable)[value][1] - + ((*seqChannel->dynTable)[value][0] << 8); +#if defined(VERSION_EU) || defined(VERSION_SH) + seqData = (*seqChannel->dynTable)[value]; + sp38 = (u16)((seqData[0] << 8) + seqData[1]); + seqChannel->dynTable = (void *) (seqPlayer->seqData + sp38); +#else + sp5A = (u16)((((*seqChannel->dynTable)[value])[0] << 8) + (((*seqChannel->dynTable)[value])[1])); seqChannel->dynTable = (void *) (seqPlayer->seqData + sp5A); +#endif } break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xeb: // chan_setbankandinstr - temp = m64_read_u8(state); - // Switch to the temp's (0-indexed) bank in this sequence's + cmd = m64_read_u8(state); + // Switch to the cmd's (0-indexed) bank in this sequence's // bank set. Note that in the binary format (not in the JSON!) // the banks are listed backwards, so we counts from the back. // (gAlBankSets[offset] is number of banks) - offset = ((u16 *) gAlBankSets)[seqPlayer->seqId]; - temp = gAlBankSets[offset + gAlBankSets[offset] - temp]; - // temp should be in a saved register across this call - if (get_bank_or_seq(&gBankLoadedPool, 2, temp) != NULL) { - seqChannel->bankId = temp; + sp38 = ((u16 *) gAlBankSets)[seqPlayer->seqId]; + loBits = *(sp38 + gAlBankSets); + cmd = gAlBankSets[(s32)sp38 + loBits - cmd]; + +#ifdef VERSION_SH + if (get_bank_or_seq(1, 2, cmd) != NULL) +#else + if (get_bank_or_seq(&gBankLoadedPool, 2, cmd) != NULL) +#endif + { + seqChannel->bankId = cmd; } else { - eu_stubbed_printf_1("SUB:ERR:BANK %d NOT CACHED.\n", temp); + eu_stubbed_printf_1("SUB:ERR:BANK %d NOT CACHED.\n", cmd); } // fallthrough #endif @@ -1335,37 +1817,49 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { case 0xdf: // chan_setvol sequence_channel_set_volume(seqChannel, m64_read_u8(state)); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqChannel->changes.as_bitfields.volume = TRUE; #endif break; case 0xe0: // chan_setvolscale seqChannel->volumeScale = FLOAT_CAST(m64_read_u8(state)) / US_FLOAT(128.0); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqChannel->changes.as_bitfields.volume = TRUE; #endif break; case 0xde: // chan_freqscale; pitch bend using raw frequency multiplier N/2^15 (N is u16) sp5A = m64_read_s16(state); -#ifdef VERSION_EU + seqChannel->freqScale = FLOAT_CAST(sp5A) / US_FLOAT(32768.0); +#if defined(VERSION_EU) || defined(VERSION_SH) seqChannel->changes.as_bitfields.freqScale = TRUE; #endif - seqChannel->freqScale = FLOAT_CAST(sp5A) / US_FLOAT(32768.0); break; case 0xd3: // chan_pitchbend; pitch bend by <= 1 octave in either direction (-127..127) // (m64_read_u8(state) is really s8 here) - temp = m64_read_u8(state) + 127; - seqChannel->freqScale = gPitchBendFrequencyScale[temp]; -#ifdef VERSION_EU +#ifdef VERSION_SH + cmd = m64_read_u8(state) + 128; +#else + cmd = m64_read_u8(state) + 127; +#endif + seqChannel->freqScale = gPitchBendFrequencyScale[cmd]; +#if defined(VERSION_EU) || defined(VERSION_SH) seqChannel->changes.as_bitfields.freqScale = TRUE; #endif break; +#ifdef VERSION_SH + case 0xee: + cmd = m64_read_u8(state) + 0x80; + seqChannel->freqScale = unk_sh_data_1[cmd]; + seqChannel->changes.as_bitfields.freqScale = TRUE; + break; +#endif + case 0xdd: // chan_setpan -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqChannel->newPan = m64_read_u8(state); seqChannel->changes.as_bitfields.pan = TRUE; #else @@ -1374,7 +1868,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { break; case 0xdc: // chan_setpanmix; set proportion of pan to come from channel (0..128) -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqChannel->panChannelWeight = m64_read_u8(state); seqChannel->changes.as_bitfields.pan = TRUE; #else @@ -1383,9 +1877,8 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { break; case 0xdb: // chan_transpose; set transposition in semitones - tempSigned = *state->pc; - state->pc++; - seqChannel->transposition = tempSigned; + temp = *state->pc++; + seqChannel->transposition = temp; break; case 0xda: // chan_setenvelope @@ -1425,13 +1918,13 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { seqChannel->vibratoDelay = m64_read_u8(state) * 16; break; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) case 0xd6: // chan_setupdatesperframe_unimplemented - temp = m64_read_u8(state); - if (temp == 0) { - temp = gAudioUpdatesPerFrame; + cmd = m64_read_u8(state); + if (cmd == 0) { + cmd = gAudioUpdatesPerFrame; } - seqChannel->updatesPerFrameUnused = temp; + seqChannel->updatesPerFrameUnused = cmd; break; #endif @@ -1440,31 +1933,41 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { break; case 0xc6: // chan_setbank; switch bank within set - { - u8 temp = m64_read_u8(state); + cmd = m64_read_u8(state); // Switch to the temp's (0-indexed) bank in this sequence's // bank set. Note that in the binary format (not in the JSON!) // the banks are listed backwards, so we counts from the back. // (gAlBankSets[offset] is number of banks) - offset = ((u16 *) gAlBankSets)[seqPlayer->seqId]; - temp = gAlBankSets[offset + gAlBankSets[offset] - temp]; - // temp should be in a saved register across this call - if (get_bank_or_seq(&gBankLoadedPool, 2, temp) != NULL) { - seqChannel->bankId = temp; +#if defined(VERSION_EU) || defined(VERSION_SH) + sp38 = ((u16 *) gAlBankSets)[seqPlayer->seqId]; + loBits = *(sp38 + gAlBankSets); + cmd = gAlBankSets[(s32)sp38 + loBits - cmd]; +#else + sp5A = ((u16 *) gAlBankSets)[seqPlayer->seqId]; + loBits = *(sp5A + gAlBankSets); + cmd = gAlBankSets[sp5A + loBits - cmd]; +#endif +#ifdef VERSION_SH + if (get_bank_or_seq(1, 2, cmd) != NULL) +#else + if (get_bank_or_seq(&gBankLoadedPool, 2, cmd) != NULL) +#endif + { + seqChannel->bankId = cmd; } else { - eu_stubbed_printf_1("SUB:ERR:BANK %d NOT CACHED.\n", temp); - } + eu_stubbed_printf_1("SUB:ERR:BANK %d NOT CACHED.\n", cmd); } break; case 0xc7: // chan_writeseq; write to sequence data (!) - // sp38 doesn't go on the stack { - u8 sp38; - u8 temp; - sp38 = value; - temp = m64_read_u8(state); - seqPlayer->seqData[(u16)m64_read_s16(state)] = sp38 + temp; +#if !defined(VERSION_EU) && !defined(VERSION_SH) + u8 *seqData; +#endif + cmd = m64_read_u8(state); + sp5A = m64_read_s16(state); + seqData = seqPlayer->seqData + sp5A; + *seqData = (u8)value + cmd; } break; @@ -1481,15 +1984,37 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { } break; +#ifdef VERSION_SH + case 0xcd: + sequence_channel_disable(seqPlayer->channels[m64_read_u8(state)]); + break; +#endif + case 0xca: // chan_setmutebhv seqChannel->muteBehavior = m64_read_u8(state); +#ifdef VERSION_SH + seqChannel->changes.as_bitfields.volume = TRUE; +#endif break; case 0xcb: // chan_readseq - sp5A = m64_read_s16(state); - value = seqPlayer->seqData[sp5A + value]; + sp38 = (u16)m64_read_s16(state) + value; + value = seqPlayer->seqData[sp38]; break; +#ifdef VERSION_SH + case 0xce: + seqChannel->unkC8 = m64_read_s16(state); + break; + + case 0xcf: + sp5A = m64_read_s16(state); + seqData = seqPlayer->seqData + sp5A; + seqData[0] = (seqChannel->unkC8 >> 8) & 0xffff; + seqData[1] = (seqChannel->unkC8) & 0xffff; + break; +#endif + case 0xd0: // chan_stereoheadseteffects seqChannel->stereoHeadsetEffects = m64_read_u8(state); break; @@ -1499,52 +2024,57 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { break; case 0xd2: // chan_setsustain -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqChannel->adsr.sustain = m64_read_u8(state); #else seqChannel->adsr.sustain = m64_read_u8(state) << 8; #endif break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xe5: seqChannel->reverbIndex = m64_read_u8(state); break; #endif case 0xe4: // chan_dyncall if (value != -1) { - if (0 && state->depth >= 4) { +#if defined(VERSION_EU) || defined(VERSION_SH) + if (state->depth >= 4) { eu_stubbed_printf_0("Audio:Track: CTBLCALL Macro Level Over Error!\n"); } - u8(*thingy)[2] = *seqChannel->dynTable; -#ifdef VERSION_EU +#endif + seqData = (*seqChannel->dynTable)[value]; +#if defined(VERSION_EU) || defined(VERSION_SH) state->stack[state->depth++] = state->pc; + sp38 = (u16)((seqData[0] << 8) + seqData[1]); + state->pc = seqPlayer->seqData + sp38; + + if (0 && sp38 >= gSeqFileHeader->seqArray[seqPlayer->seqId].len) { + eu_stubbed_printf_3("Err :Sub %x ,address %x:Undefined SubTrack Function %x", seqChannel, state->pc, sp38); + } #else state->depth++, state->stack[state->depth - 1] = state->pc; -#endif - sp5A = thingy[value][1] + (thingy[value][0] << 8); + sp5A = ((seqData[0] << 8) + seqData[1]); state->pc = seqPlayer->seqData + sp5A; - if (0 && sp5A >= gSeqFileHeader->seqArray[seqPlayer->seqId].len) { - eu_stubbed_printf_3("Err :Sub %x ,address %x:Undefined SubTrack Function %x", seqChannel, state->pc, sp5A); - } +#endif } break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xe6: seqChannel->bookOffset = m64_read_u8(state); break; case 0xe7: sp5A = m64_read_s16(state); - arr = seqPlayer->seqData + sp5A; - seqChannel->muteBehavior = *arr++; - seqChannel->noteAllocPolicy = *arr++; - seqChannel->notePriority = *arr++; - seqChannel->transposition = (s8) *arr++; - seqChannel->newPan = *arr++; - seqChannel->panChannelWeight = *arr++; - seqChannel->reverb = *arr++; - seqChannel->reverbIndex = *arr++; // reverb index? + seqData = seqPlayer->seqData + sp5A; + seqChannel->muteBehavior = *seqData++; + seqChannel->noteAllocPolicy = *seqData++; + seqChannel->notePriority = *seqData++; + seqChannel->transposition = (s8) *seqData++; + seqChannel->newPan = *seqData++; + seqChannel->panChannelWeight = *seqData++; + seqChannel->reverb = *seqData++; + seqChannel->reverbIndex = *seqData++; // reverb index? seqChannel->changes.as_bitfields.pan = TRUE; break; @@ -1571,15 +2101,122 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { break; case 0xe9: // chan_setnotepriority +#ifdef VERSION_SH + cmd = m64_read_u8(state); + if ((cmd & 0xf) != 0) { + seqChannel->notePriority = cmd & 0xf; + } + cmd = cmd >> 4; + if (cmd != 0) { + seqChannel->unkSH06 = cmd; + } +#else seqChannel->notePriority = m64_read_u8(state); +#endif + break; +#endif +#ifdef VERSION_SH + case 0xed: + seqChannel->unkSH0C = m64_read_u8(state); + break; + + case 0xef: + m64_read_s16(state); + m64_read_u8(state); + break; + + case 0xb0: + sp5A = m64_read_s16(state); + seqData = seqPlayer->seqData + sp5A; + seqChannel->filter = (s16 *) (seqData); + break; + + case 0xb1: + seqChannel->filter = NULL; + break; + + case 0xb3: + if (seqChannel->filter != NULL) { + cmd = m64_read_u8(state); + if (cmd == 0) { + seqChannel->filter = NULL; + } else { + loBits = (cmd >> 4) & 0xf; + cmd &= 0xf; + fill_filter(seqChannel->filter, loBits, cmd); + } + } + break; + + case 0xb2: + i = (value * 2); + sp5A = m64_read_s16(state); + sp38 = sp5A + i; + seqChannel->unkC8 = *(u16 *) (seqPlayer->seqData + sp38); + break; + + case 0xb4: + seqChannel->dynTable = (void *) (seqPlayer->seqData + seqChannel->unkC8); + break; + + case 0xb5: + seqChannel->unkC8 = *(u16 *) (*seqChannel->dynTable)[value]; + break; + + case 0xb6: + value = (*seqChannel->dynTable)[0][value]; break; #endif } } else { - // loBits is recomputed a lot +#ifdef VERSION_SH + if (cmd >= 0x80) { + loBits = cmd & 7; + switch (cmd & 0xf8) { + case 0x80: + if (seqChannel->layers[loBits] != NULL) { + value = seqChannel->layers[loBits]->finished; + } else { + value = -1; + } + break; + + case 0x88: + sp5A = m64_read_s16(state); + if (seq_channel_set_layer(seqChannel, loBits) == 0) { + if (1) {} + seqChannel->layers[loBits]->scriptState.pc = seqPlayer->seqData + sp5A; + } + break; + + case 0x90: + seq_channel_layer_free(seqChannel, loBits); + break; + + case 0x98: + if (value != -1 && seq_channel_set_layer(seqChannel, loBits) != -1) { + seqData = (*seqChannel->dynTable)[value]; + sp5A = ((seqData[0] << 8) + seqData[1]); + seqChannel->layers[loBits]->scriptState.pc = seqPlayer->seqData + sp5A; + } + break; + } + } else { +#endif loBits = cmd & 0xf; - // #define loBits (cmd & 0xf) + switch (cmd & 0xf0) { +#ifdef VERSION_SH + case 0x00: + seqChannel->delay = loBits; + goto out; + + case 0x10: + seqChannel->soundScriptIO[loBits] = -1; + if (func_802f47c8(seqChannel->bankId, (u8)value, &seqChannel->soundScriptIO[loBits]) == -1) { + } + break; +#else case 0x00: // chan_testlayerfinished if (seqChannel->layers[loBits] != NULL) { value = seqChannel->layers[loBits]->finished; @@ -1590,23 +2227,32 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { } #endif break; +#endif + // sh: 0x70 case 0x70: // chan_iowriteval; write data back to audio lib seqChannel->soundScriptIO[loBits] = value; break; +#ifdef VERSION_SH + case 0x60: +#else case 0x80: // chan_ioreadval; read data from audio lib +#endif value = seqChannel->soundScriptIO[loBits]; if (loBits < 4) { seqChannel->soundScriptIO[loBits] = -1; } break; + // sh: 0x50 case 0x50: // chan_ioreadvalsub; subtract with read data from audio lib value -= seqChannel->soundScriptIO[loBits]; break; +#ifndef VERSION_SH #ifdef VERSION_EU + // sh: 0x00 case 0x60: // chan_delayshort seqChannel->delay = loBits; goto out; @@ -1615,6 +2261,9 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { case 0x90: // chan_setlayer sp5A = m64_read_s16(state); if (seq_channel_set_layer(seqChannel, loBits) == 0) { +#ifdef VERSION_EU + if (1) {} +#endif seqChannel->layers[loBits]->scriptState.pc = seqPlayer->seqData + sp5A; } break; @@ -1625,8 +2274,8 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { case 0xb0: // chan_dynsetlayer if (value != -1 && seq_channel_set_layer(seqChannel, loBits) != -1) { - sp5A = ((*seqChannel->dynTable)[value][0] << 8) - + (*seqChannel->dynTable)[value][1]; + seqData = (*seqChannel->dynTable)[value]; + sp5A = ((seqData[0] << 8) + seqData[1]); seqChannel->layers[loBits]->scriptState.pc = seqPlayer->seqData + sp5A; } break; @@ -1636,28 +2285,40 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { seqChannel->notePriority = loBits; break; #endif +#endif +#ifdef VERSION_SH + case 0x20: +#else case 0x10: // chan_startchannel +#endif sp5A = m64_read_s16(state); sequence_channel_enable(seqPlayer, loBits, seqPlayer->seqData + sp5A); break; +#ifndef VERSION_SH case 0x20: // chan_disablechannel sequence_channel_disable(seqPlayer->channels[loBits]); break; +#endif case 0x30: // chan_iowriteval2; write data back to audio lib for another channel - seqPlayer->channels[loBits]->soundScriptIO[m64_read_u8(state)] = value; + cmd = m64_read_u8(state); + seqPlayer->channels[loBits]->soundScriptIO[cmd] = value; break; case 0x40: // chan_ioreadval2; read data from audio lib from another channel - value = seqPlayer->channels[loBits]->soundScriptIO[m64_read_u8(state)]; + cmd = m64_read_u8(state); + value = seqPlayer->channels[loBits]->soundScriptIO[cmd]; break; } +#ifdef VERSION_SH + } +#endif } } } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) out: #endif @@ -1666,17 +2327,12 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) { seq_channel_layer_process_script(seqChannel->layers[i]); } } -#undef loBits } -#elif defined(VERSION_EU) -GLOBAL_ASM("asm/non_matchings/eu/audio/sequence_channel_process_script.s") -#elif defined(VERSION_JP) -GLOBAL_ASM("asm/non_matchings/sequence_channel_process_script_jp.s") +#if defined(VERSION_SH) && !defined(NON_MATCHING) // regalloc +void sequence_player_process_sequence(struct SequencePlayer *seqPlayer); +GLOBAL_ASM("asm/non_matchings/sh/audio/seqplayer/sequence_player_process_sequence.s") #else -GLOBAL_ASM("asm/non_matchings/sequence_channel_process_script_us.s") -#endif - void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { u8 cmd; u8 loBits; @@ -1687,7 +2343,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { u32 u32v; u8 *tempPtr; struct M64ScriptState *state; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s32 temp32; #endif @@ -1695,6 +2351,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { return; } +#ifndef VERSION_SH if (seqPlayer->bankDmaInProgress == TRUE) { #ifdef VERSION_EU if (osRecvMesg(&seqPlayer->bankDmaMesgQueue, NULL, 0) == -1) { @@ -1702,12 +2359,13 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { } if (seqPlayer->bankDmaRemaining == 0) { seqPlayer->bankDmaInProgress = FALSE; - patch_audio_bank((struct AudioBank *)(gCtlEntries[seqPlayer->loadingBankId].instruments - 1), - gAlTbl->seqArray[seqPlayer->loadingBankId].offset, - gCtlEntries[seqPlayer->loadingBankId].numInstruments, - gCtlEntries[seqPlayer->loadingBankId].numDrums); + patch_audio_bank( + (struct AudioBank *) (gCtlEntries[seqPlayer->loadingBankId].instruments - 1), + gAlTbl->seqArray[seqPlayer->loadingBankId].offset, + gCtlEntries[seqPlayer->loadingBankId].numInstruments, + gCtlEntries[seqPlayer->loadingBankId].numDrums); gCtlEntries[seqPlayer->loadingBankId].drums = - ((struct AudioBank *)(gCtlEntries[seqPlayer->loadingBankId].instruments - 1))->drums; + ((struct AudioBank *) (gCtlEntries[seqPlayer->loadingBankId].instruments - 1))->drums; gBankLoadStatus[seqPlayer->loadingBankId] = SOUND_LOAD_STATUS_COMPLETE; } else { audio_dma_partial_copy_async(&seqPlayer->bankDmaCurrDevAddr, &seqPlayer->bankDmaCurrMemAddr, @@ -1721,7 +2379,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { if (seqPlayer->bankDmaRemaining == 0) { seqPlayer->bankDmaInProgress = FALSE; patch_audio_bank(seqPlayer->loadingBank, gAlTbl->seqArray[seqPlayer->loadingBankId].offset, - seqPlayer->loadingBankNumInstruments, seqPlayer->loadingBankNumDrums); + seqPlayer->loadingBankNumInstruments, seqPlayer->loadingBankNumDrums); gCtlEntries[seqPlayer->loadingBankId].numInstruments = seqPlayer->loadingBankNumInstruments; gCtlEntries[seqPlayer->loadingBankId].numDrums = seqPlayer->loadingBankNumDrums; gCtlEntries[seqPlayer->loadingBankId].instruments = seqPlayer->loadingBank->instruments; @@ -1755,18 +2413,30 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { seqPlayer->seqDmaInProgress = FALSE; gSeqLoadStatus[seqPlayer->seqId] = SOUND_LOAD_STATUS_COMPLETE; } +#endif // If discarded, bail out. if (IS_SEQ_LOAD_COMPLETE(seqPlayer->seqId) == FALSE - || IS_BANK_LOAD_COMPLETE(seqPlayer->defaultBank[0]) == FALSE) { + || ( +#ifdef VERSION_SH + seqPlayer->defaultBank[0] != 0xff && +#endif + IS_BANK_LOAD_COMPLETE(seqPlayer->defaultBank[0]) == FALSE)) { eu_stubbed_printf_1("Disappear Sequence or Bank %d\n", seqPlayer->seqId); sequence_player_disable(seqPlayer); return; } // Remove possible SOUND_LOAD_STATUS_DISCARDABLE marks. - gSeqLoadStatus[seqPlayer->seqId] = SOUND_LOAD_STATUS_COMPLETE; - gBankLoadStatus[seqPlayer->defaultBank[0]] = SOUND_LOAD_STATUS_COMPLETE; +#ifdef VERSION_SH + if (gSeqLoadStatus[seqPlayer->seqId] != 5) +#endif + gSeqLoadStatus[seqPlayer->seqId] = SOUND_LOAD_STATUS_COMPLETE; + +#ifdef VERSION_SH + if (gBankLoadStatus[seqPlayer->defaultBank[0]] != 5) +#endif + gBankLoadStatus[seqPlayer->defaultBank[0]] = SOUND_LOAD_STATUS_COMPLETE; if (seqPlayer->muted && (seqPlayer->muteBehavior & MUTE_BEHAVIOR_STOP_SCRIPT) != 0) { return; @@ -1774,6 +2444,9 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { // Check if we surpass the number of ticks needed for a tatum, else stop. seqPlayer->tempoAcc += seqPlayer->tempo; +#ifdef VERSION_SH + seqPlayer->tempoAcc += seqPlayer->tempoAdd; +#endif if (seqPlayer->tempoAcc < gTempoInternalToExternal) { return; } @@ -1787,7 +2460,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { #endif seqPlayer->delay--; } else { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->recalculateVolume = 1; #endif for (;;) { @@ -1798,7 +2471,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { sequence_player_disable(seqPlayer); break; } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) state->pc = state->stack[--state->depth]; #else state->depth--, state->pc = state->stack[state->depth]; @@ -1827,7 +2500,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { if (0 && state->depth >= 4) { eu_stubbed_printf_0("Macro Level Over Error!\n"); } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) state->stack[state->depth++] = state->pc; #else state->depth++, state->stack[state->depth - 1] = state->pc; @@ -1841,7 +2514,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { break; } state->remLoopIters[state->depth] = m64_read_u8(state); -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) state->stack[state->depth++] = state->pc; #else state->depth++, state->stack[state->depth - 1] = state->pc; @@ -1874,7 +2547,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { state->pc = seqPlayer->seqData + u16v; break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xf4: case 0xf3: case 0xf2: @@ -1885,11 +2558,11 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { if (cmd == 0xf2 && value >= 0) { break; } - state->pc += (s8)temp; + state->pc += (s8) temp; break; #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xf1: // seq_reservenotes #else case 0xf2: // seq_reservenotes @@ -1898,7 +2571,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { note_pool_fill(&seqPlayer->notePool, m64_read_u8(state)); break; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xf0: // seq_unreservenotes #else case 0xf1: // seq_unreservenotes @@ -1915,24 +2588,38 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { break; case 0xdd: // seq_settempo (bpm) +#ifndef VERSION_SH case 0xdc: // seq_addtempo (bpm) +#endif +#ifdef VERSION_SH + seqPlayer->tempo = m64_read_u8(state) * TEMPO_SCALE; +#else temp = m64_read_u8(state); if (cmd == 0xdd) { seqPlayer->tempo = temp * TEMPO_SCALE; } else { seqPlayer->tempo += (s8) temp * TEMPO_SCALE; } +#endif if (seqPlayer->tempo > gTempoInternalToExternal) { seqPlayer->tempo = gTempoInternalToExternal; } + //if (cmd){} + if ((s16) seqPlayer->tempo <= 0) { seqPlayer->tempo = 1; } break; -#ifdef VERSION_EU +#ifdef VERSION_SH + case 0xdc: // seq_addtempo (bpm) + seqPlayer->tempoAdd = (s8) m64_read_u8(state) * TEMPO_SCALE; + break; +#endif + +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xda: temp = m64_read_u8(state); u16v = m64_read_s16(state); @@ -1945,9 +2632,10 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { } break; case SEQUENCE_PLAYER_STATE_2: - seqPlayer->fadeTimer = u16v; + seqPlayer->fadeRemainingFrames = u16v; seqPlayer->state = temp; - seqPlayer->fadeVelocity = (0.0f - seqPlayer->fadeVolume) / (s32) (u16v & 0xFFFFu); + seqPlayer->fadeVelocity = + (0.0f - seqPlayer->fadeVolume) / (s32)(u16v & 0xFFFFu); break; } break; @@ -1962,9 +2650,9 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { seqPlayer->fadeVolume = 0.0f; // fallthrough case SEQUENCE_PLAYER_STATE_0: - seqPlayer->fadeTimer = seqPlayer->fadeTimerUnkEu; + seqPlayer->fadeRemainingFrames = seqPlayer->fadeTimerUnkEu; if (seqPlayer->fadeTimerUnkEu != 0) { - seqPlayer->fadeVelocity = (temp32 / 127.0f - seqPlayer->fadeVolume) / FLOAT_CAST(seqPlayer->fadeTimer); + seqPlayer->fadeVelocity = (temp32 / 127.0f - seqPlayer->fadeVolume) / FLOAT_CAST(seqPlayer->fadeRemainingFrames); } else { seqPlayer->fadeVolume = temp32 / 127.0f; } @@ -1975,10 +2663,10 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { temp = m64_read_u8(state); switch (seqPlayer->state) { case SEQUENCE_PLAYER_STATE_2: - if (seqPlayer->fadeTimer != 0) { + if (seqPlayer->fadeRemainingFrames != 0) { f32 targetVolume = FLOAT_CAST(temp) / US_FLOAT(127.0); seqPlayer->fadeVelocity = (targetVolume - seqPlayer->fadeVolume) - / FLOAT_CAST(seqPlayer->fadeTimer); + / FLOAT_CAST(seqPlayer->fadeRemainingFrames); break; } // fallthrough @@ -1995,14 +2683,14 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { case 0xda: // seq_changevol temp = m64_read_u8(state); seqPlayer->fadeVolume = - seqPlayer->fadeVolume + (f32) (s8)temp / US_FLOAT(127.0); + seqPlayer->fadeVolume + (f32)(s8) temp / US_FLOAT(127.0); break; #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) case 0xd9: temp = m64_read_u8(state); - seqPlayer->fadeVolumeScale = (s8)temp / 127.0f; + seqPlayer->fadeVolumeScale = (s8) temp / 127.0f; break; #endif @@ -2028,7 +2716,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { case 0xd5: // seq_setmutescale temp = m64_read_u8(state); - seqPlayer->muteVolumeScale = (f32) (s8)temp / US_FLOAT(127.0); + seqPlayer->muteVolumeScale = (f32)(s8) temp / US_FLOAT(127.0); break; case 0xd4: // seq_mute @@ -2059,7 +2747,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { break; case 0xc9: // seq_bitand -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) value &= m64_read_u8(state); #else value = m64_read_u8(state) & value; @@ -2070,6 +2758,18 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { value = value - m64_read_u8(state); break; +#ifdef VERSION_SH + case 0xc7: + temp = m64_read_u8(state); + u16v = m64_read_s16(state); + seqPlayer->seqData[u16v] = (u8) value + temp; + break; + + case 0xc6: + seqPlayer->unkSh = TRUE; + break; +#endif + default: eu_stubbed_printf_1("Group:Undefine upper C0h command (%x)\n", cmd); break; @@ -2078,7 +2778,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { loBits = cmd & 0xf; switch (cmd & 0xf0) { case 0x00: // seq_testchdisabled -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) value = seqPlayer->channels[loBits]->finished; #else if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[loBits]) == TRUE) { @@ -2093,7 +2793,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { case 0x40: break; case 0x50: // seq_subvariation -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) value -= seqPlayer->seqVariationEu[0]; #else value -= seqPlayer->seqVariation; @@ -2102,14 +2802,14 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { case 0x60: break; case 0x70: // seq_setvariation -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->seqVariationEu[0] = value; #else seqPlayer->seqVariation = value; #endif break; case 0x80: // seq_getvariation -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) value = seqPlayer->seqVariationEu[0]; #else value = seqPlayer->seqVariation; @@ -2121,7 +2821,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { break; case 0xa0: break; -#ifndef VERSION_EU +#if !defined(VERSION_EU) && !defined(VERSION_SH) case 0xd8: // (this makes no sense) break; case 0xd9: @@ -2137,7 +2837,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { } for (i = 0; i < CHANNELS_MAX; i++) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE) { sequence_channel_process_script(seqPlayer->channels[i]); } @@ -2148,13 +2848,14 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) { #endif } } +#endif // This runs 240 times per second. void process_sequences(UNUSED s32 iterationsRemaining) { s32 i; for (i = 0; i < SEQUENCE_PLAYERS; i++) { if (gSequencePlayers[i].enabled == TRUE) { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) sequence_player_process_sequence(&gSequencePlayers[i]); sequence_player_process_sound(&gSequencePlayers[i]); #else @@ -2163,7 +2864,7 @@ void process_sequences(UNUSED s32 iterationsRemaining) { #endif } } -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) reclaim_notes(); #endif process_notes(); @@ -2171,29 +2872,38 @@ void process_sequences(UNUSED s32 iterationsRemaining) { void init_sequence_player(u32 player) { struct SequencePlayer *seqPlayer = &gSequencePlayers[player]; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) sequence_player_disable(seqPlayer); #endif +#ifdef VERSION_SH + seqPlayer->unkSh = FALSE; +#else seqPlayer->muted = FALSE; +#endif seqPlayer->delay = 0; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->state = 1; #else seqPlayer->state = SEQUENCE_PLAYER_STATE_0; #endif - seqPlayer->fadeTimer = 0; -#ifdef VERSION_EU + seqPlayer->fadeRemainingFrames = 0; +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->fadeTimerUnkEu = 0; #endif seqPlayer->tempoAcc = 0; seqPlayer->tempo = 120 * TEMPO_SCALE; // 120 BPM +#ifdef VERSION_SH + seqPlayer->tempoAdd = 0; +#endif seqPlayer->transposition = 0; +#ifndef VERSION_SH seqPlayer->muteBehavior = MUTE_BEHAVIOR_STOP_SCRIPT | MUTE_BEHAVIOR_STOP_NOTES | MUTE_BEHAVIOR_SOFTEN; +#endif seqPlayer->noteAllocPolicy = 0; seqPlayer->shortNoteVelocityTable = gDefaultShortNoteVelocityTable; seqPlayer->shortNoteDurationTable = gDefaultShortNoteDurationTable; seqPlayer->fadeVolume = 1.0f; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) seqPlayer->fadeVolumeScale = 1.0f; #endif seqPlayer->fadeVelocity = 0.0f; @@ -2208,7 +2918,7 @@ void init_sequence_players(void) { for (i = 0; i < ARRAY_COUNT(gSequenceChannels); i++) { gSequenceChannels[i].seqPlayer = NULL; gSequenceChannels[i].enabled = FALSE; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) } for (i = 0; i < ARRAY_COUNT(gSequenceChannels); i++) { @@ -2238,10 +2948,15 @@ void init_sequence_players(void) { gSequencePlayers[i].channels[j] = &gSequenceChannelNone; } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) gSequencePlayers[i].seqVariationEu[0] = -1; #else gSequencePlayers[i].seqVariation = -1; +#endif +#ifdef VERSION_SH + gSequencePlayers[i].muteBehavior = MUTE_BEHAVIOR_STOP_SCRIPT | MUTE_BEHAVIOR_STOP_NOTES | MUTE_BEHAVIOR_SOFTEN; + gSequencePlayers[i].enabled = FALSE; + gSequencePlayers[i].muted = FALSE; #endif gSequencePlayers[i].bankDmaInProgress = FALSE; gSequencePlayers[i].seqDmaInProgress = FALSE; @@ -2253,3 +2968,4 @@ void init_sequence_players(void) { init_sequence_player(i); } } + diff --git a/src/audio/shindou_debug_prints.c b/src/audio/shindou_debug_prints.c new file mode 100644 index 00000000..5f85e24a --- /dev/null +++ b/src/audio/shindou_debug_prints.c @@ -0,0 +1,138 @@ +#include + +#ifdef VERSION_SH +// The first four debug prints are in data.c. +char shindouDebugPrint5[] = "Warning:Kill Note %x \n"; +char shindouDebugPrint6[] = "Kill Voice %d (ID %d) %d\n"; +char shindouDebugPrint7[] = "Warning: Running Sequence's data disappear!\n"; +char shindouDebugPrint8[] = "%x %x %x\n"; +char shindouDebugPrint9[] = "Audio:Memory:Heap OverFlow : Not Allocate %d!\n"; +char shindouDebugPrint10[] = "%x %x %x\n"; // Again +char shindouDebugPrint11[] = "Audio:Memory:Heap OverFlow : Not Allocate %d!\n"; // Again +char shindouDebugPrint12[] = "Audio:Memory:DataHeap Not Allocate \n"; +char shindouDebugPrint13[] = "StayHeap Not Allocate %d\n"; +char shindouDebugPrint14[] = "AutoHeap Not Allocate %d\n"; +char shindouDebugPrint15[] = "Status ID0 : %d ID1 : %d\n"; +char shindouDebugPrint16[] = "id 0 is Stopping\n"; +char shindouDebugPrint17[] = "id 0 is Stop\n"; +char shindouDebugPrint18[] = "id 1 is Stopping\n"; +char shindouDebugPrint19[] = "id 1 is Stop\n"; +char shindouDebugPrint20[] = "WARNING: NO FREE AUTOSEQ AREA.\n"; +char shindouDebugPrint21[] = "WARNING: NO STOP AUTO AREA.\n"; +char shindouDebugPrint22[] = " AND TRY FORCE TO STOP SIDE \n"; +char shindouDebugPrint23[] = "Check ID0 (seq ID %d) Useing ...\n"; +char shindouDebugPrint24[] = "Check ID1 (seq ID %d) Useing ...\n"; +char shindouDebugPrint25[] = "No Free Seq area.\n"; +char shindouDebugPrint26[] = "CH %d: ID %d\n"; +char shindouDebugPrint27[] = "TWO SIDES ARE LOADING... ALLOC CANCELED.\n"; +char shindouDebugPrint28[] = "WARNING: Before Area Overlaid After."; +char shindouDebugPrint29[] = "WARNING: After Area Overlaid Before."; +char shindouDebugPrint30[] = "MEMORY:SzHeapAlloc ERROR: sza->side %d\n"; +char shindouDebugPrint31[] = "Audio:MEMORY:SzHeap Overflow error. (%d bytes)\n"; +char shindouDebugPrint32[] = "Auto Heap Unhit for ID %d\n"; +char shindouDebugPrint33[] = "Heap Reconstruct Start %x\n"; +char shindouDebugPrint34[] = "---------------------------------------TEMPO %d %f\n"; +char shindouDebugPrint35[] = "%f \n"; +char shindouDebugPrint36[] = "%f \n"; // Again +char shindouDebugPrint37[] = "AHPBASE %x\n"; +char shindouDebugPrint38[] = "AHPCUR %x\n"; +char shindouDebugPrint39[] = "HeapTop %x\n"; +char shindouDebugPrint40[] = "SynoutRate %d / %d \n"; +char shindouDebugPrint41[] = "FXSIZE %d\n"; +char shindouDebugPrint42[] = "FXCOMP %d\n"; +char shindouDebugPrint43[] = "FXDOWN %d\n"; +char shindouDebugPrint44[] = "WaveCacheLen: %d\n"; +char shindouDebugPrint45[] = "SpecChange Finished\n"; +char shindouDebugPrint46[] = "Warning:Emem Over,not alloc %d\n"; +char shindouDebugPrint47[] = "Single AutoSize %d\n"; +char shindouDebugPrint48[] = "Single Ptr %x\n"; +char shindouDebugPrint49[] = "Request--------Single-Auto, %d\n"; +char shindouDebugPrint50[] = "Retry %x, %x, len %x\n"; +char shindouDebugPrint51[] = "DMAing list %d is killed.\n"; +char shindouDebugPrint52[] = "Try Kill %d \n"; +char shindouDebugPrint53[] = "Try Kill %x %x\n"; +char shindouDebugPrint54[] = "Try Kill %x %x %x\n"; +char shindouDebugPrint55[] = "Rom back %x %x \n"; +char shindouDebugPrint56[] = "Error sw NULL \n"; +char shindouDebugPrint57[] = "Request--------Single-Stay, %d\n"; +char shindouDebugPrint58[] = "Try Kill %d \n"; +char shindouDebugPrint59[] = "Try Kill %x %x\n"; +char shindouDebugPrint60[] = "Try Kill %x %x %x\n"; +// Zero padding here. These aren't used variables, so they could be either unused variables or a file boundary. +s32 shindouDebugPrintPadding[] = {0, 0, 0}; +char shindouDebugPrint61[] = "CAUTION:WAVE CACHE FULL %d"; +char shindouDebugPrint62[] = "SUPERDMA"; +char shindouDebugPrint63[] = "Bank Change... top %d lba %d\n"; +char shindouDebugPrint64[] = "BankCount %d\n"; +char shindouDebugPrint65[] = "BANK LOAD MISS! FOR %d\n"; +char shindouDebugPrint66[] = "BankCount %d\n"; +char shindouDebugPrint67[] = "Flush Start\n"; +char shindouDebugPrint68[] = "%d ->%d\n"; +char shindouDebugPrint69[] = "useflag %d\n"; +char shindouDebugPrint70[] = "BankCount %d\n"; +char shindouDebugPrint71[] = "%2x "; +char shindouDebugPrint72[] = "StartSeq (Group %d,Seq %d) Process finish\n"; +char shindouDebugPrint73[] = "LoadCtrl, Ptr %x and Media is %d\n"; +char shindouDebugPrint74[] = "Load Bank, Type %d , ID %d\n"; +char shindouDebugPrint75[] = "get auto\n"; +char shindouDebugPrint76[] = "get s-auto %x\n"; +char shindouDebugPrint77[] = "Seq %d Write ID OK %d!\n"; +char shindouDebugPrint78[] = "Banknumber %d\n"; +char shindouDebugPrint79[] = "Bank Offset %x %d %d\n"; +char shindouDebugPrint80[] = "PEP Touch %x \n"; +char shindouDebugPrint81[] = "FastCopy"; +char shindouDebugPrint82[] = "FastCopy"; +char shindouDebugPrint83[] = "Error: Cannot DMA Media [%d]\n"; +char shindouDebugPrint84[] = "Warning: size not align 16 %x (%s)\n"; +char shindouDebugPrint85[] = "Load Bank BG, Type %d , ID %d\n"; +char shindouDebugPrint86[] = "get auto\n"; +char shindouDebugPrint87[] = "get s-auto %x\n"; +char shindouDebugPrint88[] = "Clear Workarea %x -%x size %x \n"; +char shindouDebugPrint89[] = "AudioHeap is %x\n"; +char shindouDebugPrint90[] = "Heap reset.Synth Change %x \n"; +char shindouDebugPrint91[] = "Heap %x %x %x\n"; +char shindouDebugPrint92[] = "Main Heap Initialize.\n"; +char shindouDebugPrint93[] = "%d :WaveA %d WaveB %d Inst %d,Perc %d\n"; +char shindouDebugPrint94[] = "---------- Init Completed. ------------\n"; +char shindouDebugPrint95[] = " Syndrv :[%6d]\n"; +char shindouDebugPrint96[] = " Seqdrv :[%6d]\n"; +char shindouDebugPrint97[] = " audiodata :[%6d]\n"; +char shindouDebugPrint98[] = "---------------------------------------\n"; +char shindouDebugPrint99[] = "Entry--- %d %d\n"; +char shindouDebugPrint100[] = "---Block LPS here\n"; +char shindouDebugPrint101[] = "===Block LPS end\n"; +char shindouDebugPrint102[] = "SLOWCOPY"; +char shindouDebugPrint103[] = "Req: Src %x Dest %x Len %x,media %d,retcode %d\n"; +char shindouDebugPrint104[] = "Remain Size %d\n"; +char shindouDebugPrint105[] = "---Block BG here\n"; +char shindouDebugPrint106[] = "===Block BG end\n"; +char shindouDebugPrint107[] = "Retcode %x\n"; +char shindouDebugPrint108[] = "Other Type: Not Write ID.\n"; +char shindouDebugPrint109[] = "BGLOAD:Error: dma length 0\n"; +char shindouDebugPrint110[] = "BGCOPY"; +char shindouDebugPrint111[] = "Error: Already wavetable is touched %x.\n"; +char shindouDebugPrint112[] = "Touch Warning: Length zero %x\n"; +char shindouDebugPrint113[] = "It's busy now!!!!! %d\n"; // This one's my favorite +char shindouDebugPrint114[] = "BG LOAD BUFFER is OVER.\n"; +char shindouDebugPrint115[] = "Warning: Length zero %x\n"; +char shindouDebugPrint116[] = "Wave Load %d \n"; +char shindouDebugPrint117[] = "Total Bg Wave Load %d \n"; +char shindouDebugPrint118[] = "Receive %d\n"; +char shindouDebugPrint119[] = "============Error: Magic is Broken after loading.\n"; +char shindouDebugPrint120[] = "Remain DMA: %d\n"; +char shindouDebugPrint121[] = "N start %d\n"; +char shindouDebugPrint122[] = "============Error: Magic is Broken: %x\n"; +char shindouDebugPrint123[] = "Error: No Handle.\n"; +char shindouDebugPrint124[] = "Success: %x\n"; +char shindouDebugPrint125[] = "DAC:Lost 1 Frame.\n"; +char shindouDebugPrint126[] = "DMA: Request queue over.( %d )\n"; +char shindouDebugPrint127[] = "Spec Change Override. %d -> %d\n"; +char shindouDebugPrint128[] = "Audio:now-max tasklen is %d / %d\n"; +char shindouDebugPrint129[] = "Audio:Warning:ABI Tasklist length over (%d)\n"; +s32 D_SH_80314FC8 = 0x80; +struct SPTask *D_SH_80314FCC = NULL; +char shindouDebugPrint130[] = "BGLOAD Start %d\n"; +char shindouDebugPrint131[] = "Error: OverFlow Your Request\n"; +char shindouDebugPrint132[] = "---AudioSending (%d->%d) \n"; +// These continue in unk_shindou_audio_file.c +#endif diff --git a/src/audio/synthesis.c b/src/audio/synthesis.c index c89f8273..862d5123 100644 --- a/src/audio/synthesis.c +++ b/src/audio/synthesis.c @@ -9,10 +9,11 @@ #include "../pc/mixer.h" +#ifndef VERSION_SH #define DMEM_ADDR_TEMP 0x0 -#define DMEM_ADDR_UNCOMPRESSED_NOTE 0x180 #define DMEM_ADDR_RESAMPLED 0x20 #define DMEM_ADDR_RESAMPLED2 0x160 +#define DMEM_ADDR_UNCOMPRESSED_NOTE 0x180 #define DMEM_ADDR_NOTE_PAN_TEMP 0x200 #define DMEM_ADDR_STEREO_STRONG_TEMP_DRY 0x200 #define DMEM_ADDR_STEREO_STRONG_TEMP_WET 0x340 @@ -21,6 +22,18 @@ #define DMEM_ADDR_RIGHT_CH 0x600 #define DMEM_ADDR_WET_LEFT_CH 0x740 #define DMEM_ADDR_WET_RIGHT_CH 0x880 +#else +#define DMEM_ADDR_TEMP 0x450 +#define DMEM_ADDR_RESAMPLED 0x470 +#define DMEM_ADDR_RESAMPLED2 0x5f0 +#define DMEM_ADDR_UNCOMPRESSED_NOTE 0x5f0 +#define DMEM_ADDR_NOTE_PAN_TEMP 0x650 +#define DMEM_ADDR_COMPRESSED_ADPCM_DATA 0x990 +#define DMEM_ADDR_LEFT_CH 0x990 +#define DMEM_ADDR_RIGHT_CH 0xb10 +#define DMEM_ADDR_WET_LEFT_CH 0xc90 +#define DMEM_ADDR_WET_RIGHT_CH 0xe10 +#endif #define aSetLoadBufferPair(pkt, c, off) \ aSetBuffer(pkt, 0, c + DMEM_ADDR_WET_LEFT_CH, 0, DEFAULT_LEN_1CH - c); \ @@ -43,9 +56,13 @@ struct VolumeChange { u16 targetRight; }; -u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateIndex); -#ifdef VERSION_EU -u64 *synthesis_process_note(struct Note *note, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s16 *aiBuf, s32 bufLen, u64 *cmd); +u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex); +#if defined(VERSION_EU) || defined(VERSION_SH) +#ifdef VERSION_SH +u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, u16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex); +#else +u64 *synthesis_process_note(struct Note *note, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, u16 *aiBuf, s32 bufLen, u64 *cmd); +#endif u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad); u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags); u64 *process_envelope(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, u32 flags); @@ -61,13 +78,25 @@ u64 *process_envelope_inner(u64 *cmd, struct Note *note, s32 nSamples, u16 inBuf u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32 flags, s32 leftRight); #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) struct SynthesisReverb gSynthesisReverbs[4]; u8 sAudioSynthesisPad[0x10]; +#else +struct SynthesisReverb gSynthesisReverb; +u8 sAudioSynthesisPad[0x20]; +#endif + +#if defined(VERSION_EU) || defined(VERSION_SH) s16 gVolume; s8 gUseReverb; s8 gNumSynthesisReverbs; +#ifdef VERSION_SH +s16 D_SH_803479B4; // contains 4096 +#endif struct NoteSubEu *gNoteSubsEu; +#endif + +#ifdef VERSION_EU f32 gLeftVolRampings[3][1024]; f32 gRightVolRampings[3][1024]; f32 *gCurrentLeftVolRamping; // Points to any of the three left buffers above @@ -75,13 +104,9 @@ f32 *gCurrentRightVolRamping; // Points to any of the three right buffers above u8 audioString1[] = "pitch %x: delaybytes %d : olddelay %d\n"; u8 audioString2[] = "cont %x: delaybytes %d : olddelay %d\n"; - -#else -struct SynthesisReverb gSynthesisReverb; -u8 sAudioSynthesisPad[0x20]; #endif -#if defined(VERSION_EU) +#if defined(VERSION_EU) || defined(VERSION_SH) // Equivalent functionality as the US/JP version, // just that the reverb structure is chosen from an array with index void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex) { @@ -190,29 +215,59 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex) { } #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) u64 *synthesis_load_reverb_ring_buffer(u64 *cmd, u16 addr, u16 srcOffset, s32 len, s32 reverbIndex) { - // aSetBuffer, aLoadBuffer, aSetBuffer, aLoadBuffer +#ifdef VERSION_SH + aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[srcOffset]), + addr, len); + aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.right[srcOffset]), + addr + DEFAULT_LEN_1CH, len); +#else aSetBuffer(cmd++, 0, addr, 0, len); aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[srcOffset])); aSetBuffer(cmd++, 0, addr + DEFAULT_LEN_1CH, 0, len); aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.right[srcOffset])); +#endif return cmd; } +#endif - +#if defined(VERSION_EU) || defined(VERSION_SH) u64 *synthesis_save_reverb_ring_buffer(u64 *cmd, u16 addr, u16 destOffset, s32 len, s32 reverbIndex) { +#ifdef VERSION_SH + aSaveBuffer(cmd++, addr, + VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[destOffset]), len); + aSaveBuffer(cmd++, addr + DEFAULT_LEN_1CH, + VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.right[destOffset]), len); +#else aSetBuffer(cmd++, 0, 0, addr, len); aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[destOffset])); aSetBuffer(cmd++, 0, 0, addr + DEFAULT_LEN_1CH, len); aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.right[destOffset])); +#endif return cmd; } +#endif +#if defined(VERSION_SH) +void func_sh_802ed644(s32 updateIndexStart, s32 noteIndex) { + s32 i; + + for (i = updateIndexStart + 1; i < gAudioBufferParameters.updatesPerFrame; i++) { + if (!gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].needsInit) { + gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].enabled = FALSE; + } else { + break; + } + } +} +#endif + +#if defined(VERSION_EU) || defined(VERSION_SH) void synthesis_load_note_subs_eu(s32 updateIndex) { struct NoteSubEu *src; struct NoteSubEu *dest; @@ -223,15 +278,15 @@ void synthesis_load_note_subs_eu(s32 updateIndex) { dest = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i]; if (src->enabled) { *dest = *src; - src->needsInit = 0; + src->needsInit = FALSE; } else { - dest->enabled = 0; + dest->enabled = FALSE; } } } #endif -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) s32 get_volume_ramping(u16 sourceVol, u16 targetVol, s32 arg2) { // This roughly computes 2^16 * (targetVol / sourceVol) ^ (8 / arg2), // but with discretizations of targetVol, sourceVol and arg2. @@ -254,24 +309,43 @@ s32 get_volume_ramping(u16 sourceVol, u16 targetVol, s32 arg2) { } #endif -#ifdef VERSION_EU -//TODO: (Scrub C) pointless mask and whitespace +#if defined(VERSION_EU) || defined(VERSION_SH) +// TODO: (Scrub C) pointless mask and whitespace u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) { s32 i, j; +#ifndef VERSION_SH f32 *leftVolRamp; f32 *rightVolRamp; +#endif u32 *aiBufPtr; u64 *cmd = cmdBuf; s32 chunkLen; +#ifndef VERSION_SH s32 nextVolRampTable; +#endif for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) { process_sequences(i - 1); synthesis_load_note_subs_eu(gAudioBufferParameters.updatesPerFrame - i); } +#ifndef VERSION_SH aSegment(cmd++, 0, 0); +#endif aiBufPtr = (u32 *) aiBuf; for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) { +#ifdef VERSION_SH + if (i == 1) { + chunkLen = bufLen; + } else { + if (bufLen / i >= gAudioBufferParameters.samplesPerUpdateMax) { + chunkLen = gAudioBufferParameters.samplesPerUpdateMax; + } else if (bufLen / i <= gAudioBufferParameters.samplesPerUpdateMin) { + chunkLen = gAudioBufferParameters.samplesPerUpdateMin; + } else { + chunkLen = gAudioBufferParameters.samplesPerUpdate; + } + } +#else if (i == 1) { // self-assignment has no affect when added here, could possibly simplify a macro definition chunkLen = bufLen; nextVolRampTable = nextVolRampTable; leftVolRamp = gLeftVolRampings[nextVolRampTable]; rightVolRamp = gRightVolRampings[nextVolRampTable & 0xFFFFFFFF]; @@ -286,6 +360,7 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) { } gCurrentLeftVolRamping = leftVolRamp; gCurrentRightVolRamping = rightVolRamp; +#endif for (j = 0; j < gNumSynthesisReverbs; j++) { if (gSynthesisReverbs[j].useReverb != 0) { prepare_reverb_ring_buffer(chunkLen, gAudioBufferParameters.updatesPerFrame - i, j); @@ -347,7 +422,7 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) { #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s16 updateIndex) { struct ReverbRingBufferItem *item; s16 startPad; @@ -355,15 +430,22 @@ u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s1 item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex]; +#ifndef VERSION_SH aClearBuffer(cmd++, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH); +#endif if (gSynthesisReverbs[reverbIndex].downsampleRate == 1) { cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex); if (item->lengthB != 0) { cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex); } +#ifdef VERSION_SH + aAddMixer(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH); + aMix(cmd++, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH); +#else aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH); aMix(cmd++, 0, 0x7fff, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH); aMix(cmd++, 0, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH); +#endif } else { startPad = (item->startPos % 8u) * 2; paddedLengthA = ALIGN(startPad + item->lengthA, 4); @@ -379,45 +461,116 @@ u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s1 aSetBuffer(cmd++, 0, DMEM_ADDR_RESAMPLED2 + startPad, DMEM_ADDR_WET_RIGHT_CH, bufLen * 2); aResample(cmd++, gSynthesisReverbs[reverbIndex].resampleFlags, gSynthesisReverbs[reverbIndex].resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].resampleStateRight)); +#ifdef VERSION_SH + aAddMixer(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH); + aMix(cmd++, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH); +#else aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH); aMix(cmd++, 0, 0x7fff, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH); aMix(cmd++, 0, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH); +#endif + } +#ifdef VERSION_SH + if (gSynthesisReverbs[reverbIndex].panRight != 0 || gSynthesisReverbs[reverbIndex].panLeft != 0) { + // Leak some audio from the left reverb channel into the right reverb channel and vice versa (pan) + aDMEMMove(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_RESAMPLED, DEFAULT_LEN_1CH); + aMix(cmd++, gSynthesisReverbs[reverbIndex].panRight, DMEM_ADDR_WET_RIGHT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_1CH); + aMix(cmd++, gSynthesisReverbs[reverbIndex].panLeft, DMEM_ADDR_RESAMPLED, DMEM_ADDR_WET_RIGHT_CH, DEFAULT_LEN_1CH); + } +#endif + return cmd; +} +#endif + +#if defined(VERSION_SH) +u64 *synthesis_load_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) { + struct ReverbRingBufferItem *item; + struct SynthesisReverb *reverb; + + reverb = &gSynthesisReverbs[reverbIndex]; + item = &reverb->items[reverb->curFrame][updateIndex]; + // Get the oldest samples in the ring buffer into the wet channels + cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, item->startPos, item->lengthA, reverbIndex); + if (item->lengthB != 0) { + // Ring buffer wrapped + cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + item->lengthA, 0, item->lengthB, reverbIndex); + } + return cmd; +} +#endif + +#if defined(VERSION_EU) +u64 *synthesis_save_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) { + struct ReverbRingBufferItem *item; + + item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex]; + if (gSynthesisReverbs[reverbIndex].useReverb != 0) { + switch (gSynthesisReverbs[reverbIndex].downsampleRate) { + case 1: + // Put the oldest samples in the ring buffer into the wet channels + cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex); + if (item->lengthB != 0) { + // Ring buffer wrapped + cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex); + } + break; + + default: + // Downsampling is done later by CPU when RSP is done, therefore we need to have double + // buffering. Left and right buffers are adjacent in memory. + aSetBuffer(cmd++, 0, 0, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH); + aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex].toDownsampleLeft)); + gSynthesisReverbs[reverbIndex].resampleFlags = 0; + break; + } + } + return cmd; +} +#elif defined(VERSION_SH) +u64 *synthesis_save_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) { + struct ReverbRingBufferItem *item; + + item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex]; + switch (gSynthesisReverbs[reverbIndex].downsampleRate) { + case 1: + // Put the oldest samples in the ring buffer into the wet channels + cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex); + if (item->lengthB != 0) { + // Ring buffer wrapped + cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex); + } + break; + + default: + // Downsampling is done later by CPU when RSP is done, therefore we need to have double + // buffering. Left and right buffers are adjacent in memory. + aSaveBuffer(cmd++, DMEM_ADDR_WET_LEFT_CH, + VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex].toDownsampleLeft), DEFAULT_LEN_2CH); + break; + } + gSynthesisReverbs[reverbIndex].resampleFlags = 0; + return cmd; +} + +u64 *func_sh_802EDF24(u64 *cmd, s16 reverbIndex, s16 updateIndex) { + struct ReverbRingBufferItem *item; + struct SynthesisReverb *reverb; + + reverb = &gSynthesisReverbs[reverbIndex]; + item = &reverb->items[reverb->curFrame][updateIndex]; + // Put the oldest samples in the ring buffer into the wet channels + cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, item->startPos, item->lengthA, reverbIndex); + if (item->lengthB != 0) { + // Ring buffer wrapped + cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + item->lengthA, 0, item->lengthB, reverbIndex); } return cmd; } -u64 *synthesis_save_reverb_samples(u64 *cmdBuf, s16 reverbIndex, s16 updateIndex) { - struct ReverbRingBufferItem *item; - struct SynthesisReverb *reverb; - u64 *cmd = cmdBuf; - - reverb = &gSynthesisReverbs[reverbIndex]; - item = &reverb->items[reverb->curFrame][updateIndex]; - if (reverb->useReverb != 0) { - if (1) { - } - if (reverb->downsampleRate == 1) { - // Put the oldest samples in the ring buffer into the wet channels - cmd = cmdBuf = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex); - if (item->lengthB != 0) { - // Ring buffer wrapped - cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex); - cmdBuf = cmd; - } - } else { - // Downsampling is done later by CPU when RSP is done, therefore we need to have double - // buffering. Left and right buffers are adjacent in memory. - aSetBuffer(cmdBuf++, 0, 0, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH); - aSaveBuffer(cmdBuf++, VIRTUAL_TO_PHYSICAL2(reverb->items[reverb->curFrame][updateIndex].toDownsampleLeft)); - reverb->resampleFlags = 0; - } - } - return cmdBuf; -} #endif -#ifdef VERSION_EU -u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateIndex) { +#if defined(VERSION_EU) || defined(VERSION_SH) +u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex) { struct NoteSubEu *noteSubEu; u8 noteIndices[56]; s32 temp; @@ -427,16 +580,14 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI if (gNumSynthesisReverbs == 0) { for (i = 0; i < gMaxSimultaneousNotes; i++) { - temp = updateIndex; - if (gNoteSubsEu[gMaxSimultaneousNotes * temp + i].enabled) { + if (gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i].enabled) { noteIndices[notePos++] = i; } } } else { for (j = 0; j < gNumSynthesisReverbs; j++) { for (i = 0; i < gMaxSimultaneousNotes; i++) { - temp = updateIndex; - noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * temp + i]; + noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i]; if (noteSubEu->enabled && j == noteSubEu->reverbIndex) { noteIndices[notePos++] = i; } @@ -444,8 +595,7 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI } for (i = 0; i < gMaxSimultaneousNotes; i++) { - temp = updateIndex; - noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * temp + i]; + noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i]; if (noteSubEu->enabled && noteSubEu->reverbIndex >= gNumSynthesisReverbs) { noteIndices[notePos++] = i; } @@ -459,25 +609,56 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI cmd = synthesis_resample_and_mix_reverb(cmd, bufLen, j, updateIndex); } for (; i < notePos; i++) { - temp = updateIndex; - temp *= gMaxSimultaneousNotes; + temp = updateIndex * gMaxSimultaneousNotes; if (j == gNoteSubsEu[temp + noteIndices[i]].reverbIndex) { +#ifdef VERSION_SH + cmd = synthesis_process_note(noteIndices[i], + &gNoteSubsEu[temp + noteIndices[i]], + &gNotes[noteIndices[i]].synthesisState, + aiBuf, bufLen, cmd, updateIndex); +#else cmd = synthesis_process_note(&gNotes[noteIndices[i]], &gNoteSubsEu[temp + noteIndices[i]], &gNotes[noteIndices[i]].synthesisState, aiBuf, bufLen, cmd); +#endif continue; } else { break; } } if (gSynthesisReverbs[j].useReverb != 0) { +#ifdef VERSION_SH + if (gSynthesisReverbs[j].unk100 != NULL) { + aFilter(cmd++, 0x02, bufLen * 2, gSynthesisReverbs[j].unk100); + aFilter(cmd++, gSynthesisReverbs[j].resampleFlags, DMEM_ADDR_WET_LEFT_CH, gSynthesisReverbs[j].unk108); + } + if (gSynthesisReverbs[j].unk104 != NULL) { + aFilter(cmd++, 0x02, bufLen * 2, gSynthesisReverbs[j].unk104); + aFilter(cmd++, gSynthesisReverbs[j].resampleFlags, DMEM_ADDR_WET_RIGHT_CH, gSynthesisReverbs[j].unk10C); + } +#endif cmd = synthesis_save_reverb_samples(cmd, j, updateIndex); +#ifdef VERSION_SH + if (gSynthesisReverbs[j].unk5 != -1) { + if (gSynthesisReverbs[gSynthesisReverbs[j].unk5].downsampleRate == 1) { + cmd = synthesis_load_reverb_samples(cmd, gSynthesisReverbs[j].unk5, updateIndex); + aMix(cmd++, gSynthesisReverbs[j].unk08, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_RESAMPLED, DEFAULT_LEN_2CH); + cmd = func_sh_802EDF24(cmd++, gSynthesisReverbs[j].unk5, updateIndex); + } + } +#endif } } for (; i < notePos; i++) { - temp = updateIndex; - temp *= gMaxSimultaneousNotes; +#ifdef VERSION_SH + struct NoteSubEu *noteSubEu2 = &gNoteSubsEu[updateIndex * gMaxSimultaneousNotes + noteIndices[i]]; + cmd = synthesis_process_note(noteIndices[i], + noteSubEu2, + &gNotes[noteIndices[i]].synthesisState, + aiBuf, bufLen, cmd, updateIndex); +#else + temp = updateIndex * gMaxSimultaneousNotes; if (IS_BANK_LOAD_COMPLETE(gNoteSubsEu[temp + noteIndices[i]].bankId) == TRUE) { cmd = synthesis_process_note(&gNotes[noteIndices[i]], &gNoteSubsEu[temp + noteIndices[i]], @@ -486,17 +667,23 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI } else { gAudioErrorFlags = (gNoteSubsEu[temp + noteIndices[i]].bankId + (i << 8)) + 0x10000000; } +#endif } temp = bufLen * 2; +#ifdef VERSION_SH + aInterleave(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_LEFT_CH, DMEM_ADDR_RIGHT_CH, temp); + aSaveBuffer(cmd++, DMEM_ADDR_TEMP, VIRTUAL_TO_PHYSICAL2(aiBuf), temp * 2); +#else aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, temp); aInterleave(cmd++, DMEM_ADDR_LEFT_CH, DMEM_ADDR_RIGHT_CH); aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, temp * 2); aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(aiBuf)); +#endif return cmd; } -#else -u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateIndex) { +#elif defined(VERSION_JP) || defined(VERSION_US) +u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex) { UNUSED s32 pad1[1]; s16 ra; s16 t4; @@ -571,9 +758,10 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI } #endif -#ifdef VERSION_EU +#ifndef VERSION_SH +#if defined(VERSION_EU) // Processes just one note, not all -u64 *synthesis_process_note(struct Note *note, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, UNUSED s16 *aiBuf, s32 bufLen, u64 *cmd) { +u64 *synthesis_process_note(struct Note *note, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, u16 *aiBuf, s32 bufLen, u64 *cmd) { UNUSED s32 pad0[3]; #else u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { @@ -584,22 +772,22 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { struct AudioBankSample *audioBookSample; // sp164, sp138 struct AdpcmLoop *loopInfo; // sp160, sp134 s16 *curLoadedBook = NULL; // sp154, sp130 -#ifdef VERSION_EU +#if defined(VERSION_EU) UNUSED u8 padEU[0x04]; #endif UNUSED u8 pad8[0x04]; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) u16 resamplingRateFixedPoint; // sp5c, sp11A #endif s32 noteFinished; // 150 t2, sp124 s32 restart; // 14c t3, sp120 s32 flags; // sp148, sp11C -#ifdef VERSION_EU +#if defined(VERSION_EU) u16 resamplingRateFixedPoint; // sp5c, sp11A #endif UNUSED u8 pad7[0x0c]; // sp100 UNUSED s32 tempBufLen; -#ifdef VERSION_EU +#if defined(VERSION_EU) s32 sp130 = 0; //sp128, sp104 UNUSED u32 pad9; #else @@ -608,7 +796,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { #endif s32 nAdpcmSamplesProcessed; // signed required for US s32 t0; -#ifdef VERSION_EU +#if defined(VERSION_EU) u8 *sampleAddr; // sp120, spF4 s32 s6; #else @@ -616,7 +804,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { u8 *sampleAddr; // sp120, spF4 #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) s32 samplesLenAdjusted; // 108, spEC // Might have been used to store (samplesLenFixedPoint >> 0x10), but doing so causes strange // behavior with the break near the end of the loop, causing US and JP to need a goto instead @@ -634,33 +822,33 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { s32 nSamplesToProcess; // sp10c/a0, spE0 #endif - s32 s0; + s32 leftRight; s32 s3; s32 s5; //s4 u32 samplesLenFixedPoint; // v1_1 s32 nSamplesInThisIteration; // v1_2 u32 a3; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) s32 t9; #endif u8 *v0_2; s32 nParts; // spE8, spBC s32 curPart; // spE4, spB8 -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) f32 resamplingRate; // f12 #endif s32 temp; -#ifdef VERSION_EU +#if defined(VERSION_EU) s32 s5Aligned; #endif s32 resampledTempLen; // spD8, spAC u16 noteSamplesDmemAddrBeforeResampling; // spD6, spAA -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) for (noteIndex = 0; noteIndex < gMaxSimultaneousNotes; noteIndex++) { note = &gNotes[noteIndex]; #ifdef VERSION_US @@ -678,17 +866,17 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { } else { #endif flags = 0; -#ifdef VERSION_EU +#if defined(VERSION_EU) tempBufLen = bufLen; #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) if (noteSubEu->needsInit == TRUE) { #else if (note->needsInit == TRUE) { #endif flags = A_INIT; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) note->samplePosInt = 0; note->samplePosFrac = 0; #else @@ -702,7 +890,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { #endif } -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) if (note->frequency < US_FLOAT(2.0)) { nParts = 1; if (note->frequency > US_FLOAT(1.99996)) { @@ -728,7 +916,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { synthesisState->samplePosFrac = samplesLenFixedPoint & 0xFFFF; #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) if (noteSubEu->isSyntheticWave) { cmd = load_wave_samples(cmd, noteSubEu, synthesisState, samplesLenFixedPoint >> 0x10); noteSamplesDmemAddrBeforeResampling = (synthesisState->samplePosInt * 2) + DMEM_ADDR_UNCOMPRESSED_NOTE; @@ -747,7 +935,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { else { // ADPCM note -#ifdef VERSION_EU +#if defined(VERSION_EU) audioBookSample = noteSubEu->sound.audioBankSound->sample; #else audioBookSample = note->sound->sample; @@ -773,7 +961,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { if (curLoadedBook != audioBookSample->book->book) { u32 nEntries; // v1 curLoadedBook = audioBookSample->book->book; -#ifdef VERSION_EU +#if defined(VERSION_EU) nEntries = 16 * audioBookSample->book->order * audioBookSample->book->npredictors; aLoadADPCM(cmd++, nEntries, VIRTUAL_TO_PHYSICAL2(curLoadedBook + noteSubEu->bookOffset)); #else @@ -782,9 +970,9 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { #endif } -#ifdef VERSION_EU +#if defined(VERSION_EU) if (noteSubEu->bookOffset) { - curLoadedBook = (s16 *) &euUnknownData_80301950; // what's this? never read + curLoadedBook = euUnknownData_80301950; // what's this? never read } #endif @@ -795,7 +983,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { noteFinished = FALSE; restart = FALSE; nSamplesToProcess = samplesLenAdjusted - nAdpcmSamplesProcessed; -#ifdef VERSION_EU +#if defined(VERSION_EU) s2 = synthesisState->samplePosInt & 0xf; samplesRemaining = endPos - synthesisState->samplePosInt; #else @@ -803,7 +991,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { samplesRemaining = endPos - note->samplePosInt; #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) if (s2 == 0 && synthesisState->restart == FALSE) { s2 = 16; } @@ -819,7 +1007,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { s0 = t0 * 16; s3 = s6 + s0 - nSamplesToProcess; } else { -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) s0 = samplesRemaining + s2 - 0x10; #else s0 = samplesRemaining - s6; @@ -839,7 +1027,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { } if (t0 != 0) { -#ifdef VERSION_EU +#if defined(VERSION_EU) temp = (synthesisState->samplePosInt - s2 + 0x10) / 16; if (audioBookSample->loaded == 0x81) { v0_2 = sampleAddr + temp * 9; @@ -862,7 +1050,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { a3 = 0; } -#ifdef VERSION_EU +#if defined(VERSION_EU) if (synthesisState->restart != FALSE) { aSetLoop(cmd++, VIRTUAL_TO_PHYSICAL2(audioBookSample->loop->state)); flags = A_LOOP; // = 2 @@ -877,7 +1065,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { #endif nSamplesInThisIteration = s0 + s6 - s3; -#ifdef VERSION_EU +#if defined(VERSION_EU) if (nAdpcmSamplesProcessed == 0) { aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3, DMEM_ADDR_UNCOMPRESSED_NOTE, s0 * 2); @@ -930,7 +1118,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { if (noteFinished) { aClearBuffer(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (samplesLenAdjusted - nAdpcmSamplesProcessed) * 2); -#ifdef VERSION_EU +#if defined(VERSION_EU) noteSubEu->finished = 1; note->noteSubEu.finished = 1; note->noteSubEu.enabled = 0; @@ -941,7 +1129,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { #endif break; } -#ifdef VERSION_EU +#if defined(VERSION_EU) if (restart) { synthesisState->restart = TRUE; synthesisState->samplePosInt = loopInfo->start; @@ -967,14 +1155,14 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { switch (curPart) { case 0: aSetBuffer(cmd++, 0, DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, DMEM_ADDR_RESAMPLED, samplesLenAdjusted + 4); -#ifdef VERSION_EU +#if defined(VERSION_EU) aResample(cmd++, A_INIT, 0xff60, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->dummyResampleState)); #else aResample(cmd++, A_INIT, 0xff60, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->dummyResampleState)); #endif resampledTempLen = samplesLenAdjusted + 4; noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_RESAMPLED + 4; -#ifdef VERSION_EU +#if defined(VERSION_EU) if (noteSubEu->finished != FALSE) { #else if (note->finished != FALSE) { @@ -987,7 +1175,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { aSetBuffer(cmd++, 0, DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, DMEM_ADDR_RESAMPLED2, samplesLenAdjusted + 8); -#ifdef VERSION_EU +#if defined(VERSION_EU) aResample(cmd++, A_INIT, 0xff60, VIRTUAL_TO_PHYSICAL2( synthesisState->synthesisBuffers->dummyResampleState)); @@ -1003,7 +1191,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { } } -#ifdef VERSION_EU +#if defined(VERSION_EU) if (noteSubEu->finished != FALSE) { #else if (note->finished != FALSE) { @@ -1015,7 +1203,7 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { flags = 0; -#ifdef VERSION_EU +#if defined(VERSION_EU) if (noteSubEu->needsInit == TRUE) { flags = A_INIT; noteSubEu->needsInit = FALSE; @@ -1033,38 +1221,38 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { noteSamplesDmemAddrBeforeResampling, flags); #endif -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) if (note->headsetPanRight != 0 || note->prevHeadsetPanRight != 0) { - s0 = 1; + leftRight = 1; } else if (note->headsetPanLeft != 0 || note->prevHeadsetPanLeft != 0) { - s0 = 2; + leftRight = 2; #else if (noteSubEu->headsetPanRight != 0 || synthesisState->prevHeadsetPanRight != 0) { - s0 = 1; + leftRight = 1; } else if (noteSubEu->headsetPanLeft != 0 || synthesisState->prevHeadsetPanLeft != 0) { - s0 = 2; + leftRight = 2; #endif } else { - s0 = 0; + leftRight = 0; } -#ifdef VERSION_EU - cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, 0, s0, flags); +#if defined(VERSION_EU) + cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, 0, leftRight, flags); #else - cmd = process_envelope(cmd, note, bufLen, 0, s0, flags); + cmd = process_envelope(cmd, note, bufLen, 0, leftRight, flags); #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) if (noteSubEu->usesHeadsetPanEffects) { - cmd = note_apply_headset_pan_effects(cmd, noteSubEu, synthesisState, bufLen * 2, flags, s0); + cmd = note_apply_headset_pan_effects(cmd, noteSubEu, synthesisState, bufLen * 2, flags, leftRight); } #else if (note->usesHeadsetPanEffects) { - cmd = note_apply_headset_pan_effects(cmd, note, bufLen * 2, flags, s0); + cmd = note_apply_headset_pan_effects(cmd, note, bufLen * 2, flags, leftRight); } #endif } -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) } t9 = bufLen * 2; @@ -1077,24 +1265,389 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) { return cmd; } +#else // VERSION_SH +u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, UNUSED u16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex) { + UNUSED s32 pad0[3]; + struct AudioBankSample *audioBookSample; // sp164, sp138 + struct AdpcmLoop *loopInfo; // sp160, sp134 + s16 *curLoadedBook; // sp154, sp130 + UNUSED u8 padEU[0x04]; + UNUSED u8 pad8[0x04]; + s32 noteFinished; // 150 t2, sp124 + s32 restart; // 14c t3, sp120 + s32 flags; // sp148, sp11C, t8 + u16 resamplingRateFixedPoint; // sp5c, sp11A + s32 nSamplesToLoad; //s0, Ec + UNUSED u8 pad7[0x0c]; // sp100 + s32 sp130; //sp128, sp104 + UNUSED s32 tempBufLen; + UNUSED u32 pad9; + s32 t0; + u8 *sampleAddr; // sp120, spF4 + s32 s6; + s32 samplesLenAdjusted; // 108, spEC + s32 nAdpcmSamplesProcessed; // signed required for US // spc0 + s32 endPos; // sp110, spE4 + s32 nSamplesToProcess; // sp10c/a0, spE0 + // Might have been used to store (samplesLenFixedPoint >> 0x10), but doing so causes strange + // behavior with the break near the end of the loop, causing US and JP to need a goto instead + UNUSED s32 samplesLenInt; + s32 s2; + s32 leftRight; //s0 + s32 s5; //s4 + u32 samplesLenFixedPoint; // v1_1 + s32 s3; // spA0 + s32 nSamplesInThisIteration; // v1_2 + u32 a3; + u8 *v0_2; + s32 unk_s6; // sp90 + s32 s5Aligned; + s32 sp88; + s32 sp84; + u32 temp; + s32 nParts; // spE8, spBC + s32 curPart; // spE4, spB8 + s32 aligned; + UNUSED u32 padSH1; + s32 resampledTempLen; // spD8, spAC, sp6c + u16 noteSamplesDmemAddrBeforeResampling; // spD6, spAA, sp6a -- 6C + UNUSED u32 padSH2; + UNUSED u32 padSH3; + UNUSED u32 padSH4; + struct Note *note; // sp58 + u16 sp56; // sp56 + u16 addr; + u8 bankId; -#ifdef VERSION_EU + curLoadedBook = NULL; + note = &gNotes[noteIndex]; + flags = 0; + if (noteSubEu->needsInit == TRUE) { + flags = A_INIT; + synthesisState->restart = 0; + synthesisState->samplePosInt = 0; + synthesisState->samplePosFrac = 0; + synthesisState->curVolLeft = 0; + synthesisState->curVolRight = 0; + synthesisState->prevHeadsetPanRight = 0; + synthesisState->prevHeadsetPanLeft = 0; + synthesisState->reverbVol = noteSubEu->reverbVol; + synthesisState->unk5 = 0; + note->noteSubEu.finished = 0; + } + + resamplingRateFixedPoint = noteSubEu->resamplingRateFixedPoint; + nParts = noteSubEu->hasTwoAdpcmParts + 1; + samplesLenFixedPoint = (resamplingRateFixedPoint * bufLen * 2) + synthesisState->samplePosFrac; + nSamplesToLoad = (samplesLenFixedPoint >> 0x10); + synthesisState->samplePosFrac = samplesLenFixedPoint & 0xFFFF; + + if ((synthesisState->unk5 == 1) && (nParts == 2)) { + nSamplesToLoad += 2; + sp56 = 2; + } else if ((synthesisState->unk5 == 2) && (nParts == 1)) { + nSamplesToLoad -= 4; + sp56 = 4; + } else { + sp56 = 0; + } + + + synthesisState->unk5 = nParts; + + if (noteSubEu->isSyntheticWave) { + cmd = load_wave_samples(cmd, noteSubEu, synthesisState, nSamplesToLoad); + noteSamplesDmemAddrBeforeResampling = (synthesisState->samplePosInt * 2) + DMEM_ADDR_UNCOMPRESSED_NOTE; + synthesisState->samplePosInt += nSamplesToLoad; + } else { + // ADPCM note + audioBookSample = noteSubEu->sound.audioBankSound->sample; + loopInfo = audioBookSample->loop; + endPos = loopInfo->end; + sampleAddr = audioBookSample->sampleAddr; + resampledTempLen = 0; + for (curPart = 0; curPart < nParts; curPart++) { + nAdpcmSamplesProcessed = 0; // s8 + s5 = 0; // s4 + + if (nParts == 1) { + samplesLenAdjusted = nSamplesToLoad; + } else if (nSamplesToLoad & 1) { + samplesLenAdjusted = (nSamplesToLoad & ~1) + (curPart * 2); + } else { + samplesLenAdjusted = nSamplesToLoad; + } + + if (audioBookSample->codec == 0) { + if (curLoadedBook != (*audioBookSample->book).book) { + u32 nEntries; + switch (noteSubEu->bookOffset) { + case 1: + curLoadedBook = euUnknownData_80301950 + 1; + break; + case 2: + curLoadedBook = euUnknownData_80301950 + 2; + break; + case 3: + default: + curLoadedBook = audioBookSample->book->book; + break; + } + nEntries = 16 * audioBookSample->book->order * audioBookSample->book->npredictors; + aLoadADPCM(cmd++, nEntries, VIRTUAL_TO_PHYSICAL2(curLoadedBook)); + } + } + + while (nAdpcmSamplesProcessed != samplesLenAdjusted) { + s32 samplesRemaining; // v1 + s32 s0; + + noteFinished = FALSE; + restart = FALSE; + s2 = synthesisState->samplePosInt & 0xf; + samplesRemaining = endPos - synthesisState->samplePosInt; + nSamplesToProcess = samplesLenAdjusted - nAdpcmSamplesProcessed; + + if (s2 == 0 && synthesisState->restart == FALSE) { + s2 = 16; + } + s6 = 16 - s2; // a1 + if (nSamplesToProcess < samplesRemaining) { + t0 = (nSamplesToProcess - s6 + 0xf) / 16; + s0 = t0 * 16; + s3 = s6 + s0 - nSamplesToProcess; + } else { + s0 = samplesRemaining - s6; + s3 = 0; + if (s0 <= 0) { + s0 = 0; + s6 = samplesRemaining; + } + t0 = (s0 + 0xf) / 16; + if (loopInfo->count != 0) { + // Loop around and restart + restart = 1; + } else { + noteFinished = 1; + } + } + switch (audioBookSample->codec) { + case 0: + unk_s6 = 9; + sp88 = 0x10; + sp84 = 0; + break; + case 1: + unk_s6 = 0x10; + sp88 = 0x10; + sp84 = 0; + break; + case 2: goto skip; + } + if (t0 != 0) { + temp = (synthesisState->samplePosInt + sp88 - s2) / 16; + if (audioBookSample->medium == 0) { + v0_2 = sp84 + (temp * unk_s6) + sampleAddr; + } else { + v0_2 = dma_sample_data((uintptr_t)(sp84 + (temp * unk_s6) + sampleAddr), + ALIGN(t0 * unk_s6 + 16, 4), flags, &synthesisState->sampleDmaIndex, audioBookSample->medium); + } + + a3 = ((uintptr_t)v0_2 & 0xf); + addr = DMEM_ADDR_COMPRESSED_ADPCM_DATA; + addr -= ALIGN(t0 * unk_s6 + 16, 4); + aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(v0_2 - a3), addr & 0xffff, ALIGN(t0 * unk_s6 + 16, 4)); + } else { + s0 = 0; + a3 = 0; + } + if (synthesisState->restart != FALSE) { + aSetLoop(cmd++, VIRTUAL_TO_PHYSICAL2(audioBookSample->loop->state)); + flags = A_LOOP; // = 2 + synthesisState->restart = FALSE; + } + nSamplesInThisIteration = s0 + s6 - s3; + if (nAdpcmSamplesProcessed == 0) { + switch (audioBookSample->codec) { + case 0: + aligned = ALIGN(t0 * unk_s6 + 16, 4); + //! I have no idea. + addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff; + addr += a3; + aSetBuffer(cmd++, 0, addr, DMEM_ADDR_UNCOMPRESSED_NOTE, s0 * 2); + aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState)); + break; + case 1: + aligned = ALIGN(t0 * unk_s6 + 16, 4); + addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff; + addr += a3; + aSetBuffer(cmd++, 0, addr, DMEM_ADDR_UNCOMPRESSED_NOTE, s0 * 2); + aADPCM_23(cmd++, flags, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState)); + break; + } + sp130 = s2 * 2; + } else { + s5Aligned = ALIGN(s5 + 16, 4); + switch (audioBookSample->codec) { + case 0: + aligned = ALIGN(t0 * unk_s6 + 16, 4); + addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff; + addr += a3; + aSetBuffer(cmd++, 0, addr, DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned, s0 * 2); + aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState)); + break; + case 1: + aligned = ALIGN(t0 * unk_s6 + 16, 4); + addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff & 0xffff; + addr += a3; + aSetBuffer(cmd++, 0, addr, DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned, s0 * 2); + aADPCM_23(cmd++, flags, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState)); + + break; + } + aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned + (s2 * 2), DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2); + } + nAdpcmSamplesProcessed += nSamplesInThisIteration; + switch (flags) { + case A_INIT: // = 1 + sp130 = 0x20; + s5 = (s0 + 0x10) * 2; + break; + case A_LOOP: // = 2 + s5 = (nSamplesInThisIteration) * 2 + s5; + break; + default: + if (s5 != 0) { + s5 = (nSamplesInThisIteration) * 2 + s5; + } else { + s5 = (s2 + (nSamplesInThisIteration)) * 2; + } + break; + } + flags = 0; +skip: + if (noteFinished) { + aClearBuffer(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5, + (samplesLenAdjusted - nAdpcmSamplesProcessed) * 2); + noteSubEu->finished = 1; + note->noteSubEu.finished = 1; + func_sh_802ed644(updateIndex, noteIndex); + break; + } + if (restart != 0) { + synthesisState->restart = TRUE; + synthesisState->samplePosInt = loopInfo->start; + } else { + synthesisState->samplePosInt += nSamplesToProcess; + } + } + + switch (nParts) { + case 1: + noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_UNCOMPRESSED_NOTE + sp130; + break; + case 2: + switch (curPart) { + case 0: + aInterl(cmd++, 0, ALIGN(samplesLenAdjusted / 2, 3), DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, DMEM_ADDR_RESAMPLED); + resampledTempLen = samplesLenAdjusted; + noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_RESAMPLED; + if (noteSubEu->finished != FALSE) { + aClearBuffer(cmd++, noteSamplesDmemAddrBeforeResampling + resampledTempLen, samplesLenAdjusted + 0x10); + } + break; + case 1: + aInterl(cmd++, 0, ALIGN(samplesLenAdjusted / 2, 3), DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, resampledTempLen + DMEM_ADDR_RESAMPLED); + break; + } + } + if (noteSubEu->finished != FALSE) { + break; + } + } + } + flags = 0; + if (noteSubEu->needsInit == TRUE) { + flags = A_INIT; + noteSubEu->needsInit = FALSE; + } + flags = flags | sp56; + cmd = final_resample(cmd, synthesisState, bufLen * 2, resamplingRateFixedPoint, + noteSamplesDmemAddrBeforeResampling, flags); + if ((flags & 1) != 0) { + flags = 1; + } + + if (noteSubEu->filter) { + aFilter(cmd++, 0x02, bufLen * 2, noteSubEu->filter); + aFilter(cmd++, flags, DMEM_ADDR_TEMP, synthesisState->synthesisBuffers->filterBuffer); + + } + + if (noteSubEu->bookOffset == 3) { + aUnknown25(cmd++, 0, bufLen * 2, DMEM_ADDR_TEMP, DMEM_ADDR_TEMP); + } + + bankId = noteSubEu->bankId; + if (bankId != 0) { + if (bankId < 0x10) { + bankId = 0x10; + } + + aHilogain(cmd++, bankId, (bufLen + 0x10) * 2, DMEM_ADDR_TEMP); + } + + if (noteSubEu->headsetPanRight != 0 || synthesisState->prevHeadsetPanRight != 0) { + leftRight = 1; + } else if (noteSubEu->headsetPanLeft != 0 || synthesisState->prevHeadsetPanLeft != 0) { + leftRight = 2; + } else { + leftRight = 0; + } + cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, 0x450, leftRight, flags); + if (noteSubEu->usesHeadsetPanEffects) { + if ((flags & 1) == 0) { + flags = 0; + } + cmd = note_apply_headset_pan_effects(cmd, noteSubEu, synthesisState, bufLen * 2, flags, leftRight); + } + + return cmd; +} +#endif + +#if defined(VERSION_EU) || defined(VERSION_SH) u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad) { s32 a3; - s32 i; s32 repeats; +#ifndef VERSION_SH + s32 i; aSetBuffer(cmd++, /*flags*/ 0, /*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE, /*dmemout*/ 0, /*count*/ 128); aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(noteSubEu->sound.samples)); +#else + aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(noteSubEu->sound.samples), + DMEM_ADDR_UNCOMPRESSED_NOTE, 128); +#endif + synthesisState->samplePosInt &= 0x3f; a3 = 64 - synthesisState->samplePosInt; if (a3 < nSamplesToLoad) { repeats = (nSamplesToLoad - a3 + 63) / 64; +#ifndef VERSION_SH for (i = 0; i < repeats; i++) { aDMEMMove(cmd++, /*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE, /*dmemout*/ DMEM_ADDR_UNCOMPRESSED_NOTE + (1 + i) * 128, /*count*/ 128); } +#else + if (repeats != 0) { + aDuplicate(cmd++, + /*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE, + /*dmemout*/ DMEM_ADDR_UNCOMPRESSED_NOTE + 128, + /*copies*/ repeats); + } +#endif } return cmd; } @@ -1116,21 +1669,30 @@ u64 *load_wave_samples(u64 *cmd, struct Note *note, s32 nSamplesToLoad) { } #endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags) { - aSetBuffer(cmd++, /*flags*/ 0, dmemIn, /*dmemout*/ 0, count); - aResample(cmd++, flags, pitch, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->finalResampleState)); +#ifdef VERSION_SH + if (pitch == 0) { + aClearBuffer(cmd++, DMEM_ADDR_TEMP, count); + } else { +#endif + aSetBuffer(cmd++, /*flags*/ 0, dmemIn, /*dmemout*/ DMEM_ADDR_TEMP, count); + aResample(cmd++, flags, pitch, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->finalResampleState)); +#ifdef VERSION_SH + } +#endif return cmd; } #else u64 *final_resample(u64 *cmd, struct Note *note, s32 count, u16 pitch, u16 dmemIn, u32 flags) { - aSetBuffer(cmd++, /*flags*/ 0, dmemIn, /*dmemout*/ 0, count); + aSetBuffer(cmd++, /*flags*/ 0, dmemIn, /*dmemout*/ DMEM_ADDR_TEMP, count); aResample(cmd++, flags, pitch, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->finalResampleState)); return cmd; } #endif -#ifndef VERSION_EU +#ifndef VERSION_SH +#if defined(VERSION_JP) || defined(VERSION_US) u64 *process_envelope(u64 *cmd, struct Note *note, s32 nSamples, u16 inBuf, s32 headsetPanSettings, UNUSED u32 flags) { UNUSED u8 pad[16]; @@ -1150,7 +1712,7 @@ u64 *process_envelope_inner(u64 *cmd, struct Note *note, s32 nSamples, u16 inBuf u8 mixerFlags; UNUSED u8 pad2[8]; s32 rampLeft, rampRight; -#else +#elif defined(VERSION_EU) u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, UNUSED u32 flags) { UNUSED u8 pad1[20]; u16 sourceRight; @@ -1220,7 +1782,7 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat } } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (targetLeft == sourceLeft && targetRight == sourceRight && !note->envMixerNeedsInit) { #else if (vol->targetLeft == vol->sourceLeft && vol->targetRight == vol->sourceRight @@ -1230,7 +1792,7 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat } else { mixerFlags = A_INIT; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) rampLeft = gCurrentLeftVolRamping[targetLeft >> 5] * gCurrentRightVolRamping[sourceLeft >> 5]; rampRight = gCurrentLeftVolRamping[targetRight >> 5] * gCurrentRightVolRamping[sourceRight >> 5]; #else @@ -1239,7 +1801,7 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat #endif // The operation's parameters change meanings depending on flags -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) aSetVolume(cmd++, A_VOL | A_LEFT, sourceLeft, 0, 0); aSetVolume(cmd++, A_VOL | A_RIGHT, sourceRight, 0, 0); aSetVolume32(cmd++, A_RATE | A_LEFT, targetLeft, rampLeft); @@ -1254,7 +1816,7 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat #endif } -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) if (gUseReverb && note->reverbVol != 0) { aEnvMixer(cmd++, mixerFlags | A_AUX, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->mixEnvelopeState)); @@ -1278,7 +1840,7 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat /*out*/ DMEM_ADDR_WET_RIGHT_CH); } } else { -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) aEnvMixer(cmd++, mixerFlags, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->mixEnvelopeState)); #else aEnvMixer(cmd++, mixerFlags, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->mixEnvelopeState)); @@ -1296,14 +1858,115 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat return cmd; } -#ifdef VERSION_EU +#elif defined(VERSION_SH) +#ifdef NON_MATCHING // regalloc +u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, u32 flags) { + u16 sourceRight; + u16 sourceLeft; + u16 targetLeft; + u16 targetRight; + s16 rampLeft; + s16 rampRight; + s32 sourceReverbVol; + s16 reverbVol; + s32 bit; + s32 sourceVol; + s32 targetVol; + UNUSED s32 pad[2]; + + sourceLeft = synthesisState->curVolLeft; + sourceRight = synthesisState->curVolRight; + targetLeft = note->targetVolLeft; + targetRight = note->targetVolRight; + targetLeft <<= 4; + targetRight <<= 4; + if (targetLeft != sourceLeft) { + rampLeft = (targetLeft - sourceLeft) / (nSamples >> 3); + } else { + rampLeft = 0; + } + if (targetRight != sourceRight) { + rampRight = (targetRight - sourceRight) / (nSamples >> 3); + } else { + rampRight = 0; + } + sourceReverbVol = synthesisState->reverbVol; + targetVol = note->reverbVol & 0x7f; + sourceVol = sourceReverbVol & 0x7f; + bit = (sourceReverbVol & 0x80) >> 7; + if (note->reverbVol != sourceReverbVol) { + reverbVol = ((targetVol - sourceVol) << 9) / (nSamples >> 3); + synthesisState->reverbVol = note->reverbVol; + } else { + reverbVol = 0; + } + synthesisState->curVolLeft = sourceLeft + rampLeft * (nSamples >> 3); + synthesisState->curVolRight = sourceRight + rampRight * (nSamples >> 3); + + if (note->usesHeadsetPanEffects) { + aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DEFAULT_LEN_1CH); + aEnvSetup1(cmd++, (sourceVol * 2), reverbVol, rampLeft, rampRight); + aEnvSetup2(cmd++, sourceLeft, sourceRight); + + switch (headsetPanSettings) { + case 1: + aEnvMixer(cmd++, + inBuf, nSamples, + bit, + note->stereoStrongRight, note->stereoStrongLeft, + DMEM_ADDR_NOTE_PAN_TEMP, + DMEM_ADDR_RIGHT_CH, + DMEM_ADDR_WET_LEFT_CH, + DMEM_ADDR_WET_RIGHT_CH); + break; + case 2: + aEnvMixer(cmd++, + inBuf, nSamples, + bit, + note->stereoStrongRight, note->stereoStrongLeft, + DMEM_ADDR_LEFT_CH, + DMEM_ADDR_NOTE_PAN_TEMP, + DMEM_ADDR_WET_LEFT_CH, + DMEM_ADDR_WET_RIGHT_CH); + break; + default: + aEnvMixer(cmd++, + inBuf, nSamples, + bit, + note->stereoStrongRight, note->stereoStrongLeft, + DMEM_ADDR_LEFT_CH, + DMEM_ADDR_RIGHT_CH, + DMEM_ADDR_WET_LEFT_CH, + DMEM_ADDR_WET_RIGHT_CH); + break; + } + } else { + aEnvSetup1(cmd++, (sourceVol * 2), reverbVol, rampLeft, rampRight); + aEnvSetup2(cmd++, sourceLeft, sourceRight); + aEnvMixer(cmd++, + inBuf, nSamples, + bit, + note->stereoStrongRight, note->stereoStrongLeft, + DMEM_ADDR_LEFT_CH, + DMEM_ADDR_RIGHT_CH, + DMEM_ADDR_WET_LEFT_CH, + DMEM_ADDR_WET_RIGHT_CH); + } + return cmd; +} +#else +GLOBAL_ASM("asm/non_matchings/sh/audio/synthesis/process_envelope.s") +#endif +#endif + +#if defined(VERSION_EU) || defined(VERSION_SH) u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight) { #else u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32 flags, s32 leftRight) { #endif u16 dest; - u16 pitch; // t2 -#ifndef VERSION_EU + u16 pitch; +#if defined(VERSION_JP) || defined(VERSION_US) u16 prevPanShift; u16 panShift; #else @@ -1315,7 +1978,7 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32 switch (leftRight) { case 1: dest = DMEM_ADDR_LEFT_CH; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) panShift = note->headsetPanRight; #else panShift = noteSubEu->headsetPanRight; @@ -1326,7 +1989,7 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32 break; case 2: dest = DMEM_ADDR_RIGHT_CH; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) panShift = note->headsetPanLeft; #else panShift = noteSubEu->headsetPanLeft; @@ -1343,6 +2006,23 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32 if (flags != 1) // A_INIT? { // Slightly adjust the sample rate in order to fit a change in pan shift +#ifdef VERSION_SH + if (panShift != prevPanShift) { + pitch = (((bufLen << 0xf) / 2) - 1) / ((bufLen + panShift - prevPanShift - 2) / 2); + aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, (bufLen + panShift) - prevPanShift); + aResampleZoh(cmd++, pitch, 0); + } else { + aDMEMMove(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, bufLen); + } + + if (prevPanShift != 0) { + aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer), + DMEM_ADDR_NOTE_PAN_TEMP, ALIGN(prevPanShift, 4)); + aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + prevPanShift, bufLen + panShift - prevPanShift); + } else { + aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP, bufLen + panShift); + } +#else if (prevPanShift == 0) { // Kind of a hack that moves the first samples into the resample state aDMEMMove(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, 8); @@ -1353,7 +2033,7 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32 aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, 32); aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panResampleState)); -#ifdef VERSION_EU +#if defined(VERSION_EU) pitch = (bufLen << 0xf) / (bufLen + panShift - prevPanShift + 8); if (pitch) { } @@ -1384,26 +2064,41 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32 } else { aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP, panShift + bufLen - prevPanShift); } +#endif } else { // Just shift right aDMEMMove(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, bufLen); +#ifdef VERSION_SH + aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, panShift); + aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + panShift, bufLen); +#else aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + panShift, bufLen); aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, panShift); +#endif } if (panShift) { // Save excessive samples for next iteration +#ifdef VERSION_SH + aSaveBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP + bufLen, + VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer), ALIGN(panShift, 4)); +#else aSetBuffer(cmd++, 0, 0, DMEM_ADDR_NOTE_PAN_TEMP + bufLen, panShift); aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer)); +#endif } +#ifdef VERSION_SH + aAddMixer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, dest, (bufLen + 0x3f) & 0xffc0); +#else aSetBuffer(cmd++, 0, 0, 0, bufLen); aMix(cmd++, 0, /*gain*/ 0x7fff, /*in*/ DMEM_ADDR_NOTE_PAN_TEMP, /*out*/ dest); +#endif return cmd; } -#if !defined(VERSION_EU) +#if defined(VERSION_JP) || defined(VERSION_US) // Moved to playback.c in EU void note_init_volume(struct Note *note) { diff --git a/src/audio/synthesis.h b/src/audio/synthesis.h index a82363b1..244fc4a8 100644 --- a/src/audio/synthesis.h +++ b/src/audio/synthesis.h @@ -3,10 +3,15 @@ #include "internal.h" +#ifdef VERSION_SH +#define DEFAULT_LEN_1CH 0x180 +#define DEFAULT_LEN_2CH 0x300 +#else #define DEFAULT_LEN_1CH 0x140 #define DEFAULT_LEN_2CH 0x280 +#endif -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) #define MAX_UPDATES_PER_FRAME 5 #else #define MAX_UPDATES_PER_FRAME 4 @@ -25,34 +30,48 @@ struct ReverbRingBufferItem struct SynthesisReverb { - /*0x00, 0x00*/ u8 resampleFlags; - /*0x01, 0x01*/ u8 useReverb; - /*0x02, 0x02*/ u8 framesLeftToIgnore; - /*0x03, 0x03*/ u8 curFrame; -#ifdef VERSION_EU - /* 0x04*/ u8 downsampleRate; - /* 0x06*/ u16 windowSize; // same as bufSizePerChannel + /*0x00, 0x00, 0x00*/ u8 resampleFlags; + /*0x01, 0x01, 0x01*/ u8 useReverb; + /*0x02, 0x02, 0x02*/ u8 framesLeftToIgnore; + /*0x03, 0x03, 0x03*/ u8 curFrame; +#if defined(VERSION_EU) || defined(VERSION_SH) + /* 0x04, 0x04*/ u8 downsampleRate; +#ifdef VERSION_SH + /* 0x05*/ s8 unk5; #endif - /*0x04, 0x08*/ u16 reverbGain; - /*0x06, 0x0A*/ u16 resampleRate; - /*0x08, 0x0C*/ s32 nextRingBufferPos; - /*0x0C, 0x10*/ s32 unkC; // never read - /*0x10, 0x14*/ s32 bufSizePerChannel; + /* 0x06, 0x06*/ u16 windowSize; // same as bufSizePerChannel +#endif +#ifdef VERSION_SH + /* 0x08*/ u16 unk08; +#endif + /*0x04, 0x08, 0x0A*/ u16 reverbGain; + /*0x06, 0x0A, 0x0C*/ u16 resampleRate; +#ifdef VERSION_SH + /* 0x0E*/ u16 panRight; + /* 0x10*/ u16 panLeft; +#endif + /*0x08, 0x0C, 0x14*/ s32 nextRingBufferPos; + /*0x0C, 0x10, 0x18*/ s32 unkC; // never read + /*0x10, 0x14, 0x1C*/ s32 bufSizePerChannel; struct { s16 *left; s16 *right; } ringBuffer; - /*0x1C, 0x20*/ s16 *resampleStateLeft; - /*0x20, 0x24*/ s16 *resampleStateRight; - /*0x24, 0x28*/ s16 *unk24; // never read - /*0x28, 0x2C*/ s16 *unk28; // never read - /*0x2C, 0x30*/ struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME]; -#ifdef VERSION_EU - u8 pad[16]; + /*0x1C, 0x20, 0x28*/ s16 *resampleStateLeft; + /*0x20, 0x24, 0x2C*/ s16 *resampleStateRight; + /*0x24, 0x28, 0x30*/ s16 *unk24; // never read + /*0x28, 0x2C, 0x34*/ s16 *unk28; // never read + /*0x2C, 0x30, 0x38*/ struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME]; +#if defined(VERSION_EU) || defined(VERSION_SH) + // Only used in sh: + /* 0x100*/ s16 *unk100; + /* 0x104*/ s16 *unk104; + /* 0x108*/ s16 *unk108; + /* 0x10C*/ s16 *unk10C; #endif }; // 0xCC <= size <= 0x100 -#if defined(VERSION_EU) +#if defined(VERSION_EU) || defined(VERSION_SH) extern struct SynthesisReverb gSynthesisReverbs[4]; extern s8 gNumSynthesisReverbs; extern struct NoteSubEu *gNoteSubsEu; @@ -64,8 +83,12 @@ extern f32 *gCurrentRightVolRamping; // Points to any of the three right buffers extern struct SynthesisReverb gSynthesisReverb; #endif +#ifdef VERSION_SH +extern s16 D_SH_803479B4; +#endif + u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen); -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) void note_init_volume(struct Note *note); void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb); void note_set_frequency(struct Note *note, f32 frequency); diff --git a/src/audio/unk_shindou_audio_file.c b/src/audio/unk_shindou_audio_file.c new file mode 100644 index 00000000..c2ed3159 --- /dev/null +++ b/src/audio/unk_shindou_audio_file.c @@ -0,0 +1,564 @@ +#ifdef VERSION_SH + +#include + +#include "data.h" +#include "heap.h" +#include "load.h" +#include "synthesis.h" +#include "internal.h" + +#define EXTRA_BUFFERED_AI_SAMPLES_TARGET 0x80 +#define SAMPLES_TO_OVERPRODUCE 0x10 + +extern s32 D_SH_80314FC8; +extern struct SPTask *D_SH_80314FCC; +extern u8 D_SH_80315098; +extern u8 D_SH_8031509C; + +void func_sh_802f62e0(s32 playerIndex, s32 numFrames); +void func_sh_802f6288(s32 arg0, s32 numFrames); +void func_sh_802f6554(u32 arg0); + +struct SPTask *func_sh_802f5a80(void) { + u32 samplesRemainingInAI; + s32 writtenCmds; + s32 index; + OSTask_t *task; + s32 flags; + s16 *currAiBuffer; + s32 oldDmaCount; + s32 sp38; + s32 sp34; + s32 writtenCmdsCopy; + + gAudioFrameCount++; + if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0) { + if ((gAudioFrameCount % gAudioBufferParameters.presetUnk4) + 1 == gAudioBufferParameters.presetUnk4) { + return D_SH_80314FCC; + } + return NULL; + } + osSendMesg(D_SH_80350F38, (OSMesg) gAudioFrameCount, OS_MESG_NOBLOCK); + + gAudioTaskIndex ^= 1; + gCurrAiBufferIndex++; + gCurrAiBufferIndex %= NUMAIBUFFERS; + index = (gCurrAiBufferIndex - 2 + NUMAIBUFFERS) % NUMAIBUFFERS; + samplesRemainingInAI = osAiGetLength() / 4; + + if (gAudioLoadLockSH < 0x10U) { + if (gAiBufferLengths[index] != 0) { + osAiSetNextBuffer(gAiBuffers[index], gAiBufferLengths[index] * 4); + } + } + + oldDmaCount = gCurrAudioFrameDmaCount; + if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) { + } + gCurrAudioFrameDmaCount = 0; + + decrease_sample_dma_ttls(); + func_802f41e4(gAudioResetStatus); + if (osRecvMesg(D_SH_80350F88, (OSMesg *) &sp38, OS_MESG_NOBLOCK) != -1) { + if (gAudioResetStatus == 0) { + gAudioResetStatus = 5; + } + gAudioResetPresetIdToLoad = (u8) sp38; + } + + if (gAudioResetStatus != 0) { + if (audio_shut_down_and_reset_step() == 0) { + if (gAudioResetStatus == 0) { + osSendMesg(D_SH_80350FA8, (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK); + } + D_SH_80314FCC = 0; + return NULL; + } + } + if (gAudioLoadLockSH >= 0x11U) { + return NULL; + } + if (gAudioLoadLockSH != 0) { + gAudioLoadLockSH++; + } + + gAudioTask = &gAudioTasks[gAudioTaskIndex]; + gAudioCmd = (u64 *) gAudioCmdBuffers[gAudioTaskIndex]; + index = gCurrAiBufferIndex; + currAiBuffer = gAiBuffers[index]; + + gAiBufferLengths[index] = (s16) ((((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI) + + EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE); + if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) { + gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength; + } + if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength) { + gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength; + } + + if (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1) { + do { + func_sh_802f6554(sp34); + } while (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1); + } + + flags = 0; + gAudioCmd = synthesis_execute(gAudioCmd, &writtenCmds, currAiBuffer, gAiBufferLengths[index]); + gAudioRandom = (u32) (osGetCount() * (gAudioRandom + gAudioFrameCount)); + gAudioRandom = (u32) (gAiBuffers[index][gAudioFrameCount & 0xFF] + gAudioRandom); + + index = gAudioTaskIndex; + gAudioTask->msgqueue = NULL; + gAudioTask->msg = NULL; + + task = &gAudioTask->task.t; + task->type = M_AUDTASK; + task->flags = flags; + task->ucode_boot = rspF3DBootStart; + task->ucode_boot_size = (u8 *) rspF3DStart - (u8 *) rspF3DBootStart; + task->ucode = rspAspMainStart; + task->ucode_data = rspAspMainDataStart; + task->ucode_size = 0x1000; + task->ucode_data_size = (rspAspMainDataEnd - rspAspMainDataStart) * sizeof(u64); + task->dram_stack = NULL; + task->dram_stack_size = 0; + task->output_buff = NULL; + task->output_buff_size = NULL; + task->data_ptr = gAudioCmdBuffers[index]; + task->data_size = writtenCmds * sizeof(u64); + task->yield_data_ptr = NULL; + task->yield_data_size = 0; + + writtenCmdsCopy = writtenCmds; + if (D_SH_80314FC8 < writtenCmdsCopy) { + D_SH_80314FC8 = writtenCmdsCopy; + } + + if (gAudioBufferParameters.presetUnk4 == 1) { + return gAudioTask; + } else { + D_SH_80314FCC = gAudioTask; + return NULL; + } +} + +void func_sh_802f5fb8(struct EuAudioCmd *cmd) { + s32 i; + struct Note *note; + struct NoteSubEu *sub; + + switch (cmd->u.s.op) { + case 0x81: + preload_sequence(cmd->u.s.arg2, 3); + break; + + case 0x82: + case 0x88: + func_sh_802F3410(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3); + func_sh_802f62e0(cmd->u.s.arg1, cmd->u2.as_s32); + break; + + case 0x83: + if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) { + if (cmd->u2.as_s32 == 0) { + sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]); + } + else { + func_sh_802f6288(cmd->u.s.arg1, cmd->u2.as_s32); + } + } + break; + + case 0x84: + break; + + case 0xf0: + gSoundMode = cmd->u2.as_s32; + break; + + case 0xf1: + for (i = 0; i < 4; i++) { + gSequencePlayers[i].muted = TRUE; + gSequencePlayers[i].recalculateVolume = TRUE; + } + break; + + case 0xf2: + if (cmd->u2.as_s32 == 1) { + for (i = 0; i < gMaxSimultaneousNotes; i++) { + note = &gNotes[i]; + sub = ¬e->noteSubEu; + if (note->noteSubEu.enabled && note->unkSH34 == 0) { + if ((note->parentLayer->seqChannel->muteBehavior & 8) != 0) { + sub->finished = TRUE; + } + } + } + } + for (i = 0; i < 4; i++) { + gSequencePlayers[i].muted = FALSE; + gSequencePlayers[i].recalculateVolume = TRUE; + } + break; + + case 0xf3: + func_sh_802f3024(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3); + break; + + case 0xf4: + func_sh_802f30f4(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1); + break; + + case 0xf5: + func_sh_802f3158(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1); + break; + + case 0xf6: + func_sh_802f3288(cmd->u.s.arg2); + break; + } +} + +void func_sh_802f6288(s32 arg0, s32 numFrames) { + struct SequencePlayer *player; + + if (numFrames == 0) { + numFrames = 1; + } + player = &gSequencePlayers[arg0]; + player->state = 2; + player->fadeRemainingFrames = numFrames; + player->fadeVelocity = -(player->fadeVolume / (f32) numFrames); +} + +void func_sh_802f62e0(s32 playerIndex, s32 numFrames) { + struct SequencePlayer *player; + + if (numFrames != 0) { + player = &gSequencePlayers[playerIndex]; + player->state = 1; + player->fadeTimerUnkEu = numFrames; + player->fadeRemainingFrames = numFrames; + player->fadeVolume = 0.0f; + player->fadeVelocity = 0.0f; + } +} + +void func_sh_802f6330(void) { + D_SH_80350F18 = 0; + D_SH_80350F19 = 0; + D_SH_80350F38 = &D_SH_80350F20; + D_SH_80350F68 = &D_SH_80350F50; + D_SH_80350F88 = &D_SH_80350F70; + D_SH_80350FA8 = &D_SH_80350F90; + osCreateMesgQueue(D_SH_80350F38, D_SH_80350F1C, 1); + osCreateMesgQueue(D_SH_80350F68, D_SH_80350F40, 4); + osCreateMesgQueue(D_SH_80350F88, D_SH_80350F6C, 1); + osCreateMesgQueue(D_SH_80350FA8, D_SH_80350F8C, 1); +} + +extern struct EuAudioCmd sAudioCmd[0x100]; // sAudioCmd, maybe? +void func_802ad6f0(s32 arg0, s32 *arg1) { // func_sh_802f63f8 + struct EuAudioCmd *cmd = &sAudioCmd[D_SH_80350F18 & 0xff]; + cmd->u.first = arg0; + cmd->u2.as_u32 = *arg1; + D_SH_80350F18++; + if (D_SH_80350F18 == D_SH_80350F19) { + D_SH_80350F18--; + } +} + +void func_802ad728(u32 arg0, f32 arg1) { // func_sh_802f6450 + func_802ad6f0(arg0, (s32 *) &arg1); +} + +void func_802ad74c(u32 arg0, u32 arg1) { // func_sh_802f6474 + func_802ad6f0(arg0, (s32 *) &arg1); +} + +void func_802ad770(u32 arg0, s8 arg1) { // func_sh_802f6498 + s32 sp1C = arg1 << 24; + func_802ad6f0(arg0, &sp1C); +} + +char shindouDebugPrint133[] = "AudioSend: %d -> %d (%d)\n"; + +extern OSMesgQueue *D_SH_80350F68; +void func_sh_802F64C8(void) { + static s32 D_SH_8031503C = 0; + s32 a0 = (D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff; + s32 a1; + + if (D_SH_8031503C < a0) { + D_SH_8031503C = a0; + } + a0 = ((D_SH_80350F19 & 0xff) << 8) | (D_SH_80350F18 & 0xFF); + a1 = a0; + a0 = D_SH_80350F68; + osSendMesg(a0, a1, 0); + D_SH_80350F19 = D_SH_80350F18; +} + +void func_sh_802f6540(void) { + D_SH_80350F19 = D_SH_80350F18; +} + +void func_sh_802f6554(u32 arg0) { + struct EuAudioCmd *cmd; + struct SequencePlayer *seqPlayer; + struct SequenceChannel *chan; + u8 a0; + + static char shindouDebugPrint134[] = "Continue Port\n"; + static char shindouDebugPrint135[] = "%d -> %d\n"; + static char shindouDebugPrint136[] = "Sync-Frame Break. (Remain %d)\n"; + static char shindouDebugPrint137[] = "Undefined Port Command %d\n"; + + static u8 D_SH_80315098 = 0; + static u8 D_SH_8031509C = 0; + + if (D_SH_8031509C == 0) { + D_SH_80315098 = (arg0 >> 8) & 0xff; + } + + a0 = arg0 & 0xff; + + for (;;) { + if (D_SH_80315098 == a0) { + D_SH_8031509C = 0; + break; + } + cmd = &sAudioCmd[D_SH_80315098 & 0xff]; + D_SH_80315098++; + if (cmd->u.s.op == 0xf8) { + D_SH_8031509C = 1; + break; + } + else if ((cmd->u.s.op & 0xf0) == 0xf0) { + func_sh_802f5fb8(cmd); + } + else if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) { + seqPlayer = &gSequencePlayers[cmd->u.s.arg1]; + if ((cmd->u.s.op & 0x80) != 0) { + func_sh_802f5fb8(cmd); + } + else if ((cmd->u.s.op & 0x40) != 0) { + switch (cmd->u.s.op) { + case 0x41: + if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32) { + seqPlayer->fadeVolumeScale = cmd->u2.as_f32; + seqPlayer->recalculateVolume = TRUE; + } + break; + + case 0x47: + seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT; + break; + + case 0x49: + seqPlayer->tempoAdd = cmd->u2.as_s32 * TEMPO_SCALE; + break; + + case 0x48: + seqPlayer->transposition = cmd->u2.as_s8; + break; + + case 0x46: + seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8; + break; + } + } + else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) { + chan = seqPlayer->channels[cmd->u.s.arg2]; + if (IS_SEQUENCE_CHANNEL_VALID(chan)) + { + switch (cmd->u.s.op) { + case 1: + if (chan->volumeScale != cmd->u2.as_f32) { + chan->volumeScale = cmd->u2.as_f32; + chan->changes.as_bitfields.volume = TRUE; + } + break; + case 2: + if (chan->volume != cmd->u2.as_f32) { + chan->volume = cmd->u2.as_f32; + chan->changes.as_bitfields.volume = TRUE; + } + break; + case 3: + if (chan->newPan != cmd->u2.as_s8) { + chan->newPan = cmd->u2.as_s8; + chan->changes.as_bitfields.pan = TRUE; + } + break; + case 4: + if (chan->freqScale != cmd->u2.as_f32) { + chan->freqScale = cmd->u2.as_f32; + chan->changes.as_bitfields.freqScale = TRUE; + } + break; + case 5: + if (chan->reverb != cmd->u2.as_s8) { + chan->reverb = cmd->u2.as_s8; + } + break; + case 6: + if (cmd->u.s.arg3 < 8) { + chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8; + } + break; + case 8: + chan->stopSomething2 = cmd->u2.as_s8; + break; + case 9: + chan->muteBehavior = cmd->u2.as_s8; + } + } + } + } + + cmd->u.s.op = 0; + } +} + +u32 func_sh_802f6878(s32 *arg0) { + u32 sp1C; + + if (osRecvMesg(&gUnkQueue1, (OSMesg *) &sp1C, 0) == -1) { + *arg0 = 0; + return 0U; + } + *arg0 = (s32) (sp1C & 0xFFFFFF); + return sp1C >> 0x18; +} + +u8 *func_sh_802f68e0(u32 index, u32 *a1) { + return func_sh_802f3220(index, a1); +} + +s32 func_sh_802f6900(void) { + s32 ret; + s32 sp18; + + ret = osRecvMesg(D_SH_80350FA8, (OSMesg *) &sp18, 0); + + if (ret == -1) { + return 0; + } + if (sp18 != gAudioResetPresetIdToLoad) { + return 0; + } else { + return 1; + } +} + +// TODO: (Scrub C) +void func_sh_802f6958(OSMesg mesg) { + s32 a; + OSMesg recvMesg; + + do { + a = -1; + } while (osRecvMesg(D_SH_80350FA8, &recvMesg, OS_MESG_NOBLOCK) != a); + func_sh_802f6540(); + osSendMesg(D_SH_80350F88, mesg, OS_MESG_NOBLOCK); +} + +void func_sh_802f69cc(void) { + gAudioLoadLockSH = 1; + func_sh_802f6958(0); + gAudioResetStatus = 0; +} + +s32 func_sh_802f6a08(s32 playerIndex, s32 channelIndex, s32 soundScriptIOIndex) { + struct SequenceChannel *seqChannel; + struct SequencePlayer *player; + + player = &gSequencePlayers[playerIndex]; + if (player->enabled) { + seqChannel = player->channels[channelIndex]; + if (IS_SEQUENCE_CHANNEL_VALID(seqChannel)) { + return seqChannel->soundScriptIO[soundScriptIOIndex]; + } + } + return -1; +} + +s8 func_sh_802f6a6c(s32 playerIndex, s32 index) { + return gSequencePlayers[playerIndex].seqVariationEu[index]; +} + +void func_sh_802f6a9c(void) { + // creates a bunch of os message queues + func_sh_802f6330(); +} + +char shindouDebugPrint138[] = "specchg conjunction error (Msg:%d Cur:%d)\n"; +char shindouDebugPrint139[] = "Error : Queue is not empty ( %x ) \n"; +char shindouDebugPrint140[] = "Audio: setvol: volume minus %f\n"; +char shindouDebugPrint141[] = "Audio: setvol: volume overflow %f\n"; +char shindouDebugPrint142[] = "Audio: setpitch: pitch zero or minus %f\n"; +char shindouDebugPrint143[] = "----------------------Double-Error CH: %x %f\n"; +char shindouDebugPrint144[] = "----------------------Double-Error NT: %x\n"; +char shindouDebugPrint145[] = "CAUTION:SUB IS SEPARATED FROM GROUP\n"; +char shindouDebugPrint146[] = "CAUTION:PAUSE EMERGENCY\n"; +char shindouDebugPrint147[] = "Error:Wait Track disappear\n"; +char shindouDebugPrint148[] = "Audio: voiceman: No bank error %d\n"; +char shindouDebugPrint149[] = "Audio: voiceman: progNo. overflow %d,%d\n"; +char shindouDebugPrint150[] = "ptr2 %x\n"; +char shindouDebugPrint151[] = "Audio: voiceman: progNo. undefined %d,%d\n"; +char shindouDebugPrint152[] = "Audio: voiceman: No bank error %d\n"; +char shindouDebugPrint153[] = "Audio: voiceman: Percussion Overflow %d,%d\n"; +char shindouDebugPrint154[] = "Audio: voiceman: Percussion table pointer (bank %d) is irregular %x.\n"; +char shindouDebugPrint155[] = "Audio: voiceman: Percpointer NULL %d,%d\n"; +char shindouDebugPrint156[] = "--4 %x\n"; +char shindouDebugPrint157[] = "NoteOff Comes during wait release %x (note %x)\n"; +char shindouDebugPrint158[] = "Slow Release Batting\n"; +u8 euUnknownData_8030194c[4] = { 0x40, 0x20, 0x10, 0x08 }; +char shindouDebugPrint159[] = "Audio:Wavemem: Bad voiceno (%d)\n"; +char shindouDebugPrint160[] = "Audio: C-Alloc : Dealloc voice is NULL\n"; +char shindouDebugPrint161[] = "Alloc Error:Dim voice-Alloc %d"; +char shindouDebugPrint162[] = "Error:Same List Add\n"; +char shindouDebugPrint163[] = "Already Cut\n"; +char shindouDebugPrint164[] = "Audio: C-Alloc : lowerPrio is NULL\n"; +char shindouDebugPrint165[] = "Intterupt UseStop %d (Kill %d)\n"; +char shindouDebugPrint166[] = "Intterupt RelWait %d (Kill %d)\n"; +char shindouDebugPrint167[] = "Drop Voice (Prio %x)\n"; +s32 D_SH_803154CC = 0; // Either an unused variable or a file boundary. +char shindouDebugPrint168[] = "Audio:Envp: overflow %f\n"; +s32 D_SH_803154EC = 0; // Either an unused variable or a file boundary. +char shindouDebugPrint169[] = "Audio:Track:Warning: No Free Notetrack\n"; +char shindouDebugPrint170[] = "SUBTRACK DIM\n"; +char shindouDebugPrint171[] = "Audio:Track: Warning :SUBTRACK had been stolen by other Group.\n"; +char shindouDebugPrint172[] = "SEQID %d,BANKID %d\n"; +char shindouDebugPrint173[] = "ERR:SUBTRACK %d NOT ALLOCATED\n"; +char shindouDebugPrint174[] = "Stop Release\n"; +char shindouDebugPrint175[] = "Error:Same List Add\n"; +char shindouDebugPrint176[] = "Wait Time out!\n"; +char shindouDebugPrint177[] = "Macro Level Over Error!\n"; +char shindouDebugPrint178[] = "Macro Level Over Error!\n"; // Again +char shindouDebugPrint179[] = "WARNING: NPRG: cannot change %d\n"; +char shindouDebugPrint180[] = "Audio:Track:NOTE:UNDEFINED NOTE COM. %x\n"; +char shindouDebugPrint181[] = "Error: Subtrack no prg.\n"; +char shindouDebugPrint182[] = "ERR %x\n"; +char shindouDebugPrint183[] = "Note OverFlow %d\n"; +char shindouDebugPrint184[] = "trs %d , %d, %d\n"; +char shindouDebugPrint185[] = "Audio: Note:Velocity Error %d\n"; +char shindouDebugPrint186[] = "Audio:Track :Call Macro Level Over Error!\n"; +char shindouDebugPrint187[] = "Audio:Track :Loops Macro Level Over Error!\n"; +char shindouDebugPrint188[] = "SUB:ERR:BANK %d NOT CACHED.\n"; +char shindouDebugPrint189[] = "SUB:ERR:BANK %d NOT CACHED.\n"; +char shindouDebugPrint190[] = "Audio:Track: CTBLCALL Macro Level Over Error!\n"; +char shindouDebugPrint191[] = "Set Noise %d\n"; +char shindouDebugPrint192[] = "[%2x] \n"; +char shindouDebugPrint193[] = "Err :Sub %x ,address %x:Undefined SubTrack Function %x"; +char shindouDebugPrint194[] = "VoiceLoad Error Bank:%d,Prog:%d\n"; +char shindouDebugPrint195[] = "Disappear Sequence or Bank %d\n"; +char shindouDebugPrint196[] = "[FIN] group.\n"; +char shindouDebugPrint197[] = "Macro Level Over Error!\n"; +char shindouDebugPrint198[] = "Macro Level Over Error!\n"; +char shindouDebugPrint199[] = "Group:Undefine upper C0h command (%x)\n"; +char shindouDebugPrint200[] = "Group:Undefined Command\n"; + +#endif diff --git a/src/buffers/buffers.c b/src/buffers/buffers.c index d993caaa..77bcc36d 100644 --- a/src/buffers/buffers.c +++ b/src/buffers/buffers.c @@ -4,8 +4,10 @@ #include "audio/data.h" ALIGNED8 u8 gDecompressionHeap[0xD000]; -#if defined(VERSION_EU) || defined(VERSION_SH) +#if defined(VERSION_EU) ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE) - 0x3800]; +#elif defined(VERSION_SH) +ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE) - 0x4800]; #else ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE)]; #endif diff --git a/src/engine/graph_node.c b/src/engine/graph_node.c index 150092e8..eb64232e 100644 --- a/src/engine/graph_node.c +++ b/src/engine/graph_node.c @@ -881,26 +881,20 @@ s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist) { */ void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f position) { struct Animation *animation = obj->animInfo.curAnim; - u16 *attribute; - s16 *values; - s16 frame; if (animation != NULL) { - attribute = segmented_to_virtual((void *) animation->index); - values = segmented_to_virtual((void *) animation->values); + u16 *attribute = segmented_to_virtual((void *) animation->index); + s16 *values = segmented_to_virtual((void *) animation->values); - frame = obj->animInfo.animFrame; + s16 frame = obj->animInfo.animFrame; if (frame < 0) { frame = 0; } - if (1) // ? necessary to match - { - position[0] = (f32) values[retrieve_animation_index(frame, &attribute)]; - position[1] = (f32) values[retrieve_animation_index(frame, &attribute)]; - position[2] = (f32) values[retrieve_animation_index(frame, &attribute)]; - } + position[0] = (f32) values[retrieve_animation_index(frame, &attribute)]; + position[1] = (f32) values[retrieve_animation_index(frame, &attribute)]; + position[2] = (f32) values[retrieve_animation_index(frame, &attribute)]; } else { vec3f_set(position, 0, 0, 0); } diff --git a/src/engine/level_script.c b/src/engine/level_script.c index b3af1ae6..4f1a7701 100644 --- a/src/engine/level_script.c +++ b/src/engine/level_script.c @@ -375,11 +375,7 @@ static void level_cmd_end_area(void) { static void level_cmd_load_model_from_dl(void) { s16 val1 = CMD_GET(s16, 2) & 0x0FFF; -#ifdef VERSION_EU - s16 val2 = (CMD_GET(s16, 2) & 0xFFFF) >> 12; -#else - s16 val2 = CMD_GET(u16, 2) >> 12; -#endif + s16 val2 = ((u16)CMD_GET(s16, 2)) >> 12; void *val3 = CMD_GET(void *, 4); if (val1 < 256) { @@ -410,11 +406,7 @@ static void level_cmd_23(void) { } arg2; s16 model = CMD_GET(s16, 2) & 0x0FFF; -#ifdef VERSION_EU - s16 arg0H = (CMD_GET(s16, 2) & 0xFFFF) >> 12; -#else - s16 arg0H = CMD_GET(u16, 2) >> 12; -#endif + s16 arg0H = ((u16)CMD_GET(s16, 2)) >> 12; void *arg1 = CMD_GET(void *, 4); // load an f32, but using an integer load instruction for some reason (hence the union) arg2.i = CMD_GET(s32, 8); @@ -659,7 +651,7 @@ static void level_cmd_load_area(void) { s16 areaIndex = CMD_GET(u8, 2); UNUSED void *unused = (u8 *) sCurrentCmd + 4; - func_80320890(); + stop_sounds_in_continuous_banks(); load_area(areaIndex); sCurrentCmd = CMD_NEXT; diff --git a/src/engine/surface_collision.c b/src/engine/surface_collision.c index 31238b95..77bb72ed 100644 --- a/src/engine/surface_collision.c +++ b/src/engine/surface_collision.c @@ -206,8 +206,8 @@ s32 find_wall_collisions(struct WallCollisionData *colData) { // World (level) consists of a 16x16 grid. Find where the collision is on // the grid (round toward -inf) - cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1); - cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1); + cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX; + cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX; // Check for surfaces belonging to objects. node = gDynamicSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_WALLS].next; @@ -334,8 +334,8 @@ f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil) { } // Each level is split into cells to limit load, find the appropriate cell. - cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1); - cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1); + cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX; + cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX; // Check for surfaces belonging to objects. surfaceList = gDynamicSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_CEILS].next; @@ -566,8 +566,8 @@ f32 unused_find_dynamic_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfl s16 z = (s16) zPos; // Each level is split into cells to limit load, find the appropriate cell. - s16 cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1); - s16 cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1); + s16 cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX; + s16 cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX; surfaceList = gDynamicSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_FLOORS].next; floor = find_floor_from_list(surfaceList, x, y, z, &floorHeight); @@ -606,8 +606,8 @@ f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor) { } // Each level is split into cells to limit load, find the appropriate cell. - cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1); - cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & (NUM_CELLS - 1); + cellX = ((x + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX; + cellZ = ((z + LEVEL_BOUNDARY_MAX) / CELL_SIZE) & NUM_CELLS_INDEX; // Check for surfaces belonging to objects. surfaceList = gDynamicSurfacePartition[cellZ][cellX][SPATIAL_PARTITION_FLOORS].next; @@ -709,16 +709,16 @@ f32 find_poison_gas_level(f32 x, f32 z) { val = *p; if (val >= 50) { - loX = *(p + 1); - loZ = *(p + 2); - hiX = *(p + 3); - hiZ = *(p + 4); + loX = p[1]; + loZ = p[2]; + hiX = p[3]; + hiZ = p[4]; // If the location is within a gas's box and it is a gas box. // Gas has a value of 50, 60, etc. if (loX < x && x < hiX && loZ < z && z < hiZ && val % 10 == 0) { // Set the gas height. Since this breaks, only return the first height. - gasLevel = *(p + 5); + gasLevel = p[5]; break; } } @@ -761,22 +761,22 @@ void debug_surface_list_info(f32 xPos, f32 zPos) { s32 cellX = (xPos + LEVEL_BOUNDARY_MAX) / CELL_SIZE; s32 cellZ = (zPos + LEVEL_BOUNDARY_MAX) / CELL_SIZE; - list = gStaticSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_FLOORS].next; + list = gStaticSurfacePartition[cellZ & NUM_CELLS_INDEX][cellX & NUM_CELLS_INDEX][SPATIAL_PARTITION_FLOORS].next; numFloors += surface_list_length(list); - list = gDynamicSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_FLOORS].next; + list = gDynamicSurfacePartition[cellZ & NUM_CELLS_INDEX][cellX & NUM_CELLS_INDEX][SPATIAL_PARTITION_FLOORS].next; numFloors += surface_list_length(list); - list = gStaticSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_WALLS].next; + list = gStaticSurfacePartition[cellZ & NUM_CELLS_INDEX][cellX & NUM_CELLS_INDEX][SPATIAL_PARTITION_WALLS].next; numWalls += surface_list_length(list); - list = gDynamicSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_WALLS].next; + list = gDynamicSurfacePartition[cellZ & NUM_CELLS_INDEX][cellX & NUM_CELLS_INDEX][SPATIAL_PARTITION_WALLS].next; numWalls += surface_list_length(list); - list = gStaticSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_CEILS].next; + list = gStaticSurfacePartition[cellZ & NUM_CELLS_INDEX][cellX & NUM_CELLS_INDEX][SPATIAL_PARTITION_CEILS].next; numCeils += surface_list_length(list); - list = gDynamicSurfacePartition[cellZ & (NUM_CELLS - 1)][cellX & (NUM_CELLS - 1)][SPATIAL_PARTITION_CEILS].next; + list = gDynamicSurfacePartition[cellZ & NUM_CELLS_INDEX][cellX & NUM_CELLS_INDEX][SPATIAL_PARTITION_CEILS].next; numCeils += surface_list_length(list); print_debug_top_down_mapinfo("area %x", cellZ * NUM_CELLS + cellX); diff --git a/src/engine/surface_collision.h b/src/engine/surface_collision.h index 5e162e21..f278b748 100644 --- a/src/engine/surface_collision.h +++ b/src/engine/surface_collision.h @@ -5,18 +5,24 @@ #include "types.h" -#define LEVEL_BOUNDARY_MAX 0x2000 -#define CELL_SIZE 0x400 +// Range level area is 16384x16384 (-8192 to +8192 in x and z) +#define LEVEL_BOUNDARY_MAX 0x2000 // 8192 -#define CELL_HEIGHT_LIMIT 20000.f -#define FLOOR_LOWER_LIMIT -11000.f +#define CELL_SIZE (1 << 10) // 0x400 + +#define CELL_HEIGHT_LIMIT 20000 +#define FLOOR_LOWER_LIMIT -11000 +#define FLOOR_LOWER_LIMIT_MISC (FLOOR_LOWER_LIMIT + 1000) +// same as FLOOR_LOWER_LIMIT_MISC, explicitly for shadow.c +// It doesn't match if ".0" is removed or ".f" is added +#define FLOOR_LOWER_LIMIT_SHADOW (FLOOR_LOWER_LIMIT + 1000.0) struct WallCollisionData { /*0x00*/ f32 x, y, z; /*0x0C*/ f32 offsetY; /*0x10*/ f32 radius; - /*0x14*/ s16 unk14; + /*0x14*/ s16 unused; /*0x16*/ s16 numWalls; /*0x18*/ struct Surface *walls[4]; }; diff --git a/src/engine/surface_load.c b/src/engine/surface_load.c index 0645f311..de7998af 100644 --- a/src/engine/surface_load.c +++ b/src/engine/surface_load.c @@ -252,8 +252,8 @@ static s16 upper_cell_index(s16 coord) { index += 1; } - if (index > (NUM_CELLS - 1)) { - index = (NUM_CELLS - 1); + if (index > NUM_CELLS_INDEX) { + index = NUM_CELLS_INDEX; } // Potentially < 0, but since lower index is >= 0, not exploitable diff --git a/src/engine/surface_load.h b/src/engine/surface_load.h index 88654561..8a8f5fb6 100644 --- a/src/engine/surface_load.h +++ b/src/engine/surface_load.h @@ -3,11 +3,11 @@ #include +#include "surface_collision.h" #include "types.h" -// NUM_CELLS needs to be a power of 2 so that the bitwise -// in surface_collision.c functions can work properly -#define NUM_CELLS 16 +#define NUM_CELLS (2 * LEVEL_BOUNDARY_MAX / CELL_SIZE) +#define NUM_CELLS_INDEX (NUM_CELLS - 1) struct SurfaceNode { diff --git a/src/game/area.c b/src/game/area.c index e63135b1..f9b58924 100644 --- a/src/game/area.c +++ b/src/game/area.c @@ -285,7 +285,7 @@ void unload_area(void) { } void load_mario_area(void) { - func_80320890(); + stop_sounds_in_continuous_banks(); load_area(gMarioSpawnInfo->areaIndex); for (int i = 0; i < MAX_PLAYERS; i++) { diff --git a/src/game/behavior_actions.c b/src/game/behavior_actions.c index cc5a0c40..66cb8242 100644 --- a/src/game/behavior_actions.c +++ b/src/game/behavior_actions.c @@ -43,16 +43,12 @@ #include "sm64.h" #include "spawn_object.h" #include "spawn_sound.h" -#include "thread6.h" -#include "area.h" #include "game/rng_position.h" +#include "rumble_init.h" #include "pc/lua/utils/smlua_model_utils.h" #define o gCurrentObject -// BSS -s16 D_8035FF10; - struct WFRotatingPlatformData { s16 pad; s16 scale; @@ -196,6 +192,7 @@ Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat // not in behavior file // n is the number of objects to spawn, r if the rate of change of phase (frequency?) void spawn_sparkle_particles(s32 n, s32 a1, s32 a2, s32 r) { + static s16 D_8035FF10; s32 i; s16 separation = 0x10000 / n; // Evenly spread around a circle for (i = 0; i < n; i++) { @@ -203,10 +200,6 @@ void spawn_sparkle_particles(s32 n, s32 a1, s32 a2, s32 r) { coss(D_8035FF10 + i * separation) * a1, o, MODEL_NONE, bhvSparkleSpawn); } - if (1) - { - } - D_8035FF10 += r * 0x100; } diff --git a/src/game/behavior_actions.h b/src/game/behavior_actions.h index a7cc2cf3..8eeaf0e3 100644 --- a/src/game/behavior_actions.h +++ b/src/game/behavior_actions.h @@ -210,7 +210,7 @@ void bhv_lll_bowser_puzzle_piece_loop(void); void bhv_lll_bowser_puzzle_loop(void); void bhv_tuxies_mother_loop(void); void bhv_small_penguin_loop(void); -void bhv_large_fish_group_loop(void); +void bhv_fish_spawner_loop(void); void bhv_fish_loop(void); void bhv_wdw_express_elevator_loop(void); void bhv_bub_spawner_loop(void); diff --git a/src/game/behaviors/activated_bf_plat.inc.c b/src/game/behaviors/activated_bf_plat.inc.c index 5ca41632..fc303c3d 100644 --- a/src/game/behaviors/activated_bf_plat.inc.c +++ b/src/game/behaviors/activated_bf_plat.inc.c @@ -73,7 +73,7 @@ void bhv_activated_back_and_forth_platform_init(void) { } /** - * Activated back-and-forth platform update function. + * Activated back-and-forth platform update function. */ void bhv_activated_back_and_forth_platform_update(void) { u8 doSendNetwork = FALSE; diff --git a/src/game/behaviors/bbh_merry_go_round.inc.c b/src/game/behaviors/bbh_merry_go_round.inc.c index 5cdc785b..45b2051f 100644 --- a/src/game/behaviors/bbh_merry_go_round.inc.c +++ b/src/game/behaviors/bbh_merry_go_round.inc.c @@ -73,7 +73,7 @@ void bhv_merry_go_round_loop(void) { o->oMerryGoRoundMarioIsOutside++; } } else { - play_sound(SOUND_AIR_HOWLING_WIND, gDefaultSoundArgs); + play_sound(SOUND_AIR_HOWLING_WIND, gGlobalSoundSource); if ( // There are objects outside BBH, such as corkboxes. diff --git a/src/game/behaviors/blue_coin.inc.c b/src/game/behaviors/blue_coin.inc.c index aa9fc401..5dd2b42e 100644 --- a/src/game/behaviors/blue_coin.inc.c +++ b/src/game/behaviors/blue_coin.inc.c @@ -121,9 +121,9 @@ void bhv_blue_coin_switch_loop(void) { case BLUE_COIN_SWITCH_ACT_TICKING: // Tick faster when the blue coins start blinking if (o->oTimer < 200) { - play_sound(SOUND_GENERAL2_SWITCH_TICK_FAST, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_SWITCH_TICK_FAST, gGlobalSoundSource); } else { - play_sound(SOUND_GENERAL2_SWITCH_TICK_SLOW, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_SWITCH_TICK_SLOW, gGlobalSoundSource); } // Delete the switch (which stops the sound) after the last coin is collected, diff --git a/src/game/behaviors/boo.inc.c b/src/game/behaviors/boo.inc.c index b104009f..0d20125a 100644 --- a/src/game/behaviors/boo.inc.c +++ b/src/game/behaviors/boo.inc.c @@ -919,7 +919,7 @@ void bhv_merry_go_round_boo_manager_loop(void) { #ifndef VERSION_JP play_puzzle_jingle(); #else - play_sound(SOUND_GENERAL2_RIGHT_ANSWER, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_RIGHT_ANSWER, gGlobalSoundSource); #endif } } diff --git a/src/game/behaviors/bowser.inc.c b/src/game/behaviors/bowser.inc.c index 49c29fd2..d39e9e7b 100644 --- a/src/game/behaviors/bowser.inc.c +++ b/src/game/behaviors/bowser.inc.c @@ -954,15 +954,16 @@ s32 bowser_dead_not_bits_end(void) { s32 ret = 0; if (o->oBowserUnkF8 < 2) { if (o->oBowserUnkF8 == 0) { - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); o->oBowserUnkF8++; } if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog(marioState, 2, 18, sBowserDefeatedDialogText[o->oBehParams2ndByte], 0, bowser_dead_not_bits_end_continue_dialog)) { o->oBowserUnkF8++; cur_obj_play_sound_2(SOUND_GENERAL2_BOWSER_EXPLODE); - sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); - sequence_player_fade_out(0, 1); + seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); + seq_player_fade_out(SEQ_PLAYER_LEVEL, 1); network_send_object(o); + } } else if (bowser_dead_twirl_into_trophy()) { bowser_dead_hide(); @@ -987,13 +988,13 @@ s32 bowser_dead_bits_end(void) { else dialogID = DIALOG_163; if (o->oBowserUnkF8 == 0) { - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); o->oBowserUnkF8++; } if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog(marioState, 2, 18, dialogID, 0, bowser_dead_bits_end_continue_dialog)) { cur_obj_set_model(smlua_model_util_load(E_MODEL_BOWSER2)); - sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); - sequence_player_fade_out(0, 1); + seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); + seq_player_fade_out(SEQ_PLAYER_LEVEL, 1); bowser_spawn_grand_star_key(); o->oBowserUnkF8++; } @@ -1102,9 +1103,9 @@ s32 bowser_check_fallen_off_stage(void) // bowser off stage? if (o->oPosY < o->oHomeY - 1000.0f) return 1; if (o->oMoveFlags & OBJ_MOVE_LANDED) { - if (o->oFloorType == 1) + if (o->oFloorType == SURFACE_BURNING) return 1; - if (o->oFloorType == 10) + if (o->oFloorType == SURFACE_DEATH_PLANE) return 1; } } @@ -1618,9 +1619,9 @@ void bowser_flame_despawn(void) { s32 bowser_flame_should_despawn(s32 maxTime) { if (maxTime < o->oTimer) return 1; - if (o->oFloorType == 1) + if (o->oFloorType == SURFACE_BURNING) return 1; - if (o->oFloorType == 10) + if (o->oFloorType == SURFACE_DEATH_PLANE) return 1; return 0; } @@ -1634,7 +1635,7 @@ void bhv_flame_bowser_init(void) { o->oVelY = 20.0f; o->oForwardVel = 10.0f; o->oGravity = -1.0f; - o->oFlameUnkF4 = random_float() + 1.0f; + o->oFlameScale = random_float() + 1.0f; } void bhv_flame_large_burning_out_init(void) { @@ -1642,12 +1643,12 @@ void bhv_flame_large_burning_out_init(void) { o->oMoveAngleYaw = random_u16(); o->oVelY = 10.0f; o->oForwardVel = 0.0f; - o->oFlameUnkF4 = 7.0f; + o->oFlameScale = 7.0f; } void bowser_flame_move(void) { s32 sp4; - sp4 = ((o->oFlameUnkF8 + gGlobalTimer) & 0x3F) << 10; + sp4 = ((o->oFlameSpeedTimerOffset + gGlobalTimer) & 0x3F) << 10; o->oPosX += sins(o->oMoveAngleYaw) * sins(sp4) * 4.0f; o->oPosZ += coss(o->oMoveAngleYaw) * sins(sp4) * 4.0f; } @@ -1663,22 +1664,22 @@ void bhv_flame_bowser_loop(void) { if (o->oMoveFlags & OBJ_MOVE_LANDED) { o->oAction++; if (cur_obj_has_behavior(bhvFlameLargeBurningOut)) - o->oFlameUnkF4 = 8.0f; + o->oFlameScale = 8.0f; else - o->oFlameUnkF4 = random_float() * 2 + 6.0f; + o->oFlameScale = random_float() * 2 + 6.0f; o->oForwardVel = 0; o->oVelY = 0; o->oGravity = 0; } } else { cur_obj_become_tangible(); - if (o->oTimer > o->oFlameUnkF4 * 10 + 5.0f) { - o->oFlameUnkF4 -= 0.15; - if (o->oFlameUnkF4 <= 0) + if (o->oTimer > o->oFlameScale * 10 + 5.0f) { + o->oFlameScale -= 0.15; + if (o->oFlameScale <= 0) bowser_flame_despawn(); } } - cur_obj_scale(o->oFlameUnkF4); + cur_obj_scale(o->oFlameScale); o->oGraphYOffset = o->header.gfx.scale[1] * 14.0f; obj_set_hitbox(o, &sBowserFlameHitbox); } @@ -1687,20 +1688,20 @@ void bhv_flame_moving_forward_growing_init(void) { o->oForwardVel = 30.0f; obj_translate_xz_random(o, 80.0f); o->oAnimState = (s32)(random_float() * 10.0f); - o->oFlameUnkF4 = 3.0f; + o->oFlameScale = 3.0f; } void bhv_flame_moving_forward_growing_loop(void) { UNUSED s32 unused; UNUSED struct Object *sp18; obj_set_hitbox(o, &sGrowingBowserFlameHitbox); - o->oFlameUnkF4 = o->oFlameUnkF4 + 0.5; - cur_obj_scale(o->oFlameUnkF4); + o->oFlameScale = o->oFlameScale + 0.5; + cur_obj_scale(o->oFlameScale); if (o->oMoveAnglePitch > 0x800) o->oMoveAnglePitch -= 0x200; cur_obj_set_pos_via_transform(); cur_obj_update_floor_height(); - if (o->oFlameUnkF4 > 30.0f) + if (o->oFlameScale > 30.0f) obj_mark_for_deletion(o); if (o->oPosY < o->oFloorHeight) { o->oPosY = o->oFloorHeight; @@ -1718,7 +1719,7 @@ void bhv_flame_floating_landing_init(void) { o->oForwardVel = random_float() * 70.0f; o->oVelY = random_float() * 20.0f; o->oGravity = -1.0f; - o->oFlameUnkF8 = random_float() * 64.0f; + o->oFlameSpeedTimerOffset = random_float() * 64.0f; } void bhv_flame_floating_landing_loop(void) { @@ -1745,18 +1746,18 @@ void bhv_blue_bowser_flame_init(void) { o->oAnimState = (s32)(random_float() * 10.0f); o->oVelY = 7.0f; o->oForwardVel = 35.0f; - o->oFlameUnkF4 = 3.0f; + o->oFlameScale = 3.0f; o->oFlameUnkFC = random_float() * 0.5; o->oGravity = 1.0f; - o->oFlameUnkF8 = (s32)(random_float() * 64.0f); + o->oFlameSpeedTimerOffset = (s32)(random_float() * 64.0f); } void bhv_blue_bowser_flame_loop(void) { s32 i; obj_set_hitbox(o, &sGrowingBowserFlameHitbox); - if (o->oFlameUnkF4 < 16.0f) - o->oFlameUnkF4 = o->oFlameUnkF4 + 0.5; - cur_obj_scale(o->oFlameUnkF4); + if (o->oFlameScale < 16.0f) + o->oFlameScale = o->oFlameScale + 0.5; + cur_obj_scale(o->oFlameScale); cur_obj_update_floor_and_walls(); cur_obj_move_standard(0x4e); if (o->oTimer > 0x14) { @@ -1778,26 +1779,26 @@ void bhv_flame_bouncing_init(void) { o->oAnimState = (s32)(random_float() * 10.0f); o->oVelY = 30.0f; o->oForwardVel = 20.0f; - o->oFlameUnkF4 = o->header.gfx.scale[0]; - o->oFlameUnkF8 = (s32)(random_float() * 64.0f); + o->oFlameScale = o->header.gfx.scale[0]; + o->oFlameSpeedTimerOffset = (s32)(random_float() * 64.0f); } void bhv_flame_bouncing_loop(void) { - struct Object *sp1C; + struct Object *bowser; if (o->oTimer == 0) - o->oFlameUnk100 = cur_obj_nearest_object_with_behavior(bhvBowser); - sp1C = o->oFlameUnk100; + o->oFlameBowser = cur_obj_nearest_object_with_behavior(bhvBowser); + bowser = o->oFlameBowser; o->oForwardVel = 15.0f; o->oBounciness = -1.0f; - cur_obj_scale(o->oFlameUnkF4); + cur_obj_scale(o->oFlameScale); obj_set_hitbox(o, &sGrowingBowserFlameHitbox); cur_obj_update_floor_and_walls(); cur_obj_move_standard(78); if (bowser_flame_should_despawn(300)) obj_mark_for_deletion(o); - if (sp1C != NULL) - if (sp1C->oHeldState == 0) - if (lateral_dist_between_objects(o, sp1C) < 300.0f) + if (bowser != NULL) + if (bowser->oHeldState == 0) + if (lateral_dist_between_objects(o, bowser) < 300.0f) obj_mark_for_deletion(o); } @@ -1807,7 +1808,7 @@ void bhv_blue_flames_group_loop(void) { s32 i; if (o->oTimer == 0) { o->oMoveAngleYaw = obj_angle_to_object(o, player); - o->oBlueFlameUnkF8 = 5.0f; + o->oBlueFlameNextScale = 5.0f; } if (o->oTimer < 16) { if ((o->oTimer & 1) == 0) { @@ -1815,10 +1816,10 @@ void bhv_blue_flames_group_loop(void) { flame = spawn_object(o, MODEL_BLUE_FLAME, bhvFlameBouncing); if (flame != NULL) { flame->oMoveAngleYaw += i * 0x5555; - flame->header.gfx.scale[0] = o->oBlueFlameUnkF8; + flame->header.gfx.scale[0] = o->oBlueFlameNextScale; } } - o->oBlueFlameUnkF8 -= 0.5; + o->oBlueFlameNextScale -= 0.5; } } else obj_mark_for_deletion(o); diff --git a/src/game/behaviors/bubba.inc.c b/src/game/behaviors/bubba.inc.c index 1df01555..e8a4dd50 100644 --- a/src/game/behaviors/bubba.inc.c +++ b/src/game/behaviors/bubba.inc.c @@ -55,11 +55,8 @@ void bubba_act_0(void) { void bubba_act_1(void) { struct MarioState* marioState = nearest_mario_state_to_object(o); struct Object* player = marioState->marioObj; - int distanceToPlayer = dist_between_objects(o, player); - int angleToPlayer = obj_angle_to_object(o, player); - - s16 val06; - s16 val04; + s32 distanceToPlayer = dist_between_objects(o, player); + s32 angleToPlayer = obj_angle_to_object(o, player); treat_far_home_as_mario(2500.0f, &distanceToPlayer, &angleToPlayer); @@ -72,13 +69,12 @@ void bubba_act_1(void) { } else if (o->oBubbaUnk100 < 15) { o->oAnimState = 1; } else if (o->oBubbaUnk100 == 20) { - val06 = 10000 - (s16)(20.0f * (find_water_level(o->oPosX, o->oPosZ) - o->oPosY)); + s16 val06 = 10000 - (s16)(20.0f * (find_water_level(o->oPosX, o->oPosZ) - o->oPosY)); o->oBubbaUnk1AC -= val06; o->oMoveAnglePitch = o->oBubbaUnk1AC; o->oBubbaUnkF4 = 40.0f; obj_compute_vel_from_move_pitch(o->oBubbaUnkF4); o->oAnimState = 0; - ; } else { o->oBubbaUnk1AE = angleToPlayer; o->oBubbaUnk1AC = o->oBubbaUnk104; @@ -88,7 +84,7 @@ void bubba_act_1(void) { } } else { if (abs_angle_diff(player->oFaceAngleYaw, angleToPlayer) < 0x3000) { - val04 = 0x4000 - atan2s(800.0f, distanceToPlayer - 800.0f); + s16 val04 = 0x4000 - atan2s(800.0f, distanceToPlayer - 800.0f); if ((s16)(o->oMoveAngleYaw - angleToPlayer) < 0) { val04 = -val04; } @@ -134,8 +130,6 @@ void bhv_bubba_loop(void) { int angleToPlayer = obj_angle_to_object(o, player); UNUSED s32 unused; - struct Object *sp38; - s16 sp36; o->oInteractionSubtype &= ~INT_SUBTYPE_EATS_MARIO; o->oBubbaUnk104 = obj_turn_pitch_toward_mario(marioState, 120.0f, 0); @@ -164,18 +158,17 @@ void bhv_bubba_loop(void) { if (o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER) { if (o->oMoveFlags & OBJ_MOVE_ENTERED_WATER) { - sp38 = spawn_object(o, MODEL_WATER_SPLASH, bhvWaterSplash); + struct Object *sp38 = spawn_object(o, MODEL_WATER_SPLASH, bhvWaterSplash); if (sp38 != NULL) { obj_scale(sp38, 3.0f); } o->oBubbaUnk108 = o->oVelY; o->oBubbaUnk10C = 0.0f; - ; } else { approach_f32_ptr(&o->oBubbaUnk108, 0.0f, 4.0f); if ((o->oBubbaUnk10C -= o->oBubbaUnk108) > 1.0f) { - sp36 = random_u16(); + s16 sp36 = random_u16(); o->oBubbaUnk10C -= 1.0f; spawn_object_relative(0, 150.0f * coss(sp36), 0x64, 150.0f * sins(sp36), o, MODEL_WHITE_PARTICLE_SMALL, bhvSmallParticleSnow); diff --git a/src/game/behaviors/bully.inc.c b/src/game/behaviors/bully.inc.c index 26c0c48a..88e43919 100644 --- a/src/game/behaviors/bully.inc.c +++ b/src/game/behaviors/bully.inc.c @@ -89,7 +89,11 @@ void bhv_big_bully_init(void) { } void bully_check_mario_collision(void) { - if (o->oInteractStatus & INT_STATUS_INTERACTED) { + if ( +#ifdef VERSION_SH + o->oAction != BULLY_ACT_LAVA_DEATH && o->oAction != BULLY_ACT_DEATH_PLANE_DEATH && +#endif + o->oInteractStatus & INT_STATUS_INTERACTED) { if (o->oBehParams2ndByte == BULLY_BP_SIZE_SMALL) cur_obj_play_sound_2(SOUND_OBJ2_BULLY_ATTACKED); else @@ -217,9 +221,9 @@ void bully_step(void) { void bully_spawn_coin(void) { struct Object *coin = spawn_object(o, MODEL_YELLOW_COIN, bhvMovingYellowCoin); -#ifdef VERSION_JP //TODO: maybe move this ifdef logic to the header? +#ifdef VERSION_JP // TODO: maybe move this ifdef logic to the header? cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT); -#elif VERSION_EU +#elif defined(VERSION_EU) || defined(VERSION_SH) cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_EU); #else cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_2); @@ -336,11 +340,7 @@ void big_bully_spawn_star(void) { } void bhv_big_bully_with_minions_loop(void) { -#ifdef VERSION_EU - s32 collisionFlags; -#else s16 collisionFlags; -#endif o->oBullyPrevX = o->oPosX; o->oBullyPrevY = o->oPosY; diff --git a/src/game/behaviors/chain_chomp.inc.c b/src/game/behaviors/chain_chomp.inc.c index 91f9fd64..6034d8c8 100644 --- a/src/game/behaviors/chain_chomp.inc.c +++ b/src/game/behaviors/chain_chomp.inc.c @@ -28,18 +28,15 @@ static struct ObjectHitbox sChainChompHitbox = { * Update function for chain chomp part / pivot. */ void bhv_chain_chomp_chain_part_update(void) { - struct ChainSegment *segment; - if (o->parentObj->behavior != (BehaviorScript*)&bhvChainChomp || o->parentObj->oAction == CHAIN_CHOMP_ACT_UNLOAD_CHAIN) { obj_mark_for_deletion(o); } else if (o->oBehParams2ndByte != CHAIN_CHOMP_CHAIN_PART_BP_PIVOT) { - segment = &o->parentObj->oChainChompSegments[o->oBehParams2ndByte]; + struct ChainSegment *segment = &o->parentObj->oChainChompSegments[o->oBehParams2ndByte]; // Set position relative to the pivot o->oPosX = o->parentObj->parentObj->oPosX + segment->posX; o->oPosY = o->parentObj->parentObj->oPosY + segment->posY; o->oPosZ = o->parentObj->parentObj->oPosZ + segment->posZ; - ; } else if (o->parentObj->oChainChompReleaseStatus != CHAIN_CHOMP_NOT_RELEASED) { cur_obj_update_floor_and_walls(); cur_obj_move_standard(78); @@ -212,11 +209,11 @@ static void chain_chomp_sub_act_turn(void) { } static void chain_chomp_sub_act_lunge(void) { - f32 val04; - obj_face_pitch_approach(o->oChainChompTargetPitch, 0x400); if (o->oForwardVel != 0.0f) { + f32 val04; + if (o->oChainChompRestrictedByChain == TRUE) { o->oForwardVel = o->oVelY = 0.0f; o->oChainChompUnk104 = 30.0f; @@ -230,7 +227,6 @@ static void chain_chomp_sub_act_lunge(void) { o->oChainChompMaxDistBetweenChainParts = val04 / 220.0f * o->oChainChompMaxDistFromPivotPerChainPart; o->oTimer = 0; - ; } else { // Turn toward pivot cur_obj_rotate_yaw_toward(atan2s(o->oChainChompSegments[0].posZ, o->oChainChompSegments[0].posX), diff --git a/src/game/behaviors/chuckya.inc.c b/src/game/behaviors/chuckya.inc.c index 2e7307a8..cf79ed76 100644 --- a/src/game/behaviors/chuckya.inc.c +++ b/src/game/behaviors/chuckya.inc.c @@ -156,7 +156,6 @@ void chuckya_act_1(void) { if (o->oChuckyaUnkFC-- < 0) if (check_if_moving_over_floor(50.0f, 150.0f) || o->oChuckyaUnkFC < -16) { o->oSubAction++; - ; } } } else { diff --git a/src/game/behaviors/coin.inc.c b/src/game/behaviors/coin.inc.c index 09a1aa1d..a25349c3 100644 --- a/src/game/behaviors/coin.inc.c +++ b/src/game/behaviors/coin.inc.c @@ -32,7 +32,7 @@ void bhv_yellow_coin_init(void) { cur_obj_update_floor_height(); if (500.0f < absf(o->oPosY - o->oFloorHeight)) cur_obj_set_model(smlua_model_util_load(E_MODEL_YELLOW_COIN_NO_SHADOW)); - if (o->oFloorHeight < -10000.0f) + if (o->oFloorHeight < FLOOR_LOWER_LIMIT_MISC) obj_mark_for_deletion(o); } @@ -77,9 +77,9 @@ void bhv_coin_loop(void) { } } if (o->oTimer == 0) -#ifdef VERSION_US +#if defined(VERSION_US) cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_2); -#elif VERSION_EU +#elif defined(VERSION_EU) || defined(VERSION_SH) cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_EU); #else cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT); @@ -97,7 +97,7 @@ void bhv_coin_loop(void) { #ifndef VERSION_JP if (o->oMoveFlags & OBJ_MOVE_BOUNCE) { if (o->oCoinUnk1B0 < 5) - cur_obj_play_sound_2(0x30364081); + cur_obj_play_sound_2(SOUND_GENERAL_COIN_DROP); o->oCoinUnk1B0++; } #else @@ -117,7 +117,7 @@ void bhv_coin_formation_spawn_loop(void) { if (o->oCoinUnkF8) { o->oPosY += 300.0f; cur_obj_update_floor_height(); - if (o->oPosY < o->oFloorHeight || o->oFloorHeight < -10000.0f) + if (o->oPosY < o->oFloorHeight || o->oFloorHeight < FLOOR_LOWER_LIMIT_MISC) obj_mark_for_deletion(o); else o->oPosY = o->oFloorHeight; diff --git a/src/game/behaviors/controllable_platform.inc.c b/src/game/behaviors/controllable_platform.inc.c index 40233265..a7c37c2f 100644 --- a/src/game/behaviors/controllable_platform.inc.c +++ b/src/game/behaviors/controllable_platform.inc.c @@ -30,6 +30,9 @@ void bhv_controllable_platform_sub_loop(void) { if (gMarioStates[0].marioObj->platform == o) { D_80331694 = o->oBehParams2ndByte; +#ifdef VERSION_SH + o->parentObj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; +#endif o->oAction = 1; cur_obj_play_sound_2(SOUND_GENERAL_MOVING_PLATFORM_SWITCH); network_send_object(o->parentObj); @@ -108,6 +111,9 @@ void controllable_platform_hit_wall(s8 sp1B) { D_80331694 = 5; cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1); +#ifdef VERSION_SH + queue_rumble_data(50, 80); +#endif } void controllable_platform_check_walls(s8 sp1B, s8 sp1C[3], Vec3f sp20, UNUSED Vec3f sp24, Vec3f sp28) { diff --git a/src/game/behaviors/eyerok.inc.c b/src/game/behaviors/eyerok.inc.c index 0128ced4..867d06ea 100644 --- a/src/game/behaviors/eyerok.inc.c +++ b/src/game/behaviors/eyerok.inc.c @@ -99,7 +99,7 @@ static void eyerok_boss_act_wake_up(void) { if (o->oEyerokBossNumHands == 2) { if (o->oTimer > 5) { if (o->oSubAction == 0) { - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); o->oSubAction += 1; } @@ -339,9 +339,7 @@ static void eyerok_hand_act_idle(void) { static void eyerok_hand_act_open(void) { struct Object* player = nearest_player_to_object(o); - int angleToPlayer = obj_angle_to_object(o, player); - s16 sp1E; - + s32 angleToPlayer = obj_angle_to_object(o, player); o->parentObj->oEyerokBossUnk1AC = o->oBehParams2ndByte; if (cur_obj_init_anim_and_check_if_end(4)) { @@ -352,11 +350,10 @@ static void eyerok_hand_act_open(void) { o->collisionData = segmented_to_virtual(ssl_seg7_collision_070282F8); if (o->parentObj->oEyerokBossNumHands != 2) { - sp1E = angleToPlayer; + s16 sp1E = angleToPlayer; clamp_s16(&sp1E, -0x3000, 0x3000); o->oMoveAngleYaw = sp1E; o->oForwardVel = 50.0f; - ; } else { o->oMoveAngleYaw = 0; } diff --git a/src/game/behaviors/fish.inc.c b/src/game/behaviors/fish.inc.c index fa01a360..fb041859 100644 --- a/src/game/behaviors/fish.inc.c +++ b/src/game/behaviors/fish.inc.c @@ -4,43 +4,39 @@ */ /** - * Spawns fish with settings chosen by the field o->oBehParams2ndByte. + * Spawns fish with settings chosen by oBehParams2ndByte. * These settings are animations, colour, and spawn quantity. - * Fish spawning restricted to within a set distance from Mario. */ -void fish_act_spawn(void) { +static void fish_spawner_act_spawn(void) { s32 i; s32 schoolQuantity; s16 model; - const struct Animation * const*fishAnimation; + const struct Animation * const *fishAnimation; struct Object *fishObject; + switch (o->oBehParams2ndByte) { - // Blue fish with a quanitiy of twenty. - case 0: - model = MODEL_FISH; schoolQuantity = 20; fishAnimation = blue_fish_seg3_anims_0301C2B0; + // Cases need to be on one line to match with and without optimizations. + case FISH_SPAWNER_BP_MANY_BLUE: + model = MODEL_FISH; schoolQuantity = 20; fishAnimation = blue_fish_seg3_anims_0301C2B0; break; - - // Blue fish with a quanitiy of five. - case 1: - model = MODEL_FISH; schoolQuantity = 5; fishAnimation = blue_fish_seg3_anims_0301C2B0; + + case FISH_SPAWNER_BP_FEW_BLUE: + model = MODEL_FISH; schoolQuantity = 5; fishAnimation = blue_fish_seg3_anims_0301C2B0; break; - - // Cyan fish with a quanitiy of twenty. - case 2: + + case FISH_SPAWNER_BP_MANY_CYAN: model = MODEL_CYAN_FISH; schoolQuantity = 20; fishAnimation = cyan_fish_seg6_anims_0600E264; break; - - // Cyan fish with a quanitiy of five. - case 3: - model = MODEL_CYAN_FISH; schoolQuantity = 5; fishAnimation = cyan_fish_seg6_anims_0600E264; + + case FISH_SPAWNER_BP_FEW_CYAN: + model = MODEL_CYAN_FISH; schoolQuantity = 5; fishAnimation = cyan_fish_seg6_anims_0600E264; break; } - /** - * Spawn and animate the schoolQuantity of fish if Mario enters render distance - * If the current level is Secret Aquarium, ignore this requirement. - * Fish moves at random with a max-range of 700.0f. - */ + + // Spawn and animate the schoolQuantity of fish if Mario enters render distance + // or the stage is Secret Aquarium. + // Fish moves randomly within a range of 700.0f. for (i = 0; i < schoolQuantity; i++) { fishObject = spawn_object(o, model, bhvFish); if (fishObject == NULL) { continue; } @@ -48,70 +44,64 @@ void fish_act_spawn(void) { obj_init_animation_with_sound(fishObject, fishAnimation, 0); obj_translate_xyz_random(fishObject, 700.0f); } - o->oAction = FISH_ACT_ACTIVE; + o->oAction = FISH_SPAWNER_ACT_IDLE; } /** - * If the current level is not Secret Aquarium and the distance from Mario's - * Y coordinate is greater than 2000.0f then spawn another fish. + * Sets the spawner to respawn fish if the stage is not Secret Aquarium and + * Mario is more than 2000 units higher. */ -void fish_act_respawn(void) { +void fish_spawner_act_idle(void) { // TODO: should this be re-enabled? /*#ifndef NODRAWINGDISTANCE - if (gCurrLevelNum != LEVEL_SA) { - struct Object* player = nearest_player_to_object(o); - if (player->oPosY - o->oPosY > 2000.0f) { - o->oAction = FISH_ACT_RESPAWN; - } + struct Object *player = nearest_player_to_object(o); + if ((gCurrLevelNum != LEVEL_SA) && (player->oPosY - o->oPosY > 2000.0f)) { + o->oAction = FISH_SPAWNER_ACT_RESPAWN; } #endif*/ } /** - * Sets the next call of sFishActions to spawn a new fish. + * Temp action that sets the action to spawn fish. This triggers the old fish to despawn. */ -void fish_act_init(void) { - o->oAction = FISH_ACT_INIT; +static void fish_spawner_act_respawn(void) { + o->oAction = FISH_SPAWNER_ACT_SPAWN; } -/** - * An array of action methods chosen one at a time by bhv_fish_loop - */ -void (*sFishActions[])(void) = { - fish_act_spawn, fish_act_respawn, fish_act_init +static void (*sFishSpawnerActions[])(void) = { + fish_spawner_act_spawn, fish_spawner_act_idle, fish_spawner_act_respawn, }; -void bhv_large_fish_group_loop(void) { - cur_obj_call_action_function(sFishActions); +void bhv_fish_spawner_loop(void) { + cur_obj_call_action_function(sFishSpawnerActions); } /** - * Adjusts the Y coordinate of fish depending on circumstances - * such as proximity to other fish. + * Allows the fish to swim vertically. */ -void fish_regroup(s32 speed) { - // Store parentY for calculating when the fish should move towards oFishPosY. +static void fish_vertical_roam(s32 speed) { f32 parentY = o->parentObj->oPosY; - - // Sets speed of fish in SA to a leisurely speed of 10 when close to other fish. + + // If the stage is Secret Aquarium, the fish can + // travel as far vertically as they wish. if (gCurrLevelNum == LEVEL_SA) { - if (500.0f < absf(o->oPosY - o->oFishPosY)) { + if (500.0f < absf(o->oPosY - o->oFishGoalY)) { speed = 10; } - // Applies movement to fish. - o->oPosY = approach_f32_symmetric(o->oPosY, o->oFishPosY, speed); - /** - * Brings fish Y coordinate towards another fish if they are too far apart. - */ - } else if (parentY - 100.0f - o->oFishDepthDistance < o->oPosY + o->oPosY = approach_f32_symmetric(o->oPosY, o->oFishGoalY, speed); + + // Allow the fish to roam vertically if within + // range of the fish spawner. + } else if (parentY - 100.0f - o->oFishDepthDistance < o->oPosY && o->oPosY < parentY + 1000.0f + o->oFishDepthDistance) { - o->oPosY = approach_f32_symmetric(o->oPosY, o->oFishPosY, speed); + o->oPosY = approach_f32_symmetric(o->oPosY, o->oFishGoalY, speed); } } + /** - * Moves fish forward at a random velocity and sets a random rotation. + * Fish action that randomly roams within a set range. */ -void fish_group_act_rotation(void) { +static void fish_act_roam(void) { struct Object* player = nearest_player_to_object(o); int distanceToPlayer = dist_between_objects(o, player); int angleToPlayer = obj_angle_to_object(o, player); @@ -124,71 +114,65 @@ void fish_group_act_rotation(void) { } else { cur_obj_init_animation_with_accel_and_sound(0, 1.0f); } - - /** - * Assigns oForwardVel, oFishRandomOffset, & oFishRespawnDistance to a random floats. - * Determines fish movement. - */ + + // Initializes some variables when the fish first begins roaming. if (o->oTimer == 0) { o->oForwardVel = random_float() * 2 + 3.0f; if (gCurrLevelNum == LEVEL_SA) { - o->oFishRandomOffset = random_float() * 700.0f; + o->oFishHeightOffset = random_float() * 700.0f; } else { - o->oFishRandomOffset = random_float() * 100.0f; + o->oFishHeightOffset = random_float() * 100.0f; } - o->oFishRespawnDistance = random_float() * 500 + 200.0f; + o->oFishRoamDistance = random_float() * 500 + 200.0f; } - - // Interact with Mario through rotating towards him. - o->oFishPosY = player->oPosY + o->oFishRandomOffset; - cur_obj_rotate_yaw_toward(angleToPlayer, 0x400); + + o->oFishGoalY = player->oPosY + o->oFishHeightOffset; // If fish groups are too close, call fish_regroup() + // Rotate the fish towards Mario. + cur_obj_rotate_yaw_toward(angleToPlayer, 0x400); + if (o->oPosY < o->oFishWaterLevel - 50.0f) { if (fishY < 0.0f) { fishY = 0.0f - fishY; } if (fishY < 500.0f) { - fish_regroup(2); + fish_vertical_roam(2); } else { - fish_regroup(4); + fish_vertical_roam(4); } + + // Don't let the fish leave the water vertically. } else { o->oPosY = o->oFishWaterLevel - 50.0f; if (fishY > 300.0f) { o->oPosY = o->oPosY - 1.0f; } } - - /** - * Delete current fish and create a new one if distance to Mario is - * smaller than his distance to oFishRespawnDistance + 150.0f. - */ - if (distanceToPlayer < o->oFishRespawnDistance + 150.0f) { - o->oAction = FISH_ACT_RESPAWN; + + // Flee from Mario if the fish gets too close. + if (distanceToPlayer < o->oFishRoamDistance + 150.0f) { + o->oAction = FISH_ACT_FLEE; } } /** * Interactively maneuver fish in relation to its distance from other fish and Mario. */ -void fish_group_act_move(void) { +static void fish_act_flee(void) { struct Object* player = nearest_player_to_object(o); int distanceToPlayer = dist_between_objects(o, player); int angleToPlayer = obj_angle_to_object(o, player); - f32 fishY = o->oPosY - player->oPosY; - // Marked unused, but has arithmetic performed on it in a useless manner. + f32 fishY = o->oPosY - gMarioObject->oPosY; UNUSED s32 distance; - o->oFishPosY = player->oPosY + o->oFishRandomOffset; - /** - * Set fish variables to random floats when timer reaches zero and plays sound effect. - * This allows fish to move in seemingly natural patterns. - */ + o->oFishGoalY = gMarioObject->oPosY + o->oFishHeightOffset; + + // Initialize some variables when the flee action first starts. if (o->oTimer == 0) { o->oFishActiveDistance = random_float() * 300.0f; - o->oFishRandomSpeed = random_float() * 1024.0f + 1024.0f; - o->oFishRandomVel = random_float() * 4.0f + 8.0f + 5.0f; + o->oFishYawVel = random_float() * 1024.0f + 1024.0f; + o->oFishGoalVel = random_float() * 4.0f + 8.0f + 5.0f; if (distanceToPlayer < 600.0f) { distance = 1; } else { @@ -197,53 +181,61 @@ void fish_group_act_move(void) { distance *= 127; cur_obj_play_sound_2(SOUND_GENERAL_MOVING_WATER); } - // Enable fish animation in a natural manner. + + // Speed the animation up over time. if (o->oTimer < 20) { cur_obj_init_animation_with_accel_and_sound(0, 4.0f); } else { cur_obj_init_animation_with_accel_and_sound(0, 1.0f); } - // Set randomized forward velocity so fish have differing velocities - if (o->oForwardVel < o->oFishRandomVel) { + + // Accelerate over time. + if (o->oForwardVel < o->oFishGoalVel) { o->oForwardVel = o->oForwardVel + 0.5; } - o->oFishPosY = player->oPosY + o->oFishRandomOffset; + o->oFishGoalY = player->oPosY + o->oFishHeightOffset; + // Rotate fish away from Mario. - cur_obj_rotate_yaw_toward(angleToPlayer + 0x8000, o->oFishRandomSpeed); - // If fish groups are too close, call fish_regroup() + cur_obj_rotate_yaw_toward(angleToPlayer + 0x8000, o->oFishYawVel); + if (o->oPosY < o->oFishWaterLevel - 50.0f) { if (fishY < 0.0f) { fishY = 0.0f - fishY; } + if (fishY < 500.0f) { - fish_regroup(2); + fish_vertical_roam(2); } else { - fish_regroup(4); + fish_vertical_roam(4); } + + // Don't let the fish leave the water vertically. } else { o->oPosY = o->oFishWaterLevel - 50.0f; if (fishY > 300.0f) { o->oPosY -= 1.0f; } } + // If distance to Mario is too great, then set fish to active. if (distanceToPlayer > o->oFishActiveDistance + 500.0f) { - o->oAction = FISH_ACT_ACTIVE; + o->oAction = FISH_ACT_ROAM; } } + /** * Animate fish and alter scaling at random for a magnifying effect from the water. */ -void fish_group_act_animate(void) { +static void fish_act_init(void) { cur_obj_init_animation_with_accel_and_sound(0, 1.0f); o->header.gfx.animInfo.animFrame = (s16)(random_float() * 28.0f); o->oFishDepthDistance = random_float() * 300.0f; cur_obj_scale(random_float() * 0.4 + 0.8); - o->oAction = FISH_ACT_ACTIVE; + o->oAction = FISH_ACT_ROAM; } -void (*sFishGroupActions[])(void) = { - fish_group_act_animate, fish_group_act_rotation, fish_group_act_move +static void (*sFishActions[])(void) = { + fish_act_init, fish_act_roam, fish_act_flee, }; /** @@ -254,37 +246,35 @@ void bhv_fish_loop(void) UNUSED s32 unused[4]; cur_obj_scale(1.0f); - /** - * Tracks water level to delete fish outside of bounds. - * In SA oFishWaterLevel is set to zero because fish cannot exit the water. - * This prevents accidental deletion. - */ + // oFishWaterLevel tracks if a fish has roamed out of water. + // This can't happen in Secret Aquarium, so set it to 0. o->oFishWaterLevel = find_water_level(o->oPosX, o->oPosZ); if (gCurrLevelNum == LEVEL_SA) { o->oFishWaterLevel = 0.0f; } - // Apply hitbox and resolve wall collisions + + // Apply hitbox and resolve wall collisions o->oWallHitboxRadius = 30.0f; cur_obj_resolve_wall_collisions(); - - // Delete fish below the water depth bounds of -10000.0f. + + // Delete fish if it's drifted to an area with no water. if (gCurrLevelNum != LEVEL_UNKNOWN_32) { - if (o->oFishWaterLevel < -10000.0f) { + if (o->oFishWaterLevel < FLOOR_LOWER_LIMIT_MISC) { obj_mark_for_deletion(o); return; } - + // Unreachable code, perhaps for debugging or testing. } else { o->oFishWaterLevel = 1000.0f; } - + // Call fish action methods and apply physics engine. - cur_obj_call_action_function(sFishGroupActions); + cur_obj_call_action_function(sFishActions); cur_obj_move_using_fvel_and_gravity(); - + // If the parent object has action set to two, then delete the fish object. - if (o->parentObj->oAction == FISH_ACT_RESPAWN) { + if (o->parentObj->oAction == FISH_SPAWNER_ACT_RESPAWN) { obj_mark_for_deletion(o); } } diff --git a/src/game/behaviors/flame.inc.c b/src/game/behaviors/flame.inc.c index 30346894..55d41b76 100644 --- a/src/game/behaviors/flame.inc.c +++ b/src/game/behaviors/flame.inc.c @@ -4,15 +4,13 @@ void bhv_small_piranha_flame_loop(void) { struct Object* player = nearest_player_to_object(o); int angleToPlayer = obj_angle_to_object(o, player); - f32 sp2C; - if ((u16)(o->oBehParams >> 16) == 0) { if (o->oTimer > 0) { obj_mark_for_deletion(o); } else { - sp2C = random_float() - 0.5f; - o->header.gfx.scale[1] = o->header.gfx.scale[2] * (1.0f + 0.7f * sp2C); - o->header.gfx.scale[0] = o->header.gfx.scale[2] * (0.9f - 0.5f * sp2C); + f32 rnd = random_float() - 0.5f; + o->header.gfx.scale[1] = o->header.gfx.scale[2] * (1.0f + 0.7f * rnd); + o->header.gfx.scale[0] = o->header.gfx.scale[2] * (0.9f - 0.5f * rnd); o->oAnimState = random_u16(); } @@ -27,17 +25,17 @@ void bhv_small_piranha_flame_loop(void) { spawn_object_with_scale(o, o->oSmallPiranhaFlameModel, bhvSmallPiranhaFlame, 0.4f * o->header.gfx.scale[0]); - if (o->oTimer > o->oSmallPiranhaFlameUnk100) { + if (o->oTimer > o->oSmallPiranhaFlameNextFlameTimer) { spawn_object_relative_with_scale(1, 0, o->oGraphYOffset, 0, o->header.gfx.scale[0], o, o->oSmallPiranhaFlameModel, bhvFlyguyFlame); - o->oSmallPiranhaFlameUnk100 = random_linear_offset(8, 15); + o->oSmallPiranhaFlameNextFlameTimer = random_linear_offset(8, 15); o->oTimer = 0; } obj_check_attacks(&sPiranhaPlantFireHitbox, o->oAction); - o->oSmallPiranhaFlameUnk104 += o->oSmallPiranhaFlameStartSpeed; + o->oSmallPiranhaFlameSpeed += o->oSmallPiranhaFlameStartSpeed; - if (o->oSmallPiranhaFlameUnk104 > 1500.0f || (o->oMoveFlags & (OBJ_MOVE_HIT_WALL | OBJ_MOVE_MASK_IN_WATER))) { + if (o->oSmallPiranhaFlameSpeed > 1500.0f || (o->oMoveFlags & (OBJ_MOVE_HIT_WALL | OBJ_MOVE_MASK_IN_WATER))) { obj_die_if_health_non_positive(); } } diff --git a/src/game/behaviors/flying_bookend_switch.inc.c b/src/game/behaviors/flying_bookend_switch.inc.c index 980b806b..50061920 100644 --- a/src/game/behaviors/flying_bookend_switch.inc.c +++ b/src/game/behaviors/flying_bookend_switch.inc.c @@ -363,7 +363,7 @@ void bhv_book_switch_loop(void) { if (approach_f32_ptr(&o->oBookSwitchUnkF4, 0.0f, 20.0f)) { if (o->oAction != 0) { if (o->parentObj->oBookSwitchManagerUnkF4 == o->oBehParams2ndByte) { - play_sound(SOUND_GENERAL2_RIGHT_ANSWER, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_RIGHT_ANSWER, gGlobalSoundSource); if (o->oSyncID != 0 && gSyncObjects[o->oSyncID].owned) { o->parentObj->oBookSwitchManagerUnkF4 += 1; network_send_object(o->parentObj); @@ -372,7 +372,7 @@ void bhv_book_switch_loop(void) { sp36 = random_u16() & 0x1; sp34 = player->oPosZ + 1.5f * marioState->vel[2]; - play_sound(SOUND_MENU_CAMERA_BUZZ, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource); if (sp34 > 0) { sp34 = 0; } diff --git a/src/game/behaviors/haunted_chair.inc.c b/src/game/behaviors/haunted_chair.inc.c index c5c3fe34..db153000 100644 --- a/src/game/behaviors/haunted_chair.inc.c +++ b/src/game/behaviors/haunted_chair.inc.c @@ -37,7 +37,6 @@ void bhv_haunted_chair_init(void) { void haunted_chair_act_0(void) { s16 val0E; - f32 val08; struct Object* player = nearest_player_to_object(o); int distanceToPlayer = dist_between_objects(o, player); @@ -79,6 +78,8 @@ void haunted_chair_act_0(void) { o->oTimer = 0.0f; } else { if ((o->oTimer & 0x8) != 0) { + f32 val08; + if (o->oFaceAnglePitch < 0) { cur_obj_play_sound_2(SOUND_GENERAL_HAUNTED_CHAIR_MOVE); val08 = 4.0f; @@ -90,7 +91,6 @@ void haunted_chair_act_0(void) { o->oHomeZ -= val08; o->oFaceAnglePitch = o->oFaceAngleRoll = (s32)(50.0f * val08); - ; } else { o->oFaceAnglePitch = o->oFaceAngleRoll = 0; } diff --git a/src/game/behaviors/hidden_star.inc.c b/src/game/behaviors/hidden_star.inc.c index 4307887e..b15eb3df 100644 --- a/src/game/behaviors/hidden_star.inc.c +++ b/src/game/behaviors/hidden_star.inc.c @@ -44,11 +44,11 @@ void bhv_hidden_star_trigger_loop(void) { } #ifdef VERSION_JP - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); #else play_sound(SOUND_MENU_COLLECT_SECRET + (((u8) hiddenStar->oHiddenStarTriggerCounter - 1) << 16), - gDefaultSoundArgs); + gGlobalSoundSource); #endif } diff --git a/src/game/behaviors/king_bobomb.inc.c b/src/game/behaviors/king_bobomb.inc.c index 1ccc6f10..aff90567 100644 --- a/src/game/behaviors/king_bobomb.inc.c +++ b/src/game/behaviors/king_bobomb.inc.c @@ -59,7 +59,7 @@ void king_bobomb_act_0(void) { o->oHealth = 3; if (should_start_or_continue_dialog(marioState, o) && cur_obj_can_mario_activate_textbox_2(&gMarioStates[0], 500.0f, 100.0f)) { o->oSubAction++; - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); } } else if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 1, CUTSCENE_DIALOG, DIALOG_017, king_bobomb_act_0_continue_dialog)) { o->oAction = 2; @@ -190,7 +190,6 @@ void king_bobomb_act_6(void) { o->oKingBobombUnk104++; if (o->oKingBobombUnk104 > 3) { o->oSubAction++; - ; // Needed to match } } else { if (o->oSubAction == 1) { diff --git a/src/game/behaviors/koopa.inc.c b/src/game/behaviors/koopa.inc.c index f0ef152b..77385e0c 100644 --- a/src/game/behaviors/koopa.inc.c +++ b/src/game/behaviors/koopa.inc.c @@ -631,6 +631,8 @@ static void koopa_the_quick_act_show_init_text(void) { } if (response == 1) { + UNUSED s32 unused; + gMarioShotFromCannon = FALSE; o->oAction = KOOPA_THE_QUICK_ACT_RACE; o->oForwardVel = 0.0f; diff --git a/src/game/behaviors/manta_ray.inc.c b/src/game/behaviors/manta_ray.inc.c index a8a47ef7..c4124198 100644 --- a/src/game/behaviors/manta_ray.inc.c +++ b/src/game/behaviors/manta_ray.inc.c @@ -1,4 +1,9 @@ -// manta_ray.c.inc +/** + * @file Behavior file for the manta ray in DDD. + * + * The manta ray spawns on stars 2-6. It generally follows a fixed path, leaving rings. + * These rings contain a significant bug that is documented in water_ring.inc.c + */ static Trajectory sMantaRayTraj[] = { TRAJECTORY_POS(0, /*pos*/ -4500, -1380, -40), @@ -24,79 +29,90 @@ static struct ObjectHitbox sMantaRayHitbox = { /* hurtboxHeight: */ 50, }; +/** + * Initializes the manta ray when spawned. + */ void bhv_manta_ray_init(void) { - struct Object *sp1C; - sp1C = spawn_object(o, MODEL_NONE, bhvMantaRayRingManager); - if (sp1C != NULL) { - o->parentObj = sp1C; + struct Object *ringManager; + ringManager = spawn_object(o, MODEL_NONE, bhvMantaRayRingManager); + if (ringManager != NULL) { + o->parentObj = ringManager; } obj_set_hitbox(o, &sMantaRayHitbox); cur_obj_scale(2.5f); network_init_object(o, 4000.0f); - network_init_object_field(o, &o->oMantaUnkF4); - network_init_object_field(o, &o->oMantaUnkF8); - network_init_object_field(o, &o->oMantaUnk1AC); + network_init_object_field(o, &o->oMantaTargetPitch); + network_init_object_field(o, &o->oMantaTargetYaw); + network_init_object_field(o, &o->oWaterRingSpawnerRingsCollected); network_init_object_field(o, &o->oMoveAnglePitch); network_init_object_field(o, &o->oMoveAngleRoll); - if (sp1C != NULL) { - network_init_object_field(o, &sp1C->oWaterRingMgrNextRingIndex); + if (ringManager != NULL) { + network_init_object_field(o, &ringManager->oWaterRingMgrNextRingIndex); } } -void manta_ray_move(void) { - s16 sp1E; - s32 sp18 = 0; +static void manta_ray_move(void) { + s16 animFrame; + s32 pathStatus = 0; - sp1E = o->header.gfx.animInfo.animFrame; + animFrame = o->header.gfx.animInfo.animFrame; gCurrentObject->oPathedStartWaypoint = (struct Waypoint *) sMantaRayTraj; - sp18 = cur_obj_follow_path(sp18); - o->oMantaUnkF8 = o->oPathedTargetYaw; - o->oMantaUnkF4 = o->oPathedTargetPitch; + pathStatus = cur_obj_follow_path(pathStatus); + o->oMantaTargetYaw = o->oPathedTargetYaw; + o->oMantaTargetPitch = o->oPathedTargetPitch; o->oForwardVel = 10.0f; - o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oMantaUnkF8, 0x80); - o->oMoveAnglePitch = approach_s16_symmetric(o->oMoveAnglePitch, o->oMantaUnkF4, 0x80); - if ((s16) o->oMantaUnkF8 != (s16) o->oMoveAngleYaw) { + + o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oMantaTargetYaw, 0x80); + o->oMoveAnglePitch = approach_s16_symmetric(o->oMoveAnglePitch, o->oMantaTargetPitch, 0x80); + + // This causes the ray to tilt as it turns. + if ((s16) o->oMantaTargetYaw != (s16) o->oMoveAngleYaw) { o->oMoveAngleRoll -= 91; - if (o->oMoveAngleRoll < -5461.3332) + if (o->oMoveAngleRoll < -5461.3332) { o->oMoveAngleRoll = -0x4000 / 3; + } } else { o->oMoveAngleRoll += 91; - if (o->oMoveAngleRoll > 5461.3332) + if (o->oMoveAngleRoll > 5461.3332) { o->oMoveAngleRoll = 0x4000 / 3; + } } cur_obj_set_pos_via_transform(); - if (sp1E == 0) + if (animFrame == 0) { cur_obj_play_sound_2(SOUND_GENERAL_MOVING_WATER); + } } -void manta_ray_act_spawn_ring(void) { - struct Object *sp1C = o->parentObj; - struct Object *sp18; +static void manta_ray_act_spawn_ring(void) { + struct Object *ringManager = o->parentObj; + struct Object *ring; - if (o->oTimer == 300) + if (o->oTimer == 300) { o->oTimer = 0; - + } + if (!network_owns_object(o)) { return; } if (o->oTimer == 0 || o->oTimer == 50 || o->oTimer == 150 || o->oTimer == 200 || o->oTimer == 250) { - sp18 = spawn_object(o, MODEL_WATER_RING, bhvMantaRayWaterRing); - if (sp18 != NULL) { - sp18->oFaceAngleYaw = o->oMoveAngleYaw; - sp18->oFaceAnglePitch = o->oMoveAnglePitch + 0x4000; - sp18->oPosX = o->oPosX + 200.0f * sins(o->oMoveAngleYaw + 0x8000); - sp18->oPosY = o->oPosY + 10.0f + 200.0f * sins(o->oMoveAnglePitch); - sp18->oPosZ = o->oPosZ + 200.0f * coss(o->oMoveAngleYaw + 0x8000); - sp18->oWaterRingIndex = sp1C->oWaterRingMgrNextRingIndex; + ring = spawn_object(o, MODEL_WATER_RING, bhvMantaRayWaterRing); + if (ring != NULL) { + ring->oFaceAngleYaw = o->oMoveAngleYaw; + ring->oFaceAnglePitch = o->oMoveAnglePitch + 0x4000; + ring->oPosX = o->oPosX + 200.0f * sins(o->oMoveAngleYaw + 0x8000); + ring->oPosY = o->oPosY + 10.0f + 200.0f * sins(o->oMoveAnglePitch); + ring->oPosZ = o->oPosZ + 200.0f * coss(o->oMoveAngleYaw + 0x8000); + ring->oWaterRingIndex = ringManager->oWaterRingMgrNextRingIndex; } - sp1C->oWaterRingMgrNextRingIndex++; - if (sp1C->oWaterRingMgrNextRingIndex > 0x2710) - sp1C->oWaterRingMgrNextRingIndex = 0; - - if (sp18 != NULL) { - struct Object* spawn_objects[] = { sp18 }; + ringManager->oWaterRingMgrNextRingIndex++; + if (ringManager->oWaterRingMgrNextRingIndex > 10000) { + ringManager->oWaterRingMgrNextRingIndex = 0; + } + + if (ring != NULL) { + struct Object *spawn_objects[] = { ring }; u32 models[] = { MODEL_WATER_RING }; network_send_spawn_objects(spawn_objects, models, 1); } @@ -105,23 +121,29 @@ void manta_ray_act_spawn_ring(void) { } } +/** + * Behavior that occurs every frame. + */ void bhv_manta_ray_loop(void) { switch (o->oAction) { - case 0: + case MANTA_ACT_SPAWN_RINGS: manta_ray_move(); manta_ray_act_spawn_ring(); - if (o->oMantaUnk1AC == 5) { + + // Spawn a star after collecting 5 rings. + if (o->oWaterRingSpawnerRingsCollected == 5) { spawn_mist_particles(); spawn_default_star(-3180.0f, -3600.0f, 120.0f); - o->oAction = 1; + o->oAction = MANTA_ACT_NO_RINGS; } break; - case 1: + case MANTA_ACT_NO_RINGS: manta_ray_move(); break; } - if (o->oInteractStatus & INT_STATUS_INTERACTED) + if (o->oInteractStatus & INT_STATUS_INTERACTED) { o->oInteractStatus = 0; + } } diff --git a/src/game/behaviors/mips.inc.c b/src/game/behaviors/mips.inc.c index f3582c8e..10c86405 100644 --- a/src/game/behaviors/mips.inc.c +++ b/src/game/behaviors/mips.inc.c @@ -86,7 +86,7 @@ s16 bhv_mips_find_furthest_waypoint_to_mario(void) { // For each waypoint in MIPS path... for (i = 0; i < 10; i++) { - waypoint = segmented_to_virtual(*(pathBase + i)); + waypoint = segmented_to_virtual(pathBase[i]); x = waypoint->pos[0]; y = waypoint->pos[1]; z = waypoint->pos[2]; diff --git a/src/game/behaviors/moving_coin.inc.c b/src/game/behaviors/moving_coin.inc.c index a470065c..8a57205a 100644 --- a/src/game/behaviors/moving_coin.inc.c +++ b/src/game/behaviors/moving_coin.inc.c @@ -104,11 +104,7 @@ void bhv_moving_blue_coin_init(void) { } void bhv_moving_blue_coin_loop(void) { -#ifdef VERSION_EU - s32 collisionFlags; -#else s16 collisionFlags; -#endif switch (o->oAction) { case MOV_BCOIN_ACT_STILL: diff --git a/src/game/behaviors/mushroom_1up.inc.c b/src/game/behaviors/mushroom_1up.inc.c index 9c5197be..c0f9dd0e 100644 --- a/src/game/behaviors/mushroom_1up.inc.c +++ b/src/game/behaviors/mushroom_1up.inc.c @@ -3,9 +3,12 @@ void bhv_1up_interact(void) { struct MarioState* marioState = nearest_mario_state_to_object(o); if (marioState->playerIndex == 0 && obj_check_if_collided_with_object(o, marioState->marioObj) == 1) { - play_sound(SOUND_GENERAL_COLLECT_1UP, gDefaultSoundArgs); + play_sound(SOUND_GENERAL_COLLECT_1UP, gGlobalSoundSource); marioState->numLives++; o->activeFlags = ACTIVE_FLAG_DEACTIVATED; +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif network_send_collect_item(o); } } @@ -78,7 +81,7 @@ void bhv_1up_walking_loop(void) { spawn_object(o, MODEL_NONE, bhvSparkleSpawn); if (o->oTimer == 0) - play_sound(SOUND_GENERAL2_1UP_APPEAR, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_1UP_APPEAR, gGlobalSoundSource); one_up_loop_in_air(); @@ -115,7 +118,7 @@ void bhv_1up_running_away_loop(void) { spawn_object(o, MODEL_NONE, bhvSparkleSpawn); if (o->oTimer == 0) - play_sound(SOUND_GENERAL2_1UP_APPEAR, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_1UP_APPEAR, gGlobalSoundSource); one_up_loop_in_air(); @@ -239,7 +242,7 @@ void bhv_1up_hidden_loop(void) { o->oVelY = 40.0f; o->oAction = 3; o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; - play_sound(SOUND_GENERAL2_1UP_APPEAR, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_1UP_APPEAR, gGlobalSoundSource); } break; @@ -317,7 +320,7 @@ void bhv_1up_hidden_in_pole_loop(void) { o->oVelY = 40.0f; o->oAction = 3; o->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; - play_sound(SOUND_GENERAL2_1UP_APPEAR, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_1UP_APPEAR, gGlobalSoundSource); } break; diff --git a/src/game/behaviors/purple_switch.inc.c b/src/game/behaviors/purple_switch.inc.c index c1b3e653..d22c487e 100644 --- a/src/game/behaviors/purple_switch.inc.c +++ b/src/game/behaviors/purple_switch.inc.c @@ -61,9 +61,9 @@ void bhv_purple_switch_loop(void) { o->oAction++; } else { if (o->oTimer < 360) { - play_sound(SOUND_GENERAL2_SWITCH_TICK_FAST, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_SWITCH_TICK_FAST, gGlobalSoundSource); } else { - play_sound(SOUND_GENERAL2_SWITCH_TICK_SLOW, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_SWITCH_TICK_SLOW, gGlobalSoundSource); } if (o->oTimer > 400) { o->oAction = PURPLE_SWITCH_WAIT_FOR_MARIO_TO_GET_OFF; diff --git a/src/game/behaviors/racing_penguin.inc.c b/src/game/behaviors/racing_penguin.inc.c index 7f7588b2..b07879a4 100644 --- a/src/game/behaviors/racing_penguin.inc.c +++ b/src/game/behaviors/racing_penguin.inc.c @@ -93,11 +93,11 @@ static void racing_penguin_act_wait_for_mario(void) { u8 racing_penguin_act_show_init_text_continue_dialog(void) { return o->oAction == RACING_PENGUIN_ACT_SHOW_INIT_TEXT; } static void racing_penguin_act_show_init_text(void) { - s32 response; - struct Object *child; + s32 response = obj_update_race_proposition_dialog(&gMarioStates[0], sRacingPenguinData[o->oBehParams2ndByte].text, racing_penguin_act_show_init_text_continue_dialog); - response = obj_update_race_proposition_dialog(&gMarioStates[0], sRacingPenguinData[o->oBehParams2ndByte].text, racing_penguin_act_show_init_text_continue_dialog); if (response == 1) { + struct Object *child; + child = cur_obj_nearest_object_with_behavior(bhvPenguinRaceFinishLine); child->parentObj = o; @@ -112,7 +112,6 @@ static void racing_penguin_act_show_init_text(void) { o->oVelY = 60.0f; network_send_object(o); - } else if (response == 2) { o->oAction = RACING_PENGUIN_ACT_WAIT_FOR_MARIO; o->oRacingPenguinInitTextCooldown = 60; diff --git a/src/game/behaviors/red_coin.inc.c b/src/game/behaviors/red_coin.inc.c index 1e5c8584..40d7d6da 100644 --- a/src/game/behaviors/red_coin.inc.c +++ b/src/game/behaviors/red_coin.inc.c @@ -70,7 +70,7 @@ void bhv_red_coin_loop(void) { #ifndef VERSION_JP play_sound(SOUND_MENU_COLLECT_RED_COIN + (((u8) o->parentObj->oHiddenStarTriggerCounter - 1) << 16), - gDefaultSoundArgs); + gGlobalSoundSource); #endif } diff --git a/src/game/behaviors/sliding_platform_2.inc.c b/src/game/behaviors/sliding_platform_2.inc.c index 59968282..ab7f2bd1 100644 --- a/src/game/behaviors/sliding_platform_2.inc.c +++ b/src/game/behaviors/sliding_platform_2.inc.c @@ -1,6 +1,6 @@ // sliding_platform_2.inc.c -void const *D_80331A24[] = { +static void const *sSlidingPlatform2CollisionData[] = { bits_seg7_collision_0701A9A0, bits_seg7_collision_0701AA0C, bitfs_seg7_collision_07015714, @@ -12,23 +12,23 @@ void const *D_80331A24[] = { }; void bhv_sliding_plat_2_init(void) { - s32 val04; + s32 collisionDataIndex; - val04 = ((u16)(o->oBehParams >> 16) & 0x0380) >> 7; - o->collisionData = segmented_to_virtual(D_80331A24[val04]); - o->oBackAndForthPlatformUnkF8 = 50.0f * ((u16)(o->oBehParams >> 16) & 0x003F); + collisionDataIndex = ((u16)(o->oBehParams >> 16) & 0x0380) >> 7; + o->collisionData = segmented_to_virtual(sSlidingPlatform2CollisionData[collisionDataIndex]); + o->oBackAndForthPlatformPathLength = 50.0f * ((u16)(o->oBehParams >> 16) & 0x003F); - if (val04 < 5 || val04 > 6) { - o->oBackAndForthPlatformUnk100 = 15.0f; + if (collisionDataIndex < 5 || collisionDataIndex > 6) { + o->oBackAndForthPlatformVel = 15.0f; if ((u16)(o->oBehParams >> 16) & 0x0040) { o->oMoveAngleYaw += 0x8000; } } else { - o->oBackAndForthPlatformUnk100 = 10.0f; + o->oBackAndForthPlatformVel = 10.0f; if ((u16)(o->oBehParams >> 16) & 0x0040) { - o->oBackAndForthPlatformUnkF4 = -1.0f; + o->oBackAndForthPlatformDirection = -1.0f; } else { - o->oBackAndForthPlatformUnkF4 = 1.0f; + o->oBackAndForthPlatformDirection = 1.0f; } } } @@ -36,29 +36,30 @@ void bhv_sliding_plat_2_init(void) { void bhv_sliding_plat_2_loop(void) { if (!network_sync_object_initialized(o)) { struct SyncObject* so = network_init_object(o, 4000.0f); + if (so) { so->minUpdateRate = 5.0f; - network_init_object_field(o, &o->oBackAndForthPlatformUnkF4); - network_init_object_field(o, &o->oBackAndForthPlatformUnkF8); - network_init_object_field(o, &o->oBackAndForthPlatformUnkFC); - network_init_object_field(o, &o->oBackAndForthPlatformUnk100); + network_init_object_field(o, &o->oBackAndForthPlatformDirection); + network_init_object_field(o, &o->oBackAndForthPlatformPathLength); + network_init_object_field(o, &o->oBackAndForthPlatformDistance); + network_init_object_field(o, &o->oBackAndForthPlatformVel); } } if (o->oTimer > 10) { - o->oBackAndForthPlatformUnkFC += o->oBackAndForthPlatformUnk100; - if (clamp_f32(&o->oBackAndForthPlatformUnkFC, -o->oBackAndForthPlatformUnkF8, 0.0f)) { - o->oBackAndForthPlatformUnk100 = -o->oBackAndForthPlatformUnk100; + o->oBackAndForthPlatformDistance += o->oBackAndForthPlatformVel; + if (clamp_f32(&o->oBackAndForthPlatformDistance, -o->oBackAndForthPlatformPathLength, 0.0f)) { + o->oBackAndForthPlatformVel = -o->oBackAndForthPlatformVel; o->oTimer = 0; } } obj_perform_position_op(0); - if (o->oBackAndForthPlatformUnkF4 != 0.0f) { - o->oPosY = o->oHomeY + o->oBackAndForthPlatformUnkFC * o->oBackAndForthPlatformUnkF4; + if (o->oBackAndForthPlatformDirection != 0.0f) { + o->oPosY = o->oHomeY + o->oBackAndForthPlatformDistance * o->oBackAndForthPlatformDirection; } else { - obj_set_dist_from_home(o->oBackAndForthPlatformUnkFC); + obj_set_dist_from_home(o->oBackAndForthPlatformDistance); } obj_perform_position_op(1); diff --git a/src/game/behaviors/sound_ambient.inc.c b/src/game/behaviors/sound_ambient.inc.c index 9c349c14..bf5765da 100644 --- a/src/game/behaviors/sound_ambient.inc.c +++ b/src/game/behaviors/sound_ambient.inc.c @@ -4,5 +4,5 @@ void bhv_ambient_sounds_init(void) { if (gCamera->mode == CAMERA_MODE_BEHIND_MARIO) return; - play_sound(SOUND_AIR_CASTLE_OUTDOORS_AMBIENT, gDefaultSoundArgs); + play_sound(SOUND_AIR_CASTLE_OUTDOORS_AMBIENT, gGlobalSoundSource); } diff --git a/src/game/behaviors/treasure_chest.inc.c b/src/game/behaviors/treasure_chest.inc.c index bf95e97e..8187b5f5 100644 --- a/src/game/behaviors/treasure_chest.inc.c +++ b/src/game/behaviors/treasure_chest.inc.c @@ -66,8 +66,8 @@ void bhv_treasure_chest_bottom_init(void) { void bhv_treasure_chest_bottom_loop(void) { if (o->parentObj != NULL && o->parentObj->oTreasureChestSound != 0) { switch (o->parentObj->oTreasureChestSound) { - case 1: play_sound(SOUND_GENERAL2_RIGHT_ANSWER, gDefaultSoundArgs); break; - case 2: play_sound(SOUND_MENU_CAMERA_BUZZ, gDefaultSoundArgs); break; + case 1: play_sound(SOUND_GENERAL2_RIGHT_ANSWER, gGlobalSoundSource); break; + case 2: play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource); break; case 3: play_puzzle_jingle(); fade_volume_scale(0, 127, 1000); break; case 4: play_puzzle_jingle(); break; } @@ -80,7 +80,7 @@ void bhv_treasure_chest_bottom_loop(void) { if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 150)) { if (!o->parentObj->oTreasureChestUnkF8) { if (o->parentObj->oTreasureChestUnkF4 == o->oBehParams2ndByte) { - play_sound(SOUND_GENERAL2_RIGHT_ANSWER, gDefaultSoundArgs); + play_sound(SOUND_GENERAL2_RIGHT_ANSWER, gGlobalSoundSource); o->parentObj->oTreasureChestUnkF4++; o->oAction = 1; o->parentObj->oTreasureChestSound = 1; @@ -91,7 +91,7 @@ void bhv_treasure_chest_bottom_loop(void) { o->parentObj->oTreasureChestUnkF8 = 1; o->oAction = 2; cur_obj_become_tangible(); - play_sound(SOUND_MENU_CAMERA_BUZZ, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource); o->parentObj->oTreasureChestSound = 2; network_send_object(o->parentObj); o->parentObj->oTreasureChestSound = 0; @@ -169,12 +169,15 @@ void bhv_treasure_chest_ship_loop(void) { case 1: if (gEnvironmentRegions != NULL) { gEnvironmentRegions[6] += -5; - play_sound(SOUND_ENV_WATER_DRAIN, gDefaultSoundArgs); + play_sound(SOUND_ENV_WATER_DRAIN, gGlobalSoundSource); set_environmental_camera_shake(SHAKE_ENV_JRB_SHIP_DRAIN); if (gEnvironmentRegions[6] < -335) { gEnvironmentRegions[6] = -335; o->activeFlags = 0; } +#ifdef VERSION_SH + reset_rumble_timers_2(2); +#endif } break; } diff --git a/src/game/behaviors/water_pillar.inc.c b/src/game/behaviors/water_pillar.inc.c index ddf2f231..8b8b007c 100644 --- a/src/game/behaviors/water_pillar.inc.c +++ b/src/game/behaviors/water_pillar.inc.c @@ -1,7 +1,7 @@ // water_pillar.c.inc void water_level_pillar_undrained(void) { - struct Object *sp1C; + struct Object *otherWaterPillar; switch (o->oAction) { case 0: if (cur_obj_is_mario_ground_pounding_platform()) { @@ -17,16 +17,16 @@ void water_level_pillar_undrained(void) { o->oAction++; break; case 2: - sp1C = cur_obj_nearest_object_with_behavior(bhvWaterLevelPillar); - if (sp1C != NULL) { - if (sp1C->oAction < 2) + otherWaterPillar = cur_obj_nearest_object_with_behavior(bhvWaterLevelPillar); + if (otherWaterPillar != NULL) { + if (otherWaterPillar->oAction < 2) o->oAction++; } break; case 3: - sp1C = cur_obj_nearest_object_with_behavior(bhvWaterLevelPillar); - if (sp1C != NULL) { - if (sp1C->oAction > 1) { + otherWaterPillar = cur_obj_nearest_object_with_behavior(bhvWaterLevelPillar); + if (otherWaterPillar != NULL) { + if (otherWaterPillar->oAction > 1) { o->oAction++; save_file_set_flags(SAVE_FLAG_MOAT_DRAINED); diff --git a/src/game/behaviors/water_ring.inc.c b/src/game/behaviors/water_ring.inc.c index d0db20f2..e0d5d237 100644 --- a/src/game/behaviors/water_ring.inc.c +++ b/src/game/behaviors/water_ring.inc.c @@ -67,11 +67,11 @@ void water_ring_check_collection(f32 avgScale, struct Object *ringManager) { if (ringSpawner->oWaterRingSpawnerRingsCollected < 6) { spawn_orange_number(ringSpawner->oWaterRingSpawnerRingsCollected, 0, -40, 0); #ifdef VERSION_JP - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); #else play_sound(SOUND_MENU_COLLECT_SECRET + (((u8) ringSpawner->oWaterRingSpawnerRingsCollected - 1) << 16), - gDefaultSoundArgs); + gGlobalSoundSource); #endif } diff --git a/src/game/behaviors/water_splashes_and_waves.inc.c b/src/game/behaviors/water_splashes_and_waves.inc.c index 4a15e9a8..8ea14a4b 100644 --- a/src/game/behaviors/water_splashes_and_waves.inc.c +++ b/src/game/behaviors/water_splashes_and_waves.inc.c @@ -51,7 +51,7 @@ void bhv_water_splash_spawn_droplets(void) { if (o->oTimer == 0) o->oPosY = find_water_level(o->oPosX, o->oPosZ); - if (o->oPosY > -10000.0f) // Make sure it is not at the default water level + if (o->oPosY > FLOOR_LOWER_LIMIT_MISC) // Make sure it is not at the default water level for (i = 0; i < 3; i++) spawn_water_droplet(o, &sWaterSplashDropletParams); } @@ -88,7 +88,7 @@ void bhv_water_droplet_loop(void) { } else if (o->oTimer > 20) obj_mark_for_deletion(o); } - if (waterLevel < -10000.0f) + if (waterLevel < FLOOR_LOWER_LIMIT_MISC) obj_mark_for_deletion(o); } diff --git a/src/game/behaviors/whomp.inc.c b/src/game/behaviors/whomp.inc.c index 781cb5fd..bbadb6c4 100644 --- a/src/game/behaviors/whomp.inc.c +++ b/src/game/behaviors/whomp.inc.c @@ -29,7 +29,7 @@ void whomp_act_0(void) { if (o->oSubAction == 0) { if (distanceToPlayer < 600.0f) { o->oSubAction++; - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); } else { cur_obj_set_pos_to_home(); o->oHealth = 3; diff --git a/src/game/behaviors/wiggler.inc.c b/src/game/behaviors/wiggler.inc.c index c1d95b04..4a20ed96 100644 --- a/src/game/behaviors/wiggler.inc.c +++ b/src/game/behaviors/wiggler.inc.c @@ -220,7 +220,7 @@ static void wiggler_act_walk(void) { // Update text if necessary if (o->oWigglerTextStatus < WIGGLER_TEXT_STATUS_COMPLETED_DIALOG) { if (o->oWigglerTextStatus == WIGGLER_TEXT_STATUS_AWAIT_DIALOG) { - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); o->oWigglerTextStatus = WIGGLER_TEXT_STATUS_SHOWING_DIALOG; } diff --git a/src/game/behaviors/yoshi.inc.c b/src/game/behaviors/yoshi.inc.c index 2a2937a0..dda8f9e9 100644 --- a/src/game/behaviors/yoshi.inc.c +++ b/src/game/behaviors/yoshi.inc.c @@ -149,14 +149,14 @@ void yoshi_give_present_loop(void) { s32 sp1C = gGlobalTimer; if (gHudDisplay.lives == 100) { - play_sound(SOUND_GENERAL_COLLECT_1UP, gDefaultSoundArgs); + play_sound(SOUND_GENERAL_COLLECT_1UP, gGlobalSoundSource); gSpecialTripleJump = TRUE; o->oAction = YOSHI_ACT_WALK_JUMP_OFF_ROOF; return; } if ((sp1C & 0x03) == 0) { - play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gDefaultSoundArgs); + play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gGlobalSoundSource); gMarioState->numLives++; } } @@ -229,7 +229,7 @@ void bhv_yoshi_loop(void) { gSpecialTripleJump = 1; sYoshiTalkingState = 3; } else if ((gGlobalTimer & 0x03) == 0) { - play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gDefaultSoundArgs); + play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gGlobalSoundSource); gMarioStates[0].numLives++; } } diff --git a/src/game/bettercamera.inc.h b/src/game/bettercamera.inc.h index fc063e2a..6689d2d9 100644 --- a/src/game/bettercamera.inc.h +++ b/src/game/bettercamera.inc.h @@ -274,7 +274,7 @@ static void newcam_rotate_button(void) { //8 directional camera rotation input for buttons. if ((gPlayer1Controller->buttonPressed & L_CBUTTONS) && newcam_analogue == 0) { #ifndef nosound - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); #endif if (newcam_modeflags & NC_FLAG_8D) newcam_yaw_target = newcam_yaw_target+(ivrt(0)*0x2000); @@ -283,7 +283,7 @@ static void newcam_rotate_button(void) { newcam_centering = 1; } else if ((gPlayer1Controller->buttonPressed & R_CBUTTONS) && newcam_analogue == 0) { #ifndef nosound - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); #endif if (newcam_modeflags & NC_FLAG_8D) newcam_yaw_target = newcam_yaw_target-(ivrt(0)*0x2000); @@ -325,7 +325,7 @@ static void newcam_rotate_button(void) { newcam_yaw_target = newcam_yaw+(ivrt(0)*0x3000); newcam_centering = 1; #ifndef nosound - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); #endif } newcam_framessincec[0] = 0; @@ -335,7 +335,7 @@ static void newcam_rotate_button(void) { newcam_yaw_target = newcam_yaw-(ivrt(0)*0x3000); newcam_centering = 1; #ifndef nosound - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); #endif } newcam_framessincec[1] = 0; @@ -354,7 +354,7 @@ static void newcam_rotate_button(void) { newcam_cstick_down = 1; newcam_centering = 1; #ifndef nosound - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); #endif if (newcam_stick2[0] > 20) { if (newcam_modeflags & NC_FLAG_8D) @@ -408,7 +408,7 @@ static void newcam_zoom_button(void) { } else if (gPlayer1Controller->buttonPressed & R_TRIG && newcam_modeflags & NC_FLAG_XTURN) { //Each time the player presses R, but NOT L the camera zooms out more, until it hits the limit and resets back to close view. #ifndef nosound - play_sound(SOUND_MENU_CLICK_CHANGE_VIEW, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_CHANGE_VIEW, gGlobalSoundSource); #endif if (newcam_distance_target == newcam_distance_values[0]) diff --git a/src/game/camera.c b/src/game/camera.c index e4e95ee2..c9555c94 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -275,7 +275,7 @@ s16 sCutsceneShot; */ s16 gCutsceneTimer; s16 unused8033B3E8; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s16 unused8033B3E82; #endif /** @@ -4884,23 +4884,23 @@ void play_camera_buzz_if_c_sideways(void) { } void play_sound_cbutton_up(void) { - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); } void play_sound_cbutton_down(void) { - play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource); } void play_sound_cbutton_side(void) { - play_sound(SOUND_MENU_CAMERA_TURN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_TURN, gGlobalSoundSource); } void play_sound_button_change_blocked(void) { - play_sound(SOUND_MENU_CAMERA_BUZZ, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource); } void play_sound_rbutton_changed(void) { - play_sound(SOUND_MENU_CLICK_CHANGE_VIEW, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_CHANGE_VIEW, gGlobalSoundSource); } void play_sound_if_cam_switched_to_lakitu_or_mario(void) { @@ -6709,22 +6709,18 @@ s16 camera_course_processing(struct Camera *c) { break; case AREA_WDW_MAIN: - if (sMarioGeometry.currFloorType == SURFACE_INSTANT_WARP_1B) { - if (0) { - } - c->defMode = CAMERA_MODE_RADIAL; - if (0) { - } + switch (sMarioGeometry.currFloorType) { + case SURFACE_INSTANT_WARP_1B: + c->defMode = CAMERA_MODE_RADIAL; + break; } break; case AREA_WDW_TOWN: - if (sMarioGeometry.currFloorType == SURFACE_INSTANT_WARP_1C) { - if (0) { - } - c->defMode = CAMERA_MODE_CLOSE; - if (0) { - } + switch (sMarioGeometry.currFloorType) { + case SURFACE_INSTANT_WARP_1C: + c->defMode = CAMERA_MODE_CLOSE; + break; } break; @@ -7047,6 +7043,7 @@ void init_spline_point(struct CutsceneSplinePoint *splinePoint, s8 index, u8 spe vec3s_copy(splinePoint->point, point); } +// TODO: (Scrub C) void copy_spline_segment(struct CutsceneSplinePoint dst[], struct CutsceneSplinePoint src[]) { s32 j = 0; s32 i = 0; @@ -7107,7 +7104,7 @@ static UNUSED void unused_cutscene_mario_dialog_looking_up(UNUSED struct Camera */ BAD_RETURN(s32) cutscene_intro_peach_start_letter_music(UNUSED struct Camera *c) { #if defined(VERSION_US) || defined(VERSION_SH) - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); #endif cutscene_intro_peach_play_message_music(); } @@ -7117,7 +7114,7 @@ BAD_RETURN(s32) cutscene_intro_peach_start_letter_music(UNUSED struct Camera *c) */ BAD_RETURN(s32) cutscene_intro_peach_start_flying_music(UNUSED struct Camera *c) { #ifndef VERSION_JP - sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); + seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); #endif cutscene_intro_peach_play_lakitu_flying_music(); } @@ -7128,7 +7125,7 @@ BAD_RETURN(s32) cutscene_intro_peach_start_flying_music(UNUSED struct Camera *c) * starts. */ BAD_RETURN(s32) cutscene_intro_peach_eu_lower_volume(UNUSED struct Camera *c) { - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); } #endif @@ -7284,11 +7281,11 @@ void set_flag_post_door(struct Camera *c) { } void cutscene_soften_music(UNUSED struct Camera *c) { - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); } void cutscene_unsoften_music(UNUSED struct Camera *c) { - sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); + seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); } static void stub_camera_5(UNUSED struct Camera *c) { @@ -9629,7 +9626,7 @@ BAD_RETURN(s32) peach_letter_text(UNUSED struct Camera *c) { #ifndef VERSION_JP BAD_RETURN(s32) play_sound_peach_reading_letter(UNUSED struct Camera *c) { - play_sound(SOUND_PEACH_DEAR_MARIO, gDefaultSoundArgs); + play_sound(SOUND_PEACH_DEAR_MARIO, gGlobalSoundSource); } #endif @@ -9711,7 +9708,7 @@ BAD_RETURN(s32) play_sound_intro_turn_on_hud(UNUSED struct Camera *c) { BAD_RETURN(s32) cutscene_intro_peach_fly_to_pipe(struct Camera *c) { #if defined(VERSION_US) || defined(VERSION_SH) cutscene_event(play_sound_intro_turn_on_hud, c, 818, 818); -#elif VERSION_EU +#elif defined(VERSION_EU) cutscene_event(play_sound_intro_turn_on_hud, c, 673, 673); #endif cutscene_spawn_obj(6, 1); @@ -10513,12 +10510,21 @@ struct Cutscene sCutsceneEnding[] = { { cutscene_ending_kiss, 0x10b }, #else { cutscene_ending_mario_land_closeup, 75 }, +#ifdef VERSION_SH + { cutscene_ending_stars_free_peach, 431 }, +#else { cutscene_ending_stars_free_peach, 386 }, +#endif { cutscene_ending_peach_appears, 139 }, { cutscene_ending_peach_descends, 590 }, { cutscene_ending_mario_to_peach, 95 }, +#ifdef VERSION_SH + { cutscene_ending_peach_wakeup, 455 }, + { cutscene_ending_dialog, 286 }, +#else { cutscene_ending_peach_wakeup, 425 }, { cutscene_ending_dialog, 236 }, +#endif { cutscene_ending_kiss, 245 }, #endif { cutscene_ending_cake_for_mario, CUTSCENE_LOOP }, diff --git a/src/game/characters.c b/src/game/characters.c index 7c7449dc..91aefda0 100644 --- a/src/game/characters.c +++ b/src/game/characters.c @@ -4,9 +4,9 @@ #include "hud.h" #include "model_ids.h" #include "object_constants.h" -#include "audio_defines.h" -#include "luigi_audio_defines.h" -#include "wario_audio_defines.h" +#include "sounds.h" +#include "luigi_sounds.h" +#include "wario_sounds.h" #include "pc/configfile.h" #include "audio/external.h" #include "engine/graph_node.h" diff --git a/src/game/envfx_bubbles.c b/src/game/envfx_bubbles.c index 7c0b119a..1e4c84f8 100644 --- a/src/game/envfx_bubbles.c +++ b/src/game/envfx_bubbles.c @@ -150,14 +150,14 @@ void envfx_set_lava_bubble_position(s32 index, Vec3s centerPos) { floorY = find_floor((gEnvFxBuffer + index)->xPos, centerY + 500, (gEnvFxBuffer + index)->zPos, &surface); if (surface == NULL) { - (gEnvFxBuffer + index)->yPos = -10000; + (gEnvFxBuffer + index)->yPos = FLOOR_LOWER_LIMIT_MISC; return; } if (surface->type == SURFACE_BURNING) { (gEnvFxBuffer + index)->yPos = floorY; } else { - (gEnvFxBuffer + index)->yPos = -10000; + (gEnvFxBuffer + index)->yPos = FLOOR_LOWER_LIMIT_MISC; } } @@ -189,7 +189,7 @@ void envfx_update_lava(Vec3s centerPos) { } if ((chance = (s32)(random_float() * 16.0f)) == 8) { - play_sound(SOUND_GENERAL_QUIET_BUBBLE2, gDefaultSoundArgs); + play_sound(SOUND_GENERAL_QUIET_BUBBLE2, gGlobalSoundSource); } } @@ -364,17 +364,12 @@ s32 envfx_init_bubble(s32 mode) { bzero(gEnvFxBuffer, sBubbleParticleCount * sizeof(struct EnvFxParticle)); bzero(gEnvFxBubbleConfig, sizeof(gEnvFxBubbleConfig)); - if (mode == ENVFX_LAVA_BUBBLES) { - //! Dead code - if (0) { - } - - for (i = 0; i < sBubbleParticleCount; i++) { - (gEnvFxBuffer + i)->animFrame = random_float() * 7.0f; - } - - if (0) { - } + switch (mode) { + case ENVFX_LAVA_BUBBLES: + for (i = 0; i < sBubbleParticleCount; i++) { + (gEnvFxBuffer + i)->animFrame = random_float() * 7.0f; + } + break; } gEnvFxMode = mode; @@ -422,16 +417,11 @@ void envfx_bubbles_update_switch(s32 mode, Vec3s camTo, Vec3s vertex1, Vec3s ver * Append 15 vertices to 'gfx', which is enough for 5 bubbles starting at * 'index'. The 3 input vertices represent the rotated triangle around (0,0,0) * that will be translated to bubble positions to draw the bubble image - * - * TODO: (Scrub C) */ void append_bubble_vertex_buffer(Gfx *gfx, s32 index, Vec3s vertex1, Vec3s vertex2, Vec3s vertex3, Vtx *template) { s32 i = 0; Vtx *vertBuf = alloc_display_list(15 * sizeof(Vtx)); -#ifdef VERSION_EU - Vtx *p; -#endif if (vertBuf == NULL) { return; @@ -439,43 +429,19 @@ void append_bubble_vertex_buffer(Gfx *gfx, s32 index, Vec3s vertex1, Vec3s verte for (i = 0; i < 15; i += 3) { vertBuf[i] = template[0]; -#ifdef VERSION_EU - p = vertBuf; - p += i; - p[0].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex1[0]; - p[0].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex1[1]; - p[0].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex1[2]; -#else - vertBuf[i].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex1[0]; - vertBuf[i].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex1[1]; - vertBuf[i].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex1[2]; -#endif + (vertBuf + i)->v.ob[0] = (gEnvFxBuffer + (index + i / 3))->xPos + vertex1[0]; + (vertBuf + i)->v.ob[1] = (gEnvFxBuffer + (index + i / 3))->yPos + vertex1[1]; + (vertBuf + i)->v.ob[2] = (gEnvFxBuffer + (index + i / 3))->zPos + vertex1[2]; vertBuf[i + 1] = template[1]; -#ifdef VERSION_EU - p = vertBuf; - p += i; - p[1].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex2[0]; - p[1].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex2[1]; - p[1].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex2[2]; -#else - vertBuf[i + 1].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex2[0]; - vertBuf[i + 1].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex2[1]; - vertBuf[i + 1].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex2[2]; -#endif + (vertBuf + i + 1)->v.ob[0] = (gEnvFxBuffer + (index + i / 3))->xPos + vertex2[0]; + (vertBuf + i + 1)->v.ob[1] = (gEnvFxBuffer + (index + i / 3))->yPos + vertex2[1]; + (vertBuf + i + 1)->v.ob[2] = (gEnvFxBuffer + (index + i / 3))->zPos + vertex2[2]; vertBuf[i + 2] = template[2]; -#ifdef VERSION_EU - p = vertBuf; - p += i; - p[2].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex3[0]; - p[2].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex3[1]; - p[2].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex3[2]; -#else - vertBuf[i + 2].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex3[0]; - vertBuf[i + 2].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex3[1]; - vertBuf[i + 2].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex3[2]; -#endif + (vertBuf + i + 2)->v.ob[0] = (gEnvFxBuffer + (index + i / 3))->xPos + vertex3[0]; + (vertBuf + i + 2)->v.ob[1] = (gEnvFxBuffer + (index + i / 3))->yPos + vertex3[1]; + (vertBuf + i + 2)->v.ob[2] = (gEnvFxBuffer + (index + i / 3))->zPos + vertex3[2]; } gSPVertex(gfx, VIRTUAL_TO_PHYSICAL(vertBuf), 15, 0); diff --git a/src/game/envfx_snow.c b/src/game/envfx_snow.c index d2212ef6..9f79a05f 100644 --- a/src/game/envfx_snow.c +++ b/src/game/envfx_snow.c @@ -363,17 +363,12 @@ void rotate_triangle_vertices(Vec3s vertex1, Vec3s vertex2, Vec3s vertex3, s16 p * 'index' in the buffer. The 3 input vertices represent the rotated triangle * around (0,0,0) that will be translated to snowflake positions to draw the * snowflake image. - * - * TODO: (Scrub C) */ void append_snowflake_vertex_buffer(Gfx *gfx, s32 index, Vec3s vertex1, Vec3s vertex2, Vec3s vertex3) { s32 i = 0; Vtx *vertBuf = (Vtx *) alloc_display_list(15 * sizeof(Vtx)); Vtx *vertBufInterpolated = (Vtx *) alloc_display_list(15 * sizeof(Vtx)); Vtx *v; -#ifdef VERSION_EU - Vtx *p; -#endif if (vertBuf == NULL) { return; @@ -381,43 +376,19 @@ void append_snowflake_vertex_buffer(Gfx *gfx, s32 index, Vec3s vertex1, Vec3s ve for (i = 0; i < 15; i += 3) { vertBuf[i] = gSnowTempVtx[0]; -#ifdef VERSION_EU - p = vertBuf; - p += i; - p[0].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex1[0]; - p[0].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex1[1]; - p[0].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex1[2]; -#else - vertBuf[i].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex1[0]; - vertBuf[i].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex1[1]; - vertBuf[i].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex1[2]; -#endif + (vertBuf + i)->v.ob[0] = (gEnvFxBuffer + (index + i / 3))->xPos + vertex1[0]; + (vertBuf + i)->v.ob[1] = (gEnvFxBuffer + (index + i / 3))->yPos + vertex1[1]; + (vertBuf + i)->v.ob[2] = (gEnvFxBuffer + (index + i / 3))->zPos + vertex1[2]; vertBuf[i + 1] = gSnowTempVtx[1]; -#ifdef VERSION_EU - p = vertBuf; - p += i; - p[1].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex2[0]; - p[1].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex2[1]; - p[1].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex2[2]; -#else - vertBuf[i + 1].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex2[0]; - vertBuf[i + 1].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex2[1]; - vertBuf[i + 1].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex2[2]; -#endif + (vertBuf + i + 1)->v.ob[0] = (gEnvFxBuffer + (index + i / 3))->xPos + vertex2[0]; + (vertBuf + i + 1)->v.ob[1] = (gEnvFxBuffer + (index + i / 3))->yPos + vertex2[1]; + (vertBuf + i + 1)->v.ob[2] = (gEnvFxBuffer + (index + i / 3))->zPos + vertex2[2]; vertBuf[i + 2] = gSnowTempVtx[2]; -#ifdef VERSION_EU - p = vertBuf; - p += i; - p[2].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex3[0]; - p[2].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex3[1]; - p[2].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex3[2]; -#else - vertBuf[i + 2].v.ob[0] = gEnvFxBuffer[index + i / 3].xPos + vertex3[0]; - vertBuf[i + 2].v.ob[1] = gEnvFxBuffer[index + i / 3].yPos + vertex3[1]; - vertBuf[i + 2].v.ob[2] = gEnvFxBuffer[index + i / 3].zPos + vertex3[2]; -#endif + (vertBuf + i + 2)->v.ob[0] = (gEnvFxBuffer + (index + i / 3))->xPos + vertex3[0]; + (vertBuf + i + 2)->v.ob[1] = (gEnvFxBuffer + (index + i / 3))->yPos + vertex3[1]; + (vertBuf + i + 2)->v.ob[2] = (gEnvFxBuffer + (index + i / 3))->zPos + vertex3[2]; } for (i = 0; i < 15; i++) { diff --git a/src/game/game_init.c b/src/game/game_init.c index 42a15d08..630daf1c 100644 --- a/src/game/game_init.c +++ b/src/game/game_init.c @@ -19,9 +19,9 @@ #include "print.h" #include "segment2.h" #include "segment_symbols.h" -#include "thread6.h" #include "rng_position.h" #include "src/pc/djui/djui.h" +#include "rumble_init.h" #include #ifdef BETTERCAMERA #include "bettercamera.h" @@ -61,7 +61,7 @@ u32 gGlobalTimer = 0; static u16 sCurrFBNum = 0; u16 frameBufferIndex = 0; -void (*D_8032C6A0)(void) = NULL; +void (*gGoddardVblankCallback)(void) = NULL; struct Controller *gPlayer1Controller = &gControllers[0]; struct Controller *gPlayer2Controller = &gControllers[1]; // probably debug only, see note below @@ -300,9 +300,9 @@ void config_gfx_pool(void) { void display_and_vsync(void) { profiler_log_thread5_time(BEFORE_DISPLAY_LISTS); osRecvMesg(&D_80339CB8, &D_80339BEC, OS_MESG_BLOCK); - if (D_8032C6A0 != NULL) { - D_8032C6A0(); - D_8032C6A0 = NULL; + if (gGoddardVblankCallback != NULL) { + gGoddardVblankCallback(); + gGoddardVblankCallback = NULL; } send_display_list(&gGfxPool->spTask); profiler_log_thread5_time(AFTER_DISPLAY_LISTS); @@ -597,7 +597,7 @@ void game_loop_one_iteration(void) { // if any controllers are plugged in, start read the data for when // read_controller_inputs is called later. if (gControllerBits) { - // block_until_rumble_pak_free(); + //block_until_rumble_pak_free(); osContStartReadData(&gSIEventMesgQueue); } diff --git a/src/game/game_init.h b/src/game/game_init.h index 68856207..e2033acb 100644 --- a/src/game/game_init.h +++ b/src/game/game_init.h @@ -45,7 +45,7 @@ extern struct GfxPool *gGfxPool; extern u8 gControllerBits; extern s8 gEepromProbe; -extern void (*D_8032C6A0)(void); +extern void (*gGoddardVblankCallback)(void); extern struct Controller *gPlayer1Controller; extern struct Controller *gPlayer2Controller; extern struct Controller *gPlayer3Controller; diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index c7017f26..98da3bd3 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -69,7 +69,7 @@ enum DialogMark { DIALOG_MARK_NONE = 0, DIALOG_MARK_DAKUTEN = 1, DIALOG_MARK_HAN #define DEFAULT_DIALOG_BOX_ANGLE 90.0f #define DEFAULT_DIALOG_BOX_SCALE 19.0f -#if !defined(VERSION_JP) && !defined(VERSION_SH) +#if defined(VERSION_US) || defined(VERSION_EU) u8 gDialogCharWidths[256] = { // TODO: Is there a way to auto generate this? 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 5, 8, 8, 6, 6, 6, 6, 6, 5, 6, 6, @@ -670,7 +670,7 @@ void print_hud_lut_string(s8 hudLUT, s16 x, s16 y, const u8 *str) { if (hudLUT == HUD_LUT_JPMENU) { xStride = 16; } else { // HUD_LUT_GLOBAL -#if defined(VERSION_JP) +#ifdef VERSION_JP xStride = 14; #else xStride = 12; //? Shindou uses this. @@ -678,8 +678,9 @@ void print_hud_lut_string(s8 hudLUT, s16 x, s16 y, const u8 *str) { } while (str[strPos] != GLOBAR_CHAR_TERMINATOR) { -#ifdef VERSION_EU +#ifndef VERSION_JP switch (str[strPos]) { +#ifdef VERSION_EU case GLOBAL_CHAR_SPACE: curX += xStride / 2; break; @@ -695,38 +696,32 @@ void print_hud_lut_string(s8 hudLUT, s16 x, s16 y, const u8 *str) { print_hud_char_umlaut(curX, curY, ASCII_TO_DIALOG('U')); curX += xStride; break; +#else + case GLOBAL_CHAR_SPACE: + curX += 8; + break; +#endif default: #endif -#if defined(VERSION_US) || defined(VERSION_SH) - if (str[strPos] == GLOBAL_CHAR_SPACE) { - if (0) //! dead code - { - } - curX += 8; - ; //! useless statement - } else { -#endif - gDPPipeSync(gDisplayListHead++); + gDPPipeSync(gDisplayListHead++); - if (hudLUT == HUD_LUT_JPMENU) - gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, hudLUT1[str[strPos]]); + if (hudLUT == HUD_LUT_JPMENU) { + gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, hudLUT1[str[strPos]]); + } - if (hudLUT == HUD_LUT_GLOBAL) - gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, hudLUT2[str[strPos]]); + if (hudLUT == HUD_LUT_GLOBAL) { + gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, hudLUT2[str[strPos]]); + } - gSPDisplayList(gDisplayListHead++, dl_rgba16_load_tex_block); - gSPTextureRectangle(gDisplayListHead++, curX << 2, curY << 2, (curX + 16) << 2, - (curY + 16) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPDisplayList(gDisplayListHead++, dl_rgba16_load_tex_block); + gSPTextureRectangle(gDisplayListHead++, curX << 2, curY << 2, (curX + 16) << 2, + (curY + 16) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); - curX += xStride; -#ifdef VERSION_EU - break; + curX += xStride; +#ifndef VERSION_JP } #endif -#if defined(VERSION_US) || defined(VERSION_SH) - } -#endif - strPos++; + strPos++; } } @@ -749,8 +744,8 @@ void print_menu_char_umlaut(s16 x, s16 y, u8 chr) { void print_menu_generic_string(s16 x, s16 y, const u8 *str) { UNUSED s8 mark = DIALOG_MARK_NONE; // unused in EU s32 strPos = 0; - s32 curX = x; - s32 curY = y; + u32 curX = x; + u32 curY = y; void **fontLUT = segmented_to_virtual(menu_font_lut); while (str[strPos] != DIALOG_CHAR_TERMINATOR) { @@ -792,7 +787,7 @@ void print_menu_generic_string(s16 x, s16 y, const u8 *str) { gDPLoadSync(gDisplayListHead++); gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_8b_BYTES)); gSPTextureRectangle(gDisplayListHead++, (curX + 6) << 2, (curY - 7) << 2, - (curX + 14) << 2, (curY + 1) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + (curX + 6 + 8) << 2, (curY - 7 + 8) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); mark = DIALOG_MARK_NONE; } @@ -865,7 +860,7 @@ void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8 //! Probably originally a >=, but later replaced with an == and an else statement. currentIndex[0] = maxIndex; } else { - play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CHANGE_SELECT, gGlobalSoundSource); currentIndex[0]++; } } @@ -874,7 +869,7 @@ void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8 if (currentIndex[0] == minIndex) { // Same applies to here as above } else { - play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CHANGE_SELECT, gGlobalSoundSource); currentIndex[0]--; } } @@ -1064,7 +1059,7 @@ void reset_dialog_render_state(void) { #if defined(VERSION_JP) || defined(VERSION_SH) #define X_VAL1 -5.0f #define Y_VAL1 2.0 -#define Y_VAL2 4.0f +#define Y_VAL2 4 #else #define X_VAL1 -7.0f #define Y_VAL1 5.0 @@ -1335,7 +1330,7 @@ u32 ensure_nonnegative(s16 value) { return value; } -#if defined(VERSION_JP) || defined(VERSION_SH) +#if defined(VERSION_JP) void handle_dialog_text_and_pages(s8 colorMode, struct DialogEntry *dialog) #else void handle_dialog_text_and_pages(s8 colorMode, struct DialogEntry *dialog, s8 lowerBound) @@ -1411,6 +1406,9 @@ void handle_dialog_text_and_pages(s8 colorMode, struct DialogEntry *dialog, s8 l gDialogX = 0; #else handle_dialog_scroll_page_state(lineNum, totalLines, &pageState, &xMatrix, &linePos); +#ifdef VERSION_SH + mark = 0; +#endif #endif break; #ifdef VERSION_EU @@ -1526,20 +1524,26 @@ void handle_dialog_text_and_pages(s8 colorMode, struct DialogEntry *dialog, s8 l #endif default: // any other character #if defined(VERSION_JP) || defined(VERSION_SH) - if (linePos != 0) { - create_dl_translation_matrix(MENU_MTX_NOPUSH, xMatrix * 10, 0, 0); - } +#ifdef VERSION_SH + if (lineNum >= lowerBound && lineNum <= lowerBound + linesPerBox) { +#endif + if (linePos != 0) { + create_dl_translation_matrix(MENU_MTX_NOPUSH, xMatrix * 10, 0, 0); + } - render_generic_char(strChar); - xMatrix = 1; - linePos++; + render_generic_char(strChar); + xMatrix = 1; + linePos++; - if (mark != 0) { - create_dl_translation_matrix(MENU_MTX_PUSH, 5.0f, 7.0f, 0); - render_generic_char(mark + 0xEF); - gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); - mark = 0; + if (mark != 0) { + create_dl_translation_matrix(MENU_MTX_PUSH, 5.0f, 7.0f, 0); + render_generic_char(mark + 0xEF); + gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); + mark = 0; + } +#ifdef VERSION_SH } +#endif #elif defined(VERSION_US) if (lineNum >= lowerBound && lineNum <= lowerBound + linesPerBox) { if (linePos || xMatrix != 1) { @@ -1560,7 +1564,7 @@ void handle_dialog_text_and_pages(s8 colorMode, struct DialogEntry *dialog, s8 l #endif } -#if defined(VERSION_JP) || defined(VERSION_SH) +#if defined(VERSION_JP) if (linePos == 12) { if (str[strIdx + 1] == DIALOG_CHAR_PERIOD) { adjust_pos_and_print_period_char(&xMatrix, &linePos); @@ -1688,7 +1692,7 @@ void handle_special_dialog_text(s16 dialogID) { // dialog ID tables, in order for (i = 0; i < (s16) ARRAY_COUNT(dialogBossStart); i++) { if (dialogBossStart[i] == dialogID) { - sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); + seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(4, SEQ_EVENT_BOSS), 0); return; } @@ -1703,14 +1707,14 @@ void handle_special_dialog_text(s16 dialogID) { // dialog ID tables, in order for (i = 0; i < (s16) ARRAY_COUNT(dialogStarSound); i++) { if (dialogStarSound[i] == dialogID && gDialogLineNum == 1) { - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); return; } } for (i = 0; i < (s16) ARRAY_COUNT(dialogBossStop); i++) { if (dialogBossStop[i] == dialogID) { - sequence_player_fade_out(0, 1); + seq_player_fade_out(SEQ_PLAYER_LEVEL, 1); return; } } @@ -1822,7 +1826,7 @@ void render_dialog_entries(void) { #endif void **dialogTable; struct DialogEntry *dialog; -#ifdef VERSION_US +#if defined(VERSION_US) || defined(VERSION_SH) s8 lowerBound = 0; #endif #ifdef VERSION_EU @@ -1858,7 +1862,7 @@ void render_dialog_entries(void) { case DIALOG_STATE_OPENING: if (gDialogBoxOpenTimer == DEFAULT_DIALOG_BOX_ANGLE) { play_dialog_sound(gDialogID); - play_sound(SOUND_MENU_MESSAGE_APPEAR, gDefaultSoundArgs); + play_sound(SOUND_MENU_MESSAGE_APPEAR, gGlobalSoundSource); } if (gDialogBoxType == DIALOG_TYPE_ROTATE) { @@ -1873,7 +1877,7 @@ void render_dialog_entries(void) { gDialogBoxState = DIALOG_STATE_VERTICAL; gDialogLineNum = 1; } -#if !defined(VERSION_JP) && !defined(VERSION_SH) +#if !defined(VERSION_JP) lowerBound = 1; #endif break; @@ -1887,10 +1891,10 @@ void render_dialog_entries(void) { gDialogBoxState = DIALOG_STATE_CLOSING; } else { gDialogBoxState = DIALOG_STATE_HORIZONTAL; - play_sound(SOUND_MENU_MESSAGE_NEXT_PAGE, gDefaultSoundArgs); + play_sound(SOUND_MENU_MESSAGE_NEXT_PAGE, gGlobalSoundSource); } } -#if !defined(VERSION_JP) && !defined(VERSION_SH) +#if !defined(VERSION_JP) lowerBound = 1; #endif break; @@ -1902,14 +1906,14 @@ void render_dialog_entries(void) { gDialogBoxState = DIALOG_STATE_VERTICAL; gDialogScrollOffsetY = 0; } -#if !defined(VERSION_JP) && !defined(VERSION_SH) - lowerBound = (gDialogScrollOffsetY / 16) + 1; +#if !defined(VERSION_JP) + lowerBound = (gDialogScrollOffsetY / DIAG_VAL1) + 1; #endif break; case DIALOG_STATE_CLOSING: if (gDialogBoxOpenTimer == 20.0f) { level_set_transition(0, NULL); - play_sound(SOUND_MENU_MESSAGE_DISAPPEAR, gDefaultSoundArgs); + play_sound(SOUND_MENU_MESSAGE_DISAPPEAR, gGlobalSoundSource); if (gDialogBoxType == DIALOG_TYPE_ZOOM) { trigger_cutscene_dialog(2); @@ -1929,7 +1933,7 @@ void render_dialog_entries(void) { gLastDialogPageStrPos = 0; gDialogResponse = 0; } -#if !defined(VERSION_JP) && !defined(VERSION_SH) +#if !defined(VERSION_JP) lowerBound = 1; #endif break; @@ -1948,8 +1952,7 @@ void render_dialog_entries(void) { ensure_nonnegative(DIAG_VAL2 - dialog->width), SCREEN_WIDTH, scissorHeight); - -#if defined(VERSION_JP) || defined(VERSION_SH) +#if defined(VERSION_JP) handle_dialog_text_and_pages(0, dialog); #else handle_dialog_text_and_pages(0, dialog, lowerBound); @@ -2081,14 +2084,9 @@ void do_cutscene_handler(void) { print_generic_string(x, 240 - gCutsceneMsgYOffset, gEndCutsceneStringsDe[gCutsceneMsgIndex]); break; } -#else -#if defined(VERSION_SH) - // get the x coordinate of where the cutscene string starts. - x = get_str_x_pos_from_center_scale(gCutsceneMsgXOffset, gEndCutsceneStringsEn[gCutsceneMsgIndex], 10.0f); #else // get the x coordinate of where the cutscene string starts. x = get_str_x_pos_from_center(gCutsceneMsgXOffset, gEndCutsceneStringsEn[gCutsceneMsgIndex], 10.0f); -#endif print_generic_string(x, 240 - gCutsceneMsgYOffset, gEndCutsceneStringsEn[gCutsceneMsgIndex]); #endif @@ -2122,7 +2120,7 @@ void do_cutscene_handler(void) { gCutsceneMsgTimer++; } -#if defined(VERSION_JP) || defined(VERSION_SH) +#ifdef VERSION_JP #define PEACH_MESSAGE_TIMER 170 #else #define PEACH_MESSAGE_TIMER 250 @@ -2170,7 +2168,7 @@ void print_peach_letter_message(void) { gDPSetEnvColor(gDisplayListHead++, 20, 20, 20, gCutsceneMsgFade); print_generic_string(STR_X, STR_Y, str); -#if defined(VERSION_JP) || defined(VERSION_SH) +#if defined(VERSION_JP) gSPDisplayList(gDisplayListHead++, dl_ia_text_end); #endif gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255); @@ -2417,7 +2415,7 @@ void render_pause_my_score_coins(void) { } #ifndef VERSION_JP else { -#ifdef VERSION_US +#if defined(VERSION_US) || defined(VERSION_SH) print_generic_string(94, 157, &courseName[3]); #elif defined(VERSION_EU) print_generic_string(get_str_x_pos_from_center(159, &courseName[3], 10.0f), 157, &courseName[3]); @@ -2745,10 +2743,10 @@ s16 render_pause_courses_and_castle(void) { gDialogLineNum = 1; gDialogTextAlpha = 0; //level_set_transition(-1, NULL); -#if defined(VERSION_JP) || defined(VERSION_SH) - play_sound(SOUND_MENU_PAUSE, gDefaultSoundArgs); +#ifdef VERSION_JP + play_sound(SOUND_MENU_PAUSE, gGlobalSoundSource); #else - play_sound(SOUND_MENU_PAUSE_HIGHPRIO, gDefaultSoundArgs); + play_sound(SOUND_MENU_PAUSE_HIGHPRIO, gGlobalSoundSource); #endif if (gCurrCourseNum >= COURSE_MIN && gCurrCourseNum <= COURSE_MAX) { @@ -2777,7 +2775,7 @@ s16 render_pause_courses_and_castle(void) { #endif { level_set_transition(0, NULL); - play_sound(SOUND_MENU_PAUSE_2, gDefaultSoundArgs); + play_sound(SOUND_MENU_PAUSE_2, gGlobalSoundSource); gDialogBoxState = DIALOG_STATE_OPENING; gMenuMode = -1; @@ -2804,7 +2802,7 @@ s16 render_pause_courses_and_castle(void) { #endif { level_set_transition(0, NULL); - play_sound(SOUND_MENU_PAUSE_2, gDefaultSoundArgs); + play_sound(SOUND_MENU_PAUSE_2, gGlobalSoundSource); gMenuMode = -1; gDialogBoxState = DIALOG_STATE_OPENING; @@ -2830,10 +2828,14 @@ s16 render_pause_courses_and_castle(void) { return 0; } -#if defined(VERSION_JP) || defined(VERSION_SH) +#if defined(VERSION_JP) #define TXT_HISCORE_X 112 #define TXT_HISCORE_Y 48 #define TXT_CONGRATS_X 60 +#elif defined(VERSION_SH) +#define TXT_HISCORE_X 118 +#define TXT_HISCORE_Y 48 +#define TXT_CONGRATS_X 70 #else #define TXT_HISCORE_X 109 #define TXT_HISCORE_Y 36 @@ -2910,16 +2912,16 @@ void print_hud_course_complete_coins(s16 x, s16 y) { } else { if ((gCourseDoneMenuTimer & 1) || gHudDisplay.coins > 70) { gCourseCompleteCoins++; - play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gDefaultSoundArgs); + play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gGlobalSoundSource); if (gCourseCompleteCoins == 50 || gCourseCompleteCoins == 100 || gCourseCompleteCoins == 150) { - play_sound(SOUND_GENERAL_COLLECT_1UP, gDefaultSoundArgs); + play_sound(SOUND_GENERAL_COLLECT_1UP, gGlobalSoundSource); gMarioStates[0].numLives++; } } if (gHudDisplay.coins == gCourseCompleteCoins && gGotFileCoinHiScore) { - play_sound(SOUND_MENU_MARIO_CASTLE_WARP2, gDefaultSoundArgs); + play_sound(SOUND_MENU_MARIO_CASTLE_WARP2, gGlobalSoundSource); } } } @@ -2951,7 +2953,7 @@ void play_star_fanfare_and_flash_hud(s32 arg, u8 starNum) { #endif void render_course_complete_lvl_info_and_hud_str(void) { -#if defined(VERSION_JP) || defined(VERSION_SH) +#if defined(VERSION_JP) u8 textSymStar[] = { GLYPH_STAR, GLYPH_SPACE }; u8 textCourse[] = { TEXT_COURSE }; u8 textCatch[] = { TEXT_CATCH }; @@ -3173,7 +3175,7 @@ s16 render_course_complete_screen(void) { #endif )) { level_set_transition(0, NULL); - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); gDialogBoxState = DIALOG_STATE_OPENING; gMenuMode = -1; num = gDialogLineNum; @@ -3197,7 +3199,7 @@ s16 render_course_complete_screen(void) { } // Only case 1 and 2 are used -s16 render_menus_and_dialogs() { +s16 render_menus_and_dialogs(void) { s16 mode = 0; create_dl_ortho_matrix(); diff --git a/src/game/ingame_menu.h b/src/game/ingame_menu.h index d3c21896..f982f289 100644 --- a/src/game/ingame_menu.h +++ b/src/game/ingame_menu.h @@ -20,7 +20,7 @@ #define HUD_LUT_GLOBAL 2 // For file select JP HUD difference -#ifdef VERSION_JP +#if defined(VERSION_JP) || defined(VERSION_SH) #define HUD_LUT_DIFF HUD_LUT_JPMENU #else #define HUD_LUT_DIFF HUD_LUT_GLOBAL @@ -135,10 +135,10 @@ void handle_menu_scrolling(s8 scrollDirection, s8 *currentIndex, s8 minIndex, s8 #if defined(VERSION_US) || defined(VERSION_EU) s16 get_str_x_pos_from_center(s16 centerPos, u8 *str, f32 scale); #endif -#ifdef VERSION_JP +#if defined(VERSION_JP) || defined(VERSION_SH) #define get_str_x_pos_from_center get_str_x_pos_from_center_scale #endif -#if defined(VERSION_JP) || defined(VERSION_EU) +#if defined(VERSION_JP) || defined(VERSION_EU) || defined(VERSION_SH) s16 get_str_x_pos_from_center_scale(s16 centerPos, u8 *str, f32 scale); #endif void print_hud_my_score_coins(s32 useCourseCoinScore, s8 fileNum, s8 courseNum, s16 x, s16 y); diff --git a/src/game/interaction.c b/src/game/interaction.c index 92e5a94d..5288da2e 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -23,7 +23,7 @@ #include "seq_ids.h" #include "sm64.h" #include "sound_init.h" -#include "thread6.h" +#include "rumble_init.h" #include "pc/configfile.h" #include "pc/network/network.h" diff --git a/src/game/level_update.c b/src/game/level_update.c index 09ad64aa..94c3bdc9 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -28,8 +28,8 @@ #endif #include "level_table.h" #include "course_table.h" -#include "thread6.h" #include "../../include/libc/stdlib.h" +#include "rumble_init.h" #include "pc/pc_main.h" #include "pc/cliopts.h" @@ -58,11 +58,12 @@ s16 gChangeLevelTransition = -1; s16 gChangeAreaIndex = -1; s16 gChangeActNum = -1; -#ifdef VERSION_JP +// TODO: Make these ifdefs better const char *credits01[] = { "1GAME DIRECTOR", "SHIGERU MIYAMOTO" }; const char *credits02[] = { "2ASSISTANT DIRECTORS", "YOSHIAKI KOIZUMI", "TAKASHI TEZUKA" }; const char *credits03[] = { "2SYSTEM PROGRAMMERS", "YASUNARI NISHIDA", "YOSHINORI TANIMOTO" }; const char *credits04[] = { "3PROGRAMMERS", "HAJIME YAJIMA", "DAIKI IWAMOTO", "TOSHIO IWAWAKI" }; +#if defined(VERSION_JP) || defined(VERSION_SH) const char *credits05[] = { "1CAMERA PROGRAMMER", "TAKUMI KAWAGOE" }; const char *credits06[] = { "1MARIO FACE PROGRAMMER", "GILES GODDARD" }; const char *credits07[] = { "2COURSE DIRECTORS", "YOICHI YAMADA", "YASUHISA YAMAMURA" }; @@ -70,6 +71,20 @@ const char *credits08[] = { "2COURSE DESIGNERS", "KENTA USUI", "NAOKI MORI" }; const char *credits09[] = { "3COURSE DESIGNERS", "YOSHIKI HARUHANA", "MAKOTO MIYANAGA", "KATSUHIKO KANNO" }; const char *credits10[] = { "1SOUND COMPOSER", "KOJI KONDO" }; + +#ifdef VERSION_SH +const char *credits11[] = { "4SOUND EFFECTS", "SOUND PROGRAMMER", "YOJI INAGAKI", "HIDEAKI SHIMIZU" }; +const char *credits12[] = { "23D ANIMATORS", "YOSHIAKI KOIZUMI", "SATORU TAKIZAWA" }; +const char *credits13[] = { "1CG DESIGNER", "MASANAO ARIMOTO" }; +const char *credits14[] = { "3TECHNICAL SUPPORT", "TAKAO SAWANO", "HIROHITO YOSHIMOTO", "HIROTO YADA" }; +const char *credits15[] = { "1TECHNICAL SUPPORT", "SGI. 64PROJECT STAFF" }; +const char *credits16[] = { "2PROGRESS MANAGEMENT", "KIMIYOSHI FUKUI", "KEIZO KATO" }; +const char *credits17[] = { "4MARIO VOICE", "PEACH VOICE", "CHARLES MARTINET", "LESLIE SWAN" }; +const char *credits18[] = { "3SPECIAL THANKS TO", "JYOHO KAIHATUBU", "ALL NINTENDO", + "MARIO CLUB STAFF" }; +const char *credits19[] = { "1PRODUCER", "SHIGERU MIYAMOTO" }; +const char *credits20[] = { "1EXECUTIVE PRODUCER", "HIROSHI YAMAUCHI" }; +#else // VERSION_JP const char *credits11[] = { "1SOUND EFFECTS", "YOJI INAGAKI" }; const char *credits12[] = { "1SOUND PROGRAMMER", "HIDEAKI SHIMIZU" }; const char *credits13[] = { "23D ANIMATORS", "YOSHIAKI KOIZUMI", "SATORU TAKIZAWA" }; @@ -81,11 +96,8 @@ const char *credits18[] = { "3SPECIAL THANKS TO", "JYOHO KAIHATUBU", "ALL NINTEN "MARIO CLUB STAFF" }; const char *credits19[] = { "1PRODUCER", "SHIGERU MIYAMOTO" }; const char *credits20[] = { "1EXECUTIVE PRODUCER", "HIROSHI YAMAUCHI" }; -#else -const char *credits01[] = { "1GAME DIRECTOR", "SHIGERU MIYAMOTO" }; -const char *credits02[] = { "2ASSISTANT DIRECTORS", "YOSHIAKI KOIZUMI", "TAKASHI TEZUKA" }; -const char *credits03[] = { "2SYSTEM PROGRAMMERS", "YASUNARI NISHIDA", "YOSHINORI TANIMOTO" }; -const char *credits04[] = { "3PROGRAMMERS", "HAJIME YAJIMA", "DAIKI IWAMOTO", "TOSHIO IWAWAKI" }; +#endif +#else // VERSION_US || VERSION_EU const char *credits05[] = { "4CAMERA PROGRAMMER", "MARIO FACE PROGRAMMER", "TAKUMI KAWAGOE", "GILES GODDARD" }; // US combines camera programmer and Mario face programmer @@ -169,7 +181,7 @@ s16 sDelayedWarpOp; s16 sDelayedWarpTimer; s16 sSourceWarpNodeId; s32 sDelayedWarpArg; -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) s16 unusedEULevelUpdateBss1; #endif s8 sTimerRunning; @@ -500,12 +512,12 @@ void init_mario_after_warp(void) { && sWarpDest.nodeId == 31 #endif ) - play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gDefaultSoundArgs); + play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gGlobalSoundSource); #ifndef VERSION_JP if (sWarpDest.levelNum == LEVEL_CASTLE_GROUNDS && sWarpDest.areaIdx == 1 && (sWarpDest.nodeId == 7 || sWarpDest.nodeId == 10 || sWarpDest.nodeId == 20 || sWarpDest.nodeId == 30)) { - play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gDefaultSoundArgs); + play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gGlobalSoundSource); } #endif } @@ -743,7 +755,7 @@ static void initiate_painting_warp_node(struct WarpNode *pWarpNode) { play_transition_after_delay(WARP_TRANSITION_FADE_INTO_COLOR, 30, 255, 255, 255, 45); level_set_transition(74, basic_update); - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); fadeout_music(398); queue_rumble_data(80, 70); func_sh_8024C89C(1); @@ -764,6 +776,13 @@ void initiate_painting_warp(void) { set_mario_action(gMarioState, ACT_DISAPPEARED, 0); gMarioState->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; + + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); + fadeout_music(398); +#ifdef VERSION_SH + queue_rumble_data(80, 70); + func_sh_8024C89C(1); +#endif } } } @@ -820,7 +839,7 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { sDelayedWarpTimer = 48; sSourceWarpNodeId = WARP_NODE_DEATH; play_transition(WARP_TRANSITION_FADE_INTO_BOWSER, 0x30, 0x00, 0x00, 0x00); - play_sound(SOUND_MENU_BOWSER_LAUGH, gDefaultSoundArgs); + play_sound(SOUND_MENU_BOWSER_LAUGH, gGlobalSoundSource); break; case WARP_OP_EXIT: @@ -847,11 +866,11 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { sSourceWarpNodeId = WARP_NODE_F2; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF); #ifndef VERSION_JP - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); #endif break; - case WARP_OP_UNKNOWN_02: // bbh enter + case WARP_OP_SPIN_SHRINK: // bbh enter if (m->usedObj == NULL) { break; } sDelayedWarpTimer = 30; sSourceWarpNodeId = (m->usedObj->oBehParams & 0x00FF0000) >> 16; @@ -935,7 +954,8 @@ void initiate_delayed_warp(void) { case WARP_OP_CREDITS_END: warp_special(-1); - sound_banks_enable(2, 0x03F0); + sound_banks_enable(SEQ_PLAYER_SFX, + SOUND_BANKS_ALL & ~SOUND_BANKS_DISABLED_AFTER_CREDITS); break; case WARP_OP_DEMO_NEXT: @@ -952,7 +972,8 @@ void initiate_delayed_warp(void) { break; case WARP_OP_CREDITS_NEXT: - sound_banks_disable(2, 0x03FF); + sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL); + gCurrCreditsEntry += 1; gCurrActNum = gCurrCreditsEntry->unk02 & 0x07; if ((gCurrCreditsEntry + 1)->levelNum == LEVEL_NONE) { @@ -1027,7 +1048,7 @@ void update_hud_values(void) { gHudDisplay.keys = gMarioState->numKeys; if (numHealthWedges > gHudDisplay.wedges) { - play_sound(SOUND_MENU_POWER_METER, gDefaultSoundArgs); + play_sound(SOUND_MENU_POWER_METER, gGlobalSoundSource); } gHudDisplay.wedges = numHealthWedges; @@ -1389,7 +1410,7 @@ s32 init_level(void) { } if (gMarioState->action == ACT_INTRO_CUTSCENE) { - sound_banks_disable(2, 0x0330); + sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_DISABLED_DURING_INTRO_CUTSCENE); } return 1; @@ -1497,7 +1518,7 @@ s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum) { * Play the "thank you so much for to playing my game" sound. */ s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1) { - play_sound(SOUND_MENU_THANK_YOU_PLAYING_MY_GAME, gDefaultSoundArgs); + play_sound(SOUND_MENU_THANK_YOU_PLAYING_MY_GAME, gGlobalSoundSource); return 1; } diff --git a/src/game/level_update.h b/src/game/level_update.h index 92252e58..3b326c4c 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -11,23 +11,23 @@ #define TIMER_CONTROL_STOP 2 #define TIMER_CONTROL_HIDE 3 -#define WARP_OP_NONE 0x00 -#define WARP_OP_LOOK_UP 0x01 -#define WARP_OP_UNKNOWN_02 0x02 -#define WARP_OP_WARP_DOOR 0x03 -#define WARP_OP_WARP_OBJECT 0x04 -#define WARP_OP_TELEPORT 0x05 -#define WARP_OP_STAR_EXIT 0x11 -#define WARP_OP_DEATH 0x12 -#define WARP_OP_WARP_FLOOR 0x13 -#define WARP_OP_GAME_OVER 0x14 -#define WARP_OP_CREDITS_END 0x15 -#define WARP_OP_DEMO_NEXT 0x16 -#define WARP_OP_CREDITS_START 0x17 -#define WARP_OP_CREDITS_NEXT 0x18 -#define WARP_OP_DEMO_END 0x19 -#define WARP_OP_FORCE_SYNC 0x20 -#define WARP_OP_EXIT 0x21 +#define WARP_OP_NONE 0x00 +#define WARP_OP_LOOK_UP 0x01 +#define WARP_OP_SPIN_SHRINK 0x02 +#define WARP_OP_WARP_DOOR 0x03 +#define WARP_OP_WARP_OBJECT 0x04 +#define WARP_OP_TELEPORT 0x05 +#define WARP_OP_STAR_EXIT 0x11 +#define WARP_OP_DEATH 0x12 +#define WARP_OP_WARP_FLOOR 0x13 +#define WARP_OP_GAME_OVER 0x14 +#define WARP_OP_CREDITS_END 0x15 +#define WARP_OP_DEMO_NEXT 0x16 +#define WARP_OP_CREDITS_START 0x17 +#define WARP_OP_CREDITS_NEXT 0x18 +#define WARP_OP_DEMO_END 0x19 +#define WARP_OP_FORCE_SYNC 0x20 +#define WARP_OP_EXIT 0x21 #define WARP_OP_TRIGGERS_LEVEL_SELECT 0x10 diff --git a/src/game/macro_presets.c b/src/game/macro_presets.c index d498cbb6..17d16213 100644 --- a/src/game/macro_presets.c +++ b/src/game/macro_presets.c @@ -27,8 +27,8 @@ struct MacroPreset MacroObjectPresets[] = { {bhvBobombBuddyOpensCannon, MODEL_BOBOMB_BUDDY, 0}, {bhvButterfly, MODEL_BUTTERFLY, 0}, // unused {bhvBouncingFireball, MODEL_NONE, 0}, // unused - {bhvLargeFishGroup, MODEL_NONE, 0}, // unused - {bhvLargeFishGroup, MODEL_NONE, 1}, + {bhvFishSpawner, MODEL_NONE, 0}, // unused + {bhvFishSpawner, MODEL_NONE, 1}, {bhvBetaFishSplashSpawner, MODEL_NONE, 0}, {bhvHidden1upInPoleSpawner, MODEL_NONE, 0}, {bhvGoomba, MODEL_GOOMBA, 1}, @@ -239,8 +239,8 @@ struct MacroPreset MacroObjectPresets[] = { {bhvSeaweedBundle, MODEL_NONE, 0}, {bhvBetaChestBottom, MODEL_TREASURE_CHEST_BASE, 0}, // unused {bhvBowserBomb, MODEL_WATER_MINE, 0}, // unused - {bhvLargeFishGroup, MODEL_NONE, 2}, // unused - {bhvLargeFishGroup, MODEL_NONE, 3}, + {bhvFishSpawner, MODEL_NONE, 2}, // unused + {bhvFishSpawner, MODEL_NONE, 3}, {bhvJetStreamRingSpawner, MODEL_WATER_RING, 0}, // unused {bhvJetStreamRingSpawner, MODEL_WATER_RING, 0}, // unused {bhvSkeeter, MODEL_SKEETER, 0}, diff --git a/src/game/macro_special_objects.c b/src/game/macro_special_objects.c index 9254ad21..4531f740 100644 --- a/src/game/macro_special_objects.c +++ b/src/game/macro_special_objects.c @@ -43,7 +43,7 @@ s16 convert_rotation(s16 inRotation) { * parameters filling up the upper 2 bytes of newObj->oBehParams. * The object will not spawn if 'behavior' is NULL. */ -void spawn_macro_abs_yrot_2params(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params) { +void spawn_macro_abs_yrot_2params(s32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params) { if (behavior != NULL) { struct Object *newObj = spawn_object_abs_with_rot( &gMacroObjectDefaultParent, 0, model, behavior, x, y, z, 0, convert_rotation(ry), 0); @@ -58,7 +58,7 @@ void spawn_macro_abs_yrot_2params(u32 model, const BehaviorScript *behavior, s16 * a single parameter filling up the upper byte of newObj->oBehParams. * The object will not spawn if 'behavior' is NULL. */ -void spawn_macro_abs_yrot_param1(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 param) { +void spawn_macro_abs_yrot_param1(s32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 param) { if (behavior != NULL) { struct Object *newObj = spawn_object_abs_with_rot( &gMacroObjectDefaultParent, 0, model, behavior, x, y, z, 0, convert_rotation(ry), 0); @@ -72,7 +72,7 @@ void spawn_macro_abs_yrot_param1(u32 model, const BehaviorScript *behavior, s16 * Spawns an object at an absolute location with currently 3 unknown variables that get converted to * floats. Oddly enough, this function doesn't care if 'behavior' is NULL or not. */ -void spawn_macro_abs_special(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB, +void spawn_macro_abs_special(s32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB, s16 unkC) { struct Object *newObj = spawn_object_abs_with_rot(&gMacroObjectDefaultParent, 0, model, behavior, x, y, z, 0, 0, 0); @@ -253,11 +253,7 @@ void spawn_special_objects(s16 areaIndex, s16 **specialObjList) { s16 y; s16 z; s16 extraParams[4]; -#ifdef VERSION_EU - s16 model; -#else u8 model; -#endif u8 type; u8 presetID; u8 defaultParam; @@ -270,7 +266,7 @@ void spawn_special_objects(s16 areaIndex, s16 **specialObjList) { gMacroObjectDefaultParent.header.gfx.activeAreaIndex = areaIndex; for (i = 0; i < numOfSpecialObjects; i++) { - presetID = (u8) * *specialObjList; + presetID = (u8) **specialObjList; (*specialObjList)++; x = **specialObjList; (*specialObjList)++; diff --git a/src/game/macro_special_objects.h b/src/game/macro_special_objects.h index 8d836b4b..4143f4a7 100644 --- a/src/game/macro_special_objects.h +++ b/src/game/macro_special_objects.h @@ -7,9 +7,9 @@ s16 convert_rotation(s16 inRotation); -void spawn_macro_abs_yrot_2params(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params); -void spawn_macro_abs_yrot_param1(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params); -void spawn_macro_abs_special(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB, s16 unkC); +void spawn_macro_abs_yrot_2params(s32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params); +void spawn_macro_abs_yrot_param1(s32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params); +void spawn_macro_abs_special(s32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB, s16 unkC); void spawn_macro_objects(s16 areaIndex, s16 *macroObjList); void spawn_macro_objects_hardcoded(s16 areaIndex, s16 *macroObjList); diff --git a/src/game/main.c b/src/game/main.c index f1e70660..d3e28ac9 100644 --- a/src/game/main.c +++ b/src/game/main.c @@ -10,7 +10,7 @@ #include "buffers/buffers.h" #include "segments.h" #include "main.h" -#include "thread6.h" +#include "rumble_init.h" /** * WARNING! @@ -33,11 +33,13 @@ OSThread gSoundThread; OSIoMesg gDmaIoMesg; OSMesg D_80339BEC; + OSMesgQueue gDmaMesgQueue; OSMesgQueue gSIEventMesgQueue; OSMesgQueue gPIMesgQueue; OSMesgQueue gIntrMesgQueue; OSMesgQueue gSPTaskMesgQueue; + OSMesg gDmaMesgBuf[1]; OSMesg gPIMesgBuf[32]; OSMesg gSIEventMesgBuf[1]; @@ -64,7 +66,7 @@ struct SPTask *sCurrentDisplaySPTask = NULL; struct SPTask *sNextAudioSPTask = NULL; struct SPTask *sNextDisplaySPTask = NULL; s8 sAudioEnabled = TRUE; -u32 sNumVblanks = 0; +u32 gNumVblanks = 0; s8 gResetTimer = 0; s8 D_8032C648 = 0; s8 gDebugLevelSelect = FALSE; @@ -155,17 +157,17 @@ void create_thread(OSThread *thread, OSId id, void (*entry)(void *), void *arg, } #ifdef VERSION_SH -extern void func_sh_802F69CC(void); +extern void func_sh_802f69cc(void); #endif void handle_nmi_request(void) { gResetTimer = 1; D_8032C648 = 0; - func_80320890(); - sound_banks_disable(2, 0x037A); + stop_sounds_in_continuous_banks(); + sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND); fadeout_music(90); #ifdef VERSION_SH - func_sh_802F69CC(); + func_sh_802f69cc(); #endif } @@ -234,7 +236,7 @@ void handle_vblank(void) { UNUSED s32 pad; // needed to pad the stack stub_main_3(); - sNumVblanks++; + gNumVblanks++; #ifdef VERSION_SH if (gResetTimer > 0 && gResetTimer < 100) { gResetTimer++; diff --git a/src/game/main.h b/src/game/main.h index 0bf659ca..3ea95920 100644 --- a/src/game/main.h +++ b/src/game/main.h @@ -54,7 +54,7 @@ extern struct StructSH8031D9B0 gCurrRumbleSettings; extern struct VblankHandler *gVblankHandler1; extern struct VblankHandler *gVblankHandler2; extern struct SPTask *gActiveSPTask; -extern u32 sNumVblanks; +extern u32 gNumVblanks; extern s8 gResetTimer; extern s8 D_8032C648; extern s8 gDebugLevelSelect; diff --git a/src/game/mario.c b/src/game/mario.c index 92c697c1..443d2401 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -35,7 +35,7 @@ #include "print.h" #include "save_file.h" #include "sound_init.h" -#include "thread6.h" +#include "rumble_init.h" #include "obj_behaviors.h" #include "pc/configfile.h" #include "pc/cheats.h" @@ -291,7 +291,7 @@ void play_mario_jump_sound(struct MarioState *m) { */ void adjust_sound_for_speed(struct MarioState *m) { s32 absForwardVel = (m->forwardVel > 0.0f) ? m->forwardVel : -m->forwardVel; - func_80320A4C(1, (absForwardVel > 100) ? 100 : absForwardVel); + set_sound_moving_speed(SOUND_BANK_MOVING, (absForwardVel > 100) ? 100 : absForwardVel); } /** @@ -1649,7 +1649,7 @@ void update_mario_health(struct MarioState *m) { if (m->playerIndex == 0) { // Play a noise to alert the player when Mario is close to drowning. if (((m->action & ACT_GROUP_MASK) == ACT_GROUP_SUBMERGED) && (m->health < 0x300)) { - play_sound(SOUND_MOVING_ALMOST_DROWNING, gDefaultSoundArgs); + play_sound(SOUND_MOVING_ALMOST_DROWNING, gGlobalSoundSource); if (!gRumblePakTimer) { gRumblePakTimer = 36; if (is_rumble_finished_and_queue_empty()) { @@ -1975,10 +1975,10 @@ s32 execute_mario_action(UNUSED struct Object *o) { // HACK: mute snoring even when we skip the waking up action if (gMarioState->isSnoring && gMarioState->action != ACT_SLEEPING) { - func_803205E8(get_character(gMarioState)->soundSnoring1, gMarioState->marioObj->header.gfx.cameraToObject); - func_803205E8(get_character(gMarioState)->soundSnoring2, gMarioState->marioObj->header.gfx.cameraToObject); + stop_sound(get_character(gMarioState)->soundSnoring1, gMarioState->marioObj->header.gfx.cameraToObject); + stop_sound(get_character(gMarioState)->soundSnoring2, gMarioState->marioObj->header.gfx.cameraToObject); #ifndef VERSION_JP - func_803205E8(get_character(gMarioState)->soundSnoring3, gMarioState->marioObj->header.gfx.cameraToObject); + stop_sound(get_character(gMarioState)->soundSnoring3, gMarioState->marioObj->header.gfx.cameraToObject); #endif gMarioState->isSnoring = FALSE; } diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index 0c925f00..fa73fd89 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -12,7 +12,7 @@ #include "mario.h" #include "mario_step.h" #include "save_file.h" -#include "thread6.h" +#include "rumble_init.h" #ifdef BETTERCAMERA #include "bettercamera.h" #endif @@ -717,6 +717,9 @@ s32 act_twirling(struct MarioState *m) { } m->marioObj->header.gfx.angle[1] += m->twirlYaw; +#ifdef VERSION_SH + reset_rumble_timers(); +#endif return FALSE; } @@ -1114,7 +1117,7 @@ u32 common_air_knockback_step(struct MarioState *m, u32 landAction, u32 hardFall case AIR_STEP_LANDED: if (m->action == ACT_SOFT_BONK) { - queue_rumble_data_mario(m, 5, 80); + queue_rumble_data_mario(m, 5, 40); } if (!check_fall_damage_or_get_stuck(m, hardFallAction)) { #ifndef VERSION_JP @@ -1865,7 +1868,7 @@ s32 act_flying(struct MarioState *m) { } #endif } - queue_rumble_data_mario(m, 5, 80); + queue_rumble_data_mario(m, 5, 60); break; case AIR_STEP_HIT_WALL: diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index 48047f47..4cb40a77 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -15,7 +15,7 @@ #include "interaction.h" #include "camera.h" #include "level_table.h" -#include "thread6.h" +#include "rumble_init.h" #include "object_helpers.h" #include "obj_behaviors.h" #include "level_update.h" @@ -192,7 +192,7 @@ s32 act_holding_pole(struct MarioState *m) { } play_climbing_sounds(m, 2); reset_rumble_timers(m); - func_80320A4C(1, marioObj->oMarioPoleYawVel / 0x100 * 2); + set_sound_moving_speed(SOUND_BANK_MOVING, marioObj->oMarioPoleYawVel / 0x100 * 2); } else { marioObj->oMarioPoleYawVel = 0; m->faceAngle[1] -= m->controller->stickX * 16.0f; diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 1e6d07e1..d8e4fa56 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -26,7 +26,7 @@ #include "save_file.h" #include "seq_ids.h" #include "sound_init.h" -#include "thread6.h" +#include "rumble_init.h" #include "obj_behaviors.h" #include "../../include/libc/stdlib.h" #include "pc/debuglog.h" @@ -1466,7 +1466,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) { mario_set_forward_vel(m, forwardVel); m->flags &= ~MARIO_UNKNOWN_08; if (perform_air_step(m, 0) == AIR_STEP_LANDED) { - level_trigger_warp(m, WARP_OP_UNKNOWN_02); + level_trigger_warp(m, WARP_OP_SPIN_SHRINK); queue_rumble_data_mario(m, 15, 80); m->actionState = 4; } @@ -1912,7 +1912,7 @@ static void intro_cutscene_jump_out_of_pipe(struct MarioState *m) { set_mario_animation(m, MARIO_ANIM_SINGLE_JUMP); mario_set_forward_vel(m, 10.0f); if (perform_air_step(m, 0) == AIR_STEP_LANDED) { - sound_banks_enable(2, 0x0330); + sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_DISABLED_DURING_INTRO_CUTSCENE); play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING); #ifndef VERSION_JP play_character_sound(m, CHAR_SOUND_HAHA); @@ -2264,9 +2264,12 @@ static void end_peach_cutscene_summon_jumbo_star(struct MarioState *m) { play_sound(SOUND_AIR_PEACH_TWINKLE, sEndJumboStarObj->header.gfx.cameraToObject); } -#ifdef VERSION_EU +#if defined(VERSION_EU) #define TIMER_FADE_IN_PEACH 201 #define TIMER_DESCEND_PEACH 280 +#elif defined(VERSION_SH) + #define TIMER_FADE_IN_PEACH 276 + #define TIMER_DESCEND_PEACH 400 #else #define TIMER_FADE_IN_PEACH 276 #define TIMER_DESCEND_PEACH 355 @@ -2279,7 +2282,7 @@ static void end_peach_cutscene_spawn_peach(struct MarioState *m) { play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 14, 255, 255, 255); } if (m->actionTimer == 2) { - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); } if (m->actionTimer == 44) { play_transition(WARP_TRANSITION_FADE_FROM_COLOR, 192, 255, 255, 255); @@ -2401,52 +2404,87 @@ static void end_peach_cutscene_dialog_1(struct MarioState *m) { if (m->playerIndex != 0) { return; } switch (m->actionTimer) { +#ifdef VERSION_SH + case 110: +#else case 80: +#endif sEndPeachAnimation = 6; break; - + +#ifdef VERSION_SH + case 111: +#else case 81: +#endif D_8032CBE4 = 3; break; +#ifdef VERSION_SH + case 175: +#else case 145: +#endif D_8032CBE4 = 2; break; +#ifdef VERSION_SH + case 258: +#else case 228: +#endif D_8032CBE4 = 1; D_8032CBE8 = 1; break; +#ifdef VERSION_SH + case 260: +#else case 230: +#endif set_cutscene_message(160, 227, 0, 30); #ifndef VERSION_JP - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); play_sound(SOUND_PEACH_MARIO, sEndPeachObj->header.gfx.cameraToObject); #endif break; +#ifdef VERSION_SH + case 305: +#else case 275: +#endif D_8032CBE4 = 0; D_8032CBE8 = 0; break; +#ifdef VERSION_SH + case 320: +#else case 290: +#endif set_cutscene_message(160, 227, 1, 60); #ifndef VERSION_JP play_sound(SOUND_PEACH_POWER_OF_THE_STARS, sEndPeachObj->header.gfx.cameraToObject); #endif break; +#ifdef VERSION_SH + case 510: +#else case 480: +#endif advance_cutscene_step(m); break; } } -#ifdef VERSION_EU +#if defined(VERSION_EU) #define TIMER_SOMETHING_SPECIAL 150 #define TIMER_PEACH_KISS 260 +#elif defined(VERSION_SH) + #define TIMER_SOMETHING_SPECIAL 170 + #define TIMER_PEACH_KISS 250 #else #define TIMER_SOMETHING_SPECIAL 130 #define TIMER_PEACH_KISS 200 @@ -2461,18 +2499,30 @@ static void end_peach_cutscene_dialog_2(struct MarioState *m) { sEndPeachAnimation = 9; switch (m->actionTimer) { +#ifdef VERSION_SH + case 39: +#else case 29: +#endif set_cutscene_message(160, 227, 2, 30); #ifndef VERSION_JP play_sound(SOUND_PEACH_THANKS_TO_YOU, sEndPeachObj->header.gfx.cameraToObject); #endif break; +#ifdef VERSION_SH + case 65: +#else case 45: +#endif D_8032CBE8 = 1; break; +#ifdef VERSION_SH + case 105: +#else case 75: +#endif set_cutscene_message(160, 227, 3, 30); #ifndef VERSION_JP play_sound(SOUND_PEACH_THANK_YOU_MARIO, sEndPeachObj->header.gfx.cameraToObject); @@ -2585,7 +2635,7 @@ static void end_peach_cutscene_star_dance(struct MarioState *m) { case 140: if (m->playerIndex == 0) { #ifndef VERSION_JP - sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); + seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); #endif play_cutscene_music(SEQUENCE_ARGS(15, SEQ_EVENT_CUTSCENE_CREDITS)); } @@ -2745,10 +2795,14 @@ static s32 act_end_peach_cutscene(struct MarioState *m) { return FALSE; } -#ifdef VERSION_EU +#if defined(VERSION_EU) #define TIMER_CREDITS_SHOW 51 #define TIMER_CREDITS_PROGRESS 80 #define TIMER_CREDITS_WARP 160 +#elif defined(VERSION_SH) + #define TIMER_CREDITS_SHOW 61 + #define TIMER_CREDITS_PROGRESS 90 + #define TIMER_CREDITS_WARP 204 #else #define TIMER_CREDITS_SHOW 61 #define TIMER_CREDITS_PROGRESS 90 diff --git a/src/game/mario_actions_moving.c b/src/game/mario_actions_moving.c index bee6a936..42291e1a 100644 --- a/src/game/mario_actions_moving.c +++ b/src/game/mario_actions_moving.c @@ -11,7 +11,7 @@ #include "mario_actions_object.h" #include "memory.h" #include "behavior_data.h" -#include "thread6.h" +#include "rumble_init.h" #include "pc/debuglog.h" #include "pc/configfile.h" #include "pc/cheats.h" @@ -726,16 +726,13 @@ void tilt_body_walking(struct MarioState *m, s16 startYaw) { struct MarioBodyState *val0C = m->marioBodyState; UNUSED struct Object *marioObj = m->marioObj; s16 animID = m->marioObj->header.gfx.animInfo.animID; - s16 dYaw; - s16 val02; - s16 val00; if (animID == MARIO_ANIM_WALKING || animID == MARIO_ANIM_RUNNING) { - dYaw = m->faceAngle[1] - startYaw; + s16 dYaw = m->faceAngle[1] - startYaw; //! (Speed Crash) These casts can cause a crash if (dYaw * forwardVel / 12) or //! (forwardVel * 170) exceed or equal 2^31. - val02 = -(s16)(dYaw * m->forwardVel / 12.0f); - val00 = (s16)(m->forwardVel * 170.0f); + s16 val02 = -(s16)(dYaw * m->forwardVel / 12.0f); + s16 val00 = (s16)(m->forwardVel * 170.0f); if (val02 > 0x1555) { val02 = 0x1555; @@ -753,7 +750,6 @@ void tilt_body_walking(struct MarioState *m, s16 startYaw) { val0C->torsoAngle[2] = approach_s32(val0C->torsoAngle[2], val02, 0x400, 0x400); val0C->torsoAngle[0] = approach_s32(val0C->torsoAngle[0], val00, 0x400, 0x400); - ; } else { val0C->torsoAngle[2] = 0; val0C->torsoAngle[0] = 0; diff --git a/src/game/mario_actions_object.c b/src/game/mario_actions_object.c index 4bf9e266..5bb0badc 100644 --- a/src/game/mario_actions_object.c +++ b/src/game/mario_actions_object.c @@ -7,9 +7,8 @@ #include "mario.h" #include "audio/external.h" #include "interaction.h" -#include "audio_defines.h" #include "engine/math_util.h" -#include "thread6.h" +#include "rumble_init.h" #include "behavior_data.h" #include "pc/debuglog.h" #include "pc/configfile.h" @@ -451,7 +450,7 @@ s32 act_holding_bowser(struct MarioState *m) { s32 act_releasing_bowser(struct MarioState *m) { if (++m->actionTimer == 1 && m->playerIndex == 0) { if (m->actionArg == 0) { - queue_rumble_data_mario(m, 4, 50); + queue_rumble_data_mario(m, 5, 50); mario_throw_held_object(m); } else { queue_rumble_data_mario(m, 4, 50); diff --git a/src/game/mario_actions_stationary.c b/src/game/mario_actions_stationary.c index 6d46cd23..5319ee77 100644 --- a/src/game/mario_actions_stationary.c +++ b/src/game/mario_actions_stationary.c @@ -15,7 +15,7 @@ #include "save_file.h" #include "sound_init.h" #include "surface_terrains.h" -#include "thread6.h" +#include "rumble_init.h" #include "pc/debuglog.h" #include "pc/configfile.h" #include "pc/network/network.h" @@ -336,10 +336,10 @@ s32 act_sleeping(struct MarioState *m) { s32 act_waking_up(struct MarioState *m) { if (!m->actionTimer) { - func_803205E8(get_character(m)->soundSnoring1, m->marioObj->header.gfx.cameraToObject); - func_803205E8(get_character(m)->soundSnoring2, m->marioObj->header.gfx.cameraToObject); + stop_sound(get_character(m)->soundSnoring1, m->marioObj->header.gfx.cameraToObject); + stop_sound(get_character(m)->soundSnoring2, m->marioObj->header.gfx.cameraToObject); #ifndef VERSION_JP - func_803205E8(get_character(m)->soundSnoring3, m->marioObj->header.gfx.cameraToObject); + stop_sound(get_character(m)->soundSnoring3, m->marioObj->header.gfx.cameraToObject); #endif if (m->playerIndex == 0) { raise_background_noise(2); diff --git a/src/game/mario_actions_submerged.c b/src/game/mario_actions_submerged.c index 8454287f..2b41d7aa 100644 --- a/src/game/mario_actions_submerged.c +++ b/src/game/mario_actions_submerged.c @@ -15,7 +15,7 @@ #include "audio/external.h" #include "behavior_data.h" #include "level_table.h" -#include "thread6.h" +#include "rumble_init.h" #include "pc/debuglog.h" #include "pc/configfile.h" #include "pc/network/network.h" diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index 7c92da1e..f71f1262 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -171,7 +171,7 @@ Gfx *geo_draw_mario_head_goddard(s32 callContext, struct GraphNode *node, Mat4 * gd_copy_p1_contpad(gPlayer1Controller->controllerData); } gfx = (Gfx *) PHYSICAL_TO_VIRTUAL(gdm_gettestdl(asGenerated->parameter)); - D_8032C6A0 = gd_vblank; + gGoddardVblankCallback = gd_vblank; sfx = gd_sfx_to_play(); play_menu_sounds(sfx); } diff --git a/src/game/mario_step.c b/src/game/mario_step.c index c05039a8..1e0cebae 100644 --- a/src/game/mario_step.c +++ b/src/game/mario_step.c @@ -213,7 +213,7 @@ u32 mario_update_windy_ground(struct MarioState *m) { m->vel[0] += pushSpeed * sins(pushAngle); m->vel[2] += pushSpeed * coss(pushAngle); -#if VERSION_JP +#ifdef VERSION_JP play_sound(SOUND_ENV_WIND2, m->marioObj->header.gfx.cameraToObject); #endif return TRUE; diff --git a/src/game/memory.c b/src/game/memory.c index 788609f5..78ffc84a 100644 --- a/src/game/memory.c +++ b/src/game/memory.c @@ -422,6 +422,7 @@ void func_80278A78(struct MarioAnimation *a, void *b, struct Animation *target) a->targetAnim = target; } +// TODO: (Scrub C) s32 load_patchable_table(struct MarioAnimation *a, u32 index) { s32 ret = FALSE; struct MarioAnimDmaRelatedThing *sp20 = a->animDmaTable; diff --git a/src/game/moving_texture.c b/src/game/moving_texture.c index 092fc8f8..94b69d54 100644 --- a/src/game/moving_texture.c +++ b/src/game/moving_texture.c @@ -444,14 +444,13 @@ Gfx *movtex_gen_from_quad(s16 y, struct MovtexQuad *quad) { // Only add commands to change the texture when necessary if (textureId != gMovetexLastTextureId) { - if (textureId == TEXTURE_MIST) { // an ia16 texture - if (0) { - } - gLoadBlockTexture(gfx++, 32, 32, G_IM_FMT_IA, gMovtexIdToTexture[textureId]); - } else { // any rgba16 texture - gLoadBlockTexture(gfx++, 32, 32, G_IM_FMT_RGBA, gMovtexIdToTexture[textureId]); - if (0) { - } + switch (textureId) { + case TEXTURE_MIST: // an ia16 texture + gLoadBlockTexture(gfx++, 32, 32, G_IM_FMT_IA, gMovtexIdToTexture[textureId]); + break; + default: // any rgba16 texture + gLoadBlockTexture(gfx++, 32, 32, G_IM_FMT_RGBA, gMovtexIdToTexture[textureId]); + break; } gMovetexLastTextureId = textureId; } diff --git a/src/game/obj_behaviors.c b/src/game/obj_behaviors.c index 29b70b42..a3b15c2a 100644 --- a/src/game/obj_behaviors.c +++ b/src/game/obj_behaviors.c @@ -35,6 +35,7 @@ #include "pc/network/network.h" #include "pc/network/reservation_area.h" #include "game/rng_position.h" +#include "rumble_init.h" /** * @file obj_behaviors.c @@ -148,7 +149,7 @@ void turn_obj_away_from_surface(f32 velX, f32 velZ, f32 nX, UNUSED f32 nY, f32 n /** * Finds any wall collisions, applies them, and turns away from the surface. */ -s32 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ) { +s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ) { struct WallCollisionData hitbox; f32 wall_nX, wall_nY, wall_nZ, objVelXCopy, objVelZCopy, objYawX, objYawZ; @@ -183,7 +184,7 @@ s32 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ) /** * Turns an object away from steep floors, similarly to walls. */ -s32 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ) { +s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ) { f32 floor_nX, floor_nY, floor_nZ, objVelXCopy, objVelZCopy, objYawX, objYawZ; if (objFloor == NULL) { @@ -426,7 +427,7 @@ s16 object_step(void) { f32 objZ = o->oPosZ; f32 floorY; - f32 waterY = -10000.0; + f32 waterY = FLOOR_LOWER_LIMIT_MISC; f32 objVelX = o->oForwardVel * sins(o->oMoveAngleYaw); f32 objVelZ = o->oForwardVel * coss(o->oMoveAngleYaw); @@ -499,7 +500,7 @@ void obj_move_xyz_using_fvel_and_yaw(struct Object *obj) { /** * Checks if a point is within distance from Mario's graphical position. Test is exclusive. */ -s32 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist) { +s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist) { for (int i = 0; i < MAX_PLAYERS; i++) { if (!is_player_active(&gMarioStates[i])) { continue; } struct Object* player = gMarioStates[i].marioObj; @@ -573,7 +574,7 @@ struct Object* nearest_player_to_object(struct Object *obj) { /** * Checks whether a point is within distance of a given point. Test is exclusive. */ -s32 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist) { +s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist) { f32 objX = obj->oPosX; f32 objY = obj->oPosY; f32 objZ = obj->oPosZ; @@ -601,7 +602,7 @@ void set_object_visibility(struct Object *obj, s32 dist) { /** * Turns an object towards home if Mario is not near to it. */ -s32 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist) { +s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist) { f32 homeDistX = homeX - obj->oPosX; f32 homeDistZ = homeZ - obj->oPosZ; s16 angleTowardsHome = atan2s(homeDistZ, homeDistX); @@ -637,7 +638,7 @@ void obj_return_and_displace_home(struct Object *obj, f32 homeX, UNUSED f32 home * A series of checks using sin and cos to see if a given angle is facing in the same direction * of a given angle, within a certain range. */ -s32 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range) { +s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range) { s16 dAngle = (u16) goal - (u16) base; if (((f32) sins(-range) < (f32) sins(dAngle)) && ((f32) sins(dAngle) < (f32) sins(range)) @@ -651,7 +652,7 @@ s32 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range) { /** * Finds any wall collisions and returns what the displacement vector would be. */ -s32 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius) { +s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius) { struct WallCollisionData hitbox; UNUSED u8 filler[0x20]; @@ -694,7 +695,7 @@ void obj_spawn_yellow_coins(struct Object *obj, s8 nCoins) { /** * Controls whether certain objects should flicker/when to despawn. */ -s32 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan) { +s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan) { if (obj->oTimer < lifeSpan) { return FALSE; } @@ -795,7 +796,7 @@ void obj_check_floor_death(s16 collisionFlags, struct Surface *floor) { * Controls an object dying in lava by creating smoke, sinking the object, playing * audio, and eventually despawning it. Returns TRUE when the obj is dead. */ -s32 obj_lava_death(void) { +s8 obj_lava_death(void) { struct Object *deathSmoke; if (o->oTimer >= 31) { @@ -844,7 +845,7 @@ s8 sDebugTimer = 0; /** * Unused presumably debug function that tracks for a sequence of inputs. */ -s32 UNUSED debug_sequence_tracker(s16 debugInputSequence[]) { +s8 UNUSED debug_sequence_tracker(s16 debugInputSequence[]) { // If end of sequence reached, return true. if (debugInputSequence[sDebugSequenceTracker] == 0) { sDebugSequenceTracker = 0; diff --git a/src/game/obj_behaviors_2.c b/src/game/obj_behaviors_2.c index c7f45cac..af50bb1c 100644 --- a/src/game/obj_behaviors_2.c +++ b/src/game/obj_behaviors_2.c @@ -955,16 +955,16 @@ void treat_far_home_as_mario(f32 threshold, int* distanceToPlayer, int* angleToP */ struct Object* obj_spit_fire(s16 relativePosX, s16 relativePosY, s16 relativePosZ, f32 scale, s32 model, f32 startSpeed, f32 endSpeed, s16 movePitch) { - struct Object *sp2C = spawn_object_relative_with_scale(1, relativePosX, relativePosY, relativePosZ, + struct Object *obj = spawn_object_relative_with_scale(1, relativePosX, relativePosY, relativePosZ, scale, o, model, bhvSmallPiranhaFlame); - if (sp2C != NULL) { - sp2C->oSmallPiranhaFlameStartSpeed = startSpeed; - sp2C->oSmallPiranhaFlameEndSpeed = endSpeed; - sp2C->oSmallPiranhaFlameModel = model; - sp2C->oMoveAnglePitch = movePitch; + if (obj != NULL) { + obj->oSmallPiranhaFlameStartSpeed = startSpeed; + obj->oSmallPiranhaFlameEndSpeed = endSpeed; + obj->oSmallPiranhaFlameModel = model; + obj->oMoveAnglePitch = movePitch; } - return sp2C; + return obj; } #include "behaviors/fire_piranha_plant.inc.c" diff --git a/src/game/paintings.h b/src/game/paintings.h index f88c4b24..3f4334b4 100644 --- a/src/game/paintings.h +++ b/src/game/paintings.h @@ -93,7 +93,7 @@ struct Painting const s16 *const *textureMaps; // Texture data - const u8 *const *textureArray; + const Texture *const *textureArray; s16 textureWidth; s16 textureHeight; diff --git a/src/game/thread6.c b/src/game/rumble_init.c similarity index 91% rename from src/game/thread6.c rename to src/game/rumble_init.c index c30d802f..bf1d71da 100644 --- a/src/game/thread6.c +++ b/src/game/rumble_init.c @@ -3,15 +3,23 @@ #include "buffers/buffers.h" #include "main.h" -#include "thread6.h" +#include "rumble_init.h" #include "object_helpers.h" -static s8 D_SH_8030CCB4; -static s32 sUnusedDisableRumble; -static s32 sRumblePakThreadActive; -static s32 sRumblePakActive; -static s32 sRumblePakErrorCount; -s32 gRumblePakTimer; +s8 D_SH_8031D8F8[0x60]; + +OSMesg gRumblePakSchedulerMesgBuf[1]; +OSMesgQueue gRumblePakSchedulerMesgQueue; +OSMesg gRumbleThreadVIMesgBuf[1]; +OSMesgQueue gRumbleThreadVIMesgQueue; + +struct RumbleData gRumbleDataQueue[3]; +struct StructSH8031D9B0 gCurrRumbleSettings; + +s32 sRumblePakThreadActive = 0; +s32 sRumblePakActive = 0; +s32 sRumblePakErrorCount = 0; +s32 gRumblePakTimer = 0; // These void* are OSPfs* but we don't have that header // And in general, it is not necessary =) @@ -66,7 +74,7 @@ static void stop_rumble(void) { } static void update_rumble_pak(void) { - if (D_SH_8030CCB4 > 0) { + if (gResetTimer > 0) { stop_rumble(); return; } @@ -98,7 +106,7 @@ static void update_rumble_pak(void) { if (gCurrRumbleSettings.unk0A >= 5) { start_rumble(); - } else if ((gCurrRumbleSettings.unk0A >= 2) && (gGlobalTimer % gCurrRumbleSettings.unk0C == 0)) { + } else if ((gCurrRumbleSettings.unk0A >= 2) && (gNumVblanks % gCurrRumbleSettings.unk0C == 0)) { start_rumble(); } else { stop_rumble(); @@ -127,7 +135,7 @@ static void update_rumble_data_queue(void) { } void queue_rumble_data(s16 a0, s16 a1) { - if (sUnusedDisableRumble) { + if (gCurrDemoInput != NULL) { return; } @@ -183,7 +191,7 @@ u8 is_rumble_finished_and_queue_empty(void) { void reset_rumble_timers(struct MarioState* m) { if (m->playerIndex != 0) { return; } - if (sUnusedDisableRumble) { + if (gCurrDemoInput != NULL) { return; } @@ -201,7 +209,7 @@ void reset_rumble_timers(struct MarioState* m) { void reset_rumble_timers_2(struct MarioState* m, s32 a0) { if (m->playerIndex != 0) { return; } - if (sUnusedDisableRumble) { + if (gCurrDemoInput != NULL) { return; } @@ -235,7 +243,7 @@ void reset_rumble_timers_2(struct MarioState* m, s32 a0) { } void func_sh_8024CA04(void) { - if (sUnusedDisableRumble) { + if (gCurrDemoInput != NULL) { return; } diff --git a/src/game/thread6.h b/src/game/rumble_init.h similarity index 90% rename from src/game/thread6.h rename to src/game/rumble_init.h index 8afce716..2c226f70 100644 --- a/src/game/thread6.h +++ b/src/game/rumble_init.h @@ -1,5 +1,5 @@ -#ifndef THREAD6_H -#define THREAD6_H +#ifndef RUMBLE_INIT_H +#define RUMBLE_INIT_H extern s32 gRumblePakTimer; @@ -19,4 +19,4 @@ void create_thread_6(void); void rumble_thread_update_vi(void); void thread6_rumble_loop(void *a0); -#endif // THREAD6_H +#endif // RUMBLE_INIT_H diff --git a/src/game/save_file.c b/src/game/save_file.c index 0cca7d97..bb133a1b 100644 --- a/src/game/save_file.c +++ b/src/game/save_file.c @@ -9,7 +9,7 @@ #include "sound_init.h" #include "level_table.h" #include "course_table.h" -#include "thread6.h" +#include "rumble_init.h" #include "macros.h" #include "pc/ini.h" #include "pc/network/network.h" diff --git a/src/game/shadow.c b/src/game/shadow.c index 12bb1423..ec94f909 100644 --- a/src/game/shadow.c +++ b/src/game/shadow.c @@ -182,7 +182,7 @@ u8 dim_shadow_with_distance(u8 solidity, f32 distFromFloor) { */ f32 get_water_level_below_shadow(struct Shadow *s) { f32 waterLevel = find_water_level(s->parentX, s->parentZ); - if (waterLevel < -10000.0) { + if (waterLevel < FLOOR_LOWER_LIMIT_SHADOW) { return 0; } else if (s->parentY >= waterLevel && s->floorHeight <= waterLevel) { gShadowAboveWaterOrLava = TRUE; @@ -226,7 +226,7 @@ s8 init_shadow(struct Shadow *s, f32 xPos, f32 yPos, f32 zPos, s16 shadowScale, } else if (floorGeometry != NULL) { // Don't draw a shadow if the floor is lower than expected possible, // or if the y-normal is negative (an unexpected result). - if (s->floorHeight < -10000.0 || floorGeometry->normalY <= 0.0) { + if (s->floorHeight < FLOOR_LOWER_LIMIT_SHADOW || floorGeometry->normalY <= 0.0) { return 1; } @@ -695,7 +695,7 @@ Gfx *create_shadow_circle_assuming_flat_ground(f32 xPos, f32 yPos, f32 zPos, s16 f32 floorHeight = find_floor_height_and_data(xPos, yPos, zPos, &dummy); f32 radius = shadowScale / 2; - if (floorHeight < -10000.0) { + if (floorHeight < FLOOR_LOWER_LIMIT_SHADOW) { return NULL; } else { distBelowFloor = floorHeight - yPos; @@ -754,12 +754,12 @@ s32 get_shadow_height_solidity(f32 xPos, f32 yPos, f32 zPos, f32 *shadowHeight, f32 waterLevel; *shadowHeight = find_floor_height_and_data(xPos, yPos, zPos, &dummy); - if (*shadowHeight < -10000.0) { + if (*shadowHeight < FLOOR_LOWER_LIMIT_SHADOW) { return 1; } else { waterLevel = find_water_level(xPos, zPos); - if (waterLevel < -10000.0) { + if (waterLevel < FLOOR_LOWER_LIMIT_SHADOW) { // Dead if-statement. There may have been an assert here. } else if (yPos >= waterLevel && waterLevel >= *shadowHeight) { gShadowAboveWaterOrLava = TRUE; diff --git a/src/game/skybox.c b/src/game/skybox.c index 7dd2e00d..6c037935 100644 --- a/src/game/skybox.c +++ b/src/game/skybox.c @@ -60,7 +60,7 @@ struct Skybox { struct Skybox sSkyBoxInfo[2]; -typedef const u8 *const SkyboxTexture[80]; +typedef const Texture *const SkyboxTexture[80]; extern SkyboxTexture bbh_skybox_ptrlist; extern SkyboxTexture bidw_skybox_ptrlist; diff --git a/src/game/sound_init.c b/src/game/sound_init.c index 70ddf3da..0d6352ee 100644 --- a/src/game/sound_init.c +++ b/src/game/sound_init.c @@ -14,7 +14,7 @@ #include "seq_ids.h" #include "sm64.h" #include "sound_init.h" -#include "thread6.h" +#include "rumble_init.h" #define MUSIC_NONE 0xFFFF @@ -74,52 +74,67 @@ static s8 sPaintingEjectSoundPlayed = FALSE; void play_menu_sounds_extra(s32 a, void *b); +/** + * Called from threads: thread5_game_loop + */ void reset_volume(void) { D_8032C6C0 = 0; } -void lower_background_noise(s32 a) // Soften volume -{ +/** + * Called from threads: thread5_game_loop + */ +void lower_background_noise(s32 a) { switch (a) { case 1: - set_sound_disabled(TRUE); + set_audio_muted(TRUE); break; case 2: - func_8031FFB4(SEQ_PLAYER_LEVEL, 60, 40); // soften music + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); break; } D_8032C6C0 |= a; } -void raise_background_noise(s32 a) // harden volume -{ +/** + * Called from threads: thread5_game_loop + */ +void raise_background_noise(s32 a) { switch (a) { case 1: - set_sound_disabled(FALSE); + set_audio_muted(FALSE); break; case 2: - sequence_player_unlower(SEQ_PLAYER_LEVEL, 60); + seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); break; } D_8032C6C0 &= ~a; } +/** + * Called from threads: thread5_game_loop + */ void disable_background_sound(void) { if (D_8032C6C4 == 0) { D_8032C6C4 = 1; - sound_banks_disable(2, 0x037A); + sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND); } } +/** + * Called from threads: thread5_game_loop + */ void enable_background_sound(void) { if (D_8032C6C4 == 1) { D_8032C6C4 = 0; - sound_banks_enable(2, 0x037A); + sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND); } } /** * Sets the sound mode + * + * Called from threads: thread5_game_loop */ void set_sound_mode(u16 soundMode) { if (soundMode < 3) { @@ -129,38 +144,41 @@ void set_sound_mode(u16 soundMode) { /** * Wrapper method by menu used to set the sound via flags. + * + * Called from threads: thread5_game_loop */ void play_menu_sounds(s16 soundMenuFlags) { - if (soundMenuFlags & SOUND_MENU_FLAG_HANDAPPEAR) { - play_sound(SOUND_MENU_HAND_APPEAR, gDefaultSoundArgs); + play_sound(SOUND_MENU_HAND_APPEAR, gGlobalSoundSource); } else if (soundMenuFlags & SOUND_MENU_FLAG_HANDISAPPEAR) { - play_sound(SOUND_MENU_HAND_DISAPPEAR, gDefaultSoundArgs); + play_sound(SOUND_MENU_HAND_DISAPPEAR, gGlobalSoundSource); } else if (soundMenuFlags & SOUND_MENU_FLAG_UNKNOWN1) { - play_sound(SOUND_MENU_UNK0C, gDefaultSoundArgs); + play_sound(SOUND_MENU_UNK0C, gGlobalSoundSource); } else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE) { - play_sound(SOUND_MENU_PINCH_MARIO_FACE, gDefaultSoundArgs); + play_sound(SOUND_MENU_PINCH_MARIO_FACE, gGlobalSoundSource); } else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE2) { - play_sound(SOUND_MENU_PINCH_MARIO_FACE, gDefaultSoundArgs); + play_sound(SOUND_MENU_PINCH_MARIO_FACE, gGlobalSoundSource); } else if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE) { - play_sound(SOUND_MENU_LET_GO_MARIO_FACE, gDefaultSoundArgs); + play_sound(SOUND_MENU_LET_GO_MARIO_FACE, gGlobalSoundSource); } else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMIN) { - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); } else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMOUT) { - play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource); } if (soundMenuFlags & 0x100) { play_menu_sounds_extra(20, NULL); } - if ((soundMenuFlags & 0x20) != 0) { + if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE) { queue_rumble_data(10, 60); } } /** * Plays the painting eject sound effect if it has not already been played + * + * Called from threads: thread5_game_loop */ void play_painting_eject_sound(void) { if (gRipplingPainting != NULL && gRipplingPainting->state == PAINTING_ENTERED) { @@ -175,6 +193,9 @@ void play_painting_eject_sound(void) { } } +/** + * Called from threads: thread5_game_loop + */ void play_infinite_stairs_music(void) { u8 shouldPlay = FALSE; @@ -197,6 +218,9 @@ void play_infinite_stairs_music(void) { } } +/** + * Called from threads: thread5_game_loop + */ void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer) { if (gResetTimer == 0 && seqArgs != sCurrentMusic) { if (gCurrCreditsEntry != NULL) { @@ -212,6 +236,9 @@ void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer) { } } +/** + * Called from threads: thread3_main, thread5_game_loop + */ void fadeout_music(s16 fadeOutTime) { func_803210D4(fadeOutTime); sCurrentMusic = MUSIC_NONE; @@ -219,23 +246,35 @@ void fadeout_music(s16 fadeOutTime) { sCurrentCapMusic = MUSIC_NONE; } +/** + * Called from threads: thread5_game_loop + */ void fadeout_level_music(s16 fadeTimer) { - sequence_player_fade_out(0, fadeTimer); + seq_player_fade_out(SEQ_PLAYER_LEVEL, fadeTimer); sCurrentMusic = MUSIC_NONE; sCurrentShellMusic = MUSIC_NONE; sCurrentCapMusic = MUSIC_NONE; } +/** + * Called from threads: thread5_game_loop + */ void play_cutscene_music(u16 seqArgs) { play_music(SEQ_PLAYER_LEVEL, seqArgs, 0); sCurrentMusic = seqArgs; } +/** + * Called from threads: thread5_game_loop + */ void play_shell_music(void) { play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP | SEQ_VARIATION), 0); sCurrentShellMusic = SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP | SEQ_VARIATION); } +/** + * Called from threads: thread5_game_loop + */ void stop_shell_music(void) { if (sCurrentShellMusic != MUSIC_NONE) { stop_background_music(sCurrentShellMusic); @@ -243,6 +282,9 @@ void stop_shell_music(void) { } } +/** + * Called from threads: thread5_game_loop + */ void play_cap_music(u16 seqArgs) { play_music(SEQ_PLAYER_LEVEL, seqArgs, 0); if (sCurrentCapMusic != MUSIC_NONE && sCurrentCapMusic != seqArgs) { @@ -251,12 +293,18 @@ void play_cap_music(u16 seqArgs) { sCurrentCapMusic = seqArgs; } +/** + * Called from threads: thread5_game_loop + */ void fadeout_cap_music(void) { if (sCurrentCapMusic != MUSIC_NONE) { fadeout_background_music(sCurrentCapMusic, 600); } } +/** + * Called from threads: thread5_game_loop + */ void stop_cap_music(void) { if (sCurrentCapMusic != MUSIC_NONE) { stop_background_music(sCurrentCapMusic); @@ -264,10 +312,16 @@ void stop_cap_music(void) { } } +/** + * Called from threads: thread5_game_loop + */ void play_menu_sounds_extra(s32 a, void *b) { play_sound(sMenuSoundsExtra[a], b); } +/** + * Called from threads: thread5_game_loop + */ void audio_game_loop_tick(void) { audio_signal_game_loop_tick(); } @@ -291,13 +345,15 @@ void thread4_sound(UNUSED void *arg) { osRecvMesg(&sSoundMesgQueue, &msg, OS_MESG_BLOCK); if (gResetTimer < 25) { struct SPTask *spTask; - profiler_log_thread4_time(); - spTask = create_next_audio_frame_task(); +#ifdef VERSION_SH + spTask = func_sh_802f5a80(); // The function was probably just moved to a different file. Don't kill me. +#else + spTask = create_next_audio_frame_task(); +#endif if (spTask != NULL) { dispatch_audio_sptask(spTask); } - profiler_log_thread4_time(); } } diff --git a/src/game/spawn_object.c b/src/game/spawn_object.c index 8e52d6fd..a76d3c3b 100644 --- a/src/game/spawn_object.c +++ b/src/game/spawn_object.c @@ -198,7 +198,7 @@ void unload_object(struct Object *obj) { obj->prevObj = NULL; obj->header.gfx.throwMatrix = NULL; - func_803206F8(obj->header.gfx.cameraToObject); + stop_sounds_from_source(obj->header.gfx.cameraToObject); geo_remove_child(&obj->header.gfx.node); geo_add_child(&gObjParentGraphNode, &obj->header.gfx.node); diff --git a/src/game/spawn_sound.c b/src/game/spawn_sound.c index 0f208207..6f7afdc7 100644 --- a/src/game/spawn_sound.c +++ b/src/game/spawn_sound.c @@ -8,7 +8,7 @@ #include "object_list_processor.h" #include "sm64.h" #include "spawn_sound.h" -#include "thread6.h" +#include "rumble_init.h" /* * execute an object's current sound state with a provided array diff --git a/src/goddard/bad_declarations.h b/src/goddard/bad_declarations.h index cb66e2ba..e1b0539d 100644 --- a/src/goddard/bad_declarations.h +++ b/src/goddard/bad_declarations.h @@ -33,7 +33,7 @@ extern struct ObjFace *make_face_with_colour(); /* old_menu.h */ extern struct ObjLabel *make_label(); -/* should be: make_label(struct ObjValPtrs *, char *, s32, f32, f32, f32) */ +/* should be: make_label(struct ObjValPtr *, char *, s32, f32, f32, f32) */ #endif /* !AVOID_UB */ diff --git a/src/goddard/debug_utils.c b/src/goddard/debug_utils.c index 7b9203dd..4e851fb3 100644 --- a/src/goddard/debug_utils.c +++ b/src/goddard/debug_utils.c @@ -5,6 +5,7 @@ #include "gd_types.h" #include "macros.h" #include "renderer.h" +#include "draw_objects.h" // types struct UnkBufThing { @@ -14,16 +15,18 @@ struct UnkBufThing { // data static s32 sNumRoutinesInStack = 0; // @ 801A8280 -static s32 D_801A8284[7] = { // TODO: what is this array? - 2, 1, 3, 4, 5, 8, 9 +static s32 sTimerGadgetColours[7] = { + COLOUR_RED, + COLOUR_WHITE, + COLOUR_GREEN, + COLOUR_BLUE, + COLOUR_GRAY, + COLOUR_YELLOW, + COLOUR_PINK }; static s32 sNumActiveMemTrackers = 0; // @ 801A82A0 static u32 sPrimarySeed = 0x12345678; // @ 801A82A4 static u32 sSecondarySeed = 0x58374895; // @ 801A82A8 -static char sHexNumerals[17] = { // @ 801A82AC - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '\0' -}; -static s32 sPadNumPrint = 0; // @ 801A82C0 // bss u8 *gGdStreamBuffer; // @ 801BA190 @@ -33,33 +36,52 @@ static struct GdTimer sTimers[GD_NUM_TIMERS]; // @ 801BA2A0 static struct MemTracker sMemTrackers[GD_NUM_MEM_TRACKERS]; // @ 801BA720 static struct MemTracker *sActiveMemTrackers[16]; // @ 801BA920 -/* @ 23A980 -> 23AA34; orig name: func_8018C1B0 */ +/* + * Memtrackers + * + * These are used to monitor how much heap memory is being used by certain + * operations. + * To create a memtracker, call new_memtracker with a unique name. + * To record the amount of memory used by a certain allocation, call + * start_memtracker before allocating memory, and call stop_memtracker after + * allocating memory. + * The memtracker keeps track of the memory allocated between a single + * start_memtracker/stop_memtracker pair as well as the total memory allocated + * of all start_memtracker/stop_memtracker pairs. + */ + +/** + * Creates a new memtracker with the specified name + */ struct MemTracker *new_memtracker(const char *name) { s32 i; - struct MemTracker *memtrack = NULL; + struct MemTracker *tracker = NULL; for (i = 0; i < ARRAY_COUNT(sMemTrackers); i++) { if (sMemTrackers[i].name == NULL) { sMemTrackers[i].name = name; - memtrack = &sMemTrackers[i]; + tracker = &sMemTrackers[i]; break; } } - if (memtrack != NULL) { - memtrack->total = 0.0f; + if (tracker != NULL) { + tracker->total = 0.0f; } - return memtrack; + return tracker; } -/* @ 23AA34 -> 23AADC; orig name: func_8018C264 */ -struct MemTracker *get_memtracker(const char *tracker) { - s32 i; // sp1C +/** + * Returns the memtracker with the specified name, or NULL if it + * does not exist + */ +struct MemTracker *get_memtracker(const char *name) { + s32 i; for (i = 0; i < ARRAY_COUNT(sMemTrackers); i++) { if (sMemTrackers[i].name != NULL) { - if (gd_str_not_equal(sMemTrackers[i].name, tracker) == FALSE) { + if (gd_str_not_equal(sMemTrackers[i].name, name) == FALSE) { return &sMemTrackers[i]; } } @@ -68,12 +90,13 @@ struct MemTracker *get_memtracker(const char *tracker) { return NULL; } -/* @ 23AADC -> 23ABE0; orig name: func_8018C30C */ +/** + * Records the amount of heap usage before allocating memory. + */ struct MemTracker *start_memtracker(const char *name) { - struct MemTracker *tracker; - - tracker = get_memtracker(name); + struct MemTracker *tracker = get_memtracker(name); + // Create one if it doesn't exist if (tracker == NULL) { tracker = new_memtracker(name); if (tracker == NULL) { @@ -92,13 +115,15 @@ struct MemTracker *start_memtracker(const char *name) { } /* @ 23ABE0 -> 23AC28; not called; orig name: Unknown8018C410 */ -void print_most_recent_memtracker(void) { +void print_most_recent_memtracker_name(void) { gd_printf("%s\n", sActiveMemTrackers[sNumActiveMemTrackers - 1]->name); } -/* @ 23AC28 -> 23AD94; orig name: func_8018C458 */ +/** + * Records the amount of heap usage after allocating memory. + */ u32 stop_memtracker(const char *name) { - struct MemTracker *tracker; // sp24 + struct MemTracker *tracker; if (sNumActiveMemTrackers-- < 0) { fatal_printf("bad mem tracker count"); @@ -109,17 +134,19 @@ u32 stop_memtracker(const char *name) { fatal_printf("memtracker '%s' not found", name); } - tracker->end = (f32) get_alloc_mem_amt(); + tracker->end = get_alloc_mem_amt(); tracker->total += (tracker->end - tracker->begin); return (u32) tracker->total; } -/* @ 23AD94 -> 23AE20; orig name: func_8018C5C4 */ +/** + * Destroys all memtrackers + */ void remove_all_memtrackers(void) { s32 i; - for (i = 0; i < ARRAY_COUNT(sMemTrackers); i++) { // L8018C5CC + for (i = 0; i < ARRAY_COUNT(sMemTrackers); i++) { sMemTrackers[i].name = NULL; sMemTrackers[i].begin = 0.0f; sMemTrackers[i].end = 0.0f; @@ -131,12 +158,16 @@ void remove_all_memtrackers(void) { #endif } -/* 23AE20 -> 23AE44; orig name: func_8018C650 */ -struct MemTracker *get_memtracker_by_id(s32 id) { - return &sMemTrackers[id]; +/** + * Returns a memtracker by index rather than name + */ +struct MemTracker *get_memtracker_by_index(s32 index) { + return &sMemTrackers[index]; } -/* 23AE44 -> 23AEFC; orig name: func_8018C674 */ +/** + * Prints the total memory allocated for each memtracker + */ void print_all_memtrackers(void) { s32 i; @@ -147,6 +178,16 @@ void print_all_memtrackers(void) { } } +/* + * Timers + * + * These are used to profile the code by measuring the time it takes to perform + * operations. + * To record elapsed time, call start_timer, perform some operations, then call stop_timer. + * You can also use restart_timer/split_timer instead of start_timer/stop_timer + * to keep a running total. + */ + /* 23AEFC -> 23AFB0; orig name: func_8018C72C */ void print_all_timers(void) { s32 i; @@ -170,24 +211,28 @@ void activate_timing(void) { sTimingActive = TRUE; } -/* 23AFE4 -> 23B118; orig name: func_8018C814 */ +/** + * Destroys all timers + */ void remove_all_timers(void) { s32 i; for (i = 0; i < ARRAY_COUNT(sTimers); i++) { sTimers[i].name = NULL; sTimers[i].total = 0; - sTimers[i].unk0C = 0.0f; + sTimers[i].unused0C = 0.0f; sTimers[i].scaledTotal = 0.0f; sTimers[i].prevScaledTotal = 0.0f; - sTimers[i].unk1C = D_801A8284[(u32) i % 7]; + sTimers[i].gadgetColourNum = sTimerGadgetColours[(u32) i % 7]; sTimers[i].resetCount = 0; } activate_timing(); } -/* 23B118 -> 23B1C4; orig name: func_8018C948 */ -struct GdTimer *new_timer(const char *name) { +/** + * Creates a new timer with the specified name + */ +static struct GdTimer *new_timer(const char *name) { s32 i; struct GdTimer *timer = NULL; @@ -202,7 +247,9 @@ struct GdTimer *new_timer(const char *name) { return timer; } -/* 23B1C4 -> 23B284; orig name: func_8018C9F4 */ +/** + * Returns the timer with the specified name, or NULL if it does not exist. + */ struct GdTimer *get_timer(const char *timerName) { s32 i; @@ -217,8 +264,11 @@ struct GdTimer *get_timer(const char *timerName) { return NULL; } -/* 23B284 -> 23B2E4; orig name: func_8018CAB4 */ -struct GdTimer *get_timer_checked(const char *timerName) { +/** + * Returns the timer with the specified name, or aborts the program if it does + * not exist. + */ +static struct GdTimer *get_timer_checked(const char *timerName) { struct GdTimer *timer; timer = get_timer(timerName); @@ -229,13 +279,15 @@ struct GdTimer *get_timer_checked(const char *timerName) { return timer; } -/* 23B2E4 -> 23B350 */ -struct GdTimer *get_timernum(s32 id) { - if (id >= ARRAY_COUNT(sTimers)) { - fatal_printf("get_timernum(): Timer number %d out of range (MAX %d)", id, ARRAY_COUNT(sTimers)); +/** + * Returns a timer by index rather than name + */ +struct GdTimer *get_timernum(s32 index) { + if (index >= ARRAY_COUNT(sTimers)) { + fatal_printf("get_timernum(): Timer number %d out of range (MAX %d)", index, ARRAY_COUNT(sTimers)); } - return &sTimers[id]; + return &sTimers[index]; } /* 23B350 -> 23B42C; orig name: func_8018CB80 */ @@ -268,7 +320,9 @@ void split_all_timers(void) { } } -/* 23B49C -> 23B530; not called; orig name: Unknown8018CCCC */ +/** + * Unused - records the start time for all timers + */ void start_all_timers(void) { s32 i; struct GdTimer *timer; @@ -286,7 +340,9 @@ void start_all_timers(void) { } } -/* 23B530 -> 23B600 */ +/** + * Records the current time before performing an operation + */ void start_timer(const char *name) { struct GdTimer *timer; @@ -294,6 +350,7 @@ void start_timer(const char *name) { return; } + // Create timer if it does not exist. timer = get_timer(name); if (timer == NULL) { timer = new_timer(name); @@ -308,7 +365,9 @@ void start_timer(const char *name) { timer->resetCount = 1; } -/* 23B600 -> 23B6BC */ +/** + * Records the current time before performing an operation + */ void restart_timer(const char *name) { struct GdTimer *timer; @@ -316,6 +375,7 @@ void restart_timer(const char *name) { return; } + // Create timer if it does not exist. timer = get_timer(name); if (timer == NULL) { timer = new_timer(name); @@ -328,7 +388,10 @@ void restart_timer(const char *name) { timer->resetCount++; } -/* 23B6BC -> 23B718; orig name: func_8018CEEC */ +/** + * Records the current time after performing an operation, adds the elapsed time + * to the total, then restarts the timer + */ void split_timer(const char *name) { struct GdTimer *timer; @@ -340,7 +403,9 @@ void split_timer(const char *name) { split_timer_ptr(timer); } -/* 23B718 -> 23B7F0; orig name: func_8018CF48 */ +/** + * Records the current time after performing an operation + */ void stop_timer(const char *name) { struct GdTimer *timer; @@ -358,30 +423,40 @@ void stop_timer(const char *name) { timer->scaledTotal = ((f32) timer->total) / get_time_scale(); } -/* 23B7F0 -> 23B838; orig name: func_8018D020 */ +/** + * Returns the scaled total for the specified timer + */ f32 get_scaled_timer_total(const char *name) { - struct GdTimer *timer; - - timer = get_timer_checked(name); + struct GdTimer *timer = get_timer_checked(name); return timer->scaledTotal; } -/* 23B838 -> 23B888; not called; orig name: Unknown8018D1A8 */ +/** + * Unused - returns the raw total for the specified timer + */ f32 get_timer_total(const char *name) { - struct GdTimer *timer; - - timer = get_timer_checked(name); + struct GdTimer *timer = get_timer_checked(name); return (f32) timer->total; } -/* 23B888 -> 23B8B8; orig name: myPrint1 */ + +/* + * Miscellaneous debug functions + */ + + +/** + * Prints the given string, prints the stack trace, and exits the program + */ void fatal_print(const char *str) { fatal_printf(str); } -/* 23B8B8 -> 23B928; orig name: func_8018D0E8 */ +/** + * Prints the stack trace registered by callng imin()/imout() + */ void print_stack_trace(void) { s32 i; @@ -390,11 +465,13 @@ void print_stack_trace(void) { } } -/* 23B928 -> 23BBF0; orig name: myPrintf */ +/** + * Prints the formatted string, prints the stack trace, and exits the program + */ void fatal_printf(const char *fmt, ...) { - char cur; // sp37 (sp34) + char cur; UNUSED u8 pad[4]; - va_list vl; // sp2C + va_list vl; va_start(vl, fmt); while ((cur = *fmt++)) { @@ -438,19 +515,23 @@ void fatal_printf(const char *fmt, ...) { gd_exit(-1); } -/* 23BBF0 -> 23BC80; orig name: func_8018D420 */ -void add_to_stacktrace(const char *routine) { - // Please check array bounds before writing to it +/** + * "I'm in" + * Adds the function name to the stack trace + */ +void imin(const char *routine) { sRoutineNames[sNumRoutinesInStack++] = routine; - sRoutineNames[sNumRoutinesInStack] = NULL; + sRoutineNames[sNumRoutinesInStack] = NULL; //! array bounds is checked after writing this. if (sNumRoutinesInStack >= ARRAY_COUNT(sRoutineNames)) { fatal_printf("You're in too many routines"); } } -/* 23BC80 -> 23BD30 */ -// remove a routine from the stack trace routine buffer +/** + * "I'm out" + * Removes the function name from the stack trace + */ void imout(void) { s32 i; @@ -467,9 +548,11 @@ void imout(void) { } } -/* 23BD30 -> 23BE78 */ -// TODO: rename, figure out type of rng generator? -f32 func_8018D560(void) { +/** + * Returns a random floating point number between 0 and 1 (inclusive) + * TODO: figure out type of rng generator? + */ +f32 gd_rand_float(void) { u32 temp; u32 i; f32 val; @@ -495,7 +578,9 @@ f32 func_8018D560(void) { return val; } -/* 23BE78 -> 23BFD8; orig name: func_8018D6A8 */ +/** + * Reimplementation of the standard "atoi" function + */ s32 gd_atoi(const char *str) { char cur; const char *origstr = str; @@ -506,11 +591,9 @@ s32 gd_atoi(const char *str) { while (TRUE) { cur = *str++; - if (cur < '0' || cur > '9') { - if (cur != '-') { - fatal_printf("gd_atoi() bad number '%s'", origstr); - } - } + // Each character must be either a digit or a minus sign + if ((cur < '0' || cur > '9') && (cur != '-')) + fatal_printf("gd_atoi() bad number '%s'", origstr); if (cur == '-') { isNegative = TRUE; @@ -533,13 +616,17 @@ s32 gd_atoi(const char *str) { return out; } -/* 23BFD8 -> 23C018; orig name: func_8018D808 */ +/** + * Like the standard "atof" function, but only supports integer values + */ f64 gd_lazy_atof(const char *str, UNUSED u32 *unk) { return gd_atoi(str); } +static char sHexNumerals[] = {"0123456789ABCDEF"}; + /* 23C018 -> 23C078; orig name: func_8018D848 */ -char *sprint_num_as_hex(char *str, s32 val) { +char *format_number_hex(char *str, s32 val) { s32 shift; for (shift = 28; shift > -4; shift -= 4) { @@ -551,9 +638,11 @@ char *sprint_num_as_hex(char *str, s32 val) { return str; } +static s32 sPadNumPrint = 0; // @ 801A82C0 + /* 23C078 -> 23C174; orig name: func_8018D8A8 */ /* padnum = a decimal number with the max desired output width */ -char *sprint_num(char *str, s32 val, s32 padnum) { +char *format_number_decimal(char *str, s32 val, s32 padnum) { s32 i; if (val == 0) { @@ -595,7 +684,7 @@ char *sprint_num(char *str, s32 val, s32 padnum) { } /* 23C174 -> 23C1C8; orig name: func_8018D9A4 */ -s32 int_sci_notation(s32 base, s32 significand) { +static s32 int_sci_notation(s32 base, s32 significand) { s32 i; for (i = 1; i < significand; i++) { @@ -620,18 +709,18 @@ char *sprint_val_withspecifiers(char *str, union PrintVal val, char *specifiers) while ((cur = *specifiers++)) { if (cur == 'd') { sPadNumPrint = FALSE; - str = sprint_num(str, val.i, 1000000000); + str = format_number_decimal(str, val.i, 1000000000); } else if (cur == 'x') { sPadNumPrint = TRUE; /* doesn't affect hex printing, though... */ - str = sprint_num_as_hex(str, val.i); + str = format_number_hex(str, val.i); } else if (cur == 'f') { intPart = (s32) val.f; fracPart = (s32)((val.f - (f32) intPart) * (f32) int_sci_notation(10, fracPrec)); sPadNumPrint = FALSE; - str = sprint_num(str, intPart, int_sci_notation(10, intPrec)); + str = format_number_decimal(str, intPart, int_sci_notation(10, intPrec)); *str++ = '.'; sPadNumPrint = TRUE; - str = sprint_num(str, fracPart, int_sci_notation(10, fracPrec - 1)); + str = format_number_decimal(str, fracPart, int_sci_notation(10, fracPrec - 1)); } else if (cur >= '0' && cur <= '9') { cur = cur - '0'; intPrec = cur; @@ -760,7 +849,7 @@ struct GdFile *gd_fopen(const char *filename, const char *mode) { for (i = 0; i < sizeof(struct UnkBufThing); i++) { *bufbytes++ = gGdStreamBuffer[filecsr++]; } - func_801A59AC(&buf); + stub_renderer_13(&buf); fileposptr = &gGdStreamBuffer[filecsr]; filecsr += buf.size; diff --git a/src/goddard/debug_utils.h b/src/goddard/debug_utils.h index 89e41d4e..4c2bcafb 100644 --- a/src/goddard/debug_utils.h +++ b/src/goddard/debug_utils.h @@ -11,21 +11,21 @@ // structs struct MemTracker { - /* 0x00 */ const char *name; - /* 0x04 */ f32 begin; // in bytes? - /* 0x08 */ f32 end; - /* 0x0C */ f32 total; + /* 0x00 */ const char *name; // name (used as an identifier) + /* 0x04 */ f32 begin; // used heap space (in bytes) before allocating memory + /* 0x08 */ f32 end; // used heap space (in bytes) after allocating memory + /* 0x0C */ f32 total; // total memory (in bytes) allocated between all start_memtracker/stop_memtracker calls }; struct GdTimer { /* 0x00 */ s32 start; // in cycles /* 0x04 */ s32 end; // in cycles /* 0x08 */ s32 total; // in cycles - /* 0x0C */ f32 unk0C; + /* 0x0C */ f32 unused0C; /* 0x10 */ f32 scaledTotal; // total / sTimeScaleFactor (1.0f) Unused function modified value /* 0x14 */ f32 prevScaledTotal; /* 0x18 */ const char *name; - /* 0x1C */ s32 unk1C; + /* 0x1C */ s32 gadgetColourNum; // color of gadget that represents timer? /* 0x20 */ s32 resetCount; }; // sizeof = 0x24 @@ -56,7 +56,7 @@ extern u8 *gGdStreamBuffer; extern struct MemTracker *start_memtracker(const char *); extern u32 stop_memtracker(const char *); extern void remove_all_memtrackers(void); -extern struct MemTracker *get_memtracker_by_id(s32); +extern struct MemTracker *get_memtracker_by_index(s32); extern void print_all_memtrackers(void); extern void print_all_timers(void); extern void deactivate_timing(void); @@ -71,9 +71,9 @@ extern void stop_timer(const char *); extern f32 get_scaled_timer_total(const char *); extern void fatal_print(const char *) NORETURN; extern void fatal_printf(const char *, ...) NORETURN; -extern void add_to_stacktrace(const char *); +extern void imin(const char *); extern void imout(void); -extern f32 func_8018D560(void); +extern f32 gd_rand_float(void); extern s32 gd_atoi(const char *); extern f64 gd_lazy_atof(const char *, u32 *); extern char *sprint_val_withspecifiers(char *, union PrintVal, char *); diff --git a/src/goddard/draw_objects.c b/src/goddard/draw_objects.c index e6d24d28..6cd93132 100644 --- a/src/goddard/draw_objects.c +++ b/src/goddard/draw_objects.c @@ -134,12 +134,12 @@ void Unknown801781DC(struct ObjZone *zone) { f32 sp30; f32 sp2C; struct ObjLight *light; - register struct Links *link = zone->unk30->link1C; // s0 (24) + register struct ListNode *link = zone->unk30->firstMember; // s0 (24) struct GdObj *obj; // 20 while (link != NULL) { obj = link->obj; - light = (struct ObjLight *) gGdLightGroup->link1C->obj; + light = (struct ObjLight *) gGdLightGroup->firstMember->obj; lightPos.x = light->position.x; lightPos.y = light->position.y; lightPos.z = light->position.z; @@ -182,14 +182,14 @@ void draw_shape(struct ObjShape *shape, s32 flag, f32 c, f32 d, f32 e, // "sweep sp1C.x = sp1C.y = sp1C.z = 0.0f; if (flag & 2) { - translate_load_mtx_gddl(f, g, h); + gd_dl_load_trans_matrix(f, g, h); sp1C.x += f; sp1C.y += g; sp1C.z += h; } if ((flag & 0x10) && rotMtx != NULL) { - add_mat4_load_to_dl(rotMtx); + gd_dl_load_matrix(rotMtx); sp1C.x += (*rotMtx)[3][0]; sp1C.y += (*rotMtx)[3][1]; sp1C.z += (*rotMtx)[3][2]; @@ -211,7 +211,7 @@ void draw_shape(struct ObjShape *shape, s32 flag, f32 c, f32 d, f32 e, // "sweep sUseSelectedColor = TRUE; sSelectedColour = gd_get_colour(colorIdx); if (sSelectedColour != NULL) { - func_801A086C(-1, sSelectedColour, GD_MTL_LIGHTS); + gd_dl_material_lighting(-1, sSelectedColour, GD_MTL_LIGHTS); } else { fatal_print("Draw_shape(): Bad colour"); } @@ -232,11 +232,11 @@ void draw_shape(struct ObjShape *shape, s32 flag, f32 c, f32 d, f32 e, // "sweep } if (flag & 4) { - translate_mtx_gddl(i, j, k); + gd_dl_mul_trans_matrix(i, j, k); } if (flag & 1) { - func_8019F258(c, d, e); + gd_dl_scale(c, d, e); } draw_shape_faces(shape); @@ -264,7 +264,7 @@ void draw_shape_2d(struct ObjShape *shape, s32 flag, UNUSED f32 c, UNUSED f32 d, if (gViewUpdateCamera != NULL) { gd_rotate_and_translate_vec3f(&sp1C, &gViewUpdateCamera->unkE8); } - translate_load_mtx_gddl(sp1C.x, sp1C.y, sp1C.z); + gd_dl_load_trans_matrix(sp1C.x, sp1C.y, sp1C.z); } draw_shape_faces(shape); split_timer("drawshape2d"); @@ -273,9 +273,9 @@ void draw_shape_2d(struct ObjShape *shape, s32 flag, UNUSED f32 c, UNUSED f32 d, void draw_light(struct ObjLight *light) { struct GdVec3f sp94; Mat4f sp54; - UNUSED Mat4f *uMatPtr; // 50 - UNUSED f32 uMultiplier; // 4c - struct ObjShape *shape; // 48 + UNUSED Mat4f *uMatPtr; + UNUSED f32 uMultiplier; + struct ObjShape *shape; if (sSceneProcessType == FIND_PICKS) { return; @@ -292,7 +292,7 @@ void draw_light(struct ObjLight *light) { sp94.z = -light->unk80.z; gd_create_origin_lookat(&sp54, &sp94, 0.0f); uMultiplier = light->unk38 / 45.0; - shape = D_801A82E4; + shape = gSpotShape; uMatPtr = &sp54; } else { uMultiplier = 1.0f; @@ -301,7 +301,7 @@ void draw_light(struct ObjLight *light) { if (++sLightDlCounter >= 17) { sLightDlCounter = 1; } - shape->gdDls[2] = sLightDlCounter; + shape->unk50 = sLightDlCounter; } draw_shape_2d(shape, 2, 1.0f, 1.0f, 1.0f, light->position.x, light->position.y, light->position.z, @@ -314,7 +314,7 @@ void draw_material(struct ObjMaterial *mtl) { if (mtlType == GD_MTL_SHINE_DL) { if (sPhongLight != NULL && sPhongLight->unk30 > 0.0f) { if (gViewUpdateCamera != NULL) { - func_801A0478(mtl->gddlNumber, gViewUpdateCamera, &sPhongLight->position, + gd_dl_hilite(mtl->gddlNumber, gViewUpdateCamera, &sPhongLight->position, &sLightPositionOffset, &sPhongLightPosition, &sPhongLight->colour); } else { fatal_printf("draw_material() no active camera for phong"); @@ -324,9 +324,9 @@ void draw_material(struct ObjMaterial *mtl) { } } if (sUseSelectedColor == FALSE) { - func_801A086C(mtl->gddlNumber, &mtl->Kd, mtlType); + gd_dl_material_lighting(mtl->gddlNumber, &mtl->Kd, mtlType); } else { - func_801A086C(mtl->gddlNumber, sSelectedColour, GD_MTL_LIGHTS); + gd_dl_material_lighting(mtl->gddlNumber, sSelectedColour, GD_MTL_LIGHTS); } } @@ -376,41 +376,41 @@ void check_face_bad_vtx(struct ObjFace *face) { * @return Pointer to a GdColour struct */ struct GdColour *gd_get_colour(s32 idx) { - switch (idx + 1) { - case 1: + switch (idx) { + case COLOUR_BLACK: return &sClrBlack; break; - case 2: + case COLOUR_WHITE: return &sClrWhite; break; - case 3: + case COLOUR_RED: return &sClrRed; break; - case 4: + case COLOUR_GREEN: return &sClrGreen; break; - case 5: + case COLOUR_BLUE: return &sClrBlue; break; - case 6: + case COLOUR_GRAY: return &sClrGrey; break; - case 7: + case COLOUR_DARK_GRAY: return &sClrDarkGrey; break; - case 8: + case COLOUR_DARK_BLUE: return &sClrErrDarkBlue; break; - case 11: + case COLOUR_BLACK2: return &sClrBlack; break; - case 9: + case COLOUR_YELLOW: return &sClrYellow; break; - case 10: + case COLOUR_PINK: return &sClrPink; break; - case 0: + case -1: return &sLightColours[0]; break; default: @@ -427,7 +427,7 @@ void Unknown80178ECC(f32 v0X, f32 v0Y, f32 v0Z, f32 v1X, f32 v1Y, f32 v1Z) { f32 difX = v1X - v0X; f32 difZ = v1Z - v0Z; - add_tri_to_dl(v0X, v0Y, v0Z, v1X, v1Y, v1Z, v0X + difY * 0.1, v0Y + difX * 0.1, v0Z + difZ * 0.1); + gd_dl_make_triangle(v0X, v0Y, v0Z, v1X, v1Y, v1Z, v0X + difY * 0.1, v0Y + difX * 0.1, v0Z + difZ * 0.1); } /** @@ -444,14 +444,14 @@ void draw_face(struct ObjFace *face) { s32 hasTextCoords; // 1c Vtx *gbiVtx; // 18 - add_to_stacktrace("draw_face"); + imin("draw_face"); hasTextCoords = FALSE; if (sUseSelectedColor == FALSE && face->mtlId >= 0) // -1 == colored face { if (face->mtl != NULL) { if ((i = face->mtl->gddlNumber) != 0) { if (i != sUpdateViewState.mtlDlNum) { - func_801A0070(); + gd_dl_flush_vertices(); branch_to_gddl(i); sUpdateViewState.mtlDlNum = i; } @@ -483,7 +483,7 @@ void draw_face(struct ObjFace *face) { set_vtx_tc_buf(((struct BetaVtx *) vtx)->s, ((struct BetaVtx *) vtx)->t); } - gbiVtx = make_vtx_if_new(x, y, z, vtx->alpha); + gbiVtx = gd_dl_make_vertex(x, y, z, vtx->alpha); if (gbiVtx != NULL) { vtx->gbiVerts = make_vtx_link(vtx->gbiVerts, gbiVtx); @@ -501,7 +501,7 @@ void draw_face(struct ObjFace *face) { * @param lrx,lry lower right point */ void draw_rect_fill(s32 color, f32 ulx, f32 uly, f32 lrx, f32 lry) { - gd_set_fill(gd_get_colour(color)); + gd_dl_set_fill(gd_get_colour(color)); gd_draw_rect(ulx, uly, lrx, lry); } @@ -513,7 +513,7 @@ void draw_rect_fill(s32 color, f32 ulx, f32 uly, f32 lrx, f32 lry) { * @param lrx,lry lower right point */ void draw_rect_stroke(s32 color, f32 ulx, f32 uly, f32 lrx, f32 lry) { - gd_set_fill(gd_get_colour(color)); + gd_dl_set_fill(gd_get_colour(color)); gd_draw_border_rect(ulx, uly, lrx, lry); } @@ -525,27 +525,31 @@ void Unknown801792F0(struct GdObj *obj) { char objId[32]; struct GdVec3f objPos; - sprint_obj_id(objId, obj); + format_object_id(objId, obj); set_cur_dynobj(obj); d_get_world_pos(&objPos); func_801A4438(objPos.x, objPos.y, objPos.z); - func_801A48D8(objId); + stub_draw_label_text(objId); } -/* 227B20 -> 227DF8; orig name: Proc80179350 */ +/** + * Draws a label + */ void draw_label(struct ObjLabel *label) { - struct GdVec3f position; // 144 + struct GdVec3f position; char strbuf[0x100]; UNUSED u8 unused[16]; - struct ObjValPtrs *valptr; // 2c - union ObjVarVal varval; // 28 + struct ObjValPtr *valptr; + union ObjVarVal varval; valptrproc_t valfn = label->valfn; if ((valptr = label->valptr) != NULL) { - if (valptr->unk20 == 0x40000) { + if (valptr->flag == 0x40000) { + // position is offset from object set_cur_dynobj(valptr->obj); d_get_world_pos(&position); } else { + // position is absolute position.x = position.y = position.z = 0.0f; } @@ -580,12 +584,12 @@ void draw_label(struct ObjLabel *label) { gd_strcpy(strbuf, "NONAME"); } } - position.x += label->vec14.x; - position.y += label->vec14.y; - position.z += label->vec14.z; + position.x += label->position.x; + position.y += label->position.y; + position.z += label->position.z; func_801A4438(position.x, position.y, position.z); - func_801A48C4(label->unk30); - func_801A48D8(strbuf); + stub_renderer_10(label->unk30); + stub_draw_label_text(strbuf); } /* 227DF8 -> 227F3C; orig name: Proc80179628 */ @@ -598,14 +602,14 @@ void draw_net(struct ObjNet *self) { return; } - if (net->header.drawFlags & OBJ_USE_ENV_COLOUR) { - netColor = 8; + if (net->header.drawFlags & OBJ_HIGHLIGHTED) { + netColor = COLOUR_YELLOW; } else { - netColor = net->unk40; + netColor = net->colourNum; } - if (net->unk1A8 != NULL) { - draw_shape((struct ObjShape *) net->unk1A8, 0x10, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + if (net->shapePtr != NULL) { + draw_shape(net->shapePtr, 0x10, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, netColor, &net->mat168); } @@ -614,22 +618,30 @@ void draw_net(struct ObjNet *self) { } } -/* 227F3C -> 22803C; orig name: Proc8017976C */ +/** + * Draws a gadget + */ void draw_gadget(struct ObjGadget *gdgt) { s32 colour = 0; - if (gdgt->unk5C != 0) { - colour = gdgt->unk5C; + if (gdgt->colourNum != 0) { + colour = gdgt->colourNum; } - draw_rect_fill(colour, gdgt->unk14.x, gdgt->unk14.y, gdgt->unk14.x + gdgt->unk28 * gdgt->unk40.x, - gdgt->unk14.y + gdgt->unk40.y); + draw_rect_fill(colour, + gdgt->worldPos.x, + gdgt->worldPos.y, + gdgt->worldPos.x + gdgt->sliderPos * gdgt->size.x, + gdgt->worldPos.y + gdgt->size.y); - if (gdgt->header.drawFlags & OBJ_USE_ENV_COLOUR) { - draw_rect_stroke(8, gdgt->unk14.x, gdgt->unk14.y, gdgt->unk14.x + gdgt->unk28 * gdgt->unk40.x, - gdgt->unk14.y + gdgt->unk40.y); + if (gdgt->header.drawFlags & OBJ_HIGHLIGHTED) { + draw_rect_stroke(COLOUR_YELLOW, + gdgt->worldPos.x, + gdgt->worldPos.y, + gdgt->worldPos.x + gdgt->sliderPos * gdgt->size.x, + gdgt->worldPos.y + gdgt->size.y); } - gdgt->header.drawFlags &= ~OBJ_USE_ENV_COLOUR; + gdgt->header.drawFlags &= ~OBJ_HIGHLIGHTED; } /* 22803C -> 22829C */ @@ -643,26 +655,26 @@ void draw_camera(struct ObjCamera *cam) { if (cam->unk30 != NULL) { set_cur_dynobj(cam->unk30); d_get_world_pos(&sp44); - sp44.x += cam->unk34.x; - sp44.y += cam->unk34.y; - sp44.z += cam->unk34.z; + sp44.x += cam->lookAt.x; + sp44.y += cam->lookAt.y; + sp44.z += cam->lookAt.z; ; // needed to match } else { - sp44.x = cam->unk34.x; - sp44.y = cam->unk34.y; - sp44.z = cam->unk34.z; + sp44.x = cam->lookAt.x; + sp44.y = cam->lookAt.y; + sp44.z = cam->lookAt.z; } if (0) { // dead code - gd_printf("%f,%f,%f\n", cam->unk14.x, cam->unk14.y, cam->unk14.z); + gd_printf("%f,%f,%f\n", cam->worldPos.x, cam->worldPos.y, cam->worldPos.z); } - if (ABS(cam->unk14.x - sp44.x) + ABS(cam->unk14.z - sp44.z) == 0.0f) { + if (ABS(cam->worldPos.x - sp44.x) + ABS(cam->worldPos.z - sp44.z) == 0.0f) { gd_printf("Draw_Camera(): Zero view distance\n"); return; } - func_8019F318(cam, cam->unk14.x, cam->unk14.y, cam->unk14.z, sp44.x, sp44.y, sp44.z, cam->unkA4); + gd_dl_lookat(cam, cam->worldPos.x, cam->worldPos.y, cam->worldPos.z, sp44.x, sp44.y, sp44.z, cam->unkA4); } /** @@ -672,15 +684,14 @@ void draw_camera(struct ObjCamera *cam) { * @note Not called */ void Unknown80179ACC(struct GdObj *obj) { - if (obj->type == OBJ_TYPE_NETS) { - if (0) { - } - if (((struct ObjNet *) obj)->unk1C8 != NULL) { - func_80179B64(((struct ObjNet *) obj)->unk1C8); - } - } else { - if (0) { - } + switch (obj->type) { + case OBJ_TYPE_NETS: + if (((struct ObjNet *) obj)->unk1C8 != NULL) { + func_80179B64(((struct ObjNet *) obj)->unk1C8); + } + break; + default: + break; } obj->drawFlags &= ~OBJ_DRAW_UNK01; } @@ -695,19 +706,14 @@ void func_80179B64(struct ObjGroup *group) { (applyproc_t) Unknown80179ACC, group); } -// plc again -void func_80179B9C(struct GdVec3f *pos, struct ObjCamera *cam, struct ObjView *view) -{ - f32 aspect = GFX_DIMENSIONS_ASPECT_RATIO; - aspect *= 0.75; - //func_80196430(pos, &cam->unkE8); +/* 22836C -> 228498 */ +void world_pos_to_screen_coords(struct GdVec3f *pos, struct ObjCamera *cam, struct ObjView *view) { gd_rotate_and_translate_vec3f(pos, &cam->unkE8); - if (pos->z > -256.0f) { return; } - pos->x *= 256.0 / -pos->z / aspect; + pos->x *= 256.0 / -pos->z; pos->y *= 256.0 / pos->z; pos->x += view->lowerRight.x / 2.0f; pos->y += view->lowerRight.y / 2.0f; @@ -743,13 +749,13 @@ void check_grabable_click(struct GdObj *input) { objPos.x = (*mtx)[3][0]; objPos.y = (*mtx)[3][1]; objPos.z = (*mtx)[3][2]; - func_80179B9C(&objPos, gViewUpdateCamera, sUpdateViewState.view); + world_pos_to_screen_coords(&objPos, gViewUpdateCamera, sUpdateViewState.view); if (ABS(gGdCtrl.csrX - objPos.x) < 20.0f) { if (ABS(gGdCtrl.csrY - objPos.y) < 20.0f) { - // store (size, Obj Type, Obj Number) in s16 pick buffer array + // store (size, Obj Type, Obj Index) in s16 pick buffer array store_in_pickbuf(2); store_in_pickbuf(obj->type); - store_in_pickbuf(obj->number); + store_in_pickbuf(obj->index); sGrabCords.x = objPos.x; sGrabCords.y = objPos.y; } @@ -772,12 +778,12 @@ void drawscene(enum SceneType process, struct ObjGroup *interactables, struct Ob UNUSED u8 unused[16]; restart_timer("drawscene"); - add_to_stacktrace("draw_scene()"); + imin("draw_scene()"); sUnreadShapeFlag = 0; sUpdateViewState.unreadCounter = 0; restart_timer("draw1"); set_gd_mtx_parameters(G_MTX_PROJECTION | G_MTX_MUL | G_MTX_PUSH); - if (sUpdateViewState.view->unk38 == 1) { + if (sUpdateViewState.view->projectionType == 1) { gd_create_perspective_matrix(sUpdateViewState.view->clipping.z, sUpdateViewState.view->lowerRight.x / sUpdateViewState.view->lowerRight.y, sUpdateViewState.view->clipping.x, sUpdateViewState.view->clipping.y); @@ -798,12 +804,12 @@ void drawscene(enum SceneType process, struct ObjGroup *interactables, struct Ob if (gViewUpdateCamera != NULL) { draw_camera(gViewUpdateCamera); } else { - translate_mtx_gddl(0.0f, 0.0f, -1000.0f); + gd_dl_mul_trans_matrix(0.0f, 0.0f, -1000.0f); } setup_lights(); set_gd_mtx_parameters(G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH); - idn_mtx_push_gddl(); + gd_dl_push_matrix(); sSceneProcessType = process; if ((sNumActiveLights = sUpdateViewState.view->flags & VIEW_LIGHT)) { @@ -814,7 +820,7 @@ void drawscene(enum SceneType process, struct ObjGroup *interactables, struct Ob apply_to_obj_types_in_group(OBJ_TYPE_LIGHTS, (applyproc_t) register_light, gGdLightGroup); split_timer("draw1"); restart_timer("drawobj"); - add_to_stacktrace("process_group"); + imin("process_group"); if (sSceneProcessType == FIND_PICKS) { apply_to_obj_types_in_group(OBJ_TYPE_ALL, (applyproc_t) check_grabable_click, interactables); } else { @@ -827,7 +833,7 @@ void drawscene(enum SceneType process, struct ObjGroup *interactables, struct Ob gd_setproperty(GD_PROP_LIGHTING, 0.0f, 0.0f, 0.0f); apply_to_obj_types_in_group(OBJ_TYPE_LABELS, (applyproc_t) apply_obj_draw_fn, interactables); gd_setproperty(GD_PROP_LIGHTING, 1.0f, 0.0f, 0.0f); - pop_mtx_gddl(); + gd_dl_pop_matrix(); imout(); split_timer("drawscene"); return; @@ -837,7 +843,7 @@ void drawscene(enum SceneType process, struct ObjGroup *interactables, struct Ob * A drawing function that does nothing. This function is used for * `GdObj`s that don't need to be rendered */ -void nop_obj_draw(UNUSED struct GdObj *nop) { +void draw_nothing(UNUSED struct GdObj *nop) { } /** @@ -850,13 +856,13 @@ void draw_shape_faces(struct ObjShape *shape) { sUpdateViewState.unreadCounter = 0; gddl_is_loading_stub_dl(FALSE); sUnreadShapeFlag = (s32) shape->flag & 1; - func_801A02B8(shape->unk58); - if (shape->gdDls[gGdFrameBuf] != 0) { - func_8019BD0C(shape->gdDls[gGdFrameBuf], shape->gdDls[2]); + set_render_alpha(shape->alpha); + if (shape->dlNums[gGdFrameBufNum] != 0) { + draw_indexed_dl(shape->dlNums[gGdFrameBufNum], shape->unk50); } else if (shape->faceGroup != NULL) { func_801A0038(); draw_group(shape->faceGroup); - func_801A0070(); + gd_dl_flush_vertices(); } } @@ -866,18 +872,18 @@ void draw_shape_faces(struct ObjShape *shape) { void draw_particle(struct GdObj *obj) { struct ObjParticle *ptc = (struct ObjParticle *) obj; UNUSED u8 unused1[16]; - struct GdColour *white; // 60 - struct GdColour *black; // 5c - f32 sp58; + struct GdColour *white; + struct GdColour *black; + f32 brightness; UNUSED u8 unused2[16]; - if (ptc->unk5C > 0) { + if (ptc->timeout > 0) { white = sColourPalette[0]; black = sWhiteBlack[1]; - sp58 = ptc->unk5C / 10.0; - sLightColours[0].r = (white->r - black->r) * sp58 + black->r; - sLightColours[0].g = (white->g - black->g) * sp58 + black->g; - sLightColours[0].b = (white->b - black->b) * sp58 + black->b; + brightness = ptc->timeout / 10.0; + sLightColours[0].r = (white->r - black->r) * brightness + black->r; + sLightColours[0].g = (white->g - black->g) * brightness + black->g; + sLightColours[0].b = (white->b - black->b) * brightness + black->b; ; // needed to match } else { sLightColours[0].r = 0.0f; @@ -885,14 +891,14 @@ void draw_particle(struct GdObj *obj) { sLightColours[0].b = 0.0f; } - if (ptc->unk5C > 0) { - ptc->unk1C->gdDls[2] = ptc->unk5C; - draw_shape_2d(ptc->unk1C, 2, 1.0f, 1.0f, 1.0f, ptc->unk20.x, ptc->unk20.y, ptc->unk20.z, 0.0f, + if (ptc->timeout > 0) { + ptc->shapePtr->unk50 = ptc->timeout; + draw_shape_2d(ptc->shapePtr, 2, 1.0f, 1.0f, 1.0f, ptc->pos.x, ptc->pos.y, ptc->pos.z, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1, 0); } if (ptc->unk60 == 3) { - if (ptc->unk6C != NULL) { - draw_group(ptc->unk6C); + if (ptc->subParticlesGrp != NULL) { + draw_group(ptc->subParticlesGrp); } } } @@ -917,16 +923,16 @@ void draw_bone(struct GdObj *obj) { scale.y = 1.0f; scale.z = bone->unkF8 / 50.0f; - if (bone->header.drawFlags & OBJ_USE_ENV_COLOUR) { - colour = 8; + if (bone->header.drawFlags & OBJ_HIGHLIGHTED) { + colour = COLOUR_YELLOW; } else { - colour = bone->unk100; + colour = bone->colourNum; } - bone->header.drawFlags &= ~OBJ_USE_ENV_COLOUR; + bone->header.drawFlags &= ~OBJ_HIGHLIGHTED; if (sSceneProcessType != FIND_PICKS) { - draw_shape(bone->unkF0, 0x1B, scale.x, scale.y, scale.z, bone->unk14.x, bone->unk14.y, - bone->unk14.z, 0.0f, 0.0f, 0.0f, bone->unk28.x, bone->unk28.y, bone->unk28.z, colour, + draw_shape(bone->shapePtr, 0x1B, scale.x, scale.y, scale.z, bone->worldPos.x, bone->worldPos.y, + bone->worldPos.z, 0.0f, 0.0f, 0.0f, bone->unk28.x, bone->unk28.y, bone->unk28.z, colour, &bone->mat70); } } @@ -945,14 +951,14 @@ void draw_joint(struct GdObj *obj) { struct ObjShape *boneShape; UNUSED u8 unused3[28]; - if ((boneShape = joint->unk20) == NULL) { + if ((boneShape = joint->shapePtr) == NULL) { return; } - if (joint->header.drawFlags & OBJ_USE_ENV_COLOUR) { - colour = 8; + if (joint->header.drawFlags & OBJ_HIGHLIGHTED) { + colour = COLOUR_YELLOW; } else { - colour = joint->unk1C8; + colour = joint->colourNum; } draw_shape(boneShape, 0x10, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, @@ -979,8 +985,8 @@ void draw_group(struct ObjGroup *grp) { void draw_plane(struct GdObj *obj) { struct ObjPlane *plane = (struct ObjPlane *) obj; - if (obj->drawFlags & OBJ_USE_ENV_COLOUR) { - obj->drawFlags &= ~OBJ_USE_ENV_COLOUR; + if (obj->drawFlags & OBJ_HIGHLIGHTED) { + obj->drawFlags &= ~OBJ_HIGHLIGHTED; ; // needed to match; presumably setting up the color to draw the plane with } else { sUseSelectedColor = FALSE; @@ -998,7 +1004,7 @@ void apply_obj_draw_fn(struct GdObj *obj) { if (obj == NULL) { fatal_print("Bad object!"); } - if (obj->drawFlags & OBJ_NOT_DRAWABLE) { + if (obj->drawFlags & OBJ_INVISIBLE) { return; } @@ -1094,7 +1100,7 @@ void create_shape_mtl_gddls(struct ObjShape *shape) { } /** - * Uncalled function that calls a stubbed function (`func_8017BED0()`) for all + * Uncalled function that calls a stubbed function (`stub_objects_1()`) for all * `GdObj`s in @p grp * * @param grp Unknown group of objects @@ -1102,12 +1108,12 @@ void create_shape_mtl_gddls(struct ObjShape *shape) { * @note Not called */ void unref_8017AEDC(struct ObjGroup *grp) { - register struct Links *link = grp->link1C; + register struct ListNode *link = grp->firstMember; while (link != NULL) { struct GdObj *obj = link->obj; - func_8017BED0(grp, obj); + stub_objects_1(grp, obj); link = link->next; } } @@ -1148,8 +1154,8 @@ create_shape_gddl(struct ObjShape *s) { draw_shape_faces(shape); } enddl = gd_enddlsplist_parent(); - shape->gdDls[0] = shapedl; - shape->gdDls[1] = shapedl; + shape->dlNums[0] = shapedl; + shape->dlNums[1] = shapedl; if (shape->name[0] != '\0') { printf("Generated '%s' (%d) display list ok.(%d)\n", shape->name, shapedl, enddl); @@ -1182,16 +1188,16 @@ void create_gddl_for_shapes(struct ObjGroup *grp) { */ void map_face_materials(struct ObjGroup *faces, struct ObjGroup *mtls) { struct ObjFace *face; - register struct Links *linkFaces; + register struct ListNode *linkFaces; struct GdObj *temp; - register struct Links *linkMtls; + register struct ListNode *linkMtls; struct ObjMaterial *mtl; - linkFaces = faces->link1C; + linkFaces = faces->firstMember; while (linkFaces != NULL) { temp = linkFaces->obj; face = (struct ObjFace *) temp; - linkMtls = mtls->link1C; + linkMtls = mtls->firstMember; while (linkMtls != NULL) { mtl = (struct ObjMaterial *) linkMtls->obj; if (mtl->id == face->mtlId) { @@ -1209,7 +1215,8 @@ void map_face_materials(struct ObjGroup *faces, struct ObjGroup *mtls) { } /** - * @brief Calculate the normal for @p vtx based on `ObjFaces` in @p facegrp + * @brief Calculate the normal for @p vtx by averaging the normals of all + * `ObjFaces` in @p facegrp * * Calculate the normal for the input `ObjVetex` @p vtx based on the * `ObjFace` structures in @p facegrp of which that vertex is a part. @@ -1218,68 +1225,70 @@ void map_face_materials(struct ObjGroup *faces, struct ObjGroup *mtls) { * @param facegrp `ObjGroup` of `ObjFace` structures that use @p vtx * @return void */ -void calc_vtx_normal(struct ObjVertex *vtx, struct ObjGroup *facegrp) { +static void calc_vtx_normal(struct ObjVertex *vtx, struct ObjGroup *facegrp) { s32 i; - s32 facesAdded; - register struct Links *faceLink; + s32 faceCount; + register struct ListNode *node; struct ObjFace *curFace; vtx->normal.x = vtx->normal.y = vtx->normal.z = 0.0f; - facesAdded = 0; - faceLink = facegrp->link1C; - while (faceLink != NULL) { - curFace = (struct ObjFace *) faceLink->obj; + + faceCount = 0; + node = facegrp->firstMember; + while (node != NULL) { + curFace = (struct ObjFace *) node->obj; for (i = 0; i < curFace->vtxCount; i++) { if (curFace->vertices[i] == vtx) { vtx->normal.x += curFace->normal.x; vtx->normal.y += curFace->normal.y; vtx->normal.z += curFace->normal.z; - facesAdded++; + faceCount++; } } - faceLink = faceLink->next; + node = node->next; } - if (facesAdded != 0) { - vtx->normal.x /= facesAdded; - vtx->normal.y /= facesAdded; - vtx->normal.z /= facesAdded; + if (faceCount != 0) { + vtx->normal.x /= faceCount; + vtx->normal.y /= faceCount; + vtx->normal.z /= faceCount; } } /** - * @brief Convert vertex indices in an `ObjFace` into pointers + * @brief Convert vertex indices in an `ObjFace` into pointers and computes the + * face's normal * * Using the group of `ObjVertex` or `ObjParticle` structures in @p verts, - * convert indices in @p face into pointers. The indices are offests - * into the list contained in @p verts group + * convert indices in @p face into pointers. The indices are indices + * into the list contained in @p vertexGrp group * * @param face `ObjFace` to find vertices for - * @param verts `ObjGroup` to index in for `ObjVertex` or `ObjPaticle` structures + * @param vertexGrp `ObjGroup` to index in for `ObjVertex` or `ObjPaticle` structures * @return void */ -void find_thisface_verts(struct ObjFace *face, struct ObjGroup *verts) { +static void find_thisface_verts(struct ObjFace *face, struct ObjGroup *vertexGrp) { s32 i; - u32 linkVtxIdx; - struct Links *link; + u32 currIndex; + struct ListNode *node; for (i = 0; i < face->vtxCount; i++) { - link = verts->link1C; - linkVtxIdx = 0; - while (link != NULL) { - if (link->obj->type == OBJ_TYPE_VERTICES || link->obj->type == OBJ_TYPE_PARTICLES) { - // it seems that the vertices in a face are first pointer-sized indices - // to a given vertix or particle link in the second argument's group. - if (linkVtxIdx++ == (u32) (uintptr_t) face->vertices[i]) { + // find the vertex or particle whose index in vertexGrp equals face->vertices[i] + node = vertexGrp->firstMember; + currIndex = 0; + while (node != NULL) { + if (node->obj->type == OBJ_TYPE_VERTICES || node->obj->type == OBJ_TYPE_PARTICLES) { + if (currIndex++ == (u32) (uintptr_t) face->vertices[i]) { break; } } - link = link->next; + node = node->next; } - - if (link == NULL) { + if (node == NULL) { fatal_printf("find_thisface_verts(): Vertex not found"); } - face->vertices[i] = (struct ObjVertex *) link->obj; + + // set the vertex to point to the resolved `ObjVertex` + face->vertices[i] = (struct ObjVertex *) node->obj; } calc_face_normal(face); } @@ -1299,25 +1308,27 @@ void find_thisface_verts(struct ObjFace *face, struct ObjGroup *verts) { * a very similar task... */ void map_vertices(struct ObjGroup *facegrp, struct ObjGroup *vtxgrp) { - register struct Links *faceLink; + register struct ListNode *faceNode; struct ObjFace *curFace; - register struct Links *vtxLink; + register struct ListNode *vtxNode; struct ObjVertex *vtx; - add_to_stacktrace("map_vertices"); + imin("map_vertices"); - faceLink = facegrp->link1C; - while (faceLink != NULL) { - curFace = (struct ObjFace *) faceLink->obj; + // resolve vertex indices to actual vertices + faceNode = facegrp->firstMember; + while (faceNode != NULL) { + curFace = (struct ObjFace *) faceNode->obj; find_thisface_verts(curFace, vtxgrp); - faceLink = faceLink->next; + faceNode = faceNode->next; } - vtxLink = vtxgrp->link1C; - while (vtxLink != NULL) { - vtx = (struct ObjVertex *) vtxLink->obj; + // compute normals of vertices in vtxgrp + vtxNode = vtxgrp->firstMember; + while (vtxNode != NULL) { + vtx = (struct ObjVertex *) vtxNode->obj; calc_vtx_normal(vtx, facegrp); - vtxLink = vtxLink->next; + vtxNode = vtxNode->next; } imout(); @@ -1333,7 +1344,7 @@ void map_vertices(struct ObjGroup *facegrp, struct ObjGroup *vtxgrp) { void unpick_obj(struct GdObj *obj) { struct GdObj *why = obj; if (why->drawFlags & OBJ_IS_GRABBALE) { - why->drawFlags &= ~(OBJ_PICKED | OBJ_USE_ENV_COLOUR); + why->drawFlags &= ~(OBJ_PICKED | OBJ_HIGHLIGHTED); } } @@ -1352,7 +1363,7 @@ void find_closest_pickable_obj(struct GdObj *input) { f32 distance; if (obj->drawFlags & OBJ_IS_GRABBALE) { - if (obj->number == sPickDataTemp) { + if (obj->index == sPickDataTemp) { if (gViewUpdateCamera != NULL) { distance = d_calc_world_dist_btwn(&gViewUpdateCamera->header, obj); } else { @@ -1410,7 +1421,7 @@ void update_view(struct ObjView *view) { return; } - add_to_stacktrace("UpdateView()"); + imin("UpdateView()"); if (view->proc != NULL) { view->proc(view); } @@ -1455,8 +1466,8 @@ void update_view(struct ObjView *view) { } if (view->components != NULL) { - if (gGdCtrl.btnApressed) { - if (gd_getproperty(3, 0) != FALSE && gGdCtrl.btnAnewPress != FALSE) { + if (gGdCtrl.dragging) { + if (gd_getproperty(3, 0) != FALSE && gGdCtrl.startedDragging != FALSE) { init_pick_buf(sPickBuffer, ARRAY_COUNT(sPickBuffer)); drawscene(FIND_PICKS, sUpdateViewState.view->components, NULL); pickOffset = get_cur_pickbuf_offset(sPickBuffer); @@ -1500,10 +1511,10 @@ void update_view(struct ObjView *view) { if (sPickedObject != NULL) { sPickedObject->drawFlags |= OBJ_PICKED; - sPickedObject->drawFlags |= OBJ_USE_ENV_COLOUR; + sPickedObject->drawFlags |= OBJ_HIGHLIGHTED; sUpdateViewState.view->pickedObj = sPickedObject; - gGdCtrl.csrXatApress = gGdCtrl.csrX = sGrabCords.x; - gGdCtrl.csrYatApress = gGdCtrl.csrY = sGrabCords.y; + gGdCtrl.dragStartX = gGdCtrl.csrX = sGrabCords.x; + gGdCtrl.dragStartY = gGdCtrl.csrY = sGrabCords.y; } } @@ -1512,7 +1523,7 @@ void update_view(struct ObjView *view) { { if (sUpdateViewState.view->pickedObj != NULL) { sUpdateViewState.view->pickedObj->drawFlags &= ~OBJ_PICKED; - sUpdateViewState.view->pickedObj->drawFlags &= ~OBJ_USE_ENV_COLOUR; + sUpdateViewState.view->pickedObj->drawFlags &= ~OBJ_HIGHLIGHTED; sUpdateViewState.view->pickedObj = NULL; } } @@ -1529,5 +1540,5 @@ void update_view(struct ObjView *view) { * Stub function. * @note Not Called */ -void unref_8017BC94(void) { +void stub_draw_objects_1(void) { } diff --git a/src/goddard/draw_objects.h b/src/goddard/draw_objects.h index d2430537..10051de7 100644 --- a/src/goddard/draw_objects.h +++ b/src/goddard/draw_objects.h @@ -6,6 +6,19 @@ #include "gd_types.h" #include "macros.h" +// TODO: make this an enum without causing bss reordering +#define COLOUR_BLACK 0 +#define COLOUR_WHITE 1 +#define COLOUR_RED 2 +#define COLOUR_GREEN 3 +#define COLOUR_BLUE 4 +#define COLOUR_GRAY 5 +#define COLOUR_DARK_GRAY 6 +#define COLOUR_DARK_BLUE 7 +#define COLOUR_YELLOW 8 +#define COLOUR_PINK 9 +#define COLOUR_BLACK2 10 // same as COLOUR_BLACK + // data extern struct ObjCamera *gViewUpdateCamera; @@ -23,8 +36,8 @@ void draw_label(struct ObjLabel *label); void draw_net(struct ObjNet *self); void draw_gadget(struct ObjGadget *gdgt); void draw_camera(struct ObjCamera *cam); -void func_80179B9C(struct GdVec3f *pos, struct ObjCamera *cam, struct ObjView *view); -void nop_obj_draw(UNUSED struct GdObj *nop); +void world_pos_to_screen_coords(struct GdVec3f *pos, struct ObjCamera *cam, struct ObjView *view); +void draw_nothing(UNUSED struct GdObj *nop); void draw_particle(struct GdObj *obj); void draw_bone(struct GdObj *obj); void draw_joint(struct GdObj *obj); diff --git a/src/goddard/dynlist_proc.c b/src/goddard/dynlist_proc.c index 7621f0e0..4b9f21c4 100644 --- a/src/goddard/dynlist_proc.c +++ b/src/goddard/dynlist_proc.c @@ -47,12 +47,12 @@ struct DynObjInfo { #define Dyn1AsInt(dyn) ((dyn)->w1.word) #define Dyn1AsPtr(dyn) ((dyn)->w1.ptr) #define Dyn1AsStr(dyn) ((dyn)->w1.str) -#define Dyn1AsID(dyn) ((DynId)((dyn)->w1.ptr)) +#define Dyn1AsName(dyn) ((DynObjName)((dyn)->w1.ptr)) #define Dyn2AsInt(dyn) ((dyn)->w2.word) #define Dyn2AsPtr(dyn) ((dyn)->w2.ptr) #define Dyn2AsStr(dyn) ((dyn)->w2.str) -#define Dyn2AsID(dyn) ((DynId)((dyn)->w2.ptr)) +#define Dyn2AsName(dyn) ((DynObjName)((dyn)->w2.ptr)) #define DynVec(dyn) (&(dyn)->vec) #define DynVecX(dyn) ((dyn)->vec.x) @@ -63,35 +63,34 @@ struct DynObjInfo { // data static struct DynObjInfo *sGdDynObjList = NULL; // @ 801A8250; info for all loaded/made dynobjs static struct GdObj *sDynListCurObj = NULL; // @ 801A8254 -static struct GdPlaneF sGdNullPlaneF = { // @ 801A8258 - { 0.0, 0.0, 0.0 }, - { 0.0, 0.0, 0.0 } +static struct GdBoundingBox sNullBoundingBox = { // @ 801A8258 + 0.0, 0.0, 0.0, + 0.0, 0.0, 0.0 }; -static s32 sGdDynObjIdIsInt = FALSE; // @ 801A8270; str (0) or int (1) for Dyn Obj ID +static s32 sUseIntegerNames = FALSE; // if TRUE, then all DynNames are specified as integers // bss -static char sIntDynIdBuffer[DYNOBJ_NAME_SIZE]; ///< buffer for returning formated string from - ///< `print_int_dynid()` +static char sIntToStringBuf[DYNOBJ_NAME_SIZE]; ///< buffer for returning formated string from + ///< `integer_name_to_string()` static struct DynObjInfo sNullDynObjInfo; // @ 801B9F08 -static char sDynIdBuf[DYNOBJ_NAME_SIZE]; // @ 801B9F20; small buf for printing dynid to? +static char sDynNameSuffix[DYNOBJ_NAME_SIZE]; // @ 801B9F20; small buf for printing dynid to? static s32 - sUnnamedObjCount; // @ 801B9F28; used to print empty string ids (not NULL char *) to sDynIdBuf + sUnnamedObjCount; // @ 801B9F28; used to print empty string ids (not NULL char *) to sDynNameSuffix static s32 sLoadedDynObjs; // @ 801B9F2C; total loaded dynobjs static struct DynObjInfo *sDynListCurInfo; // @ 801B9F30; info for most recently added object -static struct DynObjInfo - *sParentNetInfo; ///< Information for `ObjNet` made by `d_add_net_with_subgroup()` +static struct DynObjInfo *sParentObjInfo; ///< Information for `ObjNet` made by `d_add_net_with_subgroup()` or `ObjJoint` made by `d_attach_joint_to_net()` static struct DynObjInfo *sStashedDynObjInfo; // @ 801B9F38 static struct GdObj *sStashedDynObj; // @ 801B9F3C static s32 sDynNetCount; // @ 801B9F40 -static char sDynNetIdBuf[0x20]; // @ 801B9F48 -static char sBackBuf[0x100]; // @ 801B9F68 +static char sDynNetNameSuffix[0x20]; // @ 801B9F48 +static char sStashedDynNameSuffix[0x100]; // @ 801B9F68 // necessary foreward declarations -void d_add_net_with_subgroup(s32, DynId); -void d_end_net_subgroup(DynId); -void d_attach_joint_to_net(s32, DynId); -void d_addto_group(DynId); -void d_link_with(DynId); +void d_add_net_with_subgroup(s32, DynObjName); +void d_end_net_with_subgroup(DynObjName); +void d_attach_joint_to_net(s32, DynObjName); +void d_addto_group(DynObjName); +void d_link_with(DynObjName); void d_link_with_ptr(void *); void d_set_normal(f32, f32, f32); void d_make_vertex(struct GdVec3f *); @@ -99,15 +98,15 @@ void d_set_rotation(f32, f32, f32); void d_center_of_gravity(f32, f32, f32); void d_set_shape_offset(f32, f32, f32); void d_clear_flags(s32); -void d_attach(DynId); +void d_attach(DynObjName); void d_attach_to(s32, struct GdObj *); -void d_attachto_dynid(s32, DynId); +void d_attachto_dynid(s32, DynObjName); void d_set_att_offset(const struct GdVec3f *); -void d_set_nodegroup(DynId); -void d_set_matgroup(DynId); -void d_set_skinshape(DynId); -void d_set_planegroup(DynId); -void d_set_shapeptr(DynId); +void d_set_nodegroup(DynObjName); +void d_set_matgroup(DynObjName); +void d_set_skinshape(DynObjName); +void d_set_planegroup(DynObjName); +void d_set_shapeptr(DynObjName); void d_friction(f32, f32, f32); void d_set_spring(f32); void d_set_ambient(f32, f32, f32); @@ -115,18 +114,18 @@ void d_set_control_type(s32); void d_set_skin_weight(s32, f32); void d_set_id(s32); void d_set_material(void *, s32); -void d_map_materials(DynId); -void d_map_vertices(DynId); +void d_map_materials(DynObjName); +void d_map_vertices(DynObjName); void d_set_texture_st(f32, f32); void d_use_texture(void *); -void d_make_netfromshapeid(DynId); +void d_make_netfromshapeid(DynObjName); void d_make_netfromshape_ptrptr(struct ObjShape **); -void add_to_dynobj_list(struct GdObj *, DynId); +void add_to_dynobj_list(struct GdObj *, DynObjName); /** * Store the active dynamic `GdObj` into a one object stash. */ -void push_dynobj_stash(void) { +void d_stash_dynobj(void) { sStashedDynObjInfo = sDynListCurInfo; sStashedDynObj = sDynListCurObj; } @@ -134,7 +133,7 @@ void push_dynobj_stash(void) { /** * Set the stashed `GdObj` as the active dynamic `GdObj`. */ -void pop_dynobj_stash(void) { +void d_unstash_dynobj(void) { sDynListCurObj = sStashedDynObj; sDynListCurInfo = sStashedDynObjInfo; } @@ -145,11 +144,11 @@ void pop_dynobj_stash(void) { void reset_dynlist(void) { sUnnamedObjCount = 0; sLoadedDynObjs = 0; - sDynIdBuf[0] = '\0'; + sDynNameSuffix[0] = '\0'; sGdDynObjList = NULL; sDynListCurObj = NULL; sDynNetCount = 0; - sGdDynObjIdIsInt = FALSE; + sUseIntegerNames = FALSE; gd_strcpy(sNullDynObjInfo.name, "NullObj"); } @@ -169,37 +168,37 @@ struct GdObj *proc_dynlist(struct DynList *dylist) { while (dylist->cmd != 58) { switch (dylist->cmd) { case 43: - d_copystr_to_idbuf(Dyn1AsStr(dylist)); + d_set_name_suffix(Dyn1AsStr(dylist)); break; case 15: - d_makeobj(Dyn2AsInt(dylist), Dyn1AsID(dylist)); + d_makeobj(Dyn2AsInt(dylist), Dyn1AsName(dylist)); break; case 46: - d_add_net_with_subgroup(Dyn2AsInt(dylist), Dyn1AsID(dylist)); + d_add_net_with_subgroup(Dyn2AsInt(dylist), Dyn1AsName(dylist)); break; case 48: - d_end_net_subgroup(Dyn1AsID(dylist)); + d_end_net_with_subgroup(Dyn1AsName(dylist)); break; case 47: - d_attach_joint_to_net(Dyn2AsInt(dylist), Dyn1AsID(dylist)); + d_attach_joint_to_net(Dyn2AsInt(dylist), Dyn1AsName(dylist)); break; case 16: - d_start_group(Dyn1AsID(dylist)); + d_start_group(Dyn1AsName(dylist)); break; case 17: - d_end_group(Dyn1AsID(dylist)); + d_end_group(Dyn1AsName(dylist)); break; case 18: - d_addto_group(Dyn1AsID(dylist)); + d_addto_group(Dyn1AsName(dylist)); break; case 30: - d_use_obj(Dyn1AsID(dylist)); + d_use_obj(Dyn1AsName(dylist)); break; case 28: - d_link_with(Dyn1AsID(dylist)); + d_link_with(Dyn1AsName(dylist)); break; case 50: - d_add_valptr(Dyn1AsID(dylist), (u32) DynVecY(dylist), Dyn2AsInt(dylist), + d_add_valptr(Dyn1AsName(dylist), (u32) DynVecY(dylist), Dyn2AsInt(dylist), (size_t) DynVecX(dylist)); break; case 29: @@ -209,7 +208,7 @@ struct GdObj *proc_dynlist(struct DynList *dylist) { proc_dynlist(Dyn1AsPtr(dylist)); break; case 0: - dynid_is_int(Dyn2AsInt(dylist)); + d_use_integer_names(Dyn2AsInt(dylist)); break; case 1: d_set_init_pos(DynVecX(dylist), DynVecY(dylist), DynVecZ(dylist)); @@ -254,31 +253,31 @@ struct GdObj *proc_dynlist(struct DynList *dylist) { d_set_obj_draw_flag(Dyn2AsInt(dylist)); break; case 39: - d_attach(Dyn1AsID(dylist)); + d_attach(Dyn1AsName(dylist)); break; case 40: - d_attachto_dynid(Dyn2AsInt(dylist), Dyn1AsID(dylist)); + d_attachto_dynid(Dyn2AsInt(dylist), Dyn1AsName(dylist)); break; case 41: d_set_att_offset(DynVec(dylist)); break; case 21: - d_set_nodegroup(Dyn1AsID(dylist)); + d_set_nodegroup(Dyn1AsName(dylist)); break; case 20: - d_set_matgroup(Dyn1AsID(dylist)); + d_set_matgroup(Dyn1AsName(dylist)); break; case 22: - d_set_skinshape(Dyn1AsID(dylist)); + d_set_skinshape(Dyn1AsName(dylist)); break; case 23: - d_set_planegroup(Dyn1AsID(dylist)); + d_set_planegroup(Dyn1AsName(dylist)); break; case 24: d_set_shapeptrptr(Dyn1AsPtr(dylist)); break; case 25: - d_set_shapeptr(Dyn1AsID(dylist)); + d_set_shapeptr(Dyn1AsName(dylist)); break; case 19: d_set_type(Dyn2AsInt(dylist)); @@ -311,10 +310,10 @@ struct GdObj *proc_dynlist(struct DynList *dylist) { d_set_material(Dyn1AsPtr(dylist), Dyn2AsInt(dylist)); break; case 37: - d_map_materials(Dyn1AsID(dylist)); + d_map_materials(Dyn1AsName(dylist)); break; case 38: - d_map_vertices(Dyn1AsID(dylist)); + d_map_vertices(Dyn1AsName(dylist)); break; case 53: d_set_texture_st(DynVecX(dylist), DynVecY(dylist)); @@ -323,7 +322,7 @@ struct GdObj *proc_dynlist(struct DynList *dylist) { d_use_texture(Dyn2AsPtr(dylist)); break; case 54: - d_make_netfromshapeid(Dyn1AsID(dylist)); + d_make_netfromshapeid(Dyn1AsName(dylist)); break; case 55: d_make_netfromshape_ptrptr(Dyn1AsPtr(dylist)); @@ -343,15 +342,15 @@ struct GdObj *proc_dynlist(struct DynList *dylist) { * is `NULL`, then a generic string is created based on the number of * unnamed objects. */ -void d_copystr_to_idbuf(char *str) { +void d_set_name_suffix(char *str) { if (str != NULL) { if (str[0] == '\0') { - sprintf(sDynIdBuf, "__%d", ++sUnnamedObjCount); + sprintf(sDynNameSuffix, "__%d", ++sUnnamedObjCount); } else { - gd_strcpy(sDynIdBuf, str); + gd_strcpy(sDynNameSuffix, str); } } else { - sDynIdBuf[0] = '\0'; + sDynNameSuffix[0] = '\0'; } } @@ -363,7 +362,7 @@ void d_copystr_to_idbuf(char *str) { * * @note Not called */ -void d_catstr_to_idbuf(char *str) { +void d_append_to_name_suffix(char *str) { char buf[0xff + 1]; if (str != NULL) { @@ -376,30 +375,30 @@ void d_catstr_to_idbuf(char *str) { buf[0] = '\0'; } - gd_strcat(sDynIdBuf, buf); + gd_strcat(sDynNameSuffix, buf); } /** * Stash the current string that is appended to a created dynamic `GdObj` name. */ -void cpy_idbuf_to_backbuf(void) { - gd_strcpy(sBackBuf, sDynIdBuf); +static void stash_name_suffix(void) { + gd_strcpy(sStashedDynNameSuffix, sDynNameSuffix); } /** * Pop the stash for the string that is appended to a created dynamic `GdObj` name. */ -void cpy_backbuf_to_idbuf(void) { - gd_strcpy(sDynIdBuf, sBackBuf); +static void unstash_name_suffix(void) { + gd_strcpy(sDynNameSuffix, sStashedDynNameSuffix); } /** - * Get the `DynObjInfo` struct for object `id` + * Get the `DynObjInfo` struct for object `name` * - * @param id Either a string or integer id for a dynamic `GdObj` + * @param name Either a string or integer id for a dynamic `GdObj` * @returns pointer to that object's information */ -struct DynObjInfo *get_dynobj_info(DynId id) { +static struct DynObjInfo *get_dynobj_info(DynObjName name) { struct DynObjInfo *foundDynobj; char buf[0x100]; s32 i; @@ -408,16 +407,16 @@ struct DynObjInfo *get_dynobj_info(DynId id) { return NULL; } - if (sGdDynObjIdIsInt) { - sprintf(buf, "N%d", DynIdAsInt(id)); + if (sUseIntegerNames) { + sprintf(buf, "N%d", DynNameAsInt(name)); } else { - gd_strcpy(buf, DynIdAsStr(id)); // strcpy + gd_strcpy(buf, DynNameAsStr(name)); } - gd_strcat(buf, sDynIdBuf); // strcat + gd_strcat(buf, sDynNameSuffix); foundDynobj = NULL; for (i = 0; i < sLoadedDynObjs; i++) { - if (gd_str_not_equal(sGdDynObjList[i].name, buf) == 0) // strcmp equal + if (gd_str_not_equal(sGdDynObjList[i].name, buf) == 0) { foundDynobj = &sGdDynObjList[i]; break; @@ -450,61 +449,62 @@ void reset_dynamic_objs(void) { * Create an `ObjNet` and an associated node `ObjGroup`. This function creates * its own naming string to append to later created dynamic objects. */ -void d_add_net_with_subgroup(UNUSED s32 a0, DynId id) { - d_makeobj(D_NET, id); - d_set_obj_draw_flag(OBJ_NOT_DRAWABLE); +void d_add_net_with_subgroup(UNUSED s32 a0, DynObjName name) { + d_makeobj(D_NET, name); + d_set_obj_draw_flag(OBJ_INVISIBLE); // this creates a string to append to the names of the objs created after this - sprintf(sDynNetIdBuf, "c%d", ++sDynNetCount); + sprintf(sDynNetNameSuffix, "c%d", ++sDynNetCount); d_set_type(4); - cpy_idbuf_to_backbuf(); - d_copystr_to_idbuf(sDynNetIdBuf); - d_start_group(id); - cpy_backbuf_to_idbuf(); - d_use_obj(id); - sParentNetInfo = sDynListCurInfo; + stash_name_suffix(); + d_set_name_suffix(sDynNetNameSuffix); + d_start_group(name); + unstash_name_suffix(); + d_use_obj(name); + sParentObjInfo = sDynListCurInfo; } /** * End the `ObjNet`+`ObjGroup` set created by `d_add_net_with_subgroup()`. */ -void d_end_net_subgroup(DynId id) { - d_use_obj(id); - cpy_idbuf_to_backbuf(); - d_copystr_to_idbuf(sDynNetIdBuf); - d_end_group(id); - d_set_nodegroup(id); - cpy_backbuf_to_idbuf(); - sParentNetInfo = NULL; +void d_end_net_with_subgroup(DynObjName name) { + d_use_obj(name); + stash_name_suffix(); + d_set_name_suffix(sDynNetNameSuffix); + d_end_group(name); + d_set_nodegroup(name); + unstash_name_suffix(); + sParentObjInfo = NULL; } /** - * Create an `ObjJoint` and add that to the `ObjNet` created by - * `d_add_net_with_subgroup()`. + * Create an `ObjJoint` and attach that to the `ObjNet` created by + * `d_add_net_with_subgroup()` or the most recent `ObjJoint` created + * by `d_attach_joint_to_net()`. * * @param arg0 Not used - * @param id Id for created `ObjJoint` + * @param name Name for created `ObjJoint` */ -void d_attach_joint_to_net(UNUSED s32 arg0, DynId id) { +void d_attach_joint_to_net(UNUSED s32 arg0, DynObjName name) { UNUSED struct DynObjInfo *curInfo = sDynListCurInfo; UNUSED u32 pad[2]; - d_makeobj(D_JOINT, id); + d_makeobj(D_JOINT, name); d_set_type(3); d_set_shapeptrptr(NULL); - d_attach_to(0xD, sParentNetInfo->obj); - sParentNetInfo = sDynListCurInfo; + d_attach_to(0xD, sParentObjInfo->obj); + sParentObjInfo = sDynListCurInfo; } /** - * Create a new `ObjNet` linked with the dynamic `ObjShape` `id`. + * Create a new `ObjNet` linked with the dynamic `ObjShape` `name`. * The newly made net is added to the dynamic object list. */ -void d_make_netfromshapeid(DynId id) { - struct DynObjInfo *dyninfo = get_dynobj_info(id); +void d_make_netfromshapeid(DynObjName name) { + struct DynObjInfo *dyninfo = get_dynobj_info(name); struct ObjNet *net; if (dyninfo == NULL) { - fatal_printf("dMakeNetFromShape(\"%s\"): Undefined object", DynIdAsStr(id)); + fatal_printf("dMakeNetFromShape(\"%s\"): Undefined object", DynNameAsStr(name)); } net = make_netfromshape((struct ObjShape *) dyninfo->obj); @@ -526,11 +526,11 @@ void d_make_netfromshape_ptrptr(struct ObjShape **shapePtr) { } /** - * Add `newobj` identified by `id` to the dynamic `GdObj` list. Once a `GdObj` - * is in the dynamic list, it can referred to by its `id` when that object is + * Add `newobj` identified by `name` to the dynamic `GdObj` list. Once a `GdObj` + * is in the dynamic list, it can referred to by its `name` when that object is * needed later. */ -void add_to_dynobj_list(struct GdObj *newobj, DynId id) { +void add_to_dynobj_list(struct GdObj *newobj, DynObjName name) { UNUSED u32 pad; char idbuf[0x100]; @@ -545,23 +545,23 @@ void add_to_dynobj_list(struct GdObj *newobj, DynId id) { stop_memtracker("dynlist"); - if (sGdDynObjIdIsInt) { - sprintf(idbuf, "N%d", DynIdAsInt(id)); - id = NULL; + if (sUseIntegerNames) { + sprintf(idbuf, "N%d", DynNameAsInt(name)); + name = NULL; } else { sprintf(idbuf, "U%d", ((u32) sLoadedDynObjs) + 1); } - if (DynIdAsStr(id) != NULL) { - if (get_dynobj_info(id) != NULL) { - fatal_printf("dMakeObj(\"%s\"): Object with same name already exists", DynIdAsStr(id)); + if (DynNameAsStr(name) != NULL) { + if (get_dynobj_info(name) != NULL) { + fatal_printf("dMakeObj(\"%s\"): Object with same name already exists", DynNameAsStr(name)); } - gd_strcpy(sGdDynObjList[sLoadedDynObjs].name, DynIdAsStr(id)); + gd_strcpy(sGdDynObjList[sLoadedDynObjs].name, DynNameAsStr(name)); } else { gd_strcpy(sGdDynObjList[sLoadedDynObjs].name, idbuf); } - gd_strcat(sGdDynObjList[sLoadedDynObjs].name, sDynIdBuf); + gd_strcat(sGdDynObjList[sLoadedDynObjs].name, sDynNameSuffix); if (gd_strlen(sGdDynObjList[sLoadedDynObjs].name) > (DYNOBJ_NAME_SIZE - 1)) { fatal_printf("dyn list obj name too long '%s'", sGdDynObjList[sLoadedDynObjs].name); @@ -581,16 +581,16 @@ void add_to_dynobj_list(struct GdObj *newobj, DynId id) { } /** - * Format `id` into string, if `DynId`s are currently being interpreted + * Format `name` into string, if `DynObjName`s are currently being interpreted * as numbers. * * @returns pointer to global buffer for id - * @retval NULL if `id` is `NULL` or if `DynId`s are interpreted as strings + * @retval NULL if `name` is `NULL` or if `DynObjName`s are interpreted as strings */ -char *print_int_dynid(DynId id) { - if (id && sGdDynObjIdIsInt) { - sprintf(sIntDynIdBuffer, "N%d", DynIdAsInt(id)); - return sIntDynIdBuffer; +static char *integer_name_to_string(DynObjName name) { + if (DynNameAsInt(name) != 0 && sUseIntegerNames) { + sprintf(sIntToStringBuf, "N%d", DynNameAsInt(name)); + return sIntToStringBuf; } return NULL; @@ -598,12 +598,12 @@ char *print_int_dynid(DynId id) { /** * Create a new `GdObj` of `type` and add that object to the - * dynamic object list with `id`. Created objects have default + * dynamic object list with `name`. Created objects have default * parameters, which are usually 0 or NULL. * * @returns pointer to created object */ -struct GdObj *d_makeobj(enum DObjTypes type, DynId id) { +struct GdObj *d_makeobj(enum DObjTypes type, DynObjName name) { struct GdObj *dobj; UNUSED struct ObjGroup *dgroup; @@ -625,7 +625,7 @@ struct GdObj *d_makeobj(enum DObjTypes type, DynId id) { dgroup = (struct ObjGroup *) dobj; break; case D_DATA_GRP: - d_makeobj(D_GROUP, id); + d_makeobj(D_GROUP, name); ((struct ObjGroup *) sDynListCurObj)->linkType = 1; //! @bug Returns garbage when making `D_DATA_GRP` object #ifdef AVOID_UB @@ -655,7 +655,7 @@ struct GdObj *d_makeobj(enum DObjTypes type, DynId id) { dobj = &make_material(0, NULL, 0)->header; break; case D_SHAPE: - dobj = &make_shape(0, print_int_dynid(id))->header; + dobj = &make_shape(0, integer_name_to_string(name))->header; break; case D_GADGET: dobj = &make_gadget(0, 0)->header; @@ -684,25 +684,25 @@ struct GdObj *d_makeobj(enum DObjTypes type, DynId id) { fatal_printf("dMakeObj(): Unkown object type"); } - add_to_dynobj_list(dobj, id); + add_to_dynobj_list(dobj, name); return dobj; } /** - * Attach dynamic object `id` to the current active `ObjJoint` object. + * Attach dynamic object `name` to the current active `ObjJoint` object. * * @note This function doesn't actually do anything. */ -void d_attach(DynId id) { +void d_attach(DynObjName name) { struct DynObjInfo *info; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dAttach(\"%s\"): Undefined object", DynIdAsStr(id)); + fatal_printf("dAttach(\"%s\"): Undefined object", DynNameAsStr(name)); } switch (sDynListCurObj->type) { @@ -723,10 +723,10 @@ void d_attach_to(s32 flag, struct GdObj *obj) { struct ObjGroup *attgrp; UNUSED u32 pad[2]; UNUSED struct DynObjInfo *curInfo = sDynListCurInfo; - struct GdVec3f dynobjPos; // transformed into attach offset + struct GdVec3f currObjPos; // transformed into attach offset struct GdVec3f objPos; - push_dynobj_stash(); + d_stash_dynobj(); if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); @@ -735,23 +735,23 @@ void d_attach_to(s32 flag, struct GdObj *obj) { // find or generate attachment groups switch (obj->type) { case OBJ_TYPE_JOINTS: - if ((attgrp = ((struct ObjJoint *) obj)->unk1F8) == NULL) { - attgrp = ((struct ObjJoint *) obj)->unk1F8 = make_group(0); + if ((attgrp = ((struct ObjJoint *) obj)->attachedObjsGrp) == NULL) { + attgrp = ((struct ObjJoint *) obj)->attachedObjsGrp = make_group(0); } break; case OBJ_TYPE_NETS: - if ((attgrp = ((struct ObjNet *) obj)->unk1D4) == NULL) { - attgrp = ((struct ObjNet *) obj)->unk1D4 = make_group(0); + if ((attgrp = ((struct ObjNet *) obj)->attachedObjsGrp) == NULL) { + attgrp = ((struct ObjNet *) obj)->attachedObjsGrp = make_group(0); } break; case OBJ_TYPE_PARTICLES: - if ((attgrp = ((struct ObjParticle *) obj)->unkB4) == NULL) { - attgrp = ((struct ObjParticle *) obj)->unkB4 = make_group(0); + if ((attgrp = ((struct ObjParticle *) obj)->attachedObjsGrp) == NULL) { + attgrp = ((struct ObjParticle *) obj)->attachedObjsGrp = make_group(0); } break; case OBJ_TYPE_ANIMATORS: - if ((attgrp = ((struct ObjAnimator *) obj)->unk30) == NULL) { - attgrp = ((struct ObjAnimator *) obj)->unk30 = make_group(0); + if ((attgrp = ((struct ObjAnimator *) obj)->attachedObjsGrp) == NULL) { + attgrp = ((struct ObjAnimator *) obj)->attachedObjsGrp = make_group(0); } break; default: @@ -766,32 +766,32 @@ void d_attach_to(s32 flag, struct GdObj *obj) { addto_group(attgrp, sDynListCurObj); if (flag & 9) { - d_get_world_pos(&dynobjPos); + d_get_world_pos(&currObjPos); set_cur_dynobj(obj); d_get_world_pos(&objPos); - dynobjPos.x -= objPos.x; - dynobjPos.y -= objPos.y; - dynobjPos.z -= objPos.z; + currObjPos.x -= objPos.x; + currObjPos.y -= objPos.y; + currObjPos.z -= objPos.z; } - pop_dynobj_stash(); + d_unstash_dynobj(); switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) sDynListCurObj)->unk1FC = flag; - ((struct ObjJoint *) sDynListCurObj)->unk20C = obj; + ((struct ObjJoint *) sDynListCurObj)->attachFlags = flag; + ((struct ObjJoint *) sDynListCurObj)->attachedToObj = obj; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) sDynListCurObj)->unk1E4 = flag; - ((struct ObjNet *) sDynListCurObj)->unk1E8 = obj; + ((struct ObjNet *) sDynListCurObj)->attachFlags = flag; + ((struct ObjNet *) sDynListCurObj)->attachedToObj = obj; break; case OBJ_TYPE_PARTICLES: - ((struct ObjParticle *) sDynListCurObj)->unkB8 = flag; - ((struct ObjParticle *) sDynListCurObj)->unkBC = obj; + ((struct ObjParticle *) sDynListCurObj)->attachFlags = flag; + ((struct ObjParticle *) sDynListCurObj)->attachedToObj = obj; break; case OBJ_TYPE_ANIMATORS: - ((struct ObjAnimator *) sDynListCurObj)->unk34 = flag; - ((struct ObjAnimator *) sDynListCurObj)->unk44 = obj; + ((struct ObjAnimator *) sDynListCurObj)->attachFlags = flag; + ((struct ObjAnimator *) sDynListCurObj)->attachedToObj = obj; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dAttachTo()", @@ -799,27 +799,27 @@ void d_attach_to(s32 flag, struct GdObj *obj) { } if (flag & 9) { - d_set_att_offset(&dynobjPos); + d_set_att_offset(&currObjPos); } } /** - * Attach the current dynamic object to dynamic object `id`. This function + * Attach the current dynamic object to dynamic object `name`. This function * is a wrapper around `d_attach_to()` */ -void d_attachto_dynid(s32 flag, DynId id) { +void d_attachto_dynid(s32 flag, DynObjName name) { struct DynObjInfo *info; - if (id == NULL) { + if (name == NULL) { return; } if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dAttachTo(\"%s\"): Undefined object", DynIdAsStr(id)); + fatal_printf("dAttachTo(\"%s\"): Undefined object", DynNameAsStr(name)); } d_attach_to(flag, info->obj); @@ -839,7 +839,7 @@ void copy_bytes(u8 *src, u8 *dst, s32 num) { /** * Allocate the animation data for `animator` onto the goddard heap. - * Animation data of type `::GD_ANIM_9H` is converted to a `AnimMtxVec` struct, + * Animation data of type `::GD_ANIM_SCALE3S_POS3S_ROT3S` is converted to a `AnimMtxVec` struct, * rather than solely byted copied like the other types. */ void alloc_animdata(struct ObjAnimator *animator) { @@ -857,17 +857,17 @@ void alloc_animdata(struct ObjAnimator *animator) { s32 animCnt; //+38; count of animdata "info" structs s32 i; //+34 void *allocSpace; //+30; allocated animdata space - f32 allocMtxScale = 0.1f; //+2C; scale postion/rotation of GD_ANIM_9H data + f32 allocMtxScale = 0.1f; //+2C; scale postion/rotation of GD_ANIM_SCALE3S_POS3S_ROT3S data struct AnimMtxVec *curMtxVec; //+28 UNUSED u32 pad20; start_memtracker("animdata"); - if ((animgrp = animator->animdata) == NULL) { + if ((animgrp = animator->animdataGrp) == NULL) { fatal_printf("no anim group"); } - if ((curAnimSrc = (struct AnimDataInfo *) animgrp->link1C->obj) == NULL) { + if ((curAnimSrc = (struct AnimDataInfo *) animgrp->firstMember->obj) == NULL) { fatal_printf("no animation data"); } @@ -887,26 +887,26 @@ void alloc_animdata(struct ObjAnimator *animator) { allocSpace = NULL; if (curAnimSrc->type != 0) { switch (curAnimSrc->type) { - case GD_ANIM_CAMERA: + case GD_ANIM_CAMERA_EYE3S_LOOKAT3S: datasize = sizeof(s16[6]); break; - case GD_ANIM_3H_SCALED: + case GD_ANIM_ROT3S: datasize = sizeof(s16[3]); break; - case GD_ANIM_3H: + case GD_ANIM_POS3S: datasize = sizeof(s16[3]); break; - case GD_ANIM_6H_SCALED: + case GD_ANIM_ROT3S_POS3S: datasize = sizeof(s16[6]); break; - case GD_ANIM_TRI_F_2: + case GD_ANIM_SCALE3F_ROT3F_POS3F: datasize = sizeof(f32[3][3]); break; /* This function will convert the s16[9] array into a struct AnimMtxVec */ - case GD_ANIM_9H: + case GD_ANIM_SCALE3S_POS3S_ROT3S: datasize = sizeof(struct AnimMtxVec); break; - case GD_ANIM_MATRIX: + case GD_ANIM_MTX4x4: datasize = sizeof(Mat4f); break; default: @@ -919,7 +919,7 @@ void alloc_animdata(struct ObjAnimator *animator) { fatal_printf("cant allocate animation data"); } - if (curAnimSrc->type == GD_ANIM_9H) { + if (curAnimSrc->type == GD_ANIM_SCALE3S_POS3S_ROT3S) { for (dataIdx = 0; dataIdx < curAnimSrc->count; dataIdx++) { halfarr = &((s16(*)[9]) curAnimSrc->data)[dataIdx]; curMtxVec = &((struct AnimMtxVec *) allocSpace)[dataIdx]; @@ -942,7 +942,7 @@ void alloc_animdata(struct ObjAnimator *animator) { ((struct AnimMtxVec *) allocSpace)[dataIdx].vec.y = tri.p0.y; ((struct AnimMtxVec *) allocSpace)[dataIdx].vec.z = tri.p0.z; } - curAnimSrc->type = GD_ANIM_MTX_VEC; + curAnimSrc->type = GD_ANIM_MTX4x4F_SCALE3F; } else { copy_bytes(curAnimSrc->data, allocSpace, curAnimSrc->count * datasize); } @@ -955,7 +955,7 @@ void alloc_animdata(struct ObjAnimator *animator) { curAnimSrc++; // next anim data struct } - animgrp->link1C->obj = (void *) animDataArr; + animgrp->firstMember->obj = (void *) animDataArr; stop_memtracker("animdata"); } @@ -984,7 +984,7 @@ void chk_shapegen(struct ObjShape *shape) { struct GdObj *oldObjHead; // sp2C start_memtracker("chk_shapegen"); - add_to_stacktrace("chk_shapegen"); + imin("chk_shapegen"); shapeMtls = shape->mtlGroup; shapeFaces = shape->faceGroup; shapeVtx = shape->vtxGroup; @@ -992,9 +992,9 @@ void chk_shapegen(struct ObjShape *shape) { if (shapeVtx != NULL && shapeFaces != NULL) { if ((shapeVtx->linkType & 1) && (shapeFaces->linkType & 1)) //? needs the double if { - // These Links point to special, compressed data structures - vtxdata = (struct GdVtxData *) shapeVtx->link1C->obj; - facedata = (struct GdFaceData *) shapeFaces->link1C->obj; + // These ListNodes point to special, compressed data structures + vtxdata = (struct GdVtxData *) shapeVtx->firstMember->obj; + facedata = (struct GdFaceData *) shapeFaces->firstMember->obj; if (facedata->type != 1) { fatal_printf("unsupported poly type"); } @@ -1073,14 +1073,14 @@ void chk_shapegen(struct ObjShape *shape) { } /** - * Set the "node group" of the current dynamic object to dynamic object `id`. + * Set the "node group" of the current dynamic object to dynamic object `name`. * The node group depends on the type of the current dynamic object: * * the vertex group is set for `ObjShape` * * the joints/weight group is set for `ObjNet` * * data is set for `ObjAnimator` * * something is set for `ObjGadget` */ -void d_set_nodegroup(DynId id) { +void d_set_nodegroup(DynObjName name) { struct DynObjInfo *info; // sp2C UNUSED u32 pad[2]; @@ -1088,9 +1088,9 @@ void d_set_nodegroup(DynId id) { fatal_printf("proc_dynlist(): No current object"); } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dSetNodeGroup(\"%s\"): Undefined group", DynIdAsStr(id)); + fatal_printf("dSetNodeGroup(\"%s\"): Undefined group", DynNameAsStr(name)); } switch (sDynListCurObj->type) { @@ -1106,7 +1106,7 @@ void d_set_nodegroup(DynId id) { ((struct ObjGadget *) sDynListCurObj)->unk54 = (struct ObjGroup *) info->obj; break; case OBJ_TYPE_ANIMATORS: - ((struct ObjAnimator *) sDynListCurObj)->animdata = (struct ObjGroup *) info->obj; + ((struct ObjAnimator *) sDynListCurObj)->animdataGrp = (struct ObjGroup *) info->obj; alloc_animdata((struct ObjAnimator *) sDynListCurObj); break; default: @@ -1116,18 +1116,18 @@ void d_set_nodegroup(DynId id) { } /** - * Set the material group of the current dynamic `ObjShape` to `id`. + * Set the material group of the current dynamic `ObjShape` to `name`. */ -void d_set_matgroup(DynId id) { - struct DynObjInfo *info; // sp1C +void d_set_matgroup(DynObjName name) { + struct DynObjInfo *info; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dSetMatGroup(\"%s\"): Undefined group", DynIdAsStr(id)); + fatal_printf("dSetMatGroup(\"%s\"): Undefined group", DynNameAsStr(name)); } switch (sDynListCurObj->type) { @@ -1183,18 +1183,18 @@ void d_use_texture(void *texture) { /** * Set the current dynamic `ObjNet`'s skin group with the vertex group from - * the dynamic `ObjShape` with `id`. + * the dynamic `ObjShape` with `name`. */ -void d_set_skinshape(DynId id) { +void d_set_skinshape(DynObjName name) { struct DynObjInfo *info; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dSetSkinShape(\"%s\"): Undefined object", DynIdAsStr(id)); + fatal_printf("dSetSkinShape(\"%s\"): Undefined object", DynNameAsStr(name)); } switch (sDynListCurObj->type) { @@ -1209,41 +1209,43 @@ void d_set_skinshape(DynId id) { /** * Map the material ids for the `ObjFace`s in the current dynamic `ObjGroup` - * to pointer to `ObjMaterial`s in the `ObjGroup` `id`. + * to pointer to `ObjMaterial`s in the `ObjGroup` `name`. * * See `map_face_materials()` for more info. */ -void d_map_materials(DynId id) { +void d_map_materials(DynObjName name) { struct DynObjInfo *info; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dMapMaterials(\"%s\"): Undefined group", DynIdAsStr(id)); + fatal_printf("dMapMaterials(\"%s\"): Undefined group", DynNameAsStr(name)); } map_face_materials((struct ObjGroup *) sDynListCurObj, (struct ObjGroup *) info->obj); } /** - * Map the vertex ids for the `ObjFace`s in the current dynamic `ObjGroup` - * to pointer to `ObjVertex` in the `ObjGroup` `id`. - * + * For all faces in the current `ObjGroup`, resolve their vertex indices to + * `ObjVertex` pointers that point to vertices in the specified vertex group. + * Also compute normals for all faces in the current `ObjGroup` and all vertices + * in the specified vertex group. * See `map_vertices()` for more info. + * @param name name of a vertex group dynobj */ -void d_map_vertices(DynId id) { +void d_map_vertices(DynObjName name) { struct DynObjInfo *info; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dMapVertices(\"%s\"): Undefined group", DynIdAsStr(id)); + fatal_printf("dMapVertices(\"%s\"): Undefined group", DynNameAsStr(name)); } map_vertices((struct ObjGroup *) sDynListCurObj, (struct ObjGroup *) info->obj); @@ -1251,21 +1253,21 @@ void d_map_vertices(DynId id) { /** * In practice, this is used to set the faces of the current - * active dynamic `ObjShape` to the dynamic group `id` of `ObjFace`s. + * active dynamic `ObjShape` to the dynamic group `name` of `ObjFace`s. * It also has interactions with `ObjNet`s, but there are no examples * of that usage in existing code. */ -void d_set_planegroup(DynId id) { - struct DynObjInfo *info; // sp2C +void d_set_planegroup(DynObjName name) { + struct DynObjInfo *info; UNUSED u32 pad[2]; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dSetPlaneGroup(\"%s\"): Undefined group", DynIdAsStr(id)); + fatal_printf("dSetPlaneGroup(\"%s\"): Undefined group", DynNameAsStr(name)); } switch (sDynListCurObj->type) { @@ -1299,20 +1301,20 @@ void d_set_shapeptrptr(struct ObjShape **shpPtrptr) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) sDynListCurObj)->unk20 = *shpPtrptr; - ((struct ObjJoint *) sDynListCurObj)->unk1C8 = 0; + ((struct ObjJoint *) sDynListCurObj)->shapePtr = *shpPtrptr; + ((struct ObjJoint *) sDynListCurObj)->colourNum = 0; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) sDynListCurObj)->unk1A8 = *shpPtrptr; + ((struct ObjNet *) sDynListCurObj)->shapePtr = *shpPtrptr; break; case OBJ_TYPE_BONES: - ((struct ObjBone *) sDynListCurObj)->unkF0 = *shpPtrptr; + ((struct ObjBone *) sDynListCurObj)->shapePtr = *shpPtrptr; break; case OBJ_TYPE_GADGETS: - ((struct ObjGadget *) sDynListCurObj)->unk50 = *shpPtrptr; + ((struct ObjGadget *) sDynListCurObj)->shapePtr = *shpPtrptr; break; case OBJ_TYPE_PARTICLES: - ((struct ObjParticle *) sDynListCurObj)->unk1C = *shpPtrptr; + ((struct ObjParticle *) sDynListCurObj)->shapePtr = *shpPtrptr; break; case OBJ_TYPE_LIGHTS: ((struct ObjLight *) sDynListCurObj)->unk9C = *shpPtrptr; @@ -1325,35 +1327,35 @@ void d_set_shapeptrptr(struct ObjShape **shpPtrptr) { /** * Set the shape pointer of the current active dynamic object to dynamic - * `ObjShape` `id`. + * `ObjShape` `name`. */ -void d_set_shapeptr(DynId id) { - struct DynObjInfo *info; // sp24 - if (id == NULL) { +void d_set_shapeptr(DynObjName name) { + struct DynObjInfo *info; + if (name == NULL) { return; } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dSetShapePtr(\"%s\"): Undefined object", DynIdAsStr(id)); + fatal_printf("dSetShapePtr(\"%s\"): Undefined object", DynNameAsStr(name)); } switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) sDynListCurObj)->unk20 = (struct ObjShape *) info->obj; - ((struct ObjJoint *) sDynListCurObj)->unk1C8 = 0; + ((struct ObjJoint *) sDynListCurObj)->shapePtr = (struct ObjShape *) info->obj; + ((struct ObjJoint *) sDynListCurObj)->colourNum = 0; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) sDynListCurObj)->unk1A8 = (struct ObjShape *) info->obj; + ((struct ObjNet *) sDynListCurObj)->shapePtr = (struct ObjShape *) info->obj; break; case OBJ_TYPE_BONES: - ((struct ObjBone *) sDynListCurObj)->unkF0 = (struct ObjShape *) info->obj; + ((struct ObjBone *) sDynListCurObj)->shapePtr = (struct ObjShape *) info->obj; break; case OBJ_TYPE_GADGETS: - ((struct ObjGadget *) sDynListCurObj)->unk50 = (struct ObjShape *) info->obj; + ((struct ObjGadget *) sDynListCurObj)->shapePtr = (struct ObjShape *) info->obj; break; case OBJ_TYPE_PARTICLES: - ((struct ObjParticle *) sDynListCurObj)->unk1C = (struct ObjShape *) info->obj; + ((struct ObjParticle *) sDynListCurObj)->shapePtr = (struct ObjShape *) info->obj; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetShapePtr()", @@ -1362,12 +1364,12 @@ void d_set_shapeptr(DynId id) { } /** - * Set the current active dynamic object to object `id`. + * Set the current active dynamic object to object `name`. */ -struct GdObj *d_use_obj(DynId id) { - struct DynObjInfo *info = get_dynobj_info(id); +struct GdObj *d_use_obj(DynObjName name) { + struct DynObjInfo *info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dUseObj(\"%s\"): Undefined object", DynIdAsStr(id)); + fatal_printf("dUseObj(\"%s\"): Undefined object", DynNameAsStr(name)); } sDynListCurObj = info->obj; @@ -1387,24 +1389,24 @@ void set_cur_dynobj(struct GdObj *obj) { } /** - * Start a dynamic `ObjGroup` identified with `id`. + * Start a dynamic `ObjGroup` identified with `name`. */ -void d_start_group(DynId id) { - d_makeobj(D_GROUP, id); +void d_start_group(DynObjName name) { + d_makeobj(D_GROUP, name); } /** - * Add all dynamic objects created between the start of dynamic `ObjGroup` `id` + * Add all dynamic objects created between the start of dynamic `ObjGroup` `name` * and this call. */ -void d_end_group(DynId id) { +void d_end_group(DynObjName name) { UNUSED u32 pad; - struct DynObjInfo *info = get_dynobj_info(id); // sp20; - struct ObjGroup *dynGrp; // sp1C - s32 i; // sp18 + struct DynObjInfo *info = get_dynobj_info(name); + struct ObjGroup *dynGrp; + s32 i; if (info == NULL) { - fatal_printf("dEndGroup(\"%s\"): Undefined group", DynIdAsStr(id)); + fatal_printf("dEndGroup(\"%s\"): Undefined group", DynNameAsStr(name)); } dynGrp = (struct ObjGroup *) info->obj; @@ -1416,15 +1418,15 @@ void d_end_group(DynId id) { } /** - * Add the current dynamic object to the dynamic `ObjGroup` `id`. + * Add the current dynamic object to the dynamic `ObjGroup` `name`. */ -void d_addto_group(DynId id) { +void d_addto_group(DynObjName name) { UNUSED u32 pad; - struct DynObjInfo *info = get_dynobj_info(id); // sp20 + struct DynObjInfo *info = get_dynobj_info(name); struct ObjGroup *targetGrp; if (info == NULL) { - fatal_printf("dAddToGroup(\"%s\"): Undefined group", DynIdAsStr(id)); + fatal_printf("dAddToGroup(\"%s\"): Undefined group", DynNameAsStr(name)); } targetGrp = (struct ObjGroup *) info->obj; @@ -1432,13 +1434,13 @@ void d_addto_group(DynId id) { } /** - * Set if `DynId` should be treated as integer values, + * Set if `DynObjName` should be treated as integer values, * or as `char *` string pointers. * * @param isIntBool `TRUE` to interpret ids as integers */ -void dynid_is_int(s32 isIntBool) { - sGdDynObjIdIsInt = isIntBool; +void d_use_integer_names(s32 isIntBool) { + sUseIntegerNames = isIntBool; } /** @@ -1456,36 +1458,36 @@ void d_set_init_pos(f32 x, f32 y, f32 z) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) dynobj)->unk14.x = x; - ((struct ObjJoint *) dynobj)->unk14.y = y; - ((struct ObjJoint *) dynobj)->unk14.z = z; + ((struct ObjJoint *) dynobj)->worldPos.x = x; + ((struct ObjJoint *) dynobj)->worldPos.y = y; + ((struct ObjJoint *) dynobj)->worldPos.z = z; ((struct ObjJoint *) dynobj)->unk3C.x = x; ((struct ObjJoint *) dynobj)->unk3C.y = y; ((struct ObjJoint *) dynobj)->unk3C.z = z; - ((struct ObjJoint *) dynobj)->unk54.x = x; - ((struct ObjJoint *) dynobj)->unk54.y = y; - ((struct ObjJoint *) dynobj)->unk54.z = z; + ((struct ObjJoint *) dynobj)->initPos.x = x; + ((struct ObjJoint *) dynobj)->initPos.y = y; + ((struct ObjJoint *) dynobj)->initPos.z = z; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) dynobj)->unk14.x = x; - ((struct ObjNet *) dynobj)->unk14.y = y; - ((struct ObjNet *) dynobj)->unk14.z = z; + ((struct ObjNet *) dynobj)->worldPos.x = x; + ((struct ObjNet *) dynobj)->worldPos.y = y; + ((struct ObjNet *) dynobj)->worldPos.z = z; - ((struct ObjNet *) dynobj)->unk20.x = x; - ((struct ObjNet *) dynobj)->unk20.y = y; - ((struct ObjNet *) dynobj)->unk20.z = z; + ((struct ObjNet *) dynobj)->initPos.x = x; + ((struct ObjNet *) dynobj)->initPos.y = y; + ((struct ObjNet *) dynobj)->initPos.z = z; break; case OBJ_TYPE_PARTICLES: - ((struct ObjParticle *) dynobj)->unk20.x = x; - ((struct ObjParticle *) dynobj)->unk20.y = y; - ((struct ObjParticle *) dynobj)->unk20.z = z; + ((struct ObjParticle *) dynobj)->pos.x = x; + ((struct ObjParticle *) dynobj)->pos.y = y; + ((struct ObjParticle *) dynobj)->pos.z = z; break; case OBJ_TYPE_CAMERAS: - ((struct ObjCamera *) dynobj)->unk14.x = x; - ((struct ObjCamera *) dynobj)->unk14.y = y; - ((struct ObjCamera *) dynobj)->unk14.z = z; + ((struct ObjCamera *) dynobj)->worldPos.x = x; + ((struct ObjCamera *) dynobj)->worldPos.y = y; + ((struct ObjCamera *) dynobj)->worldPos.z = z; break; case OBJ_TYPE_VERTICES: d_set_rel_pos(x, y, z); @@ -1513,14 +1515,14 @@ void d_set_velocity(const struct GdVec3f *vel) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) dynobj)->unk78.x = vel->x; - ((struct ObjJoint *) dynobj)->unk78.y = vel->y; - ((struct ObjJoint *) dynobj)->unk78.z = vel->z; + ((struct ObjJoint *) dynobj)->velocity.x = vel->x; + ((struct ObjJoint *) dynobj)->velocity.y = vel->y; + ((struct ObjJoint *) dynobj)->velocity.z = vel->z; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) dynobj)->unk50.x = vel->x; - ((struct ObjNet *) dynobj)->unk50.y = vel->y; - ((struct ObjNet *) dynobj)->unk50.z = vel->z; + ((struct ObjNet *) dynobj)->velocity.x = vel->x; + ((struct ObjNet *) dynobj)->velocity.y = vel->y; + ((struct ObjNet *) dynobj)->velocity.z = vel->z; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetVelocity()", @@ -1542,14 +1544,14 @@ void d_get_velocity(struct GdVec3f *dst) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - dst->x = ((struct ObjJoint *) dynobj)->unk78.x; - dst->y = ((struct ObjJoint *) dynobj)->unk78.y; - dst->z = ((struct ObjJoint *) dynobj)->unk78.z; + dst->x = ((struct ObjJoint *) dynobj)->velocity.x; + dst->y = ((struct ObjJoint *) dynobj)->velocity.y; + dst->z = ((struct ObjJoint *) dynobj)->velocity.z; break; case OBJ_TYPE_NETS: - dst->x = ((struct ObjNet *) dynobj)->unk50.x; - dst->y = ((struct ObjNet *) dynobj)->unk50.y; - dst->z = ((struct ObjNet *) dynobj)->unk50.z; + dst->x = ((struct ObjNet *) dynobj)->velocity.x; + dst->y = ((struct ObjNet *) dynobj)->velocity.y; + dst->z = ((struct ObjNet *) dynobj)->velocity.z; break; default: dst->x = dst->y = dst->z = 0.0f; @@ -1572,9 +1574,9 @@ void d_set_torque(const struct GdVec3f *src) { switch (sDynListCurObj->type) { case OBJ_TYPE_NETS: - ((struct ObjNet *) dynobj)->unkA4.x = src->x; - ((struct ObjNet *) dynobj)->unkA4.y = src->y; - ((struct ObjNet *) dynobj)->unkA4.z = src->z; + ((struct ObjNet *) dynobj)->torque.x = src->x; + ((struct ObjNet *) dynobj)->torque.y = src->y; + ((struct ObjNet *) dynobj)->torque.z = src->z; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetTorque()", @@ -1595,14 +1597,14 @@ void d_get_init_pos(struct GdVec3f *dst) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - dst->x = ((struct ObjJoint *) dynobj)->unk54.x; - dst->y = ((struct ObjJoint *) dynobj)->unk54.y; - dst->z = ((struct ObjJoint *) dynobj)->unk54.z; + dst->x = ((struct ObjJoint *) dynobj)->initPos.x; + dst->y = ((struct ObjJoint *) dynobj)->initPos.y; + dst->z = ((struct ObjJoint *) dynobj)->initPos.z; break; case OBJ_TYPE_NETS: - dst->x = ((struct ObjNet *) dynobj)->unk20.x; - dst->y = ((struct ObjNet *) dynobj)->unk20.y; - dst->z = ((struct ObjNet *) dynobj)->unk20.z; + dst->x = ((struct ObjNet *) dynobj)->initPos.x; + dst->y = ((struct ObjNet *) dynobj)->initPos.y; + dst->z = ((struct ObjNet *) dynobj)->initPos.z; break; case OBJ_TYPE_VERTICES: dst->x = ((struct ObjVertex *) dynobj)->initPos.x; @@ -1675,19 +1677,19 @@ void d_set_rel_pos(f32 x, f32 y, f32 z) { ((struct ObjCamera *) dynobj)->unk40.y = y; ((struct ObjCamera *) dynobj)->unk40.z = z; - ((struct ObjCamera *) dynobj)->positions[0].x = x; - ((struct ObjCamera *) dynobj)->positions[0].y = y; - ((struct ObjCamera *) dynobj)->positions[0].z = z; + ((struct ObjCamera *) dynobj)->zoomPositions[0].x = x; + ((struct ObjCamera *) dynobj)->zoomPositions[0].y = y; + ((struct ObjCamera *) dynobj)->zoomPositions[0].z = z; - ((struct ObjCamera *) dynobj)->positions[1].x = x * 1.5; //? 1.5f - ((struct ObjCamera *) dynobj)->positions[1].y = y * 1.5; //? 1.5f - ((struct ObjCamera *) dynobj)->positions[1].z = z * 1.5; //? 1.5f + ((struct ObjCamera *) dynobj)->zoomPositions[1].x = x * 1.5; //? 1.5f + ((struct ObjCamera *) dynobj)->zoomPositions[1].y = y * 1.5; //? 1.5f + ((struct ObjCamera *) dynobj)->zoomPositions[1].z = z * 1.5; //? 1.5f - ((struct ObjCamera *) dynobj)->positions[2].x = x * 2.0f; - ((struct ObjCamera *) dynobj)->positions[2].y = y * 2.0f; - ((struct ObjCamera *) dynobj)->positions[2].z = z * 2.0f; + ((struct ObjCamera *) dynobj)->zoomPositions[2].x = x * 2.0f; + ((struct ObjCamera *) dynobj)->zoomPositions[2].y = y * 2.0f; + ((struct ObjCamera *) dynobj)->zoomPositions[2].z = z * 2.0f; - ((struct ObjCamera *) dynobj)->zoomLevels = 2; + ((struct ObjCamera *) dynobj)->maxZoomLevel = 2; break; case OBJ_TYPE_VERTICES: ((struct ObjVertex *) dynobj)->pos.x = x; @@ -1695,14 +1697,14 @@ void d_set_rel_pos(f32 x, f32 y, f32 z) { ((struct ObjVertex *) dynobj)->pos.z = z; break; case OBJ_TYPE_LABELS: - ((struct ObjLabel *) dynobj)->vec14.x = x; - ((struct ObjLabel *) dynobj)->vec14.y = y; - ((struct ObjLabel *) dynobj)->vec14.z = z; + ((struct ObjLabel *) dynobj)->position.x = x; + ((struct ObjLabel *) dynobj)->position.y = y; + ((struct ObjLabel *) dynobj)->position.z = z; break; case OBJ_TYPE_PARTICLES: - ((struct ObjParticle *) dynobj)->unk20.x = x; - ((struct ObjParticle *) dynobj)->unk20.y = y; - ((struct ObjParticle *) dynobj)->unk20.z = z; + ((struct ObjParticle *) dynobj)->pos.x = x; + ((struct ObjParticle *) dynobj)->pos.y = y; + ((struct ObjParticle *) dynobj)->pos.z = z; break; case OBJ_TYPE_NETS: break; @@ -1734,9 +1736,9 @@ void d_addto_rel_pos(struct GdVec3f *src) { ((struct ObjJoint *) dynobj)->unk3C.z += src->z; break; case OBJ_TYPE_PARTICLES: - ((struct ObjParticle *) dynobj)->unk20.x += src->x; - ((struct ObjParticle *) dynobj)->unk20.y += src->y; - ((struct ObjParticle *) dynobj)->unk20.z += src->z; + ((struct ObjParticle *) dynobj)->pos.x += src->x; + ((struct ObjParticle *) dynobj)->pos.y += src->y; + ((struct ObjParticle *) dynobj)->pos.z += src->z; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dAddToRelPos()", @@ -1769,9 +1771,9 @@ void d_get_rel_pos(struct GdVec3f *dst) { dst->z = ((struct ObjCamera *) sDynListCurObj)->unk40.z; break; case OBJ_TYPE_PARTICLES: - dst->x = ((struct ObjParticle *) sDynListCurObj)->unk20.x; - dst->y = ((struct ObjParticle *) sDynListCurObj)->unk20.y; - dst->z = ((struct ObjParticle *) sDynListCurObj)->unk20.z; + dst->x = ((struct ObjParticle *) sDynListCurObj)->pos.x; + dst->y = ((struct ObjParticle *) sDynListCurObj)->pos.y; + dst->z = ((struct ObjParticle *) sDynListCurObj)->pos.z; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dGetRelPos()", @@ -1790,10 +1792,10 @@ struct ObjGroup *d_get_att_objgroup(void) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - return ((struct ObjJoint *) sDynListCurObj)->unk1F8; + return ((struct ObjJoint *) sDynListCurObj)->attachedObjsGrp; break; // lol case OBJ_TYPE_NETS: - return ((struct ObjNet *) sDynListCurObj)->unk1D4; + return ((struct ObjNet *) sDynListCurObj)->attachedObjsGrp; break; // lol default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dGetAttObjGroup()", @@ -1803,7 +1805,7 @@ struct ObjGroup *d_get_att_objgroup(void) { } /** - * Return a pointer to the attached object of the current dynamic object. + * Return a pointer to the object that the current dynamic object is attached to. */ struct GdObj *d_get_att_to_obj(void) { if (sDynListCurObj == NULL) { @@ -1812,10 +1814,10 @@ struct GdObj *d_get_att_to_obj(void) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - return ((struct ObjJoint *) sDynListCurObj)->unk20C; + return ((struct ObjJoint *) sDynListCurObj)->attachedToObj; break; // lol case OBJ_TYPE_NETS: - return ((struct ObjNet *) sDynListCurObj)->unk1E8; + return ((struct ObjNet *) sDynListCurObj)->attachedToObj; break; // lol default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dGetAttToObj()", @@ -1837,14 +1839,14 @@ void d_get_scale(struct GdVec3f *dst) { dynobj = sDynListCurObj; switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - dst->x = ((struct ObjJoint *) dynobj)->unk9C.x; - dst->y = ((struct ObjJoint *) dynobj)->unk9C.y; - dst->z = ((struct ObjJoint *) dynobj)->unk9C.z; + dst->x = ((struct ObjJoint *) dynobj)->scale.x; + dst->y = ((struct ObjJoint *) dynobj)->scale.y; + dst->z = ((struct ObjJoint *) dynobj)->scale.z; break; case OBJ_TYPE_NETS: - dst->x = ((struct ObjNet *) dynobj)->unk1AC.x; - dst->y = ((struct ObjNet *) dynobj)->unk1AC.y; - dst->z = ((struct ObjNet *) dynobj)->unk1AC.z; + dst->x = ((struct ObjNet *) dynobj)->scale.x; + dst->y = ((struct ObjNet *) dynobj)->scale.y; + dst->z = ((struct ObjNet *) dynobj)->scale.z; break; case OBJ_TYPE_LIGHTS: dst->x = 1.0f; @@ -1870,22 +1872,22 @@ void d_set_att_offset(const struct GdVec3f *off) { dynobj = sDynListCurObj; switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) dynobj)->unk200.x = off->x; - ((struct ObjJoint *) dynobj)->unk200.y = off->y; - ((struct ObjJoint *) dynobj)->unk200.z = off->z; + ((struct ObjJoint *) dynobj)->attachOffset.x = off->x; + ((struct ObjJoint *) dynobj)->attachOffset.y = off->y; + ((struct ObjJoint *) dynobj)->attachOffset.z = off->z; - ((struct ObjJoint *) dynobj)->unk54.x = off->x; - ((struct ObjJoint *) dynobj)->unk54.y = off->y; - ((struct ObjJoint *) dynobj)->unk54.z = off->z; + ((struct ObjJoint *) dynobj)->initPos.x = off->x; + ((struct ObjJoint *) dynobj)->initPos.y = off->y; + ((struct ObjJoint *) dynobj)->initPos.z = off->z; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) dynobj)->unk1D8.x = off->x; - ((struct ObjNet *) dynobj)->unk1D8.y = off->y; - ((struct ObjNet *) dynobj)->unk1D8.z = off->z; + ((struct ObjNet *) dynobj)->attachOffset.x = off->x; + ((struct ObjNet *) dynobj)->attachOffset.y = off->y; + ((struct ObjNet *) dynobj)->attachOffset.z = off->z; - ((struct ObjNet *) dynobj)->unk20.x = off->x; - ((struct ObjNet *) dynobj)->unk20.y = off->y; - ((struct ObjNet *) dynobj)->unk20.z = off->z; + ((struct ObjNet *) dynobj)->initPos.x = off->x; + ((struct ObjNet *) dynobj)->initPos.y = off->y; + ((struct ObjNet *) dynobj)->initPos.z = off->z; break; case OBJ_TYPE_PARTICLES: break; @@ -1912,16 +1914,16 @@ void d_set_att_to_offset(UNUSED u32 a) { } dynobj = sDynListCurObj; - push_dynobj_stash(); + d_stash_dynobj(); switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - set_cur_dynobj(((struct ObjJoint *) dynobj)->unk20C); + set_cur_dynobj(((struct ObjJoint *) dynobj)->attachedToObj); break; case OBJ_TYPE_NETS: - set_cur_dynobj(((struct ObjNet *) dynobj)->unk1E8); + set_cur_dynobj(((struct ObjNet *) dynobj)->attachedToObj); break; case OBJ_TYPE_PARTICLES: - set_cur_dynobj(((struct ObjParticle *) dynobj)->unkBC); + set_cur_dynobj(((struct ObjParticle *) dynobj)->attachedToObj); break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetAttToOffset()", @@ -1933,7 +1935,7 @@ void d_set_att_to_offset(UNUSED u32 a) { sStashedDynObjInfo->name); } d_set_att_to_offset(a); - pop_dynobj_stash(); + d_unstash_dynobj(); } /** @@ -1948,14 +1950,14 @@ void d_get_att_offset(struct GdVec3f *dst) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - dst->x = ((struct ObjJoint *) sDynListCurObj)->unk200.x; - dst->y = ((struct ObjJoint *) sDynListCurObj)->unk200.y; - dst->z = ((struct ObjJoint *) sDynListCurObj)->unk200.z; + dst->x = ((struct ObjJoint *) sDynListCurObj)->attachOffset.x; + dst->y = ((struct ObjJoint *) sDynListCurObj)->attachOffset.y; + dst->z = ((struct ObjJoint *) sDynListCurObj)->attachOffset.z; break; case OBJ_TYPE_NETS: - dst->x = ((struct ObjNet *) sDynListCurObj)->unk1D8.x; - dst->y = ((struct ObjNet *) sDynListCurObj)->unk1D8.y; - dst->z = ((struct ObjNet *) sDynListCurObj)->unk1D8.z; + dst->x = ((struct ObjNet *) sDynListCurObj)->attachOffset.x; + dst->y = ((struct ObjNet *) sDynListCurObj)->attachOffset.y; + dst->z = ((struct ObjNet *) sDynListCurObj)->attachOffset.z; break; case OBJ_TYPE_PARTICLES: break; @@ -1977,13 +1979,13 @@ s32 d_get_att_flags(void) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - attflag = ((struct ObjJoint *) sDynListCurObj)->unk1FC; + attflag = ((struct ObjJoint *) sDynListCurObj)->attachFlags; break; case OBJ_TYPE_NETS: - attflag = ((struct ObjNet *) sDynListCurObj)->unk1E4; + attflag = ((struct ObjNet *) sDynListCurObj)->attachFlags; break; case OBJ_TYPE_PARTICLES: - attflag = ((struct ObjParticle *) sDynListCurObj)->unkB8; + attflag = ((struct ObjParticle *) sDynListCurObj)->attachFlags; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dGetAttFlags()", @@ -2005,24 +2007,24 @@ void d_set_world_pos(f32 x, f32 y, f32 z) { switch (sDynListCurObj->type) { case OBJ_TYPE_CAMERAS: - ((struct ObjCamera *) sDynListCurObj)->unk14.x = x; - ((struct ObjCamera *) sDynListCurObj)->unk14.y = y; - ((struct ObjCamera *) sDynListCurObj)->unk14.z = z; + ((struct ObjCamera *) sDynListCurObj)->worldPos.x = x; + ((struct ObjCamera *) sDynListCurObj)->worldPos.y = y; + ((struct ObjCamera *) sDynListCurObj)->worldPos.z = z; break; case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) sDynListCurObj)->unk14.x = x; - ((struct ObjJoint *) sDynListCurObj)->unk14.y = y; - ((struct ObjJoint *) sDynListCurObj)->unk14.z = z; + ((struct ObjJoint *) sDynListCurObj)->worldPos.x = x; + ((struct ObjJoint *) sDynListCurObj)->worldPos.y = y; + ((struct ObjJoint *) sDynListCurObj)->worldPos.z = z; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) sDynListCurObj)->unk14.x = x; - ((struct ObjNet *) sDynListCurObj)->unk14.y = y; - ((struct ObjNet *) sDynListCurObj)->unk14.z = z; + ((struct ObjNet *) sDynListCurObj)->worldPos.x = x; + ((struct ObjNet *) sDynListCurObj)->worldPos.y = y; + ((struct ObjNet *) sDynListCurObj)->worldPos.z = z; break; case OBJ_TYPE_GADGETS: - ((struct ObjGadget *) sDynListCurObj)->unk14.x = x; - ((struct ObjGadget *) sDynListCurObj)->unk14.y = y; - ((struct ObjGadget *) sDynListCurObj)->unk14.z = z; + ((struct ObjGadget *) sDynListCurObj)->worldPos.x = x; + ((struct ObjGadget *) sDynListCurObj)->worldPos.y = y; + ((struct ObjGadget *) sDynListCurObj)->worldPos.z = z; break; case OBJ_TYPE_VIEWS: ((struct ObjView *) sDynListCurObj)->upperLeft.x = x; @@ -2084,7 +2086,7 @@ struct GdVec3f *d_get_world_pos_ptr(void) { return &((struct ObjVertex *) sDynListCurObj)->pos; break; case OBJ_TYPE_PARTICLES: - return &((struct ObjParticle *) sDynListCurObj)->unk20; + return &((struct ObjParticle *) sDynListCurObj)->pos; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dGetWorldPosPtr()", @@ -2108,29 +2110,29 @@ void d_get_world_pos(struct GdVec3f *dst) { dst->z = ((struct ObjVertex *) sDynListCurObj)->pos.z; break; case OBJ_TYPE_JOINTS: - dst->x = ((struct ObjJoint *) sDynListCurObj)->unk14.x; - dst->y = ((struct ObjJoint *) sDynListCurObj)->unk14.y; - dst->z = ((struct ObjJoint *) sDynListCurObj)->unk14.z; + dst->x = ((struct ObjJoint *) sDynListCurObj)->worldPos.x; + dst->y = ((struct ObjJoint *) sDynListCurObj)->worldPos.y; + dst->z = ((struct ObjJoint *) sDynListCurObj)->worldPos.z; break; case OBJ_TYPE_NETS: - dst->x = ((struct ObjNet *) sDynListCurObj)->unk14.x; - dst->y = ((struct ObjNet *) sDynListCurObj)->unk14.y; - dst->z = ((struct ObjNet *) sDynListCurObj)->unk14.z; + dst->x = ((struct ObjNet *) sDynListCurObj)->worldPos.x; + dst->y = ((struct ObjNet *) sDynListCurObj)->worldPos.y; + dst->z = ((struct ObjNet *) sDynListCurObj)->worldPos.z; break; case OBJ_TYPE_PARTICLES: - dst->x = ((struct ObjParticle *) sDynListCurObj)->unk20.x; - dst->y = ((struct ObjParticle *) sDynListCurObj)->unk20.y; - dst->z = ((struct ObjParticle *) sDynListCurObj)->unk20.z; + dst->x = ((struct ObjParticle *) sDynListCurObj)->pos.x; + dst->y = ((struct ObjParticle *) sDynListCurObj)->pos.y; + dst->z = ((struct ObjParticle *) sDynListCurObj)->pos.z; break; case OBJ_TYPE_CAMERAS: - dst->x = ((struct ObjCamera *) sDynListCurObj)->unk14.x; - dst->y = ((struct ObjCamera *) sDynListCurObj)->unk14.y; - dst->z = ((struct ObjCamera *) sDynListCurObj)->unk14.z; + dst->x = ((struct ObjCamera *) sDynListCurObj)->worldPos.x; + dst->y = ((struct ObjCamera *) sDynListCurObj)->worldPos.y; + dst->z = ((struct ObjCamera *) sDynListCurObj)->worldPos.z; break; case OBJ_TYPE_BONES: - dst->x = ((struct ObjBone *) sDynListCurObj)->unk14.x; - dst->y = ((struct ObjBone *) sDynListCurObj)->unk14.y; - dst->z = ((struct ObjBone *) sDynListCurObj)->unk14.z; + dst->x = ((struct ObjBone *) sDynListCurObj)->worldPos.x; + dst->y = ((struct ObjBone *) sDynListCurObj)->worldPos.y; + dst->z = ((struct ObjBone *) sDynListCurObj)->worldPos.z; break; case OBJ_TYPE_SHAPES: dst->x = dst->y = dst->z = 0.0f; @@ -2139,31 +2141,31 @@ void d_get_world_pos(struct GdVec3f *dst) { dst->x = dst->y = dst->z = 0.0f; break; case OBJ_TYPE_GADGETS: - dst->x = ((struct ObjGadget *) sDynListCurObj)->unk14.x; - dst->y = ((struct ObjGadget *) sDynListCurObj)->unk14.y; - dst->z = ((struct ObjGadget *) sDynListCurObj)->unk14.z; + dst->x = ((struct ObjGadget *) sDynListCurObj)->worldPos.x; + dst->y = ((struct ObjGadget *) sDynListCurObj)->worldPos.y; + dst->z = ((struct ObjGadget *) sDynListCurObj)->worldPos.z; break; case OBJ_TYPE_PLANES: - dst->x = ((struct ObjPlane *) sDynListCurObj)->plane28.p0.x; - dst->y = ((struct ObjPlane *) sDynListCurObj)->plane28.p0.y; - dst->z = ((struct ObjPlane *) sDynListCurObj)->plane28.p0.z; + dst->x = ((struct ObjPlane *) sDynListCurObj)->boundingBox.minX; + dst->y = ((struct ObjPlane *) sDynListCurObj)->boundingBox.minY; + dst->z = ((struct ObjPlane *) sDynListCurObj)->boundingBox.minZ; - dst->x += ((struct ObjPlane *) sDynListCurObj)->plane28.p1.x; - dst->y += ((struct ObjPlane *) sDynListCurObj)->plane28.p1.y; - dst->z += ((struct ObjPlane *) sDynListCurObj)->plane28.p1.z; + dst->x += ((struct ObjPlane *) sDynListCurObj)->boundingBox.maxX; + dst->y += ((struct ObjPlane *) sDynListCurObj)->boundingBox.maxY; + dst->z += ((struct ObjPlane *) sDynListCurObj)->boundingBox.maxZ; dst->x *= 0.5; //? 0.5f dst->y *= 0.5; //? 0.5f dst->z *= 0.5; //? 0.5f break; case OBJ_TYPE_ZONES: - dst->x = ((struct ObjZone *) sDynListCurObj)->unk14.p0.x; - dst->y = ((struct ObjZone *) sDynListCurObj)->unk14.p0.y; - dst->z = ((struct ObjZone *) sDynListCurObj)->unk14.p0.z; + dst->x = ((struct ObjZone *) sDynListCurObj)->boundingBox.minX; + dst->y = ((struct ObjZone *) sDynListCurObj)->boundingBox.minY; + dst->z = ((struct ObjZone *) sDynListCurObj)->boundingBox.minZ; - dst->x += ((struct ObjZone *) sDynListCurObj)->unk14.p1.x; - dst->y += ((struct ObjZone *) sDynListCurObj)->unk14.p1.y; - dst->z += ((struct ObjZone *) sDynListCurObj)->unk14.p1.z; + dst->x += ((struct ObjZone *) sDynListCurObj)->boundingBox.maxX; + dst->y += ((struct ObjZone *) sDynListCurObj)->boundingBox.maxY; + dst->z += ((struct ObjZone *) sDynListCurObj)->boundingBox.maxZ; dst->x *= 0.5; //? 0.5f dst->y *= 0.5; //? 0.5f @@ -2186,7 +2188,7 @@ void d_get_world_pos(struct GdVec3f *dst) { * @param[in] pos values are copied to set vertex position */ void d_make_vertex(struct GdVec3f *pos) { - d_makeobj(D_VERTEX, AsDynId(NULL)); + d_makeobj(D_VERTEX, AsDynName(NULL)); d_set_init_pos(pos->x, pos->y, pos->z); } @@ -2196,24 +2198,24 @@ void d_make_vertex(struct GdVec3f *pos) { * @note Sets the lower right coordinates of an `ObjView` */ void d_set_scale(f32 x, f32 y, f32 z) { - struct GdObj *initDynobj; // sp24; + struct GdObj *initDynobj; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } initDynobj = sDynListCurObj; - push_dynobj_stash(); + d_stash_dynobj(); switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) initDynobj)->unk9C.x = x; - ((struct ObjJoint *) initDynobj)->unk9C.y = y; - ((struct ObjJoint *) initDynobj)->unk9C.z = z; + ((struct ObjJoint *) initDynobj)->scale.x = x; + ((struct ObjJoint *) initDynobj)->scale.y = y; + ((struct ObjJoint *) initDynobj)->scale.z = z; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) initDynobj)->unk1AC.x = x; - ((struct ObjNet *) initDynobj)->unk1AC.y = y; - ((struct ObjNet *) initDynobj)->unk1AC.z = z; + ((struct ObjNet *) initDynobj)->scale.x = x; + ((struct ObjNet *) initDynobj)->scale.y = y; + ((struct ObjNet *) initDynobj)->scale.z = z; break; case OBJ_TYPE_VIEWS: ((struct ObjView *) initDynobj)->lowerRight.x = x; @@ -2223,12 +2225,12 @@ void d_set_scale(f32 x, f32 y, f32 z) { case OBJ_TYPE_PARTICLES: break; case OBJ_TYPE_GADGETS: - if (((struct ObjGadget *) initDynobj)->unk50 != NULL) { - scale_verts_in_shape(((struct ObjGadget *) initDynobj)->unk50, x, y, z); + if (((struct ObjGadget *) initDynobj)->shapePtr != NULL) { + scale_verts_in_shape(((struct ObjGadget *) initDynobj)->shapePtr, x, y, z); } - ((struct ObjGadget *) initDynobj)->unk40.x = x; - ((struct ObjGadget *) initDynobj)->unk40.y = y; - ((struct ObjGadget *) initDynobj)->unk40.z = z; + ((struct ObjGadget *) initDynobj)->size.x = x; + ((struct ObjGadget *) initDynobj)->size.y = y; + ((struct ObjGadget *) initDynobj)->size.z = z; break; case OBJ_TYPE_LIGHTS: break; @@ -2236,7 +2238,7 @@ void d_set_scale(f32 x, f32 y, f32 z) { fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetScale()", sDynListCurInfo->name, sDynListCurObj->type); } - pop_dynobj_stash(); + d_unstash_dynobj(); } /** @@ -2278,9 +2280,9 @@ void d_center_of_gravity(f32 x, f32 y, f32 z) { switch (sDynListCurObj->type) { case OBJ_TYPE_NETS: - ((struct ObjNet *) sDynListCurObj)->unkB0.x = x; - ((struct ObjNet *) sDynListCurObj)->unkB0.y = y; - ((struct ObjNet *) sDynListCurObj)->unkB0.z = z; + ((struct ObjNet *) sDynListCurObj)->centerOfGravity.x = x; + ((struct ObjNet *) sDynListCurObj)->centerOfGravity.y = y; + ((struct ObjNet *) sDynListCurObj)->centerOfGravity.z = z; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dCofG()", @@ -2298,9 +2300,9 @@ void d_set_shape_offset(f32 x, f32 y, f32 z) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) sDynListCurObj)->unkC0.x = x; - ((struct ObjJoint *) sDynListCurObj)->unkC0.y = y; - ((struct ObjJoint *) sDynListCurObj)->unkC0.z = z; + ((struct ObjJoint *) sDynListCurObj)->shapeOffset.x = x; + ((struct ObjJoint *) sDynListCurObj)->shapeOffset.y = y; + ((struct ObjJoint *) sDynListCurObj)->shapeOffset.z = z; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dShapeOffset()", @@ -2309,15 +2311,15 @@ void d_set_shape_offset(f32 x, f32 y, f32 z) { } /** - * Create a new `ObjValPtr` to dynamic object `objId` and attach - * that valptr to the current dynamic object. - * - * @param type `::ValPtrType` + * Creates a new `ObjValPtr`. + * If `vflags` is 0x40000, then `name` is the name of an object, and `offset` + * is an offset to a field in that object. Otherwise, `offset` specifies a + * the address of a standalone variable. */ -void d_add_valptr(DynId objId, u32 vflags, s32 type, size_t offset) { - struct GdObj *dynobj; // sp2C - struct ObjValPtrs *valptr; // sp28 - struct DynObjInfo *info; // sp24 +void d_add_valptr(DynObjName name, u32 vflags, enum ValPtrType type, size_t offset) { + struct GdObj *dynobj; + struct ObjValPtr *valptr; + struct DynObjInfo *info; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); @@ -2326,22 +2328,24 @@ void d_add_valptr(DynId objId, u32 vflags, s32 type, size_t offset) { dynobj = sDynListCurObj; if (vflags == 0x40000) { - info = get_dynobj_info(objId); + // value is an object field, and objId is the name of the object + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dAddValPtr(\"%s\"): Undefined object", DynIdAsStr(objId)); + fatal_printf("dAddValPtr(\"%s\"): Undefined object", DynNameAsStr(name)); } - valptr = make_valptrs(info->obj, vflags, type, offset); + valptr = make_valptr(info->obj, vflags, type, offset); } else { - valptr = make_valptrs(objId, vflags, type, offset); + // value is a standalone variable + valptr = make_valptr(name, vflags, type, offset); } switch (sDynListCurObj->type) { case OBJ_TYPE_GADGETS: - if (((struct ObjGadget *) dynobj)->unk4C == NULL) { - ((struct ObjGadget *) dynobj)->unk4C = make_group(0); + if (((struct ObjGadget *) dynobj)->valueGrp == NULL) { + ((struct ObjGadget *) dynobj)->valueGrp = make_group(0); } - addto_group(((struct ObjGadget *) dynobj)->unk4C, &valptr->header); + addto_group(((struct ObjGadget *) dynobj)->valueGrp, &valptr->header); break; case OBJ_TYPE_LABELS: ((struct ObjLabel *) dynobj)->valptr = valptr; @@ -2357,7 +2361,7 @@ void d_add_valptr(DynId objId, u32 vflags, s32 type, size_t offset) { * dynamic `ObjLabel`. */ void d_add_valproc(valptrproc_t proc) { - struct GdObj *dynobj; // sp1C + struct GdObj *dynobj; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); @@ -2381,22 +2385,22 @@ void d_add_valproc(valptrproc_t proc) { */ void d_link_with_ptr(void *ptr) { struct GdObj *dynobj; // sp34 - struct ObjValPtrs *valptr; // sp30 - struct Links *link; // sp2C + struct ObjValPtr *valptr; // sp30 + struct ListNode *link; // sp2C if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } dynobj = sDynListCurObj; - add_to_stacktrace("dLinkWithPtr"); + imin("dLinkWithPtr"); switch (sDynListCurObj->type) { case OBJ_TYPE_CAMERAS: ((struct ObjCamera *) dynobj)->unk30 = ptr; break; case OBJ_TYPE_GROUPS: link = make_link_to_obj(NULL, ptr); - ((struct ObjGroup *) dynobj)->link1C = link; + ((struct ObjGroup *) dynobj)->firstMember = link; break; case OBJ_TYPE_BONES: add_joint2bone((struct ObjBone *) dynobj, ptr); @@ -2425,14 +2429,14 @@ void d_link_with_ptr(void *ptr) { break; case OBJ_TYPE_ANIMATORS: - if (((struct ObjAnimator *) dynobj)->unk14 == NULL) { - ((struct ObjAnimator *) dynobj)->unk14 = make_group(0); + if (((struct ObjAnimator *) dynobj)->animatedPartsGrp == NULL) { + ((struct ObjAnimator *) dynobj)->animatedPartsGrp = make_group(0); } - addto_group(((struct ObjAnimator *) dynobj)->unk14, ptr); + addto_group(((struct ObjAnimator *) dynobj)->animatedPartsGrp, ptr); break; case OBJ_TYPE_LABELS: - valptr = make_valptrs(ptr, OBJ_TYPE_ALL, 0, 0); + valptr = make_valptr(ptr, OBJ_TYPE_ALL, 0, 0); ((struct ObjLabel *) dynobj)->valptr = valptr; break; default: @@ -2443,10 +2447,10 @@ void d_link_with_ptr(void *ptr) { } /** - * Link the dynamic object `id` to the current dynamic object by wrapping + * Link the dynamic object `name` to the current dynamic object by wrapping * `d_link_with_ptr()`. */ -void d_link_with(DynId id) { +void d_link_with(DynObjName name) { struct DynObjInfo *info; // sp1C struct DynObjInfo *origInfo = sDynListCurInfo; // sp18 @@ -2454,13 +2458,13 @@ void d_link_with(DynId id) { fatal_printf("proc_dynlist(): No current object"); } - if (id == NULL) { + if (name == NULL) { return; } - info = get_dynobj_info(id); + info = get_dynobj_info(name); if (info == NULL) { - fatal_printf("dLinkWith(\"%s\"): Undefined object", DynIdAsStr(id)); + fatal_printf("dLinkWith(\"%s\"): Undefined object", DynNameAsStr(name)); } d_link_with_ptr(info->obj); @@ -2481,16 +2485,16 @@ void d_set_flags(s32 flags) { dynobj = sDynListCurObj; switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) dynobj)->unk1BC |= flags; + ((struct ObjJoint *) dynobj)->flags |= flags; break; case OBJ_TYPE_BONES: ((struct ObjBone *) dynobj)->unk104 |= flags; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) dynobj)->unk34 |= flags; + ((struct ObjNet *) dynobj)->flags |= flags; break; case OBJ_TYPE_CAMERAS: - ((struct ObjCamera *) dynobj)->unk2C |= flags; + ((struct ObjCamera *) dynobj)->flags |= flags; break; case OBJ_TYPE_VIEWS: ((struct ObjView *) dynobj)->flags |= flags; @@ -2499,7 +2503,7 @@ void d_set_flags(s32 flags) { ((struct ObjShape *) dynobj)->flag |= flags; break; case OBJ_TYPE_PARTICLES: - ((struct ObjParticle *) dynobj)->unk54 |= flags; + ((struct ObjParticle *) dynobj)->flags |= flags; break; case OBJ_TYPE_LIGHTS: ((struct ObjLight *) dynobj)->flags |= flags; @@ -2520,19 +2524,19 @@ void d_clear_flags(s32 flags) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) sDynListCurObj)->unk1BC &= ~flags; + ((struct ObjJoint *) sDynListCurObj)->flags &= ~flags; break; case OBJ_TYPE_BONES: ((struct ObjBone *) sDynListCurObj)->unk104 &= ~flags; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) sDynListCurObj)->unk34 &= ~flags; + ((struct ObjNet *) sDynListCurObj)->flags &= ~flags; break; case OBJ_TYPE_CAMERAS: - ((struct ObjCamera *) sDynListCurObj)->unk2C &= ~flags; + ((struct ObjCamera *) sDynListCurObj)->flags &= ~flags; break; case OBJ_TYPE_PARTICLES: - ((struct ObjParticle *) sDynListCurObj)->unk54 &= ~flags; + ((struct ObjParticle *) sDynListCurObj)->flags &= ~flags; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dClrFlags()", @@ -2554,7 +2558,7 @@ void d_set_parm_f(enum DParmF param, f32 val) { case OBJ_TYPE_SHAPES: switch (param) { case PARM_F_ALPHA: - ((struct ObjShape *) sDynListCurObj)->unk58 = val; + ((struct ObjShape *) sDynListCurObj)->alpha = val; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", @@ -2564,11 +2568,11 @@ void d_set_parm_f(enum DParmF param, f32 val) { break; case OBJ_TYPE_GADGETS: switch (param) { - case PARM_F_RANGE_LEFT: - ((struct ObjGadget *) sDynListCurObj)->unk38 = val; + case PARM_F_RANGE_MIN: + ((struct ObjGadget *) sDynListCurObj)->rangeMin = val; break; - case PARM_F_RANGE_RIGHT: - ((struct ObjGadget *) sDynListCurObj)->unk3C = val; + case PARM_F_RANGE_MAX: + ((struct ObjGadget *) sDynListCurObj)->rangeMax = val; break; case PARM_F_VARVAL: ((struct ObjGadget *) sDynListCurObj)->varval.f = val; @@ -2628,11 +2632,13 @@ void d_set_parm_ptr(enum DParmPtr param, void *ptr) { case OBJ_TYPE_FACES: switch (param) { case PARM_PTR_OBJ_VTX: - if (((struct ObjFace *) sDynListCurObj)->vtxCount > 3) { + // Don't allow more than 4 vertices in a face + if (((struct ObjFace *) sDynListCurObj)->vtxCount >= 4) { fatal_printf("dsetparmp() too many points"); } - ((struct ObjFace *) sDynListCurObj) - ->vertices[((struct ObjFace *) sDynListCurObj)->vtxCount++] = ptr; + // `ptr` here is a vertex index, not an actual pointer. + // These vertex indices later get converted to `ObjVertex` pointers when `find_thisface_verts` is called. + ((struct ObjFace *) sDynListCurObj)->vertices[((struct ObjFace *) sDynListCurObj)->vtxCount++] = ptr; break; default: fatal_printf("Bad parm"); @@ -2670,13 +2676,13 @@ void d_set_type(s32 type) { ((struct ObjNet *) dynobj)->netType = type; break; case OBJ_TYPE_GADGETS: - ((struct ObjGadget *) dynobj)->unk24 = type; + ((struct ObjGadget *) dynobj)->type = type; break; case OBJ_TYPE_GROUPS: ((struct ObjGroup *) dynobj)->debugPrint = type; break; case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) dynobj)->unk1CC = type; + ((struct ObjJoint *) dynobj)->type = type; break; case OBJ_TYPE_PARTICLES: ((struct ObjParticle *) dynobj)->unk60 = type; @@ -2725,7 +2731,7 @@ void d_set_id(s32 id) { * for `gd_get_colour()` */ void d_set_colour_num(s32 colornum) { - struct GdColour *rgbcolor; // sp24 + struct GdColour *rgbcolor; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); @@ -2733,16 +2739,16 @@ void d_set_colour_num(s32 colornum) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) sDynListCurObj)->unk1C8 = colornum; + ((struct ObjJoint *) sDynListCurObj)->colourNum = colornum; break; case OBJ_TYPE_PARTICLES: - ((struct ObjParticle *) sDynListCurObj)->unk58 = colornum; + ((struct ObjParticle *) sDynListCurObj)->colourNum = colornum; break; case OBJ_TYPE_NETS: - ((struct ObjNet *) sDynListCurObj)->unk40 = colornum; + ((struct ObjNet *) sDynListCurObj)->colourNum = colornum; break; case OBJ_TYPE_GADGETS: - ((struct ObjGadget *) sDynListCurObj)->unk5C = colornum; + ((struct ObjGadget *) sDynListCurObj)->colourNum = colornum; break; case OBJ_TYPE_FACES: rgbcolor = gd_get_colour(colornum); @@ -2750,7 +2756,7 @@ void d_set_colour_num(s32 colornum) { ((struct ObjFace *) sDynListCurObj)->colour.r = rgbcolor->r; ((struct ObjFace *) sDynListCurObj)->colour.g = rgbcolor->g; ((struct ObjFace *) sDynListCurObj)->colour.b = rgbcolor->b; - ((struct ObjFace *) sDynListCurObj)->colNum = colornum; + ((struct ObjFace *) sDynListCurObj)->colourNum = colornum; } else { fatal_printf("dSetColNum: Unkown colour number"); } @@ -2789,9 +2795,9 @@ void d_friction(f32 x, f32 y, f32 z) { switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) sDynListCurObj)->unkDC.x = x; - ((struct ObjJoint *) sDynListCurObj)->unkDC.y = y; - ((struct ObjJoint *) sDynListCurObj)->unkDC.z = z; + ((struct ObjJoint *) sDynListCurObj)->friction.x = x; + ((struct ObjJoint *) sDynListCurObj)->friction.y = y; + ((struct ObjJoint *) sDynListCurObj)->friction.z = z; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dFriction()", @@ -2809,7 +2815,7 @@ void d_set_spring(f32 spring) { switch (sDynListCurObj->type) { case OBJ_TYPE_BONES: - ((struct ObjBone *) sDynListCurObj)->unk110 = spring; + ((struct ObjBone *) sDynListCurObj)->spring = spring; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetSpring()", @@ -2872,7 +2878,7 @@ void d_set_control_type(s32 ctrltype) { switch (sDynListCurObj->type) { case OBJ_TYPE_NETS: - ((struct ObjNet *) sDynListCurObj)->unk210 = ctrltype; + ((struct ObjNet *) sDynListCurObj)->ctrlType = ctrltype; break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dControlType()", @@ -2881,27 +2887,27 @@ void d_set_control_type(s32 ctrltype) { } /** - * Get a pointer to a `GdPlaneF` in the current dynamic object. - * If the current object does not have a plane, a pointer to - * a global plane at (0,0) is returned. + * Get a pointer to a `GdBoundingBox` in the current dynamic object. + * If the current object does not have a bounding box, a pointer to + * a global bounding box at (0,0) is returned. */ -struct GdPlaneF *d_get_plane(void) { +struct GdBoundingBox *d_get_bounding_box(void) { if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } switch (sDynListCurObj->type) { case OBJ_TYPE_NETS: - return &((struct ObjNet *) sDynListCurObj)->unkBC; + return &((struct ObjNet *) sDynListCurObj)->boundingBox; break; case OBJ_TYPE_PLANES: - return &((struct ObjPlane *) sDynListCurObj)->plane28; + return &((struct ObjPlane *) sDynListCurObj)->boundingBox; break; case OBJ_TYPE_ZONES: - return &((struct ObjZone *) sDynListCurObj)->unk14; + return &((struct ObjZone *) sDynListCurObj)->boundingBox; break; default: - return &sGdNullPlaneF; + return &sNullBoundingBox; } } @@ -3009,10 +3015,11 @@ Mat4f *d_get_rot_mtx_ptr(void) { } /** - * Copy `src` into the identity matrix of the current dynamic object. + * Copy `src` into the matrix of the current dynamic object. + * TODO: What is an IMatrix? */ -void d_set_idn_mtx(Mat4f *src) { - struct GdObj *dynobj; // sp24 +void d_set_i_matrix(Mat4f *src) { + struct GdObj *dynobj; if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); @@ -3066,9 +3073,10 @@ Mat4f *d_get_matrix_ptr(void) { } /** - * Get a pointer to the current dynamic object's identity matrix. + * Get a pointer to the current dynamic object's matrix. + * TODO: What is an IMatrix? */ -Mat4f *d_get_idn_mtx_ptr(void) { +Mat4f *d_get_i_mtx_ptr(void) { struct GdObj *dynobj; // sp24 if (sDynListCurObj == NULL) { @@ -3112,18 +3120,18 @@ f32 d_calc_world_dist_btwn(struct GdObj *obj1, struct GdObj *obj2) { } /** - * Create a new weight for the current dynamic `ObjJoint`. The input weight value - * is out of 100. + * Create a new weight for the vertex `vtxId` in the current dynamic `ObjJoint`. + * The input weight value is out of 100. */ -void d_set_skin_weight(s32 id, f32 percentWeight) { +void d_set_skin_weight(s32 vtxId, f32 percentWeight) { if (sDynListCurObj == NULL) { fatal_printf("proc_dynlist(): No current object"); } switch (sDynListCurObj->type) { case OBJ_TYPE_JOINTS: - set_skin_weight((struct ObjJoint *) sDynListCurObj, id, NULL, - percentWeight / 100.0); //? 100.0f + set_skin_weight((struct ObjJoint *) sDynListCurObj, vtxId, NULL, + percentWeight / 100.0); break; default: fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetSkinWeight()", diff --git a/src/goddard/dynlist_proc.h b/src/goddard/dynlist_proc.h index 251fb261..f4641baf 100644 --- a/src/goddard/dynlist_proc.h +++ b/src/goddard/dynlist_proc.h @@ -6,30 +6,30 @@ #include "gd_types.h" // types -/// @name DynId Type +/// @name DynObjName Type /// @{ /// A new type for identification of `GdObj`s in the dynamic object list. -typedef void *DynId; -/// Macros for casting between types of ids, -/// as the id can be either a number or a string. +typedef void *DynObjName; +/// Macros for casting between types of names, +/// as the name can be either a number or a string. /// @{ -#define DynIdAsStr(id) ((char *)(id)) -#define DynIdAsInt(id) ((u32)(uintptr_t)(id)) -#define AsDynId(unk) ((DynId)(unk)) +#define DynNameAsStr(name) ((char *)(name)) +#define DynNameAsInt(name) ((u32)(uintptr_t)(name)) +#define AsDynName(unk) ((DynObjName)(unk)) /// @} /// @} /// parameters types for `d_set_parm_ptr()` enum DParmPtr { - PARM_PTR_OBJ_VTX = 1, ///< parameter is an `ObjVertex` to add to an `ObjFace` + PARM_PTR_OBJ_VTX = 1, ///< parameter is the index of a vertex to add to an `ObjFace` PARM_PTR_CHAR = 5 ///< parameter is a `char *` }; /// parameters for `d_set_parm_f()` enum DParmF { PARM_F_ALPHA = 1, ///< Set the alpha value for an `ObjShape` or `ObjVertex` - PARM_F_RANGE_LEFT = 2, ///< Set the left range for an `ObjGadget` - PARM_F_RANGE_RIGHT = 3, ///< Set the right range for an `ObjGadget` + PARM_F_RANGE_MIN = 2, ///< Set the left range for an `ObjGadget` + PARM_F_RANGE_MAX = 3, ///< Set the right range for an `ObjGadget` PARM_F_VARVAL = 6 ///< Set the float variable value union in an `ObjGadget` }; @@ -57,18 +57,18 @@ enum DObjTypes { }; // functions -void push_dynobj_stash(void); -void pop_dynobj_stash(void); +void d_stash_dynobj(void); +void d_unstash_dynobj(void); void reset_dynlist(void); struct GdObj *proc_dynlist(struct DynList *dylist); -void d_copystr_to_idbuf(char *str); -struct GdObj *d_makeobj(enum DObjTypes type, DynId id); +void d_set_name_suffix(char *str); +struct GdObj *d_makeobj(enum DObjTypes type, DynObjName name); void d_set_shapeptrptr(struct ObjShape **shpPtrptr); -struct GdObj *d_use_obj(DynId id); +struct GdObj *d_use_obj(DynObjName name); void set_cur_dynobj(struct GdObj *obj); -void d_start_group(DynId id); -void d_end_group(DynId id); -void dynid_is_int(s32 isIntBool); +void d_start_group(DynObjName name); +void d_end_group(DynObjName name); +void d_use_integer_names(s32 isIntBool); void d_set_init_pos(f32 x, f32 y, f32 z); void d_get_init_pos(struct GdVec3f *dst); void d_get_init_rot(struct GdVec3f *dst); @@ -79,7 +79,7 @@ void d_get_scale(struct GdVec3f *dst); void d_set_world_pos(f32 x, f32 y, f32 z); void d_get_world_pos(struct GdVec3f *dst); void d_set_scale(f32 x, f32 y, f32 z); -void d_add_valptr(DynId objId, u32 vflags, s32 type, size_t offset); +void d_add_valptr(DynObjName name, u32 vflags, enum ValPtrType type, size_t offset); void d_add_valproc(union ObjVarVal * (*)(union ObjVarVal *, union ObjVarVal)); void d_set_flags(s32 flags); void d_set_parm_f(enum DParmF param, f32 val); @@ -88,12 +88,12 @@ void d_set_obj_draw_flag(enum ObjDrawingFlags flag); void d_set_type(s32 type); void d_set_colour_num(s32 colornum); void d_set_diffuse(f32 r, f32 g, f32 b); -struct GdPlaneF* d_get_plane(void); +struct GdBoundingBox* d_get_bounding_box(void); void d_get_matrix(Mat4f *dst); Mat4f *d_get_rot_mtx_ptr(void); -void d_set_idn_mtx(Mat4f *src); +void d_set_i_matrix(Mat4f *src); Mat4f *d_get_matrix_ptr(void); -Mat4f *d_get_idn_mtx_ptr(void); +Mat4f *d_get_i_mtx_ptr(void); f32 d_calc_world_dist_btwn(struct GdObj *obj1, struct GdObj *obj2); #endif // GD_DYNLIST_PROCESSOR_H diff --git a/src/goddard/dynlists/anim_group_1.c b/src/goddard/dynlists/anim_group_1.c index ce05c210..bd2b61f8 100644 --- a/src/goddard/dynlists/anim_group_1.c +++ b/src/goddard/dynlists/anim_group_1.c @@ -1,10 +1,10 @@ #include +#include "macros.h" #include "animdata.h" #include "../gd_types.h" -/* @ 04012400 */ -s16 animdata_mario_eyebrows_equalizer_1[820][3] = { +static s16 animdata_mario_eyebrows_equalizer_1[][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, @@ -144,15 +144,13 @@ s16 animdata_mario_eyebrows_equalizer_1[820][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, }; -/* @ 04013738 */ -struct AnimDataInfo anim_mario_eyebrows_equalizer[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_eyebrows_equalizer_1 }, +struct AnimDataInfo anim_mario_eyebrows_equalizer[] = { + { ARRAY_COUNT(animdata_mario_eyebrows_equalizer_1), GD_ANIM_ROT3S, animdata_mario_eyebrows_equalizer_1 }, { 0, GD_ANIM_EMPTY, NULL }, END_ANIMDATA_INFO_ARR, }; -/* @ 0401375C */ -s16 animdata_mario_eyebrows_2_1[820][3] = { +static s16 animdata_mario_eyebrows_2_1[][3] = { { 28, 0, 1823 }, { 28, 0, 1823 }, { 28, 0, 1823 }, { 27, 0, 1822 }, { 26, 0, 1821 }, { 26, 0, 1819 }, { 25, 0, 1818 }, { 24, 0, 1816 }, { 23, 0, 1815 }, { 22, 0, 1814 }, { 21, 0, 1812 }, { 21, 0, 1811 }, { 20, 0, 1810 }, { 20, 0, 1810 }, { 20, 0, 1810 }, @@ -319,8 +317,7 @@ s16 animdata_mario_eyebrows_2_1[820][3] = { { -13, 1, 1821 }, { 3, 0, 1822 }, { 16, 0, 1823 }, { 25, 0, 1823 }, { 28, 0, 1823 }, }; -/* @ 04014A94 */ -s16 animdata_mario_eyebrows_2_2[166][3] = { +static s16 animdata_mario_eyebrows_2_2[][3] = { { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, { 28, -5, 1943 }, @@ -357,15 +354,13 @@ s16 animdata_mario_eyebrows_2_2[166][3] = { { 28, 0, 1823 }, }; -/* @ 04014E78 */ -struct AnimDataInfo anim_mario_eyebrows_2[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_eyebrows_2_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_eyebrows_2_2 }, +struct AnimDataInfo anim_mario_eyebrows_2[] = { + { ARRAY_COUNT(animdata_mario_eyebrows_2_1), GD_ANIM_ROT3S, animdata_mario_eyebrows_2_1 }, + { ARRAY_COUNT(animdata_mario_eyebrows_2_2), GD_ANIM_ROT3S, animdata_mario_eyebrows_2_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 04014E9C */ -s16 anim_mario_eyebrows_3_1[820][3] = { +static s16 anim_mario_eyebrows_3_1[][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, @@ -505,15 +500,13 @@ s16 anim_mario_eyebrows_3_1[820][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, }; -/* @ 040161D4 */ -struct AnimDataInfo anim_mario_eyebrows_3[3] = { - { 820, GD_ANIM_3H_SCALED, anim_mario_eyebrows_3_1 }, +struct AnimDataInfo anim_mario_eyebrows_3[] = { + { ARRAY_COUNT(anim_mario_eyebrows_3_1), GD_ANIM_ROT3S, anim_mario_eyebrows_3_1 }, { 0, GD_ANIM_EMPTY, NULL }, END_ANIMDATA_INFO_ARR, }; -/* @ 040161F8 */ -s16 animdata_mario_eyebrows_4_1[820][3] = { +static s16 animdata_mario_eyebrows_4_1[][3] = { { -34, 0, -1777 }, { -34, 0, -1777 }, { -34, 0, -1778 }, { -35, 0, -1780 }, { -36, 0, -1781 }, { -36, 0, -1784 }, { -37, 0, -1786 }, { -38, -1, -1788 }, { -39, -1, -1790 }, { -40, -1, -1793 }, { -41, -1, -1795 }, { -42, -1, -1797 }, { -42, -1, -1798 }, { -42, -1, -1799 }, { -43, -1, -1799 }, @@ -680,8 +673,7 @@ s16 animdata_mario_eyebrows_4_1[820][3] = { { -7, 0, -1777 }, { -18, 0, -1777 }, { -26, 0, -1777 }, { -32, 0, -1777 }, { -34, 0, -1777 }, }; -/* @ 04017530 */ -s16 animdata_mario_eyebrows_4_2[166][3] = { +static s16 animdata_mario_eyebrows_4_2[][3] = { { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, { -34, 0, -1754 }, @@ -718,15 +710,13 @@ s16 animdata_mario_eyebrows_4_2[166][3] = { { -34, 0, -1777 }, }; -/* @ 04017914 */ -struct AnimDataInfo anim_mario_eyebrows_4[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_eyebrows_4_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_eyebrows_4_2 }, +struct AnimDataInfo anim_mario_eyebrows_4[] = { + { ARRAY_COUNT(animdata_mario_eyebrows_4_1), GD_ANIM_ROT3S, animdata_mario_eyebrows_4_1 }, + { ARRAY_COUNT(animdata_mario_eyebrows_4_2), GD_ANIM_ROT3S, animdata_mario_eyebrows_4_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 04017938 */ -s16 animdata_mario_eyebrows_5_1[820][3] = { +static s16 animdata_mario_eyebrows_5_1[][3] = { { 108, 0, 1775 }, { 108, 0, 1774 }, { 108, 0, 1774 }, { 107, 0, 1773 }, { 107, 0, 1771 }, { 106, 0, 1770 }, { 105, 1, 1768 }, { 104, 1, 1766 }, { 103, 1, 1764 }, { 103, 2, 1763 }, { 102, 2, 1761 }, { 101, 2, 1760 }, { 101, 3, 1759 }, { 100, 3, 1758 }, { 100, 3, 1758 }, @@ -893,15 +883,13 @@ s16 animdata_mario_eyebrows_5_1[820][3] = { { 76, 8, 1782 }, { 89, 5, 1779 }, { 99, 2, 1777 }, { 106, 0, 1775 }, { 108, 0, 1775 }, }; -/* @ 04018C70 */ -struct AnimDataInfo anim_mario_eyebrows_5[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_eyebrows_5_1 }, +struct AnimDataInfo anim_mario_eyebrows_5[] = { + { ARRAY_COUNT(animdata_mario_eyebrows_5_1), GD_ANIM_ROT3S, animdata_mario_eyebrows_5_1 }, { 0, GD_ANIM_EMPTY, NULL }, END_ANIMDATA_INFO_ARR, }; -/* @ 04018C94 */ -s16 animdata_mario_eye_left_1[820][3] = { +static s16 animdata_mario_eye_left_1[][3] = { { -68, 2, -974 }, { -68, 1, -974 }, { -68, 0, -974 }, { -68, -2, -974 }, { -68, -6, -973 }, { -68, -10, -973 }, { -68, -15, -972 }, { -68, -20, -972 }, { -68, -26, -971 }, { -69, -32, -970 }, { -69, -38, -970 }, { -69, -44, -969 }, @@ -1109,8 +1097,7 @@ s16 animdata_mario_eye_left_1[820][3] = { { -68, -3, -967 }, { -68, 0, -971 }, { -68, 1, -973 }, { -68, 2, -974 }, }; -/* @ 04019FCC */ -s16 animdata_mario_eye_left_2[166][3] = { +static s16 animdata_mario_eye_left_2[][3] = { { -69, -86, -946 }, { -69, -86, -946 }, { -69, -83, -946 }, { -69, -79, -947 }, { -69, -73, -948 }, { -69, -67, -949 }, { -69, -59, -950 }, { -69, -50, -951 }, { -69, -41, -952 }, { -69, -31, -953 }, { -69, -20, -955 }, { -69, -9, -956 }, { -69, 1, -958 }, { -69, 12, -959 }, { -69, 24, -961 }, @@ -1147,15 +1134,13 @@ s16 animdata_mario_eye_left_2[166][3] = { { -68, 2, -974 }, }; -/* @ 0401A3B0 */ -struct AnimDataInfo anim_mario_eye_left[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_eye_left_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_eye_left_2 }, +struct AnimDataInfo anim_mario_eye_left[] = { + { ARRAY_COUNT(animdata_mario_eye_left_1), GD_ANIM_ROT3S, animdata_mario_eye_left_1 }, + { ARRAY_COUNT(animdata_mario_eye_left_2), GD_ANIM_ROT3S, animdata_mario_eye_left_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 0401A3D4 */ -s16 animdata_mario_eye_right_1[820][3] = { +static s16 animdata_mario_eye_right_1[][3] = { { 1844, -1788, 824 }, { 1844, -1789, 824 }, { 1844, -1791, 825 }, { 1844, -1794, 825 }, { 1844, -1797, 826 }, { 1844, -1802, 826 }, { 1844, -1807, 827 }, { 1844, -1813, 828 }, { 1844, -1819, 829 }, { 1845, -1826, 829 }, { 1845, -1832, 830 }, { 1845, -1839, 831 }, @@ -1363,8 +1348,7 @@ s16 animdata_mario_eye_right_1[820][3] = { { 1845, -1794, 829 }, { 1844, -1791, 827 }, { 1844, -1789, 825 }, { 1844, -1788, 824 }, }; -/* @ 0401B70C */ -s16 animdata_mario_eye_right_2[166][3] = { +static s16 animdata_mario_eye_right_2[][3] = { { 1841, -1711, 853 }, { 1841, -1711, 853 }, { 1841, -1711, 853 }, { 1841, -1711, 853 }, { 1841, -1710, 853 }, { 1841, -1710, 853 }, { 1841, -1709, 853 }, { 1841, -1708, 853 }, { 1841, -1707, 853 }, { 1841, -1706, 853 }, { 1841, -1705, 853 }, { 1841, -1705, 853 }, @@ -1409,15 +1393,13 @@ s16 animdata_mario_eye_right_2[166][3] = { { 1844, -1788, 824 }, { 1844, -1788, 824 }, }; -/* @ 0401BAF0 */ -struct AnimDataInfo anim_mario_eye_right[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_eye_right_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_eye_right_2 }, +struct AnimDataInfo anim_mario_eye_right[] = { + { ARRAY_COUNT(animdata_mario_eye_right_1), GD_ANIM_ROT3S, animdata_mario_eye_right_1 }, + { ARRAY_COUNT(animdata_mario_eye_right_2), GD_ANIM_ROT3S, animdata_mario_eye_right_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 0401BB14 */ -s16 animdata_mario_cap_1[820][3] = { +static s16 animdata_mario_cap_1[][3] = { { 0, 0, 1539 }, { 0, 0, 1539 }, { 0, 0, 1539 }, { 0, 0, 1538 }, { 0, 0, 1538 }, { 0, 0, 1537 }, { 0, 0, 1537 }, { 0, 0, 1536 }, { 0, 0, 1536 }, { 0, 0, 1535 }, { 0, 0, 1535 }, { 0, 0, 1534 }, { 0, 0, 1534 }, { 0, 0, 1534 }, { 0, 0, 1534 }, @@ -1584,8 +1566,7 @@ s16 animdata_mario_cap_1[820][3] = { { 0, 0, 1543 }, { 0, 0, 1542 }, { 0, 0, 1540 }, { 0, 0, 1539 }, { 0, 0, 1539 }, }; -/* @ 0401CE4C */ -s16 animdata_mario_cap_2[166][3] = { +static s16 animdata_mario_cap_2[][3] = { { 0, 0, 1539 }, { 0, 0, 1539 }, { 0, 0, 1539 }, { 0, 0, 1538 }, { 0, 0, 1538 }, { 0, 0, 1538 }, { 0, 0, 1537 }, { 0, 0, 1537 }, { 0, 0, 1536 }, { 0, 0, 1536 }, { 0, 0, 1535 }, { 0, 0, 1535 }, { 0, 0, 1535 }, { 0, 0, 1534 }, { 0, 0, 1534 }, { 0, 0, 1534 }, { 0, 0, 1534 }, { 0, 0, 1534 }, @@ -1616,15 +1597,13 @@ s16 animdata_mario_cap_2[166][3] = { { 0, 0, 1539 }, { 0, 0, 1539 }, { 0, 0, 1539 }, { 0, 0, 1539 }, }; -/* @ 0401D230 */ -struct AnimDataInfo anim_mario_cap[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_cap_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_cap_2 }, +struct AnimDataInfo anim_mario_cap[] = { + { ARRAY_COUNT(animdata_mario_cap_1), GD_ANIM_ROT3S, animdata_mario_cap_1 }, + { ARRAY_COUNT(animdata_mario_cap_2), GD_ANIM_ROT3S, animdata_mario_cap_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 0401D254 */ -s16 animdata_mario_lips_3_1[820][3] = { +static s16 animdata_mario_lips_3_1[][3] = { { 0, 0, -665 }, { 0, 0, -664 }, { 0, 0, -662 }, { 0, 0, -660 }, { -1, 0, -656 }, { -1, 0, -652 }, { -2, 0, -648 }, { -3, 1, -643 }, { -3, 1, -638 }, { -4, 1, -634 }, { -5, 2, -629 }, { -5, 2, -625 }, @@ -1832,8 +1811,7 @@ s16 animdata_mario_lips_3_1[820][3] = { { 0, -31, -670 }, { 0, -14, -667 }, { 0, -3, -665 }, { 0, 0, -665 }, }; -/* @ 0401E58C */ -s16 animdata_mario_lips_3_2[166][3] = { +static s16 animdata_mario_lips_3_2[][3] = { { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, { -269, -128, -669 }, @@ -1878,15 +1856,13 @@ s16 animdata_mario_lips_3_2[166][3] = { { 0, 0, -665 }, { 0, 0, -665 }, }; -/* @ 0401E970 */ -struct AnimDataInfo anim_mario_lips_3[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_lips_3_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_lips_3_2 }, +struct AnimDataInfo anim_mario_lips_3[] = { + { ARRAY_COUNT(animdata_mario_lips_3_1), GD_ANIM_ROT3S, animdata_mario_lips_3_1 }, + { ARRAY_COUNT(animdata_mario_lips_3_2), GD_ANIM_ROT3S, animdata_mario_lips_3_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 0401E994 */ -s16 animdata_mario_lips_4_1[820][3] = { +static s16 animdata_mario_lips_4_1[][3] = { { 0, 0, -665 }, { 0, 0, -664 }, { 0, 0, -663 }, { 0, 0, -661 }, { 0, 0, -659 }, { 0, 0, -656 }, { 0, 0, -653 }, { 0, 0, -650 }, { 0, 0, -647 }, { 0, 0, -644 }, { 0, 0, -641 }, { 0, 0, -638 }, @@ -2094,8 +2070,7 @@ s16 animdata_mario_lips_4_1[820][3] = { { 7, 27, -681 }, { 3, 12, -672 }, { 0, 3, -667 }, { 0, 0, -665 }, }; -/* @ 0401FCCC */ -s16 animdata_mario_lips_4_2[166][3] = { +static s16 animdata_mario_lips_4_2[][3] = { { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, { 51, 5, -623 }, @@ -2132,15 +2107,13 @@ s16 animdata_mario_lips_4_2[166][3] = { { 0, 0, -665 }, }; -/* @ 040200B0 */ -struct AnimDataInfo anim_mario_lips_4[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_lips_4_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_lips_4_2 }, +struct AnimDataInfo anim_mario_lips_4[] = { + { ARRAY_COUNT(animdata_mario_lips_4_1), GD_ANIM_ROT3S, animdata_mario_lips_4_1 }, + { ARRAY_COUNT(animdata_mario_lips_4_2), GD_ANIM_ROT3S, animdata_mario_lips_4_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 040200D4 */ -s16 animdata_mario_ear_left_1[820][3] = { +static s16 animdata_mario_ear_left_1[][3] = { { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, @@ -2348,9 +2321,8 @@ s16 animdata_mario_ear_left_1[820][3] = { { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, { 1800, 1800, -1534 }, }; -/* @ 0402140C */ -struct AnimDataInfo anim_mario_ear_left[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_ear_left_1 }, +struct AnimDataInfo anim_mario_ear_left[] = { + { ARRAY_COUNT(animdata_mario_ear_left_1), GD_ANIM_ROT3S, animdata_mario_ear_left_1 }, { 0, GD_ANIM_EMPTY, NULL }, END_ANIMDATA_INFO_ARR, }; diff --git a/src/goddard/dynlists/anim_group_2.c b/src/goddard/dynlists/anim_group_2.c index eb4ad001..51d6fe07 100644 --- a/src/goddard/dynlists/anim_group_2.c +++ b/src/goddard/dynlists/anim_group_2.c @@ -1,10 +1,10 @@ #include +#include "macros.h" #include "animdata.h" #include "../gd_types.h" -/* @ 04021430 */ -s16 animdata_mario_ear_right_1[820][3] = { +static s16 animdata_mario_ear_right_1[][3] = { { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, @@ -171,15 +171,13 @@ s16 animdata_mario_ear_right_1[820][3] = { { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, { 0, 0, 265 }, }; -/* @ 04022768 */ -struct AnimDataInfo anim_mario_ear_right[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_ear_right_1 }, +struct AnimDataInfo anim_mario_ear_right[] = { + { ARRAY_COUNT(animdata_mario_ear_right_1), GD_ANIM_ROT3S, animdata_mario_ear_right_1 }, { 0, GD_ANIM_EMPTY, NULL }, END_ANIMDATA_INFO_ARR, }; -/* @ 0402278C */ -s16 animdata_mario_nose_1[820][3] = { +static s16 animdata_mario_nose_1[][3] = { { 0, 0, -1785 }, { 0, 0, -1785 }, { 0, 0, -1786 }, { 0, 0, -1786 }, { 0, 0, -1787 }, { 0, 0, -1788 }, { 0, 0, -1789 }, { 0, 0, -1790 }, { 0, 0, -1791 }, { 0, 0, -1792 }, { 0, 0, -1793 }, { 0, 0, -1793 }, { 0, 0, -1794 }, { 0, 0, -1794 }, { 0, 0, -1794 }, @@ -346,8 +344,7 @@ s16 animdata_mario_nose_1[820][3] = { { 0, 0, -1812 }, { 0, 0, -1801 }, { 0, 0, -1793 }, { 0, 0, -1787 }, { 0, 0, -1785 }, }; -/* @ 04023AC4 */ -s16 animdata_mario_nose_2[166][3] = { +static s16 animdata_mario_nose_2[][3] = { { 0, 0, -1785 }, { 0, 0, -1785 }, { 0, 0, -1785 }, { 0, 0, -1784 }, { 0, 0, -1783 }, { 0, 0, -1782 }, { 0, 0, -1780 }, { 0, 0, -1779 }, { 0, 0, -1777 }, { 0, 0, -1776 }, { 0, 0, -1775 }, { 0, 0, -1774 }, { 0, 0, -1773 }, { 0, 0, -1772 }, { 0, 0, -1772 }, @@ -384,15 +381,13 @@ s16 animdata_mario_nose_2[166][3] = { { 0, 0, -1785 }, }; -/* @ 04023EA8 */ -struct AnimDataInfo anim_mario_nose[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_nose_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_nose_2 }, +struct AnimDataInfo anim_mario_nose[] = { + { ARRAY_COUNT(animdata_mario_nose_1), GD_ANIM_ROT3S, animdata_mario_nose_1 }, + { ARRAY_COUNT(animdata_mario_nose_2), GD_ANIM_ROT3S, animdata_mario_nose_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 04023ECC */ -s16 animdata_mario_lips_5_1[820][3] = { +static s16 animdata_mario_lips_5_1[][3] = { { 0, 0, -311 }, { 0, 0, -311 }, { 0, 0, -310 }, { 0, 0, -310 }, { 0, 0, -309 }, { 0, 0, -307 }, { 0, 0, -306 }, { 0, 0, -304 }, { 0, 0, -302 }, { 0, 0, -300 }, { 0, 0, -297 }, { 0, 0, -295 }, { 0, 0, -292 }, { 0, 0, -289 }, { 0, 0, -286 }, { 0, 0, -283 }, { 0, 0, -280 }, { 0, 0, -276 }, @@ -532,8 +527,7 @@ s16 animdata_mario_lips_5_1[820][3] = { { 0, 0, -304 }, { 0, 0, -308 }, { 0, 0, -310 }, { 0, 0, -311 }, }; -/* @ 04025204 */ -s16 animdata_mario_lips_5_2[166][3] = { +static s16 animdata_mario_lips_5_2[][3] = { { 0, 0, -311 }, { 0, 0, -311 }, { 0, 0, -311 }, { 0, 0, -310 }, { 0, 0, -309 }, { 0, 0, -308 }, { 0, 0, -307 }, { 0, 0, -306 }, { 0, 0, -305 }, { 0, 0, -303 }, { 0, 0, -302 }, { 0, 0, -300 }, { 0, 0, -299 }, { 0, 0, -297 }, { 0, 0, -296 }, { 0, 0, -294 }, { 0, 0, -293 }, { 0, 0, -292 }, @@ -564,15 +558,13 @@ s16 animdata_mario_lips_5_2[166][3] = { { 0, 0, -311 }, { 0, 0, -311 }, { 0, 0, -311 }, { 0, 0, -311 }, }; -/* @ 040255E8 */ -struct AnimDataInfo anim_mario_lips_5[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_lips_5_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_lips_5_2 }, +struct AnimDataInfo anim_mario_lips_5[] = { + { ARRAY_COUNT(animdata_mario_lips_5_1), GD_ANIM_ROT3S, animdata_mario_lips_5_1 }, + { ARRAY_COUNT(animdata_mario_lips_5_2), GD_ANIM_ROT3S, animdata_mario_lips_5_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 0402560C */ -s16 animdata_mario_lip_6_1[820][3] = { +static s16 animdata_mario_lip_6_1[][3] = { { 0, 0, -1115 }, { 0, 0, -1116 }, { 0, 0, -1117 }, { 0, 0, -1119 }, { 0, 0, -1122 }, { 0, 0, -1125 }, { 0, 0, -1129 }, { 0, 0, -1133 }, { 0, 0, -1137 }, { 0, 0, -1142 }, { 0, 0, -1146 }, { 0, 0, -1151 }, @@ -780,8 +772,7 @@ s16 animdata_mario_lip_6_1[820][3] = { { 0, 0, -1164 }, { 0, 0, -1139 }, { 0, 0, -1121 }, { 0, 0, -1115 }, }; -/* @ 04026944 */ -s16 animdata_mario_lip_6_2[166][3] = { +static s16 animdata_mario_lip_6_2[][3] = { { 60, -96, -1085 }, { 59, -96, -1084 }, { 59, -97, -1081 }, { 58, -97, -1076 }, { 57, -98, -1070 }, { 56, -99, -1062 }, { 55, -99, -1054 }, { 53, -100, -1045 }, { 52, -101, -1036 }, { 50, -102, -1027 }, { 49, -103, -1018 }, { 47, -104, -1009 }, @@ -826,15 +817,13 @@ s16 animdata_mario_lip_6_2[166][3] = { { 0, 0, -1115 }, { 0, 0, -1115 }, }; -/* @ 04026D28 */ -struct AnimDataInfo anim_mario_lips_6[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_lip_6_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_lip_6_2 }, +struct AnimDataInfo anim_mario_lips_6[] = { + { ARRAY_COUNT(animdata_mario_lip_6_1), GD_ANIM_ROT3S, animdata_mario_lip_6_1 }, + { ARRAY_COUNT(animdata_mario_lip_6_2), GD_ANIM_ROT3S, animdata_mario_lip_6_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 04026D4C */ -s16 animdata_mario_eyelid_left_1[820][3] = { +static s16 animdata_mario_eyelid_left_1[][3] = { { 0, 0, 1620 }, { 0, 0, 1619 }, { 0, 0, 1617 }, { 0, 0, 1614 }, { 0, 0, 1611 }, { 0, 0, 1607 }, { 0, 0, 1602 }, { 0, 0, 1598 }, { 0, 0, 1593 }, { 0, 0, 1589 }, { 0, 0, 1585 }, { 0, 0, 1581 }, { 0, 0, 1579 }, { 0, 0, 1577 }, { 0, 0, 1576 }, @@ -1001,8 +990,7 @@ s16 animdata_mario_eyelid_left_1[820][3] = { { 0, 0, 1846 }, { 0, 0, 1936 }, { 0, 0, 1843 }, { 0, 0, 1696 }, { 0, 0, 1620 }, }; -/* @ 04028084 */ -s16 animdata_mario_eyelid_left_2[166][3] = { +static s16 animdata_mario_eyelid_left_2[][3] = { { 0, 0, 1717 }, { 0, 0, 1717 }, { 0, 0, 1715 }, { 0, 0, 1714 }, { 0, 0, 1711 }, { 0, 0, 1708 }, { 0, 0, 1705 }, { 0, 0, 1702 }, { 0, 0, 1699 }, { 0, 0, 1696 }, { 0, 0, 1694 }, { 0, 0, 1691 }, { 0, 0, 1689 }, { 0, 0, 1688 }, { 0, 0, 1688 }, { 0, 0, 1688 }, { 0, 0, 1690 }, { 0, 0, 1692 }, @@ -1033,15 +1021,13 @@ s16 animdata_mario_eyelid_left_2[166][3] = { { 0, 0, 1628 }, { 0, 0, 1623 }, { 0, 0, 1621 }, { 0, 0, 1620 }, }; -/* @ 04028468 */ -struct AnimDataInfo anim_mario_eyelid_left[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_eyelid_left_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_eyelid_left_2 }, +struct AnimDataInfo anim_mario_eyelid_left[] = { + { ARRAY_COUNT(animdata_mario_eyelid_left_1), GD_ANIM_ROT3S, animdata_mario_eyelid_left_1 }, + { ARRAY_COUNT(animdata_mario_eyelid_left_2), GD_ANIM_ROT3S, animdata_mario_eyelid_left_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 0402848C */ -s16 animdata_mario_eyelid_right_1[820][3] = { +static s16 animdata_mario_eyelid_right_1[][3] = { { 0, 0, 1620 }, { 0, 0, 1619 }, { 0, 0, 1617 }, { 0, 0, 1614 }, { 0, 0, 1611 }, { 0, 0, 1607 }, { 0, 0, 1602 }, { 0, 0, 1598 }, { 0, 0, 1593 }, { 0, 0, 1589 }, { 0, 0, 1585 }, { 0, 0, 1581 }, { 0, 0, 1579 }, { 0, 0, 1577 }, { 0, 0, 1576 }, @@ -1208,8 +1194,7 @@ s16 animdata_mario_eyelid_right_1[820][3] = { { 0, 0, 1851 }, { 0, 0, 1942 }, { 0, 0, 1847 }, { 0, 0, 1698 }, { 0, 0, 1620 }, }; -/* @ 040297C4 */ -s16 animdata_mario_eyelid_right_2[166][3] = { +static s16 animdata_mario_eyelid_right_2[][3] = { { 0, 0, 1763 }, { 0, 0, 1762 }, { 0, 0, 1761 }, { 0, 0, 1760 }, { 0, 0, 1757 }, { 0, 0, 1755 }, { 0, 0, 1752 }, { 0, 0, 1749 }, { 0, 0, 1746 }, { 0, 0, 1744 }, { 0, 0, 1741 }, { 0, 0, 1739 }, { 0, 0, 1737 }, { 0, 0, 1736 }, { 0, 0, 1736 }, { 0, 0, 1736 }, { 0, 0, 1738 }, { 0, 0, 1740 }, @@ -1240,15 +1225,13 @@ s16 animdata_mario_eyelid_right_2[166][3] = { { 0, 0, 1629 }, { 0, 0, 1624 }, { 0, 0, 1621 }, { 0, 0, 1620 }, }; -/* @ 04029BA8 */ -struct AnimDataInfo anim_mario_eyelid_right[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_eyelid_right_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_eyelid_right_2 }, +struct AnimDataInfo anim_mario_eyelid_right[] = { + { ARRAY_COUNT(animdata_mario_eyelid_right_1), GD_ANIM_ROT3S, animdata_mario_eyelid_right_1 }, + { ARRAY_COUNT(animdata_mario_eyelid_right_2), GD_ANIM_ROT3S, animdata_mario_eyelid_right_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 04029BCC */ -s16 animdata_mario_intro_1[820][6] = { +static s16 animdata_mario_intro_1[][6] = { { 1128, 0, 0, 0, 0, -20010 }, { 1123, 0, 0, 0, -2, -19891 }, { 1108, 0, 0, 0, -7, -19548 }, @@ -2071,8 +2054,7 @@ s16 animdata_mario_intro_1[820][6] = { { 0, 30, 0, 0, 0, -10 }, }; -/* @ 0402C23C */ -s16 animdata_mario_intro_2[166][6] = { +static s16 animdata_mario_intro_2[][6] = { { 0, 0, 10, 0, 0, -20000 }, { 0, 0, 3584, 19, -3, -19864 }, { 0, 0, 3541, 71, -14, -19484 }, @@ -2241,15 +2223,13 @@ s16 animdata_mario_intro_2[166][6] = { { 0, 0, 0, 0, 0, 0 }, }; -/* @ 0402CA04 */ -struct AnimDataInfo anim_mario_intro[3] = { - { 820, GD_ANIM_6H_SCALED, animdata_mario_intro_1 }, - { 166, GD_ANIM_6H_SCALED, animdata_mario_intro_2 }, +struct AnimDataInfo anim_mario_intro[] = { + { ARRAY_COUNT(animdata_mario_intro_1), GD_ANIM_ROT3S_POS3S, animdata_mario_intro_1 }, + { ARRAY_COUNT(animdata_mario_intro_2), GD_ANIM_ROT3S_POS3S, animdata_mario_intro_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 0402CA28 */ -s16 animdata_silver_star_1[820][6] = { +static s16 animdata_silver_star_1[][6] = { { 0, 0, 0, -1300, 1500, 2600 }, { 0, 0, 0, -1300, 1500, 2600 }, { 0, 0, 0, -1300, 1500, 2600 }, { 0, 0, 0, -1300, 1500, 2600 }, { 0, 0, 0, -1300, 1500, 2600 }, { 0, 0, 0, -1300, 1500, 2600 }, { 0, 0, 0, -1300, 1500, 2600 }, { 0, 0, 0, -1300, 1500, 2600 }, { 0, 0, 0, -1300, 1500, 2600 }, @@ -2526,8 +2506,7 @@ s16 animdata_silver_star_1[820][6] = { { 0, 0, 0, -1670, 1582, 1187 }, }; -/* @ 0402F098 */ -s16 animdata_silver_star_2[166][6] = { +static s16 animdata_silver_star_2[][6] = { { 0, 0, 0, -25, -1862, -21178 }, { 0, 0, 0, -23, -1860, -21094 }, { 0, 0, 0, -16, -1854, -20848 }, { 0, 0, 0, -5, -1845, -20453 }, { 0, 0, 0, 7, -1833, -19921 }, { 0, 0, 0, 21, -1817, -19267 }, { 0, 0, 0, 35, -1797, -18501 }, { 0, 0, 0, 48, -1774, -17638 }, { 0, 0, 0, 60, -1748, -16688 }, @@ -2586,15 +2565,13 @@ s16 animdata_silver_star_2[166][6] = { { 0, 0, 0, -1300, 1500, 2600 }, }; -/* @ 0402F860 */ -struct AnimDataInfo anim_silver_star[3] = { - { 820, GD_ANIM_6H_SCALED, animdata_silver_star_1 }, - { 166, GD_ANIM_6H_SCALED, animdata_silver_star_2 }, +struct AnimDataInfo anim_silver_star[] = { + { ARRAY_COUNT(animdata_silver_star_1), GD_ANIM_ROT3S_POS3S, animdata_silver_star_1 }, + { ARRAY_COUNT(animdata_silver_star_2), GD_ANIM_ROT3S_POS3S, animdata_silver_star_2 }, END_ANIMDATA_INFO_ARR, }; -/* @ 0402F884 */ -s16 animdata_red_star_1[820][6] = { +static s16 animdata_red_star_1[][6] = { { 0, 0, 0, 0, 0, -20000 }, { 0, 0, 0, 0, 0, -20000 }, { 0, 0, 0, 0, 0, -20000 }, { 0, 0, 0, 0, 0, -20000 }, { 0, 0, 0, 0, 0, -20000 }, { 0, 0, 0, 0, 0, -20000 }, { 0, 0, 0, 0, 0, -20000 }, { 0, 0, 0, 0, 0, -20000 }, { 0, 0, 0, 0, 0, -20000 }, @@ -2871,8 +2848,7 @@ s16 animdata_red_star_1[820][6] = { { 0, 0, 0, 1, 498, -4972 }, }; -/* @ 04031EF4 */ -s16 animdata_red_star_2[166][6] = { +static s16 animdata_red_star_2[][6] = { { 0, 0, 0, 4291, 2080, 2392 }, { 0, 0, 0, 4290, 2079, 2391 }, { 0, 0, 0, 4289, 2079, 2389 }, { 0, 0, 0, 4287, 2078, 2385 }, { 0, 0, 0, 4283, 2077, 2379 }, { 0, 0, 0, 4279, 2075, 2372 }, { 0, 0, 0, 4274, 2073, 2364 }, { 0, 0, 0, 4268, 2071, 2354 }, { 0, 0, 0, 4262, 2069, 2342 }, @@ -2931,9 +2907,8 @@ s16 animdata_red_star_2[166][6] = { { 0, 0, 0, 1, 498, -4972 }, }; -/* @ 040326BC */ -struct AnimDataInfo anim_red_star[3] = { - { 820, GD_ANIM_6H_SCALED, animdata_red_star_1 }, - { 166, GD_ANIM_6H_SCALED, animdata_red_star_2 }, +struct AnimDataInfo anim_red_star[] = { + { ARRAY_COUNT(animdata_red_star_1), GD_ANIM_ROT3S_POS3S, animdata_red_star_1 }, + { ARRAY_COUNT(animdata_red_star_2), GD_ANIM_ROT3S_POS3S, animdata_red_star_2 }, END_ANIMDATA_INFO_ARR, }; diff --git a/src/goddard/dynlists/anim_mario_eyebrows_1.c b/src/goddard/dynlists/anim_mario_eyebrows_1.c index c52ebaf7..10f3bd56 100644 --- a/src/goddard/dynlists/anim_mario_eyebrows_1.c +++ b/src/goddard/dynlists/anim_mario_eyebrows_1.c @@ -1,10 +1,10 @@ #include +#include "macros.h" #include "animdata.h" #include "../gd_types.h" -/* @ 04010CC0 */ -s16 animdata_mario_eyebrows_1_1[820][3] = { +static s16 animdata_mario_eyebrows_1_1[][3] = { { -68, 0, 1775 }, { -68, 0, 1774 }, { -68, 0, 1774 }, { -68, 0, 1773 }, { -68, 0, 1773 }, { -68, 0, 1772 }, { -68, 0, 1771 }, { -68, 0, 1770 }, { -68, 0, 1768 }, { -68, 0, 1767 }, { -68, 0, 1766 }, { -68, -1, 1766 }, { -68, -1, 1765 }, { -68, -1, 1765 }, { -68, -1, 1764 }, @@ -171,8 +171,7 @@ s16 animdata_mario_eyebrows_1_1[820][3] = { { -20, -10, 1781 }, { -39, -6, 1778 }, { -55, -2, 1776 }, { -65, 0, 1775 }, { -68, 0, 1775 }, }; -/* @ 04011FF8 */ -s16 animdata_mario_eyebrows_1_2[166][3] = { +static s16 animdata_mario_eyebrows_1_2[][3] = { { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, { -68, 5, 1820 }, @@ -209,9 +208,8 @@ s16 animdata_mario_eyebrows_1_2[166][3] = { { -68, 0, 1775 }, }; -/* @ 040123DC */ -struct AnimDataInfo anim_mario_eyebrows_1[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_eyebrows_1_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_eyebrows_1_2 }, +struct AnimDataInfo anim_mario_eyebrows_1[] = { + { ARRAY_COUNT(animdata_mario_eyebrows_1_1), GD_ANIM_ROT3S, animdata_mario_eyebrows_1_1 }, + { ARRAY_COUNT(animdata_mario_eyebrows_1_2), GD_ANIM_ROT3S, animdata_mario_eyebrows_1_2 }, END_ANIMDATA_INFO_ARR, }; diff --git a/src/goddard/dynlists/anim_mario_lips_1.c b/src/goddard/dynlists/anim_mario_lips_1.c index 334f1679..e6188e2a 100644 --- a/src/goddard/dynlists/anim_mario_lips_1.c +++ b/src/goddard/dynlists/anim_mario_lips_1.c @@ -1,10 +1,10 @@ #include +#include "macros.h" #include "animdata.h" #include "../gd_types.h" -/* @ 0400DE40 */ -s16 animdata_mario_lips_1_1[820][3] = { +static s16 animdata_mario_lips_1_1[][3] = { { -80, -6, 1818 }, { -80, -6, 1818 }, { -80, -6, 1818 }, { -80, -6, 1817 }, { -80, -6, 1817 }, { -80, -6, 1816 }, { -80, -6, 1815 }, { -80, -6, 1815 }, { -80, -6, 1814 }, { -80, -6, 1813 }, { -80, -6, 1812 }, { -80, -6, 1812 }, @@ -212,8 +212,7 @@ s16 animdata_mario_lips_1_1[820][3] = { { -36, -4, 1820 }, { -59, -5, 1819 }, { -74, -5, 1818 }, { -80, -6, 1818 }, }; -/* @ 0400F178 */ -s16 animdata_mario_lips_1_2[166][3] = { +static s16 animdata_mario_lips_1_2[][3] = { { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, { -97, -93, 1924 }, @@ -250,9 +249,8 @@ s16 animdata_mario_lips_1_2[166][3] = { { -80, -6, 1818 }, }; -/* @ 0400F55C */ -struct AnimDataInfo anim_mario_lips_1[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_lips_1_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_lips_1_2 }, +struct AnimDataInfo anim_mario_lips_1[] = { + { ARRAY_COUNT(animdata_mario_lips_1_1), GD_ANIM_ROT3S, animdata_mario_lips_1_1 }, + { ARRAY_COUNT(animdata_mario_lips_1_2), GD_ANIM_ROT3S, animdata_mario_lips_1_2 }, END_ANIMDATA_INFO_ARR, }; diff --git a/src/goddard/dynlists/anim_mario_lips_2.c b/src/goddard/dynlists/anim_mario_lips_2.c index 02e19207..eecd78dc 100644 --- a/src/goddard/dynlists/anim_mario_lips_2.c +++ b/src/goddard/dynlists/anim_mario_lips_2.c @@ -1,10 +1,10 @@ #include +#include "macros.h" #include "animdata.h" #include "../gd_types.h" -/* @ 0400F580 */ -s16 animdata_mario_lips_2_1[820][3] = { +static s16 animdata_mario_lips_2_1[][3] = { { -97, -3, -1771 }, { -97, -3, -1772 }, { -97, -3, -1772 }, { -97, -4, -1773 }, { -97, -4, -1773 }, { -97, -4, -1774 }, { -97, -4, -1775 }, { -97, -4, -1776 }, { -97, -4, -1777 }, { -97, -5, -1778 }, { -97, -5, -1779 }, { -97, -5, -1780 }, @@ -212,8 +212,7 @@ s16 animdata_mario_lips_2_1[820][3] = { { -97, -3, -1771 }, { -97, -3, -1771 }, { -97, -3, -1771 }, { -97, -3, -1771 }, }; -/* @ 040108B8 */ -s16 animdata_mario_lips_2_2[166][3] = { +static s16 animdata_mario_lips_2_2[][3] = { { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, { -96, -15, -1839 }, @@ -258,9 +257,8 @@ s16 animdata_mario_lips_2_2[166][3] = { { -97, -3, -1771 }, { -97, -3, -1771 }, }; -/* @ 04010C9C */ -struct AnimDataInfo anim_mario_lips_2[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_lips_2_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_lips_2_2 }, +struct AnimDataInfo anim_mario_lips_2[] = { + { ARRAY_COUNT(animdata_mario_lips_2_1), GD_ANIM_ROT3S, animdata_mario_lips_2_1 }, + { ARRAY_COUNT(animdata_mario_lips_2_2), GD_ANIM_ROT3S, animdata_mario_lips_2_2 }, END_ANIMDATA_INFO_ARR, }; diff --git a/src/goddard/dynlists/anim_mario_mustache_left.c b/src/goddard/dynlists/anim_mario_mustache_left.c index 61fd74f3..b983235c 100644 --- a/src/goddard/dynlists/anim_mario_mustache_left.c +++ b/src/goddard/dynlists/anim_mario_mustache_left.c @@ -1,10 +1,10 @@ #include +#include "macros.h" #include "animdata.h" #include "../gd_types.h" -/* @ 0400C700 */ -s16 animdata_mario_mustache_left_1[820][3] = { +static s16 animdata_mario_mustache_left_1[][3] = { { -1799, -1645, -293 }, { -1799, -1645, -293 }, { -1800, -1645, -292 }, { -1800, -1645, -291 }, { -1800, -1645, -290 }, { -1800, -1645, -289 }, { -1801, -1645, -287 }, { -1801, -1645, -286 }, { -1802, -1645, -284 }, { -1802, -1645, -283 }, { -1802, -1644, -281 }, { -1803, -1644, -280 }, @@ -212,8 +212,7 @@ s16 animdata_mario_mustache_left_1[820][3] = { { -1802, -1645, -282 }, { -1801, -1645, -288 }, { -1800, -1645, -292 }, { -1799, -1645, -293 }, }; -/* @ 0400DA38 */ -s16 animdata_mario_mustache_left_2[166][3] = { +static s16 animdata_mario_mustache_left_2[][3] = { { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, { -1756, -1651, -459 }, @@ -258,9 +257,8 @@ s16 animdata_mario_mustache_left_2[166][3] = { { -1799, -1645, -293 }, { -1799, -1645, -293 }, }; -/* @ 0400DE1C */ -struct AnimDataInfo anim_mario_mustache_left[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_mustache_left_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_mustache_left_2 }, +struct AnimDataInfo anim_mario_mustache_left[] = { + { ARRAY_COUNT(animdata_mario_mustache_left_1), GD_ANIM_ROT3S, animdata_mario_mustache_left_1 }, + { ARRAY_COUNT(animdata_mario_mustache_left_2), GD_ANIM_ROT3S, animdata_mario_mustache_left_2 }, END_ANIMDATA_INFO_ARR, }; diff --git a/src/goddard/dynlists/anim_mario_mustache_right.c b/src/goddard/dynlists/anim_mario_mustache_right.c index 6d20451d..e5ae9403 100644 --- a/src/goddard/dynlists/anim_mario_mustache_right.c +++ b/src/goddard/dynlists/anim_mario_mustache_right.c @@ -1,10 +1,10 @@ #include +#include "macros.h" #include "animdata.h" #include "../gd_types.h" -/* @ 0400AFC0 */ -s16 animdata_mario_mustache_right_1[820][3] = { +static s16 animdata_mario_mustache_right_1[][3] = { { 0, 154, 1506 }, { 0, 154, 1506 }, { 0, 154, 1507 }, { 0, 154, 1508 }, { 0, 154, 1510 }, { 1, 154, 1511 }, { 1, 154, 1513 }, { 2, 154, 1515 }, { 2, 155, 1517 }, { 3, 155, 1518 }, { 3, 155, 1520 }, { 3, 155, 1521 }, { 4, 155, 1522 }, { 4, 155, 1522 }, { 4, 155, 1522 }, @@ -171,8 +171,7 @@ s16 animdata_mario_mustache_right_1[820][3] = { { 6, 154, 1530 }, { 3, 154, 1521 }, { 1, 154, 1513 }, { 0, 154, 1508 }, { 0, 154, 1506 }, }; -/* @ 0400C2F8 */ -s16 animdata_mario_mustache_right_2[166][3] = { +static s16 animdata_mario_mustache_right_2[][3] = { { 23, 152, 1595 }, { 23, 152, 1595 }, { 23, 152, 1596 }, { 24, 152, 1597 }, { 24, 152, 1598 }, { 24, 152, 1600 }, { 25, 152, 1602 }, { 25, 152, 1604 }, { 26, 152, 1605 }, { 26, 152, 1607 }, { 27, 152, 1609 }, { 27, 152, 1610 }, { 28, 152, 1611 }, { 28, 152, 1612 }, { 28, 152, 1613 }, @@ -209,9 +208,8 @@ s16 animdata_mario_mustache_right_2[166][3] = { { 0, 154, 1506 }, }; -/* @ 0400C6DC */ struct AnimDataInfo anim_mario_mustache_right[3] = { - { 820, GD_ANIM_3H_SCALED, animdata_mario_mustache_right_1 }, - { 166, GD_ANIM_3H_SCALED, animdata_mario_mustache_right_2 }, + { ARRAY_COUNT(animdata_mario_mustache_right_1), GD_ANIM_ROT3S, animdata_mario_mustache_right_1 }, + { ARRAY_COUNT(animdata_mario_mustache_right_2), GD_ANIM_ROT3S, animdata_mario_mustache_right_2 }, END_ANIMDATA_INFO_ARR, }; diff --git a/src/goddard/dynlists/animdata.h b/src/goddard/dynlists/animdata.h index 192d9fad..28e69269 100644 --- a/src/goddard/dynlists/animdata.h +++ b/src/goddard/dynlists/animdata.h @@ -4,30 +4,30 @@ #include "../gd_types.h" #define END_ANIMDATA_INFO_ARR { -1, GD_ANIM_EMPTY, NULL } -extern struct AnimDataInfo anim_mario_mustache_right[3]; -extern struct AnimDataInfo anim_mario_mustache_left[3]; -extern struct AnimDataInfo anim_mario_lips_1[3]; -extern struct AnimDataInfo anim_mario_lips_2[3]; -extern struct AnimDataInfo anim_mario_eyebrows_1[3]; -extern struct AnimDataInfo anim_mario_eyebrows_equalizer[3]; -extern struct AnimDataInfo anim_mario_eyebrows_2[3]; -extern struct AnimDataInfo anim_mario_eyebrows_3[3]; -extern struct AnimDataInfo anim_mario_eyebrows_4[3]; -extern struct AnimDataInfo anim_mario_eyebrows_5[3]; -extern struct AnimDataInfo anim_mario_eye_left[3]; -extern struct AnimDataInfo anim_mario_eye_right[3]; -extern struct AnimDataInfo anim_mario_cap[3]; -extern struct AnimDataInfo anim_mario_lips_3[3]; -extern struct AnimDataInfo anim_mario_lips_4[3]; -extern struct AnimDataInfo anim_mario_ear_left[3]; -extern struct AnimDataInfo anim_mario_ear_right[3]; -extern struct AnimDataInfo anim_mario_nose[3]; -extern struct AnimDataInfo anim_mario_lips_5[3]; -extern struct AnimDataInfo anim_mario_lips_6[3]; -extern struct AnimDataInfo anim_mario_eyelid_left[3]; -extern struct AnimDataInfo anim_mario_eyelid_right[3]; -extern struct AnimDataInfo anim_mario_intro[3]; -extern struct AnimDataInfo anim_silver_star[3]; -extern struct AnimDataInfo anim_red_star[3]; +extern struct AnimDataInfo anim_mario_mustache_right[]; +extern struct AnimDataInfo anim_mario_mustache_left[]; +extern struct AnimDataInfo anim_mario_lips_1[]; +extern struct AnimDataInfo anim_mario_lips_2[]; +extern struct AnimDataInfo anim_mario_eyebrows_1[]; +extern struct AnimDataInfo anim_mario_eyebrows_equalizer[]; +extern struct AnimDataInfo anim_mario_eyebrows_2[]; +extern struct AnimDataInfo anim_mario_eyebrows_3[]; +extern struct AnimDataInfo anim_mario_eyebrows_4[]; +extern struct AnimDataInfo anim_mario_eyebrows_5[]; +extern struct AnimDataInfo anim_mario_eye_left[]; +extern struct AnimDataInfo anim_mario_eye_right[]; +extern struct AnimDataInfo anim_mario_cap[]; +extern struct AnimDataInfo anim_mario_lips_3[]; +extern struct AnimDataInfo anim_mario_lips_4[]; +extern struct AnimDataInfo anim_mario_ear_left[]; +extern struct AnimDataInfo anim_mario_ear_right[]; +extern struct AnimDataInfo anim_mario_nose[]; +extern struct AnimDataInfo anim_mario_lips_5[]; +extern struct AnimDataInfo anim_mario_lips_6[]; +extern struct AnimDataInfo anim_mario_eyelid_left[]; +extern struct AnimDataInfo anim_mario_eyelid_right[]; +extern struct AnimDataInfo anim_mario_intro[]; +extern struct AnimDataInfo anim_silver_star[]; +extern struct AnimDataInfo anim_red_star[]; #endif // GD_ANIMDATA_H diff --git a/src/goddard/dynlists/dynlist_macros.h b/src/goddard/dynlists/dynlist_macros.h index 9c0c727c..decb8fa9 100644 --- a/src/goddard/dynlists/dynlist_macros.h +++ b/src/goddard/dynlists/dynlist_macros.h @@ -2,145 +2,217 @@ #define GD_DYNLIST_MACROS_H /* DynListCmd Macros */ -/* Necessary start command for the dynlist. List will not process otherwise. */ -#define StartList() \ + +/** + * Must be the first command in a dynlist. + */ +#define BeginList() \ { 53716, {0}, {0}, {0.0, 0.0, 0.0} } -/* Necessary stop command for the dynlist. */ -#define StopList() \ +/** + * Must be the last command in a dynlist. + */ +#define EndList() \ { 58, {0}, {0}, {0.0, 0.0, 0.0} } -/* Subsequent dynobj ids should be treated as ints, not as C string pointers. */ -#define UseIntId(w2) \ - { 0, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * If `enable` is TRUE, then subsequent object names are treated as integers + * rather than strings. + */ +#define UseIntegerNames(enable) \ + { 0, {0}, {(void *)(enable)}, {0.0, 0.0, 0.0} } -/* Set the initial position of the current object */ -/* Supported Objs: joints, particles, nets, vertices, cameras */ +/** + * Set the initial position of the current object + * Supported Objs: joints, particles, nets, vertices, cameras + */ #define SetInitialPosition(x, y, z) \ { 1, {0}, {0}, {(x), (y), (z)} } -/* Set the relative position of the current object */ -/* Supported Objs: joints, particles, vertices, cameras, labels */ +/** + * Set the relative position of the current object + * Supported Objs: joints, particles, vertices, cameras, labels + */ #define SetRelativePosition(x, y, z) \ { 2, {0}, {0}, {(x), (y), (z)} } -/* Set the world position of the current object */ -/* Supported Objs: joints, nets, vertices, cameras, gadgets, views */ +/** + * Set the world position of the current object + * Supported Objs: joints, nets, vertices, cameras, gadgets, views + */ #define SetWorldPosition(x, y, z) \ { 3, {0}, {0}, {(x), (y), (z)} } -/* Set the normal of the current object */ -/* Supported Objs: vertices */ +/** + * Set the normal of the current object + * Supported Objs: vertices + */ #define SetNormal(x, y, z) \ { 4, {0}, {0}, {(x), (y), (z)} } -/* Set the scale of the current object */ -/* Supported Objs: joints, particles, nets, gadgets, views, lights */ +/** + * Set the scale of the current object + * Supported Objs: joints, particles, nets, gadgets, views, lights + */ #define SetScale(x, y, z) \ { 5, {0}, {0}, {(x), (y), (z)} } -/* Set the rotation of the current object */ -/* Supported Objs: joints, nets */ +/** + * Set the rotation of the current object + * Supported Objs: joints, nets + */ #define SetRotation(x, y, z) \ { 6, {0}, {0}, {(x), (y), (z)} } -/* Set the half-word flag in the header of the current dynobj */ -/* Supported Objs: all */ -#define SetHeaderFlag(w2) \ - { 7, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Set the specified bits in the object's `drawFlags` field + * Supported Objs: all + */ +#define SetDrawFlag(flags) \ + { 7, {0}, {(void *)(flags)}, {0.0, 0.0, 0.0} } -/* Set the bits in an object specific flag with the provided flag */ -/* Supported Objs: bones, joints, particles, shapes, nets, cameras, views, lights */ -#define SetFlag(w2) \ - { 8, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Set the specified bits in the object specific flag + * Supported Objs: bones, joints, particles, shapes, nets, cameras, views, lights + */ +#define SetFlag(flags) \ + { 8, {0}, {(void *)(flags)}, {0.0, 0.0, 0.0} } -/* Clear the bits in an object specific flag with the provided flag */ -/* Supported Objs: bones, joints, particles, nets, cameras */ -#define ClearFlag(w2) \ - { 9, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Clear the specified bits in the object specific flag + * Supported Objs: bones, joints, particles, nets, cameras + */ +#define ClearFlag(flags) \ + { 9, {0}, {(void *)(flags)}, {0.0, 0.0, 0.0} } -/* Set the friction vector of a Joint */ -/* Supported Objs: joints */ +/** + * Set the friction vector of a Joint + * Supported Objs: joints + */ #define SetFriction(x, y, z) \ { 10, {0}, {0}, {(x), (y), (z)} } -/* Set the spring f32 of a Bone */ -/* Supported Objs: bones */ -#define SetSpring(x) \ - { 11, {0}, {0}, {(x), 0.0, 0.0} } +/** + * Set the spring value of a Bone + * Supported Objs: bones + */ +#define SetSpring(spring) \ + { 11, {0}, {0}, {(spring), 0.0, 0.0} } -/* Jump to pointed dynlist. Once that list has finished processing, flow returns to current list. */ -#define JumpToList(w1) \ - { 12, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Jump to pointed dynlist. Once that list has finished processing, flow returns + * to the current list. + */ +#define CallList(list) \ + { 12, {(void *)(list)}, {0}, {0.0, 0.0, 0.0} } -/* Store either the enumerated "colour" number in an object, or the RGB f32 values the number refers to */ -/* Supported Objs: joints, particles, nets, faces, gadgets */ -#define SetColourNum(w2) \ - { 13, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Sets the object's color to one of the predefined colors (see draw_objects.h + * for the list of colors. + * Supported Objs: joints, particles, nets, faces, gadgets + */ +#define SetColourNum(colourNum) \ + { 13, {0}, {(void *)(colourNum)}, {0.0, 0.0, 0.0} } -/* Make an object of the specified type and id, and add that object to the dynobj pool. */ -#define MakeDynObj(w2, w1) \ - { 15, {(void *)(w1)}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Make an object of the specified type and name, and set it as the current + * object. + */ +#define MakeDynObj(type, name) \ + { 15, {(void *)(name)}, {(void *)(type)}, {0.0, 0.0, 0.0} } -/* Make a group object that will contain all subsequently created objects once the EndGroup command is called. */ -#define StartGroup(w1) \ - { 16, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Make a group that will contain all subsequently created objects once the + * EndGroup command is called. + */ +#define StartGroup(grpName) \ + { 16, {(void *)(grpName)}, {0}, {0.0, 0.0, 0.0} } -/* Collect all objects created after the StartGroup command with the same id. */ -/* Supported Objs: groups */ -#define EndGroup(w1) \ - { 17, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * End a group. All objects created between StartGroup and EndGroup are added to + * the group. + */ +#define EndGroup(grpName) \ + { 17, {(void *)(grpName)}, {0}, {0.0, 0.0, 0.0} } -/* Add the current dyn object to the Group with the called ID */ -/* Supported Objs: groups */ -#define AddToGroup(w1) \ - { 18, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Add the current object to the specified group. + * Supported Objs: all + */ +#define AddToGroup(grpName) \ + { 18, {(void *)(grpName)}, {0}, {0.0, 0.0, 0.0} } -/* Set an object specific type flag. */ -/* Supported Objs: groups, joints, particles, nets, materials, gadgets */ -#define SetType(w2) \ - { 19, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Set an object specific type flag. + * Supported Objs: groups, joints, particles, nets, materials, gadgets + */ +#define SetType(type) \ + { 19, {0}, {(void *)(type)}, {0.0, 0.0, 0.0} } -/* Assign the material Group ID to the current dynobj Shape and check the Shape */ -/* Supported Objs: shapes */ -#define SetMaterialGroup(w1) \ - { 20, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Set the current shape's material group to the specified group. + * Supported Objs: shapes + */ +#define SetMaterialGroup(mtlGrpName) \ + { 20, {(void *)(mtlGrpName)}, {0}, {0.0, 0.0, 0.0} } -/* Attach Group ID to the current dynobj */ -/* Supported Objs: shapes, nets, gadgets, animators */ -#define SetNodeGroup(w1) \ - { 21, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Assign the specified group to the current object. The purpose of the group + * depends on the current object's type. For shapes, it sets the vertex data. + * For animators, it sets the animation data. For nets, it sets ???. For + * gadgets, it sets ???. + * Supported Objs: shapes, nets, gadgets, animators + */ +#define SetNodeGroup(grpName) \ + { 21, {(void *)(grpName)}, {0}, {0.0, 0.0, 0.0} } -/* Set the skin group of the current Net dynobj with the vertices from Shape ID */ -/* Supported Objs: nets */ -#define SetSkinShape(w1) \ - { 22, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Set the skin group of the current Net object with the vertices from the + * specified shape. + * Supported Objs: nets + */ +#define SetSkinShape(shapeName) \ + { 22, {(void *)(shapeName)}, {0}, {0.0, 0.0, 0.0} } -/* Set the plane group ID of the current dynobj */ -/* Supported Objs: shapes, nets */ -#define SetPlaneGroup(w1) \ - { 23, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Set the plane (face) group of the current object. + * Supported Objs: shapes, nets + */ +#define SetPlaneGroup(planeGrpName) \ + { 23, {(void *)(planeGrpName)}, {0}, {0.0, 0.0, 0.0} } -/* Set the current dynobj's shape pointer by dereferencing the ptr ptr */ -/* Supported Objs: bones, joints, particles, nets, gadgets, lights */ -#define SetShapePtrPtr(w1) \ - { 24, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Set the current object's shape, where `shapePtr` is a pointer to an + * `ObjShape`. + * Supported Objs: bones, joints, particles, nets, gadgets, lights + */ +#define SetShapePtrPtr(shapePtr) \ + { 24, {(void *)(shapePtr)}, {0}, {0.0, 0.0, 0.0} } -/* Set the current dynobj's shape pointer to Shape ID */ -/* Supported Objs: bones, joints, particles, nets, gadgets */ -#define SetShapePtr(w1) \ - { 25, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Set the current object's shape, where `shapeName` is the name of a shape + * object. + * Supported Objs: bones, joints, particles, nets, gadgets + */ +#define SetShapePtr(shapeName) \ + { 25, {(void *)(shapeName)}, {0}, {0.0, 0.0, 0.0} } -/* Set offset of the connected shape */ -/* Supported Objs: joints */ +/** + * Set offset of the connected shape + * Supported Objs: joints + */ #define SetShapeOffset(x, y, z) \ { 26, {0}, {0}, {(x), (y), (z)} } -/* Set the center of gravity of the current Net object */ -/* Supported Objs: nets */ +/** + * Set the center of gravity of the current Net object + * Supported Objs: nets + */ #define SetCenterOfGravity(x, y, z) \ { 27, {0}, {0}, {(x), (y), (z)} } +// TODO: + /* Link Object ID to the current dynobj */ /* Supported Objs: groups, bones, faces, cameras, views, labels, animators */ #define LinkWith(w1) \ @@ -151,116 +223,180 @@ #define LinkWithPtr(w1) \ { 29, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } -/* Set Object ID as the current dynobj */ -/* Supported Objs: all */ -#define UseObj(w1) \ - { 30, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Set the specified object as the current object. + * Supported Objs: all + */ +#define UseObj(name) \ + { 30, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } -/* Set the current Net object's control type field */ -/* Supported Objs: nets */ +/** + * Set the current Net object's control type field. Control type is never used + * for anything, so this command effectively does nothing. + * Supported Objs: nets + */ #define SetControlType(w2) \ { 31, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } -/* Set the weight of the current Joint object with ID and VALUE */ -/* Supported Objs: joints */ -#define SetSkinWeight(w2, x) \ - { 32, {0}, {(void *)(w2)}, {(x), 0.0, 0.0} } +/** + * Set the weight percentage of the specified vertex controlled by the current + * Joint object. + * Supported Objs: joints + */ +#define SetSkinWeight(vtxNum, weight) \ + { 32, {0}, {(void *)(vtxNum)}, {(weight), 0.0, 0.0} } -/* Set the ambient color of the current Material object */ -/* Supported Objs: materials */ -#define SetAmbient(x, y, z) \ - { 33, {0}, {0}, {(x), (y), (z)} } +/** + * Set the ambient color of the current Material object. + * Supported Objs: materials + */ +#define SetAmbient(r, g, b) \ + { 33, {0}, {0}, {(r), (g), (b)} } -/* Set the diffuse color of the current Material or Light object */ -/* Supported Objs: materials, lights */ -#define SetDiffuse(x, y, z) \ - { 34, {0}, {0}, {(x), (y), (z)} } +/** + * Set the diffuse color of the current Material or Light object. + * Supported Objs: materials, lights + */ +#define SetDiffuse(r, g, b) \ + { 34, {0}, {0}, {(r), (g), (b)} } -/* Set the numerical Object ID field (not dynobj id) */ -/* Supported Objs: joints, vertices, materials, lights */ -#define SetId(w2) \ - { 35, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Set the object specific ID field. + * Supported Objs: joints, vertices, materials, lights + */ +#define SetId(id) \ + { 35, {0}, {(void *)(id)}, {0.0, 0.0, 0.0} } -/* Set the material id of the current Face */ -/* Supported Objs: faces */ -#define SetMaterial(w1, w2) \ - { 36, {(void *)(w1)}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Set the material id of the current Face + * Supported Objs: faces + */ +#define SetMaterial(id) \ + { 36, {0}, {(void *)(id)}, {0.0, 0.0, 0.0} } -/* Map Materials from Group ID to the current Group obj */ -/* Supported Objs: groups */ -#define MapMaterials(w1) \ - { 37, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * For all faces in the current Group, resolve their material IDs to actual + * `ObjMaterial`s. + * Supported Objs: groups + */ +#define MapMaterials(name) \ + { 37, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } -/* Map vertices from Group ID to the current Group obj, and correct any vertex indices to pointers */ -/* Supported Objs: groups */ -#define MapVertices(w1) \ - { 38, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * For all faces in the current Group, resolve their vertex indices to pointers + * to actual `ObjVertex`es. Calculate normals for all vertices in the the group + * specified by `name` + * Supported Objs: groups + */ +#define MapVertices(name) \ + { 38, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } -/* Stub command */ -/* Supported Objs: joints */ -#define Attach(w1) \ - { 39, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Stub command (does nothing). + * Supported Objs: joints + */ +#define Attach(name) \ + { 39, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } -/* Attach the current dynobj with modifications made by FLAG to Object ID */ -/* Supported Objs: joints, particles, nets, animators */ -#define AttachTo(w2, w1) \ - { 40, {(void *)(w1)}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Attach the current object to the specified object, using the specified flags. + * Supported Objs: joints, particles, nets, animators + */ +#define AttachTo(flags, name) \ + { 40, {(void *)(name)}, {(void *)(flags)}, {0.0, 0.0, 0.0} } -/* Set the offset of the attached object for the current dynobj */ -/* Supported Objs: joints, particles, nets */ +/** + * Set the point at which the current object is attached to its parent object + * Supported Objs: joints, particles, nets + */ #define SetAttachOffset(x, y, z) \ { 41, {0}, {0}, {(x), (y), (z)} } -/* Copy the C-string pointed to by PTR to the dynobj id buf */ -#define CopyStrToIdBuf(w1) \ - { 43, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * Set a "suffix" to use with dynobj names. All commands that take a name as a + * parameter will have this suffix appended to the name. + */ +#define SetNameSuffix(suffix) \ + { 43, {(void *)(suffix)}, {0}, {0.0, 0.0, 0.0} } -/* Set f32 paramter PARAM to VALUE. TODO: Enumerate parameters */ -/* Supported Objs: shapes, vertices, gadgets */ -#define SetParamF(w2, x) \ - { 44, {0}, {(void *)(w2)}, {(x), 0.0, 0.0} } +/** + * Set the float paramter `param` to `value`. + * For Shapes, the following parameters are supported: + * PARM_F_ALPHA - the alpha (opacity) of the shape + * For Gadgets, the following parameters are supported: + * PARM_F_RANGE_MIN - the minimum value of the gadget + * PARM_F_RANGE_MAX - the maximum value of the gadget + * PARM_F_VARVAL - the current value of the gadget + * For Vertices, the following parameters are supported: + * PARM_F_ALPHA - the alpha (opacity) of the vertex + * Supported Objs: shapes, vertices, gadgets + */ +#define SetParamF(param, value) \ + { 44, {0}, {(void *)(param)}, {(value), 0.0, 0.0} } -/* Set pointer paramter PARAM to PTR */ -/* Supported Objs: faces, views, labels */ -#define SetParamPtr(w2, w1) \ - { 45, {(void *)(w1)}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Set pointer paramter `param` to `value` + * For Labels, the following parameters are supported: + * PARM_PTR_CHAR - the format string for the label text + * For Views, the following parameters are supported: + * PARM_PTR_CHAR - the name of the view + * For Faces, the following parameters are supported: + * PARM_PTR_OBJ_VTX - (not actually a pointer) index of a vertex created with `MakeVertex`. + * Supported Objs: faces, views, labels */ +#define SetParamPtr(param, value) \ + { 45, {(void *)(value)}, {(void *)(param)}, {0.0, 0.0, 0.0} } -/* Create a Net and a subgroup with ID. ARG1 is not used */ -#define MakeNetWithSubGroup(w2, w1) \ - { 46, {(void *)(w1)}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Create a Net with the specified name, and add a group to it. + */ +#define MakeNetWithSubGroup(name) \ + { 46, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } -/* Make Joint ID and attach the Net created with "MakeNetWithSubGroup". ARG1 is not used */ -#define AttachNetToJoint(w2, w1) \ - { 47, {(void *)(w1)}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Make a Joint and attach it to the Net created with "MakeNetWithSubGroup". + */ +#define MakeAttachedJoint(name) \ + { 47, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } -/* Ends a net sub-Group ID that was created with "MakeNetWithSubGroup" */ -#define EndNetSubGroup(w1) \ - { 48, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +/** + * End a Net that was created with "MakeNetWithSubGroup" + */ +#define EndNetWithSubGroup(name) \ + { 48, {(void *)(name)}, {0}, {0.0, 0.0, 0.0} } -/* Add a Vertex dynobj */ +/** + * Add a Vertex dynobj + */ #define MakeVertex(x, y, z) \ { 49, {0}, {0}, {(x), (y), (z)} } -/* Add a ValPtr dynobj */ +/** + * Add a ValPtr dynobj + */ #define MakeValPtr(id, flags, type, offset) \ { 50, {(void *)(id)}, {(void *)(type)}, {(offset), (flags), 0.0} } -/* Add the texture pointed to by PTR to the current dynobj */ -/* Supported Objs: materials */ -#define UseTexture(w2) \ - { 52, {0}, {(void *)(w2)}, {0.0, 0.0, 0.0} } +/** + * Set the texture of the current Material dynobj. Note that textures are not + * actually supported. + * Supported Objs: materials + */ +#define UseTexture(texture) \ + { 52, {0}, {(void *)(texture)}, {0.0, 0.0, 0.0} } -/* Set the S and T values of the current dynobj */ -/* Supported Objs: vertices */ -#define SetTextureST(x, y) \ - { 53, {0}, {0}, {(x), (y), 0.0} } +/** + * Stub command (does nothing). + * Supported Objs: vertices + */ +#define SetTextureST(s, t) \ + { 53, {0}, {0}, {(s), (t), 0.0} } /* Make a new Net from Shape ID */ -#define MakeNetFromShapeId(w1) \ - { 54, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } +#define MakeNetFromShape(shape) \ + { 54, {(void *)(shape)}, {0}, {0.0, 0.0, 0.0} } /* Make a new Net from Shape double pointer PTR */ -#define MakeNetFromShapeDblPtr(w1) \ +#define MakeNetFromShapePtrPtr(w1) \ { 55, {(void *)(w1)}, {0}, {0.0, 0.0, 0.0} } #endif // GD_DYNLIST_MACROS_H diff --git a/src/goddard/dynlists/dynlist_mario_face.c b/src/goddard/dynlists/dynlist_mario_face.c index 262f1ca9..e742dd54 100644 --- a/src/goddard/dynlists/dynlist_mario_face.c +++ b/src/goddard/dynlists/dynlist_mario_face.c @@ -1,12 +1,11 @@ #include +#include "macros.h" #include "dynlist_macros.h" #include "dynlists.h" #include "../dynlist_proc.h" -#define VTX_NUM 440 -/* @ 04000C20 */ -static s16 mario_Face_VtxData[VTX_NUM][3] = { +static s16 mario_Face_VtxData[][3] = { { 434, 326, -209 }, { 283, 371, -268 }, { 344, 531, -97 }, { 360, 187, -363 }, { 162, -260, 265 }, { 172, -251, 175 }, { 218, -191, 287 }, { 173, 279, 296 }, { 192, 226, 279 }, { 233, 346, 216 }, { 135, -283, 182 }, { 165, -299, 114 }, @@ -119,12 +118,9 @@ static s16 mario_Face_VtxData[VTX_NUM][3] = { { -67, -114, 567 }, { 66, -114, 567 }, { 76, 126, 434 }, { -157, 46, 567 }, }; -/* @ 04001670 */ -static struct GdVtxData mario_Face_VtxInfo = { VTX_NUM, 0x1, mario_Face_VtxData }; +static struct GdVtxData mario_Face_VtxInfo = { ARRAY_COUNT(mario_Face_VtxData), 0x1, mario_Face_VtxData }; -#define FACE_NUM 877 -/* @ 0400167C */ -static u16 mario_Face_FaceData[FACE_NUM][4] = { +static u16 mario_Face_FaceData[][4] = { { 0, 43, 102, 112 }, { 0, 102, 42, 188 }, { 0, 354, 356, 188 }, { 0, 188, 198, 354 }, { 0, 198, 188, 42 }, { 0, 43, 42, 102 }, { 1, 4, 5, 6 }, { 1, 7, 8, 9 }, { 1, 10, 11, 5 }, { 1, 15, 16, 17 }, { 1, 18, 19, 20 }, { 1, 21, 22, 15 }, @@ -347,53 +343,64 @@ static u16 mario_Face_FaceData[FACE_NUM][4] = { { 7, 156, 424, 427 }, }; -/* @ 040031E4 */ -static struct GdFaceData mario_Face_FaceInfo = { FACE_NUM, 0x1, mario_Face_FaceData }; +static struct GdFaceData mario_Face_FaceInfo = { ARRAY_COUNT(mario_Face_FaceData), 0x1, mario_Face_FaceData }; -/* @ 040031F0 */ -struct DynList dynlist_mario_face[44] = { - StartList(), - MakeDynObj(D_DATA_GRP, 0xDE), - LinkWithPtr(&mario_Face_VtxInfo), - MakeDynObj(D_DATA_GRP, 0xDF), - LinkWithPtr(&mario_Face_FaceInfo), - StartGroup(0xE0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(0), - SetAmbient(1.0, 1.0, 1.0), - SetDiffuse(1.0, 1.0, 1.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(1), - SetAmbient(0.883, 0.602, 0.408), - SetDiffuse(0.883, 0.602, 0.408), - MakeDynObj(D_MATERIAL, 0x0), - SetId(2), - SetAmbient(0.362, 0.0, 0.0), - SetDiffuse(0.362, 0.0, 0.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(3), - SetAmbient(1.0, 1.0, 1.0), - SetDiffuse(1.0, 1.0, 1.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(4), - SetAmbient(1.0, 1.0, 1.0), - SetDiffuse(1.0, 1.0, 1.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(5), - SetAmbient(0.362, 0.0, 0.0), - SetDiffuse(0.362, 0.0, 0.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(6), - SetAmbient(0.526, 0.0, 0.0), - SetDiffuse(0.526, 0.0, 0.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(7), - SetAmbient(1.0, 0.0, 0.0), - SetDiffuse(1.0, 0.0, 0.0), - EndGroup(0xE0), - MakeDynObj(D_SHAPE, 0xE1), - SetNodeGroup(0xDE), - SetPlaneGroup(0xDF), - SetMaterialGroup(0xE0), - StopList(), +struct DynList dynlist_mario_face_shape[] = { + BeginList(), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_FACE_VTX_GROUP), + LinkWithPtr(&mario_Face_VtxInfo), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_FACE_TRI_GROUP), + LinkWithPtr(&mario_Face_FaceInfo), + + StartGroup(DYNOBJ_MARIO_FACE_MTL_GROUP), + // Teeth color + MakeDynObj(D_MATERIAL, 0), + SetId(0), + SetAmbient(1.0, 1.0, 1.0), + SetDiffuse(1.0, 1.0, 1.0), + // Face color + MakeDynObj(D_MATERIAL, 0), + SetId(1), + SetAmbient(0.883, 0.602, 0.408), + SetDiffuse(0.883, 0.602, 0.408), + // Shadow on back of hat + MakeDynObj(D_MATERIAL, 0), + SetId(2), + SetAmbient(0.362, 0.0, 0.0), + SetDiffuse(0.362, 0.0, 0.0), + // Cap emblem color + MakeDynObj(D_MATERIAL, 0), + SetId(3), + SetAmbient(1.0, 1.0, 1.0), + SetDiffuse(1.0, 1.0, 1.0), + // Eye color + MakeDynObj(D_MATERIAL, 0), + SetId(4), + SetAmbient(1.0, 1.0, 1.0), + SetDiffuse(1.0, 1.0, 1.0), + // Hair color + MakeDynObj(D_MATERIAL, 0), + SetId(5), + SetAmbient(0.362, 0.0, 0.0), + SetDiffuse(0.362, 0.0, 0.0), + // Mouth color + MakeDynObj(D_MATERIAL, 0), + SetId(6), + SetAmbient(0.526, 0.0, 0.0), + SetDiffuse(0.526, 0.0, 0.0), + // Cap color + MakeDynObj(D_MATERIAL, 0), + SetId(7), + SetAmbient(1.0, 0.0, 0.0), + SetDiffuse(1.0, 0.0, 0.0), + EndGroup(DYNOBJ_MARIO_FACE_MTL_GROUP), + + MakeDynObj(D_SHAPE, DYNOBJ_MARIO_FACE_SHAPE), + SetNodeGroup(DYNOBJ_MARIO_FACE_VTX_GROUP), + SetPlaneGroup(DYNOBJ_MARIO_FACE_TRI_GROUP), + SetMaterialGroup(DYNOBJ_MARIO_FACE_MTL_GROUP), + + EndList(), }; diff --git a/src/goddard/dynlists/dynlist_mario_master.c b/src/goddard/dynlists/dynlist_mario_master.c index 9c321343..6a5b19ca 100644 --- a/src/goddard/dynlists/dynlist_mario_master.c +++ b/src/goddard/dynlists/dynlist_mario_master.c @@ -6,1058 +6,1118 @@ #include "../dynlist_proc.h" #include "../shape_helper.h" -/* @ 04004F90 */ -struct DynList dynlist_mario_master[1026] = { - StartList(), - UseIntId(TRUE), - StartGroup(0x3E8), - JumpToList(dynlist_mario_face), - JumpToList(dynlist_mario_eye_right), - JumpToList(dynlist_mario_eye_left), - JumpToList(dynlist_mario_eyebrow_right), - JumpToList(dynlist_mario_eyebrow_left), - JumpToList(dynlist_mario_mustache), - EndGroup(0x3E8), - MakeDynObj(D_LIGHT, 0xE4), - SetId(1), - SetDiffuse(1.0, 1.0, 1.0), - SetFlag(0x20), - SetShapePtrPtr(&gShapeSilverStar), - MakeDynObj(D_LIGHT, 0xE7), - SetId(0), - SetDiffuse(1.0, 0.0, 0.0), - SetShapePtrPtr(&gShapeRedStar), +struct DynList dynlist_mario_master[] = { + BeginList(), + UseIntegerNames(TRUE), // Specify all object names as integers + + StartGroup(DYNOBJ_MARIO_MAIN_SHAPES_GROUP), + CallList(dynlist_mario_face_shape), + CallList(dynlist_mario_eye_right_shape), + CallList(dynlist_mario_eye_left_shape), + CallList(dynlist_mario_eyebrow_right_shape), + CallList(dynlist_mario_eyebrow_left_shape), + CallList(dynlist_mario_mustache_shape), + EndGroup(DYNOBJ_MARIO_MAIN_SHAPES_GROUP), + + MakeDynObj(D_LIGHT, DYNOBJ_SILVER_STAR_LIGHT), + SetId(1), + SetDiffuse(1.0, 1.0, 1.0), + SetFlag(0x20), + SetShapePtrPtr(&gShapeSilverStar), + + MakeDynObj(D_LIGHT, DYNOBJ_RED_STAR_LIGHT), + SetId(0), + SetDiffuse(1.0, 0.0, 0.0), + SetShapePtrPtr(&gShapeRedStar), + StartGroup(0x1), - MakeDynObj(D_NET, 0xDD), - SetType(2), - SetFlag(0x2), - SetShapePtr(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(112.873, 0.0, 0.0), - SetAttachOffset(0.0, 0.0, -20010.0), - MakeNetWithSubGroup(0, 0xDA), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 90.0, 0.0), - SetAttachOffset(116.3, 182.6, -70.2), - AttachNetToJoint(0, 0xD7), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 162.007), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(7, 95.0), - SetSkinWeight(8, 70.0), - SetSkinWeight(48, 90.0), - SetSkinWeight(49, 100.0), - SetSkinWeight(128, 60.0), - SetSkinWeight(131, 90.0), - SetSkinWeight(132, 100.0), - SetSkinWeight(133, 95.0), - SetSkinWeight(134, 70.0), - SetSkinWeight(428, 50.0), - SetSkinWeight(429, 20.0), - SetSkinWeight(51, 35.0), - SetSkinWeight(124, 10.0), - SetSkinWeight(126, 10.0), - SetSkinWeight(127, 5.0), - SetSkinWeight(130, 50.0), - SetSkinWeight(135, 20.0), - SetSkinWeight(136, 10.0), - SetSkinWeight(423, 35.0), - SetSkinWeight(46, 40.0), - SetSkinWeight(47, 10.0), - SetSkinWeight(82, 10.0), - AttachNetToJoint(0, 0xD4), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(382.3, 0.0, 0.0), - EndNetSubGroup(0xDA), - MakeNetWithSubGroup(0, 0xD1), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 90.0, 0.0), - SetAttachOffset(-116.3, 182.6, -70.2), - AttachNetToJoint(0, 0xCE), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 162.007), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(196, 90.0), - SetSkinWeight(375, 70.0), - SetSkinWeight(392, 70.0), - SetSkinWeight(393, 95.0), - SetSkinWeight(394, 95.0), - SetSkinWeight(395, 100.0), - SetSkinWeight(396, 100.0), - SetSkinWeight(397, 90.0), - SetSkinWeight(399, 60.0), - SetSkinWeight(428, 50.0), - SetSkinWeight(429, 20.0), - SetSkinWeight(197, 50.0), - SetSkinWeight(385, 5.0), - SetSkinWeight(388, 10.0), - SetSkinWeight(389, 10.0), - SetSkinWeight(390, 20.0), - SetSkinWeight(391, 35.0), - SetSkinWeight(398, 10.0), - SetSkinWeight(419, 35.0), - SetSkinWeight(400, 40.0), - SetSkinWeight(374, 10.0), - SetSkinWeight(387, 10.0), - AttachNetToJoint(0, 0xCB), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(420.0, 0.0, 0.0), - EndNetSubGroup(0xD1), - MakeNetWithSubGroup(0, 0xC8), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 90.0, 0.0), - SetAttachOffset(0.0, -154.9, 118.5), - AttachNetToJoint(0, 0xC5), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, -111.558), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(98, 100.0), - SetSkinWeight(104, 100.0), - SetSkinWeight(189, 100.0), - SetSkinWeight(358, 100.0), - SetSkinWeight(5, 40.0), - SetSkinWeight(10, 38.0), - SetSkinWeight(380, 40.0), - SetSkinWeight(405, 38.0), - SetSkinWeight(39, 50.0), - SetSkinWeight(117, 50.0), - SetSkinWeight(337, 50.0), - SetSkinWeight(11, 40.0), - SetSkinWeight(379, 40.0), - SetSkinWeight(105, 50.0), - SetSkinWeight(116, 50.0), - SetSkinWeight(406, 50.0), - SetSkinWeight(85, 70.0), - SetSkinWeight(86, 60.0), - SetSkinWeight(111, 30.0), - SetSkinWeight(159, 50.0), - SetSkinWeight(357, 50.0), - SetSkinWeight(416, 60.0), - SetSkinWeight(6, 25.0), - SetSkinWeight(407, 25.0), - SetSkinWeight(408, 30.0), - SetSkinWeight(4, 30.0), - SetSkinWeight(410, 70.0), - SetSkinWeight(409, 30.0), - SetSkinWeight(109, 15.0), - SetSkinWeight(355, 15.0), - SetSkinWeight(35, 5.0), - SetSkinWeight(372, 5.0), - SetSkinWeight(376, 5.0), - SetSkinWeight(110, 5.0), - SetSkinWeight(16, 3.0), - SetSkinWeight(17, 3.0), - SetSkinWeight(34, 3.0), - SetSkinWeight(373, 3.0), - SetSkinWeight(381, 3.0), - SetSkinWeight(383, 3.0), - AttachNetToJoint(0, 0xC2), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, -31.153), - SetAttachOffset(141.0, 0.0, 0.0), - SetSkinWeight(31, 80.0), - SetSkinWeight(32, 80.0), - SetSkinWeight(39, 30.0), - SetSkinWeight(40, 10.0), - SetSkinWeight(99, 100.0), - SetSkinWeight(100, 100.0), - SetSkinWeight(105, 50.0), - SetSkinWeight(113, 100.0), - SetSkinWeight(114, 100.0), - SetSkinWeight(115, 100.0), - SetSkinWeight(116, 50.0), - SetSkinWeight(117, 20.0), - SetSkinWeight(177, 20.0), - SetSkinWeight(336, 10.0), - SetSkinWeight(337, 30.0), - SetSkinWeight(406, 50.0), - SetSkinWeight(411, 80.0), - SetSkinWeight(412, 100.0), - SetSkinWeight(413, 100.0), - SetSkinWeight(414, 100.0), - SetSkinWeight(415, 80.0), - SetSkinWeight(418, 100.0), - SetSkinWeight(409, 28.0), - SetSkinWeight(86, 8.0), - SetSkinWeight(416, 4.0), - SetSkinWeight(4, 28.0), - SetSkinWeight(5, 3.0), - SetSkinWeight(10, 5.0), - SetSkinWeight(380, 5.0), - SetSkinWeight(405, 5.0), - AttachNetToJoint(0, 0xBF), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(80.1, 0.0, 0.0), - EndNetSubGroup(0xC8), - MakeNetWithSubGroup(0, 0xBC), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 90.0, 0.0), - SetAttachOffset(0.0, 15.3, 295.1), - AttachNetToJoint(0, 0xB9), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, -178.586), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(15, 5.0), - SetSkinWeight(18, 30.0), - SetSkinWeight(23, 70.0), - SetSkinWeight(24, 40.0), - SetSkinWeight(25, 90.0), - SetSkinWeight(26, 70.0), - SetSkinWeight(27, 90.0), - SetSkinWeight(28, 40.0), - SetSkinWeight(29, 70.0), - SetSkinWeight(30, 90.0), - SetSkinWeight(41, 70.0), - SetSkinWeight(160, 70.0), - SetSkinWeight(161, 100.0), - SetSkinWeight(182, 90.0), - SetSkinWeight(183, 90.0), - SetSkinWeight(346, 70.0), - SetSkinWeight(347, 30.0), - SetSkinWeight(348, 70.0), - SetSkinWeight(349, 40.0), - SetSkinWeight(350, 30.0), - SetSkinWeight(351, 70.0), - SetSkinWeight(352, 90.0), - SetSkinWeight(353, 5.0), - SetSkinWeight(386, 5.0), - SetSkinWeight(430, 70.0), - SetSkinWeight(431, 70.0), - SetSkinWeight(433, 70.0), - SetSkinWeight(434, 70.0), - SetSkinWeight(435, 70.0), - SetSkinWeight(436, 70.0), - SetSkinWeight(437, 70.0), - SetSkinWeight(439, 70.0), - SetSkinWeight(19, 40.0), - SetSkinWeight(20, 5.0), - SetSkinWeight(21, 5.0), - SetSkinWeight(22, 30.0), - SetSkinWeight(82, 5.0), - SetSkinWeight(83, 5.0), - SetSkinWeight(87, 5.0), - SetSkinWeight(384, 5.0), - SetSkinWeight(387, 5.0), - SetSkinWeight(432, 40.0), - SetSkinWeight(438, 40.0), - AttachNetToJoint(0, 0xB6), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(276.6, 0.0, 0.0), - EndNetSubGroup(0xBC), - MakeNetWithSubGroup(0, 0xB3), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(-90.0, 0.0, 0.0), - SetAttachOffset(294.7, 13.1, -82.1), - AttachNetToJoint(0, 0xB0), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 26.565), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(59, 80.0), - SetSkinWeight(60, 50.0), - SetSkinWeight(61, 60.0), - SetSkinWeight(65, 100.0), - SetSkinWeight(66, 60.0), - SetSkinWeight(88, 10.0), - SetSkinWeight(89, 60.0), - SetSkinWeight(90, 80.0), - SetSkinWeight(91, 70.0), - SetSkinWeight(92, 100.0), - SetSkinWeight(118, 15.0), - SetSkinWeight(119, 5.0), - SetSkinWeight(120, 15.0), - SetSkinWeight(122, 60.0), - SetSkinWeight(123, 70.0), - SetSkinWeight(137, 10.0), - SetSkinWeight(138, 60.0), - SetSkinWeight(139, 10.0), - SetSkinWeight(140, 5.0), - SetSkinWeight(141, 10.0), - SetSkinWeight(167, 60.0), - SetSkinWeight(168, 70.0), - SetSkinWeight(224, 50.0), - SetSkinWeight(225, 70.0), - SetSkinWeight(226, 50.0), - SetSkinWeight(227, 50.0), - SetSkinWeight(228, 60.0), - SetSkinWeight(229, 60.0), - SetSkinWeight(235, 10.0), - AttachNetToJoint(0, 0xAD), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(200.9, 0.0, 0.0), - EndNetSubGroup(0xB3), - MakeNetWithSubGroup(0, 0xAA), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(90.0, 180.0, 0.0), - SetAttachOffset(-294.7, 13.1, -82.1), - AttachNetToJoint(0, 0xA7), - SetScale(1.0, 1.0, 1.0), - SetRotation(180.0, 180.0, -153.435), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(244, 5.0), - SetSkinWeight(267, 5.0), - SetSkinWeight(268, 5.0), - SetSkinWeight(299, 5.0), - SetSkinWeight(302, 5.0), - SetSkinWeight(307, 70.0), - SetSkinWeight(308, 70.0), - SetSkinWeight(309, 100.0), - SetSkinWeight(310, 70.0), - SetSkinWeight(311, 70.0), - SetSkinWeight(314, 100.0), - SetSkinWeight(315, 70.0), - SetSkinWeight(317, 80.0), - SetSkinWeight(318, 70.0), - SetSkinWeight(319, 80.0), - SetSkinWeight(320, 70.0), - SetSkinWeight(321, 10.0), - SetSkinWeight(322, 10.0), - SetSkinWeight(323, 10.0), - SetSkinWeight(324, 10.0), - SetSkinWeight(325, 60.0), - SetSkinWeight(326, 100.0), - SetSkinWeight(327, 100.0), - SetSkinWeight(328, 100.0), - SetSkinWeight(329, 80.0), - SetSkinWeight(330, 80.0), - SetSkinWeight(331, 60.0), - SetSkinWeight(332, 70.0), - SetSkinWeight(340, 70.0), - AttachNetToJoint(0, 0xA4), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.02), - SetAttachOffset(200.9, 0.0, 0.0), - EndNetSubGroup(0xAA), - MakeNetWithSubGroup(0, 0xA1), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(-90.0, 0.0, 0.0), - SetAttachOffset(119.7, -161.4, 125.5), - AttachNetToJoint(0, 0x9E), - SetScale(1.0, 1.0, 1.0), - SetRotation(-0.02, 0.0, -66.509), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(4, 42.0), - SetSkinWeight(5, 40.0), - SetSkinWeight(6, 75.0), - SetSkinWeight(10, 30.0), - SetSkinWeight(11, 40.0), - SetSkinWeight(16, 20.0), - SetSkinWeight(17, 15.0), - SetSkinWeight(33, 30.0), - SetSkinWeight(34, 20.0), - SetSkinWeight(35, 60.0), - SetSkinWeight(37, 10.0), - SetSkinWeight(43, 40.0), - SetSkinWeight(85, 30.0), - SetSkinWeight(86, 30.0), - SetSkinWeight(93, 30.0), - SetSkinWeight(94, 10.0), - SetSkinWeight(101, 100.0), - SetSkinWeight(103, 100.0), - SetSkinWeight(108, 10.0), - SetSkinWeight(109, 70.0), - SetSkinWeight(110, 80.0), - SetSkinWeight(111, 60.0), - SetSkinWeight(112, 70.0), - SetSkinWeight(159, 50.0), - SetSkinWeight(42, 30.0), - SetSkinWeight(102, 30.0), - SetSkinWeight(31, 20.0), - SetSkinWeight(32, 20.0), - SetSkinWeight(44, 15.0), - AttachNetToJoint(0, 0x9B), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.028, 0.0, 0.0), - SetAttachOffset(184.5, 0.0, 0.0), - EndNetSubGroup(0xA1), - MakeNetWithSubGroup(0, 0x98), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(90.0, 180.0, 0.0), - SetAttachOffset(-119.7, -161.4, 125.5), - AttachNetToJoint(0, 0x95), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.02, 0.0, -66.509), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(187, 100.0), - SetSkinWeight(273, 30.0), - SetSkinWeight(342, 10.0), - SetSkinWeight(354, 40.0), - SetSkinWeight(355, 70.0), - SetSkinWeight(356, 70.0), - SetSkinWeight(357, 50.0), - SetSkinWeight(371, 10.0), - SetSkinWeight(372, 60.0), - SetSkinWeight(373, 20.0), - SetSkinWeight(376, 80.0), - SetSkinWeight(377, 100.0), - SetSkinWeight(378, 10.0), - SetSkinWeight(379, 40.0), - SetSkinWeight(380, 30.0), - SetSkinWeight(381, 15.0), - SetSkinWeight(383, 20.0), - SetSkinWeight(404, 30.0), - SetSkinWeight(405, 30.0), - SetSkinWeight(407, 75.0), - SetSkinWeight(408, 60.0), - SetSkinWeight(409, 42.0), - SetSkinWeight(410, 30.0), - SetSkinWeight(416, 36.0), - SetSkinWeight(199, 15.0), - SetSkinWeight(415, 20.0), - SetSkinWeight(411, 20.0), - SetSkinWeight(188, 20.0), - SetSkinWeight(198, 20.0), - AttachNetToJoint(0, 0x92), - SetScale(1.0, 1.0, 1.0), - SetRotation(-0.028, 0.0, 0.0), - SetAttachOffset(184.5, 0.0, 0.0), - EndNetSubGroup(0x98), - MakeNetWithSubGroup(0, 0x8F), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 90.0, 0.0), - SetAttachOffset(0.0, -162.2, 121.0), - AttachNetToJoint(0, 0x8C), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, -176.775), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(42, 70.0), - SetSkinWeight(44, 85.0), - SetSkinWeight(102, 70.0), - SetSkinWeight(188, 80.0), - SetSkinWeight(198, 80.0), - SetSkinWeight(199, 85.0), - AttachNetToJoint(0, 0x89), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(242.8, 0.0, 0.0), - EndNetSubGroup(0x8F), - MakeNetWithSubGroup(0, 0x86), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 90.0, 0.0), - SetAttachOffset(0.0, 233.8, -148.8), - AttachNetToJoint(0, 0x83), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 153.932), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(68, 90.0), - SetSkinWeight(69, 100.0), - SetSkinWeight(70, 100.0), - SetSkinWeight(71, 100.0), - SetSkinWeight(75, 100.0), - SetSkinWeight(76, 100.0), - SetSkinWeight(77, 100.0), - SetSkinWeight(79, 80.0), - SetSkinWeight(129, 100.0), - SetSkinWeight(147, 90.0), - SetSkinWeight(148, 90.0), - SetSkinWeight(149, 100.0), - SetSkinWeight(150, 100.0), - SetSkinWeight(151, 100.0), - SetSkinWeight(154, 100.0), - SetSkinWeight(155, 100.0), - SetSkinWeight(156, 100.0), - SetSkinWeight(157, 100.0), - SetSkinWeight(184, 100.0), - SetSkinWeight(185, 100.0), - SetSkinWeight(192, 100.0), - SetSkinWeight(193, 90.0), - SetSkinWeight(194, 80.0), - SetSkinWeight(195, 100.0), - SetSkinWeight(201, 100.0), - SetSkinWeight(202, 100.0), - SetSkinWeight(230, 100.0), - SetSkinWeight(360, 100.0), - SetSkinWeight(361, 100.0), - SetSkinWeight(362, 100.0), - SetSkinWeight(363, 100.0), - SetSkinWeight(364, 100.0), - SetSkinWeight(366, 100.0), - SetSkinWeight(367, 90.0), - SetSkinWeight(368, 100.0), - SetSkinWeight(369, 90.0), - SetSkinWeight(420, 100.0), - SetSkinWeight(421, 100.0), - SetSkinWeight(422, 100.0), - SetSkinWeight(424, 100.0), - SetSkinWeight(425, 100.0), - SetSkinWeight(426, 100.0), - SetSkinWeight(427, 100.0), - SetSkinWeight(58, 100.0), - SetSkinWeight(242, 100.0), - SetSkinWeight(0, 100.0), - SetSkinWeight(1, 100.0), - SetSkinWeight(2, 80.0), - SetSkinWeight(9, 100.0), - SetSkinWeight(50, 100.0), - SetSkinWeight(54, 100.0), - SetSkinWeight(55, 100.0), - SetSkinWeight(56, 100.0), - SetSkinWeight(57, 100.0), - SetSkinWeight(67, 80.0), - SetSkinWeight(78, 90.0), - SetSkinWeight(80, 100.0), - SetSkinWeight(121, 100.0), - SetSkinWeight(142, 50.0), - SetSkinWeight(145, 80.0), - SetSkinWeight(146, 100.0), - SetSkinWeight(152, 90.0), - SetSkinWeight(158, 90.0), - SetSkinWeight(186, 100.0), - SetSkinWeight(240, 80.0), - SetSkinWeight(246, 100.0), - SetSkinWeight(247, 100.0), - SetSkinWeight(248, 50.0), - SetSkinWeight(249, 90.0), - SetSkinWeight(251, 100.0), - SetSkinWeight(303, 90.0), - SetSkinWeight(304, 100.0), - SetSkinWeight(305, 100.0), - SetSkinWeight(306, 100.0), - SetSkinWeight(335, 100.0), - SetSkinWeight(338, 100.0), - SetSkinWeight(345, 100.0), - SetSkinWeight(359, 90.0), - SetSkinWeight(365, 100.0), - SetSkinWeight(370, 80.0), - SetSkinWeight(401, 100.0), - SetSkinWeight(402, 100.0), - SetSkinWeight(403, 100.0), - SetSkinWeight(417, 80.0), - SetSkinWeight(125, 60.0), - SetSkinWeight(143, 50.0), - SetSkinWeight(270, 50.0), - SetSkinWeight(294, 60.0), - SetSkinWeight(239, 50.0), - SetSkinWeight(245, 50.0), - AttachNetToJoint(0, 0x80), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(528.3, 0.0, 0.0), - EndNetSubGroup(0x86), - MakeNetWithSubGroup(0, 0x7D), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(90.0, 180.0, 0.0), - SetAttachOffset(29.7, 192.4, -3.0), - AttachNetToJoint(0, 0x7A), - SetScale(1.0, 1.0, 1.0), - SetRotation(184.483, -178.885, 82.485), - SetAttachOffset(0.0, 0.0, 0.0), - AttachNetToJoint(0, 0x77), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(329.8, 0.0, 0.0), - EndNetSubGroup(0x7D), - MakeDynObj(D_NET, 0x70), - SetType(3), - SetShapePtr(0x74), - AttachTo(0xd, 0x7A), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(0.0, 0.0, 0.0), - MakeNetWithSubGroup(0, 0x6D), - AttachTo(0xd, 0xDD), - SetSkinShape(0xE1), - SetScale(1.0, 1.0, 1.0), - SetRotation(-90.0, 0.0, 0.0), - SetAttachOffset(-29.0, 192.3, -2.0), - AttachNetToJoint(0, 0x6A), - SetScale(1.0, 1.0, 1.0), - SetRotation(-6.873, 0.206, -97.461), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(429, 16.0), - AttachNetToJoint(0, 0x67), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(329.8, 0.0, 0.0), - EndNetSubGroup(0x6D), - MakeDynObj(D_NET, 0x60), - SetType(3), - SetShapePtr(0x64), - AttachTo(0xd, 0x6A), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(0.0, 0.0, 0.0), - MakeDynObj(D_NET, 0x59), - SetType(2), - SetShapePtr(0x5D), - AttachTo(0xd, 0xDD), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(20.8, 0.0, -8.5), - MakeNetWithSubGroup(0, 0x56), - AttachTo(0xd, 0x59), - SetSkinShape(0x5D), - SetScale(1.0, 1.0, 1.0), - SetRotation(-90.0, 90.0, -90.0), - SetAttachOffset(231.3, 287.1, -51.4), - AttachNetToJoint(0, 0x53), - SetScale(1.0, 1.0, 1.0), - SetRotation(10.886, 0.0, 177.51), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(5, 70.0), - SetSkinWeight(6, 80.0), - SetSkinWeight(7, 70.0), - SetSkinWeight(8, 50.0), - SetSkinWeight(11, 70.0), - SetSkinWeight(12, 100.0), - SetSkinWeight(19, 50.0), - SetSkinWeight(20, 80.0), - SetSkinWeight(23, 70.0), - AttachNetToJoint(0, 0x50), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(345.5, 0.0, 0.0), - EndNetSubGroup(0x56), - MakeNetWithSubGroup(0, 0x4D), - AttachTo(0xd, 0x59), - SetSkinShape(0x5D), - SetScale(1.0, 1.0, 1.0), - SetRotation(-90.0, 90.0, -90.0), - SetAttachOffset(23.0, 305.5, -44.6), - AttachNetToJoint(0, 0x4A), - SetScale(1.0, 1.0, 1.0), - SetRotation(-3.437, -0.069, -177.758), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(16, 80.0), - SetSkinWeight(17, 100.0), - SetSkinWeight(18, 80.0), - SetSkinWeight(22, 70.0), - SetSkinWeight(24, 50.0), - SetSkinWeight(25, 80.0), - SetSkinWeight(15, 30.0), - AttachNetToJoint(0, 0x47), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(399.5, 0.0, 0.0), - EndNetSubGroup(0x4D), - MakeNetWithSubGroup(0, 0x44), - AttachTo(0xd, 0x59), - SetSkinShape(0x5D), - SetScale(1.0, 1.0, 1.0), - SetRotation(-90.0, 90.0, -90.0), - SetAttachOffset(123.1, 385.5, -46.4), - AttachNetToJoint(0, 0x41), - SetScale(1.0, 1.0, 1.0), - SetRotation(2.865, 0.029, 182.377), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(0, 100.0), - SetSkinWeight(1, 100.0), - SetSkinWeight(2, 100.0), - SetSkinWeight(3, 100.0), - SetSkinWeight(4, 100.0), - SetSkinWeight(9, 100.0), - SetSkinWeight(10, 100.0), - SetSkinWeight(13, 100.0), - SetSkinWeight(14, 100.0), - SetSkinWeight(15, 70.0), - SetSkinWeight(21, 100.0), - SetSkinWeight(16, 20.0), - SetSkinWeight(18, 20.0), - SetSkinWeight(22, 30.0), - SetSkinWeight(25, 20.0), - SetSkinWeight(6, 20.0), - SetSkinWeight(11, 30.0), - SetSkinWeight(20, 20.0), - SetSkinWeight(23, 30.0), - SetSkinWeight(5, 30.0), - SetSkinWeight(7, 30.0), - SetSkinWeight(8, 50.0), - SetSkinWeight(19, 50.0), - SetSkinWeight(24, 50.0), - AttachNetToJoint(0, 0x3E), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(388.6, 0.0, 0.0), - EndNetSubGroup(0x44), - MakeDynObj(D_NET, 0x37), - SetType(2), - SetShapePtr(0x3B), - AttachTo(0xd, 0xDD), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(-18.5, 0.0, -1.0), - MakeNetWithSubGroup(0, 0x34), - AttachTo(0xd, 0x37), - SetSkinShape(0x3B), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 90.0, 0.0), - SetAttachOffset(-233.6, 287.1, -51.4), - AttachNetToJoint(0, 0x31), - SetScale(1.0, 1.0, 1.0), - SetRotation(-6.876, 0.0, 177.51), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(9, 100.0), - SetSkinWeight(10, 80.0), - SetSkinWeight(11, 80.0), - SetSkinWeight(13, 80.0), - SetSkinWeight(14, 80.0), - SetSkinWeight(18, 60.0), - SetSkinWeight(21, 60.0), - SetSkinWeight(25, 60.0), - AttachNetToJoint(0, 0x2E), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(345.5, 0.0, 0.0), - EndNetSubGroup(0x34), - MakeNetWithSubGroup(0, 0x2B), - AttachTo(0xd, 0x37), - SetSkinShape(0x3B), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 90.0, 0.0), - SetAttachOffset(-25.3, 305.5, -44.6), - AttachNetToJoint(0, 0x28), - SetScale(1.0, 1.0, 1.0), - SetRotation(-9.733, -0.388, -177.186), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(0, 70.0), - SetSkinWeight(1, 100.0), - SetSkinWeight(2, 70.0), - SetSkinWeight(3, 70.0), - SetSkinWeight(5, 50.0), - SetSkinWeight(12, 70.0), - SetSkinWeight(19, 30.0), - SetSkinWeight(15, 30.0), - AttachNetToJoint(0, 0x25), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(399.5, 0.0, 0.0), - EndNetSubGroup(0x2B), - MakeNetWithSubGroup(0, 0x22), - AttachTo(0xd, 0x37), - SetSkinShape(0x3B), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 90.0, 0.0), - SetAttachOffset(-125.4, 385.5, -46.4), - AttachNetToJoint(0, 0x1F), - SetScale(1.0, 1.0, 1.0), - SetRotation(-8.004, -0.61, 181.847), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(4, 70.0), - SetSkinWeight(6, 100.0), - SetSkinWeight(7, 100.0), - SetSkinWeight(8, 80.0), - SetSkinWeight(15, 70.0), - SetSkinWeight(16, 80.0), - SetSkinWeight(17, 100.0), - SetSkinWeight(19, 70.0), - SetSkinWeight(20, 80.0), - SetSkinWeight(22, 80.0), - SetSkinWeight(23, 60.0), - SetSkinWeight(24, 100.0), - SetSkinWeight(5, 50.0), - SetSkinWeight(0, 30.0), - SetSkinWeight(2, 30.0), - SetSkinWeight(10, 20.0), - SetSkinWeight(11, 20.0), - SetSkinWeight(13, 20.0), - SetSkinWeight(14, 20.0), - SetSkinWeight(18, 40.0), - SetSkinWeight(21, 40.0), - SetSkinWeight(25, 40.0), - SetSkinWeight(3, 30.0), - SetSkinWeight(12, 30.0), - AttachNetToJoint(0, 0x1C), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(388.6, 0.0, 0.0), - EndNetSubGroup(0x22), - MakeDynObj(D_NET, 0x15), - SetType(2), - SetShapePtr(0x19), - AttachTo(0xd, 0xDD), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.02, -0.002, 0.04), - SetAttachOffset(0.0, 0.0, 0.0), - MakeNetWithSubGroup(0, 0x12), - AttachTo(0xd, 0x15), - SetSkinShape(0x19), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 180.0, 0.0), - SetAttachOffset(4.2, -86.5, 415.5), - AttachNetToJoint(0, 0xF), - SetScale(1.0, 1.0, 1.0), - SetRotation(-179.98, -164.53, -29.34), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(3, 50.0), - SetSkinWeight(4, 50.0), - SetSkinWeight(5, 50.0), - SetSkinWeight(11, 70.0), - SetSkinWeight(12, 80.0), - SetSkinWeight(13, 70.0), - SetSkinWeight(18, 80.0), - SetSkinWeight(19, 80.0), - SetSkinWeight(20, 80.0), - SetSkinWeight(21, 100.0), - SetSkinWeight(22, 100.0), - SetSkinWeight(23, 100.0), - SetSkinWeight(25, 100.0), - SetSkinWeight(27, 100.0), - SetSkinWeight(28, 50.0), - SetSkinWeight(29, 40.0), - SetSkinWeight(30, 40.0), - SetSkinWeight(31, 100.0), - SetSkinWeight(36, 50.0), - SetSkinWeight(37, 50.0), - SetSkinWeight(42, 40.0), - SetSkinWeight(45, 50.0), - SetSkinWeight(46, 50.0), - SetSkinWeight(47, 80.0), - SetSkinWeight(50, 40.0), - SetSkinWeight(51, 100.0), - SetSkinWeight(53, 40.0), - SetSkinWeight(54, 80.0), - AttachNetToJoint(0, 0xC), - SetScale(1.0, 1.0, 1.0), - SetRotation(-0.028, 0.0, 0.02), - SetAttachOffset(292.7, 0.0, 0.0), - EndNetSubGroup(0x12), - MakeNetWithSubGroup(0, 0x9), - AttachTo(0xd, 0x15), - SetSkinShape(0x19), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(-4.2, -86.5, 415.5), - AttachNetToJoint(0, 0x6), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 15.47, 150.66), - SetAttachOffset(0.0, 0.0, 0.0), - SetSkinWeight(0, 100.0), - SetSkinWeight(1, 80.0), - SetSkinWeight(2, 80.0), - SetSkinWeight(6, 100.0), - SetSkinWeight(7, 100.0), - SetSkinWeight(8, 50.0), - SetSkinWeight(9, 50.0), - SetSkinWeight(10, 50.0), - SetSkinWeight(14, 50.0), - SetSkinWeight(15, 50.0), - SetSkinWeight(16, 50.0), - SetSkinWeight(17, 80.0), - SetSkinWeight(24, 100.0), - SetSkinWeight(26, 100.0), - SetSkinWeight(32, 80.0), - SetSkinWeight(33, 100.0), - SetSkinWeight(34, 70.0), - SetSkinWeight(35, 50.0), - SetSkinWeight(38, 40.0), - SetSkinWeight(39, 40.0), - SetSkinWeight(40, 40.0), - SetSkinWeight(41, 50.0), - SetSkinWeight(43, 50.0), - SetSkinWeight(44, 50.0), - SetSkinWeight(48, 80.0), - SetSkinWeight(49, 70.0), - SetSkinWeight(52, 40.0), - SetSkinWeight(55, 80.0), - AttachNetToJoint(0, 0x3), - SetScale(1.0, 1.0, 1.0), - SetRotation(0.0, 0.0, 0.0), - SetAttachOffset(292.7, 0.0, 0.0), - EndNetSubGroup(0x9), - MakeDynObj(D_DATA_GRP, 0x7), // mustache right - LinkWithPtr(&anim_mario_mustache_right), - MakeDynObj(D_ANIMATOR, 0x8), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x7), - LinkWith(0x6), + MakeDynObj(D_NET, DYNOBJ_MARIO_MAIN_NET), + SetType(2), + SetFlag(0x2), + SetShapePtr(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(112.873, 0.0, 0.0), + SetAttachOffset(0.0, 0.0, -20010.0), - MakeDynObj(D_DATA_GRP, 0x10), // mustache left - LinkWithPtr(&anim_mario_mustache_left), - MakeDynObj(D_ANIMATOR, 0x11), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x10), - LinkWith(0xF), + // right eyelid skinning + MakeNetWithSubGroup(DYNOBJ_RIGHT_EYELID_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 90.0, 0.0), + SetAttachOffset(116.3, 182.6, -70.2), + MakeAttachedJoint(DYNOBJ_RIGHT_EYELID_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 162.007), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(7, 95.0), + SetSkinWeight(8, 70.0), + SetSkinWeight(48, 90.0), + SetSkinWeight(49, 100.0), + SetSkinWeight(128, 60.0), + SetSkinWeight(131, 90.0), + SetSkinWeight(132, 100.0), + SetSkinWeight(133, 95.0), + SetSkinWeight(134, 70.0), + SetSkinWeight(428, 50.0), + SetSkinWeight(429, 20.0), + SetSkinWeight(51, 35.0), + SetSkinWeight(124, 10.0), + SetSkinWeight(126, 10.0), + SetSkinWeight(127, 5.0), + SetSkinWeight(130, 50.0), + SetSkinWeight(135, 20.0), + SetSkinWeight(136, 10.0), + SetSkinWeight(423, 35.0), + SetSkinWeight(46, 40.0), + SetSkinWeight(47, 10.0), + SetSkinWeight(82, 10.0), + MakeAttachedJoint(DYNOBJ_RIGHT_EYELID_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(382.3, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_RIGHT_EYELID_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x20), // lips - LinkWithPtr(&anim_mario_lips_1), - MakeDynObj(D_ANIMATOR, 0x21), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x20), - LinkWith(0x1F), + // left eyelid skinning + MakeNetWithSubGroup(DYNOBJ_LEFT_EYELID_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 90.0, 0.0), + SetAttachOffset(-116.3, 182.6, -70.2), + MakeAttachedJoint(DYNOBJ_LEFT_EYELID_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 162.007), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(196, 90.0), + SetSkinWeight(375, 70.0), + SetSkinWeight(392, 70.0), + SetSkinWeight(393, 95.0), + SetSkinWeight(394, 95.0), + SetSkinWeight(395, 100.0), + SetSkinWeight(396, 100.0), + SetSkinWeight(397, 90.0), + SetSkinWeight(399, 60.0), + SetSkinWeight(428, 50.0), + SetSkinWeight(429, 20.0), + SetSkinWeight(197, 50.0), + SetSkinWeight(385, 5.0), + SetSkinWeight(388, 10.0), + SetSkinWeight(389, 10.0), + SetSkinWeight(390, 20.0), + SetSkinWeight(391, 35.0), + SetSkinWeight(398, 10.0), + SetSkinWeight(419, 35.0), + SetSkinWeight(400, 40.0), + SetSkinWeight(374, 10.0), + SetSkinWeight(387, 10.0), + MakeAttachedJoint(DYNOBJ_LEFT_EYELID_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(420.0, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_LEFT_EYELID_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x29), // lips - LinkWithPtr(&anim_mario_lips_2), - MakeDynObj(D_ANIMATOR, 0x2A), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x29), - LinkWith(0x28), + // right jaw skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_JAW_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 90.0, 0.0), + SetAttachOffset(0.0, -154.9, 118.5), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_JAW_JOINT), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, -111.558), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(98, 100.0), + SetSkinWeight(104, 100.0), + SetSkinWeight(189, 100.0), + SetSkinWeight(358, 100.0), + SetSkinWeight(5, 40.0), + SetSkinWeight(10, 38.0), + SetSkinWeight(380, 40.0), + SetSkinWeight(405, 38.0), + SetSkinWeight(39, 50.0), + SetSkinWeight(117, 50.0), + SetSkinWeight(337, 50.0), + SetSkinWeight(11, 40.0), + SetSkinWeight(379, 40.0), + SetSkinWeight(105, 50.0), + SetSkinWeight(116, 50.0), + SetSkinWeight(406, 50.0), + SetSkinWeight(85, 70.0), + SetSkinWeight(86, 60.0), + SetSkinWeight(111, 30.0), + SetSkinWeight(159, 50.0), + SetSkinWeight(357, 50.0), + SetSkinWeight(416, 60.0), + SetSkinWeight(6, 25.0), + SetSkinWeight(407, 25.0), + SetSkinWeight(408, 30.0), + SetSkinWeight(4, 30.0), + SetSkinWeight(410, 70.0), + SetSkinWeight(409, 30.0), + SetSkinWeight(109, 15.0), + SetSkinWeight(355, 15.0), + SetSkinWeight(35, 5.0), + SetSkinWeight(372, 5.0), + SetSkinWeight(376, 5.0), + SetSkinWeight(110, 5.0), + SetSkinWeight(16, 3.0), + SetSkinWeight(17, 3.0), + SetSkinWeight(34, 3.0), + SetSkinWeight(373, 3.0), + SetSkinWeight(381, 3.0), + SetSkinWeight(383, 3.0), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_JAW_JOINT), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, -31.153), + SetAttachOffset(141.0, 0.0, 0.0), + SetSkinWeight(31, 80.0), + SetSkinWeight(32, 80.0), + SetSkinWeight(39, 30.0), + SetSkinWeight(40, 10.0), + SetSkinWeight(99, 100.0), + SetSkinWeight(100, 100.0), + SetSkinWeight(105, 50.0), + SetSkinWeight(113, 100.0), + SetSkinWeight(114, 100.0), + SetSkinWeight(115, 100.0), + SetSkinWeight(116, 50.0), + SetSkinWeight(117, 20.0), + SetSkinWeight(177, 20.0), + SetSkinWeight(336, 10.0), + SetSkinWeight(337, 30.0), + SetSkinWeight(406, 50.0), + SetSkinWeight(411, 80.0), + SetSkinWeight(412, 100.0), + SetSkinWeight(413, 100.0), + SetSkinWeight(414, 100.0), + SetSkinWeight(415, 80.0), + SetSkinWeight(418, 100.0), + SetSkinWeight(409, 28.0), + SetSkinWeight(86, 8.0), + SetSkinWeight(416, 4.0), + SetSkinWeight(4, 28.0), + SetSkinWeight(5, 3.0), + SetSkinWeight(10, 5.0), + SetSkinWeight(380, 5.0), + SetSkinWeight(405, 5.0), + MakeAttachedJoint(DYNOBJ_MARIO_UNKNOWN_191), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(80.1, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_JAW_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x32), // eyebrows - LinkWithPtr(&anim_mario_eyebrows_1), - MakeDynObj(D_ANIMATOR, 0x33), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x32), - LinkWith(0x31), + // nose skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_NOSE_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 90.0, 0.0), + SetAttachOffset(0.0, 15.3, 295.1), + MakeAttachedJoint(DYNOBJ_MARIO_NOSE_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, -178.586), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(15, 5.0), + SetSkinWeight(18, 30.0), + SetSkinWeight(23, 70.0), + SetSkinWeight(24, 40.0), + SetSkinWeight(25, 90.0), + SetSkinWeight(26, 70.0), + SetSkinWeight(27, 90.0), + SetSkinWeight(28, 40.0), + SetSkinWeight(29, 70.0), + SetSkinWeight(30, 90.0), + SetSkinWeight(41, 70.0), + SetSkinWeight(160, 70.0), + SetSkinWeight(161, 100.0), + SetSkinWeight(182, 90.0), + SetSkinWeight(183, 90.0), + SetSkinWeight(346, 70.0), + SetSkinWeight(347, 30.0), + SetSkinWeight(348, 70.0), + SetSkinWeight(349, 40.0), + SetSkinWeight(350, 30.0), + SetSkinWeight(351, 70.0), + SetSkinWeight(352, 90.0), + SetSkinWeight(353, 5.0), + SetSkinWeight(386, 5.0), + SetSkinWeight(430, 70.0), + SetSkinWeight(431, 70.0), + SetSkinWeight(433, 70.0), + SetSkinWeight(434, 70.0), + SetSkinWeight(435, 70.0), + SetSkinWeight(436, 70.0), + SetSkinWeight(437, 70.0), + SetSkinWeight(439, 70.0), + SetSkinWeight(19, 40.0), + SetSkinWeight(20, 5.0), + SetSkinWeight(21, 5.0), + SetSkinWeight(22, 30.0), + SetSkinWeight(82, 5.0), + SetSkinWeight(83, 5.0), + SetSkinWeight(87, 5.0), + SetSkinWeight(384, 5.0), + SetSkinWeight(387, 5.0), + SetSkinWeight(432, 40.0), + SetSkinWeight(438, 40.0), + MakeAttachedJoint(DYNOBJ_MARIO_NOSE_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(276.6, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_NOSE_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x3F), // eyebrows equalizer - LinkWithPtr(&anim_mario_eyebrows_equalizer), - MakeDynObj(D_ANIMATOR, 0x40), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x3F), - LinkWith(0x3E), + // right ear skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EAR_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(-90.0, 0.0, 0.0), + SetAttachOffset(294.7, 13.1, -82.1), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EAR_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 26.565), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(59, 80.0), + SetSkinWeight(60, 50.0), + SetSkinWeight(61, 60.0), + SetSkinWeight(65, 100.0), + SetSkinWeight(66, 60.0), + SetSkinWeight(88, 10.0), + SetSkinWeight(89, 60.0), + SetSkinWeight(90, 80.0), + SetSkinWeight(91, 70.0), + SetSkinWeight(92, 100.0), + SetSkinWeight(118, 15.0), + SetSkinWeight(119, 5.0), + SetSkinWeight(120, 15.0), + SetSkinWeight(122, 60.0), + SetSkinWeight(123, 70.0), + SetSkinWeight(137, 10.0), + SetSkinWeight(138, 60.0), + SetSkinWeight(139, 10.0), + SetSkinWeight(140, 5.0), + SetSkinWeight(141, 10.0), + SetSkinWeight(167, 60.0), + SetSkinWeight(168, 70.0), + SetSkinWeight(224, 50.0), + SetSkinWeight(225, 70.0), + SetSkinWeight(226, 50.0), + SetSkinWeight(227, 50.0), + SetSkinWeight(228, 60.0), + SetSkinWeight(229, 60.0), + SetSkinWeight(235, 10.0), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EAR_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(200.9, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EAR_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x42), // eyebrows - LinkWithPtr(&anim_mario_eyebrows_2), - MakeDynObj(D_ANIMATOR, 0x43), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x42), - LinkWith(0x41), + // left ear skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_LEFT_EAR_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(90.0, 180.0, 0.0), + SetAttachOffset(-294.7, 13.1, -82.1), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_EAR_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(180.0, 180.0, -153.435), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(244, 5.0), + SetSkinWeight(267, 5.0), + SetSkinWeight(268, 5.0), + SetSkinWeight(299, 5.0), + SetSkinWeight(302, 5.0), + SetSkinWeight(307, 70.0), + SetSkinWeight(308, 70.0), + SetSkinWeight(309, 100.0), + SetSkinWeight(310, 70.0), + SetSkinWeight(311, 70.0), + SetSkinWeight(314, 100.0), + SetSkinWeight(315, 70.0), + SetSkinWeight(317, 80.0), + SetSkinWeight(318, 70.0), + SetSkinWeight(319, 80.0), + SetSkinWeight(320, 70.0), + SetSkinWeight(321, 10.0), + SetSkinWeight(322, 10.0), + SetSkinWeight(323, 10.0), + SetSkinWeight(324, 10.0), + SetSkinWeight(325, 60.0), + SetSkinWeight(326, 100.0), + SetSkinWeight(327, 100.0), + SetSkinWeight(328, 100.0), + SetSkinWeight(329, 80.0), + SetSkinWeight(330, 80.0), + SetSkinWeight(331, 60.0), + SetSkinWeight(332, 70.0), + SetSkinWeight(340, 70.0), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_EAR_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.02), + SetAttachOffset(200.9, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_LEFT_EAR_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x48), // eyebrows - LinkWithPtr(&anim_mario_eyebrows_3), - MakeDynObj(D_ANIMATOR, 0x49), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x48), - LinkWith(0x47), + // right lip corner skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_RIGHT_LIP_CORNER_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(-90.0, 0.0, 0.0), + SetAttachOffset(119.7, -161.4, 125.5), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_LIP_CORNER_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(-0.02, 0.0, -66.509), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(4, 42.0), + SetSkinWeight(5, 40.0), + SetSkinWeight(6, 75.0), + SetSkinWeight(10, 30.0), + SetSkinWeight(11, 40.0), + SetSkinWeight(16, 20.0), + SetSkinWeight(17, 15.0), + SetSkinWeight(33, 30.0), + SetSkinWeight(34, 20.0), + SetSkinWeight(35, 60.0), + SetSkinWeight(37, 10.0), + SetSkinWeight(43, 40.0), + SetSkinWeight(85, 30.0), + SetSkinWeight(86, 30.0), + SetSkinWeight(93, 30.0), + SetSkinWeight(94, 10.0), + SetSkinWeight(101, 100.0), + SetSkinWeight(103, 100.0), + SetSkinWeight(108, 10.0), + SetSkinWeight(109, 70.0), + SetSkinWeight(110, 80.0), + SetSkinWeight(111, 60.0), + SetSkinWeight(112, 70.0), + SetSkinWeight(159, 50.0), + SetSkinWeight(42, 30.0), + SetSkinWeight(102, 30.0), + SetSkinWeight(31, 20.0), + SetSkinWeight(32, 20.0), + SetSkinWeight(44, 15.0), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_LIP_CORNER_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.028, 0.0, 0.0), + SetAttachOffset(184.5, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_RIGHT_LIP_CORNER_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x4B), // eyebrows - LinkWithPtr(&anim_mario_eyebrows_4), - MakeDynObj(D_ANIMATOR, 0x4C), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x4B), - LinkWith(0x4A), + // left lip corner skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_LEFT_LIP_CORNER_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(90.0, 180.0, 0.0), + SetAttachOffset(-119.7, -161.4, 125.5), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_LIP_CORNER_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.02, 0.0, -66.509), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(187, 100.0), + SetSkinWeight(273, 30.0), + SetSkinWeight(342, 10.0), + SetSkinWeight(354, 40.0), + SetSkinWeight(355, 70.0), + SetSkinWeight(356, 70.0), + SetSkinWeight(357, 50.0), + SetSkinWeight(371, 10.0), + SetSkinWeight(372, 60.0), + SetSkinWeight(373, 20.0), + SetSkinWeight(376, 80.0), + SetSkinWeight(377, 100.0), + SetSkinWeight(378, 10.0), + SetSkinWeight(379, 40.0), + SetSkinWeight(380, 30.0), + SetSkinWeight(381, 15.0), + SetSkinWeight(383, 20.0), + SetSkinWeight(404, 30.0), + SetSkinWeight(405, 30.0), + SetSkinWeight(407, 75.0), + SetSkinWeight(408, 60.0), + SetSkinWeight(409, 42.0), + SetSkinWeight(410, 30.0), + SetSkinWeight(416, 36.0), + SetSkinWeight(199, 15.0), + SetSkinWeight(415, 20.0), + SetSkinWeight(411, 20.0), + SetSkinWeight(188, 20.0), + SetSkinWeight(198, 20.0), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_LIP_CORNER_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(-0.028, 0.0, 0.0), + SetAttachOffset(184.5, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_LEFT_LIP_CORNER_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x54), // eyebrows - LinkWithPtr(&anim_mario_eyebrows_5), - MakeDynObj(D_ANIMATOR, 0x55), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x54), - LinkWith(0x53), + // ??? + MakeNetWithSubGroup(0x8F), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 90.0, 0.0), + SetAttachOffset(0.0, -162.2, 121.0), + MakeAttachedJoint(DYNOBJ_MARIO_UNKNOWN_140), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, -176.775), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(42, 70.0), + SetSkinWeight(44, 85.0), + SetSkinWeight(102, 70.0), + SetSkinWeight(188, 80.0), + SetSkinWeight(198, 80.0), + SetSkinWeight(199, 85.0), + MakeAttachedJoint(DYNOBJ_MARIO_UNKNOWN_137), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(242.8, 0.0, 0.0), + EndNetWithSubGroup(0x8F), - MakeDynObj(D_DATA_GRP, 0x6B), // left eye - LinkWithPtr(&anim_mario_eye_left), - MakeDynObj(D_ANIMATOR, 0x6C), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x6B), - LinkWith(0x6A), + // cap skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_CAP_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 90.0, 0.0), + SetAttachOffset(0.0, 233.8, -148.8), + MakeAttachedJoint(DYNOBJ_MARIO_CAP_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 153.932), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(68, 90.0), + SetSkinWeight(69, 100.0), + SetSkinWeight(70, 100.0), + SetSkinWeight(71, 100.0), + SetSkinWeight(75, 100.0), + SetSkinWeight(76, 100.0), + SetSkinWeight(77, 100.0), + SetSkinWeight(79, 80.0), + SetSkinWeight(129, 100.0), + SetSkinWeight(147, 90.0), + SetSkinWeight(148, 90.0), + SetSkinWeight(149, 100.0), + SetSkinWeight(150, 100.0), + SetSkinWeight(151, 100.0), + SetSkinWeight(154, 100.0), + SetSkinWeight(155, 100.0), + SetSkinWeight(156, 100.0), + SetSkinWeight(157, 100.0), + SetSkinWeight(184, 100.0), + SetSkinWeight(185, 100.0), + SetSkinWeight(192, 100.0), + SetSkinWeight(193, 90.0), + SetSkinWeight(194, 80.0), + SetSkinWeight(195, 100.0), + SetSkinWeight(201, 100.0), + SetSkinWeight(202, 100.0), + SetSkinWeight(230, 100.0), + SetSkinWeight(360, 100.0), + SetSkinWeight(361, 100.0), + SetSkinWeight(362, 100.0), + SetSkinWeight(363, 100.0), + SetSkinWeight(364, 100.0), + SetSkinWeight(366, 100.0), + SetSkinWeight(367, 90.0), + SetSkinWeight(368, 100.0), + SetSkinWeight(369, 90.0), + SetSkinWeight(420, 100.0), + SetSkinWeight(421, 100.0), + SetSkinWeight(422, 100.0), + SetSkinWeight(424, 100.0), + SetSkinWeight(425, 100.0), + SetSkinWeight(426, 100.0), + SetSkinWeight(427, 100.0), + SetSkinWeight(58, 100.0), + SetSkinWeight(242, 100.0), + SetSkinWeight(0, 100.0), + SetSkinWeight(1, 100.0), + SetSkinWeight(2, 80.0), + SetSkinWeight(9, 100.0), + SetSkinWeight(50, 100.0), + SetSkinWeight(54, 100.0), + SetSkinWeight(55, 100.0), + SetSkinWeight(56, 100.0), + SetSkinWeight(57, 100.0), + SetSkinWeight(67, 80.0), + SetSkinWeight(78, 90.0), + SetSkinWeight(80, 100.0), + SetSkinWeight(121, 100.0), + SetSkinWeight(142, 50.0), + SetSkinWeight(145, 80.0), + SetSkinWeight(146, 100.0), + SetSkinWeight(152, 90.0), + SetSkinWeight(158, 90.0), + SetSkinWeight(186, 100.0), + SetSkinWeight(240, 80.0), + SetSkinWeight(246, 100.0), + SetSkinWeight(247, 100.0), + SetSkinWeight(248, 50.0), + SetSkinWeight(249, 90.0), + SetSkinWeight(251, 100.0), + SetSkinWeight(303, 90.0), + SetSkinWeight(304, 100.0), + SetSkinWeight(305, 100.0), + SetSkinWeight(306, 100.0), + SetSkinWeight(335, 100.0), + SetSkinWeight(338, 100.0), + SetSkinWeight(345, 100.0), + SetSkinWeight(359, 90.0), + SetSkinWeight(365, 100.0), + SetSkinWeight(370, 80.0), + SetSkinWeight(401, 100.0), + SetSkinWeight(402, 100.0), + SetSkinWeight(403, 100.0), + SetSkinWeight(417, 80.0), + SetSkinWeight(125, 60.0), + SetSkinWeight(143, 50.0), + SetSkinWeight(270, 50.0), + SetSkinWeight(294, 60.0), + SetSkinWeight(239, 50.0), + SetSkinWeight(245, 50.0), + MakeAttachedJoint(DYNOBJ_MARIO_CAP_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(528.3, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_CAP_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x7B), // right eye - LinkWithPtr(&anim_mario_eye_right), - MakeDynObj(D_ANIMATOR, 0x7C), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x7B), - LinkWith(0x7A), + // right eye skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EYE_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(90.0, 180.0, 0.0), + SetAttachOffset(29.7, 192.4, -3.0), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EYE_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(184.483, -178.885, 82.485), + SetAttachOffset(0.0, 0.0, 0.0), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EYE_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(329.8, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EYE_SKIN_NET), + MakeDynObj(D_NET, DYNOBJ_MARIO_RIGHT_EYE_UNKNOWN_NET), + SetType(3), + SetShapePtr(DYNOBJ_MARIO_RIGHT_EYE_SHAPE), + AttachTo(0xd, DYNOBJ_MARIO_RIGHT_EYE_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(0.0, 0.0, 0.0), - MakeDynObj(D_DATA_GRP, 0x84), // cap - LinkWithPtr(&anim_mario_cap), - MakeDynObj(D_ANIMATOR, 0x85), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x84), - LinkWith(0x83), + // left eye skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_LEFT_EYE_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetSkinShape(DYNOBJ_MARIO_FACE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(-90.0, 0.0, 0.0), + SetAttachOffset(-29.0, 192.3, -2.0), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_EYE_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(-6.873, 0.206, -97.461), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(429, 16.0), + MakeAttachedJoint(DYNOMJ_MARIO_LEFT_EYE_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(329.8, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_LEFT_EYE_SKIN_NET), + MakeDynObj(D_NET, DYNOBJ_MARIO_LEFT_EYE_UNKNOWN_NET), + SetType(3), + SetShapePtr(DYNOBJ_MARIO_LEFT_EYE_SHAPE), + AttachTo(0xd, DYNOBJ_MARIO_LEFT_EYE_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(0.0, 0.0, 0.0), - MakeDynObj(D_DATA_GRP, 0x96), // upper lip left - LinkWithPtr(&anim_mario_lips_3), - MakeDynObj(D_ANIMATOR, 0x97), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x96), - LinkWith(0x95), + // right eyebrow net (attaches to head) + MakeDynObj(D_NET, DYNOBJ_MARIO_RIGHT_EYEBROW_NET), + SetType(2), + SetShapePtr(DYNOBJ_MARIO_RIGHT_EYEBROW_SHAPE), + // attach right eyebrow to head + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(20.8, 0.0, -8.5), + // right part of right eyebrow skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_RPART_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_RIGHT_EYEBROW_NET), + SetSkinShape(DYNOBJ_MARIO_RIGHT_EYEBROW_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(-90.0, 90.0, -90.0), + SetAttachOffset(231.3, 287.1, -51.4), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EYEBROW_RPART_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(10.886, 0.0, 177.51), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(5, 70.0), + SetSkinWeight(6, 80.0), + SetSkinWeight(7, 70.0), + SetSkinWeight(8, 50.0), + SetSkinWeight(11, 70.0), + SetSkinWeight(12, 100.0), + SetSkinWeight(19, 50.0), + SetSkinWeight(20, 80.0), + SetSkinWeight(23, 70.0), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EYEBROW_RPART_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(345.5, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_RPART_SKIN_NET), + // left part of right eyebrow skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_LPART_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_RIGHT_EYEBROW_NET), + SetSkinShape(DYNOBJ_MARIO_RIGHT_EYEBROW_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(-90.0, 90.0, -90.0), + SetAttachOffset(23.0, 305.5, -44.6), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EYEBROW_LPART_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(-3.437, -0.069, -177.758), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(16, 80.0), + SetSkinWeight(17, 100.0), + SetSkinWeight(18, 80.0), + SetSkinWeight(22, 70.0), + SetSkinWeight(24, 50.0), + SetSkinWeight(25, 80.0), + SetSkinWeight(15, 30.0), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EYEBROW_LPART_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(399.5, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_LPART_SKIN_NET), + // middle part of right eyebrow skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_RIGHT_EYEBROW_NET), + SetSkinShape(DYNOBJ_MARIO_RIGHT_EYEBROW_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(-90.0, 90.0, -90.0), + SetAttachOffset(123.1, 385.5, -46.4), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(2.865, 0.029, 182.377), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(0, 100.0), + SetSkinWeight(1, 100.0), + SetSkinWeight(2, 100.0), + SetSkinWeight(3, 100.0), + SetSkinWeight(4, 100.0), + SetSkinWeight(9, 100.0), + SetSkinWeight(10, 100.0), + SetSkinWeight(13, 100.0), + SetSkinWeight(14, 100.0), + SetSkinWeight(15, 70.0), + SetSkinWeight(21, 100.0), + SetSkinWeight(16, 20.0), + SetSkinWeight(18, 20.0), + SetSkinWeight(22, 30.0), + SetSkinWeight(25, 20.0), + SetSkinWeight(6, 20.0), + SetSkinWeight(11, 30.0), + SetSkinWeight(20, 20.0), + SetSkinWeight(23, 30.0), + SetSkinWeight(5, 30.0), + SetSkinWeight(7, 30.0), + SetSkinWeight(8, 50.0), + SetSkinWeight(19, 50.0), + SetSkinWeight(24, 50.0), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(388.6, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0x9F), // upper lip right - LinkWithPtr(&anim_mario_lips_4), - MakeDynObj(D_ANIMATOR, 0xA0), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0x9F), - LinkWith(0x9E), + // left eyebrow net (attaches to head) + MakeDynObj(D_NET, DYNOBJ_MARIO_LEFT_EYEBROW_NET), + SetType(2), + SetShapePtr(DYNOBJ_MARIO_LEFT_EYEBROW_SHAPE), + // attach left eyebrow to head + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(-18.5, 0.0, -1.0), + // left part of left eyebrow skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_LEFT_EYEBROW_LPART_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_LEFT_EYEBROW_NET), + SetSkinShape(DYNOBJ_MARIO_LEFT_EYEBROW_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 90.0, 0.0), + SetAttachOffset(-233.6, 287.1, -51.4), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_EYEBROW_LPART_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(-6.876, 0.0, 177.51), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(9, 100.0), + SetSkinWeight(10, 80.0), + SetSkinWeight(11, 80.0), + SetSkinWeight(13, 80.0), + SetSkinWeight(14, 80.0), + SetSkinWeight(18, 60.0), + SetSkinWeight(21, 60.0), + SetSkinWeight(25, 60.0), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_EYEBROW_LPART_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(345.5, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_LEFT_EYEBROW_LPART_SKIN_NET), + // right part of left eyebrow skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_LEFT_EYEBROW_RPART_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_LEFT_EYEBROW_NET), + SetSkinShape(DYNOBJ_MARIO_LEFT_EYEBROW_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 90.0, 0.0), + SetAttachOffset(-25.3, 305.5, -44.6), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_EYEBROW_RPART_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(-9.733, -0.388, -177.186), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(0, 70.0), + SetSkinWeight(1, 100.0), + SetSkinWeight(2, 70.0), + SetSkinWeight(3, 70.0), + SetSkinWeight(5, 50.0), + SetSkinWeight(12, 70.0), + SetSkinWeight(19, 30.0), + SetSkinWeight(15, 30.0), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_EYEBROW_RPART_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(399.5, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_LEFT_EYEBROW_RPART_SKIN_NET), + // middle part of left eyebrow skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_LEFT_EYEBROW_MPART_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_LEFT_EYEBROW_NET), + SetSkinShape(DYNOBJ_MARIO_LEFT_EYEBROW_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 90.0, 0.0), + SetAttachOffset(-125.4, 385.5, -46.4), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_EYEBROW_MPART_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(-8.004, -0.61, 181.847), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(4, 70.0), + SetSkinWeight(6, 100.0), + SetSkinWeight(7, 100.0), + SetSkinWeight(8, 80.0), + SetSkinWeight(15, 70.0), + SetSkinWeight(16, 80.0), + SetSkinWeight(17, 100.0), + SetSkinWeight(19, 70.0), + SetSkinWeight(20, 80.0), + SetSkinWeight(22, 80.0), + SetSkinWeight(23, 60.0), + SetSkinWeight(24, 100.0), + SetSkinWeight(5, 50.0), + SetSkinWeight(0, 30.0), + SetSkinWeight(2, 30.0), + SetSkinWeight(10, 20.0), + SetSkinWeight(11, 20.0), + SetSkinWeight(13, 20.0), + SetSkinWeight(14, 20.0), + SetSkinWeight(18, 40.0), + SetSkinWeight(21, 40.0), + SetSkinWeight(25, 40.0), + SetSkinWeight(3, 30.0), + SetSkinWeight(12, 30.0), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_EYEBROW_MPART_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(388.6, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_LEFT_EYEBROW_MPART_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0xA8), // left ear - LinkWithPtr(&anim_mario_ear_left), - MakeDynObj(D_ANIMATOR, 0xA9), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xA8), - LinkWith(0xA7), + // mustache net (attaches to head) + MakeDynObj(D_NET, DYNOBJ_MARIO_MUSTACHE_NET), + SetType(2), + SetShapePtr(DYNOBJ_MARIO_MUSTACHE_SHAPE), + // attach mustache to head + AttachTo(0xd, DYNOBJ_MARIO_MAIN_NET), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.02, -0.002, 0.04), + SetAttachOffset(0.0, 0.0, 0.0), + // left mustache skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_LEFT_MUSTACHE_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MUSTACHE_NET), + SetSkinShape(DYNOBJ_MARIO_MUSTACHE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 180.0, 0.0), + SetAttachOffset(4.2, -86.5, 415.5), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_MUSTACHE_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(-179.98, -164.53, -29.34), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(3, 50.0), + SetSkinWeight(4, 50.0), + SetSkinWeight(5, 50.0), + SetSkinWeight(11, 70.0), + SetSkinWeight(12, 80.0), + SetSkinWeight(13, 70.0), + SetSkinWeight(18, 80.0), + SetSkinWeight(19, 80.0), + SetSkinWeight(20, 80.0), + SetSkinWeight(21, 100.0), + SetSkinWeight(22, 100.0), + SetSkinWeight(23, 100.0), + SetSkinWeight(25, 100.0), + SetSkinWeight(27, 100.0), + SetSkinWeight(28, 50.0), + SetSkinWeight(29, 40.0), + SetSkinWeight(30, 40.0), + SetSkinWeight(31, 100.0), + SetSkinWeight(36, 50.0), + SetSkinWeight(37, 50.0), + SetSkinWeight(42, 40.0), + SetSkinWeight(45, 50.0), + SetSkinWeight(46, 50.0), + SetSkinWeight(47, 80.0), + SetSkinWeight(50, 40.0), + SetSkinWeight(51, 100.0), + SetSkinWeight(53, 40.0), + SetSkinWeight(54, 80.0), + MakeAttachedJoint(DYNOBJ_MARIO_LEFT_MUSTACHE_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(-0.028, 0.0, 0.02), + SetAttachOffset(292.7, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_LEFT_MUSTACHE_SKIN_NET), + // right mustache skinning + MakeNetWithSubGroup(DYNOBJ_MARIO_RIGHT_MUSTACHE_SKIN_NET), + AttachTo(0xd, DYNOBJ_MARIO_MUSTACHE_NET), + SetSkinShape(DYNOBJ_MARIO_MUSTACHE_SHAPE), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(-4.2, -86.5, 415.5), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_MUSTACHE_JOINT_1), + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 15.47, 150.66), + SetAttachOffset(0.0, 0.0, 0.0), + SetSkinWeight(0, 100.0), + SetSkinWeight(1, 80.0), + SetSkinWeight(2, 80.0), + SetSkinWeight(6, 100.0), + SetSkinWeight(7, 100.0), + SetSkinWeight(8, 50.0), + SetSkinWeight(9, 50.0), + SetSkinWeight(10, 50.0), + SetSkinWeight(14, 50.0), + SetSkinWeight(15, 50.0), + SetSkinWeight(16, 50.0), + SetSkinWeight(17, 80.0), + SetSkinWeight(24, 100.0), + SetSkinWeight(26, 100.0), + SetSkinWeight(32, 80.0), + SetSkinWeight(33, 100.0), + SetSkinWeight(34, 70.0), + SetSkinWeight(35, 50.0), + SetSkinWeight(38, 40.0), + SetSkinWeight(39, 40.0), + SetSkinWeight(40, 40.0), + SetSkinWeight(41, 50.0), + SetSkinWeight(43, 50.0), + SetSkinWeight(44, 50.0), + SetSkinWeight(48, 80.0), + SetSkinWeight(49, 70.0), + SetSkinWeight(52, 40.0), + SetSkinWeight(55, 80.0), + MakeAttachedJoint(DYNOBJ_MARIO_RIGHT_MUSTACHE_JOINT_2), // What is this joint for? + SetScale(1.0, 1.0, 1.0), + SetRotation(0.0, 0.0, 0.0), + SetAttachOffset(292.7, 0.0, 0.0), + EndNetWithSubGroup(DYNOBJ_MARIO_RIGHT_MUSTACHE_SKIN_NET), - MakeDynObj(D_DATA_GRP, 0xB1), // right ear - LinkWithPtr(&anim_mario_ear_right), - MakeDynObj(D_ANIMATOR, 0xB2), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xB1), - LinkWith(0xB0), + // right mustache animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_RIGHT_MUSTACHE_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_mustache_right), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_RIGHT_MUSTACHE_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_RIGHT_MUSTACHE_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_RIGHT_MUSTACHE_JOINT_1), - MakeDynObj(D_DATA_GRP, 0xBA), // nose - LinkWithPtr(&anim_mario_nose), - MakeDynObj(D_ANIMATOR, 0xBB), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xBA), - LinkWith(0xB9), + // left mustache animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_LEFT_MUSTACHE_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_mustache_left), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_LEFT_MUSTACHE_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_LEFT_MUSTACHE_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_LEFT_MUSTACHE_JOINT_1), - MakeDynObj(D_DATA_GRP, 0xC3), // lip - LinkWithPtr(&anim_mario_lips_5), - MakeDynObj(D_ANIMATOR, 0xC4), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xC3), - LinkWith(0xC2), + // left eyebrow animators + MakeDynObj(D_DATA_GRP, 32), + LinkWithPtr(&anim_mario_lips_1), + MakeDynObj(D_ANIMATOR, 33), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(32), + LinkWith(DYNOBJ_MARIO_LEFT_EYEBROW_MPART_JOINT_1), + MakeDynObj(D_DATA_GRP, 41), + LinkWithPtr(&anim_mario_lips_2), + MakeDynObj(D_ANIMATOR, 42), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(41), + LinkWith(DYNOBJ_MARIO_LEFT_EYEBROW_RPART_JOINT_1), + MakeDynObj(D_DATA_GRP, 50), + LinkWithPtr(&anim_mario_eyebrows_1), + MakeDynObj(D_ANIMATOR, 51), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(50), + LinkWith(DYNOBJ_MARIO_LEFT_EYEBROW_LPART_JOINT_1), - MakeDynObj(D_DATA_GRP, 0xC6), // lip - LinkWithPtr(&anim_mario_lips_6), - MakeDynObj(D_ANIMATOR, 0xC7), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xC6), - LinkWith(0xC5), + // right eyebrow animators + MakeDynObj(D_DATA_GRP, 63), + LinkWithPtr(&anim_mario_eyebrows_equalizer), + MakeDynObj(D_ANIMATOR, 64), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(63), + LinkWith(DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_JOINT_2), + MakeDynObj(D_DATA_GRP, 66), + LinkWithPtr(&anim_mario_eyebrows_2), + MakeDynObj(D_ANIMATOR, 67), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(66), + LinkWith(DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_JOINT_1), + MakeDynObj(D_DATA_GRP, 72), + LinkWithPtr(&anim_mario_eyebrows_3), + MakeDynObj(D_ANIMATOR, 73), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(72), + LinkWith(DYNOBJ_MARIO_RIGHT_EYEBROW_LPART_JOINT_2), + MakeDynObj(D_DATA_GRP, 75), + LinkWithPtr(&anim_mario_eyebrows_4), + MakeDynObj(D_ANIMATOR, 76), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(75), + LinkWith(DYNOBJ_MARIO_RIGHT_EYEBROW_LPART_JOINT_1), + MakeDynObj(D_DATA_GRP, 84), + LinkWithPtr(&anim_mario_eyebrows_5), + MakeDynObj(D_ANIMATOR, 85), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(84), + LinkWith(DYNOBJ_MARIO_RIGHT_EYEBROW_RPART_JOINT_1), - MakeDynObj(D_DATA_GRP, 0xCF), // left eyelid - LinkWithPtr(&anim_mario_eyelid_left), - MakeDynObj(D_ANIMATOR, 0xD0), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xCF), - LinkWith(0xCE), + // left eye animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_LEFT_EYE_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_eye_left), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_LEFT_EYE_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_LEFT_EYE_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_LEFT_EYE_JOINT_1), - MakeDynObj(D_DATA_GRP, 0xD8), // right eyelid - LinkWithPtr(&anim_mario_eyelid_right), - MakeDynObj(D_ANIMATOR, 0xD9), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xD8), - LinkWith(0xD7), + // right eye animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_RIGHT_EYE_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_eye_right), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_RIGHT_EYE_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_RIGHT_EYE_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_RIGHT_EYE_JOINT_1), - MakeDynObj(D_DATA_GRP, 0xE2), // intro - LinkWithPtr(&anim_mario_intro), - MakeDynObj(D_ANIMATOR, 0xE3), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xE2), - LinkWith(0xDD), + // cap animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_CAP_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_cap), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_CAP_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_CAP_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_CAP_JOINT_1), - MakeDynObj(D_DATA_GRP, 0xE5), // silver star - LinkWithPtr(&anim_silver_star), - MakeDynObj(D_ANIMATOR, 0xE6), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xE5), - LinkWith(0xE4), + // left lip corner animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_LEFT_LIP_CORNER_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_lips_3), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_LEFT_LIP_CORNER_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_LEFT_LIP_CORNER_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_LEFT_LIP_CORNER_JOINT_1), - MakeDynObj(D_DATA_GRP, 0xE8), // red star - LinkWithPtr(&anim_red_star), - MakeDynObj(D_ANIMATOR, 0xE9), - AttachTo(0x0, 0x3E9), - SetNodeGroup(0xE8), - LinkWith(0xE7), + // right lip corner animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_RIGHT_LIP_CORNER_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_lips_4), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_RIGHT_LIP_CORNER_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_RIGHT_LIP_CORNER_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_RIGHT_LIP_CORNER_JOINT_1), + + // left ear animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_LEFT_EAR_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_ear_left), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_LEFT_EAR_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_LEFT_EAR_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_LEFT_EAR_JOINT_1), + + // right ear animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_RIGHT_EAR_ANIMADATA_GROUP), + LinkWithPtr(&anim_mario_ear_right), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_RIGHT_EAR_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_RIGHT_EAR_ANIMADATA_GROUP), + LinkWith(DYNOBJ_MARIO_RIGHT_EAR_JOINT_1), + + // nose animator + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_NOSE_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_nose), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_NOSE_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_NOSE_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_NOSE_JOINT_1), + + // animator for left side of jaw + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_LEFT_JAW_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_lips_5), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_LEFT_JAW_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_LEFT_JAW_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_LEFT_JAW_JOINT), + + // animator for right side of jaw + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_RIGHT_JAW_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_lips_6), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_RIGHT_JAW_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_RIGHT_JAW_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_RIGHT_JAW_JOINT), + + // left eyelid animator + MakeDynObj(D_DATA_GRP, DYNOBJ_LEFT_EYELID_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_eyelid_left), + MakeDynObj(D_ANIMATOR, DYNOBJ_LEFT_EYELID_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_LEFT_EYELID_ANIMDATA_GROUP), + LinkWith(DYNOBJ_LEFT_EYELID_JOINT_1), + + // right eyelid animator + MakeDynObj(D_DATA_GRP, DYNOBJ_RIGHT_EYELID_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_eyelid_right), + MakeDynObj(D_ANIMATOR, DYNOBJ_RIGHT_EYELID_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_RIGHT_EYELID_ANIMDATA_GROUP), + LinkWith(DYNOBJ_RIGHT_EYELID_JOINT_1), + + // whole head animator? + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_HEAD_ANIMDATA_GROUP), + LinkWithPtr(&anim_mario_intro), + MakeDynObj(D_ANIMATOR, DYNOBJ_MARIO_HEAD_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_MARIO_HEAD_ANIMDATA_GROUP), + LinkWith(DYNOBJ_MARIO_MAIN_NET), + + // silver star animator + MakeDynObj(D_DATA_GRP, DYNOBJ_SILVER_STAR_ANIMDATA_GROUP), + LinkWithPtr(&anim_silver_star), + MakeDynObj(D_ANIMATOR, DYNOBJ_SILVER_STAR_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_SILVER_STAR_ANIMDATA_GROUP), + LinkWith(DYNOBJ_SILVER_STAR_LIGHT), + + // red star animator + MakeDynObj(D_DATA_GRP, DYNOBJ_RED_STAR_ANIMDATA_GROUP), + LinkWithPtr(&anim_red_star), + MakeDynObj(D_ANIMATOR, DYNOBJ_RED_STAR_ANIMATOR), + AttachTo(0x0, DYNOBJ_MARIO_MAIN_ANIMATOR), + SetNodeGroup(DYNOBJ_RED_STAR_ANIMDATA_GROUP), + LinkWith(DYNOBJ_RED_STAR_LIGHT), EndGroup(0x1), + UseObj(0x1), - UseIntId(FALSE), - StopList(), + + UseIntegerNames(FALSE), + EndList(), }; diff --git a/src/goddard/dynlists/dynlist_test_cube.c b/src/goddard/dynlists/dynlist_test_cube.c index cf3f43ec..1ceb6426 100644 --- a/src/goddard/dynlists/dynlist_test_cube.c +++ b/src/goddard/dynlists/dynlist_test_cube.c @@ -6,72 +6,77 @@ #include "../dynlist_proc.h" // maybe move types into the dynlists.h file? -struct DynList dynlist_test_cube[67] = { - StartList(), +struct DynList dynlist_test_cube[] = { + BeginList(), + StartGroup("ico1vg"), - MakeVertex(-2.0, 0.0, -2.0), - MakeVertex(-2.0, 0.0, 2.0), - MakeVertex(2.0, 0.0, 2.0), - MakeVertex(2.0, 0.0, -2.0), - MakeVertex(0.0, 3.0, 0.0), - MakeVertex(0.0, -3.0, 0.0), + MakeVertex(-2.0, 0.0, -2.0), + MakeVertex(-2.0, 0.0, 2.0), + MakeVertex(2.0, 0.0, 2.0), + MakeVertex(2.0, 0.0, -2.0), + MakeVertex(0.0, 3.0, 0.0), + MakeVertex(0.0, -3.0, 0.0), EndGroup("ico1vg"), + StartGroup("ico1pg"), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 1), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - SetParamPtr(PARM_PTR_OBJ_VTX, 3), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 4), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - SetParamPtr(PARM_PTR_OBJ_VTX, 3), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 1), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - SetParamPtr(PARM_PTR_OBJ_VTX, 4), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 1), - SetParamPtr(PARM_PTR_OBJ_VTX, 4), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 3), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 4), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 5), - SetParamPtr(PARM_PTR_OBJ_VTX, 3), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 1), - SetParamPtr(PARM_PTR_OBJ_VTX, 5), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 1), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 5), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 3), - SetParamPtr(PARM_PTR_OBJ_VTX, 5), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), + SetParamPtr(PARM_PTR_OBJ_VTX, 1), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + SetParamPtr(PARM_PTR_OBJ_VTX, 3), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 4), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + SetParamPtr(PARM_PTR_OBJ_VTX, 3), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 1), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + SetParamPtr(PARM_PTR_OBJ_VTX, 4), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 1), + SetParamPtr(PARM_PTR_OBJ_VTX, 4), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 3), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), + SetParamPtr(PARM_PTR_OBJ_VTX, 4), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 5), + SetParamPtr(PARM_PTR_OBJ_VTX, 3), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 1), + SetParamPtr(PARM_PTR_OBJ_VTX, 5), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 1), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), + SetParamPtr(PARM_PTR_OBJ_VTX, 5), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 3), + SetParamPtr(PARM_PTR_OBJ_VTX, 5), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), EndGroup("ico1pg"), + UseObj("ico1pg"), - MapVertices("ico1vg"), + MapVertices("ico1vg"), + MakeDynObj(D_SHAPE, "ico1_sh"), - SetNodeGroup("ico1vg"), - SetPlaneGroup("ico1pg"), - StopList(), + SetNodeGroup("ico1vg"), + SetPlaneGroup("ico1pg"), + + EndList(), }; diff --git a/src/goddard/dynlists/dynlist_unused.c b/src/goddard/dynlists/dynlist_unused.c index 249fcfec..2ce4dd7d 100644 --- a/src/goddard/dynlists/dynlist_unused.c +++ b/src/goddard/dynlists/dynlist_unused.c @@ -4,68 +4,72 @@ #include "dynlists.h" #include "../dynlist_proc.h" -// maybe move types into the dynlists.h file? -struct DynList dynlist_unused[62] = { - StartList(), +struct DynList dynlist_spot_shape[] = { + BeginList(), + StartGroup("spotvg"), - MakeVertex(0.0, 0.0, 0.0), - MakeVertex(1.0, -1.0, 1.0), - SetParamF(1, 0.0), - MakeVertex(1.0, 1.0, 1.0), - SetParamF(1, 0.0), - MakeVertex(-1.0, 1.0, 1.0), - SetParamF(1, 0.0), - MakeVertex(-1.0, -1.0, 1.0), - SetParamF(1, 0.0), - MakeVertex(0.0, 0.0, 0.0), + MakeVertex(0.0, 0.0, 0.0), + MakeVertex(1.0, -1.0, 1.0), + SetParamF(PARM_F_ALPHA, 0.0), + MakeVertex(1.0, 1.0, 1.0), + SetParamF(PARM_F_ALPHA, 0.0), + MakeVertex(-1.0, 1.0, 1.0), + SetParamF(PARM_F_ALPHA, 0.0), + MakeVertex(-1.0, -1.0, 1.0), + SetParamF(PARM_F_ALPHA, 0.0), + MakeVertex(0.0, 0.0, 0.0), EndGroup("spotvg"), + StartGroup("spotpg"), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - SetParamPtr(PARM_PTR_OBJ_VTX, 3), - SetParamPtr(PARM_PTR_OBJ_VTX, 5), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 3), - SetParamPtr(PARM_PTR_OBJ_VTX, 4), - SetParamPtr(PARM_PTR_OBJ_VTX, 5), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 4), - SetParamPtr(PARM_PTR_OBJ_VTX, 1), - SetParamPtr(PARM_PTR_OBJ_VTX, 5), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 1), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - SetParamPtr(PARM_PTR_OBJ_VTX, 5), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 3), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 4), - SetParamPtr(PARM_PTR_OBJ_VTX, 3), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 1), - SetParamPtr(PARM_PTR_OBJ_VTX, 4), - MakeDynObj(D_FACE, NULL), - SetMaterial(NULL, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 0), - SetParamPtr(PARM_PTR_OBJ_VTX, 2), - SetParamPtr(PARM_PTR_OBJ_VTX, 1), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + SetParamPtr(PARM_PTR_OBJ_VTX, 3), + SetParamPtr(PARM_PTR_OBJ_VTX, 5), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 3), + SetParamPtr(PARM_PTR_OBJ_VTX, 4), + SetParamPtr(PARM_PTR_OBJ_VTX, 5), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 4), + SetParamPtr(PARM_PTR_OBJ_VTX, 1), + SetParamPtr(PARM_PTR_OBJ_VTX, 5), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 1), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + SetParamPtr(PARM_PTR_OBJ_VTX, 5), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), + SetParamPtr(PARM_PTR_OBJ_VTX, 3), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), + SetParamPtr(PARM_PTR_OBJ_VTX, 4), + SetParamPtr(PARM_PTR_OBJ_VTX, 3), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), + SetParamPtr(PARM_PTR_OBJ_VTX, 1), + SetParamPtr(PARM_PTR_OBJ_VTX, 4), + MakeDynObj(D_FACE, NULL), + SetMaterial(0), + SetParamPtr(PARM_PTR_OBJ_VTX, 0), + SetParamPtr(PARM_PTR_OBJ_VTX, 2), + SetParamPtr(PARM_PTR_OBJ_VTX, 1), EndGroup("spotpg"), + UseObj("spotpg"), - MapVertices("spotvg"), + MapVertices("spotvg"), + MakeDynObj(D_SHAPE, "spot_sh"), - SetNodeGroup("spotvg"), - SetPlaneGroup("spotpg"), - SetParamF(1, 0.1), - StopList(), + SetNodeGroup("spotvg"), + SetPlaneGroup("spotpg"), + SetParamF(PARM_F_ALPHA, 0.1), + + EndList(), }; diff --git a/src/goddard/dynlists/dynlists.h b/src/goddard/dynlists/dynlists.h index d6973075..c134a21c 100644 --- a/src/goddard/dynlists/dynlists.h +++ b/src/goddard/dynlists/dynlists.h @@ -3,14 +3,146 @@ #include "../gd_types.h" -extern struct DynList dynlist_test_cube[67]; -extern struct DynList dynlist_unused[62]; -extern struct DynList dynlist_mario_face[44]; -extern struct DynList dynlist_mario_eye_right[28]; -extern struct DynList dynlist_mario_eye_left[28]; -extern struct DynList dynlist_mario_eyebrow_right[16]; -extern struct DynList dynlist_mario_eyebrow_left[16]; -extern struct DynList dynlist_mario_mustache[16]; -extern struct DynList dynlist_mario_master[1026]; +// Dynamic Object names +enum { + DYNOBJ_MARIO_RIGHT_MUSTACHE_JOINT_2 = 3, + DYNOBJ_MARIO_RIGHT_MUSTACHE_JOINT_1 = 6, + DYNOBJ_MARIO_RIGHT_MUSTACHE_ANIMDATA_GROUP = 7, + DYNOBJ_MARIO_RIGHT_MUSTACHE_ANIMATOR = 8, + DYNOBJ_MARIO_RIGHT_MUSTACHE_SKIN_NET = 9, + DYNOBJ_MARIO_LEFT_MUSTACHE_JOINT_2 = 12, + DYNOBJ_MARIO_LEFT_MUSTACHE_JOINT_1 = 15, + DYNOBJ_MARIO_LEFT_MUSTACHE_ANIMDATA_GROUP = 16, + DYNOBJ_MARIO_LEFT_MUSTACHE_ANIMATOR = 17, + DYNOBJ_MARIO_LEFT_MUSTACHE_SKIN_NET = 18, + DYNOBJ_MARIO_MUSTACHE_NET = 21, // (left and right mustache skin nets are attached to this net) + DYNOBJ_MARIO_MUSTACHE_VTX_GROUP = 22, + DYNOBJ_MARIO_MUSTACHE_TRI_GROUP = 23, + DYNOBJ_MARIO_MUSTACHE_MTL_GROUP = 24, + DYNOBJ_MARIO_MUSTACHE_SHAPE = 25, + DYNOBJ_MARIO_LEFT_EYEBROW_MPART_JOINT_2 = 28, + DYNOBJ_MARIO_LEFT_EYEBROW_MPART_JOINT_1 = 31, + DYNOBJ_MARIO_LEFT_EYEBROW_MPART_SKIN_NET = 34, + DYNOBJ_MARIO_LEFT_EYEBROW_RPART_JOINT_2 = 37, + DYNOBJ_MARIO_LEFT_EYEBROW_RPART_JOINT_1 = 40, + DYNOBJ_MARIO_LEFT_EYEBROW_RPART_SKIN_NET = 43, + DYNOBJ_MARIO_LEFT_EYEBROW_LPART_JOINT_2 = 46, + DYNOBJ_MARIO_LEFT_EYEBROW_LPART_JOINT_1 = 49, + DYNOBJ_MARIO_LEFT_EYEBROW_LPART_SKIN_NET = 52, + DYNOBJ_MARIO_LEFT_EYEBROW_NET = 55, + DYNOBJ_MARIO_LEFT_EYEBROW_VTX_GROUP = 56, + DYNOBJ_MARIO_LEFT_EYEBROW_TRI_GROUP = 57, + DYNOBJ_MARIO_LEFT_EYEBROW_MTL_GROUP = 58, + DYNOBJ_MARIO_LEFT_EYEBROW_SHAPE = 59, + DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_JOINT_2 = 62, + DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_JOINT_1 = 65, + DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_SKIN_NET = 68, + DYNOBJ_MARIO_RIGHT_EYEBROW_LPART_JOINT_2 = 71, + DYNOBJ_MARIO_RIGHT_EYEBROW_LPART_JOINT_1 = 74, + DYNOBJ_MARIO_RIGHT_EYEBROW_LPART_SKIN_NET = 77, + DYNOBJ_MARIO_RIGHT_EYEBROW_RPART_JOINT_2 = 80, + DYNOBJ_MARIO_RIGHT_EYEBROW_RPART_JOINT_1 = 83, + DYNOBJ_MARIO_RIGHT_EYEBROW_RPART_SKIN_NET = 86, + DYNOBJ_MARIO_RIGHT_EYEBROW_NET = 89, + DYNOBJ_MARIO_RIGHT_EYEBROW_VTX_GROUP = 90, + DYNOBJ_MARIO_RIGHT_EYEBROW_TRI_GROUP = 91, + DYNOBJ_MARIO_RIGHT_EYEBROW_MTL_GROUP = 92, + DYNOBJ_MARIO_RIGHT_EYEBROW_SHAPE = 93, + DYNOBJ_MARIO_LEFT_EYE_UNKNOWN_NET = 96, + DYNOBJ_MARIO_LEFT_EYE_VTX_GROUP = 97, + DYNOBJ_MARIO_LEFT_EYE_TRI_GROUP = 98, + DYNOBJ_MARIO_LEFT_EYE_MTL_GROUP = 99, + DYNOBJ_MARIO_LEFT_EYE_SHAPE = 100, + DYNOMJ_MARIO_LEFT_EYE_JOINT_2 = 103, + DYNOBJ_MARIO_LEFT_EYE_JOINT_1 = 106, + DYNOBJ_MARIO_LEFT_EYE_ANIMDATA_GROUP = 107, + DYNOBJ_MARIO_LEFT_EYE_ANIMATOR = 108, + DYNOBJ_MARIO_LEFT_EYE_SKIN_NET = 109, + DYNOBJ_MARIO_RIGHT_EYE_UNKNOWN_NET = 112, + DYNOBJ_MARIO_RIGHT_EYE_VTX_GROUP = 113, + DYNOBJ_MARIO_RIGHT_EYE_TRI_GROUP = 114, + DYNOBJ_MARIO_RIGHT_EYE_MTL_GROUP = 115, + DYNOBJ_MARIO_RIGHT_EYE_SHAPE = 116, + DYNOBJ_MARIO_RIGHT_EYE_JOINT_2 = 119, + DYNOBJ_MARIO_RIGHT_EYE_JOINT_1 = 122, + DYNOBJ_MARIO_RIGHT_EYE_ANIMDATA_GROUP = 123, + DYNOBJ_MARIO_RIGHT_EYE_ANIMATOR = 124, + DYNOBJ_MARIO_RIGHT_EYE_SKIN_NET = 125, + DYNOBJ_MARIO_CAP_JOINT_2 = 128, + DYNOBJ_MARIO_CAP_JOINT_1 = 131, + DYNOBJ_MARIO_CAP_ANIMDATA_GROUP = 132, + DYNOBJ_MARIO_CAP_ANIMATOR = 133, + DYNOBJ_MARIO_CAP_SKIN_NET = 134, + DYNOBJ_MARIO_UNKNOWN_137 = 137, + DYNOBJ_MARIO_UNKNOWN_140 = 140, + DYNOBJ_MARIO_LEFT_LIP_CORNER_JOINT_2 = 146, + DYNOBJ_MARIO_LEFT_LIP_CORNER_JOINT_1 = 149, + DYNOBJ_MARIO_LEFT_LIP_CORNER_ANIMDATA_GROUP = 150, + DYNOBJ_MARIO_LEFT_LIP_CORNER_ANIMATOR = 151, + DYNOBJ_MARIO_LEFT_LIP_CORNER_SKIN_NET = 152, + DYNOBJ_MARIO_RIGHT_LIP_CORNER_JOINT_2 = 155, + DYNOBJ_MARIO_RIGHT_LIP_CORNER_JOINT_1 = 158, + DYNOBJ_MARIO_RIGHT_LIP_CORNER_ANIMDATA_GROUP = 159, + DYNOBJ_MARIO_RIGHT_LIP_CORNER_ANIMATOR = 160, + DYNOBJ_MARIO_RIGHT_LIP_CORNER_SKIN_NET = 161, + DYNOBJ_MARIO_LEFT_EAR_JOINT_2 = 164, + DYNOBJ_MARIO_LEFT_EAR_JOINT_1 = 167, // 167 "N167l" + DYNOBJ_MARIO_LEFT_EAR_ANIMDATA_GROUP = 168, + DYNOBJ_MARIO_LEFT_EAR_ANIMATOR = 169, + DYNOBJ_MARIO_LEFT_EAR_SKIN_NET = 170, + DYNOBJ_MARIO_RIGHT_EAR_JOINT_2 = 173, + DYNOBJ_MARIO_RIGHT_EAR_JOINT_1 = 176, + DYNOBJ_MARIO_RIGHT_EAR_ANIMADATA_GROUP = 177, + DYNOBJ_MARIO_RIGHT_EAR_ANIMATOR = 178, + DYNOBJ_MARIO_RIGHT_EAR_SKIN_NET = 179, + DYNOBJ_MARIO_NOSE_JOINT_2 = 182, + DYNOBJ_MARIO_NOSE_JOINT_1 = 185, + DYNOBJ_MARIO_NOSE_ANIMDATA_GROUP = 186, + DYNOBJ_MARIO_NOSE_ANIMATOR = 187, + DYNOBJ_MARIO_NOSE_SKIN_NET = 188, + DYNOBJ_MARIO_UNKNOWN_191 = 191, + DYNOBJ_MARIO_LEFT_JAW_JOINT = 194, + DYNOBJ_MARIO_LEFT_JAW_ANIMDATA_GROUP = 195, + DYNOBJ_MARIO_LEFT_JAW_ANIMATOR = 196, + DYNOBJ_MARIO_RIGHT_JAW_JOINT = 197, + DYNOBJ_MARIO_RIGHT_JAW_ANIMDATA_GROUP = 198, + DYNOBJ_MARIO_RIGHT_JAW_ANIMATOR = 199, + DYNOBJ_MARIO_JAW_SKIN_NET = 200, + DYNOBJ_LEFT_EYELID_JOINT_2 = 203, + DYNOBJ_LEFT_EYELID_JOINT_1 = 206, + DYNOBJ_LEFT_EYELID_ANIMDATA_GROUP = 207, + DYNOBJ_LEFT_EYELID_ANIMATOR = 208, + DYNOBJ_LEFT_EYELID_SKIN_NET = 209, + DYNOBJ_RIGHT_EYELID_JOINT_2 = 212, + DYNOBJ_RIGHT_EYELID_JOINT_1 = 215, + DYNOBJ_RIGHT_EYELID_ANIMDATA_GROUP = 216, + DYNOBJ_RIGHT_EYELID_ANIMATOR = 217, + DYNOBJ_RIGHT_EYELID_SKIN_NET = 218, + DYNOBJ_MARIO_MAIN_NET = 221, // rename to HEAD_NET? + DYNOBJ_MARIO_FACE_VTX_GROUP = 222, + DYNOBJ_MARIO_FACE_TRI_GROUP = 223, + DYNOBJ_MARIO_FACE_MTL_GROUP = 224, + DYNOBJ_MARIO_FACE_SHAPE = 225, + DYNOBJ_MARIO_HEAD_ANIMDATA_GROUP = 226, + DYNOBJ_MARIO_HEAD_ANIMATOR = 227, + DYNOBJ_SILVER_STAR_LIGHT = 228, // "N228l" + DYNOBJ_SILVER_STAR_ANIMDATA_GROUP = 229, + DYNOBJ_SILVER_STAR_ANIMATOR = 230, + DYNOBJ_RED_STAR_LIGHT = 231, // "N231l" + DYNOBJ_RED_STAR_ANIMDATA_GROUP = 232, + DYNOBJ_RED_STAR_ANIMATOR = 233, + DYNOBJ_MARIO_MAIN_SHAPES_GROUP = 1000, // "N1000l" + DYNOBJ_MARIO_MAIN_ANIMATOR = 1001 // root animator +}; + +extern struct DynList dynlist_test_cube[]; +extern struct DynList dynlist_spot_shape[]; +extern struct DynList dynlist_mario_face_shape[]; +extern struct DynList dynlist_mario_eye_right_shape[]; +extern struct DynList dynlist_mario_eye_left_shape[]; +extern struct DynList dynlist_mario_eyebrow_right_shape[]; +extern struct DynList dynlist_mario_eyebrow_left_shape[]; +extern struct DynList dynlist_mario_mustache_shape[]; +extern struct DynList dynlist_mario_master[]; #endif // GD_DYNLISTS_H diff --git a/src/goddard/dynlists/dynlists_mario_eyebrows_mustache.c b/src/goddard/dynlists/dynlists_mario_eyebrows_mustache.c index 7c406087..28569138 100644 --- a/src/goddard/dynlists/dynlists_mario_eyebrows_mustache.c +++ b/src/goddard/dynlists/dynlists_mario_eyebrows_mustache.c @@ -1,12 +1,11 @@ #include +#include "macros.h" #include "dynlist_macros.h" #include "dynlists.h" #include "../dynlist_proc.h" -#define VTX_NUM 26 -/* @ 040042E0 */ -s16 verts_mario_eyebrow_right[VTX_NUM][3] = { +static s16 verts_mario_eyebrow_right[][3] = { { 105, 391, 363 }, { 62, 370, 378 }, { 86, 366, 370 }, { 171, 380, 339 }, { 139, 377, 353 }, { 193, 353, 331 }, { 204, 314, 297 }, { 175, 342, 305 }, { 209, 361, 291 }, { 124, 360, 323 }, { 161, 393, 306 }, { 230, 323, 286 }, { 233, 276, 289 }, { 123, 402, 319 }, { 85, 399, 334 }, @@ -15,13 +14,9 @@ s16 verts_mario_eyebrow_right[VTX_NUM][3] = { { 41, 345, 382 }, }; -/* @ 0400437C */ -struct GdVtxData vtx_mario_eyebrow_right = { VTX_NUM, 0x1, verts_mario_eyebrow_right }; -#undef VTX_NUM +static struct GdVtxData vtx_mario_eyebrow_right = { ARRAY_COUNT(verts_mario_eyebrow_right), 0x1, verts_mario_eyebrow_right }; -#define FACE_NUM 36 -/* @ 04004388 */ -u16 facedata_mario_eyebrow_right[FACE_NUM][4] = { +static u16 facedata_mario_eyebrow_right[][4] = { { 0, 0, 1, 2 }, { 0, 3, 4, 5 }, { 0, 20, 23, 19 }, { 0, 1, 25, 22 }, { 0, 0, 21, 13 }, { 0, 2, 15, 9 }, { 0, 7, 6, 20 }, { 0, 3, 19, 8 }, { 0, 25, 1, 24 }, { 0, 19, 5, 20 }, { 0, 19, 3, 5 }, { 0, 3, 21, 4 }, { 0, 21, 0, 4 }, { 0, 0, 2, 4 }, { 0, 1, 22, 2 }, @@ -32,33 +27,33 @@ u16 facedata_mario_eyebrow_right[FACE_NUM][4] = { { 0, 9, 7, 5 }, }; -/* @ 040044A8 */ -struct GdFaceData faces_mario_eyebrow_right = { FACE_NUM, 0x1, facedata_mario_eyebrow_right }; -#undef FACE_NUM +static struct GdFaceData faces_mario_eyebrow_right = { ARRAY_COUNT(facedata_mario_eyebrow_right), 0x1, facedata_mario_eyebrow_right }; -/* @ 040044B4 */ -struct DynList dynlist_mario_eyebrow_right[16] = { - StartList(), - MakeDynObj(D_DATA_GRP, 0x5A), - LinkWithPtr(&vtx_mario_eyebrow_right), - MakeDynObj(D_DATA_GRP, 0x5B), - LinkWithPtr(&faces_mario_eyebrow_right), - StartGroup(0x5C), - MakeDynObj(D_MATERIAL, 0x0), - SetId(0), - SetAmbient(0.0, 0.005, 0.0), - SetDiffuse(0.0, 0.0, 0.0), - EndGroup(0x5C), - MakeDynObj(D_SHAPE, 0x5D), - SetNodeGroup(0x5A), - SetPlaneGroup(0x5B), - SetMaterialGroup(0x5C), - StopList(), +struct DynList dynlist_mario_eyebrow_right_shape[] = { + BeginList(), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_RIGHT_EYEBROW_VTX_GROUP), + LinkWithPtr(&vtx_mario_eyebrow_right), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_RIGHT_EYEBROW_TRI_GROUP), + LinkWithPtr(&faces_mario_eyebrow_right), + + StartGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_MTL_GROUP), + MakeDynObj(D_MATERIAL, 0), + SetId(0), + SetAmbient(0.0, 0.005, 0.0), // Why is green 0.005 on the right eyebrow, but 0.0 on the left eyebrow? + SetDiffuse(0.0, 0.0, 0.0), + EndGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_MTL_GROUP), + + MakeDynObj(D_SHAPE, DYNOBJ_MARIO_RIGHT_EYEBROW_SHAPE), + SetNodeGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_VTX_GROUP), + SetPlaneGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_TRI_GROUP), + SetMaterialGroup(DYNOBJ_MARIO_RIGHT_EYEBROW_MTL_GROUP), + + EndList(), }; -#define VTX_NUM 26 -/* @ 04004634 */ -s16 verts_mario_eyebrow_left[VTX_NUM][3] = { +static s16 verts_mario_eyebrow_left[][3] = { { -57, 339, 377 }, { -17, 294, 356 }, { -45, 341, 383 }, { -45, 330, 354 }, { -73, 355, 342 }, { -52, 377, 349 }, { -139, 394, 353 }, { -123, 402, 319 }, { -161, 393, 306 }, { -233, 276, 289 }, { -204, 314, 297 }, { -214, 324, 318 }, { -29, 335, 363 }, { -231, 330, 311 }, { -230, 323, 286 }, @@ -67,13 +62,9 @@ s16 verts_mario_eyebrow_left[VTX_NUM][3] = { { -212, 358, 323 }, }; -/* @ 040046D0 */ -struct GdVtxData vtx_mario_eyebrow_left = { VTX_NUM, 0x1, verts_mario_eyebrow_left }; -#undef VTX_NUM +static struct GdVtxData vtx_mario_eyebrow_left = { ARRAY_COUNT(verts_mario_eyebrow_left), 0x1, verts_mario_eyebrow_left }; -#define FACE_NUM 36 -/* @ 040046DC */ -u16 facedata_mario_eyebrow_left[FACE_NUM][4] = { +static u16 facedata_mario_eyebrow_left[][4] = { { 0, 0, 1, 2 }, { 0, 8, 22, 6 }, { 0, 6, 7, 8 }, { 0, 9, 10, 11 }, { 0, 1, 12, 2 }, { 0, 9, 13, 14 }, { 0, 4, 0, 15 }, { 0, 16, 17, 18 }, { 0, 19, 5, 20 }, { 0, 21, 14, 13 }, { 0, 2, 12, 5 }, { 0, 22, 8, 21 }, { 0, 3, 1, 0 }, { 0, 23, 18, 11 }, { 0, 16, 15, 17 }, @@ -84,33 +75,33 @@ u16 facedata_mario_eyebrow_left[FACE_NUM][4] = { { 0, 25, 13, 11 }, }; -/* @ 040047FC */ -struct GdFaceData faces_mario_eyebrow_left = { FACE_NUM, 0x1, facedata_mario_eyebrow_left }; -#undef FACE_NUM +static struct GdFaceData faces_mario_eyebrow_left = { ARRAY_COUNT(facedata_mario_eyebrow_left), 0x1, facedata_mario_eyebrow_left }; -/* @ 04004808 */ -struct DynList dynlist_mario_eyebrow_left[16] = { - StartList(), - MakeDynObj(D_DATA_GRP, 0x38), - LinkWithPtr(&vtx_mario_eyebrow_left), - MakeDynObj(D_DATA_GRP, 0x39), - LinkWithPtr(&faces_mario_eyebrow_left), - StartGroup(0x3A), - MakeDynObj(D_MATERIAL, 0x0), - SetId(0), - SetAmbient(0.0, 0.0, 0.0), - SetDiffuse(0.0, 0.0, 0.0), - EndGroup(0x3A), - MakeDynObj(D_SHAPE, 0x3B), - SetNodeGroup(0x38), - SetPlaneGroup(0x39), - SetMaterialGroup(0x3A), - StopList(), +struct DynList dynlist_mario_eyebrow_left_shape[] = { + BeginList(), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_LEFT_EYEBROW_VTX_GROUP), + LinkWithPtr(&vtx_mario_eyebrow_left), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_LEFT_EYEBROW_TRI_GROUP), + LinkWithPtr(&faces_mario_eyebrow_left), + + StartGroup(DYNOBJ_MARIO_LEFT_EYEBROW_MTL_GROUP), + MakeDynObj(D_MATERIAL, 0), + SetId(0), + SetAmbient(0.0, 0.0, 0.0), + SetDiffuse(0.0, 0.0, 0.0), + EndGroup(DYNOBJ_MARIO_LEFT_EYEBROW_MTL_GROUP), + + MakeDynObj(D_SHAPE, DYNOBJ_MARIO_LEFT_EYEBROW_SHAPE), + SetNodeGroup(DYNOBJ_MARIO_LEFT_EYEBROW_VTX_GROUP), + SetPlaneGroup(DYNOBJ_MARIO_LEFT_EYEBROW_TRI_GROUP), + SetMaterialGroup(DYNOBJ_MARIO_LEFT_EYEBROW_MTL_GROUP), + + EndList(), }; -#define VTX_NUM 56 -/* @ 04004988 */ -s16 verts_mario_mustache[VTX_NUM][3] = { +static s16 verts_mario_mustache[][3] = { { -202, 15, 400 }, { -295, -13, 358 }, { -287, -45, 362 }, { 229, -89, 385 }, { 214, -126, 385 }, { 221, -131, 360 }, { -266, 73, 363 }, { -202, 15, 375 }, { -154, -160, 372 }, { -154, -148, 397 }, { -191, -150, 387 }, { 276, -74, 345 }, @@ -127,13 +118,9 @@ s16 verts_mario_mustache[VTX_NUM][3] = { { -121, -188, 384 }, { 75, -191, 396 }, { 304, 20, 332 }, { -304, 20, 332 }, }; -/* @ 04004AD8 */ -struct GdVtxData vtx_mario_mustache = { VTX_NUM, 0x1, verts_mario_mustache }; -#undef VTX_NUM +static struct GdVtxData vtx_mario_mustache = { ARRAY_COUNT(verts_mario_mustache), 0x1, verts_mario_mustache }; -#define FACE_NUM 100 -/* @ 04004AE4 */ -u16 facedata_mario_mustache[FACE_NUM][4] = { +static u16 facedata_mario_mustache[][4] = { { 0, 0, 1, 2 }, { 0, 3, 4, 5 }, { 0, 3, 5, 46 }, { 0, 6, 0, 7 }, { 0, 6, 7, 33 }, { 0, 8, 9, 10 }, { 0, 8, 10, 44 }, { 0, 11, 47, 12 }, { 0, 11, 12, 13 }, { 0, 14, 15, 16 }, { 0, 14, 16, 35 }, { 0, 2, 1, 48 }, { 0, 2, 48, 17 }, { 0, 18, 19, 20 }, { 0, 18, 20, 54 }, @@ -156,26 +143,28 @@ u16 facedata_mario_mustache[FACE_NUM][4] = { { 0, 17, 48, 55 }, { 0, 35, 49, 7 }, { 0, 54, 11, 23 }, { 0, 46, 5, 45 }, { 0, 5, 36, 45 }, }; -/* @ 04004E04 */ -struct GdFaceData faces_mario_mustache = { FACE_NUM, 0x1, facedata_mario_mustache }; -#undef FACE_NUM +static struct GdFaceData faces_mario_mustache = { ARRAY_COUNT(facedata_mario_mustache), 0x1, facedata_mario_mustache }; -/* @ 04004E10 */ -struct DynList dynlist_mario_mustache[16] = { - StartList(), - MakeDynObj(D_DATA_GRP, 0x16), - LinkWithPtr(&vtx_mario_mustache), - MakeDynObj(D_DATA_GRP, 0x17), - LinkWithPtr(&faces_mario_mustache), - StartGroup(0x18), - MakeDynObj(D_MATERIAL, 0x0), - SetId(0), - SetAmbient(0.0, 0.0, 0.0), - SetDiffuse(0.0, 0.0, 0.0), - EndGroup(0x18), - MakeDynObj(D_SHAPE, 0x19), - SetNodeGroup(0x16), - SetPlaneGroup(0x17), - SetMaterialGroup(0x18), - StopList(), +struct DynList dynlist_mario_mustache_shape[] = { + BeginList(), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_MUSTACHE_VTX_GROUP), + LinkWithPtr(&vtx_mario_mustache), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_MUSTACHE_TRI_GROUP), + LinkWithPtr(&faces_mario_mustache), + + StartGroup(DYNOBJ_MARIO_MUSTACHE_MTL_GROUP), + MakeDynObj(D_MATERIAL, 0), + SetId(0), + SetAmbient(0.0, 0.0, 0.0), + SetDiffuse(0.0, 0.0, 0.0), + EndGroup(DYNOBJ_MARIO_MUSTACHE_MTL_GROUP), + + MakeDynObj(D_SHAPE, DYNOBJ_MARIO_MUSTACHE_SHAPE), + SetNodeGroup(DYNOBJ_MARIO_MUSTACHE_VTX_GROUP), + SetPlaneGroup(DYNOBJ_MARIO_MUSTACHE_TRI_GROUP), + SetMaterialGroup(DYNOBJ_MARIO_MUSTACHE_MTL_GROUP), + + EndList(), }; diff --git a/src/goddard/dynlists/dynlists_mario_eyes.c b/src/goddard/dynlists/dynlists_mario_eyes.c index 4881f903..f01e21ff 100644 --- a/src/goddard/dynlists/dynlists_mario_eyes.c +++ b/src/goddard/dynlists/dynlists_mario_eyes.c @@ -1,12 +1,11 @@ #include +#include "macros.h" #include "dynlist_macros.h" #include "dynlists.h" #include "../dynlist_proc.h" -#define VTX_NUM 48 -/* @ 04003610 */ -static s16 verts_mario_eye_right[VTX_NUM][3] = { +static s16 verts_mario_eye_right[][3] = { { 306, 26, 83 }, { 318, 18, 81 }, { 312, -13, 94 }, { 308, 43, 53 }, { 320, 35, 50 }, { 308, 47, 12 }, { 320, 39, 9 }, { 316, 31, -30 }, { 304, 39, -27 }, { 311, 11, -58 }, { 299, 19, -55 }, { 304, -21, -66 }, { 287, -46, -51 }, { 299, -54, -53 }, { 285, -64, -20 }, @@ -19,13 +18,9 @@ static s16 verts_mario_eye_right[VTX_NUM][3] = { { 319, -13, 24 }, { 320, -7, 11 }, { 301, -6, 96 }, }; -/* @ 04003730 */ -static struct GdVtxData vtx_mario_eye_right = { VTX_NUM, 0x1, verts_mario_eye_right }; -#undef VTX_NUM +static struct GdVtxData vtx_mario_eye_right = { ARRAY_COUNT(verts_mario_eye_right), 0x1, verts_mario_eye_right }; -#define FACE_NUM 82 -/* @ 0400373C */ -static u16 facedata_mario_eye_right[FACE_NUM][4] = { +static u16 facedata_mario_eye_right[][4] = { { 1, 2, 1, 0 }, { 1, 1, 4, 3 }, { 1, 4, 6, 5 }, { 1, 6, 7, 5 }, { 1, 7, 9, 8 }, { 1, 9, 11, 10 }, { 1, 11, 13, 12 }, { 1, 13, 15, 14 }, { 1, 15, 17, 16 }, { 1, 17, 18, 16 }, { 1, 18, 20, 19 }, { 1, 20, 2, 21 }, { 1, 0, 47, 2 }, { 1, 2, 26, 1 }, { 1, 20, 26, 2 }, @@ -45,45 +40,49 @@ static u16 facedata_mario_eye_right[FACE_NUM][4] = { { 3, 42, 46, 45 }, { 3, 46, 44, 45 }, }; -/* @ 040039CC */ -static struct GdFaceData faces_mario_eye_right = { FACE_NUM, 0x1, facedata_mario_eye_right }; -#undef FACE_NUM +static struct GdFaceData faces_mario_eye_right = { ARRAY_COUNT(facedata_mario_eye_right), 0x1, facedata_mario_eye_right }; -/* @ 040039D8 */ -struct DynList dynlist_mario_eye_right[28] = { - StartList(), - MakeDynObj(D_DATA_GRP, 0x71), - LinkWithPtr(&vtx_mario_eye_right), - MakeDynObj(D_DATA_GRP, 0x72), - LinkWithPtr(&faces_mario_eye_right), - StartGroup(0x73), - MakeDynObj(D_MATERIAL, 0x0), - SetId(0), - SetAmbient(0.0, 0.291, 1.0), - SetDiffuse(0.0, 0.291, 1.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(1), - SetAmbient(0.0, 0.576, 1.0), - SetDiffuse(0.0, 0.576, 1.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(2), - SetAmbient(0.0, 0.0, 0.0), - SetDiffuse(0.0, 0.0, 0.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(3), - SetAmbient(1.0, 1.0, 1.0), - SetDiffuse(1.0, 1.0, 1.0), - EndGroup(0x73), - MakeDynObj(D_SHAPE, 0x74), - SetNodeGroup(0x71), - SetPlaneGroup(0x72), - SetMaterialGroup(0x73), - StopList(), +struct DynList dynlist_mario_eye_right_shape[] = { + BeginList(), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_RIGHT_EYE_VTX_GROUP), + LinkWithPtr(&vtx_mario_eye_right), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_RIGHT_EYE_TRI_GROUP), + LinkWithPtr(&faces_mario_eye_right), + + StartGroup(DYNOBJ_MARIO_RIGHT_EYE_MTL_GROUP), + // ??? + MakeDynObj(D_MATERIAL, 0), + SetId(0), + SetAmbient(0.0, 0.291, 1.0), + SetDiffuse(0.0, 0.291, 1.0), + // Iris color + MakeDynObj(D_MATERIAL, 0), + SetId(1), + SetAmbient(0.0, 0.576, 1.0), + SetDiffuse(0.0, 0.576, 1.0), + // Pupil color + MakeDynObj(D_MATERIAL, 0), + SetId(2), + SetAmbient(0.0, 0.0, 0.0), + SetDiffuse(0.0, 0.0, 0.0), + // Color of spot in the middle of pupil + MakeDynObj(D_MATERIAL, 0), + SetId(3), + SetAmbient(1.0, 1.0, 1.0), + SetDiffuse(1.0, 1.0, 1.0), + EndGroup(DYNOBJ_MARIO_RIGHT_EYE_MTL_GROUP), + + MakeDynObj(D_SHAPE, DYNOBJ_MARIO_RIGHT_EYE_SHAPE), + SetNodeGroup(DYNOBJ_MARIO_RIGHT_EYE_VTX_GROUP), + SetPlaneGroup(DYNOBJ_MARIO_RIGHT_EYE_TRI_GROUP), + SetMaterialGroup(DYNOBJ_MARIO_RIGHT_EYE_MTL_GROUP), + + EndList(), }; -#define VTX_NUM 48 -/* @ 04003C78 */ -static s16 verts_mario_eye_left[VTX_NUM][3] = { +static s16 verts_mario_eye_left[][3] = { { 302, 35, -81 }, { 316, 28, -79 }, { 311, -2, -97 }, { 304, 48, -48 }, { 318, 40, -46 }, { 302, 46, -7 }, { 316, 38, -5 }, { 311, 24, 32 }, { 297, 32, 30 }, { 305, 0, 56 }, { 291, 7, 55 }, { 298, -34, 60 }, { 280, -57, 40 }, { 294, -64, 42 }, { 279, -70, 7 }, @@ -96,13 +95,9 @@ static s16 verts_mario_eye_left[VTX_NUM][3] = { { 319, -11, -28 }, { 319, -8, -14 }, { 297, 5, -99 }, }; -/* @ 04003D98 */ -static struct GdVtxData vtx_mario_eye_left = { VTX_NUM, 0x1, verts_mario_eye_left }; -#undef VTX_NUM +static struct GdVtxData vtx_mario_eye_left = { ARRAY_COUNT(verts_mario_eye_left), 0x1, verts_mario_eye_left }; -#define FACE_NUM 82 -/* @ 04003DA4 */ -static u16 facedata_mario_eye_left[FACE_NUM][4] = { +static u16 facedata_mario_eye_left[][4] = { { 1, 0, 1, 2 }, { 1, 3, 4, 1 }, { 1, 5, 6, 4 }, { 1, 5, 7, 6 }, { 1, 8, 9, 7 }, { 1, 10, 11, 9 }, { 1, 12, 13, 11 }, { 1, 14, 15, 13 }, { 1, 16, 17, 15 }, { 1, 16, 18, 17 }, { 1, 19, 20, 18 }, { 1, 21, 2, 20 }, { 1, 2, 47, 0 }, { 1, 1, 26, 2 }, { 1, 2, 26, 20 }, @@ -122,38 +117,44 @@ static u16 facedata_mario_eye_left[FACE_NUM][4] = { { 3, 45, 46, 42 }, { 3, 45, 44, 46 }, }; -/* @ 04004034 */ -static struct GdFaceData faces_mario_eye_left = { FACE_NUM, 0x1, facedata_mario_eye_left }; -#undef FACE_NUM +static struct GdFaceData faces_mario_eye_left = { ARRAY_COUNT(facedata_mario_eye_left), 0x1, facedata_mario_eye_left }; -/* @ 04004040 */ -struct DynList dynlist_mario_eye_left[28] = { - StartList(), - MakeDynObj(D_DATA_GRP, 0x61), - LinkWithPtr(&vtx_mario_eye_left), - MakeDynObj(D_DATA_GRP, 0x62), - LinkWithPtr(&faces_mario_eye_left), - StartGroup(0x63), - MakeDynObj(D_MATERIAL, 0x0), - SetId(0), - SetAmbient(0.0, 0.291, 1.0), - SetDiffuse(0.0, 0.291, 1.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(1), - SetAmbient(0.0, 0.576, 1.0), - SetDiffuse(0.0, 0.576, 1.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(2), - SetAmbient(0.0, 0.0, 0.0), - SetDiffuse(0.0, 0.0, 0.0), - MakeDynObj(D_MATERIAL, 0x0), - SetId(3), - SetAmbient(1.0, 1.0, 1.0), - SetDiffuse(1.0, 1.0, 1.0), - EndGroup(0x63), - MakeDynObj(D_SHAPE, 0x64), - SetNodeGroup(0x61), - SetPlaneGroup(0x62), - SetMaterialGroup(0x63), - StopList(), +struct DynList dynlist_mario_eye_left_shape[28] = { + BeginList(), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_LEFT_EYE_VTX_GROUP), + LinkWithPtr(&vtx_mario_eye_left), + + MakeDynObj(D_DATA_GRP, DYNOBJ_MARIO_LEFT_EYE_TRI_GROUP), + LinkWithPtr(&faces_mario_eye_left), + + StartGroup(DYNOBJ_MARIO_LEFT_EYE_MTL_GROUP), + // ??? + MakeDynObj(D_MATERIAL, 0), + SetId(0), + SetAmbient(0.0, 0.291, 1.0), + SetDiffuse(0.0, 0.291, 1.0), + // Iris color + MakeDynObj(D_MATERIAL, 0), + SetId(1), + SetAmbient(0.0, 0.576, 1.0), + SetDiffuse(0.0, 0.576, 1.0), + // Pupil color + MakeDynObj(D_MATERIAL, 0), + SetId(2), + SetAmbient(0.0, 0.0, 0.0), + SetDiffuse(0.0, 0.0, 0.0), + // Color of spot in the middle of pupil + MakeDynObj(D_MATERIAL, 0), + SetId(3), + SetAmbient(1.0, 1.0, 1.0), + SetDiffuse(1.0, 1.0, 1.0), + EndGroup(DYNOBJ_MARIO_LEFT_EYE_MTL_GROUP), + + MakeDynObj(D_SHAPE, DYNOBJ_MARIO_LEFT_EYE_SHAPE), + SetNodeGroup(DYNOBJ_MARIO_LEFT_EYE_VTX_GROUP), + SetPlaneGroup(DYNOBJ_MARIO_LEFT_EYE_TRI_GROUP), + SetMaterialGroup(DYNOBJ_MARIO_LEFT_EYE_MTL_GROUP), + + EndList(), }; diff --git a/src/goddard/gd_main.c b/src/goddard/gd_main.c index bdf5b8a6..e515b328 100644 --- a/src/goddard/gd_main.c +++ b/src/goddard/gd_main.c @@ -24,12 +24,14 @@ static s32 sUnrefScnHeight = 240; struct GdControl gGdCtrl; // @ 801B9920; processed controller info struct GdControl gGdCtrlPrev; // @ 801B9A18; previous frame's controller info -/* @ 225DA0 for 0x110 */ +/** + * Unused main function possibly from when this was a standalone demo + */ u32 __main__(void) { UNUSED u32 pad1C; gd_printf("%x, %x\n", (u32) (uintptr_t) &D_801A8058, (u32) (uintptr_t) &gGdMoveScene); - add_to_stacktrace("main"); + imin("main"); gd_init(); gGdCtrl.unk88 = 0.46799f; @@ -39,9 +41,8 @@ u32 __main__(void) { gGdCtrl.newStartPress = FALSE; gGdCtrl.prevFrame = &gGdCtrlPrev; - add_to_stacktrace("main - make_scene"); - // TODO: rename to "make_scene"?; called function does nothing, though - func_8017E20C(); + imin("main - make_scene"); + make_scene(); // make_scene does nothing, though imout(); gd_init_controllers(); diff --git a/src/goddard/gd_main.h b/src/goddard/gd_main.h index 7ec51f48..2fa0c3ec 100644 --- a/src/goddard/gd_main.h +++ b/src/goddard/gd_main.h @@ -22,7 +22,7 @@ // structs struct GdControl { // gGdCtrl - /* 0x00 */ s32 unk00; + /* 0x00 */ s32 unk00; // set but never used /* 0x04 */ u8 pad04[4]; /* 0x08 */ s32 dleft; // Dpad-left (mask) /* 0x0C */ s32 dright; // Dpad-right (mask) @@ -47,14 +47,14 @@ struct GdControl { // gGdCtrl /* 0x7C */ f32 stickXf; /* 0x80 */ f32 stickYf; /* 0x84 */ u8 pad84[4]; - /* 0x88 */ f32 unk88; + /* 0x88 */ f32 unk88; // set but never used /* 0x8C */ u8 pad8c[0xA0-0x8C]; - /* 0xA0 */ f32 unkA0; + /* 0xA0 */ f32 unkA0; // set but never used /* 0xA4 */ u8 padA4[0xAC-0xA4]; /* 0xAC */ f32 unkAC; /* 0xB0 */ u8 padB0[0xB8-0xB0]; - /* 0xB8 */ s32 csrXatApress; // cursor x position when there was a new (A) press? - /* 0xBC */ s32 csrYatApress; // cursor y position when there was a new (A) press? + /* 0xB8 */ s32 dragStartX; // cursor x position when there was a new (A) press? + /* 0xBC */ s32 dragStartY; // cursor y position when there was a new (A) press? /* 0xC0 */ s32 stickDeltaX; /* 0xC4 */ s32 stickDeltaY; /* 0xC8 */ s32 stickX; @@ -62,16 +62,16 @@ struct GdControl { // gGdCtrl /* 0xD0 */ s32 csrX; // bounded by screen view /* 0xD4 */ s32 csrY; // bounded by screen view /* 0xD8 */ /* hand/cursor state bitfield? */ - /* b80 */ u8 btnApressed : 1; // bool (A) pressed + /* b80 */ u8 dragging : 1; // bool (A) pressed /* b40 */ u8 unkD8b40 : 1; // set to FALSE and unused /* b20 */ u8 unkD8b20 : 1; // set to FALSE and unused - /* b10 */ u8 btnAnewPress : 1; // bool new (A) press + /* b10 */ u8 startedDragging : 1; // bool new (A) press /* b08 */ u8 unkD8b08 : 1; /* b04 */ u8 unkD8b04 : 1; /* b02 */ u8 AbtnPressWait : 1; // bool 10 frames between (A) presses (cursor cool down?) - /* 0xDC */ u32 frameAbtnPressed; // first frame of new a press + /* 0xDC */ u32 dragStartFrame; // first frame of new a press /* 0xE0 */ u8 padE0[0xE8-0xE0]; - /* 0xE8 */ u32 frameCount; // frame count? + /* 0xE8 */ u32 currFrame; // frame count? /* 0xEC */ u8 padEC[0xF0-0xEC]; /* 0xF0 */ struct GdControl *prevFrame; // previous frame data }; diff --git a/src/goddard/gd_math.c b/src/goddard/gd_math.c index 0050a753..bc155f6c 100644 --- a/src/goddard/gd_math.c +++ b/src/goddard/gd_math.c @@ -887,12 +887,12 @@ void gd_print_vec(UNUSED const char *prefix, const struct GdVec3f *vec) { * * Printed a prefix at some point, as shone by how the function is used. */ -void gd_print_plane(UNUSED const char *prefix, UNUSED const struct GdPlaneF *p) { +void gd_print_bounding_box(UNUSED const char *prefix, UNUSED const struct GdBoundingBox *p) { UNUSED u8 pad[8]; - printf("Min X = %f, Max X = %f \n", p->p0.x, p->p1.x); - printf("Min Y = %f, Max Y = %f \n", p->p0.y, p->p1.y); - printf("Min Z = %f, Max Z = %f \n", p->p0.z, p->p1.z); + printf("Min X = %f, Max X = %f \n", p->minX, p->maxX); + printf("Min Y = %f, Max Y = %f \n", p->minY, p->maxY); + printf("Min Z = %f, Max Z = %f \n", p->minZ, p->maxZ); printf("\n"); } diff --git a/src/goddard/gd_math.h b/src/goddard/gd_math.h index fff705b9..53c35397 100644 --- a/src/goddard/gd_math.h +++ b/src/goddard/gd_math.h @@ -50,7 +50,7 @@ void gd_rotate_and_translate_vec3f(struct GdVec3f *vec, const Mat4f *mtx); void gd_mat4f_mult_vec3f(struct GdVec3f *vec, const Mat4f *mtx); void gd_mult_mat4f(const Mat4f *mA, const Mat4f *mB, Mat4f *dst); void gd_print_vec(UNUSED const char *prefix, const struct GdVec3f *vec); -void gd_print_plane(UNUSED const char *prefix, const struct GdPlaneF *p); +void gd_print_bounding_box(UNUSED const char *prefix, const struct GdBoundingBox *p); void gd_print_mtx(UNUSED const char *prefix, const Mat4f *mtx); #endif // GD_MATH_H diff --git a/src/goddard/gd_memory.c b/src/goddard/gd_memory.c index 5d0d1509..74fa0a2c 100644 --- a/src/goddard/gd_memory.c +++ b/src/goddard/gd_memory.c @@ -312,22 +312,3 @@ void mem_stats(void) { list = sEmptyBlockListHead; print_list_stats(list, FALSE, PERM_G_MEM_BLOCK | TEMP_G_MEM_BLOCK); } - -/* - :::::: - MMMMMMMMMM :::::: - MMMMMMMMMMMMMMMMMM:::: - SSSSSS::::SS:: SSSSSS - SS::SS::::::SS::::::SSSS - SS::SSSS::::::SS::::::SS - SSSS::::::::SSSSSSSSSS - ::::::::::::::SS - SSSSSSSSSSMMSSSSSSMMSS - SSSSSSSSSSSSSSMMSSSSSSMM SS -::::SSSSSSSSSSSSMMMMMMMMMM SS -:::::: MMSSMMMMMM::MM::MMSSSS - :: SS MMMMMMMMMMMMMMMMMMSSSS - SSSSSSMMMMMMMMMMMMMMMMMMSSSS - SSSSSSMMMMMMMMMMMMMM - SS MMMMMMMM -*/ diff --git a/src/goddard/gd_types.h b/src/goddard/gd_types.h index 0857cc06..a0213d44 100644 --- a/src/goddard/gd_types.h +++ b/src/goddard/gd_types.h @@ -9,14 +9,21 @@ struct GdVec3f f32 x, y, z; }; -struct GdPlaneF { - struct GdVec3f p0, p1; +struct GdBoundingBox { + f32 minX, minY, minZ; + f32 maxX, maxY, maxZ; }; struct GdTriangleF { struct GdVec3f p0, p1, p2; }; +struct GdAnimTransform { + struct GdVec3f scale; + struct GdVec3f rotate; // each component specifies the degrees to rotate about that axis + struct GdVec3f pos; +}; + typedef f32 Mat4f[4][4]; struct GdColour { @@ -71,39 +78,46 @@ enum ObjTypeFlag { typedef void (*drawmethod_t)(void *); /// Flags for the drawFlags field of an GdObj enum ObjDrawingFlags { - OBJ_DRAW_UNK01 = 0x01, - OBJ_NOT_DRAWABLE = 0x02, ///< This `GdObj` shouldn't be drawn when updating a scene - OBJ_PICKED = 0x04, ///< This `GdObj` is held by the cursor - OBJ_IS_GRABBALE = 0x08, ///< This `GdObj` can be grabbed/picked by the cursor - OBJ_USE_ENV_COLOUR = 0x10 + OBJ_DRAW_UNK01 = 0x01, + OBJ_INVISIBLE = 0x02, ///< This `GdObj` shouldn't be drawn when updating a scene + OBJ_PICKED = 0x04, ///< This `GdObj` is held by the cursor + OBJ_IS_GRABBALE = 0x08, ///< This `GdObj` can be grabbed/picked by the cursor + OBJ_HIGHLIGHTED = 0x10 }; /** * The base of structure of all of Goddard's objects. It is present as a "header" * at the beginning of all `ObjX` structures, and as such, this type is used - * when he need to generalize code to take different `ObjX`es. - * It is also a linked list node structure with `prev` and `next` pointers. + * when we need to generalize code to take different `ObjX`es. + * Every GdObj created is connected together in a linked list with `prev` and `next` pointers. */ struct GdObj { - /* 0x00 */ struct GdObj *prev; - /* 0x04 */ struct GdObj *next; + /* 0x00 */ struct GdObj *prev; // previous node in gGdObjectList linked list + /* 0x04 */ struct GdObj *next; // next node in gGdObjectList linked list /* 0x08 */ drawmethod_t objDrawFn; /* 0x0C */ enum ObjTypeFlag type; - /* 0x10 */ s16 number; ///< the index of this `GdObj` in the linked list + /* 0x10 */ s16 index; ///< the index of this `GdObj` in the linked list /* 0x12 */ u16 drawFlags; ///< enumerated in `::ObjDrawingFlags` /* 0x14 Specific object data starts here */ }; /* Used to create a linked list of objects (or data) ** within an ObjGroup */ -struct Links { - /* 0x00 */ struct Links *prev; - /* 0x04 */ struct Links *next; +struct ListNode { + /* 0x00 */ struct ListNode *prev; + /* 0x04 */ struct ListNode *next; /* 0x08 */ struct GdObj *obj; }; +// I think this is actually the same type as ListNode, and data is just a generic "void *" pointer. +struct VtxLink { + struct VtxLink *prev; + struct VtxLink *next; + Vtx *data; +}; + /* These are the compressed versions of ObjFace or ObjVertex that are -** pointed to by Links in the faceGroup and vtxGroup, if Group.linkType +** pointed to by ListNode in the faceGroup and vtxGroup, if Group.linkType ** is set to 0x01. See `chk_shapegen` */ struct GdFaceData { u32 count; @@ -119,16 +133,16 @@ struct GdVtxData { /** - * This is test documentation comment for ObjGroup + * Used to group related objects together. Seems to mainly be used for `apply_to_obj_types_in_group`. */ struct ObjGroup { /* 0x00 */ struct GdObj header; /* 0x14 */ struct ObjGroup *prev; /* 0x18 */ struct ObjGroup *next; - /* 0x1C */ struct Links *link1C; ///< Head of a linked list for objects contained in this group - /* 0x20 */ struct Links *link20; // what is this second one used for? - /* 0x24 */ s32 groupObjTypes; ///< OR'd collection of type flags for all objects in this group - /* 0x28 */ s32 objCount; + /* 0x1C */ struct ListNode *firstMember; ///< Head of a linked list for objects contained in this group + /* 0x20 */ struct ListNode *lastMember; ///< Tail of a linked list for objects contained in this group + /* 0x24 */ s32 memberTypes; ///< OR'd collection of type flags for all objects in this group + /* 0x28 */ s32 memberCount; // number of objects in this group /* 0x2C */ s32 debugPrint; // might also be a type? /* 0x30 */ s32 linkType; /* 0x34 */ char name[0x40]; ///< possibly, only referenced in old code @@ -142,26 +156,26 @@ struct ObjGroup { struct ObjBone { /* 0x000 */ struct GdObj header; - /* 0x014 */ struct GdVec3f unk14; // "position"?? from dead code in draw_bone + /* 0x014 */ struct GdVec3f worldPos; // "position"?? from dead code in draw_bone /* 0x020 */ struct ObjBone *prev; // maybe, based on make_bone /* 0x024 */ struct ObjBone *next; // maybe, based on make_bone /* 0x028 */ struct GdVec3f unk28; // "rotation"?? from dead code in draw_bone /* 0x034 */ u8 pad34[0x40-0x34]; /* 0x040 */ struct GdVec3f unk40; /* 0x04C */ u8 pad4C[0x58-0x4C]; - /* 0x058 */ struct GdVec3f unk58; + /* 0x058 */ struct GdVec3f unk58; // orientation? /* 0x064 */ struct GdVec3f unk64; /* 0x070 */ Mat4f mat70; /* 0x0B0 */ Mat4f matB0; - /* 0x0F0 */ struct ObjShape *unkF0; // from dead code in draw_bone - /* 0x0F4 */ f32 unkF4; - /* 0x0F8 */ f32 unkF8; // from dead code in draw_bone - /* 0x0FC */ f32 unkFC; - /* 0x100 */ s32 unk100; // "colour" + /* 0x0F0 */ struct ObjShape *shapePtr; // from dead code in draw_bone + /* 0x0F4 */ f32 unkF4; // also length? + /* 0x0F8 */ f32 unkF8; // length? + /* 0x0FC */ f32 unkFC; // also length? + /* 0x100 */ s32 colourNum; // "colour" /* 0x104 */ s32 unk104; // "flags" /* 0x108 */ s32 id; /* 0x10C */ struct ObjGroup *unk10C; // group of joints? - /* 0x110 */ f32 unk110; // "spring" + /* 0x110 */ f32 spring; /* 0x114 */ f32 unk114; /* 0x118 */ f32 unk118; /* 0x11C */ u8 pad11C[0x124-0x11C]; @@ -169,45 +183,45 @@ struct ObjBone { struct ObjJoint { /* 0x000 */ struct GdObj header; - /* 0x014 */ struct GdVec3f unk14; //position? based on d_set_initpos - /* 0x020 */ struct ObjShape *unk20; + /* 0x014 */ struct GdVec3f worldPos; // position in world space + /* 0x020 */ struct ObjShape *shapePtr; /* 0x024 */ struct ObjJoint *prevjoint; // prev joint? linked joint? /* 0x028 */ struct ObjJoint *nextjoint; - /* 0x02C */ void (*fn2C)(struct ObjJoint*); + /* 0x02C */ void (*updateFunc)(struct ObjJoint*); // seems to update attached objects? see grabbable_joint_update_func /* 0x030 */ struct GdVec3f unk30; // huge array of vecs? another matrix? /* 0x03C */ struct GdVec3f unk3C; // relative position? /* 0x048 */ struct GdVec3f unk48; - /* 0x054 */ struct GdVec3f unk54; // attached offset (with +200 as well) + /* 0x054 */ struct GdVec3f initPos; // attached offset? (with +200 as well) /* 0x060 */ u8 pad60[0x6C-0x60]; /* 0x06C */ struct GdVec3f unk6C; // initial rotation vec - /* 0x078 */ struct GdVec3f unk78; + /* 0x078 */ struct GdVec3f velocity; /* 0x084 */ struct GdVec3f unk84; /* 0x090 */ struct GdVec3f unk90; - /* 0x09C */ struct GdVec3f unk9C; // scale vec? + /* 0x09C */ struct GdVec3f scale; /* 0x0A8 */ struct GdVec3f unkA8; /* 0x0B4 */ struct GdVec3f unkB4; - /* 0x0C0 */ struct GdVec3f unkC0; // "shape offset" + /* 0x0C0 */ struct GdVec3f shapeOffset; /* 0x0CC */ struct GdVec3f unkCC; /* 0x0D8 */ u8 padD8[4]; - /* 0x0DC */ struct GdVec3f unkDC; // "friction" + /* 0x0DC */ struct GdVec3f friction; /* 0x0E8 */ Mat4f matE8; //matrix4x4 /* 0x128 */ Mat4f mat128; // "rot matrix" /* 0x168 */ Mat4f mat168; // "id matrix" /* 0x1A8 */ struct GdVec3f unk1A8; /* 0x1B4 */ s32 id; /* 0x1B8 */ u8 pad1B8[4]; - /* 0x1BC */ s32 unk1BC; // "flags" + /* 0x1BC */ s32 flags; // "flags" - 0x2000 = grabbed /* 0x1C0 */ s32 unk1C0; /* 0x1C4 */ struct ObjGroup *unk1C4; // bone group? - /* 0x1C8 */ s32 unk1C8; // "colour" - /* 0x1CC */ s32 unk1CC; // "type" - /* 0x1D0 */ struct ObjAnimator *unk1D0; + /* 0x1C8 */ s32 colourNum; + /* 0x1CC */ s32 type; // 0 = normal joint, 5 = grabbable joint. seems to be set, but never used + /* 0x1D0 */ struct ObjAnimator *rootAnimator; // root animator? used by eye_joint_update_func /* 0x1D4 */ u8 pad1D4[0x1f4-0x1d4]; - /* 0x1F4 */ struct ObjGroup *unk1F4; //Group of ObjWeights, only? skin weights? - /* 0x1F8 */ struct ObjGroup *unk1F8; //attach object group - /* 0x1FC */ s32 unk1FC; //d_attach_to arg 0; "AttFlag" - /* 0x200 */ struct GdVec3f unk200; //attached offset? - /* 0x20C */ struct GdObj *unk20C; //attached object? + /* 0x1F4 */ struct ObjGroup *weightGrp; //Group of ObjWeights, only? skin weights? + /* 0x1F8 */ struct ObjGroup *attachedObjsGrp; //attach object group + /* 0x1FC */ s32 attachFlags; //d_attach_to arg 0; "AttFlag" + /* 0x200 */ struct GdVec3f attachOffset; + /* 0x20C */ struct GdObj *attachedToObj; // object that this object is attached to /* 0x210 */ u8 pad210[0x228-0x210]; /* 0x228 */ f32 unk228; }; /* sizeof = 0x22C */ @@ -219,8 +233,8 @@ struct ObjJoint { struct ObjParticle { /* 0x00 */ struct GdObj header; /* 0x14 */ u8 pad14[0x1C-0x14]; - /* 0x1C */ struct ObjShape *unk1C; // looks like a shape... - /* 0x20 */ struct GdVec3f unk20; // position vec? + /* 0x1C */ struct ObjShape *shapePtr; // looks like a shape... + /* 0x20 */ struct GdVec3f pos; // some kind of position - relative? world? /* 0x2C */ u8 pad2C[0x30-0x2C]; /* 0x30 */ f32 unk30; /* 0x34 */ u8 pad34[0x38-0x34]; @@ -229,13 +243,13 @@ struct ObjParticle { /* 0x48 */ f32 unk48; //not vec? /* 0x4C */ u8 pad4C[0x50-0x4C]; /* 0x50 */ s32 id; - /* 0x54 */ u32 unk54; // "dflags"? - /* 0x58 */ s32 unk58; // "colour" - /* 0x5C */ s32 unk5C; // gd dl dlptr offset? - /* 0x60 */ s32 unk60; //flag? type? - /* 0x64 */ s32 unk64; //flag? + /* 0x54 */ u32 flags; // "dflags"? + /* 0x58 */ s32 colourNum; + /* 0x5C */ s32 timeout; // when this reaches zero, the particle disappears + /* 0x60 */ s32 unk60; //type? + /* 0x64 */ s32 unk64; //type? (1 = has 50 sub-particles, 2,3 = has 30 sub-particles /* 0x68 */ u8 pad68[0x6C-0x68]; - /* 0x6C */ struct ObjGroup *unk6C; // group of other Particles ? + /* 0x6C */ struct ObjGroup *subParticlesGrp; // group of other Particles ? /* 0x70 */ u8 pad70[4]; /* 0x74 */ s32 unk74; /* 0x78 */ u8 unk78[4]; @@ -243,18 +257,21 @@ struct ObjParticle { /* 0x80 */ struct ObjLight *unk80; // could be a Net or Light; not seen as non-null in running code /* 0x84 */ u8 pad84[0xB0-0x84]; /* 0xB0 */ s32 unkB0; //state? - /* 0xB4 */ struct ObjGroup *unkB4; // attach group? unused group of particles - /* 0xB8 */ s32 unkB8; //attached arg0; "AttFlag" - /* 0xBC */ struct GdObj *unkBC; //attached obj? looks like can be a Light or Camera + /* 0xB4 */ struct ObjGroup *attachedObjsGrp; // attach group? unused group of particles + /* 0xB8 */ s32 attachFlags; //attached arg0; "AttFlag" + /* 0xBC */ struct GdObj *attachedToObj; // object that this object is attached to. looks like can be a Light or Camera }; /* sizeof = 0xC0 */ +/** + * An object that represents the visual portion of a 3D model. + */ struct ObjShape { /* 0x00 */ struct GdObj header; /* 0x14 */ struct ObjShape *prevShape; /* 0x18 */ struct ObjShape *nextShape; /* 0x1C */ struct ObjGroup *faceGroup; /* face group; based on get_3DG1_shape */ /* 0x20 */ struct ObjGroup *vtxGroup; /* vtx group; based on get_3DG1_shape */ - /* 0x24 */ struct ObjGroup *unk24; /* group for type 2 shapenets only ? */ + /* 0x24 */ struct ObjGroup *scaledVtxGroup; /* group for type 2 shapenets only ? vertices whose scaleFactor is not 1 get put into this group. */ /* 0x28 */ u8 pad28[4]; /* 0x2C */ struct ObjGroup *mtlGroup; /* what does this group do? materials? */ /* 0x30 */ s32 unk30; @@ -263,9 +280,10 @@ struct ObjShape { /* 0x3C */ s32 unk3C; // bool? if FALSE, then draw_shape_faces(shape) /* 0x40 */ u32 id; /* 0x44 */ s32 flag; // what are the flag values? only from dynlists? - /* 0x48 */ s32 gdDls[3]; // gd dl number for each frame buffer (??) [0, 1]; and an offset for GdDl->dlptr [2] + /* 0x48 */ s32 dlNums[2]; // gd dl number for each frame buffer (??) [0, 1] + s32 unk50; // frame number (index into dlNums)? /* 0x54 */ u8 pad54[0x58-0x54]; // part of above array?? - /* 0x58 */ f32 unk58; // paramF? opacitiy? something with rendertype + /* 0x58 */ f32 alpha; // paramF? opacitiy? something with rendertype /* 0x5C */ char name[0x40]; }; /* sizeof = 0x9C */ @@ -287,49 +305,49 @@ struct ObjShape { struct ObjNet { /* 0x000 */ struct GdObj header; - /* 0x014 */ struct GdVec3f unk14; // position? d_set_initpos + d_set_world_pos; print_net says world - /* 0x020 */ struct GdVec3f unk20; // position? d_set_initpos? attached offset? dynamic? scratch? + /* 0x014 */ struct GdVec3f worldPos; // position? d_set_initpos + d_set_world_pos; print_net says world + /* 0x020 */ struct GdVec3f initPos; // position? d_set_initpos? attached offset? dynamic? scratch? /* 0x02C */ u8 pad2c[0x34-0x2C]; - /* 0x034 */ s32 unk34; // "dflags"? - /* 0x038 */ u32 unk38; // some sort of id? from move_net + /* 0x034 */ s32 flags; // "dflags"? + /* 0x038 */ u32 id; // some sort of id? from move_net /* 0x03C */ s32 unk3C; // state flags? vertex info flags? - /* 0x040 */ s32 unk40; // gd "colour" - /* 0x044 */ struct GdVec3f unk44; // "force" - /* 0x050 */ struct GdVec3f unk50; // velocity - /* 0x05C */ struct GdVec3f unk5C; // rotation + /* 0x040 */ s32 colourNum; + /* 0x044 */ struct GdVec3f unusedForce; // "force" (unused) + /* 0x050 */ struct GdVec3f velocity; + /* 0x05C */ struct GdVec3f rotation; /* 0x068 */ struct GdVec3f unk68; //initial rotation? - /* 0x074 */ struct GdVec3f unk74; // "collDisp" - /* 0x080 */ struct GdVec3f unk80; // "collTorque" - /* 0x08C */ struct GdVec3f unk8C; // "CollTorqueL" - /* 0x098 */ struct GdVec3f unk98; // "CollTorqueD" - /* 0x0A4 */ struct GdVec3f unkA4; // torque - /* 0x0B0 */ struct GdVec3f unkB0; // "CofG" center of gravity? - /* 0x0BC */ struct GdPlaneF unkBC; // bounding box - /* 0x0D4 */ struct GdVec3f unkD4; // "CollDispOff" - /* 0x0E0 */ f32 unkE0; // "CollMaxD" - /* 0x0E4 */ f32 unkE4; // "MaxRadius" + /* 0x074 */ struct GdVec3f collDisp; // what is this? + /* 0x080 */ struct GdVec3f collTorque; // what is this? + /* 0x08C */ struct GdVec3f unusedCollTorqueL; // unused + /* 0x098 */ struct GdVec3f unusedCollTorqueD; // unused + /* 0x0A4 */ struct GdVec3f torque; // torque + /* 0x0B0 */ struct GdVec3f centerOfGravity; // "CofG" center of gravity? + /* 0x0BC */ struct GdBoundingBox boundingBox; + /* 0x0D4 */ struct GdVec3f unusedCollDispOff; // unused + /* 0x0E0 */ f32 unusedCollMaxD; // unused + /* 0x0E4 */ f32 maxRadius; /* 0x0E8 */ Mat4f matE8; /* 0x128 */ Mat4f mat128; /* 0x168 */ Mat4f mat168; // "rotation matrix" - /* 0x1A8 */ struct ObjShape *unk1A8; // "ShapePtr" - /* 0x1AC */ struct GdVec3f unk1AC; // scale - /* 0x1B8 */ f32 unk1B8; // "Mass" - /* 0x1BC */ s32 unk1BC; // "NumModes" - /* 0x1C0 */ struct ObjGroup *unk1C0; + /* 0x1A8 */ struct ObjShape *shapePtr; + /* 0x1AC */ struct GdVec3f scale; + /* 0x1B8 */ f32 unusedMass; // unused + /* 0x1BC */ s32 numModes; // unused + /* 0x1C0 */ struct ObjGroup *unk1C0; // group of `ObjVertex` or `ObjParticle` /* 0x1C4 */ struct ObjGroup *skinGrp; // SkinGroup (from reset_weight) (joints and bones) /* 0x1C8 */ struct ObjGroup *unk1C8; // "node group" (joints, weights?) /* 0x1CC */ struct ObjGroup *unk1CC; // plane group (only type 1?) /* 0x1D0 */ struct ObjGroup *unk1D0; // vertex group - /* 0x1D4 */ struct ObjGroup *unk1D4; // attached objects group? - /* 0x1D8 */ struct GdVec3f unk1D8; // attached offset - /* 0x1E4 */ s32 unk1E4; // d_attach_to arg 0; "AttFlag" - /* 0x1E8 */ struct GdObj *unk1E8; // attached obj? + /* 0x1D4 */ struct ObjGroup *attachedObjsGrp; + /* 0x1D8 */ struct GdVec3f attachOffset; + /* 0x1E4 */ s32 attachFlags; // d_attach_to arg 0; "AttFlag" + /* 0x1E8 */ struct GdObj *attachedToObj; // object that this object is attached to /* 0x1EC */ s32 netType; // from move_net /* 0x1F0 */ struct ObjNet *unk1F0; // or joint. guess from Unknown80192AD0 /* 0x1F4 */ struct GdVec3f unk1F4; /* 0x200 */ struct GdVec3f unk200; /* 0x20C */ struct ObjGroup *unk20C; - /* 0x210 */ s32 unk210; // "control type" + /* 0x210 */ s32 ctrlType; // has no purpose /* 0x214 */ u8 pad214[0x21C-0x214]; /* 0x21C */ struct ObjGroup *unk21C; }; /* sizeof = 0x220 */ @@ -341,48 +359,46 @@ struct ObjPlane { /* 0x1C */ f32 unk1C; /* 0x20 */ s32 unk20; /* 0x24 */ s32 unk24; - /* 0x28 */ struct GdPlaneF plane28; //position plane? + /* 0x28 */ struct GdBoundingBox boundingBox; /* 0x40 */ struct ObjFace* unk40; }; /* sizeof = 0x44*/ struct ObjVertex { /* 0x00 */ struct GdObj header; /* 0x14 */ struct GdVec3f initPos; - /* 0x20 */ struct GdVec3f pos; // rel position? world pos? both are set with the same value.. + /* 0x20 */ struct GdVec3f pos; // new position after being moved by joints? /* 0x2C */ struct GdVec3f normal; // normal? also color (like gbi?) /* 0x38 */ s16 id; - /* 0x3A */ u8 pad3A[2]; /* 0x3C */ f32 scaleFactor; /* 0x40 */ f32 alpha; /* 0x44 */ struct VtxLink *gbiVerts; }; /* sizeof = 0x48 */ -struct VtxLink { - struct VtxLink *prev; - struct VtxLink *next; - Vtx *data; -}; - +/** + * An object that represents a face in an `ObjShape`. It connects 3 or 4 vertices. + */ struct ObjFace { /* 0x00 */ struct GdObj header; /* 0x14 */ struct GdColour colour; - /* 0x20 */ s32 colNum; // "colour" index + /* 0x20 */ s32 colourNum; // "colour" index /* 0x24 */ struct GdVec3f normal; /* 0x30 */ s32 vtxCount; - /* 0x34 */ struct ObjVertex *vertices[4]; // these can also be s32 indices? which are then replaced by `find_thisface_verts` + /* 0x34 */ struct ObjVertex *vertices[4]; // these can also be s32 indices? which are then replaced by `find_thisface_verts` /* 0x44 */ s32 mtlId; // from compressed GdFaceData; -1 == coloured face? /* 0x48 */ struct ObjMaterial *mtl; // initialize to NULL; set by `map_face_materials` from mtlId }; /* sizeof = 0x4C */ +#define CAMERA_FLAG_CONTROLLABLE 0x4 + struct ObjCamera { /* 0x000 */ struct GdObj header; - /* 0x014 */ struct GdVec3f unk14; // position vec? from d_set_initpos + /* 0x014 */ struct GdVec3f worldPos; // position vec? from d_set_initpos /* 0x020 */ struct ObjCamera* prev; /* 0x024 */ struct ObjCamera* next; /* 0x028 */ s32 id; - /* 0x02C */ s32 unk2C; // flag of some sort + /* 0x02C */ s32 flags; // flag of some sort /* 0x030 */ struct GdObj* unk30; // pointer to some type of object - /* 0x034 */ struct GdVec3f unk34; + /* 0x034 */ struct GdVec3f lookAt; // point that the camera faces /* 0x040 */ struct GdVec3f unk40; // relative position related? /* 0x04C */ struct GdVec3f unk4C; /* 0x058 */ f32 unk58; // GdVec3f ? @@ -394,9 +410,9 @@ struct ObjCamera { /* 0x0E8 */ Mat4f unkE8; /* 0x128 */ struct GdVec3f unk128; //possibly /* 0x134 */ struct GdVec3f unk134; - /* 0x140 */ struct GdVec3f positions[4]; // zoom positions (*1, *1.5, *2, empty fourth) - /* 0x170 */ s32 zoomLevels; // max number of zoom positions - /* 0x174 */ s32 zoom; // index into position vec array + /* 0x140 */ struct GdVec3f zoomPositions[4]; // zoom positions (*1, *1.5, *2, empty fourth) + /* 0x170 */ s32 maxZoomLevel; // max number of zoom positions + /* 0x174 */ s32 zoomLevel; // index into zoomPositions array /* 0x178 */ f32 unk178; /* 0x17C */ f32 unk17C; /* 0x180 */ struct GdVec3f unk180; @@ -428,11 +444,11 @@ struct ObjMaterial { struct ObjWeight { /* 0x00 */ struct GdObj header; /* 0x14 */ u8 pad14[0x8]; - /* 0x1C */ s32 id; //id - /* 0x20 */ struct GdVec3f vec20; //based on func_80181894? maybe a GdPlaneF? + /* 0x1C */ s32 vtxId; // ID of vertex that this weight applies to + /* 0x20 */ struct GdVec3f vec20; // based on func_80181894? maybe a GdBoundingBox? /* 0x2C */ u8 pad2C[0x38-0x2c]; - /* 0x38 */ f32 unk38; // weight (unit?) - /* 0x3C */ struct ObjVertex* unk3C; + /* 0x38 */ f32 weightVal; // weight (unit?) + /* 0x3C */ struct ObjVertex* vtx; }; /* sizeof = 0x40 */ /* This union is used in ObjGadget for a variable typed field. @@ -443,22 +459,25 @@ union ObjVarVal { u64 l; }; +/* + * A slider control used to adjust the value of a variable + */ struct ObjGadget { /* 0x00 */ struct GdObj header; - /* 0x14 */ struct GdVec3f unk14; // "world" position vec? - /* 0x20 */ s32 unk20; - /* 0x24 */ s32 unk24; // type? - /* 0x28 */ f32 unk28; + /* 0x14 */ struct GdVec3f worldPos; // "world" position vec? + /* 0x20 */ s32 unk20; // unused; only ever set to 0 + /* 0x24 */ s32 type; + /* 0x28 */ f32 sliderPos; // position of the slider (from 0 to 1) /* 0x2C */ u8 pad2C[4]; /* 0x30 */ union ObjVarVal varval; //retype and rename varval30 - /* 0x38 */ f32 unk38; //range left? - /* 0x3C */ f32 unk3C; //range right? - /* 0x40 */ struct GdVec3f unk40; // scale? - /* 0x4C */ struct ObjGroup *unk4C; //gfroup->link->obj = valptr for var30 ? - /* 0x50 */ struct ObjShape *unk50; + /* 0x38 */ f32 rangeMin; + /* 0x3C */ f32 rangeMax; + /* 0x40 */ struct GdVec3f size; // size (x = width, y = height) + /* 0x4C */ struct ObjGroup *valueGrp; // group containing `ObjValPtr`s controlled by this gadget + /* 0x50 */ struct ObjShape *shapePtr; /* 0x54 */ struct ObjGroup *unk54; //node group? /* 0x58 */ u8 pad58[4]; - /* 0x5C */ s32 unk5C; // gd colour id (enum eventually) + /* 0x5C */ s32 colourNum; }; /* sizeof = 0x60 */ enum GdViewFlags { @@ -490,7 +509,7 @@ struct ObjView { /* 0x2C */ struct ObjGroup *lights; // only lights? /* 0x30 */ struct GdObj *pickedObj; // selected with cursor (`update_view`) /* 0x34 */ enum GdViewFlags flags; - /* 0x38 */ s32 unk38; // enum? if 1 use guPerspective (see `drawscene`) + /* 0x38 */ s32 projectionType; // enum? if 1 use guPerspective, if 0 (or 2?) use guOrtho (see `drawscene`) /* 0x3C */ struct GdVec3f upperLeft; // position vec? /* 0x48 */ f32 unk48; // what are these? are they another vec? /* 0x4C */ f32 unk4C; @@ -498,7 +517,7 @@ struct ObjView { /* 0x54 */ struct GdVec3f lowerRight; /* 0x60 */ struct GdVec3f clipping; // z-coordinate of (x: near, y: far) clipping plane? /* 0x6C */ const char *namePtr; - /* 0x70 */ s32 gdDlNum; // gd dl number + /* 0x70 */ s32 gdDlNum; /* 0x74 */ s32 unk74; /* 0x78 */ s32 unk78; /* 0x7C */ struct GdColour colour; @@ -514,12 +533,12 @@ typedef union ObjVarVal * (*valptrproc_t)(union ObjVarVal *, union ObjVarVal); struct ObjLabel { /* 0x00 */ struct GdObj header; - /* 0x14 */ struct GdVec3f vec14; - /* 0x20 */ char *fmtstr; - /* 0x24 */ s32 unk24; - /* 0x28 */ struct ObjValPtrs *valptr; + /* 0x14 */ struct GdVec3f position; + /* 0x20 */ char *fmtstr; // format string for displaying the value contained in `valptr` + /* 0x24 */ s32 unk24; // always 8 + /* 0x28 */ struct ObjValPtr *valptr; /* 0x2C */ valptrproc_t valfn; - /* 0x30 */ s32 unk30; // state or type? + /* 0x30 */ s32 unk30; // set to 3 or 4 in the code, but never actually used. could possibly be colourNum? }; /* sizeof = 0x34 */ /* unk30 types: @@ -528,44 +547,44 @@ struct ObjLabel { struct ObjAnimator { /* 0x00 */ struct GdObj header; - /* 0x14 */ struct ObjGroup* unk14; // joint? - /* 0x18 */ struct ObjGroup* animdata; //animation data? a group, but the link points to something weird.. + /* 0x14 */ struct ObjGroup* animatedPartsGrp; // group containing objects animated by this animator. I think all of them are joints. + /* 0x18 */ struct ObjGroup* animdataGrp; //animation data? a group, but the link points to something weird.. /* 0x1C */ u8 pad1C[0x4]; - /* 0x20 */ s32 unk20; + /* 0x20 */ s32 animSeqNum; // which entry in the AnimDataInfo array to use /* 0x24 */ f32 unk24; - /* 0x28 */ f32 unk28; + /* 0x28 */ f32 frame; // key frame number. This is a float so that it can interpolate between key frames, though I think in practice, it's always a whole number. /* 0x2C */ u8 pad2C[4]; - /* 0x30 */ struct ObjGroup* unk30; //attached group? - /* 0x34 */ s32 unk34; //attach arg0 + /* 0x30 */ struct ObjGroup *attachedObjsGrp; + /* 0x34 */ s32 attachFlags; //attach arg0, not used /* 0x38 */ u8 pad38[0x44-0x38]; - /* 0x44 */ struct GdObj* unk44; //attached object? Normally another Objanimator? - /* 0x48 */ void (*fn48) (struct ObjAnimator*); - /* 0x4C */ s32 unk4C; //state enum? - /* 0x50 */ s32 unk50; - /* 0x54 */ s32 unk54; + /* 0x44 */ struct GdObj* attachedToObj; // object that this object is attached to. Normally another Objanimator? + /* 0x48 */ void (*controlFunc) (struct ObjAnimator *); // function that "controls" the animation sequence by choosing the frame number + /* 0x4C */ s32 state; //state enum? + /* 0x50 */ s32 nods; // Counts the number of nods when Mario is dozing off. When this reaches zero, he wakes up again + /* 0x54 */ s32 stillTimer; // number of frames to remain in the part where Mario's head stays still with his eyes following the cursor }; /* sizeof = 0x58 */ /* Animation Data Types */ enum GdAnimations { - GD_ANIM_EMPTY = 0, // Listed types are how the data are arranged in memory; maybe not be exact type - GD_ANIM_MATRIX = 1, // f32[4][4] - GD_ANIM_TRI_F_2 = 2, // f32[3][3] - GD_ANIM_9H = 3, // s16[9] - GD_ANIM_TRI_F_4 = 4, // f32[3][3] - GD_ANIM_STUB = 5, - GD_ANIM_3H_SCALED = 6, // s16[3] - GD_ANIM_3H = 7, // s16[3] - GD_ANIM_6H_SCALED = 8, // s16[6] - GD_ANIM_MTX_VEC = 9, // {f32 mtx[4][4]; f32 vec[3];} - GD_ANIM_CAMERA = 11 // s16[6] + GD_ANIM_EMPTY = 0, // Listed types are how the data are arranged in memory; maybe not be exact type + GD_ANIM_MTX4x4 = 1, // f32[4][4] + GD_ANIM_SCALE3F_ROT3F_POS3F = 2, // f32[3][3] + GD_ANIM_SCALE3S_POS3S_ROT3S = 3, // s16[9] + GD_ANIM_SCALE3F_ROT3F_POS3F_2 = 4, // f32[3][3] + GD_ANIM_STUB = 5, + GD_ANIM_ROT3S = 6, // s16[3] + GD_ANIM_POS3S = 7, // s16[3] + GD_ANIM_ROT3S_POS3S = 8, // s16[6] + GD_ANIM_MTX4x4F_SCALE3F = 9, // {f32 mtx[4][4]; f32 vec[3];} + GD_ANIM_CAMERA_EYE3S_LOOKAT3S = 11 // s16[6] }; -/* This struct is pointed to by the `obj` field in Links struct in the `animdata` ObjGroup */ +/* This struct is pointed to by the `obj` field in ListNode struct in the `animdata` ObjGroup */ struct AnimDataInfo { s32 count; // count or -1 for end of array of AnimDataInfo structures enum GdAnimations type; // types are used in "move_animator" void* data; // points to an array of `type` data }; -/* GD_ANIM_MTX_VEC (9) type */ +/* GD_ANIM_MTX4x4F_SCALE3F (9) type */ struct AnimMtxVec { /* 0x00 */ Mat4f matrix; /* 0x40 */ struct GdVec3f vec; // seems to be a scale vec @@ -576,12 +595,17 @@ enum ValPtrType { OBJ_VALUE_FLOAT = 2 }; -struct ObjValPtrs { +/** + * An object that points to a value in memory (either a field of another object, + * or a standalone variable). Used by `ObjLabel` and `ObjGadget` to manage their + * values. + */ +struct ObjValPtr { /* 0x00 */ struct GdObj header; /* 0x14 */ struct GdObj *obj; // maybe just a void *? - /* 0x18 */ size_t offset; + /* 0x18 */ uintptr_t offset; // value pointed to is `obj` + `offset` /* 0x1C */ enum ValPtrType datatype; - /* 0x20 */ s32 unk20; // obj type ptr enum? Might be OBJ_TYPES flags? + /* 0x20 */ s32 flag; // TODO: better name for this? If 0x40000, then `offset` is an offset to a field in `obj`. Otherwise, `obj` is NULL, and `offset` is the address of a variable. }; /* sizeof = 0x24 */ enum GdLightFlags { @@ -616,7 +640,7 @@ struct ObjLight { struct ObjZone { /* 0x00 */ struct GdObj header; - /* 0x14 */ struct GdPlaneF unk14; + /* 0x14 */ struct GdBoundingBox boundingBox; /* 0x2C */ struct ObjGroup *unk2C; // plane group? /* 0x30 */ struct ObjGroup *unk30; // guess based on Unknown801781DC; might have to change later /* 0x34 */ u8 pad[4]; diff --git a/src/goddard/joints.c b/src/goddard/joints.c index 3a7a2690..0863118d 100644 --- a/src/goddard/joints.c +++ b/src/goddard/joints.c @@ -1,9 +1,9 @@ #include - -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) #include "prevent_bss_reordering.h" #endif + #include "debug_utils.h" #include "draw_objects.h" #include "dynlist_proc.h" @@ -24,7 +24,7 @@ static s32 D_801A82D0 = 0; static struct ObjBone *gGdTempBone = NULL; // @ 801A82D4 // bss -s32 sTargetWeightID; // @ 801BA960 +s32 sResetWeightVtxNum; // WTF? why is this not in skin_movement.c? static Mat4f *D_801BA964; static struct GdVec3f D_801BA968; @@ -43,97 +43,110 @@ static struct GdVec3f D_801BAAE0; // forward declarations void set_joint_vecs(struct ObjJoint *, f32, f32, f32); -/* 23CCF0 -> 23D3B8 */ -void Proc8018E520(struct ObjJoint *self) { +/** + * Controls movement of grabbable joints + */ +void grabbable_joint_update_func(struct ObjJoint *self) { UNUSED u8 pad78[0xC8 - 0x78]; - Mat4f *sp74; + Mat4f *attObjMtx; UNUSED u8 pad70[4]; - struct GdVec3f sp64; + struct GdVec3f offset; // difference between current position and initial position UNUSED u8 pad50[0x10]; - register struct Links *att; // sp4C? + register struct ListNode *att; UNUSED u8 pad48[0x8]; - struct GdObj *attobj; // sp44 + struct GdObj *attobj; - sp64.x = self->mat128[3][0] - self->unk54.x; - sp64.y = self->mat128[3][1] - self->unk54.y; - sp64.z = self->mat128[3][2] - self->unk54.z; + // The joint acts somewhat like a spring in that the further it is moved + // from its original position, the more resistance it has to moving further + + offset.x = self->mat128[3][0] - self->initPos.x; + offset.y = self->mat128[3][1] - self->initPos.y; + offset.z = self->mat128[3][2] - self->initPos.z; if (self->header.drawFlags & OBJ_PICKED) { - self->unk78.x = sp64.x * -0.25; //? -0.25f - self->unk78.y = sp64.y * -0.25; //? -0.25f - self->unk78.z = sp64.z * -0.25; //? -0.25f + self->velocity.x = offset.x * -0.25; + self->velocity.y = offset.y * -0.25; + self->velocity.z = offset.z * -0.25; - self->unk1BC |= 0x2000; - ; // necessary? + self->flags |= 0x2000; + ; // needed to match } else { - if (gGdCtrl.trgR == FALSE) // R-trigger not held or released + if (gGdCtrl.trgR == FALSE) // R trigger is released { - self->unk78.x -= sp64.x * 0.5; //? 0.5f - self->unk78.y -= sp64.y * 0.5; //? 0.5f - self->unk78.z -= sp64.z * 0.5; //? 0.5f + // Set velocity so that the joint approaches its initial position + self->velocity.x -= offset.x * 0.5; //? 0.5f + self->velocity.y -= offset.y * 0.5; //? 0.5f + self->velocity.z -= offset.z * 0.5; //? 0.5f - self->unk78.x *= 0.8; //? 0.8f - self->unk78.y *= 0.8; //? 0.8f - self->unk78.z *= 0.8; //? 0.8f + // Decay the velocity + self->velocity.x *= 0.8; //? 0.8f + self->velocity.y *= 0.8; //? 0.8f + self->velocity.z *= 0.8; //? 0.8f - if (ABS(self->unk78.x) + ABS(self->unk78.y) + ABS(self->unk78.z) < 1.0) //? 1.0f + // If the joint's velocity has decayed enough and it is very close + // to its original position, stop its movement altogether + if (ABS(self->velocity.x) + ABS(self->velocity.y) + ABS(self->velocity.z) < 1.0) { - if (ABS(sp64.x) + ABS(sp64.y) + ABS(sp64.z) < 1.0) //? 1.0f + if (ABS(offset.x) + ABS(offset.y) + ABS(offset.z) < 1.0) { - self->unk78.x = self->unk78.y = self->unk78.z = 0.0f; - self->mat128[3][0] -= sp64.x; - self->mat128[3][1] -= sp64.y; - self->mat128[3][2] -= sp64.z; + self->velocity.x = self->velocity.y = self->velocity.z = 0.0f; + self->mat128[3][0] -= offset.x; + self->mat128[3][1] -= offset.y; + self->mat128[3][2] -= offset.z; } } - if (self->unk1BC & 0x2000) { + if (self->flags & 0x2000) { gd_play_sfx(GD_SFX_LET_GO_FACE); } - self->unk1BC &= ~0x2000; + self->flags &= ~0x2000; ; // necessary? } else { - self->unk78.x = self->unk78.y = self->unk78.z = 0.0f; + // freeze position of joint + self->velocity.x = self->velocity.y = self->velocity.z = 0.0f; } } - self->mat128[3][0] += self->unk78.x; - self->mat128[3][1] += self->unk78.y; - self->mat128[3][2] += self->unk78.z; + // update position + self->mat128[3][0] += self->velocity.x; + self->mat128[3][1] += self->velocity.y; + self->mat128[3][2] += self->velocity.z; if (self->header.drawFlags & OBJ_PICKED) { - gGdCtrl.csrX -= (gGdCtrl.csrX - gGdCtrl.csrXatApress) * 0.2; - gGdCtrl.csrY -= (gGdCtrl.csrY - gGdCtrl.csrYatApress) * 0.2; + gGdCtrl.csrX -= (gGdCtrl.csrX - gGdCtrl.dragStartX) * 0.2; + gGdCtrl.csrY -= (gGdCtrl.csrY - gGdCtrl.dragStartY) * 0.2; } - sp64.x = self->mat128[3][0] - self->unk54.x; - sp64.y = self->mat128[3][1] - self->unk54.y; - sp64.z = self->mat128[3][2] - self->unk54.z; - - for (att = self->unk1F8->link1C; att != NULL; att = att->next) { + // update position of attached objects + offset.x = self->mat128[3][0] - self->initPos.x; + offset.y = self->mat128[3][1] - self->initPos.y; + offset.z = self->mat128[3][2] - self->initPos.z; + for (att = self->attachedObjsGrp->firstMember; att != NULL; att = att->next) { attobj = att->obj; set_cur_dynobj(attobj); - sp74 = d_get_matrix_ptr(); - gd_add_vec3f_to_mat4f_offset(sp74, &sp64); + attObjMtx = d_get_matrix_ptr(); + gd_add_vec3f_to_mat4f_offset(attObjMtx, &offset); } } -/* 23D3B8 -> 23D62C */ -void func_8018EBE8(struct ObjJoint *self) { +/** + * Update function for Mario's eye joints, which makes them follow the cursor + */ +void eye_joint_update_func(struct ObjJoint *self) { Mat4f *sp5C; struct GdVec3f sp50; struct GdVec3f sp44; UNUSED u8 pad2c[0x18]; - register struct Links *att; // sp28 - struct GdObj *attobj; // sp24 + register struct ListNode *att; + struct GdObj *attobj; if (sCurrentMoveCamera == NULL) { return; } - if (self->unk1D0 != NULL) { - if (self->unk1D0->unk4C != 7) { + if (self->rootAnimator != NULL) { + if (self->rootAnimator->state != 7) { return; } } @@ -143,7 +156,7 @@ void func_8018EBE8(struct ObjJoint *self) { sp44.x = (*sp5C)[3][0]; sp44.y = (*sp5C)[3][1]; sp44.z = (*sp5C)[3][2]; - func_80179B9C(&sp44, sCurrentMoveCamera, sCurrentMoveView); + world_pos_to_screen_coords(&sp44, sCurrentMoveCamera, sCurrentMoveView); sp50.x = gGdCtrl.csrX - sp44.x; sp50.y = -(gGdCtrl.csrY - sp44.y); @@ -159,7 +172,7 @@ void func_8018EBE8(struct ObjJoint *self) { sp50.z *= 30.0f; } - for (att = self->unk1F8->link1C; att != NULL; att = att->next) { + for (att = self->attachedObjsGrp->firstMember; att != NULL; att = att->next) { attobj = att->obj; set_cur_dynobj(attobj); sp5C = d_get_rot_mtx_ptr(); @@ -176,13 +189,13 @@ void func_8018EE5C(struct ObjJoint *j1, struct ObjJoint *j2, struct ObjJoint *j3 return; } - vec.z = j3->unk14.x; - vec.y = j3->unk14.y; - vec.x = j3->unk14.z; + vec.z = j3->worldPos.x; + vec.y = j3->worldPos.y; + vec.x = j3->worldPos.z; curj = j1; while (curj != NULL) { - set_joint_vecs(curj, curj->unk14.x + vec.z, curj->unk14.y + vec.y, curj->unk14.z + vec.x); + set_joint_vecs(curj, curj->worldPos.x + vec.z, curj->worldPos.y + vec.y, curj->worldPos.z + vec.x); if (curj == j2) { break; } @@ -192,9 +205,9 @@ void func_8018EE5C(struct ObjJoint *j1, struct ObjJoint *j2, struct ObjJoint *j3 /* 23D748 -> 23D818; orig name: func_8018EF78 */ void set_joint_vecs(struct ObjJoint *j, f32 x, f32 y, f32 z) { - j->unk14.x = x; - j->unk14.y = y; - j->unk14.z = z; + j->worldPos.x = x; + j->worldPos.y = y; + j->worldPos.z = z; j->unk30.x = x; j->unk30.y = y; @@ -204,9 +217,9 @@ void set_joint_vecs(struct ObjJoint *j, f32 x, f32 y, f32 z) { j->unk3C.y = y; j->unk3C.z = z; - j->unk54.x = x; - j->unk54.y = y; - j->unk54.z = z; + j->initPos.x = x; + j->initPos.y = y; + j->initPos.z = z; j->mat128[3][0] = x; j->mat128[3][1] = y; @@ -231,70 +244,75 @@ struct ObjJoint *make_joint(s32 flags, f32 x, f32 y, f32 z) { gd_set_identity_mat4(&j->matE8); gd_set_identity_mat4(&j->mat128); set_joint_vecs(j, x, y, z); - j->unk1CC = 0; + j->type = 0; j->id = sJointCount; - j->unk1BC = flags; + j->flags = flags; - if (!(j->unk1BC & 0x1)) { + if (!(j->flags & 0x1)) { sJointNotF1Count++; } - if (j->unk1BC & 0x1) { - j->unk1C8 = 2; + if (j->flags & 0x1) { + j->colourNum = COLOUR_RED; } else { - j->unk1C8 = 9; + j->colourNum = COLOUR_PINK; } j->unk1C4 = NULL; - j->unk20 = NULL; - j->unk9C.x = 1.0f; - j->unk9C.y = 1.0f; - j->unk9C.z = 1.0f; - j->unkDC.x = 0.0f; - j->unkDC.y = 0.0f; - j->unkDC.z = 0.0f; - j->fn2C = NULL; + j->shapePtr = NULL; + j->scale.x = 1.0f; + j->scale.y = 1.0f; + j->scale.z = 1.0f; + j->friction.x = 0.0f; + j->friction.y = 0.0f; + j->friction.z = 0.0f; + j->updateFunc = NULL; return j; } -/* 23DA18 -> 23DAF8; orig name: func_8018F248 */ -struct ObjJoint *make_joint_withshape(struct ObjShape *shape, s32 flags, f32 x, f32 y, f32 z) { +/** + * Creates a joint that can be grabbed by the cursor. When moved, this joint + * drags the joints in its unk1F8 group along with it. The `shape` does not + * actually get rendered due to the joint's OBJ_INVISIBLE flag being set. + */ +struct ObjJoint *make_grabber_joint(struct ObjShape *shape, s32 flags, f32 x, f32 y, f32 z) { struct ObjJoint *j; j = make_joint(0, x, y, z); - j->unk20 = shape; - j->unk1CC = 5; - j->unk1BC |= flags; - j->unk1C8 = 9; + j->shapePtr = shape; + j->type = 5; + j->flags |= flags; + j->colourNum = COLOUR_PINK; j->header.drawFlags |= OBJ_IS_GRABBALE; - j->header.drawFlags |= OBJ_NOT_DRAWABLE; - j->fn2C = &Proc8018E520; - j->unk1D0 = NULL; + j->header.drawFlags |= OBJ_INVISIBLE; + j->updateFunc = grabbable_joint_update_func; + j->rootAnimator = NULL; return j; } /* 23DAF8 -> 23DC9C */ void func_8018F328(struct ObjBone *b) { - struct ObjJoint *sp24; - struct ObjJoint *sp20; + struct ObjJoint *joint1; + struct ObjJoint *joint2; struct ObjGroup *grp; // sp1C - struct Links *link; // sp18 + struct ListNode *link; // sp18 grp = b->unk10C; - link = grp->link1C; - sp24 = (struct ObjJoint *) link->obj; + link = grp->firstMember; + joint1 = (struct ObjJoint *) link->obj; link = link->next; - sp20 = (struct ObjJoint *) link->obj; + joint2 = (struct ObjJoint *) link->obj; - b->unk14.x = (sp24->unk14.x + sp20->unk14.x) / 2.0; //?2.0f - b->unk14.y = (sp24->unk14.y + sp20->unk14.y) / 2.0; //?2.0f - b->unk14.z = (sp24->unk14.z + sp20->unk14.z) / 2.0; //?2.0f + // bone position is average of two connecting joints + b->worldPos.x = (joint1->worldPos.x + joint2->worldPos.x) / 2.0; //?2.0f + b->worldPos.y = (joint1->worldPos.y + joint2->worldPos.y) / 2.0; //?2.0f + b->worldPos.z = (joint1->worldPos.z + joint2->worldPos.z) / 2.0; //?2.0f - b->unk58.x = sp20->unk14.x - sp24->unk14.x; - b->unk58.y = sp20->unk14.y - sp24->unk14.y; - b->unk58.z = sp20->unk14.z - sp24->unk14.z; + b->unk58.x = joint2->worldPos.x - joint1->worldPos.x; + b->unk58.y = joint2->worldPos.y - joint1->worldPos.y; + b->unk58.z = joint2->worldPos.z - joint1->worldPos.z; gd_normalize_vec3f(&b->unk58); gd_create_origin_lookat(&b->matB0, &b->unk58, 0); //? 0.0f @@ -302,7 +320,7 @@ void func_8018F328(struct ObjBone *b) { /* 23DC9C -> 23DCF0 */ void func_8018F4CC(struct ObjJoint *j) { - if (j->unk1BC & 0x1000) { + if (j->flags & 0x1000) { j->unkB4.x = D_801BA968.x; j->unkB4.y = D_801BA968.y; j->unkB4.z = D_801BA968.z; @@ -311,8 +329,8 @@ void func_8018F4CC(struct ObjJoint *j) { /* 23DCF0 -> 23E06C */ void func_8018F520(struct ObjBone *b) { - struct ObjJoint *spAC; - struct ObjJoint *spA8; + struct ObjJoint *joint1; + struct ObjJoint *joint2; UNUSED u32 pad[3]; struct GdVec3f sp90; struct GdVec3f sp84; @@ -321,18 +339,20 @@ void func_8018F520(struct ObjBone *b) { f32 sp68; f32 sp64; struct ObjGroup *grp; // sp60 - struct Links *link; + struct ListNode *link; Mat4f mtx; // sp1C grp = b->unk10C; - link = grp->link1C; - spAC = (struct ObjJoint *) link->obj; + link = grp->firstMember; + joint1 = (struct ObjJoint *) link->obj; link = link->next; - spA8 = (struct ObjJoint *) link->obj; + joint2 = (struct ObjJoint *) link->obj; + + // bone position is average of two connecting joints + b->worldPos.x = (joint1->worldPos.x + joint2->worldPos.x) / 2.0; //? 2.0f; + b->worldPos.y = (joint1->worldPos.y + joint2->worldPos.y) / 2.0; //? 2.0f; + b->worldPos.z = (joint1->worldPos.z + joint2->worldPos.z) / 2.0; //? 2.0f; - b->unk14.x = (spAC->unk14.x + spA8->unk14.x) / 2.0; //? 2.0f; - b->unk14.y = (spAC->unk14.y + spA8->unk14.y) / 2.0; //? 2.0f; - b->unk14.z = (spAC->unk14.z + spA8->unk14.z) / 2.0; //? 2.0f; sp90.x = b->unk58.x; sp90.y = b->unk58.y; sp90.z = b->unk58.z; @@ -379,18 +399,18 @@ void func_8018F89C(struct ObjBone *b) { struct ObjJoint *spA8; UNUSED u8 pad64[0x44]; struct ObjGroup *grp; // sp60 - struct Links *link; // sp5c + struct ListNode *link; // sp5c Mat4f mtx; // sp1c grp = b->unk10C; - link = grp->link1C; + link = grp->firstMember; spAC = (struct ObjJoint *) link->obj; link = link->next; spA8 = (struct ObjJoint *) link->obj; - b->unk14.x = (spAC->unk14.x + spA8->unk14.x) / 2.0; //? 2.0f; - b->unk14.y = (spAC->unk14.y + spA8->unk14.y) / 2.0; //? 2.0f; - b->unk14.z = (spAC->unk14.z + spA8->unk14.z) / 2.0; //? 2.0f; + b->worldPos.x = (spAC->worldPos.x + spA8->worldPos.x) / 2.0; //? 2.0f; + b->worldPos.y = (spAC->worldPos.y + spA8->worldPos.y) / 2.0; //? 2.0f; + b->worldPos.z = (spAC->worldPos.z + spA8->worldPos.z) / 2.0; //? 2.0f; gd_mult_mat4f(&b->matB0, &gGdSkinNet->mat128, &mtx); gd_copy_mat4f(&mtx, &b->mat70); @@ -413,14 +433,14 @@ void func_8018FA68(struct ObjBone *b) { } /* 23E298 -> 23E328; orig name: func_8018FAC8 */ -s32 set_skin_weight(struct ObjJoint *j, s32 id, struct ObjVertex *vtx, f32 weight) { +s32 set_skin_weight(struct ObjJoint *j, s32 id, struct ObjVertex *vtx /* always NULL */, f32 weight) { struct ObjWeight *w; - if (j->unk1F4 == NULL) { - j->unk1F4 = make_group(0); + if (j->weightGrp == NULL) { + j->weightGrp = make_group(0); } w = make_weight(0, id, vtx, weight); - addto_group(j->unk1F4, &w->header); + addto_group(j->weightGrp, &w->header); return TRUE; } @@ -430,18 +450,18 @@ void func_8018FB58(struct ObjBone *b) { struct GdVec3f vec; // sp2c struct ObjJoint *j1; // sp28 struct ObjJoint *j2; - struct Links *link; + struct ListNode *link; struct ObjGroup *grp; grp = b->unk10C; - link = grp->link1C; + link = grp->firstMember; j1 = (struct ObjJoint *) link->obj; link = link->next; j2 = (struct ObjJoint *) link->obj; - vec.x = j1->unk14.x - j2->unk14.x; - vec.y = j1->unk14.y - j2->unk14.y; - vec.z = j1->unk14.z - j2->unk14.z; + vec.x = j1->worldPos.x - j2->worldPos.x; + vec.y = j1->worldPos.y - j2->worldPos.y; + vec.z = j1->worldPos.z - j2->worldPos.z; b->unkF8 = gd_sqrt_d((vec.x * vec.x) + (vec.y * vec.y) + (vec.z * vec.z)); b->unkF4 = b->unkF8; @@ -465,7 +485,7 @@ void add_joint2bone(struct ObjBone *b, struct ObjJoint *j) { } addto_group(j->unk1C4, &b->header); - if (b->unk10C->objCount == 2) { + if (b->unk10C->memberCount == 2) { func_8018FB58(b); } } @@ -487,11 +507,11 @@ struct ObjBone *make_bone(s32 a0, struct ObjJoint *j1, struct ObjJoint *j2, UNUS oldhead->prev = b; } b->unk10C = NULL; - b->unk100 = 0; + b->colourNum = 0; b->unk104 = a0; - b->unkF0 = NULL; + b->shapePtr = NULL; gd_set_identity_mat4(&b->mat70); - b->unk110 = 0.8f; + b->spring = 0.8f; b->unk114 = 0.9f; b->unkF8 = 100.0f; @@ -505,20 +525,23 @@ struct ObjBone *make_bone(s32 a0, struct ObjJoint *j1, struct ObjJoint *j2, UNUS } /* 23E6E4 -> 23E6F8; not called */ -void func_8018FF14(UNUSED u32 a0) { +void stub_joints_1(UNUSED u32 a0) { } /* 23E6F8 -> 23E758; not called */ void func_8018FF28(struct ObjJoint *a0, struct ObjJoint *a1) { - if (a1->unk1BC & 0x1) { + if (a1->flags & 0x1) { a0->unk84.x -= a1->unk84.x; a0->unk84.y -= a1->unk84.y; a0->unk84.z -= a1->unk84.z; } } -/* 23E758 -> 23E7B8; not called */ -void func_8018FF88(s32 size) { +/** + * Unused (not called) - possibly was used to print indent levels inside + * recursive functions + */ +void print_some_spaces(s32 size) { s32 i; for (i = 0; i < size - 1; i++) { @@ -533,15 +556,15 @@ s32 func_8018FFE8(struct ObjBone **a0, struct ObjJoint **a1, struct ObjJoint *a2 s32 sp14 = 0; struct ObjGroup *bonegrp; // 10 struct ObjGroup *grp; // 0c - struct Links *bonelink; // 08 - struct Links *link; // 04 + struct ListNode *bonelink; // 08 + struct ListNode *link; // 04 grp = a3->unk1C4; if (grp == NULL) { return 0; } - link = grp->link1C; + link = grp->firstMember; if (link == NULL) { return 0; } @@ -549,7 +572,7 @@ s32 func_8018FFE8(struct ObjBone **a0, struct ObjJoint **a1, struct ObjJoint *a2 while (link != NULL) { if ((b = (struct ObjBone *) link->obj) != NULL) { bonegrp = b->unk10C; - bonelink = bonegrp->link1C; + bonelink = bonegrp->firstMember; while (bonelink != NULL) { sp18 = (struct ObjJoint *) bonelink->obj; @@ -590,12 +613,12 @@ void func_80190168(struct ObjBone *b, UNUSED struct ObjJoint *a1, UNUSED struct if (sp58 == 0.0f) { sp58 = 1.0f; } - sp60 = (b->unkF8 / sp58) * b->unk110; + sp60 = (b->unkF8 / sp58) * b->spring; } if (b->unk104 & 0x4) { if (sp60 > (sp58 = gd_vec3f_magnitude(&sp7C))) { - sp5C = b->unk110; + sp5C = b->spring; a3->x *= sp5C; a3->y *= sp5C; a3->z *= sp5C; @@ -608,7 +631,7 @@ void func_80190168(struct ObjBone *b, UNUSED struct ObjJoint *a1, UNUSED struct if (b->unk104 & 0x2) { if (sp60 < (sp58 = gd_vec3f_magnitude(&sp7C))) { - sp5C = b->unk110; + sp5C = b->spring; a3->x *= sp5C; a3->y *= sp5C; a3->z *= sp5C; @@ -625,7 +648,7 @@ void func_801903E8(struct ObjJoint *j, struct GdVec3f *a1, f32 x, f32 y, f32 z) f32 sp14; struct GdVec3f sp8; - if (j->unk1BC & 0x1 || (j->unk1BC & 0x1000) == 0) { + if (j->flags & 0x1 || (j->flags & 0x1000) == 0) { j->unk3C.x += x; j->unk3C.y += y; j->unk3C.z += z; @@ -701,7 +724,7 @@ void func_80190574(s32 a0, struct ObjJoint *a1, struct ObjJoint *a2, f32 x, f32 } if (sp220 < 2) { - if (sp26C->unk1BC & 0x1) { + if (sp26C->flags & 0x1) { sJointArrLen++; sJointArr[sJointArrLen] = sp274; sJointArrVecs[sJointArrLen].x = -sp24C.x; @@ -768,14 +791,14 @@ void func_80190A20(void) { UNUSED u32 pad38; struct GdVec3f vec; // sp2C struct ObjGroup *grp; - struct Links *link; + struct ListNode *link; struct ObjBone *b; j = gGdJointList; while (j != NULL) { - if (j->unk1BC & 0x40) { + if (j->flags & 0x40) { grp = j->unk1C4; - link = grp->link1C; + link = grp->firstMember; b = (struct ObjBone *) link->obj; vec.z = b->unk40.x * 100.0f; @@ -854,7 +877,7 @@ void func_80190B54(struct ObjJoint *a0, struct ObjJoint *a1, struct GdVec3f *a2) void func_80190E68(struct GdObj *obj, f32 x, f32 y, f32 z) { struct ObjJoint *sp44; struct GdObj *sp40; - struct GdVec3f vec; // sp34 + struct GdVec3f vec; UNUSED u32 pad1C[6]; vec.x = x; @@ -870,14 +893,14 @@ void func_80190E68(struct GdObj *obj, f32 x, f32 y, f32 z) { func_80190B54(((struct ObjJoint *) sp40), sp44, &vec); sp44 = ((struct ObjJoint *) sp40); - sp40 = ((struct ObjJoint *) sp40)->unk20C; //"attached object" + sp40 = ((struct ObjJoint *) sp40)->attachedToObj; } } /* 23F70C -> 23F978 */ f32 func_80190F3C(struct ObjJoint *a0, f32 a1, f32 a2, f32 a3) { - struct ObjJoint *curj; // 34 - s32 i; // 30 + struct ObjJoint *curj; + s32 i; struct GdVec3f sp24; sp24.x = a0->unk3C.x; @@ -915,30 +938,30 @@ f32 func_80190F3C(struct ObjJoint *a0, f32 a1, f32 a2, f32 a3) { /* 23F978 -> 23F9F0 */ void func_801911A8(struct ObjJoint *j) { - j->unkCC.x = j->unkC0.x; // storing "shape offset"? - j->unkCC.y = j->unkC0.y; - j->unkCC.z = j->unkC0.z; + j->unkCC.x = j->shapeOffset.x; + j->unkCC.y = j->shapeOffset.y; + j->unkCC.z = j->shapeOffset.z; gd_rotate_and_translate_vec3f(&j->unkCC, &gGdSkinNet->mat128); } /* 23F9F0 -> 23FB90 */ void func_80191220(struct ObjJoint *j) { - j->unk48.x = j->unk54.x; // storing "attached offset"? - j->unk48.y = j->unk54.y; - j->unk48.z = j->unk54.z; + j->unk48.x = j->initPos.x; // storing "attached offset"? + j->unk48.y = j->initPos.y; + j->unk48.z = j->initPos.z; gd_mat4f_mult_vec3f(&j->unk48, &gGdSkinNet->mat128); j->unk3C.x = j->unk48.x; j->unk3C.y = j->unk48.y; j->unk3C.z = j->unk48.z; - j->unk14.x = gGdSkinNet->unk14.x; - j->unk14.y = gGdSkinNet->unk14.y; - j->unk14.z = gGdSkinNet->unk14.z; + j->worldPos.x = gGdSkinNet->worldPos.x; + j->worldPos.y = gGdSkinNet->worldPos.y; + j->worldPos.z = gGdSkinNet->worldPos.z; - j->unk14.x += j->unk3C.x; - j->unk14.y += j->unk3C.y; - j->unk14.z += j->unk3C.z; + j->worldPos.x += j->unk3C.x; + j->worldPos.y += j->unk3C.y; + j->worldPos.z += j->unk3C.z; j->unk1A8.x = j->unk1A8.y = j->unk1A8.z = 0.0f; gGdCounter.ctr0++; } @@ -951,23 +974,24 @@ void func_801913C0(struct ObjJoint *j) { /* 23FBC0 -> 23FCC8 */ void func_801913F0(struct ObjJoint *j) { - j->unk78.x = j->unk14.x; - j->unk78.y = j->unk14.y; - j->unk78.z = j->unk14.z; + // hmm... + j->velocity.x = j->worldPos.x; + j->velocity.y = j->worldPos.y; + j->velocity.z = j->worldPos.z; - j->unk78.x -= j->unk30.x; - j->unk78.y -= j->unk30.y; - j->unk78.z -= j->unk30.z; + j->velocity.x -= j->unk30.x; + j->velocity.y -= j->unk30.y; + j->velocity.z -= j->unk30.z; - j->unk30.x = j->unk14.x; - j->unk30.y = j->unk14.y; - j->unk30.z = j->unk14.z; + j->unk30.x = j->worldPos.x; + j->unk30.y = j->worldPos.y; + j->unk30.z = j->worldPos.z; gd_copy_mat4f(&gGdSkinNet->mat128, &j->matE8); } /* 23FCC8 -> 23FCDC */ -void func_801914F8(UNUSED struct ObjJoint *j) { +void stub_joints_2(UNUSED struct ObjJoint *j) { } /* 23FCDC -> 23FDD4; not called */ @@ -985,32 +1009,32 @@ void func_8019150C(Mat4f *a0, struct GdVec3f *a1) { } /* 23FDD4 -> 23FFF4 */ -void func_80191604(struct ObjJoint *j) { - j->unk14.x = j->unk54.x; - j->unk14.y = j->unk54.y; - j->unk14.z = j->unk54.z; +void reset_joint(struct ObjJoint *j) { + j->worldPos.x = j->initPos.x; + j->worldPos.y = j->initPos.y; + j->worldPos.z = j->initPos.z; - j->unk30.x = j->unk54.x; - j->unk30.y = j->unk54.y; - j->unk30.z = j->unk54.z; + j->unk30.x = j->initPos.x; + j->unk30.y = j->initPos.y; + j->unk30.z = j->initPos.z; - j->unk3C.x = j->unk54.x; - j->unk3C.y = j->unk54.y; - j->unk3C.z = j->unk54.z; + j->unk3C.x = j->initPos.x; + j->unk3C.y = j->initPos.y; + j->unk3C.z = j->initPos.z; - j->unk78.x = j->unk78.y = j->unk78.z = 0.0f; + j->velocity.x = j->velocity.y = j->velocity.z = 0.0f; j->unk84.x = j->unk84.y = j->unk84.z = 0.0f; j->unk90.x = j->unk90.y = j->unk90.z = 0.0f; j->unk1A8.x = j->unk1A8.y = j->unk1A8.z = 0.0f; gd_set_identity_mat4(&j->mat168); - gd_scale_mat4f_by_vec3f(&j->mat168, (struct GdVec3f *) &j->unk9C); + gd_scale_mat4f_by_vec3f(&j->mat168, (struct GdVec3f *) &j->scale); gd_rot_mat_about_vec(&j->mat168, (struct GdVec3f *) &j->unk6C); - gd_add_vec3f_to_mat4f_offset(&j->mat168, &j->unk200); + gd_add_vec3f_to_mat4f_offset(&j->mat168, &j->attachOffset); gd_copy_mat4f(&j->mat168, &j->matE8); gd_set_identity_mat4(&j->mat128); - gd_add_vec3f_to_mat4f_offset(&j->mat128, &j->unk54); + gd_add_vec3f_to_mat4f_offset(&j->mat128, &j->initPos); } /* 23FFF4 -> 2400C4 */ @@ -1019,14 +1043,14 @@ void func_80191824(struct ObjJoint *j) { UNUSED u32 pad00[4]; sp14 = gGdSkinNet->unk1F0; - if (j->unk1BC & 0x1) { - j->unk14.x = gGdSkinNet->unk14.x; - j->unk14.y = gGdSkinNet->unk14.y; - j->unk14.z = gGdSkinNet->unk14.z; + if (j->flags & 0x1) { + j->worldPos.x = gGdSkinNet->worldPos.x; + j->worldPos.y = gGdSkinNet->worldPos.y; + j->worldPos.z = gGdSkinNet->worldPos.z; - j->unk3C.x = gGdSkinNet->unk14.x; - j->unk3C.y = gGdSkinNet->unk14.y; - j->unk3C.z = gGdSkinNet->unk14.z; + j->unk3C.x = gGdSkinNet->worldPos.x; + j->unk3C.y = gGdSkinNet->worldPos.y; + j->unk3C.z = gGdSkinNet->worldPos.z; } } @@ -1034,13 +1058,13 @@ void func_80191824(struct ObjJoint *j) { void func_801918F4(struct ObjJoint *j) { f32 sp4; - j->unk78.x = j->unk3C.x; - j->unk78.y = j->unk3C.y; - j->unk78.z = j->unk3C.z; + j->velocity.x = j->unk3C.x; + j->velocity.y = j->unk3C.y; + j->velocity.z = j->unk3C.z; - j->unk78.x -= j->unk30.x; - j->unk78.y -= j->unk30.y; - j->unk78.z -= j->unk30.z; + j->velocity.x -= j->unk30.x; + j->velocity.y -= j->unk30.y; + j->velocity.z -= j->unk30.z; j->unk30.x = j->unk3C.x; j->unk30.y = j->unk3C.y; @@ -1048,12 +1072,12 @@ void func_801918F4(struct ObjJoint *j) { sp4 = -4.0f; - if (!(j->unk1BC & 0x41)) { - j->unk78.y += sp4 * 0.2; //? 0.2f + if (!(j->flags & 0x41)) { + j->velocity.y += sp4 * 0.2; //? 0.2f - j->unk3C.x += j->unk78.x; - j->unk3C.y += j->unk78.y; - j->unk3C.z += j->unk78.z; + j->unk3C.x += j->velocity.x; + j->unk3C.y += j->velocity.y; + j->unk3C.z += j->velocity.z; } } @@ -1073,8 +1097,8 @@ void func_80191A1C(struct ObjBone *a0) { a0->unk118 = sp3C; if ((sp3C -= sp38) < 0.0f) { - tempjoint = gGdTempBone->unk10C->link1C->obj; - argjoint = a0->unk10C->link1C->next->obj; + tempjoint = gGdTempBone->unk10C->firstMember->obj; + argjoint = a0->unk10C->firstMember->next->obj; set_cur_dynobj(argjoint); d_get_rel_pos(&sp24); set_cur_dynobj(tempjoint); @@ -1086,7 +1110,7 @@ void func_80191A1C(struct ObjBone *a0) { gd_normalize_vec3f(&sp24); sp3C = -sp3C * 50.0; //? 50.0f - if (!(((struct ObjJoint *) argjoint)->unk1BC & 0x1)) { + if (!(((struct ObjJoint *) argjoint)->flags & 0x1)) { func_80190F3C((struct ObjJoint *) argjoint, sp24.x * sp3C, sp24.y * sp3C, sp24.z * sp3C); } } @@ -1098,14 +1122,14 @@ void func_80191BF8(struct ObjJoint *j) { f32 sp1C; f32 sp18 = -2.0f; - if (!(j->unk1BC & 0x1)) { + if (!(j->flags & 0x1)) { j->unk3C.y += sp18; } - if ((sp1C = j->unk3C.y - (D_801A8058 + 30.0f)) < 0.0f && j->unk78.y < 0.0f) { - sp1C += j->unk78.y; + if ((sp1C = j->unk3C.y - (D_801A8058 + 30.0f)) < 0.0f && j->velocity.y < 0.0f) { + sp1C += j->velocity.y; sp1C *= 0.8; //? 0.8f - func_80190F3C(j, -j->unk78.x * 0.7, -sp1C, -j->unk78.z * 0.7); + func_80190F3C(j, -j->velocity.x * 0.7, -sp1C, -j->velocity.z * 0.7); } func_80190F3C(j, 0.0f, 0.0f, 0.0f); @@ -1113,24 +1137,24 @@ void func_80191BF8(struct ObjJoint *j) { /* 240530 -> 240624 */ void func_80191D60(struct ObjJoint *j) { - j->unk78.x += j->unk3C.x - j->unk14.x; - j->unk78.y += j->unk3C.y - j->unk14.y; - j->unk78.z += j->unk3C.z - j->unk14.z; + j->velocity.x += j->unk3C.x - j->worldPos.x; + j->velocity.y += j->unk3C.y - j->worldPos.y; + j->velocity.z += j->unk3C.z - j->worldPos.z; - j->unk78.x *= 0.9; //? 0.9f - j->unk78.y *= 0.9; //? 0.9f - j->unk78.z *= 0.9; //? 0.9f + j->velocity.x *= 0.9; //? 0.9f + j->velocity.y *= 0.9; //? 0.9f + j->velocity.z *= 0.9; //? 0.9f - j->unk14.x += j->unk78.x; - j->unk14.y += j->unk78.y; - j->unk14.z += j->unk78.z; + j->worldPos.x += j->velocity.x; + j->worldPos.y += j->velocity.y; + j->worldPos.z += j->velocity.z; } /* 240624 -> 240658 */ void func_80191E54(struct ObjJoint *j) { - j->unk3C.x = j->unk14.x; - j->unk3C.y = j->unk14.y; - j->unk3C.z = j->unk14.z; + j->unk3C.x = j->worldPos.x; + j->unk3C.y = j->worldPos.y; + j->unk3C.z = j->worldPos.z; } /* 240658 -> 2406B8 */ diff --git a/src/goddard/joints.h b/src/goddard/joints.h index 719f4745..a78c7a7a 100644 --- a/src/goddard/joints.h +++ b/src/goddard/joints.h @@ -6,12 +6,12 @@ #include "gd_types.h" // bss -extern s32 sTargetWeightID; +extern s32 sResetWeightVtxNum; // functions -void func_8018EBE8(struct ObjJoint *self); +void eye_joint_update_func(struct ObjJoint *self); struct ObjJoint *make_joint(s32 flags, f32 x, f32 y, f32 z); -struct ObjJoint *make_joint_withshape(struct ObjShape *shape, s32 flags, f32 x, f32 y, f32 z); +struct ObjJoint *make_grabber_joint(struct ObjShape *shape, s32 flags, f32 x, f32 y, f32 z); void func_8018F328(struct ObjBone *b); void func_8018FA68(struct ObjBone *b); s32 set_skin_weight(struct ObjJoint *j, s32 id, struct ObjVertex *vtx, f32 weight); @@ -22,8 +22,8 @@ void func_801911A8(struct ObjJoint *j); void func_80191220(struct ObjJoint *j); void func_801913C0(struct ObjJoint *j); void func_801913F0(struct ObjJoint *j); -void func_801914F8(struct ObjJoint *j); -void func_80191604(struct ObjJoint *j); +void stub_joints_2(struct ObjJoint *j); +void reset_joint(struct ObjJoint *j); void func_80191824(struct ObjJoint *j); void func_80191E88(struct ObjGroup *grp); void reset_joint_counts(void); diff --git a/src/goddard/objects.c b/src/goddard/objects.c index 46000fd1..f8504b1a 100644 --- a/src/goddard/objects.c +++ b/src/goddard/objects.c @@ -36,7 +36,7 @@ f32 D_801A81C0 = 0.0f; f32 D_801A81C4 = 0.0f; // bss -struct GdPlaneF D_801B9DA0; +struct GdBoundingBox gSomeBoundingBox; struct ObjCamera *sCurrentMoveCamera; // @ 801B9DB8 struct ObjView *sCurrentMoveView; // @ 801B9DBC struct DebugCounters gGdCounter; // @ 801B9DC0 @@ -62,75 +62,74 @@ struct Unk801B9E68 sGdViewInfo; // @ 801B9E68 void *D_801B9E80; struct ObjJoint *gGdJointList; // @ 801B9E84 struct ObjBone *gGdBoneList; // @ 801B9E88 -struct GdObj *gGdObjectList; // @ 801B9E8C +struct GdObj *gGdObjectList; // head of linked list containing every single GdObj that was created struct ObjGroup *gGdViewsGroup; // @ 801B9E90 /* @ 22A480 for 0x70 */ -void func_8017BCB0(void) { /* Initialize Plane? */ - D_801B9DA0.p0.x = 10000000.0f; - D_801B9DA0.p0.y = 10000000.0f; - D_801B9DA0.p0.z = 10000000.0f; +void reset_bounding_box(void) { /* Initialize Plane? */ + gSomeBoundingBox.minX = 10000000.0f; + gSomeBoundingBox.minY = 10000000.0f; + gSomeBoundingBox.minZ = 10000000.0f; - D_801B9DA0.p1.x = -10000000.0f; - D_801B9DA0.p1.y = -10000000.0f; - D_801B9DA0.p1.z = -10000000.0f; + gSomeBoundingBox.maxX = -10000000.0f; + gSomeBoundingBox.maxY = -10000000.0f; + gSomeBoundingBox.maxZ = -10000000.0f; } -// TODO: fix first argument's type once type of set_cur_dynobj is known -// Should be an ObjVertex* -/* @ 22A4F0 for 0x140 */ -void func_8017BD20(void *a0) { - struct GdVec3f sp1c; +void add_obj_pos_to_bounding_box(struct GdObj *obj) { + struct GdVec3f pos; - set_cur_dynobj(a0); - d_get_world_pos(&sp1c); + set_cur_dynobj(obj); + d_get_world_pos(&pos); - if (sp1c.x < D_801B9DA0.p0.x) { - D_801B9DA0.p0.x = sp1c.x; + if (pos.x < gSomeBoundingBox.minX) { + gSomeBoundingBox.minX = pos.x; } - if (sp1c.y < D_801B9DA0.p0.y) { - D_801B9DA0.p0.y = sp1c.y; + if (pos.y < gSomeBoundingBox.minY) { + gSomeBoundingBox.minY = pos.y; } - if (sp1c.z < D_801B9DA0.p0.z) { - D_801B9DA0.p0.z = sp1c.z; + if (pos.z < gSomeBoundingBox.minZ) { + gSomeBoundingBox.minZ = pos.z; } - if (sp1c.x > D_801B9DA0.p1.x) { - D_801B9DA0.p1.x = sp1c.x; + if (pos.x > gSomeBoundingBox.maxX) { + gSomeBoundingBox.maxX = pos.x; } - if (sp1c.y > D_801B9DA0.p1.y) { - D_801B9DA0.p1.y = sp1c.y; + if (pos.y > gSomeBoundingBox.maxY) { + gSomeBoundingBox.maxY = pos.y; } - if (sp1c.z > D_801B9DA0.p1.z) { - D_801B9DA0.p1.z = sp1c.z; + if (pos.z > gSomeBoundingBox.maxZ) { + gSomeBoundingBox.maxZ = pos.z; } } /* @ 22A630 for 0x70 */ -void func_8017BE60(struct GdPlaneF *a0) { - a0->p0.x = D_801B9DA0.p0.x; - a0->p0.y = D_801B9DA0.p0.y; - a0->p0.z = D_801B9DA0.p0.z; +void get_some_bounding_box(struct GdBoundingBox *a0) { + a0->minX = gSomeBoundingBox.minX; + a0->minY = gSomeBoundingBox.minY; + a0->minZ = gSomeBoundingBox.minZ; - a0->p1.x = D_801B9DA0.p1.x; - a0->p1.y = D_801B9DA0.p1.y; - a0->p1.z = D_801B9DA0.p1.z; + a0->maxX = gSomeBoundingBox.maxX; + a0->maxY = gSomeBoundingBox.maxY; + a0->maxZ = gSomeBoundingBox.maxZ; } /* @ 22A6A0 for 0x24 */ -void func_8017BED0(UNUSED struct ObjGroup *a0, UNUSED struct GdObj *a1) { +void stub_objects_1(UNUSED struct ObjGroup *a0, UNUSED struct GdObj *a1) { UNUSED u8 sp00[8]; /* Debug stub? */ return; } -/* @ 22A6C4 for 0x2CC; orig. name: func_8017BEF4 */ -const char *get_obj_name_str(enum ObjTypeFlag objFlag) { - /* sp04 */ const char *objName; +/** + * Returns a string containing the name of the the object type + */ +static const char *get_obj_name_str(enum ObjTypeFlag objFlag) { + const char *objName; switch (objFlag) { case OBJ_TYPE_JOINTS: objName = "joints"; @@ -196,18 +195,21 @@ const char *get_obj_name_str(enum ObjTypeFlag objFlag) { return objName; } -/* @ 22A990 for 0x510 */ +/** + * Creates an object of the specified type + */ struct GdObj *make_object(enum ObjTypeFlag objType) { struct GdObj *newObj; struct GdObj *objListOldHead; s32 objSize; s32 i; drawmethod_t objDrawFn; - const char *objNameStr; + const char *typeName; u8 *newObjBytes; s32 objPermanence = 0x10; - add_to_stacktrace("make_object"); + imin("make_object"); + switch (objType) { case OBJ_TYPE_JOINTS: objSize = sizeof(struct ObjJoint); @@ -227,11 +229,12 @@ struct GdObj *make_object(enum ObjTypeFlag objType) { break; case OBJ_TYPE_SHAPES: objSize = sizeof(struct ObjShape); - objDrawFn = (drawmethod_t) nop_obj_draw; + // Shapes get drawn by their parent object instead of automatically. + objDrawFn = (drawmethod_t) draw_nothing; break; case OBJ_TYPE_UNK200000: objSize = sizeof(struct ObjUnk200000); - objDrawFn = (drawmethod_t) nop_obj_draw; + objDrawFn = (drawmethod_t) draw_nothing; break; case OBJ_TYPE_NETS: objSize = sizeof(struct ObjNet); @@ -243,7 +246,7 @@ struct GdObj *make_object(enum ObjTypeFlag objType) { break; case OBJ_TYPE_VERTICES: objSize = sizeof(struct ObjVertex); - objDrawFn = (drawmethod_t) nop_obj_draw; + objDrawFn = (drawmethod_t) draw_nothing; break; case OBJ_TYPE_CAMERAS: objSize = sizeof(struct ObjCamera); @@ -264,7 +267,7 @@ struct GdObj *make_object(enum ObjTypeFlag objType) { break; case OBJ_TYPE_WEIGHTS: objSize = sizeof(struct ObjWeight); - objDrawFn = (drawmethod_t) nop_obj_draw; + objDrawFn = (drawmethod_t) draw_nothing; break; case OBJ_TYPE_GADGETS: objSize = sizeof(struct ObjGadget); @@ -272,7 +275,7 @@ struct GdObj *make_object(enum ObjTypeFlag objType) { break; case OBJ_TYPE_VIEWS: objSize = sizeof(struct ObjView); - objDrawFn = (drawmethod_t) nop_obj_draw; + objDrawFn = (drawmethod_t) draw_nothing; break; case OBJ_TYPE_LABELS: objSize = sizeof(struct ObjLabel); @@ -280,46 +283,48 @@ struct GdObj *make_object(enum ObjTypeFlag objType) { break; case OBJ_TYPE_ANIMATORS: objSize = sizeof(struct ObjAnimator); - objDrawFn = (drawmethod_t) nop_obj_draw; + objDrawFn = (drawmethod_t) draw_nothing; break; case OBJ_TYPE_VALPTRS: - objSize = sizeof(struct ObjValPtrs); - objDrawFn = (drawmethod_t) nop_obj_draw; + objSize = sizeof(struct ObjValPtr); + objDrawFn = (drawmethod_t) draw_nothing; break; case OBJ_TYPE_ZONES: objSize = sizeof(struct ObjZone); - objDrawFn = (drawmethod_t) nop_obj_draw; + objDrawFn = (drawmethod_t) draw_nothing; break; default: fatal_print("make_object() : Unkown object!"); } - objNameStr = get_obj_name_str(objType); - start_memtracker(objNameStr); + typeName = get_obj_name_str(objType); + // Allocate memory for the object + start_memtracker(typeName); newObj = gd_malloc(objSize, objPermanence); - if (newObj == NULL) { - fatal_printf("Cant allocate object '%s' memory!", objNameStr); + fatal_printf("Cant allocate object '%s' memory!", typeName); } + stop_memtracker(typeName); - stop_memtracker(objNameStr); - + // Zero out the object newObjBytes = (u8 *) newObj; for (i = 0; i < objSize; i++) { newObjBytes[i] = 0; } + // Add the new object to the beginning of gGdObjectList gGdObjCount++; objListOldHead = gGdObjectList; gGdObjectList = newObj; - newObj->prev = NULL; if (objListOldHead != NULL) { newObj->next = objListOldHead; objListOldHead->prev = newObj; } - newObj->number = gGdObjCount; + + // Fill in required fields + newObj->index = gGdObjCount; newObj->type = objType; newObj->objDrawFn = objDrawFn; newObj->drawFlags = 0; @@ -329,15 +334,15 @@ struct GdObj *make_object(enum ObjTypeFlag objType) { } /* @ 22AEA0 for 0xD0; orig name: func_8017C6D0 */ -struct ObjZone *make_zone(struct ObjGroup *a0, struct GdPlaneF *a1, struct ObjGroup *a2) { +struct ObjZone *make_zone(struct ObjGroup *a0, struct GdBoundingBox *bbox, struct ObjGroup *a2) { struct ObjZone *newZone = (struct ObjZone *) make_object(OBJ_TYPE_ZONES); - newZone->unk14.p0.x = a1->p0.x; - newZone->unk14.p0.y = a1->p0.y; - newZone->unk14.p0.z = a1->p0.z; - newZone->unk14.p1.x = a1->p1.x; - newZone->unk14.p1.y = a1->p1.y; - newZone->unk14.p1.z = a1->p1.z; + newZone->boundingBox.minX = bbox->minX; + newZone->boundingBox.minY = bbox->minY; + newZone->boundingBox.minZ = bbox->minZ; + newZone->boundingBox.maxX = bbox->maxX; + newZone->boundingBox.maxY = bbox->maxY; + newZone->boundingBox.maxZ = bbox->maxZ; // pointers? prev, next? newZone->unk2C = a2; newZone->unk30 = a0; @@ -350,69 +355,74 @@ struct ObjZone *make_zone(struct ObjGroup *a0, struct GdPlaneF *a1, struct ObjGr /* @ 22AF70 for 0x60 */ struct ObjUnk200000 *func_8017C7A0(struct ObjVertex *a0, struct ObjFace *a1) { - struct ObjUnk200000 *sp1C = (struct ObjUnk200000 *) make_object(OBJ_TYPE_UNK200000); + struct ObjUnk200000 *unk = (struct ObjUnk200000 *) make_object(OBJ_TYPE_UNK200000); - sp1C->unk30 = a0; - sp1C->unk34 = a1; + unk->unk30 = a0; + unk->unk34 = a1; - return sp1C; + return unk; } -/* @ 22AFD0 for 0xC0; orig name: func_8017C800 */ -struct Links *make_link_to_obj(struct Links *head, struct GdObj *a1) { - struct Links *newLink; +/** + * Creates a ListNode for the object. Adds the new node after `prevNode` if `prevNode` is not NULL. + */ +struct ListNode *make_link_to_obj(struct ListNode *prevNode, struct GdObj *obj) { + struct ListNode *newNode; + // Allocate link node start_memtracker("links"); - - newLink = gd_malloc_perm(sizeof(struct Links)); - - if (newLink == NULL) { + newNode = gd_malloc_perm(sizeof(struct ListNode)); + if (newNode == NULL) { fatal_print("Cant allocate link memory!"); } - stop_memtracker("links"); - if (head != NULL) { - head->next = newLink; + // Append to `prevNode` if not NULL + if (prevNode != NULL) { + prevNode->next = newNode; } - newLink->prev = head; - newLink->next = NULL; - newLink->obj = a1; + newNode->prev = prevNode; + newNode->next = NULL; + newNode->obj = obj; - return newLink; + return newNode; } -/* @ 22B090 -> 22B154; orig name: func_8017C8C0 */ -struct VtxLink *make_vtx_link(struct VtxLink *prevlink, Vtx *data) { - struct VtxLink *newLink; +/* + * Creates a VtxLink for the vertex. Adds the new node after `prevNode` if `prevNode` is not NULL. + */ +struct VtxLink *make_vtx_link(struct VtxLink *prevNode, Vtx *data) { + struct VtxLink *newNode; - newLink = gd_malloc_perm(sizeof(struct VtxLink)); - - if (newLink == NULL) { + newNode = gd_malloc_perm(sizeof(struct VtxLink)); + if (newNode == NULL) { fatal_print("Cant allocate link memory!"); } - if (prevlink != NULL) { - prevlink->next = newLink; + // Append to `prevNode` if not NULL + if (prevNode != NULL) { + prevNode->next = newNode; } - newLink->prev = prevlink; - newLink->next = NULL; - newLink->data = data; - // WTF? - if (((uintptr_t)(newLink)) == 0x3F800000) { + newNode->prev = prevNode; + newNode->next = NULL; + newNode->data = data; + + // WTF? Not sure what this is supposed to check + if (((uintptr_t)(newNode)) == 0x3F800000) { fatal_printf("bad3\n"); } - return newLink; + + return newNode; } /* @ 22B154 for 0x88; orig name: func8017C984 */ -struct ObjValPtrs *make_valptrs(struct GdObj *obj, s32 flags, enum ValPtrType type, size_t offset) { - struct ObjValPtrs *sp1C = (struct ObjValPtrs *) make_object(OBJ_TYPE_VALPTRS); +struct ObjValPtr *make_valptr(struct GdObj *obj, s32 flag, enum ValPtrType type, size_t offset) { + struct ObjValPtr *sp1C = (struct ObjValPtr *) make_object(OBJ_TYPE_VALPTRS); sp1C->obj = obj; - sp1C->unk20 = flags; + sp1C->flag = flag; sp1C->offset = offset; sp1C->datatype = type; @@ -431,7 +441,7 @@ void reset_plane(struct ObjPlane *plane) { s32 sp30; register f32 sp28; - add_to_stacktrace("reset_plane"); + imin("reset_plane"); sp4C = plane->unk40; calc_face_normal(sp4C); @@ -473,30 +483,30 @@ void reset_plane(struct ObjPlane *plane) { break; } - func_8017BCB0(); + reset_bounding_box(); for (i = 0; i < sp4C->vtxCount; i++) { - func_8017BD20(sp4C->vertices[i]); + add_obj_pos_to_bounding_box(&sp4C->vertices[i]->header); } - plane->plane28.p0.x = D_801B9DA0.p0.x; - plane->plane28.p0.y = D_801B9DA0.p0.y; - plane->plane28.p0.z = D_801B9DA0.p0.z; - plane->plane28.p1.x = D_801B9DA0.p1.x; - plane->plane28.p1.y = D_801B9DA0.p1.y; - plane->plane28.p1.z = D_801B9DA0.p1.z; + plane->boundingBox.minX = gSomeBoundingBox.minX; + plane->boundingBox.minY = gSomeBoundingBox.minY; + plane->boundingBox.minZ = gSomeBoundingBox.minZ; + plane->boundingBox.maxX = gSomeBoundingBox.maxX; + plane->boundingBox.maxY = gSomeBoundingBox.maxY; + plane->boundingBox.maxZ = gSomeBoundingBox.maxZ; - if (plane->plane28.p1.x - plane->plane28.p0.x < 100.0f) { - plane->plane28.p1.x += 50.0f; - plane->plane28.p0.x -= 50.0f; + if (plane->boundingBox.maxX - plane->boundingBox.minX < 100.0f) { + plane->boundingBox.maxX += 50.0f; + plane->boundingBox.minX -= 50.0f; } - plane->plane28.p1.y += 200.0f; - plane->plane28.p0.y -= 200.0f; + plane->boundingBox.maxY += 200.0f; + plane->boundingBox.minY -= 200.0f; - if (plane->plane28.p1.z - plane->plane28.p0.z < 100.0f) { - plane->plane28.p1.z += 50.0f; - plane->plane28.p0.z -= 50.0f; + if (plane->boundingBox.maxZ - plane->boundingBox.minZ < 100.0f) { + plane->boundingBox.maxZ += 50.0f; + plane->boundingBox.minZ -= 50.0f; } imout(); } @@ -516,7 +526,7 @@ struct ObjPlane *make_plane(s32 inZone, struct ObjFace *a1) { } /* @ 22B6A0 for 0x21C; orig name: func_8017CED0 */ -struct ObjCamera *make_camera(s32 a0, struct GdObj *a1) { +struct ObjCamera *make_camera(s32 flags, struct GdObj *a1) { struct ObjCamera *newCam; struct ObjCamera *oldCameraHead; @@ -533,7 +543,7 @@ struct ObjCamera *make_camera(s32 a0, struct GdObj *a1) { oldCameraHead->prev = newCam; } - newCam->unk2C = a0 | 0x10; + newCam->flags = flags | 0x10; newCam->unk30 = a1; gd_set_identity_mat4(&newCam->unk64); gd_set_identity_mat4(&newCam->unkA8); @@ -549,13 +559,13 @@ struct ObjCamera *make_camera(s32 a0, struct GdObj *a1) { newCam->unk178 = 0.0f; newCam->unk17C = 0.25f; - newCam->zoom = 0; - newCam->zoomLevels = -1; + newCam->zoomLevel = 0; + newCam->maxZoomLevel = -1; newCam->unkA4 = 0.0f; - newCam->unk34.x = newCam->unk34.y = newCam->unk34.z = 0.0f; - newCam->unk14.x = newCam->unk14.y = newCam->unk14.z = 0.0f; + newCam->lookAt.x = newCam->lookAt.y = newCam->lookAt.z = 0.0f; + newCam->worldPos.x = newCam->worldPos.y = newCam->worldPos.z = 0.0f; return newCam; } @@ -604,7 +614,7 @@ struct ObjLight *make_light(s32 flags, char *name, s32 id) { } /* @ 22BA78 for 0x294; orig name: func_8017D2A8*/ -struct ObjView *make_view(const char *name, s32 flags, s32 a2, s32 ulx, s32 uly, s32 lrx, s32 lry, +struct ObjView *make_view(const char *name, s32 flags, s32 projectionType, s32 ulx, s32 uly, s32 lrx, s32 lry, struct ObjGroup *parts) { struct ObjView *newView = (struct ObjView *) make_object(OBJ_TYPE_VIEWS); @@ -622,7 +632,7 @@ struct ObjView *make_view(const char *name, s32 flags, s32 a2, s32 ulx, s32 uly, } newView->unk78 = 0; - newView->unk38 = a2; + newView->projectionType = projectionType; newView->clipping.x = 30.0f; newView->clipping.y = 5000.0f; @@ -658,26 +668,29 @@ struct ObjView *make_view(const char *name, s32 flags, s32 a2, s32 ulx, s32 uly, struct ObjAnimator *make_animator(void) { struct ObjAnimator *newAnim = (struct ObjAnimator *) make_object(OBJ_TYPE_ANIMATORS); newAnim->unk24 = 1.0f; - newAnim->unk28 = 1.0f; + newAnim->frame = 1.0f; - newAnim->fn48 = NULL; - newAnim->unk4C = 0; + newAnim->controlFunc = NULL; + newAnim->state = 0; return newAnim; } /* @ 22BD84 for 0x78; orig name: func_8017D5B4 */ -struct ObjWeight *make_weight(UNUSED s32 a0, s32 id, struct ObjVertex *vtx, f32 weight) { +struct ObjWeight *make_weight(UNUSED s32 a0, s32 vtxId, struct ObjVertex *vtx /* always NULL */, f32 weight) { struct ObjWeight *newWeight = (struct ObjWeight *) make_object(OBJ_TYPE_WEIGHTS); - newWeight->id = id; - newWeight->unk38 = weight; - newWeight->unk3C = vtx; + newWeight->vtxId = vtxId; + newWeight->weightVal = weight; + newWeight->vtx = vtx; // is always NULL here. This vtx field actually gets set in reset_weight_vtx. return newWeight; } -/* @ 22BDFC for 0xCC; orig name: func_8017D62C */ +/** + * Makes a group, adding all objects from `fromObj` to `toObj` with type `type` + * as members. + */ struct ObjGroup *make_group_of_type(enum ObjTypeFlag type, struct GdObj *fromObj, struct GdObj *toObj) { struct ObjGroup *newGroup; struct GdObj *curObj; @@ -700,8 +713,10 @@ struct ObjGroup *make_group_of_type(enum ObjTypeFlag type, struct GdObj *fromObj return newGroup; } -/* @ 22BEC8 for 0x1CC; orig name: func_8017D6F8 */ -void sprint_obj_id(char *str, struct GdObj *obj) { +/** + * Converts the object's ID to a string and places it in the buffer pointed to by `str`. + */ +void format_object_id(char *str, struct GdObj *obj) { enum ObjTypeFlag type = obj->type; switch (type) { @@ -748,12 +763,12 @@ struct ObjGroup *make_group(s32 count, ...) { struct ObjGroup *oldGroupListHead; struct GdObj *vargObj; char idStrBuf[0x20]; - struct Links *curLink; + struct ListNode *curLink; newGroup = (struct ObjGroup *) make_object(OBJ_TYPE_GROUPS); newGroup->id = ++gGdGroupCount; - newGroup->objCount = 0; - newGroup->link1C = newGroup->link20 = NULL; + newGroup->memberCount = 0; + newGroup->firstMember = newGroup->lastMember = NULL; printf("Made group no.%d\n", newGroup->id); @@ -780,16 +795,16 @@ struct ObjGroup *make_group(s32 count, ...) { } curObj = vargObj; - newGroup->groupObjTypes |= curObj->type; + newGroup->memberTypes |= curObj->type; addto_group(newGroup, vargObj); } va_end(args); - curLink = newGroup->link1C; + curLink = newGroup->firstMember; printf("Made group no.%d from: ", newGroup->id); while (curLink != NULL) { curObj = curLink->obj; - sprint_obj_id(idStrBuf, curObj); + format_object_id(idStrBuf, curObj); printf("%s", idStrBuf); printf("\n"); curLink = curLink->next; @@ -798,74 +813,81 @@ struct ObjGroup *make_group(s32 count, ...) { return newGroup; } -/* @ 22C2A4 for 0xEC */ +/** + * Adds the object as a member of the group, placing it at the end of the group's list. + */ void addto_group(struct ObjGroup *group, struct GdObj *obj) { char strbuf[0x20]; UNUSED u8 pad[0x8]; - add_to_stacktrace("addto_group"); + imin("addto_group"); - if (group->link1C == NULL) { - group->link1C = make_link_to_obj(NULL, obj); - group->link20 = group->link1C; + // Add object to the end of group's member list + if (group->firstMember == NULL) { + group->firstMember = make_link_to_obj(NULL, obj); + group->lastMember = group->firstMember; } else { - group->link20 = make_link_to_obj(group->link20, obj); + group->lastMember = make_link_to_obj(group->lastMember, obj); } - group->groupObjTypes |= obj->type; - group->objCount++; + group->memberTypes |= obj->type; + group->memberCount++; printf("Added "); - sprint_obj_id(strbuf, obj); + format_object_id(strbuf, obj); printf("%s", strbuf); printf(" to "); - sprint_obj_id(strbuf, &group->header); + format_object_id(strbuf, &group->header); printf("%s", strbuf); printf("\n"); + imout(); } -/* @ 22C390 for 0xFC; orig name: func_8017DBC0 */ +/** + * Adds the object as a member of the group, placing it at the beginning of the group's list. + */ void addto_groupfirst(struct ObjGroup *group, struct GdObj *obj) { - struct Links *newLink; + imin("addto_groupfirst"); - add_to_stacktrace("addto_groupfirst"); - - if (group->link1C == NULL) { - group->link1C = make_link_to_obj(NULL, obj); - group->link20 = group->link1C; + // Add object to the beginning of group's member list + if (group->firstMember == NULL) { + group->firstMember = make_link_to_obj(NULL, obj); + group->lastMember = group->firstMember; } else { - newLink = make_link_to_obj(NULL, obj); - group->link1C->prev = newLink; - newLink->next = group->link1C; - group->link1C = newLink; + struct ListNode *newNode = make_link_to_obj(NULL, obj); + group->firstMember->prev = newNode; + newNode->next = group->firstMember; + group->firstMember = newNode; } - group->groupObjTypes |= obj->type; - group->objCount++; + group->memberTypes |= obj->type; + group->memberCount++; + imout(); } -/* @ 22C48C for 0x84; orig name: func_8017DCBC */ +/** + * Returns TRUE if `obj` is a member of `group`, or FALSE otherwise + */ s32 group_contains_obj(struct ObjGroup *group, struct GdObj *obj) { - struct Links *objLink = group->link1C; + struct ListNode *node = group->firstMember; - while (objLink != NULL) { - if (objLink->obj->number == obj->number) { - return 1; - } - - objLink = objLink->next; + while (node != NULL) { + if (node->obj->index == obj->index) + return TRUE; + node = node->next; } - return 0; + return FALSE; } -/* @ 22C510 for 0x4A8 */ -/* this shows details about all objects in the main object linked list */ +/** + * Unused (not called) - this shows details about all objects in the main object linked list + */ void show_details(enum ObjTypeFlag type) { enum ObjTypeFlag curObjType; - struct Links *curGroupLink; + struct ListNode *curGroupLink; struct ObjGroup *curSubGroup; struct GdObj *curObj; char idStrBuf[0x24]; @@ -894,11 +916,11 @@ void show_details(enum ObjTypeFlag type) { while (curObj != NULL) { curObjType = curObj->type; if (curObjType == type) { - sprint_obj_id(idStrBuf, curObj); + format_object_id(idStrBuf, curObj); switch (curObjType) { case OBJ_TYPE_GROUPS: gd_printf("Group %s: ", idStrBuf); - curGroupTypes = ((struct ObjGroup *) curObj)->groupObjTypes; + curGroupTypes = ((struct ObjGroup *) curObj)->memberTypes; if (curGroupTypes & OBJ_TYPE_GROUPS) { gd_printf("groups "); @@ -931,9 +953,9 @@ void show_details(enum ObjTypeFlag type) { gd_printf("vertex "); } - curGroupLink = ((struct ObjGroup *) curObj)->link1C; + curGroupLink = ((struct ObjGroup *) curObj)->firstMember; while (curGroupLink != NULL) { - sprint_obj_id(idStrBuf, curGroupLink->obj); + format_object_id(idStrBuf, curGroupLink->obj); gd_printf("%s", idStrBuf); curGroupLink = curGroupLink->next; } @@ -942,9 +964,9 @@ void show_details(enum ObjTypeFlag type) { case OBJ_TYPE_BONES: gd_printf("Bone %s: ", idStrBuf); curSubGroup = ((struct ObjBone *) curObj)->unk10C; - curGroupLink = curSubGroup->link1C; + curGroupLink = curSubGroup->firstMember; while (curGroupLink != NULL) { - sprint_obj_id(idStrBuf, curGroupLink->obj); + format_object_id(idStrBuf, curGroupLink->obj); gd_printf("%s", idStrBuf); curGroupLink = curGroupLink->next; } @@ -953,9 +975,9 @@ void show_details(enum ObjTypeFlag type) { case OBJ_TYPE_JOINTS: gd_printf("Joint %s: ", idStrBuf); curSubGroup = ((struct ObjJoint *) curObj)->unk1C4; - curGroupLink = curSubGroup->link1C; + curGroupLink = curSubGroup->firstMember; while (curGroupLink != NULL) { - sprint_obj_id(idStrBuf, curGroupLink->obj); + format_object_id(idStrBuf, curGroupLink->obj); gd_printf("%s", idStrBuf); curGroupLink = curGroupLink->next; } @@ -967,24 +989,28 @@ void show_details(enum ObjTypeFlag type) { curObj = curObj->next; } } + /* @ 22C9B8 for 0x24 */ -s32 func_8017E1E8(void) { +s32 stub_objects_2(void) { s32 sp4 = 0; return sp4; } -/* @ 22C9DC for 0x24 */ -s32 func_8017E20C(void) { + +/** + * Unused - called by __main__ + */ +s32 make_scene(void) { s32 sp4 = 0; return sp4; } /* @ 22CA00 for 0x88 */ -void gd_loadtexture(struct GdObj *obj) { +static void reset_joint_or_net(struct GdObj *obj) { struct GdObj *localObjPtr = obj; switch (obj->type) { case OBJ_TYPE_JOINTS: - func_80191604((struct ObjJoint *) localObjPtr); + reset_joint((struct ObjJoint *) localObjPtr); break; case OBJ_TYPE_NETS: reset_net((struct ObjNet *) localObjPtr); @@ -993,25 +1019,30 @@ void gd_loadtexture(struct GdObj *obj) { } } -/* @ 22CA88 for 0x38 */ -void func_8017E2B8(void) { - apply_to_obj_types_in_group(OBJ_TYPE_NETS, (applyproc_t) gd_loadtexture, sCurrentMoveGrp); +/** + * called when the user clicks the "Reset Positions" item from the + * "Dynamics" menu. + */ +void menu_cb_reset_positions(void) { + apply_to_obj_types_in_group(OBJ_TYPE_NETS, (applyproc_t) reset_joint_or_net, sCurrentMoveGrp); } -/* @ 22CAC0 for 0xF0 */ +/** + * Unused (not called) - does nothing useful + */ struct GdObj *func_8017E2F0(struct GdObj *obj, enum ObjTypeFlag type) { UNUSED u32 sp2C; enum ObjTypeFlag curObjType; - struct Links *curGroupLink; + struct ListNode *node; curObjType = obj->type; switch (curObjType) { case OBJ_TYPE_GROUPS: - curGroupLink = ((struct ObjGroup *) obj)->link1C; - while (curGroupLink != NULL) { - func_8017E2F0(curGroupLink->obj, type); - curGroupLink = curGroupLink->next; + node = ((struct ObjGroup *) obj)->firstMember; + while (node != NULL) { + func_8017E2F0(node->obj, type); + node = node->next; } break; case OBJ_TYPE_BONES: @@ -1029,10 +1060,14 @@ struct GdObj *func_8017E2F0(struct GdObj *obj, enum ObjTypeFlag type) { #endif } -/* @ 22CBB0 for 0x1A4; orig name: func8017E3E0 */ -s32 apply_to_obj_types_in_group(s32 types, applyproc_t fn, struct ObjGroup *group) { - struct Links *curLink; - struct Links *nextLink; +/** + * Recursively calls `func` on all members of `group` whose type is in the + * `types` bitmask. + * Returns the number of objects this function was called on. + */ +s32 apply_to_obj_types_in_group(s32 types, applyproc_t func, struct ObjGroup *group) { + struct ListNode *curLink; + struct ListNode *nextLink; struct GdObj *linkedObj; enum ObjTypeFlag linkedObjType; applyproc_t objFn; @@ -1055,12 +1090,12 @@ s32 apply_to_obj_types_in_group(s32 types, applyproc_t fn, struct ObjGroup *grou return fnAppliedCount; } - if (!((group->groupObjTypes & OBJ_TYPE_GROUPS) | (group->groupObjTypes & types))) { + if (!((group->memberTypes & OBJ_TYPE_GROUPS) | (group->memberTypes & types))) { return fnAppliedCount; } - objFn = fn; - curLink = group->link1C; + objFn = func; + curLink = group->firstMember; while (curLink != NULL) { linkedObj = curLink->obj; @@ -1068,7 +1103,7 @@ s32 apply_to_obj_types_in_group(s32 types, applyproc_t fn, struct ObjGroup *grou nextLink = curLink->next; if (linkedObjType == OBJ_TYPE_GROUPS) { - fnAppliedCount += apply_to_obj_types_in_group(types, fn, (struct ObjGroup *) linkedObj); + fnAppliedCount += apply_to_obj_types_in_group(types, func, (struct ObjGroup *) linkedObj); } if (linkedObjType & types) { @@ -1102,9 +1137,9 @@ void func_8017E584(struct ObjNet *a0, struct GdVec3f *a1, struct GdVec3f *a2) { sp7C.y = a1->y; sp7C.z = a1->z; - sp1C.x = a0->unkB0.x; - sp1C.y = a0->unkB0.y; - sp1C.z = a0->unkB0.z; + sp1C.x = a0->centerOfGravity.x; + sp1C.y = a0->centerOfGravity.y; + sp1C.z = a0->centerOfGravity.z; gd_rotate_and_translate_vec3f(&sp1C, &a0->mat128); @@ -1132,9 +1167,9 @@ void func_8017E584(struct ObjNet *a0, struct GdVec3f *a1, struct GdVec3f *a2) { sp88.y = a2->y * sp2C; sp88.z = a2->z * sp2C; - a0->unk74.x += sp88.x; - a0->unk74.y += sp88.y; - a0->unk74.z += sp88.z; + a0->collDisp.x += sp88.x; + a0->collDisp.y += sp88.y; + a0->collDisp.z += sp88.z; } /* @ 22D008 for 0x1B4 */ @@ -1151,9 +1186,9 @@ void func_8017E838(struct ObjNet *a0, struct GdVec3f *a1, struct GdVec3f *a2) { sp64.y = a1->y; sp64.z = a1->z; - sp18.x = a0->unkB0.x; - sp18.y = a0->unkB0.y; - sp18.z = a0->unkB0.z; + sp18.x = a0->centerOfGravity.x; + sp18.y = a0->centerOfGravity.y; + sp18.z = a0->centerOfGravity.z; gd_rotate_and_translate_vec3f(&sp18, &a0->mat128); @@ -1168,28 +1203,30 @@ void func_8017E838(struct ObjNet *a0, struct GdVec3f *a1, struct GdVec3f *a2) { gd_cross_vec3f(a2, &sp64, &sp70); gd_clamp_vec3f(&sp70, 5.0f); - a0->unk80.x += sp70.x; - a0->unk80.y += sp70.y; - a0->unk80.z += sp70.z; + a0->collTorque.x += sp70.x; + a0->collTorque.y += sp70.y; + a0->collTorque.z += sp70.z; } /* @ 22D1BC for 0xA8 */ -void func_8017E9EC(struct ObjNet *a0) { +void func_8017E9EC(struct ObjNet *net) { struct GdVec3f sp5C; Mat4f sp1C; f32 sp18; - sp5C.x = a0->unkA4.x; - sp5C.y = a0->unkA4.y; - sp5C.z = a0->unkA4.z; + sp5C.x = net->torque.x; + sp5C.y = net->torque.y; + sp5C.z = net->torque.z; gd_normalize_vec3f(&sp5C); - sp18 = gd_vec3f_magnitude(&a0->unkA4); + sp18 = gd_vec3f_magnitude(&net->torque); gd_create_rot_mat_angular(&sp1C, &sp5C, -sp18); gd_mult_mat4f(&D_801B9DC8, &sp1C, &D_801B9DC8); } -/* @ 22D264 for 0x90 */ +/** + * Unused (not called) + */ s32 func_8017EA94(struct GdVec3f *vec, Mat4f matrix) { if (vec->x >= matrix[2][2] && vec->x <= matrix[3][1] && vec->z >= matrix[3][0] && vec->z <= matrix[3][3]) { @@ -1199,117 +1236,131 @@ s32 func_8017EA94(struct GdVec3f *vec, Mat4f matrix) { return 0; } -/* @ 22D2F4 for 0x1DC */ -s32 func_8017EB24(struct GdObj *a0, struct GdObj *a1) { - struct GdVec3f sp44; - struct GdVec3f sp38; - struct GdPlaneF *sp34; - struct GdPlaneF *sp30; - struct GdPlaneF sp18; +/** + * Unused (not called) + */ +s32 func_8017EB24(struct GdObj *obj1, struct GdObj *obj2) { + struct GdVec3f pos1; + struct GdVec3f pos2; + struct GdBoundingBox *bbox1; + struct GdBoundingBox *bbox2; + struct GdBoundingBox sp18; - set_cur_dynobj(a0); - d_get_world_pos(&sp44); - sp34 = d_get_plane(); + set_cur_dynobj(obj1); + d_get_world_pos(&pos1); + bbox1 = d_get_bounding_box(); - set_cur_dynobj(a1); - d_get_world_pos(&sp38); - sp30 = d_get_plane(); + set_cur_dynobj(obj2); + d_get_world_pos(&pos2); + bbox2 = d_get_bounding_box(); - sp18.p0.x = sp34->p0.x + sp30->p0.x; - sp18.p0.y = sp34->p0.y + sp30->p0.y; - sp18.p0.z = sp34->p0.z + sp30->p0.z; - sp18.p1.x = sp34->p1.x + sp30->p1.x; - sp18.p1.y = sp34->p1.y + sp30->p1.y; - sp18.p1.z = sp34->p1.z + sp30->p1.z; + // bbox2 is an offset for bbox1? + sp18.minX = bbox1->minX + bbox2->minX; + sp18.minY = bbox1->minY + bbox2->minY; + sp18.minZ = bbox1->minZ + bbox2->minZ; + sp18.maxX = bbox1->maxX + bbox2->maxX; + sp18.maxY = bbox1->maxY + bbox2->maxY; + sp18.maxZ = bbox1->maxZ + bbox2->maxZ; - D_801B9E08.x = sp38.x - sp44.x; - D_801B9E08.y = sp38.y - sp44.y; - D_801B9E08.z = sp38.z - sp44.z; + D_801B9E08.x = pos2.x - pos1.x; + D_801B9E08.y = pos2.y - pos1.y; + D_801B9E08.z = pos2.z - pos1.z; - if (D_801B9E08.x >= sp18.p0.x) { - if (D_801B9E08.x <= sp18.p1.x) { - if (D_801B9E08.z >= sp18.p0.z) { - if (D_801B9E08.z <= sp18.p1.z) { - return 1; - } - } - } - } - - return 0; -} - -/* @ 22D4D0 for 0xCC */ -s32 func_8017ED00(struct GdObj *a0, struct GdPlaneF *a1) { - struct GdVec3f sp1C; - - set_cur_dynobj(a0); - d_get_world_pos(&sp1C); - - if (sp1C.x >= a1->p0.x) { - if (sp1C.x <= a1->p1.x) { - if (sp1C.z >= a1->p0.z) { - if (sp1C.z <= a1->p1.z) { - return 1; - } - } - } - } - - return 0; -} - -/* @ 22D59C for 0x90 */ -s32 func_8017EDCC(struct GdVec3f *a0, struct GdPlaneF *a1) { - if (a0->x >= a1->p0.x) { - if (a0->x <= a1->p1.x) { - if (a0->z >= a1->p0.z) { - if (a0->z <= a1->p1.z) { - return 1; - } - } - } - } - - return 0; -} - -/* @ 22D62C for 0x1F8; orig name: func_8017EE5C */ -s32 gd_plane_point_within(struct GdPlaneF *a0, struct GdPlaneF *a1) { - if (a0->p0.x >= a1->p0.x) { - if (a0->p0.x <= a1->p1.x) { - if (a0->p0.z >= a1->p0.z) { - if (a0->p0.z <= a1->p1.z) { + if (D_801B9E08.x >= sp18.minX) { + if (D_801B9E08.x <= sp18.maxX) { + if (D_801B9E08.z >= sp18.minZ) { + if (D_801B9E08.z <= sp18.maxZ) { return TRUE; } } } } - if (a0->p1.x >= a1->p0.x) { - if (a0->p1.x <= a1->p1.x) { - if (a0->p0.z >= a1->p0.z) { - if (a0->p0.z <= a1->p1.z) { + return FALSE; +} + +/** + * Unused (not called) + */ +s32 is_obj_xz_in_bounding_box(struct GdObj *obj, struct GdBoundingBox *bbox) { + struct GdVec3f pos; + + set_cur_dynobj(obj); + d_get_world_pos(&pos); + + if (pos.x >= bbox->minX) { + if (pos.x <= bbox->maxX) { + if (pos.z >= bbox->minZ) { + if (pos.z <= bbox->maxZ) { return TRUE; } } } } - if (a0->p1.x >= a1->p0.x) { - if (a0->p1.x <= a1->p1.x) { - if (a0->p1.z >= a1->p0.z) { - if (a0->p1.z <= a1->p1.z) { + return FALSE; +} + +/** + * Unused (not called) + */ +s32 is_point_xz_in_bounding_box(struct GdVec3f *point, struct GdBoundingBox *bbox) { + if (point->x >= bbox->minX) { + if (point->x <= bbox->maxX) { + if (point->z >= bbox->minZ) { + if (point->z <= bbox->maxZ) { return TRUE; } } } } - if (a0->p0.x >= a1->p0.x) { - if (a0->p0.x <= a1->p1.x) { - if (a0->p1.z >= a1->p0.z) { - if (a0->p1.z <= a1->p1.z) { + return FALSE; +} + +/** + * Unused (called by func_801A71CC) - returns TRUE if any of the four corners of + * box1's X-Z plane lie within box2's X-Z plane + */ +s32 gd_plane_point_within(struct GdBoundingBox *box1, struct GdBoundingBox *box2) { + // test if min x and min z of box1 are within box2 + if (box1->minX >= box2->minX) { + if (box1->minX <= box2->maxX) { + if (box1->minZ >= box2->minZ) { + if (box1->minZ <= box2->maxZ) { + return TRUE; + } + } + } + } + + // test if max x and min z of box1 are within box2 + if (box1->maxX >= box2->minX) { + if (box1->maxX <= box2->maxX) { + if (box1->minZ >= box2->minZ) { + if (box1->minZ <= box2->maxZ) { + return TRUE; + } + } + } + } + + // test if max x and max z of box1 are within box2 + if (box1->maxX >= box2->minX) { + if (box1->maxX <= box2->maxX) { + if (box1->maxZ >= box2->minZ) { + if (box1->maxZ <= box2->maxZ) { + return TRUE; + } + } + } + } + + // test if min x and max z of box1 are within box2 + if (box1->minX >= box2->minX) { + if (box1->minX <= box2->maxX) { + if (box1->maxZ >= box2->minZ) { + if (box1->maxZ <= box2->maxZ) { return TRUE; } } @@ -1320,52 +1371,53 @@ s32 gd_plane_point_within(struct GdPlaneF *a0, struct GdPlaneF *a1) { } /* @ 22D824 for 0x1BC */ -s32 func_8017F054(struct GdObj *a0, struct GdObj *a1) { - struct Links *curLink; +s32 transform_child_objects_recursive(struct GdObj *obj, struct GdObj *parentObj) { + struct ListNode *curLink; struct ObjGroup *curGroup; UNUSED u32 sp54; - Mat4f *sp50; - Mat4f *sp4C; - Mat4f *sp48; - Mat4f *sp44; - Mat4f *sp40; + Mat4f *parentUnkMtx; + Mat4f *iMtx; + Mat4f *unkMtx; + Mat4f *rotMtx; + Mat4f *rotMtx2; UNUSED u8 pad20[0x18]; - struct GdVec3f sp1C; + struct GdVec3f scale; - if (a1 != NULL) { - set_cur_dynobj(a1); - sp50 = d_get_matrix_ptr(); - sp44 = (Mat4f *) d_get_rot_mtx_ptr(); + if (parentObj != NULL) { + set_cur_dynobj(parentObj); + parentUnkMtx = d_get_matrix_ptr(); + rotMtx = (Mat4f *) d_get_rot_mtx_ptr(); - set_cur_dynobj(a0); - sp4C = d_get_idn_mtx_ptr(); - sp40 = (Mat4f *) d_get_rot_mtx_ptr(); + set_cur_dynobj(obj); + iMtx = d_get_i_mtx_ptr(); + rotMtx2 = (Mat4f *) d_get_rot_mtx_ptr(); - d_get_scale(&sp1C); - sp48 = d_get_matrix_ptr(); + d_get_scale(&scale); - gd_mult_mat4f(sp4C, sp50, sp48); - gd_mult_mat4f(sp4C, sp44, sp40); - gd_scale_mat4f_by_vec3f(sp40, &sp1C); + unkMtx = d_get_matrix_ptr(); + gd_mult_mat4f(iMtx, parentUnkMtx, unkMtx); + + gd_mult_mat4f(iMtx, rotMtx, rotMtx2); + gd_scale_mat4f_by_vec3f(rotMtx2, &scale); } else { - set_cur_dynobj(a0); - sp48 = d_get_matrix_ptr(); - sp4C = d_get_idn_mtx_ptr(); - sp44 = (Mat4f *) d_get_rot_mtx_ptr(); + set_cur_dynobj(obj); + unkMtx = d_get_matrix_ptr(); + iMtx = d_get_i_mtx_ptr(); + rotMtx = (Mat4f *) d_get_rot_mtx_ptr(); - d_get_scale(&sp1C); - gd_set_identity_mat4(sp48); - gd_copy_mat4f(sp4C, sp44); - gd_scale_mat4f_by_vec3f(sp44, &sp1C); + d_get_scale(&scale); + gd_set_identity_mat4(unkMtx); + gd_copy_mat4f(iMtx, rotMtx); + gd_scale_mat4f_by_vec3f(rotMtx, &scale); } - set_cur_dynobj(a0); + // Recursively call this function on attached children + set_cur_dynobj(obj); curGroup = d_get_att_objgroup(); - if (curGroup != NULL) { - curLink = curGroup->link1C; + curLink = curGroup->firstMember; while (curLink != NULL) { - func_8017F054(curLink->obj, a0); + transform_child_objects_recursive(curLink->obj, obj); curLink = curLink->next; } } @@ -1374,7 +1426,7 @@ s32 func_8017F054(struct GdObj *a0, struct GdObj *a1) { /* @ 22D9E0 for 0x1BC */ s32 func_8017F210(struct GdObj *a0, struct GdObj *a1) { - struct Links *sp6C; + struct ListNode *sp6C; struct ObjGroup *sp68; UNUSED u32 sp64; UNUSED Mat4f *sp60; @@ -1394,7 +1446,7 @@ s32 func_8017F210(struct GdObj *a0, struct GdObj *a1) { sp54 = (Mat4f *) d_get_rot_mtx_ptr(); set_cur_dynobj(a0); - sp5C = d_get_idn_mtx_ptr(); + sp5C = d_get_i_mtx_ptr(); sp50 = (Mat4f *) d_get_rot_mtx_ptr(); d_get_scale(&sp2C); @@ -1403,7 +1455,7 @@ s32 func_8017F210(struct GdObj *a0, struct GdObj *a1) { } else { set_cur_dynobj(a0); sp58 = d_get_matrix_ptr(); - sp5C = d_get_idn_mtx_ptr(); + sp5C = d_get_i_mtx_ptr(); sp54 = (Mat4f *) d_get_rot_mtx_ptr(); d_get_scale(&sp2C); @@ -1415,7 +1467,7 @@ s32 func_8017F210(struct GdObj *a0, struct GdObj *a1) { sp68 = d_get_att_objgroup(); if (sp68 != NULL) { - sp6C = sp68->link1C; + sp6C = sp68->firstMember; while (sp6C != NULL) { count += func_8017F210(sp6C->obj, a0); sp6C = sp6C->next; @@ -1430,34 +1482,44 @@ void func_8017F3CC(struct Unk8017F3CC *a0) { } /* @ 22DBD4 for 0x20 */ -void func_8017F404(UNUSED f32 a0, UNUSED struct GdObj *a1, UNUSED struct GdObj *a2) { +void stub_objects_3(UNUSED f32 a0, UNUSED struct GdObj *a1, UNUSED struct GdObj *a2) { UNUSED u8 pad[0x30]; } -/* @ 22DBF4 for 0x1A0 */ -void func_8017F424(struct GdTriangleF *a0, struct GdTriangleF *a1, f32 a2) { - Mat4f sp40; - struct GdTriangleF sp1C; +/** + * Interpolates between animation transformations `t1` and `t2`, with `dt` as + * the interpolation factor (between 0 and 1). Sets the current dynobj's matrix + * as the result of the transformation. + */ +void interpolate_animation_transform(struct GdAnimTransform *t1, struct GdAnimTransform *t2, f32 dt) { + Mat4f mtx; - gd_set_identity_mat4(&sp40); + gd_set_identity_mat4(&mtx); - if (a2 != 0.0f) { - sp1C.p1.x = a0->p1.x + (a1->p1.x - a0->p1.x) * a2; - sp1C.p1.y = a0->p1.y + (a1->p1.y - a0->p1.y) * a2; - sp1C.p1.z = a0->p1.z + (a1->p1.z - a0->p1.z) * a2; - sp1C.p2.x = a0->p2.x + (a1->p2.x - a0->p2.x) * a2; - sp1C.p2.y = a0->p2.y + (a1->p2.y - a0->p2.y) * a2; - sp1C.p2.z = a0->p2.z + (a1->p2.z - a0->p2.z) * a2; + if (dt != 0.0f) { + struct GdAnimTransform transform; - gd_scale_mat4f_by_vec3f(&sp40, &a0->p0); - gd_rot_mat_about_vec(&sp40, &sp1C.p1); - gd_add_vec3f_to_mat4f_offset(&sp40, &sp1C.p2); - } else { // L8017F568 - d_set_scale(a0->p0.x, a0->p0.y, a0->p0.z); - gd_rot_mat_about_vec(&sp40, &a0->p1); - gd_add_vec3f_to_mat4f_offset(&sp40, &a0->p2); - } // L8017F5A4 - d_set_idn_mtx(&sp40); + // interpolate rotation between t1 and t2 + transform.rotate.x = t1->rotate.x + (t2->rotate.x - t1->rotate.x) * dt; + transform.rotate.y = t1->rotate.y + (t2->rotate.y - t1->rotate.y) * dt; + transform.rotate.z = t1->rotate.z + (t2->rotate.z - t1->rotate.z) * dt; + + // interpolate position between t1 and t2 + transform.pos.x = t1->pos.x + (t2->pos.x - t1->pos.x) * dt; + transform.pos.y = t1->pos.y + (t2->pos.y - t1->pos.y) * dt; + transform.pos.z = t1->pos.z + (t2->pos.z - t1->pos.z) * dt; + + // not going to interpolate scale? + + gd_scale_mat4f_by_vec3f(&mtx, &t1->scale); + gd_rot_mat_about_vec(&mtx, &transform.rotate); + gd_add_vec3f_to_mat4f_offset(&mtx, &transform.pos); + } else { + d_set_scale(t1->scale.x, t1->scale.y, t1->scale.z); + gd_rot_mat_about_vec(&mtx, &t1->rotate); + gd_add_vec3f_to_mat4f_offset(&mtx, &t1->pos); + } + d_set_i_matrix(&mtx); } /* @ 22DD94 for 0x1060; orig name: func_8017F5C4 */ @@ -1465,42 +1527,41 @@ void move_animator(struct ObjAnimator *animObj) { struct AnimDataInfo *animData; // array? Mat4f *mtxArr; Mat4f localMtx; - struct GdTriangleF *triPtr; // Used as GdTriangleF[] or GdTriangleF* - struct GdTriangleF tri1; - struct GdTriangleF tri2; - s16(*triHArr)[9]; // GdTriangleH[]? - s16(*vec3hArr)[3]; // MyVec3h[]? - s16(*planeHArr)[6]; // GdPlaneH[]? - s16(*camPlaneHArr)[6]; // camera GdPlaneH[]? + struct GdAnimTransform *triPtr; + struct GdAnimTransform currTransform; // transformation for the current keyframe + struct GdAnimTransform nextTransform; // transformation for the next keyframe + s16(*animData9s16)[9]; // GdTriangleH[]? + s16(*animData3s16)[3]; // MyVec3h[]? + s16(*animData6s16)[6]; // GdPlaneH[]? + s16(*animDataCam)[6]; // camera GdPlaneH[]? struct GdObj *stubObj1 = NULL; // used only for call to stubbed function struct GdObj *stubObj2 = NULL; // used only for call to stubbed function UNUSED s32 sp50; UNUSED s32 sp4C; UNUSED s32 sp48; UNUSED struct GdVec3f unusedVec; - s32 sp38; - s32 sp34; - f32 sp30; + s32 currKeyFrame; + s32 nextKeyFrame; + f32 dt; f32 scale = 0.1f; struct AnimMtxVec *sp28; - register struct Links *link; + register struct ListNode *link; struct GdObj *linkedObj; - if (animObj->fn48 != NULL) { - (*animObj->fn48)(animObj); + if (animObj->controlFunc != NULL) { + animObj->controlFunc(animObj); } - if (animObj->unk14 == NULL) { - return; + if (animObj->animatedPartsGrp == NULL) { + return; // nothing to animate } - animData = (struct AnimDataInfo *) animObj->animdata->link1C->obj; + animData = (struct AnimDataInfo *) animObj->animdataGrp->firstMember->obj; - if (animObj->unk44 != NULL) { - animObj->unk28 = ((struct ObjAnimator *) animObj->unk44)->unk28 - / ((struct ObjAnimator *) animObj->unk44)->unk24; - animData += - ((struct ObjAnimator *) animObj->unk44)->unk20; //...why offset this pointer like this... + if (animObj->attachedToObj != NULL) { + animObj->frame = ((struct ObjAnimator *) animObj->attachedToObj)->frame + / ((struct ObjAnimator *) animObj->attachedToObj)->unk24; + animData += ((struct ObjAnimator *) animObj->attachedToObj)->animSeqNum; } if (animData->type == 0) { @@ -1511,170 +1572,183 @@ void move_animator(struct ObjAnimator *animObj) { unusedVec.y = 1.0f; unusedVec.z = 1.0f; - if (animObj->unk28 > (f32) animData->count) { - animObj->unk28 = 1.0f; - } else if (animObj->unk28 < 0.0f) { - animObj->unk28 = (f32) animData->count; + if (animObj->frame > (f32) animData->count) { + animObj->frame = 1.0f; + } else if (animObj->frame < 0.0f) { + animObj->frame = (f32) animData->count; } - sp38 = animObj->unk28; - sp30 = animObj->unk28 - (f32) sp38; - sp34 = sp38 + 1; + currKeyFrame = (s32) animObj->frame; + dt = animObj->frame - (f32) currKeyFrame; + nextKeyFrame = currKeyFrame + 1; - if (sp34 > animData->count) { - sp34 = 1; + if (nextKeyFrame > animData->count) { + nextKeyFrame = 1; } - sp38--; - sp34--; - link = animObj->unk14->link1C; + // convert frame numbers to zero-indexed + currKeyFrame--; + nextKeyFrame--; + + link = animObj->animatedPartsGrp->firstMember; while (link != NULL) { linkedObj = link->obj; set_cur_dynobj(linkedObj); switch (animData->type) { - case GD_ANIM_MATRIX: // data = Mat4f* (f32[4][4]) + case GD_ANIM_MTX4x4: // data = Mat4f* (f32[4][4]) mtxArr = (Mat4f *) animData->data; /* This needs be be un-dereferenced pointer addition to make the registers match */ - d_set_idn_mtx(mtxArr + (s32) animObj->unk28); + d_set_i_matrix(mtxArr + (s32) animObj->frame); break; - case GD_ANIM_3H_SCALED: // data = s16(*)[3] or MyVec3h[]... - vec3hArr = (s16(*)[3]) animData->data; + case GD_ANIM_ROT3S: // data = s16(*)[3] - rotation only + animData3s16 = (s16(*)[3]) animData->data; - d_get_scale(&tri1.p0); - tri2.p0.x = tri1.p0.x; - tri2.p0.y = tri1.p0.y; - tri2.p0.z = tri1.p0.z; + // keep current object scale + d_get_scale(&currTransform.scale); + nextTransform.scale.x = currTransform.scale.x; + nextTransform.scale.y = currTransform.scale.y; + nextTransform.scale.z = currTransform.scale.z; - d_get_init_pos(&tri1.p2); - tri2.p2.x = tri1.p2.x; - tri2.p2.y = tri1.p2.y; - tri2.p2.z = tri1.p2.z; + // keep current object position + d_get_init_pos(&currTransform.pos); + nextTransform.pos.x = currTransform.pos.x; + nextTransform.pos.y = currTransform.pos.y; + nextTransform.pos.z = currTransform.pos.z; - tri1.p1.x = (f32) vec3hArr[sp38][0] * scale; - tri1.p1.y = (f32) vec3hArr[sp38][1] * scale; - tri1.p1.z = (f32) vec3hArr[sp38][2] * scale; + // use animation rotation + currTransform.rotate.x = (f32) animData3s16[currKeyFrame][0] * scale; + currTransform.rotate.y = (f32) animData3s16[currKeyFrame][1] * scale; + currTransform.rotate.z = (f32) animData3s16[currKeyFrame][2] * scale; - tri2.p1.x = (f32) vec3hArr[sp34][0] * scale; - tri2.p1.y = (f32) vec3hArr[sp34][1] * scale; - tri2.p1.z = (f32) vec3hArr[sp34][2] * scale; + nextTransform.rotate.x = (f32) animData3s16[nextKeyFrame][0] * scale; + nextTransform.rotate.y = (f32) animData3s16[nextKeyFrame][1] * scale; + nextTransform.rotate.z = (f32) animData3s16[nextKeyFrame][2] * scale; - func_8017F424(&tri1, &tri2, sp30); + interpolate_animation_transform(&currTransform, &nextTransform, dt); break; - case GD_ANIM_3H: // data = s16(*)[3] or MyVec3h[]... - vec3hArr = (s16(*)[3]) animData->data; + case GD_ANIM_POS3S: // data = s16(*)[3] - position only + animData3s16 = (s16(*)[3]) animData->data; - d_get_scale(&tri1.p0); - tri2.p0.x = tri1.p0.x; - tri2.p0.y = tri1.p0.y; - tri2.p0.z = tri1.p0.z; + // keep current object scale + d_get_scale(&currTransform.scale); + nextTransform.scale.x = currTransform.scale.x; + nextTransform.scale.y = currTransform.scale.y; + nextTransform.scale.z = currTransform.scale.z; - d_get_init_rot(&tri1.p1); - tri2.p1.x = tri1.p1.x; - tri2.p1.y = tri1.p1.y; - tri2.p1.z = tri1.p1.z; + // keep current object rotation + d_get_init_rot(&currTransform.rotate); + nextTransform.rotate.x = currTransform.rotate.x; + nextTransform.rotate.y = currTransform.rotate.y; + nextTransform.rotate.z = currTransform.rotate.z; - tri1.p2.x = (f32) vec3hArr[sp38][0]; - tri1.p2.y = (f32) vec3hArr[sp38][1]; - tri1.p2.z = (f32) vec3hArr[sp38][2]; + // use animation position + currTransform.pos.x = (f32) animData3s16[currKeyFrame][0]; + currTransform.pos.y = (f32) animData3s16[currKeyFrame][1]; + currTransform.pos.z = (f32) animData3s16[currKeyFrame][2]; - tri2.p2.x = (f32) vec3hArr[sp34][0]; - tri2.p2.y = (f32) vec3hArr[sp34][1]; - tri2.p2.z = (f32) vec3hArr[sp34][2]; + nextTransform.pos.x = (f32) animData3s16[nextKeyFrame][0]; + nextTransform.pos.y = (f32) animData3s16[nextKeyFrame][1]; + nextTransform.pos.z = (f32) animData3s16[nextKeyFrame][2]; - func_8017F424(&tri1, &tri2, sp30); + interpolate_animation_transform(&currTransform, &nextTransform, dt); break; - case GD_ANIM_6H_SCALED: // data = s16(*)[6] or GdPlaneH[]... - planeHArr = (s16(*)[6]) animData->data; + case GD_ANIM_ROT3S_POS3S: // data = s16(*)[6] - rotation and position + animData6s16 = (s16(*)[6]) animData->data; - d_get_scale(&tri1.p0); - tri2.p0.x = tri1.p0.x; - tri2.p0.y = tri1.p0.y; - tri2.p0.z = tri1.p0.z; + // keep current object scale + d_get_scale(&currTransform.scale); + nextTransform.scale.x = currTransform.scale.x; + nextTransform.scale.y = currTransform.scale.y; + nextTransform.scale.z = currTransform.scale.z; - tri1.p1.x = (f32) planeHArr[sp38][0] * scale; - tri1.p1.y = (f32) planeHArr[sp38][1] * scale; - tri1.p1.z = (f32) planeHArr[sp38][2] * scale; + // use animation rotation + currTransform.rotate.x = (f32) animData6s16[currKeyFrame][0] * scale; + currTransform.rotate.y = (f32) animData6s16[currKeyFrame][1] * scale; + currTransform.rotate.z = (f32) animData6s16[currKeyFrame][2] * scale; - tri2.p1.x = (f32) planeHArr[sp34][0] * scale; - tri2.p1.y = (f32) planeHArr[sp34][1] * scale; - tri2.p1.z = (f32) planeHArr[sp34][2] * scale; + nextTransform.rotate.x = (f32) animData6s16[nextKeyFrame][0] * scale; + nextTransform.rotate.y = (f32) animData6s16[nextKeyFrame][1] * scale; + nextTransform.rotate.z = (f32) animData6s16[nextKeyFrame][2] * scale; - tri1.p2.x = (f32) planeHArr[sp38][3]; - tri1.p2.y = (f32) planeHArr[sp38][4]; - tri1.p2.z = (f32) planeHArr[sp38][5]; + // use animation position + currTransform.pos.x = (f32) animData6s16[currKeyFrame][3]; + currTransform.pos.y = (f32) animData6s16[currKeyFrame][4]; + currTransform.pos.z = (f32) animData6s16[currKeyFrame][5]; - tri2.p2.x = (f32) planeHArr[sp34][3]; - tri2.p2.y = (f32) planeHArr[sp34][4]; - tri2.p2.z = (f32) planeHArr[sp34][5]; + nextTransform.pos.x = (f32) animData6s16[nextKeyFrame][3]; + nextTransform.pos.y = (f32) animData6s16[nextKeyFrame][4]; + nextTransform.pos.z = (f32) animData6s16[nextKeyFrame][5]; - func_8017F424(&tri1, &tri2, sp30); + interpolate_animation_transform(&currTransform, &nextTransform, dt); break; - case GD_ANIM_9H: // data = s16(*)[9] or GdTriangleFH[]... - triHArr = (s16(*)[9]) animData->data; + case GD_ANIM_SCALE3S_POS3S_ROT3S: // data = s16(*)[9] - scale, position, and rotation + animData9s16 = (s16(*)[9]) animData->data; - tri1.p0.x = (f32) triHArr[sp38][0] * scale; - tri1.p0.y = (f32) triHArr[sp38][1] * scale; - tri1.p0.z = (f32) triHArr[sp38][2] * scale; + currTransform.scale.x = (f32) animData9s16[currKeyFrame][0] * scale; + currTransform.scale.y = (f32) animData9s16[currKeyFrame][1] * scale; + currTransform.scale.z = (f32) animData9s16[currKeyFrame][2] * scale; - tri1.p1.x = (f32) triHArr[sp38][3] * scale; - tri1.p1.y = (f32) triHArr[sp38][4] * scale; - tri1.p1.z = (f32) triHArr[sp38][5] * scale; + currTransform.rotate.x = (f32) animData9s16[currKeyFrame][3] * scale; + currTransform.rotate.y = (f32) animData9s16[currKeyFrame][4] * scale; + currTransform.rotate.z = (f32) animData9s16[currKeyFrame][5] * scale; - tri1.p2.x = (f32) triHArr[sp38][6]; - tri1.p2.y = (f32) triHArr[sp38][7]; - tri1.p2.z = (f32) triHArr[sp38][8]; + currTransform.pos.x = (f32) animData9s16[currKeyFrame][6]; + currTransform.pos.y = (f32) animData9s16[currKeyFrame][7]; + currTransform.pos.z = (f32) animData9s16[currKeyFrame][8]; - tri2.p0.x = (f32) triHArr[sp34][0] * scale; - tri2.p0.y = (f32) triHArr[sp34][1] * scale; - tri2.p0.z = (f32) triHArr[sp34][2] * scale; + nextTransform.scale.x = (f32) animData9s16[nextKeyFrame][0] * scale; + nextTransform.scale.y = (f32) animData9s16[nextKeyFrame][1] * scale; + nextTransform.scale.z = (f32) animData9s16[nextKeyFrame][2] * scale; - tri2.p1.x = (f32) triHArr[sp34][3] * scale; - tri2.p1.y = (f32) triHArr[sp34][4] * scale; - tri2.p1.z = (f32) triHArr[sp34][5] * scale; + nextTransform.rotate.x = (f32) animData9s16[nextKeyFrame][3] * scale; + nextTransform.rotate.y = (f32) animData9s16[nextKeyFrame][4] * scale; + nextTransform.rotate.z = (f32) animData9s16[nextKeyFrame][5] * scale; - tri2.p2.x = (f32) triHArr[sp34][6]; - tri2.p2.y = (f32) triHArr[sp34][7]; - tri2.p2.z = (f32) triHArr[sp34][8]; + nextTransform.pos.x = (f32) animData9s16[nextKeyFrame][6]; + nextTransform.pos.y = (f32) animData9s16[nextKeyFrame][7]; + nextTransform.pos.z = (f32) animData9s16[nextKeyFrame][8]; - func_8017F424(&tri1, &tri2, sp30); + interpolate_animation_transform(&currTransform, &nextTransform, dt); break; - case GD_ANIM_CAMERA: // s16(*)[6]? + case GD_ANIM_CAMERA_EYE3S_LOOKAT3S: // s16(*)[6]? if (linkedObj->type == OBJ_TYPE_CAMERAS) { - camPlaneHArr = animData->data; + animDataCam = animData->data; - tri1.p2.x = (f32) camPlaneHArr[sp38][0]; - tri1.p2.y = (f32) camPlaneHArr[sp38][1]; - tri1.p2.z = (f32) camPlaneHArr[sp38][2]; + // eye position + currTransform.pos.x = (f32) animDataCam[currKeyFrame][0]; + currTransform.pos.y = (f32) animDataCam[currKeyFrame][1]; + currTransform.pos.z = (f32) animDataCam[currKeyFrame][2]; - tri2.p2.x = (f32) camPlaneHArr[sp38][3]; - tri2.p2.y = (f32) camPlaneHArr[sp38][4]; - tri2.p2.z = (f32) camPlaneHArr[sp38][5]; + // lookat position + nextTransform.pos.x = (f32) animDataCam[currKeyFrame][3]; + nextTransform.pos.y = (f32) animDataCam[currKeyFrame][4]; + nextTransform.pos.z = (f32) animDataCam[currKeyFrame][5]; - ((struct ObjCamera *) linkedObj)->unk14.x = tri1.p2.x; - ((struct ObjCamera *) linkedObj)->unk14.y = tri1.p2.y; - ((struct ObjCamera *) linkedObj)->unk14.z = tri1.p2.z; + ((struct ObjCamera *) linkedObj)->worldPos.x = currTransform.pos.x; + ((struct ObjCamera *) linkedObj)->worldPos.y = currTransform.pos.y; + ((struct ObjCamera *) linkedObj)->worldPos.z = currTransform.pos.z; - ((struct ObjCamera *) linkedObj)->unk34.x = tri2.p2.x; - ((struct ObjCamera *) linkedObj)->unk34.y = tri2.p2.y; - ((struct ObjCamera *) linkedObj)->unk34.z = tri2.p2.z; + ((struct ObjCamera *) linkedObj)->lookAt.x = nextTransform.pos.x; + ((struct ObjCamera *) linkedObj)->lookAt.y = nextTransform.pos.y; + ((struct ObjCamera *) linkedObj)->lookAt.z = nextTransform.pos.z; } break; - case GD_ANIM_TRI_F_2: // GdTriangleF[] - triPtr = (struct GdTriangleF *) animData->data; - func_8017F424(&triPtr[sp38], &triPtr[sp34], sp30); + case GD_ANIM_SCALE3F_ROT3F_POS3F: // scale, rotation, and position (as floats) + triPtr = (struct GdAnimTransform *) animData->data; + interpolate_animation_transform(&triPtr[currKeyFrame], &triPtr[nextKeyFrame], dt); break; - case GD_ANIM_MTX_VEC: // AnimMtxVec[] - sp28 = &((struct AnimMtxVec *) animData->data)[sp38]; - d_set_idn_mtx(&sp28->matrix); + case GD_ANIM_MTX4x4F_SCALE3F: // AnimMtxVec[] + sp28 = &((struct AnimMtxVec *) animData->data)[currKeyFrame]; + d_set_i_matrix(&sp28->matrix); d_set_scale(sp28->vec.x, sp28->vec.y, sp28->vec.z); break; - case GD_ANIM_TRI_F_4: // GdTriangleF* - triPtr = (struct GdTriangleF *) animData->data; + case GD_ANIM_SCALE3F_ROT3F_POS3F_2: // similar to GD_ANIM_SCALE3F_ROT3F_POS3F, but no interpolation? what matrix does d_set_i_matrix set? + triPtr = (struct GdAnimTransform *) animData->data; gd_set_identity_mat4(&localMtx); - gd_scale_mat4f_by_vec3f(&localMtx, &triPtr->p0); - gd_rot_mat_about_vec(&localMtx, &triPtr->p1); - gd_add_vec3f_to_mat4f_offset(&localMtx, &triPtr->p2); - d_set_idn_mtx(&localMtx); + gd_scale_mat4f_by_vec3f(&localMtx, &triPtr->scale); + gd_rot_mat_about_vec(&localMtx, &triPtr->rotate); + gd_add_vec3f_to_mat4f_offset(&localMtx, &triPtr->pos); + d_set_i_matrix(&localMtx); break; case GD_ANIM_STUB: if (stubObj1 == NULL) { @@ -1682,7 +1756,7 @@ void move_animator(struct ObjAnimator *animObj) { } else { if (stubObj2 == NULL) { stubObj2 = linkedObj; - func_8017F404(animObj->unk28, stubObj1, stubObj2); + stub_objects_3(animObj->frame, stubObj1, stubObj2); } else { fatal_printf("Too many objects to morph"); } @@ -1700,7 +1774,7 @@ void drag_picked_object(struct GdObj *inputObj) { UNUSED u32 spE4; UNUSED u32 spE0; UNUSED u32 spDC; - struct GdVec3f spD0; + struct GdVec3f displacement; struct GdVec3f spC4; struct GdControl *ctrl; Mat4f sp80; @@ -1708,7 +1782,7 @@ void drag_picked_object(struct GdObj *inputObj) { UNUSED u32 pad34[3]; struct GdObj *obj; UNUSED u32 pad2C; - f32 sp28; + f32 dispMag; ctrl = &gGdCtrl; @@ -1716,18 +1790,18 @@ void drag_picked_object(struct GdObj *inputObj) { return; } - sp28 = gd_vec3f_magnitude(&gViewUpdateCamera->unk40); - sp28 /= 1000.0f; + dispMag = gd_vec3f_magnitude(&gViewUpdateCamera->unk40); + dispMag /= 1000.0f; - spD0.x = ((f32)(ctrl->csrX - ctrl->csrXatApress)) * sp28; - spD0.y = ((f32) - (ctrl->csrY - ctrl->csrYatApress)) * sp28; - spD0.z = 0.0f; + displacement.x = ((f32)(ctrl->csrX - ctrl->dragStartX)) * dispMag; + displacement.y = ((f32) - (ctrl->csrY - ctrl->dragStartY)) * dispMag; + displacement.z = 0.0f; gd_inverse_mat4f(&gViewUpdateCamera->unkE8, &sp40); - gd_mat4f_mult_vec3f(&spD0, &sp40); + gd_mat4f_mult_vec3f(&displacement, &sp40); obj = inputObj; - if ((inputObj->drawFlags & OBJ_PICKED) && gGdCtrl.btnApressed) { + if ((inputObj->drawFlags & OBJ_PICKED) && gGdCtrl.dragging) { gd_play_sfx(GD_SFX_PINCH_FACE); // Note: this second sfx won't play, as it is "overwritten" by the first if (ABS(ctrl->stickDeltaX) + ABS(ctrl->stickDeltaY) >= 11) { @@ -1736,22 +1810,22 @@ void drag_picked_object(struct GdObj *inputObj) { switch (inputObj->type) { case OBJ_TYPE_JOINTS: - ((struct ObjJoint *) obj)->mat128[3][0] += spD0.x; - ((struct ObjJoint *) obj)->mat128[3][1] += spD0.y; - ((struct ObjJoint *) obj)->mat128[3][2] += spD0.z; + ((struct ObjJoint *) obj)->mat128[3][0] += displacement.x; + ((struct ObjJoint *) obj)->mat128[3][1] += displacement.y; + ((struct ObjJoint *) obj)->mat128[3][2] += displacement.z; break; case OBJ_TYPE_GADGETS: break; case OBJ_TYPE_NETS: gd_inverse_mat4f(&((struct ObjNet *) obj)->mat128, &sp80); - spC4.x = spD0.x; - spC4.y = spD0.y; - spC4.z = spD0.z; + spC4.x = displacement.x; + spC4.y = displacement.y; + spC4.z = displacement.z; gd_mat4f_mult_vec3f(&spC4, &sp80); - ((struct ObjNet *) obj)->matE8[3][0] += spD0.x; - ((struct ObjNet *) obj)->matE8[3][1] += spD0.y; - ((struct ObjNet *) obj)->matE8[3][2] += spD0.z; + ((struct ObjNet *) obj)->matE8[3][0] += displacement.x; + ((struct ObjNet *) obj)->matE8[3][1] += displacement.y; + ((struct ObjNet *) obj)->matE8[3][2] += displacement.z; break; case OBJ_TYPE_PARTICLES: break; @@ -1783,10 +1857,10 @@ void move_camera(struct ObjCamera *cam) { Mat4f sp70; UNUSED u8 pad30[0x70 - 0x30]; Mat4f *sp2C; - struct GdControl *ctrl; // 28 + struct GdControl *ctrl; ctrl = &gGdCtrl; - if ((cam->unk2C & 0x10) == 0) { + if (!(cam->flags & 0x10)) { return; } @@ -1816,20 +1890,21 @@ void move_camera(struct ObjCamera *cam) { cam->unkA8[1][1] = 1.0f; cam->unkA8[1][2] = 0.0f; + // setting the unkA8 matrix above is pointless, if we're just going to overwrite it with the identity matrix. gd_set_identity_mat4(&cam->unkA8); } else { gd_set_identity_mat4(&cam->unkA8); } sp2C = &cam->unk64; - if ((cam->unk2C & 0x4) != 0) { // new B press - if (ctrl->btnB != FALSE && ctrl->prevFrame->btnB == FALSE) { - cam->zoom++; - if (cam->zoom > cam->zoomLevels) { - cam->zoom = 0; + if ((cam->flags & CAMERA_FLAG_CONTROLLABLE) != 0) { + if (ctrl->btnB != FALSE && ctrl->prevFrame->btnB == FALSE) { // new B press + cam->zoomLevel++; + if (cam->zoomLevel > cam->maxZoomLevel) { + cam->zoomLevel = 0; } - switch (cam->zoom) { + switch (cam->zoomLevel) { case 0: gd_play_sfx(GD_SFX_CAM_ZOOM_IN); break; @@ -1858,9 +1933,9 @@ void move_camera(struct ObjCamera *cam) { cam->unk128.x = gd_clamp_f32(cam->unk128.x, 80.0f); - cam->unk4C.x = cam->positions[cam->zoom].x; - cam->unk4C.y = cam->positions[cam->zoom].y; - cam->unk4C.z = cam->positions[cam->zoom].z; + cam->unk4C.x = cam->zoomPositions[cam->zoomLevel].x; + cam->unk4C.y = cam->zoomPositions[cam->zoomLevel].y; + cam->unk4C.z = cam->zoomPositions[cam->zoomLevel].z; gd_rot_2d_vec(cam->unk128.x, &cam->unk4C.y, &cam->unk4C.z); gd_rot_2d_vec(-cam->unk128.y, &cam->unk4C.x, &cam->unk4C.z); @@ -1883,13 +1958,13 @@ void move_camera(struct ObjCamera *cam) { gd_mult_mat4f(sp2C, &cam->unkA8, &cam->unkA8); gd_mat4f_mult_vec3f(&spD4, &cam->unkA8); - cam->unk14.x = spD4.x; - cam->unk14.y = spD4.y; - cam->unk14.z = spD4.z; + cam->worldPos.x = spD4.x; + cam->worldPos.y = spD4.y; + cam->worldPos.z = spD4.z; - cam->unk14.x += spE0.x; - cam->unk14.y += spE0.y; - cam->unk14.z += spE0.z; + cam->worldPos.x += spE0.x; + cam->worldPos.y += spE0.y; + cam->worldPos.z += spE0.z; } /* @ 22F7A4 for 0x38; orig name: func_80180FD4 */ @@ -1982,7 +2057,7 @@ void move_group_members(void) { /* @ 22FC2C for 0x98; orig name: func_8018145C */ void proc_view_movement(struct ObjView *view) { - add_to_stacktrace("movement"); + imin("movement"); sCurrentMoveCamera = view->activeCam; sCurrentMoveView = view; if ((sCurrentMoveGrp = view->components) != NULL) { diff --git a/src/goddard/objects.h b/src/goddard/objects.h index 9719f7db..bdf14c18 100644 --- a/src/goddard/objects.h +++ b/src/goddard/objects.h @@ -18,7 +18,7 @@ struct DebugCounters { }; // bss -extern struct GdPlaneF D_801B9DA0; +extern struct GdBoundingBox gSomeBoundingBox; extern struct ObjCamera *sCurrentMoveCamera; extern struct ObjView *sCurrentMoveView; extern struct DebugCounters gGdCounter; @@ -48,17 +48,16 @@ extern struct GdObj* gGdObjectList; extern struct ObjGroup* gGdViewsGroup; // functions -void func_8017BCB0(void); -void func_8017BD20(void *a0); -void func_8017BE60(struct GdPlaneF *a0); -void func_8017BED0(UNUSED struct ObjGroup *a0, UNUSED struct GdObj *a1); -const char *get_obj_name_str(enum ObjTypeFlag objFlag); +void reset_bounding_box(void); +void add_obj_pos_to_bounding_box(struct GdObj *a0); +void get_some_bounding_box(struct GdBoundingBox *a0); +void stub_objects_1(UNUSED struct ObjGroup *a0, UNUSED struct GdObj *a1); struct GdObj *make_object(enum ObjTypeFlag objFlag); -struct ObjZone *make_zone(struct ObjGroup *a0, struct GdPlaneF *a1, struct ObjGroup *a2); +struct ObjZone *make_zone(struct ObjGroup *a0, struct GdBoundingBox *a1, struct ObjGroup *a2); struct ObjUnk200000 *func_8017C7A0(struct ObjVertex *a0, struct ObjFace *a1); -struct Links *make_link_to_obj(struct Links *head, struct GdObj *a1); +struct ListNode *make_link_to_obj(struct ListNode *head, struct GdObj *a1); struct VtxLink *make_vtx_link(struct VtxLink *prevLink, Vtx *data); -struct ObjValPtrs *make_valptrs(struct GdObj *obj, s32 flags, enum ValPtrType type, size_t offset); +struct ObjValPtr *make_valptr(struct GdObj *obj, s32 flags, enum ValPtrType type, size_t offset); void reset_plane(struct ObjPlane *plane); struct ObjPlane *make_plane(s32 inZone, struct ObjFace *a1); struct ObjCamera *make_camera(s32 a0, struct GdObj *a1); @@ -69,30 +68,28 @@ struct ObjView *make_view(const char *name, s32 flags, s32 a2, s32 ulx, s32 uly, struct ObjAnimator *make_animator(void); struct ObjWeight *make_weight(UNUSED s32 a0, s32 id, struct ObjVertex *vtx, f32 weight); struct ObjGroup *make_group_of_type(enum ObjTypeFlag, struct GdObj*, struct GdObj*); -void sprint_obj_id(char*, struct GdObj*); +void format_object_id(char*, struct GdObj*); struct ObjGroup* make_group(s32 count, ...); void addto_group(struct ObjGroup *group, struct GdObj *obj); void addto_groupfirst(struct ObjGroup *group, struct GdObj *obj); s32 group_contains_obj(struct ObjGroup *group, struct GdObj *obj); void show_details(enum ObjTypeFlag type); -s32 func_8017E1E8(void); -s32 func_8017E20C(void); -void gd_loadtexture(struct GdObj *obj); -void func_8017E2B8(void); -struct GdObj *func_8017E2F0(struct GdObj *obj, enum ObjTypeFlag type); +s32 stub_objects_2(void); +s32 make_scene(void); +void menu_cb_reset_positions(void); s32 apply_to_obj_types_in_group(s32 types, applyproc_t fn, struct ObjGroup *group); void func_8017E584(struct ObjNet *a0, struct GdVec3f *a1, struct GdVec3f *a2); void func_8017E838(struct ObjNet *a0, struct GdVec3f *a1, struct GdVec3f *a2); void func_8017E9EC(struct ObjNet *a0); s32 func_8017EA94(struct GdVec3f *vec, Mat4f matrix); s32 func_8017EB24(struct GdObj *a0, struct GdObj *a1); -s32 func_8017ED00(struct GdObj *a0, struct GdPlaneF *a1); -s32 func_8017EDCC(struct GdVec3f *a0, struct GdPlaneF *a1); -s32 gd_plane_point_within(struct GdPlaneF *a0, struct GdPlaneF *a1); -s32 func_8017F054(struct GdObj *a0, struct GdObj *a1); +s32 is_obj_xz_in_bounding_box(struct GdObj *a0, struct GdBoundingBox *a1); +s32 is_point_xz_in_bounding_box(struct GdVec3f *a0, struct GdBoundingBox *a1); +s32 gd_plane_point_within(struct GdBoundingBox *a0, struct GdBoundingBox *a1); +s32 transform_child_objects_recursive(struct GdObj *a0, struct GdObj *a1); s32 func_8017F210(struct GdObj *a0, struct GdObj *a1); -void func_8017F404(UNUSED f32 a0, UNUSED struct GdObj *a1, UNUSED struct GdObj *a2); -void func_8017F424(struct GdTriangleF *a0, struct GdTriangleF *a1, f32 a2); +void stub_objects_3(UNUSED f32 a0, UNUSED struct GdObj *a1, UNUSED struct GdObj *a2); +void interpolate_animation_transform(struct GdAnimTransform *a0, struct GdAnimTransform *a1, f32 a2); void move_animator(struct ObjAnimator *animObj); void drag_picked_object(struct GdObj *inputObj); void move_animators(struct ObjGroup *group); diff --git a/src/goddard/old_menu.c b/src/goddard/old_menu.c index f6269438..7d4751cb 100644 --- a/src/goddard/old_menu.c +++ b/src/goddard/old_menu.c @@ -12,8 +12,8 @@ /** * @file old_menu.c * - * This file contains code for rendering what appears to be an old menuing system. - * It is hard to tell, as most of the menuing code is stubbed out. + * This file contains remnants of code for rendering what appears to be a GUI + * that used the IRIX Graphics Library, from when this program was a standalone demo. * It also contains code for creating labels and gadget, which are `GdObj`s that * allow for displaying text and memory values on screen. Those `GdObj`s are not * created in-game, but there are some functions in `renderer.c` that use @@ -21,13 +21,13 @@ */ // bss -static char sMenuStrBuf[0x100]; +static char sDefSettingsMenuStr[0x100]; static struct GdVec3f sStaticVec; static struct GdVec3f unusedVec; static struct ObjGadget *sCurGadgetPtr; // forward declarations -void func_8018BCB8(struct ObjGadget *); +static void reset_gadget_default(struct ObjGadget *); /* 239EC0 -> 239F78 */ void get_objvalue(union ObjVarVal *dst, enum ValPtrType type, void *base, size_t offset) { @@ -58,53 +58,72 @@ void Unknown8018B7A8(void *a0) { d_set_world_pos(sp1C.x, sp1C.y, sp1C.z); } -/* 23A00C -> 23A068 */ -void Proc8018B83C(void *a0) { - struct ObjGroup *argGroup = a0; - apply_to_obj_types_in_group(OBJ_TYPE_GADGETS, (applyproc_t) func_8018BCB8, argGroup); - apply_to_obj_types_in_group(OBJ_TYPE_VIEWS, (applyproc_t) func_801A43DC, gGdViewsGroup); +/** + * Unused - called when an item is selected from the "Default Settings" menu. + * + * @param itemId ID of the menu item that was clicked + */ +static void menu_cb_default_settings(intptr_t itemId) { + struct ObjGroup *group = (struct ObjGroup *)itemId; // Unpack pointer from menu item ID + apply_to_obj_types_in_group(OBJ_TYPE_GADGETS, (applyproc_t) reset_gadget_default, group); + apply_to_obj_types_in_group(OBJ_TYPE_VIEWS, (applyproc_t) stub_renderer_6, gGdViewsGroup); } -/* 23A068 -> 23A0D0; orig name: Unknown8018B898 */ -void cat_grp_name_to_buf(struct ObjGroup *group) { - char buf[0x100]; // sp18 +/** + * Unused - appends a menu item for the group to sDefSettingsMenuStr. + */ +static void add_item_to_default_settings_menu(struct ObjGroup *group) { + char buf[0x100]; if (group->debugPrint == 1) { - sprintf(buf, "| %s %%x%d", group->name, (u32) (uintptr_t) group); - gd_strcat(sMenuStrBuf, buf); // gd_strcat? + // Convert pointer to integer and store it as the menu item ID. + sprintf(buf, "| %s %%x%d", group->name, (u32) (intptr_t) group); + gd_strcat(sDefSettingsMenuStr, buf); } } -/* 23A0D0 -> 23A190 */ -void *Unknown8018B900(struct ObjGroup *grp) { - void *mainMenu; - void *defaultSettingMenu; - void *controlerMenu; +/** + * Unused - creates a popup menu that allows the user to control some settings. + */ +long create_gui_menu(struct ObjGroup *grp) { + long dynamicsMenuId; + long defaultSettingMenuId; + long contTypeMenuId; - gd_strcpy(sMenuStrBuf, "Default Settings %t %F"); // gd_strcpy? - apply_to_obj_types_in_group(OBJ_TYPE_GROUPS, (applyproc_t) cat_grp_name_to_buf, grp); - defaultSettingMenu = func_801A43F0(sMenuStrBuf, &Proc8018B83C); - controlerMenu = func_801A43F0( - "Control Type %t %F| U-64 Analogue Joystick %x1 | Keyboard %x2 | Mouse %x3", &func_801A4410); - mainMenu = - func_801A43F0("Dynamics %t |\t\t\tReset Positions %f |\t\t\tSet Defaults %m |\t\t\tSet " - "Controller %m |\t\t\tRe-Calibrate Controller %f |\t\t\tQuit %f", - &func_8017E2B8, defaultSettingMenu, controlerMenu, &func_801A4424, &gd_exit); + gd_strcpy(sDefSettingsMenuStr, "Default Settings %t %F"); + apply_to_obj_types_in_group(OBJ_TYPE_GROUPS, (applyproc_t) add_item_to_default_settings_menu, grp); + defaultSettingMenuId = defpup(sDefSettingsMenuStr, &menu_cb_default_settings); - return mainMenu; + contTypeMenuId = defpup( + "Control Type %t %F" + "| U-64 Analogue Joystick %x1 " + "| Keyboard %x2 " + "| Mouse %x3", + &menu_cb_control_type); + + dynamicsMenuId = defpup( + "Dynamics %t " + "|\t\t\tReset Positions %f " + "|\t\t\tSet Defaults %m " + "|\t\t\tSet Controller %m " + "|\t\t\tRe-Calibrate Controller %f " + "|\t\t\tQuit %f", + &menu_cb_reset_positions, defaultSettingMenuId, contTypeMenuId, &menu_cb_recalibrate_controller, &gd_exit); + + return dynamicsMenuId; } /* 23A190 -> 23A250 */ -struct ObjLabel *make_label(struct ObjValPtrs *ptr, char *str, s32 a2, f32 x, f32 y, f32 z) { +struct ObjLabel *make_label(struct ObjValPtr *ptr, char *str, s32 a2, f32 x, f32 y, f32 z) { struct ObjLabel *label = (struct ObjLabel *) make_object(OBJ_TYPE_LABELS); label->valfn = NULL; label->valptr = ptr; label->fmtstr = str; label->unk24 = a2; label->unk30 = 4; - label->vec14.x = x; - label->vec14.y = y; - label->vec14.z = z; + label->position.x = x; + label->position.y = y; + label->position.z = z; return label; } @@ -112,15 +131,15 @@ struct ObjLabel *make_label(struct ObjValPtrs *ptr, char *str, s32 a2, f32 x, f3 /* 23A250 -> 23A32C */ struct ObjGadget *make_gadget(UNUSED s32 a0, s32 a1) { struct ObjGadget *gdgt = (struct ObjGadget *) make_object(OBJ_TYPE_GADGETS); - gdgt->unk4C = NULL; - gdgt->unk3C = 1.0f; - gdgt->unk38 = 0.0f; + gdgt->valueGrp = NULL; + gdgt->rangeMax = 1.0f; + gdgt->rangeMin = 0.0f; gdgt->unk20 = a1; - gdgt->unk5C = 0; - gdgt->unk28 = 1.0f; - gdgt->unk40.x = 100.0f; - gdgt->unk40.y = 10.0f; - gdgt->unk40.z = 10.0f; + gdgt->colourNum = 0; + gdgt->sliderPos = 1.0f; + gdgt->size.x = 100.0f; + gdgt->size.y = 10.0f; + gdgt->size.z = 10.0f; // how is this useful? return gdgt; } @@ -141,7 +160,7 @@ void set_objvalue(union ObjVarVal *src, enum ValPtrType type, void *base, size_t } /* 23A3E4 -> 23A488; orig name: Unknown8018BD54 */ -void set_static_gdgt_value(struct ObjValPtrs *vp) { +void set_static_gdgt_value(struct ObjValPtr *vp) { switch (vp->datatype) { case OBJ_VALUE_FLOAT: set_objvalue(&sCurGadgetPtr->varval, OBJ_VALUE_FLOAT, vp->obj, vp->offset); @@ -153,74 +172,75 @@ void set_static_gdgt_value(struct ObjValPtrs *vp) { } /* 23A488 -> 23A4D0 */ -void func_8018BCB8(struct ObjGadget *gdgt) { +static void reset_gadget_default(struct ObjGadget *gdgt) { UNUSED u8 pad[4]; sCurGadgetPtr = gdgt; - apply_to_obj_types_in_group(OBJ_TYPE_VALPTRS, (applyproc_t) set_static_gdgt_value, gdgt->unk4C); + apply_to_obj_types_in_group(OBJ_TYPE_VALPTRS, (applyproc_t) set_static_gdgt_value, gdgt->valueGrp); } /* 23A4D0 -> 23A784 */ void adjust_gadget(struct ObjGadget *gdgt, s32 a1, s32 a2) { UNUSED u8 pad[8]; - f32 sp2C; - struct ObjValPtrs *vp; + f32 range; + struct ObjValPtr *vp; - if (gdgt->unk24 == 1) { - gdgt->unk28 += a2 * (-sCurrentMoveCamera->unk40.z * 1.0E-5); - } else if (gdgt->unk24 == 2) { - gdgt->unk28 += a1 * (-sCurrentMoveCamera->unk40.z * 1.0E-5); + if (gdgt->type == 1) { + gdgt->sliderPos += a2 * (-sCurrentMoveCamera->unk40.z * 1.0E-5); + } else if (gdgt->type == 2) { + gdgt->sliderPos += a1 * (-sCurrentMoveCamera->unk40.z * 1.0E-5); } - if (gdgt->unk28 < 0.0f) { - gdgt->unk28 = 0.0f; - } else if (gdgt->unk28 > 1.0f) { - gdgt->unk28 = 1.0f; + // slider position must be between 0 and 1 (inclusive) + if (gdgt->sliderPos < 0.0f) { + gdgt->sliderPos = 0.0f; + } else if (gdgt->sliderPos > 1.0f) { + gdgt->sliderPos = 1.0f; } - sp2C = gdgt->unk3C - gdgt->unk38; + range = gdgt->rangeMax - gdgt->rangeMin; - if (gdgt->unk4C != NULL) { - vp = (struct ObjValPtrs *) gdgt->unk4C->link1C->obj; + if (gdgt->valueGrp != NULL) { + vp = (struct ObjValPtr *) gdgt->valueGrp->firstMember->obj; switch (vp->datatype) { case OBJ_VALUE_FLOAT: - gdgt->varval.f = gdgt->unk28 * sp2C + gdgt->unk38; + gdgt->varval.f = gdgt->sliderPos * range + gdgt->rangeMin; break; case OBJ_VALUE_INT: - gdgt->varval.i = ((s32)(gdgt->unk28 * sp2C)) + gdgt->unk38; + gdgt->varval.i = ((s32)(gdgt->sliderPos * range)) + gdgt->rangeMin; break; default: fatal_printf("%s: Undefined ValueType", "adjust_gadget"); } } - func_8018BCB8(gdgt); + reset_gadget_default(gdgt); } /* 23A784 -> 23A940; orig name: Unknown8018BFB4 */ void reset_gadget(struct ObjGadget *gdgt) { UNUSED u8 pad[8]; - f32 sp34; - struct ObjValPtrs *vp; + f32 range; + struct ObjValPtr *vp; - if (gdgt->unk3C - gdgt->unk38 == 0.0f) { - fatal_printf("gadget has zero range (%f -> %f)\n", gdgt->unk38, gdgt->unk3C); + if (gdgt->rangeMax - gdgt->rangeMin == 0.0f) { + fatal_printf("gadget has zero range (%f -> %f)\n", gdgt->rangeMin, gdgt->rangeMax); } - sp34 = (f32)(1.0 / (gdgt->unk3C - gdgt->unk38)); + range = (f32)(1.0 / (gdgt->rangeMax - gdgt->rangeMin)); - if (gdgt->unk4C != NULL) { - vp = (struct ObjValPtrs *) gdgt->unk4C->link1C->obj; + if (gdgt->valueGrp != NULL) { + vp = (struct ObjValPtr *) gdgt->valueGrp->firstMember->obj; switch (vp->datatype) { case OBJ_VALUE_FLOAT: get_objvalue(&gdgt->varval, OBJ_VALUE_FLOAT, vp->obj, vp->offset); - gdgt->unk28 = (gdgt->varval.f - gdgt->unk38) * sp34; + gdgt->sliderPos = (gdgt->varval.f - gdgt->rangeMin) * range; break; case OBJ_VALUE_INT: get_objvalue(&gdgt->varval, OBJ_VALUE_INT, vp->obj, vp->offset); - gdgt->unk28 = (gdgt->varval.i - gdgt->unk38) * sp34; + gdgt->sliderPos = (gdgt->varval.i - gdgt->rangeMin) * range; break; default: fatal_printf("%s: Undefined ValueType", "reset_gadget"); diff --git a/src/goddard/old_menu.h b/src/goddard/old_menu.h index 85ed7419..5d71b342 100644 --- a/src/goddard/old_menu.h +++ b/src/goddard/old_menu.h @@ -13,7 +13,7 @@ void reset_gadgets_in_grp(struct ObjGroup *grp); // see bad_declarations.h #ifndef GD_USE_BAD_DECLARATIONS -struct ObjLabel *make_label(struct ObjValPtrs *ptr, char *str, s32 a2, f32 x, f32 y, f32 z); +struct ObjLabel *make_label(struct ObjValPtr *ptr, char *str, s32 a2, f32 x, f32 y, f32 z); #endif #endif // GD_OLD_MENU_H diff --git a/src/goddard/particles.c b/src/goddard/particles.c index aa353b9b..26b3cb86 100644 --- a/src/goddard/particles.c +++ b/src/goddard/particles.c @@ -18,9 +18,10 @@ typedef union { } VtxPtc; struct Connection { - u8 filler0[0x1C]; - VtxPtc unk1C; - VtxPtc unk20; + struct GdObj header; // this header is never used + u8 filler14[8]; + VtxPtc node1; // first connected vertex or particle + VtxPtc node2; // second connected vertex or particle f32 unk24; u32 unk28; // union tag? 0 = vertex; 1 = particle? }; @@ -41,42 +42,39 @@ static s32 D_801A8238[5] = { static struct ObjFace *D_801B9EF0; // fn declarations -struct Connection *func_801825FC(struct ObjVertex *, struct ObjVertex *); -void func_80181C00(struct ObjVertex *, struct ObjVertex *); +struct Connection *make_connection(struct ObjVertex *, struct ObjVertex *); void Unknown80181D14(struct ObjFace *); void func_80181EB0(struct Connection *); void func_80182088(struct Connection *); void move_particle(struct ObjParticle *); -struct Connection *func_801825FC(struct ObjVertex *, struct ObjVertex *); +struct Connection *make_connection(struct ObjVertex *, struct ObjVertex *); int func_80182778(struct ObjParticle *); void func_80182A08(struct ObjParticle *, struct GdVec3f *b); void func_801838D0(struct ObjParticle *); void Unknown801835C8(struct ObjParticle *ptc); -/* 2303D0 -> 2304E4 */ -// rename to "connect_in_skinnet_if_needed"? -void func_80181C00(struct ObjVertex *vtx1, struct ObjVertex *vtx2) { - struct GdObj *sp2C; - register struct Links *link; +static void connect_vertices(struct ObjVertex *vtx1, struct ObjVertex *vtx2) { + struct Connection *newConn; + register struct ListNode *link; if (vtx1 == vtx2) { return; } - link = gGdSkinNet->unk1C0->link1C; + link = gGdSkinNet->unk1C0->firstMember; while (link != NULL) { // FIXME: types - struct Connection *sp24 = (void *) link->obj; + struct Connection *conn = (struct Connection *) link->obj; - if ((sp24->unk1C.vtx == vtx1 || sp24->unk1C.vtx == vtx2) - && (sp24->unk20.vtx == vtx1 || sp24->unk20.vtx == vtx2)) { + if ((conn->node1.vtx == vtx1 || conn->node1.vtx == vtx2) + && (conn->node2.vtx == vtx1 || conn->node2.vtx == vtx2)) { break; } link = link->next; } if (link == NULL) { - // FIXME: types - sp2C = (void *) func_801825FC(vtx1, vtx2); - addto_group(gGdSkinNet->unk1C0, sp2C); + newConn = make_connection(vtx1, vtx2); + //! make_connection never sets the header, so not sure what happens here + addto_group(gGdSkinNet->unk1C0, &newConn->header); } } @@ -90,14 +88,14 @@ void Unknown80181D14(struct ObjFace *face) { for (i = 0; i < face->vtxCount - 1; i++) { vtx1 = face->vertices[i]; vtx2 = face->vertices[i + 1]; - func_80181C00(vtx1, vtx2); + connect_vertices(vtx1, vtx2); } if (D_801B9EF0 != NULL) { for (i = 0; i < face->vtxCount; i++) { vtx1 = face->vertices[i]; for (j = 0; j < D_801B9EF0->vtxCount; j++) { vtx2 = D_801B9EF0->vertices[j]; - func_80181C00(vtx1, vtx2); + connect_vertices(vtx1, vtx2); } } } @@ -108,11 +106,11 @@ void Unknown80181D14(struct ObjFace *face) { void func_80181EB0(struct Connection *cxn) { struct GdVec3f sp34; UNUSED u8 unused[0x2C]; - struct ObjParticle *sp4 = cxn->unk1C.ptc; - struct ObjParticle *sp0 = cxn->unk20.ptc; + struct ObjParticle *sp4 = cxn->node1.ptc; + struct ObjParticle *sp0 = cxn->node2.ptc; sp34.x = 0.0f; - sp34.y = sp4->unk20.y - sp0->unk20.y; + sp34.y = sp4->pos.y - sp0->pos.y; sp34.z = 0.0f; sp34.y *= 0.01; sp4->unk38.x -= sp34.x; @@ -121,15 +119,15 @@ void func_80181EB0(struct Connection *cxn) { sp0->unk38.x += sp34.x; sp0->unk38.y += sp34.y; sp0->unk38.z += sp34.z; - if (!(sp4->unk54 & 2)) { - sp4->unk20.x -= sp34.x; - sp4->unk20.y -= sp34.y; - sp4->unk20.z -= sp34.z; + if (!(sp4->flags & 2)) { + sp4->pos.x -= sp34.x; + sp4->pos.y -= sp34.y; + sp4->pos.z -= sp34.z; } - if (!(sp0->unk54 & 2)) { - sp0->unk20.x += sp34.x; - sp0->unk20.y += sp34.y; - sp0->unk20.z += sp34.z; + if (!(sp0->flags & 2)) { + sp0->pos.x += sp34.x; + sp0->pos.y += sp34.y; + sp0->pos.z += sp34.z; } } @@ -146,11 +144,11 @@ void func_80182088(struct Connection *cxn) { func_80181EB0(cxn); return; } - sp1C = cxn->unk1C.ptc; - sp18 = cxn->unk20.ptc; - sp4C.x = sp1C->unk20.x - sp18->unk20.x; - sp4C.y = sp1C->unk20.y - sp18->unk20.y; - sp4C.z = sp1C->unk20.z - sp18->unk20.z; + sp1C = cxn->node1.ptc; + sp18 = cxn->node2.ptc; + sp4C.x = sp1C->pos.x - sp18->pos.x; + sp4C.y = sp1C->pos.y - sp18->pos.y; + sp4C.z = sp1C->pos.z - sp18->pos.z; sp20 = gd_vec3f_magnitude(&sp4C); sp24 = sp20 - cxn->unk24; sp4C.x /= sp20; @@ -165,36 +163,36 @@ void func_80182088(struct Connection *cxn) { sp18->unk38.x += sp4C.x; sp18->unk38.y += sp4C.y; sp18->unk38.z += sp4C.z; - if (!(sp1C->unk54 & 2)) { - sp1C->unk20.x -= sp4C.x; - sp1C->unk20.y -= sp4C.y; - sp1C->unk20.z -= sp4C.z; + if (!(sp1C->flags & 2)) { + sp1C->pos.x -= sp4C.x; + sp1C->pos.y -= sp4C.y; + sp1C->pos.z -= sp4C.z; } - if (!(sp18->unk54 & 2)) { - sp18->unk20.x += sp4C.x; - sp18->unk20.y += sp4C.y; - sp18->unk20.z += sp4C.z; + if (!(sp18->flags & 2)) { + sp18->pos.x += sp4C.x; + sp18->pos.y += sp4C.y; + sp18->pos.z += sp4C.z; } } /* 230B70 -> 230CC0 */ void func_801823A0(struct ObjNet *net) { - register struct Links *link; + register struct ListNode *link; struct Connection *cxn; gGdSkinNet = net; switch (net->unk3C) { case 1: // Shape; Are these flags the same as net->netType (+0x1EC)? - net->unk1C8 = ((struct ObjShape *) net->unk1A8)->vtxGroup; + net->unk1C8 = net->shapePtr->vtxGroup; net->unk1C0 = make_group(0); D_801B9EF0 = NULL; apply_to_obj_types_in_group(OBJ_TYPE_FACES, (applyproc_t) Unknown80181D14, - ((struct ObjShape *) net->unk1A8)->faceGroup); + net->shapePtr->faceGroup); net->unk3C = 2; break; case 2: - link = net->unk1C0->link1C; + link = net->unk1C0->firstMember; while (link != NULL) { // FIXME: types cxn = (struct Connection *) link->obj; @@ -208,35 +206,35 @@ void func_801823A0(struct ObjNet *net) { } /* 230CC0 -> 230DCC */ -struct ObjParticle *make_particle(u32 a, s32 b, f32 x, f32 y, f32 z) { - struct ObjParticle *sp2C = (struct ObjParticle *) make_object(OBJ_TYPE_PARTICLES); +struct ObjParticle *make_particle(u32 flags, s32 colourNum, f32 x, f32 y, f32 z) { + struct ObjParticle *particle = (struct ObjParticle *) make_object(OBJ_TYPE_PARTICLES); UNUSED u8 unused[8]; - sp2C->unk20.x = x; - sp2C->unk20.y = y; - sp2C->unk20.z = z; - sp2C->unk38.x = sp2C->unk38.y = sp2C->unk38.z = 0.0f; - sp2C->unk58 = b; - sp2C->unk54 = a | 8; - sp2C->unk5C = -1; - sp2C->id = D_801B9E40; /* should this be D_801B9E40++? */ - sp2C->unk1C = 0; - sp2C->unkB0 = 1; - return sp2C; + particle->pos.x = x; + particle->pos.y = y; + particle->pos.z = z; + particle->unk38.x = particle->unk38.y = particle->unk38.z = 0.0f; + particle->colourNum = colourNum; + particle->flags = flags | 8; + particle->timeout = -1; + particle->id = D_801B9E40; /* should this be D_801B9E40++? */ + particle->shapePtr = NULL; + particle->unkB0 = 1; + return particle; } /* 230DCC -> 230F48 */ -struct Connection *func_801825FC(struct ObjVertex *vtx1, struct ObjVertex *vtx2) { - struct Connection *sp34 = gd_malloc_perm(44); +struct Connection *make_connection(struct ObjVertex *vtx1, struct ObjVertex *vtx2) { + struct Connection *conn = gd_malloc_perm(sizeof(struct Connection)); struct GdVec3f sp28; struct GdVec3f sp1C; - if (sp34 == NULL) { + if (conn == NULL) { fatal_print("Cant allocate connection memory!"); } - sp34->unk1C.vtx = vtx1; - sp34->unk20.vtx = vtx2; - push_dynobj_stash(); + conn->node1.vtx = vtx1; + conn->node2.vtx = vtx2; + d_stash_dynobj(); set_cur_dynobj((struct GdObj *)vtx1); d_get_world_pos(&sp28); set_cur_dynobj((struct GdObj *)vtx2); @@ -244,39 +242,39 @@ struct Connection *func_801825FC(struct ObjVertex *vtx1, struct ObjVertex *vtx2) sp28.x -= sp1C.x; sp28.y -= sp1C.y; sp28.z -= sp1C.z; - sp34->unk24 = gd_vec3f_magnitude(&sp28); + conn->unk24 = gd_vec3f_magnitude(&sp28); // Duplicate conditional. Possibly should've checked `vtx2`; // Also, this shouldn't be called with particle types... if (vtx1->header.type == OBJ_TYPE_PARTICLES && vtx1->header.type == OBJ_TYPE_PARTICLES) { - if ((((struct ObjParticle *) vtx1)->unk54 & 4) && (((struct ObjParticle *) vtx2)->unk54 & 4)) { - sp34->unk28 |= 1; + if ((((struct ObjParticle *) vtx1)->flags & 4) && (((struct ObjParticle *) vtx2)->flags & 4)) { + conn->unk28 |= 1; } } - pop_dynobj_stash(); - return sp34; + d_unstash_dynobj(); + return conn; } /* 230F48 -> 2311D8 */ int func_80182778(struct ObjParticle *ptc) { s32 sp4 = 0; - if (ptc->unk7C->unk20 == 2 && ptc->unk74 == 1) { + if (ptc->unk7C->animSeqNum == 2 && ptc->unk74 == 1) { while (D_801A81D4[sp4] != 0) { - if (D_801A81D4[sp4] == ptc->unk7C->unk28) { - ptc->unk20.x = D_801A81D4[sp4 + 1] * 10.0f; - ptc->unk20.y = D_801A81D4[sp4 + 2] * 10.0f; - ptc->unk20.z = D_801A81D4[sp4 + 3] * 10.0f; + if (D_801A81D4[sp4] == ptc->unk7C->frame) { + ptc->pos.x = D_801A81D4[sp4 + 1] * 10.0f; + ptc->pos.y = D_801A81D4[sp4 + 2] * 10.0f; + ptc->pos.z = D_801A81D4[sp4 + 3] * 10.0f; return TRUE; } sp4 += 4; } } - if (ptc->unk7C->unk20 == 1 && ptc->unk74 == 1) { + if (ptc->unk7C->animSeqNum == 1 && ptc->unk74 == 1) { while (D_801A8238[sp4] != 0) { - if (D_801A8238[sp4] == ptc->unk7C->unk28) { - ptc->unk20.x = D_801A8238[sp4 + 1] * 10.0f; - ptc->unk20.y = D_801A8238[sp4 + 2] * 10.0f; - ptc->unk20.z = D_801A8238[sp4 + 3] * 10.0f; + if (D_801A8238[sp4] == ptc->unk7C->frame) { + ptc->pos.x = D_801A8238[sp4 + 1] * 10.0f; + ptc->pos.y = D_801A8238[sp4 + 2] * 10.0f; + ptc->pos.z = D_801A8238[sp4 + 3] * 10.0f; return TRUE; } sp4 += 4; @@ -287,29 +285,29 @@ int func_80182778(struct ObjParticle *ptc) { /* 2311D8 -> 231454 */ void func_80182A08(struct ObjParticle *ptc, struct GdVec3f *b) { - register struct Links *link; + register struct ListNode *link; struct ObjParticle *sp20; - if (ptc->unk6C != NULL) { - link = ptc->unk6C->link1C; + if (ptc->subParticlesGrp != NULL) { + link = ptc->subParticlesGrp->firstMember; while (link != NULL) { // FIXME: types sp20 = (struct ObjParticle *) link->obj; - if (sp20->unk5C <= 0) { - sp20->unk20.x = ptc->unk20.x; - sp20->unk20.y = ptc->unk20.y; - sp20->unk20.z = ptc->unk20.z; - sp20->unk5C = 12.0f - func_8018D560() * 5.0f; + if (sp20->timeout <= 0) { + sp20->pos.x = ptc->pos.x; + sp20->pos.y = ptc->pos.y; + sp20->pos.z = ptc->pos.z; + sp20->timeout = 12.0f - gd_rand_float() * 5.0f; do { - sp20->unk38.x = func_8018D560() * 50.0 - 25.0; - sp20->unk38.y = func_8018D560() * 50.0 - 25.0; - sp20->unk38.z = func_8018D560() * 50.0 - 25.0; + sp20->unk38.x = gd_rand_float() * 50.0 - 25.0; + sp20->unk38.y = gd_rand_float() * 50.0 - 25.0; + sp20->unk38.z = gd_rand_float() * 50.0 - 25.0; } while (gd_vec3f_magnitude(&sp20->unk38) > 30.0); sp20->unk38.x += b->x; sp20->unk38.y += b->y; sp20->unk38.z += b->z; - sp20->header.drawFlags &= ~OBJ_NOT_DRAWABLE; - sp20->unk54 |= 8; + sp20->header.drawFlags &= ~OBJ_INVISIBLE; + sp20->flags |= 8; } link = link->next; } @@ -323,17 +321,17 @@ void move_particle(struct ObjParticle *ptc) { struct GdVec3f sp64; struct ObjParticle *sp60; UNUSED u8 unused1[4]; - s32 sp58; + s32 i; UNUSED u8 unused4[4]; UNUSED u8 unused5[4]; struct ObjCamera *sp4C; struct GdVec3f sp40; struct GdVec3f sp34; - if (ptc->unk54 & 2) { + if (ptc->flags & 2) { return; } - if (!(ptc->unk54 & 8)) { + if (!(ptc->flags & 8)) { return; } if (ptc->unk60 == 3) { @@ -344,63 +342,64 @@ void move_particle(struct ObjParticle *ptc) { sp34.y = gViewUpdateCamera->unkE8[2][1] * -20.0f; sp34.z = gViewUpdateCamera->unkE8[2][2] * -20.0f; } - if (ptc->unkBC != NULL) { - set_cur_dynobj(ptc->unkBC); + if (ptc->attachedToObj != NULL) { + set_cur_dynobj(ptc->attachedToObj); if (ptc->unk60 == 3) { if (ptc->unk64 == 3) { - sp4C = (struct ObjCamera *) ptc->unkBC; + sp4C = (struct ObjCamera *) ptc->attachedToObj; // Camera->unk18C = ObjView here if (sp4C->unk18C->pickedObj != NULL) { set_cur_dynobj(sp4C->unk18C->pickedObj); - ptc->unk54 |= 0x20; + ptc->flags |= 0x20; ; // needed to match } else { - ptc->unk54 &= ~0x10; - ptc->unk54 &= ~0x20; + ptc->flags &= ~0x10; + ptc->flags &= ~0x20; } } } d_get_world_pos(&sp64); - ptc->unk20.x = sp64.x; - ptc->unk20.y = sp64.y; - ptc->unk20.z = sp64.z; + ptc->pos.x = sp64.x; + ptc->pos.y = sp64.y; + ptc->pos.z = sp64.z; } sp7C = -0.4f; - ptc->unk20.x += ptc->unk38.x; - ptc->unk20.y += ptc->unk38.y; - ptc->unk20.z += ptc->unk38.z; - if (ptc->unk54 & 1) { + ptc->pos.x += ptc->unk38.x; + ptc->pos.y += ptc->unk38.y; + ptc->pos.z += ptc->unk38.z; + if (ptc->flags & 1) { ptc->unk38.y += sp7C; } func_801838D0(ptc); - if (ptc->unkB0 == 1) { - if (0) { - } - ptc->unkB0 = 2; - if (ptc->unk60 == 3) { - switch (ptc->unk64) { - case 1: - ptc->unk6C = make_group(0); - for (sp58 = 0; sp58 < 50; sp58++) { - sp60 = make_particle(1, -1, ptc->unk20.x, ptc->unk20.y, ptc->unk20.z); - sp60->unk1C = ptc->unk1C; - addto_group(ptc->unk6C, &sp60->header); - sp60->unk54 &= ~8; - } - break; - case 2: - case 3: - ptc->unk6C = make_group(0); - for (sp58 = 0; sp58 < 30; sp58++) { - sp60 = make_particle(1, -1, ptc->unk20.x, ptc->unk20.y, ptc->unk20.z); - sp60->unk1C = (void *) ptc->unk1C; - addto_group(ptc->unk6C, &sp60->header); - sp60->unk54 &= ~8; - } - break; + switch (ptc->unkB0) { + case 1: + ptc->unkB0 = 2; + if (ptc->unk60 == 3) { + switch (ptc->unk64) { + case 1: + ptc->subParticlesGrp = make_group(0); + for (i = 0; i < 50; i++) { + sp60 = make_particle(1, -1, ptc->pos.x, ptc->pos.y, ptc->pos.z); + sp60->shapePtr = ptc->shapePtr; + addto_group(ptc->subParticlesGrp, &sp60->header); + sp60->flags &= ~8; + } + break; + case 2: + case 3: + ptc->subParticlesGrp = make_group(0); + for (i = 0; i < 30; i++) { + sp60 = make_particle(1, -1, ptc->pos.x, ptc->pos.y, ptc->pos.z); + sp60->shapePtr = ptc->shapePtr; + addto_group(ptc->subParticlesGrp, &sp60->header); + sp60->flags &= ~8; + } + break; + } } - } - } else if (0) { + break; + default: + break; } ptc->unk38.x *= 0.9; ptc->unk38.y *= 0.9; @@ -408,51 +407,51 @@ void move_particle(struct ObjParticle *ptc) { if (ptc->unk60 == 3) { switch (ptc->unk64) { case 1: - if (func_80182778(ptc) && ptc->unk6C != NULL) { - register struct Links *link; + if (func_80182778(ptc) && ptc->subParticlesGrp != NULL) { + register struct ListNode *link; if (ptc->unk80 != NULL) { ptc->unk80->unk3C |= 1; - ptc->unk80->position.x = ptc->unk20.x; - ptc->unk80->position.y = ptc->unk20.y; - ptc->unk80->position.z = ptc->unk20.z; + ptc->unk80->position.x = ptc->pos.x; + ptc->unk80->position.y = ptc->pos.y; + ptc->unk80->position.z = ptc->pos.z; } - link = ptc->unk6C->link1C; + link = ptc->subParticlesGrp->firstMember; while (link != NULL) { struct ObjParticle *sp2C = (struct ObjParticle *) link->obj; - sp2C->unk20.x = ptc->unk20.x; - sp2C->unk20.y = ptc->unk20.y; - sp2C->unk20.z = ptc->unk20.z; - sp2C->unk5C = 20; + sp2C->pos.x = ptc->pos.x; + sp2C->pos.y = ptc->pos.y; + sp2C->pos.z = ptc->pos.z; + sp2C->timeout = 20; do { - sp2C->unk38.x = func_8018D560() * 64.0 - 32.0; - sp2C->unk38.y = func_8018D560() * 64.0 - 32.0; - sp2C->unk38.z = func_8018D560() * 64.0 - 32.0; + sp2C->unk38.x = gd_rand_float() * 64.0 - 32.0; + sp2C->unk38.y = gd_rand_float() * 64.0 - 32.0; + sp2C->unk38.z = gd_rand_float() * 64.0 - 32.0; } while (gd_vec3f_magnitude(&sp2C->unk38) > 32.0); - sp2C->unk30 = func_8018D560() * 180.0f; - sp2C->header.drawFlags &= ~OBJ_NOT_DRAWABLE; - sp2C->unk54 |= 8; + sp2C->unk30 = gd_rand_float() * 180.0f; + sp2C->header.drawFlags &= ~OBJ_INVISIBLE; + sp2C->flags |= 8; link = link->next; } } break; case 3: - if ((ptc->unk54 & 0x20) && !(ptc->unk54 & 0x10)) { + if ((ptc->flags & 0x20) && !(ptc->flags & 0x10)) { func_80182A08(ptc, &sp40); - ptc->unk54 |= 0x10; + ptc->flags |= 0x10; } break; case 2: func_80182A08(ptc, &sp34); break; } - apply_to_obj_types_in_group(OBJ_TYPE_PARTICLES, (applyproc_t) move_particle, ptc->unk6C); + apply_to_obj_types_in_group(OBJ_TYPE_PARTICLES, (applyproc_t) move_particle, ptc->subParticlesGrp); } - if (ptc->unk5C >= 0) { - if (ptc->unk5C-- <= 0) { - ptc->header.drawFlags |= OBJ_NOT_DRAWABLE; - ptc->unk54 &= ~8; + if (ptc->timeout >= 0) { + if (ptc->timeout-- <= 0) { + ptc->header.drawFlags |= OBJ_INVISIBLE; + ptc->flags &= ~8; } } } @@ -470,46 +469,58 @@ void move_particles_in_grp(struct ObjGroup *group) { void Unknown801835C8(struct ObjParticle *ptc) { struct GdVec3f sp54; f32 sp50; - register struct Links *link; + register struct ListNode *link; - gd_printf("p(%d)=", ptc->unkB4->objCount); - link = ptc->unkB4->link1C; + gd_printf("p(%d)=", ptc->attachedObjsGrp->memberCount); + link = ptc->attachedObjsGrp->firstMember; while (link != NULL) { // FIXME: types struct ObjParticle *sp48 = (struct ObjParticle *) link->obj; - sp54.x = sp48->unk20.x - ptc->unk20.x; - sp54.y = sp48->unk20.y - ptc->unk20.y; - sp54.z = sp48->unk20.z - ptc->unk20.z; + sp54.x = sp48->pos.x - ptc->pos.x; + sp54.y = sp48->pos.y - ptc->pos.y; + sp54.z = sp48->pos.z - ptc->pos.z; sp50 = 150.0f - (ABS(sp54.x) + ABS(sp54.y) + ABS(sp54.z)); gd_printf(",%f ", sp50); sp50 *= 0.00000005; - ptc->unk20.x += sp50 * sp54.x; - ptc->unk20.y += sp50 * sp54.y; - ptc->unk20.z += sp50 * sp54.z; - sp48->unk20.x -= sp50 * sp54.x; - sp48->unk20.y -= sp50 * sp54.y; - sp48->unk20.z -= sp50 * sp54.z; + ptc->pos.x += sp50 * sp54.x; + ptc->pos.y += sp50 * sp54.y; + ptc->pos.z += sp50 * sp54.z; + sp48->pos.x -= sp50 * sp54.x; + sp48->pos.y -= sp50 * sp54.y; + sp48->pos.z -= sp50 * sp54.z; link = link->next; } gd_printf("\n"); } -void Unknown80183870(UNUSED s32 a) { +/** + * Unused + */ +void stub_particles_1(UNUSED s32 a) { } -void Unknown80183884(UNUSED s32 a) { +/** + * Unused + */ +void stub_particles_2(UNUSED s32 a) { } -void Unknown80183898(UNUSED s32 a, UNUSED s32 b, UNUSED s32 c) { +/** + * Unused + */ +void stub_particles_3(UNUSED s32 a, UNUSED s32 b, UNUSED s32 c) { } -void Unknown801838B4(UNUSED s32 a, UNUSED s32 b, UNUSED s32 c) { +/** + * Unused + */ +void stub_particles_4(UNUSED s32 a, UNUSED s32 b, UNUSED s32 c) { } /* 2320A0 -> 2320D4; pad to 2320E0 */ void func_801838D0(struct ObjParticle *ptc) { D_801B9E3C = ptc; - if (ptc->unk20.y < -15.0f) { + if (ptc->pos.y < -15.0f) { } } diff --git a/src/goddard/renderer.c b/src/goddard/renderer.c index 13fd77f1..a82f5c07 100644 --- a/src/goddard/renderer.c +++ b/src/goddard/renderer.c @@ -2,9 +2,10 @@ #include #include -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) #include "prevent_bss_reordering.h" #endif + #include "debug_utils.h" #include "draw_objects.h" #include "dynlist_proc.h" @@ -20,6 +21,7 @@ #include "sfx.h" #include "shape_helper.h" #include "skin.h" +#include "types.h" #include "config.h" #include "gfx_dimensions.h" @@ -53,7 +55,7 @@ struct GdDisplayList { /*0x24*/ s32 curGfxIdx; /*0x28*/ s32 totalGfx; /*0x2C*/ Gfx *gfx; // active position in DL - /*0x30*/ Gfx **dlptr; // pointer to list/array of display lists? + /*0x30*/ Gfx **dlptr; // pointer to list/array of display lists for each frame? /* Viewports */ /*0x34*/ s32 curVpIdx; /*0x38*/ s32 totalVp; @@ -65,12 +67,11 @@ struct GdDisplayList { /*0x4C*/ struct GdDisplayList *parent; // not quite sure? }; /* sizeof = 0x50 */ // accessor macros for gd dl -#define DL_CURRENT_VTX(dl) ((dl)->vtx[(dl)->curVtxIdx]) -#define DL_CURRENT_MTX(dl) ((dl)->mtx[(dl)->curMtxIdx]) +#define DL_CURRENT_VTX(dl) ((dl)->vtx[(dl)->curVtxIdx]) +#define DL_CURRENT_MTX(dl) ((dl)->mtx[(dl)->curMtxIdx]) #define DL_CURRENT_LIGHT(dl) ((dl)->light[(dl)->curLightIdx]) -#define DL_LIGHT_IDX(dl, idx) ((dl)->unk20[(idx)]) -#define DL_CURRENT_GFX(dl) ((dl)->gfx[(dl)->curGfxIdx]) -#define DL_CURRENT_VP(dl) ((dl)->vp[(dl)->curVpIdx]) +#define DL_CURRENT_GFX(dl) ((dl)->gfx[(dl)->curGfxIdx]) +#define DL_CURRENT_VP(dl) ((dl)->vp[(dl)->curVpIdx]) struct LightDirVec { s32 x, y, z; @@ -84,7 +85,7 @@ struct DynListBankInfo { }; // bss -#ifdef VERSION_EU +#if defined(VERSION_EU) || defined(VERSION_SH) static OSMesgQueue D_801BE830; // controller msg queue static OSMesg D_801BE848[10]; u8 EUpad1[0x40]; @@ -96,52 +97,51 @@ static OSMesgQueue sGdDMAQueue; // @ 801BE8C8 u8 EUpad2[0x64]; static OSMesg sGdMesgBuf[1]; // @ 801BE944 u8 EUpad3[0x34]; -static OSMesg D_801BE97C; // msg buf for D_801BE8B0 queue -static OSIoMesg D_801BE980; +static OSMesg sGdDMACompleteMsg; // msg buf for D_801BE8B0 queue +static OSIoMesg sGdDMAReqMesg; static struct ObjView *D_801BE994; // store if View flag 0x40 set u8 EUpad4[0x88]; #endif - static OSContStatus D_801BAE60[4]; static OSContPad sGdContPads[4]; // @ 801BAE70 static OSContPad sPrevFrameCont[4]; // @ 801BAE88 static u8 D_801BAEA0; static struct ObjGadget *sTimerGadgets[GD_NUM_TIMERS]; // @ 801BAEA8 static u32 D_801BAF28; // RAM addr offset? -static s16 D_801BAF30[13][8]; // [[s16; 8]; 13]? vert indices? +static s16 sTriangleBuf[13][8]; // [[s16; 8]; 13]? vert indices? static u32 unref_801bb000[3]; static u8 *sMemBlockPoolBase; // @ 801BB00C static u32 sAllocMemory; // @ 801BB010; malloc-ed bytes static u32 unref_801bb014; static s32 D_801BB018; static s32 D_801BB01C; -static void *D_801BB020[0x10]; // texture pointers -static s32 D_801BB060[0x10]; // gd_dl indices +static void *sLoadedTextures[0x10]; // texture pointers +static s32 sTextureDisplayLists[0x10]; // gd_dl indices static s16 sVtxCvrtTCBuf[2]; // @ 801BB0A0 static s32 sCarGdDlNum; // @ 801BB0A4 static struct ObjGroup *sYoshiSceneGrp; // @ 801BB0A8 -static s32 D_801BB0AC; // unused DL number +static s32 unusedDl801BB0AC; // unused DL number static struct ObjGroup *sMarioSceneGrp; // @ 801BB0B0 -static s32 D_801BB0B4; // second offset into D_801BAF30 +static s32 D_801BB0B4; // second offset into sTriangleBuf static struct ObjGroup *sCarSceneGrp; // @ 801BB0B8 -static s32 D_801BB0BC; // vtx's to load into RPD? Vtx len in GD Dl and in the lower bank (AF30) +static s32 sVertexBufCount; // vtx's to load into RPD? Vtx len in GD Dl and in the lower bank (AF30) static struct ObjView *sYoshiSceneView; // @ 801BB0C0 -static s32 D_801BB0C4; // first offset into D_801BAF30 +static s32 sTriangleBufCount; // number of triangles in sTriangleBuf static struct ObjView *sMSceneView; // @ 801BB0C8; Mario scene view -static s32 D_801BB0CC; // Vtx start in GD Dl +static s32 sVertexBufStartIndex; // Vtx start in GD Dl static struct ObjView *sCarSceneView; // @ 801BB0D0 static s32 sUpdateYoshiScene; // @ 801BB0D4; update dl Vtx from ObjVertex? static s32 sUpdateMarioScene; // @ 801BB0D8; update dl Vtx from ObjVertex? static u32 unref_801bb0dc; static s32 sUpdateCarScene; // @ 801BB0E0; guess, not really used static u32 unref_801bb0e4; -static struct GdVec3f D_801BB0E8; +static struct GdVec3f sTextDrawPos; // position to draw text? only set in one function, never used static u32 unref_801bb0f8[2]; static Mtx sIdnMtx; // @ 801BB100 static Mat4f sInitIdnMat4; // @ 801BB140 static s8 sVtxCvrtNormBuf[3]; // @ 801BB180 -static s16 D_801BB184; +static s16 sAlpha; static s32 sNumLights; static struct GdColour sAmbScaleColour; // @ 801BB190 static struct GdColour sLightScaleColours[2]; // @ 801BB1A0 @@ -152,20 +152,19 @@ static struct GdVec3f D_801BD758; static struct GdVec3f D_801BD768; // had to migrate earlier static u32 D_801BD774; static struct GdObj *sMenuGadgets[9]; // @ 801BD778; d_obj ptr storage? menu? -static struct ObjView *D_801BD7A0[2]; +static struct ObjView *sDebugViews[2]; // Seems to be a list of ObjViews for displaying debug info static struct GdDisplayList *sStaticDl; // @ 801BD7A8 -static struct GdDisplayList *sDynDlSet1[2]; // @ 801BD7B0 +static struct GdDisplayList *sDynamicMainDls[2]; // @ 801BD7B0 static struct GdDisplayList *sGdDlStash; // @ 801BD7B8 -static struct GdDisplayList - *sMHeadMainDls[2]; // @ 801BD7C0; seem to be basic dls that branch to actual lists? -static struct GdDisplayList *D_801BD7C8[3][2]; // I guess? 801BD7C8 -> 801BD7E0? +static struct GdDisplayList *sMHeadMainDls[2]; // @ 801BD7C0; two DLs, double buffered one per frame - seem to be basic dls that branch to actual lists? +static struct GdDisplayList *sViewDls[3][2]; // I guess? 801BD7C8 -> 801BD7E0? static struct GdDisplayList *sGdDLArray[MAX_GD_DLS]; // @ 801BD7E0; indexed by dl number (gddl+0x44) static s32 sPickBufLen; // @ 801BE780 static s32 sPickBufPosition; // @ 801BE784 static s16 *sPickBuf; // @ 801BE788 static LookAt D_801BE790[2]; static LookAt D_801BE7D0[3]; -#ifndef VERSION_EU +#if defined(VERSION_JP) || defined(VERSION_US) static OSMesgQueue D_801BE830; // controller msg queue static OSMesg D_801BE848[10]; static u32 unref_801be870[16]; @@ -174,8 +173,8 @@ static OSMesgQueue sGdDMAQueue; // @ 801BE8C8 static u32 unref_801be8e0[25]; static OSMesg sGdMesgBuf[1]; // @ 801BE944 static u32 unref_801be948[13]; -static OSMesg D_801BE97C; // msg buf for D_801BE8B0 queue -static OSIoMesg D_801BE980; +static OSMesg sGdDMACompleteMsg; // msg buf for D_801BE8B0 queue +static OSIoMesg sGdDMAReqMesg; static struct ObjView *D_801BE994; // store if View flag 0x40 set #endif @@ -192,11 +191,11 @@ static f32 sRCPTime = 0.0f; // @ 801A8690 static f32 sTimeScaleFactor = 1.0f; // @ D_801A8694 static u32 sMemBlockPoolSize = 1; // @ 801A8698 static s32 sMemBlockPoolUsed = 0; // @ 801A869C -static s32 D_801A86A0 = 0; +static s32 sTextureCount = 0; // maybe? static struct GdTimer *D_801A86A4 = NULL; // timer for dlgen, dynamics, or rcp static struct GdTimer *D_801A86A8 = NULL; // timer for dlgen, dynamics, or rcp static struct GdTimer *D_801A86AC = NULL; // timer for dlgen, dynamics, or rcp -s32 gGdFrameBuf = 0; // @ 801A86B0 +s32 gGdFrameBufNum = 0; // @ 801A86B0 static u32 unref_801a86B4 = 0; static struct ObjShape *sHandShape = NULL; // @ 801A86B8 static s32 D_801A86BC = 1; @@ -205,19 +204,19 @@ static u32 unref_801a86C4 = 10; static s32 sMtxParamType = G_MTX_PROJECTION; static struct GdVec3f D_801A86CC = { 1.0f, 1.0f, 1.0f }; static struct ObjView *sActiveView = NULL; // @ 801A86D8 current view? used when drawing dl -static struct ObjView *sScreenView2 = NULL; // @ 801A86DC +static struct ObjView *sScreenView = NULL; // @ 801A86DC static struct ObjView *D_801A86E0 = NULL; static struct ObjView *sHandView = NULL; // @ 801A86E4 static struct ObjView *sMenuView = NULL; // @ 801A86E8 static u32 sItemsInMenu = 0; // @ 801A86EC -static s32 D_801A86F0 = 0; // frame buffer idx into D_801BD7A0? -static s32 sNewZPresses = 0; // @ 801A86F4; timing activate cool down counter? +static s32 sDebugViewsCount = 0; // number of elements in the sDebugViews array +static s32 sCurrDebugViewIndex = 0; // @ 801A86F4; timing activate cool down counter? static u32 unref_801a86F8 = 0; static struct GdDisplayList *sCurrentGdDl = NULL; // @ 801A86FC static u32 sGdDlCount = 0; // @ 801A8700 static struct DynListBankInfo sDynLists[] = { // @ 801A8704 { STD_LIST_BANK, dynlist_test_cube }, - { STD_LIST_BANK, dynlist_unused }, + { STD_LIST_BANK, dynlist_spot_shape }, { STD_LIST_BANK, dynlist_mario_master }, { TABLE_END, NULL } }; @@ -227,7 +226,7 @@ static Gfx gd_texture1_dummy_aligner1[] = { // @ 801A8728 gsSPEndDisplayList(), }; -ALIGNED8 u8 gd_texture_hand_open[] = { +ALIGNED8 Texture gd_texture_hand_open[] = { #include "textures/intro_raw/hand_open.rgba16.inc.c" }; @@ -235,71 +234,71 @@ static Gfx gd_texture2_dummy_aligner1[] = { gsSPEndDisplayList() }; -ALIGNED8 u8 gd_texture_hand_closed[] = { +ALIGNED8 Texture gd_texture_hand_closed[] = { #include "textures/intro_raw/hand_closed.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_red_star_0[] = { +ALIGNED8 static Texture gd_texture_red_star_0[] = { #include "textures/intro_raw/red_star_0.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_red_star_1[] = { +ALIGNED8 static Texture gd_texture_red_star_1[] = { #include "textures/intro_raw/red_star_1.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_red_star_2[] = { +ALIGNED8 static Texture gd_texture_red_star_2[] = { #include "textures/intro_raw/red_star_2.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_red_star_3[] = { +ALIGNED8 static Texture gd_texture_red_star_3[] = { #include "textures/intro_raw/red_star_3.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_red_star_4[] = { +ALIGNED8 static Texture gd_texture_red_star_4[] = { #include "textures/intro_raw/red_star_4.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_red_star_5[] = { +ALIGNED8 static Texture gd_texture_red_star_5[] = { #include "textures/intro_raw/red_star_5.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_red_star_6[] = { +ALIGNED8 static Texture gd_texture_red_star_6[] = { #include "textures/intro_raw/red_star_6.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_red_star_7[] = { +ALIGNED8 static Texture gd_texture_red_star_7[] = { #include "textures/intro_raw/red_star_7.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_white_star_0[] = { +ALIGNED8 static Texture gd_texture_white_star_0[] = { #include "textures/intro_raw/white_star_0.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_white_star_1[] = { +ALIGNED8 static Texture gd_texture_white_star_1[] = { #include "textures/intro_raw/white_star_1.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_white_star_2[] = { +ALIGNED8 static Texture gd_texture_white_star_2[] = { #include "textures/intro_raw/white_star_2.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_white_star_3[] = { +ALIGNED8 static Texture gd_texture_white_star_3[] = { #include "textures/intro_raw/white_star_3.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_white_star_4[] = { +ALIGNED8 static Texture gd_texture_white_star_4[] = { #include "textures/intro_raw/white_star_4.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_white_star_5[] = { +ALIGNED8 static Texture gd_texture_white_star_5[] = { #include "textures/intro_raw/white_star_5.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_white_star_6[] = { +ALIGNED8 static Texture gd_texture_white_star_6[] = { #include "textures/intro_raw/white_star_6.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_white_star_7[] = { +ALIGNED8 static Texture gd_texture_white_star_7[] = { #include "textures/intro_raw/white_star_7.rgba16.inc.c" }; @@ -318,7 +317,7 @@ UNUSED static Vtx_t gd_unused_vertex[] = { {{ 0, 0, 0}, 0, {0, 0}, {0x00, 0x00, 0x00}}, }; -static Gfx gd_dl_star[] = { +static Gfx gd_dl_star_common[] = { gsDPSetCombineMode(G_CC_DECALRGBA, G_CC_DECALRGBA), gsSPClearGeometryMode(G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR), gsDPSetRenderMode(G_RM_AA_ZB_TEX_EDGE, G_RM_NOOP2), @@ -339,97 +338,97 @@ static Gfx gd_dl_star[] = { static Gfx gd_dl_red_star_0[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_red_star_0), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_red_star_1[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_red_star_1), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_red_star_2[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_red_star_2), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_red_star_3[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_red_star_3), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_red_star_4[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_red_star_4), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_red_star_5[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_red_star_5), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_red_star_6[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_red_star_6), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_red_star_7[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_red_star_7), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_silver_star_0[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_white_star_0), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_silver_star_1[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_white_star_1), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_silver_star_2[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_white_star_2), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_silver_star_3[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_white_star_3), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_silver_star_4[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_white_star_4), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_silver_star_5[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_white_star_5), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_silver_star_6[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_white_star_6), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx gd_dl_silver_star_7[] = { gsDPPipeSync(), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gd_texture_white_star_7), - gsSPBranchList(gd_dl_star), + gsSPBranchList(gd_dl_star_common), }; static Gfx *gd_red_star_dl_array[] = { @@ -470,30 +469,30 @@ static Gfx *gd_silver_star_dl_array[] = { gd_dl_silver_star_7, }; -ALIGNED8 static u8 gd_texture_sparkle_0[] = { +ALIGNED8 static Texture gd_texture_sparkle_0[] = { #include "textures/intro_raw/sparkle_0.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_sparkle_1[] = { +ALIGNED8 static Texture gd_texture_sparkle_1[] = { #include "textures/intro_raw/sparkle_1.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_sparkle_2[] = { +ALIGNED8 static Texture gd_texture_sparkle_2[] = { #include "textures/intro_raw/sparkle_2.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_sparkle_3[] = { +ALIGNED8 static Texture gd_texture_sparkle_3[] = { #include "textures/intro_raw/sparkle_3.rgba16.inc.c" }; -ALIGNED8 static u8 gd_texture_sparkle_4[] = { +ALIGNED8 static Texture gd_texture_sparkle_4[] = { #include "textures/intro_raw/sparkle_4.rgba16.inc.c" }; //! No reference to this texture. Two DL's uses the same previous texture // instead of using this texture. // Fixed via setting TEXTURE_FIX to 1. -ALIGNED8 static u8 gd_texture_sparkle_5[] = { +ALIGNED8 static Texture gd_texture_sparkle_5[] = { #include "textures/intro_raw/sparkle_5.rgba16.inc.c" }; @@ -682,7 +681,7 @@ static Gfx gd_texture3_dummy_aligner1[] = { gsSPEndDisplayList(), }; -ALIGNED8 static u8 gd_texture_mario_face_shine[] = { +ALIGNED8 static Texture gd_texture_mario_face_shine[] = { #include "textures/intro_raw/mario_face_shine.ia8.inc.c" }; @@ -782,7 +781,7 @@ void gd_setup_cursor(struct ObjGroup *); void parse_p1_controller(void); void update_cursor(void); void update_view_and_dl(struct ObjView *); -void func_801A1A00(void); +static void update_render_mode(void); void gddl_is_loading_shine_dl(s32); void func_801A3370(f32, f32, f32); void gd_put_sprite(u16 *, s32, s32, s32, s32); @@ -794,6 +793,9 @@ u32 get_alloc_mem_amt(void) { return sAllocMemory; } +/** + * Returns the current time + */ s32 gd_get_ostime(void) { return osGetTime(); } @@ -810,7 +812,10 @@ void dump_disp_list(void) { sCurrentGdDl->totalGfx); } -Gfx *next_gfx(void) { +/** + * Increments the current display list's Gfx index list and returns a pointer to the next Gfx element + */ +static Gfx *next_gfx(void) { if (sCurrentGdDl->curGfxIdx >= sCurrentGdDl->totalGfx) { dump_disp_list(); fatal_printf("Gfx list overflow"); @@ -819,7 +824,10 @@ Gfx *next_gfx(void) { return &sCurrentGdDl->gfx[sCurrentGdDl->curGfxIdx++]; } -Lights4 *next_light(void) { +/** + * Increments the current display list's Light index list and returns a pointer to the next Light element + */ +static Lights4 *next_light(void) { if (sCurrentGdDl->curLightIdx >= sCurrentGdDl->totalLights) { dump_disp_list(); fatal_printf("Light list overflow"); @@ -828,7 +836,10 @@ Lights4 *next_light(void) { return &sCurrentGdDl->light[sCurrentGdDl->curLightIdx++]; } -Mtx *next_mtx(void) { +/** + * Increments the current display list's matrix index list and returns a pointer to the next matrix element + */ +static Mtx *next_mtx(void) { if (sCurrentGdDl->curMtxIdx >= sCurrentGdDl->totalMtx) { dump_disp_list(); fatal_printf("Mtx list overflow"); @@ -837,7 +848,10 @@ Mtx *next_mtx(void) { return &sCurrentGdDl->mtx[sCurrentGdDl->curMtxIdx++]; } -Vtx *next_vtx(void) { +/** + * Increments the current display list's vertex index list and returns a pointer to the next vertex element + */ +static Vtx *next_vtx(void) { if (sCurrentGdDl->curVtxIdx >= sCurrentGdDl->totalVtx) { dump_disp_list(); fatal_printf("Vtx list overflow"); @@ -846,8 +860,10 @@ Vtx *next_vtx(void) { return &sCurrentGdDl->vtx[sCurrentGdDl->curVtxIdx++]; } -/* 249A20 -> 249AAC */ -Vp *next_vp(void) { +/** + * Increments the current display list's viewport list and returns a pointer to the next viewport element + */ +static Vp *next_vp(void) { if (sCurrentGdDl->curVpIdx >= sCurrentGdDl->totalVp) { dump_disp_list(); fatal_printf("Vp list overflow"); @@ -874,24 +890,26 @@ f64 gd_sqrt_d(f64 x) { return sqrtf(x); } -/* 249BA4 -> 249BCC */ -f64 Unknown8019B3D4(UNUSED f64 x) { +/** + * Unused + */ +f64 stub_renderer_1(UNUSED f64 x) { return 0.0; } /* 249BCC -> 24A19C */ void gd_printf(const char *format, ...) { - s32 i; // 15c + s32 i; UNUSED u32 pad158; - char c; // 157 - char f; // 156 + char c; + char f; UNUSED u32 pad150; - char buf[0x100]; // 50 - char *csr = buf; // 4c - char spec[8] = { 0 }; // 44; goddard specifier string + char buf[0x100]; + char *csr = buf; + char spec[8] = { 0 }; // specifier string UNUSED u32 pad40; - union PrintVal val; // 38; - va_list args; // 34 + union PrintVal val; + va_list args; *csr = '\0'; va_start(args, format); @@ -1049,58 +1067,62 @@ void *Unknown8019BCD4(u32 size) { } /* 24A4DC -> 24A598 */ -void func_8019BD0C(s32 dlNum, s32 gfxIdx) { - Gfx *dl; // 1c +void draw_indexed_dl(s32 dlNum, s32 gfxIdx) { + Gfx *dl; if (gfxIdx != 0) { - dl = sGdDLArray[dlNum]->dlptr[gfxIdx - 1]; + dl = sGdDLArray[dlNum]->dlptr[gfxIdx - 1]; // multiple display lists (determined by frame) } else { - dl = sGdDLArray[dlNum]->gfx; + dl = sGdDLArray[dlNum]->gfx; // only one display list } gSPDisplayList(next_gfx(), GD_VIRTUAL_TO_PHYSICAL(dl)); } /* 24A598 -> 24A610; orig name: func_8019BDC8 */ void branch_cur_dl_to_num(s32 dlNum) { - Gfx *dl; // 24 + Gfx *dl; UNUSED u32 pad[2]; dl = sGdDLArray[dlNum]->gfx; gSPDisplayList(next_gfx(), GD_VIRTUAL_TO_PHYSICAL(dl)); } -/* 24A610 -> 24A640 */ -Gfx *Unknown8019BE40(s32 num) { +/** + * Unused (not called) + */ +Gfx *get_dl_gfx(s32 num) { return sGdDLArray[num]->gfx; } -/* 24A640 -> 24A8D0; orig name: func_8019BE70 */ +/** + * Creates `ObjShape`s for the stars and sparkles + */ void setup_stars(void) { gShapeRedStar = make_shape(0, "redstar"); - gShapeRedStar->gdDls[0] = new_gddl_from(NULL, 0); - gShapeRedStar->gdDls[1] = gShapeRedStar->gdDls[0]; - sGdDLArray[gShapeRedStar->gdDls[0]]->dlptr = gd_red_star_dl_array; - sGdDLArray[gShapeRedStar->gdDls[1]]->dlptr = gd_red_star_dl_array; + gShapeRedStar->dlNums[0] = new_gddl_from(NULL, 0); + gShapeRedStar->dlNums[1] = gShapeRedStar->dlNums[0]; + sGdDLArray[gShapeRedStar->dlNums[0]]->dlptr = gd_red_star_dl_array; + sGdDLArray[gShapeRedStar->dlNums[1]]->dlptr = gd_red_star_dl_array; gShapeSilverStar = make_shape(0, "silverstar"); - gShapeSilverStar->gdDls[0] = new_gddl_from(NULL, 0); - gShapeSilverStar->gdDls[1] = gShapeSilverStar->gdDls[0]; - sGdDLArray[gShapeSilverStar->gdDls[0]]->dlptr = gd_silver_star_dl_array; - sGdDLArray[gShapeSilverStar->gdDls[1]]->dlptr = gd_silver_star_dl_array; + gShapeSilverStar->dlNums[0] = new_gddl_from(NULL, 0); + gShapeSilverStar->dlNums[1] = gShapeSilverStar->dlNums[0]; + sGdDLArray[gShapeSilverStar->dlNums[0]]->dlptr = gd_silver_star_dl_array; + sGdDLArray[gShapeSilverStar->dlNums[1]]->dlptr = gd_silver_star_dl_array; // make_shape names of the dl array they call are misnamed (swapped) // "sspark" calls red sparkles and "rspark" calls silver sparkles gShapeRedSpark = make_shape(0, "sspark"); - gShapeRedSpark->gdDls[0] = new_gddl_from(NULL, 0); - gShapeRedSpark->gdDls[1] = gShapeRedSpark->gdDls[0]; - sGdDLArray[gShapeRedSpark->gdDls[0]]->dlptr = gd_red_sparkle_dl_array; - sGdDLArray[gShapeRedSpark->gdDls[1]]->dlptr = gd_red_sparkle_dl_array; + gShapeRedSpark->dlNums[0] = new_gddl_from(NULL, 0); + gShapeRedSpark->dlNums[1] = gShapeRedSpark->dlNums[0]; + sGdDLArray[gShapeRedSpark->dlNums[0]]->dlptr = gd_red_sparkle_dl_array; + sGdDLArray[gShapeRedSpark->dlNums[1]]->dlptr = gd_red_sparkle_dl_array; gShapeSilverSpark = make_shape(0, "rspark"); - gShapeSilverSpark->gdDls[0] = new_gddl_from(NULL, 0); - gShapeSilverSpark->gdDls[1] = gShapeSilverSpark->gdDls[0]; - sGdDLArray[gShapeSilverSpark->gdDls[0]]->dlptr = gd_silver_sparkle_dl_array; - sGdDLArray[gShapeSilverSpark->gdDls[1]]->dlptr = gd_silver_sparkle_dl_array; + gShapeSilverSpark->dlNums[0] = new_gddl_from(NULL, 0); + gShapeSilverSpark->dlNums[1] = gShapeSilverSpark->dlNums[0]; + sGdDLArray[gShapeSilverSpark->dlNums[0]]->dlptr = gd_silver_sparkle_dl_array; + sGdDLArray[gShapeSilverSpark->dlNums[1]]->dlptr = gd_silver_sparkle_dl_array; } /* 24A8D0 -> 24AA40 */ @@ -1160,7 +1182,7 @@ void gd_add_to_heap(void *addr, u32 size) { void gdm_init(void *blockpool, u32 size) { UNUSED u32 pad; - add_to_stacktrace("gdm_init"); + imin("gdm_init"); // Align downwards? size = (size - 8) & ~7; // Align to next double word boundry? @@ -1174,11 +1196,13 @@ void gdm_init(void *blockpool, u32 size) { imout(); } -/* 24AB7C -> 24AC18 */ +/** + * Initializes the Mario head demo + */ void gdm_setup(void) { UNUSED u32 pad; - add_to_stacktrace("gdm_setup"); + imin("gdm_setup"); sYoshiSceneGrp = NULL; sMarioSceneGrp = NULL; sUpdateYoshiScene = FALSE; @@ -1194,7 +1218,7 @@ void gdm_setup(void) { } /* 24AC18 -> 24AC2C */ -void Unknown8019C448(UNUSED u32 a0) { +void stub_renderer_2(UNUSED u32 a0) { } /* 24AC2C -> 24AC80; not called; orig name: Unknown8019C45C */ @@ -1208,13 +1232,10 @@ void print_gdm_stats(void) { /* 24AC80 -> 24AD14; orig name: func_8019C4B0 */ struct ObjView *make_view_withgrp(char *name, struct ObjGroup *grp) { - struct ObjView *view; // 2c - UNUSED struct ObjGroup *viewgrp; // 28 + struct ObjView *view = make_view(name, (VIEW_DRAW | VIEW_ALLOC_ZBUF | VIEW_MOVEMENT), 1, 0, 0, 320, 240, grp); + UNUSED struct ObjGroup *viewgrp = make_group(2, grp, view); - view = make_view(name, (VIEW_DRAW | VIEW_ALLOC_ZBUF | VIEW_MOVEMENT), 1, 0, 0, 320, 240, grp); - viewgrp = make_group(2, grp, view); view->lights = gGdLightGroup; - return view; } @@ -1222,7 +1243,7 @@ struct ObjView *make_view_withgrp(char *name, struct ObjGroup *grp) { void gdm_maketestdl(s32 id) { UNUSED u32 pad[3]; - add_to_stacktrace("gdm_maketestdl"); + imin("gdm_maketestdl"); switch (id) { case 0: sYoshiSceneView = make_view_withgrp("yoshi_scene", sYoshiSceneGrp); @@ -1269,9 +1290,11 @@ void Unknown8019C840(void) { print_all_timers(); } -/* 24AF04 -> 24AFC0; orig name: Proc8019C734 */ +/** + * Runs every frame at V-blank. Handles input and updates state. + */ void gd_vblank(void) { - gd_sfx_played(); + gd_sfx_update(); if (sUpdateYoshiScene) { apply_to_obj_types_in_group(OBJ_TYPE_NETS, (applyproc_t) convert_net_verts, sYoshiSceneGrp); } @@ -1280,20 +1303,22 @@ void gd_vblank(void) { } sUpdateYoshiScene = FALSE; sUpdateMarioScene = FALSE; - gGdFrameBuf ^= 1; + gGdFrameBufNum ^= 1; reset_cur_dl_indices(); parse_p1_controller(); update_cursor(); } -/* 24AFC0 -> 24B058; orig name: func_8019C7F0 */ +/** + * Copies the player1 controller data from p1cont to sGdContPads[0]. + */ void gd_copy_p1_contpad(OSContPad *p1cont) { u32 i; // 24 - u8 *contdata = (u8 *) p1cont; // 20 - u8 *gd_contdata = (u8 *) &sGdContPads[0]; // 1c + u8 *src = (u8 *) p1cont; // 20 + u8 *dest = (u8 *) &sGdContPads[0]; // 1c for (i = 0; i < sizeof(OSContPad); i++) { - gd_contdata[i] = contdata[i]; + dest[i] = src[i]; } if (p1cont->button & Z_TRIG) { @@ -1307,7 +1332,7 @@ s32 gd_sfx_to_play(void) { } /* 24B088 -> 24B418 */ -void *gdm_gettestdl(s32 id) { +Gfx *gdm_gettestdl(s32 id) { struct GdObj *dobj; struct GdDisplayList *gddl; UNUSED u32 pad28[2]; @@ -1334,17 +1359,17 @@ void *gdm_gettestdl(s32 id) { fatal_printf("gdm_gettestdl(): DL number %d undefined", id); } dobj = d_use_obj("yoshi_sh_l1"); - gddl = sGdDLArray[((struct ObjShape *) dobj)->gdDls[gGdFrameBuf]]; + gddl = sGdDLArray[((struct ObjShape *) dobj)->dlNums[gGdFrameBufNum]]; sUpdateYoshiScene = TRUE; break; - case 2: - case 3: + case GD_SCENE_REGULAR_MARIO: + case GD_SCENE_DIZZY_MARIO: setup_timers(); update_view_and_dl(sMSceneView); if (sHandView != NULL) { update_view_and_dl(sHandView); } - sCurrentGdDl = sMHeadMainDls[gGdFrameBuf]; + sCurrentGdDl = sMHeadMainDls[gGdFrameBufNum]; gSPEndDisplayList(next_gfx()); gddl = sCurrentGdDl; sUpdateMarioScene = TRUE; @@ -1361,7 +1386,7 @@ void *gdm_gettestdl(s32 id) { sUpdateCarScene = TRUE; break; case 5: - sActiveView = sScreenView2; + sActiveView = sScreenView; set_gd_mtx_parameters(G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH); dobj = d_use_obj("testnet2"); sCarGdDlNum = gd_startdisplist(8); @@ -1392,9 +1417,9 @@ void gdm_getpos(s32 id, struct GdVec3f *dst) { case 5: set_gd_mtx_parameters(G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH); dobj = d_use_obj("testnet2"); - dst->x = ((struct ObjNet *) dobj)->unk14.x; - dst->y = ((struct ObjNet *) dobj)->unk14.y; - dst->z = ((struct ObjNet *) dobj)->unk14.z; + dst->x = ((struct ObjNet *) dobj)->worldPos.x; + dst->y = ((struct ObjNet *) dobj)->worldPos.y; + dst->z = ((struct ObjNet *) dobj)->worldPos.z; break; default: fatal_printf("gdm_getpos(): %d out of range", id); @@ -1402,8 +1427,10 @@ void gdm_getpos(s32 id, struct GdVec3f *dst) { return; } -/* 24B4CC -> 24B5A8; orig name: func_8019CCFC */ -void bound_on_active_view(f32 *x, f32 *y) { +/** + * Clamps the coordinates so that they are within the active view + */ +static void clamp_coords_to_active_view(f32 *x, f32 *y) { struct ObjView *view = sActiveView; if (*x < 0.0f) { @@ -1546,8 +1573,8 @@ void gd_rdp_init(void) { /* 24BB30 -> 24BED8; orig name: func_8019D360 */ void gd_draw_rect(f32 ulx, f32 uly, f32 lrx, f32 lry) { - bound_on_active_view(&ulx, &uly); - bound_on_active_view(&lrx, &lry); + clamp_coords_to_active_view(&ulx, &uly); + clamp_coords_to_active_view(&lrx, &lry); if (lrx > ulx && lry > uly) { gDPFillRectangle(next_gfx(), (u32)(sActiveView->upperLeft.x + ulx), @@ -1562,8 +1589,8 @@ void gd_draw_rect(f32 ulx, f32 uly, f32 lrx, f32 lry) { /* 24BED8 -> 24CAC8; orig name: func_8019D708 */ void gd_draw_border_rect(f32 ulx, f32 uly, f32 lrx, f32 lry) { - bound_on_active_view(&ulx, &uly); - bound_on_active_view(&lrx, &lry); + clamp_coords_to_active_view(&ulx, &uly); + clamp_coords_to_active_view(&lrx, &lry); if (lrx > ulx && lry > uly) { gDPFillRectangle( @@ -1586,7 +1613,7 @@ void gd_draw_border_rect(f32 ulx, f32 uly, f32 lrx, f32 lry) { } /* 24CAC8 -> 24CDB4; orig name: func_8019E2F8 */ -void gd_set_fill(struct GdColour *colour) { +void gd_dl_set_fill(struct GdColour *colour) { u8 r, g, b; r = colour->r * 255.0f; @@ -1600,20 +1627,20 @@ void gd_set_fill(struct GdColour *colour) { } /* 24CDB4 -> 24CE10; orig name: func_8019E5E4 */ -void gd_set_zb_area(void) { +void gd_dl_set_zbuffer_area(void) { gDPSetDepthImage(next_gfx(), GD_LOWER_24(sActiveView->parent->zbuf)); } /* 24CE10 -> 24CF2C; orig name: func_8019E640 */ void gd_set_color_fb(void) { gDPSetColorImage(next_gfx(), G_IM_FMT_RGBA, G_IM_SIZ_16b, sActiveView->parent->lowerRight.x, - GD_LOWER_24(sActiveView->parent->colourBufs[gGdFrameBuf])); + GD_LOWER_24(sActiveView->parent->colourBufs[gGdFrameBufNum])); } /* 24CF2C -> 24CFCC; orig name: func_8019E75C */ void reset_cur_dl_indices(void) { - sMHeadMainDls[gGdFrameBuf]->curGfxIdx = 0; - sCurrentGdDl = sDynDlSet1[gGdFrameBuf]; + sMHeadMainDls[gGdFrameBufNum]->curGfxIdx = 0; + sCurrentGdDl = sDynamicMainDls[gGdFrameBufNum]; sCurrentGdDl->curVtxIdx = 0; sCurrentGdDl->curMtxIdx = 0; sCurrentGdDl->curLightIdx = 0; @@ -1622,7 +1649,7 @@ void reset_cur_dl_indices(void) { } /* 24CFCC -> 24D044; orig name: func_8019E7FC */ -void reset_dlnum_indices(s32 num) { +void begin_gddl(s32 num) { sCurrentGdDl = sGdDLArray[num]; sCurrentGdDl->curVtxIdx = 0; sCurrentGdDl->curMtxIdx = 0; @@ -1647,15 +1674,15 @@ s32 gd_startdisplist(s32 memarea) { D_801BB01C = 1; switch (memarea) { - case 7: + case 7: // Create new display list as a child of sStaticDl sCurrentGdDl = create_child_gdl(0, sStaticDl); break; - case 8: + case 8: // Use the active view's display list if (sActiveView->id > 2) { fatal_printf("gd_startdisplist(): Too many views to display"); } - sCurrentGdDl = D_801BD7C8[sActiveView->id][gGdFrameBuf]; + sCurrentGdDl = sViewDls[sActiveView->id][gGdFrameBufNum]; cpy_remaining_gddl(sCurrentGdDl, sCurrentGdDl->parent); break; default: @@ -1719,62 +1746,80 @@ void mat4_to_mtx(Mat4f *src, Mtx *dst) { guMtxF2L(*src, dst); } -/* 24D63C -> 24D6E4; orig name: func_8019EE6C */ -void add_mat4_to_dl(Mat4f *mtx) { +/** + * Adds a display list operation that multiplies the current matrix with `mtx`. + */ +void gd_dl_mul_matrix(Mat4f *mtx) { mat4_to_mtx(mtx, &DL_CURRENT_MTX(sCurrentGdDl)); gSPMatrix(next_gfx(), osVirtualToPhysical(&DL_CURRENT_MTX(sCurrentGdDl)), sMtxParamType | G_MTX_MUL | G_MTX_NOPUSH); next_mtx(); } -/* 24D6E4 -> 24D790; orig name: func_8019EF14 */ -void add_mat4_load_to_dl(Mat4f *mtx) { +/** + * Adds a display list operation that replaces the current matrix with `mtx`. + */ +void gd_dl_load_matrix(Mat4f *mtx) { mat4_to_mtx(mtx, &DL_CURRENT_MTX(sCurrentGdDl)); gSPMatrix(next_gfx(), osVirtualToPhysical(&DL_CURRENT_MTX(sCurrentGdDl)), sMtxParamType | G_MTX_LOAD | G_MTX_NOPUSH); next_mtx(); } -/* 24D790 -> 24D7FC */ -void idn_mtx_load_gddl(void) { +/** + * Adds a display list operation that replaces the current matrix with the + * identity matrix. + */ +void gd_dl_load_identity_matrix(void) { gSPMatrix(next_gfx(), osVirtualToPhysical(&sIdnMtx), sMtxParamType | G_MTX_LOAD | G_MTX_NOPUSH); } -/* 24D7FC -> 24D868; orig name: func_8019F02C */ -void idn_mtx_push_gddl(void) { +/** + * Adds a display list operation that pushes the current matrix onto the matrix + * stack. + */ +void gd_dl_push_matrix(void) { gSPMatrix(next_gfx(), osVirtualToPhysical(&sIdnMtx), sMtxParamType | G_MTX_MUL | G_MTX_PUSH); } -/* 24D868 -> 24D8B4; orig name: func_8019F098 */ -void pop_mtx_gddl(void) { +/** + * Adds a display list operation that pops a matrix from the matrix stack. + */ +void gd_dl_pop_matrix(void) { gSPPopMatrix(next_gfx(), sMtxParamType); } -/* 24D8B4 -> 24D96C; orig name: func_8019F0E4 */ -void translate_mtx_gddl(f32 x, f32 y, f32 z) { +/** + * Adds a display list operation that translates the current matrix by `x`, `y`, and `z`. + */ +void gd_dl_mul_trans_matrix(f32 x, f32 y, f32 z) { guTranslate(&DL_CURRENT_MTX(sCurrentGdDl), x, y, z); gSPMatrix(next_gfx(), osVirtualToPhysical(&DL_CURRENT_MTX(sCurrentGdDl)), sMtxParamType | G_MTX_MUL | G_MTX_NOPUSH); next_mtx(); } -/* 24D96C -> 24DA28; orig name: func_8019F19C */ -void translate_load_mtx_gddl(f32 x, f32 y, f32 z) { +/** + * Adds a display list operation that loads a translation matrix. + */ +void gd_dl_load_trans_matrix(f32 x, f32 y, f32 z) { guTranslate(&DL_CURRENT_MTX(sCurrentGdDl), x, y, z); gSPMatrix(next_gfx(), osVirtualToPhysical(&DL_CURRENT_MTX(sCurrentGdDl)), sMtxParamType | G_MTX_LOAD | G_MTX_NOPUSH); next_mtx(); } -/* 24DA28 -> 24DA94 */ -void func_8019F258(f32 x, f32 y, f32 z) { - Mat4f mtx; // 28 - struct GdVec3f vec; // 1c +/** + * Adds a display list operation that scales the current matrix by `x`, `y`, and `z`. + */ +void gd_dl_scale(f32 x, f32 y, f32 z) { + Mat4f mtx; + struct GdVec3f vec; vec.x = x; vec.y = y; vec.z = z; gd_set_identity_mat4(&mtx); gd_scale_mat4f_by_vec3f(&mtx, &vec); - add_mat4_to_dl(&mtx); + gd_dl_mul_matrix(&mtx); } /* 24DA94 -> 24DAE8 */ @@ -1783,29 +1828,29 @@ void func_8019F2C4(f32 arg0, s8 arg1) { gd_set_identity_mat4(&mtx); gd_absrot_mat4(&mtx, arg1 - 120, -arg0); - add_mat4_to_dl(&mtx); + gd_dl_mul_matrix(&mtx); } /* 24DAE8 -> 24E1A8 */ -void func_8019F318(struct ObjCamera *cam, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) { - LookAt *lookat; // 5c +void gd_dl_lookat(struct ObjCamera *cam, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) { + LookAt *lookat; arg7 *= RAD_PER_DEG; gd_mat4f_lookat(&cam->unkE8, arg1, arg2, arg3, arg4, arg5, arg6, gd_sin_d(arg7), gd_cos_d(arg7), 0.0f); - // 8019F3C8 + mat4_to_mtx(&cam->unkE8, &DL_CURRENT_MTX(sCurrentGdDl)); gSPMatrix(next_gfx(), osVirtualToPhysical(&DL_CURRENT_MTX(sCurrentGdDl)), G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH); - // 8019F434 + /* col colc dir 0 1 2 3 4 5 6 7 8 9 10 11 { { 0, 0, 0}, _, {0, 0, 0}, _, {0, 0, 0}, _} 16 17 18 19 20 21 22 23 24 25 26 27 { { 0, 0, 0}, _, {0, 0, 0}, _, {0, 0, 0}, _} */ - lookat = &D_801BE7D0[gGdFrameBuf]; + lookat = &D_801BE7D0[gGdFrameBufNum]; lookat->l[0].l.dir[0] = LOOKAT_PACK(cam->unkE8[0][0]); lookat->l[0].l.dir[1] = LOOKAT_PACK(cam->unkE8[1][0]); @@ -1831,7 +1876,7 @@ void func_8019F318(struct ObjCamera *cam, f32 arg1, f32 arg2, f32 arg3, f32 arg4 lookat->l[1].l.colc[1] = 0x80; lookat->l[1].l.colc[2] = 0; lookat->l[1].l.pad2 = 0; - // 8019F810 + lookat = &D_801BE790[0]; lookat->l[0].l.dir[0] = 1; lookat->l[0].l.dir[1] = 0; @@ -1858,7 +1903,7 @@ void func_8019F318(struct ObjCamera *cam, f32 arg1, f32 arg2, f32 arg3, f32 arg4 lookat->l[1].l.colc[2] = 0; lookat->l[1].l.pad2 = 0; - gSPLookAt(next_gfx(), osVirtualToPhysical(&D_801BE7D0[gGdFrameBuf])); + gSPLookAt(next_gfx(), osVirtualToPhysical(&D_801BE7D0[gGdFrameBufNum])); next_mtx(); } @@ -1874,25 +1919,29 @@ void check_tri_display(s32 vtxcount) { } } -/* 24E230 -> 24E6C0; orig name: func_8019FA60 */ -Vtx *make_vtx_if_new(f32 x, f32 y, f32 z, f32 alpha) { - Vtx *vtx = NULL; // 1c - s32 i; // 18 +/** + * Adds a vertex to the current display list. Returns a pointer to the vertex if + * it is new, or NULL if the vertex already exists. + */ +Vtx *gd_dl_make_vertex(f32 x, f32 y, f32 z, f32 alpha) { + Vtx *vtx = NULL; + s32 i; - for (i = D_801BB0CC; i < (D_801BB0CC + D_801BB0BC); i++) { + // Add the vertex index to the buffer if it doesn't already exist + for (i = sVertexBufStartIndex; i < (sVertexBufStartIndex + sVertexBufCount); i++) { // the ifs need to be separate to match... if (sCurrentGdDl->vtx[i].n.ob[0] == (s16) x) { if (sCurrentGdDl->vtx[i].n.ob[1] == (s16) y) { if (sCurrentGdDl->vtx[i].n.ob[2] == (s16) z) { - D_801BAF30[D_801BB0C4][D_801BB0B4++] = (s16) i; + sTriangleBuf[sTriangleBufCount][D_801BB0B4++] = (s16) i; return NULL; } } } } - D_801BB0BC++; - D_801BAF30[D_801BB0C4][D_801BB0B4++] = (s16) sCurrentGdDl->curVtxIdx; + sVertexBufCount++; + sTriangleBuf[sTriangleBufCount][D_801BB0B4++] = (s16) sCurrentGdDl->curVtxIdx; DL_CURRENT_VTX(sCurrentGdDl).n.ob[0] = (s16) x; DL_CURRENT_VTX(sCurrentGdDl).n.ob[1] = (s16) y; @@ -1912,22 +1961,24 @@ Vtx *make_vtx_if_new(f32 x, f32 y, f32 z, f32 alpha) { /* 24E6C0 -> 24E724 */ void func_8019FEF0(void) { - D_801BB0C4++; - if (D_801BB0BC >= 12) { - func_801A0070(); + sTriangleBufCount++; + if (sVertexBufCount >= 12) { + gd_dl_flush_vertices(); func_801A0038(); } D_801BB018 = 0; } -/* 24E724 -> 24E808; orig name: func_8019FF54 */ -void add_tri_to_dl(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 x3, f32 y3, f32 z3) { - Vtx *vtx; // 24 +/** + * Adds a triange to the current display list. + */ +void gd_dl_make_triangle(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 x3, f32 y3, f32 z3) { + Vtx *vtx; vtx = &DL_CURRENT_VTX(sCurrentGdDl); - make_vtx_if_new(x1, y1, z1, 1.0f); - make_vtx_if_new(x2, y2, z2, 1.0f); - make_vtx_if_new(x3, y3, z3, 1.0f); + gd_dl_make_vertex(x1, y1, z1, 1.0f); + gd_dl_make_vertex(x2, y2, z2, 1.0f); + gd_dl_make_vertex(x3, y3, z3, 1.0f); gSPVertex(next_gfx(), osVirtualToPhysical(vtx), 3, 0); gSP1Triangle(next_gfx(), 0, 1, 2, 0); @@ -1935,46 +1986,54 @@ void add_tri_to_dl(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 x3, f32 y /* 24E808 -> 24E840 */ void func_801A0038(void) { - D_801BB0BC = 0; - D_801BB0C4 = 0; - D_801BB0CC = sCurrentGdDl->curVtxIdx; + sVertexBufCount = 0; + sTriangleBufCount = 0; + sVertexBufStartIndex = sCurrentGdDl->curVtxIdx; } /* 24E840 -> 24E9BC */ -void func_801A0070(void) { +void gd_dl_flush_vertices(void) { UNUSED u32 pad; - s32 i; // 28 - UNUSED s32 startvtx; // 24 + s32 i; + UNUSED s32 startvtx = sVertexBufStartIndex; - startvtx = D_801BB0CC; - if (D_801BB0BC != 0) { - gSPVertex(next_gfx(), osVirtualToPhysical(&sCurrentGdDl->vtx[D_801BB0CC]), D_801BB0BC, 0); - for (i = 0; i < D_801BB0C4; i++) { - gSP1Triangle(next_gfx(), D_801BAF30[i][0] - D_801BB0CC, D_801BAF30[i][1] - D_801BB0CC, - D_801BAF30[i][2] - D_801BB0CC, 0); + if (sVertexBufCount != 0) { + // load vertex data + gSPVertex(next_gfx(), osVirtualToPhysical(&sCurrentGdDl->vtx[sVertexBufStartIndex]), sVertexBufCount, 0); + // load triangle data + for (i = 0; i < sTriangleBufCount; i++) { + gSP1Triangle(next_gfx(), + sTriangleBuf[i][0] - sVertexBufStartIndex, + sTriangleBuf[i][1] - sVertexBufStartIndex, + sTriangleBuf[i][2] - sVertexBufStartIndex, + 0); } } func_801A0038(); } -/* 24E9BC -> 24EA2C */ -void func_801A01EC(void) { +/** + * Unused - called by func_801A520C + */ +static void func_801A01EC(void) { if (D_801BE8B0.validCount >= D_801BE8B0.msgCount) { - osRecvMesg(&D_801BE8B0, &D_801BE97C, OS_MESG_BLOCK); + osRecvMesg(&D_801BE8B0, &sGdDMACompleteMsg, OS_MESG_BLOCK); } - osRecvMesg(&D_801BE8B0, &D_801BE97C, OS_MESG_BLOCK); + osRecvMesg(&D_801BE8B0, &sGdDMACompleteMsg, OS_MESG_BLOCK); } -/* 24EA2C -> 24EA88 */ -void func_801A025C(void) { - gGdFrameBuf ^= 1; - osViSwapBuffer(sScreenView2->parent->colourBufs[gGdFrameBuf]); +/** + * Unused - called by func_801A520C + */ +static void func_801A025C(void) { + gGdFrameBufNum ^= 1; + osViSwapBuffer(sScreenView->parent->colourBufs[gGdFrameBufNum]); } /* 24EA88 -> 24EAF4 */ -void func_801A02B8(f32 arg0) { - D_801BB184 = arg0 * 255.0f; - func_801A1A00(); +void set_render_alpha(f32 alpha) { + sAlpha = alpha * 255.0f; + update_render_mode(); } /* 24EAF4 -> 24EB0C */ @@ -1997,7 +2056,7 @@ s32 create_mtl_gddl(UNUSED s32 mtlType) { blue.g = 0.0f; blue.b = 1.0f; dlnum = gd_startdisplist(7); - func_801A086C(dlnum, &blue, GD_MTL_TEX_OFF); + gd_dl_material_lighting(dlnum, &blue, GD_MTL_TEX_OFF); gd_enddlsplist_parent(); sCurrentGdDl->totalVtx = sCurrentGdDl->curVtxIdx; sCurrentGdDl->totalMtx = sCurrentGdDl->curMtxIdx; @@ -2014,7 +2073,7 @@ void branch_to_gddl(s32 dlNum) { /* 24EC48 -> 24F03C */ // phong shading function? -void func_801A0478(s32 idx, // material GdDl number; offsets into hilite array +void gd_dl_hilite(s32 idx, // material GdDl number; offsets into hilite array struct ObjCamera *cam, UNUSED struct GdVec3f *arg2, UNUSED struct GdVec3f *arg3, struct GdVec3f *arg4, // vector to light source? struct GdColour *colour // light color @@ -2060,8 +2119,10 @@ void func_801A0478(s32 idx, // material GdDl number; offsets into hilite array } } -/* 24F03C -> 24FDB8 */ -s32 func_801A086C(s32 id, struct GdColour *colour, s32 material) { +/** + * Adds some display list commands that perform lighting for a material + */ +s32 gd_dl_material_lighting(s32 id, struct GdColour *colour, s32 material) { UNUSED u32 pad60[2]; s32 i; s32 numLights = sNumLights; @@ -2069,9 +2130,8 @@ s32 func_801A086C(s32 id, struct GdColour *colour, s32 material) { s32 lightDir[3]; if (id > 0) { - reset_dlnum_indices(id); + begin_gddl(id); } - // L801A08B0 switch (material) { case GD_MTL_TEX_OFF: gddl_is_loading_stub_dl(FALSE); @@ -2200,20 +2260,22 @@ void set_gd_mtx_parameters(s32 params) { } } -/* 24FFDC -> 2501D0 */ -void func_801A180C(void) { - Vp *vp; // 1c +/** + * Adds a viewport to the current display list based on the current active view + */ +static void gd_dl_viewport(void) { + Vp *vp; vp = &DL_CURRENT_VP(sCurrentGdDl); - vp->vp.vscale[0] = (s16)(sActiveView->lowerRight.x * 2.0f); - vp->vp.vscale[1] = (s16)(sActiveView->lowerRight.y * 2.0f); - vp->vp.vscale[2] = 0x1FF; + vp->vp.vscale[0] = (s16)(sActiveView->lowerRight.x * 2.0f); // x scale + vp->vp.vscale[1] = (s16)(sActiveView->lowerRight.y * 2.0f); // y scale + vp->vp.vscale[2] = 0x1FF; // z scale vp->vp.vscale[3] = 0x000; - vp->vp.vtrans[0] = (s16)((sActiveView->upperLeft.x * 4.0f) + (sActiveView->lowerRight.x * 2.0f)); - vp->vp.vtrans[1] = (s16)((sActiveView->upperLeft.y * 4.0f) + (sActiveView->lowerRight.y * 2.0f)); - vp->vp.vtrans[2] = 0x1FF; + vp->vp.vtrans[0] = (s16)((sActiveView->upperLeft.x * 4.0f) + (sActiveView->lowerRight.x * 2.0f)); // x offset + vp->vp.vtrans[1] = (s16)((sActiveView->upperLeft.y * 4.0f) + (sActiveView->lowerRight.y * 2.0f)); // y offset + vp->vp.vtrans[2] = 0x1FF; // z offset vp->vp.vtrans[3] = 0x000; gSPViewport(next_gfx(), osVirtualToPhysical(vp)); @@ -2221,15 +2283,15 @@ void func_801A180C(void) { } /* 2501D0 -> 250300 */ -void func_801A1A00(void) { +static void update_render_mode(void) { if ((sActiveView->flags & VIEW_ALLOC_ZBUF) != 0) { - if (D_801BB184 != 0xff) { + if (sAlpha != 0xff) { gDPSetRenderMode(next_gfx(), G_RM_AA_ZB_XLU_SURF, G_RM_AA_ZB_XLU_SURF2); } else { gDPSetRenderMode(next_gfx(), G_RM_AA_ZB_OPA_INTER, G_RM_NOOP2); } } else { - if (D_801BB184 != 0xff) { + if (sAlpha != 0xff) { gDPSetRenderMode(next_gfx(), G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); } else { gDPSetRenderMode(next_gfx(), G_RM_AA_ZB_OPA_INTER, G_RM_NOOP2); @@ -2241,7 +2303,7 @@ void func_801A1A00(void) { void Unknown801A1B30(void) { gDPPipeSync(next_gfx()); gd_set_color_fb(); - gd_set_fill(&sActiveView->colour); + gd_dl_set_fill(&sActiveView->colour); gDPFillRectangle(next_gfx(), (u32)(sActiveView->upperLeft.x), (u32)(sActiveView->upperLeft.y), (u32)(sActiveView->upperLeft.x + sActiveView->lowerRight.x - 1.0f), (u32)(sActiveView->upperLeft.y + sActiveView->lowerRight.y - 1.0f)); @@ -2253,7 +2315,7 @@ void Unknown801A1E70(void) { gDPPipeSync(next_gfx()); gDPSetCycleType(next_gfx(), G_CYC_FILL); gDPSetRenderMode(next_gfx(), G_RM_OPA_SURF, G_RM_OPA_SURF2); - gd_set_zb_area(); + gd_dl_set_zbuffer_area(); gDPSetColorImage(next_gfx(), G_IM_FMT_RGBA, G_IM_SIZ_16b, sActiveView->parent->lowerRight.x, GD_LOWER_24(sActiveView->parent->zbuf)); gDPSetFillColor(next_gfx(), GPACK_ZDZ(G_MAXFBZ, 0) << 16 | GPACK_ZDZ(G_MAXFBZ, 0)); @@ -2267,11 +2329,11 @@ void Unknown801A1E70(void) { /* 250AE0 -> 250B30; orig name: func_801A2310 */ void gd_set_one_cycle(void) { gDPSetCycleType(next_gfx(), G_CYC_1CYCLE); - func_801A1A00(); + update_render_mode(); } /* 250B30 -> 250B44 */ -void Unknown801A2360(void) { +void stub_renderer_3(void) { UNUSED u32 pad[4]; } @@ -2286,16 +2348,15 @@ void gddl_is_loading_shine_dl(s32 dlLoad) { } else { gSPTexture(next_gfx(), 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_OFF); gDPSetCombineMode(next_gfx(), G_CC_SHADE, G_CC_SHADE); - ; } } /* 250C18 -> 251014; orig name: func_801A2448 */ void start_view_dl(struct ObjView *view) { - f32 ulx; // 3c - f32 uly; // 38 - f32 lrx; // 34 - f32 lry; // 30 + f32 ulx; + f32 uly; + f32 lrx; + f32 lry; if (view->upperLeft.x < view->parent->upperLeft.x) { ulx = view->parent->upperLeft.x; @@ -2336,155 +2397,147 @@ void start_view_dl(struct ObjView *view) { if (view->flags & VIEW_ALLOC_ZBUF) { gSPSetGeometryMode(next_gfx(), G_ZBUFFER); } - func_801A180C(); - func_801A1A00(); + gd_dl_viewport(); + update_render_mode(); gDPPipeSync(next_gfx()); } /* 251014 -> 251A1C; orig name: func_801A2844 */ void parse_p1_controller(void) { - u32 i; // 3c - struct GdControl *gdctrl; // 38 - OSContPad *p1cont; // 34 - OSContPad *p1contPrev; // 30 - u8 *gdCtrlBytes; // 2C - u8 *prevGdCtrlBytes; // 28 + struct GdControl *gdctrl = &gGdCtrl; // 38 + OSContPad *currInputs = NULL; // 34 + OSContPad *prevInputs = NULL; // 30 f32 aspect = GFX_DIMENSIONS_ASPECT_RATIO; aspect *= 0.75; - - gdctrl = &gGdCtrl; - gdCtrlBytes = (u8 *) gdctrl; - prevGdCtrlBytes = (u8 *) gdctrl->prevFrame; - for (i = 0; i < sizeof(struct GdControl); i++) { - *prevGdCtrlBytes++ = *gdCtrlBytes++; + // Copy current inputs to previous + u8 *src = (u8 *) gdctrl; + u8 *dest = (u8 *) gdctrl->prevFrame; + for (u32 i = 0; i < sizeof(struct GdControl); i++) { + *dest++ = *src++; } gdctrl->unk50 = gdctrl->unk4C = gdctrl->dup = gdctrl->ddown = 0; - p1cont = &sGdContPads[0]; - p1contPrev = &sPrevFrameCont[0]; + currInputs = &sGdContPads[0]; + prevInputs = &sPrevFrameCont[0]; // stick values - gdctrl->stickXf = (f32) p1cont->stick_x; - gdctrl->stickYf = (f32) p1cont->stick_y; + gdctrl->stickXf = currInputs->stick_x; + gdctrl->stickYf = currInputs->stick_y; gdctrl->stickDeltaX = gdctrl->stickX; gdctrl->stickDeltaY = gdctrl->stickY; - gdctrl->stickX = (s32) p1cont->stick_x; - gdctrl->stickY = (s32) p1cont->stick_y; + gdctrl->stickX = currInputs->stick_x; + gdctrl->stickY = currInputs->stick_y; gdctrl->stickDeltaX -= gdctrl->stickX; gdctrl->stickDeltaY -= gdctrl->stickY; // button values (as bools) - gdctrl->trgL = (p1cont->button & L_TRIG) > 0u; - gdctrl->trgR = (p1cont->button & R_TRIG) > 0u; - gdctrl->btnA = (p1cont->button & A_BUTTON) > 0u; - gdctrl->btnB = (p1cont->button & B_BUTTON) > 0u; - gdctrl->cleft = (p1cont->button & L_CBUTTONS) > 0u; - gdctrl->cright = (p1cont->button & R_CBUTTONS) > 0u; - gdctrl->cup = (p1cont->button & U_CBUTTONS) > 0u; - gdctrl->cdown = (p1cont->button & D_CBUTTONS) > 0u; + gdctrl->trgL = (currInputs->button & L_TRIG) != 0; + gdctrl->trgR = (currInputs->button & R_TRIG) != 0; + gdctrl->btnA = (currInputs->button & A_BUTTON) != 0; + gdctrl->btnB = (currInputs->button & B_BUTTON) != 0; + gdctrl->cleft = (currInputs->button & L_CBUTTONS) != 0; + gdctrl->cright = (currInputs->button & R_CBUTTONS) != 0; + gdctrl->cup = (currInputs->button & U_CBUTTONS) != 0; + gdctrl->cdown = (currInputs->button & D_CBUTTONS) != 0; // but not these buttons?? - gdctrl->dleft = p1cont->button & L_JPAD; - gdctrl->dright = p1cont->button & R_JPAD; - gdctrl->dup = p1cont->button & U_JPAD; - gdctrl->ddown = p1cont->button & D_JPAD; + gdctrl->dleft = currInputs->button & L_JPAD; + gdctrl->dright = currInputs->button & R_JPAD; + gdctrl->dup = currInputs->button & U_JPAD; + gdctrl->ddown = currInputs->button & D_JPAD; - if (gdctrl->btnA && !gdctrl->btnApressed) { - gdctrl->btnAnewPress = TRUE; + if (gdctrl->btnA && !gdctrl->dragging) { + gdctrl->startedDragging = TRUE; } else { - gdctrl->btnAnewPress = FALSE; + gdctrl->startedDragging = FALSE; } // toggle if A is pressed? or is this just some seed for an rng? - gdctrl->btnApressed = gdctrl->btnA; + gdctrl->dragging = gdctrl->btnA; gdctrl->unkD8b20 = gdctrl->unkD8b40 = FALSE; gdctrl->AbtnPressWait = FALSE; - if (gdctrl->btnAnewPress) { - gdctrl->csrXatApress = gdctrl->csrX; - gdctrl->csrYatApress = gdctrl->csrY; + if (gdctrl->startedDragging) { + gdctrl->dragStartX = gdctrl->csrX; + gdctrl->dragStartY = gdctrl->csrY; - if (gdctrl->frameCount - gdctrl->frameAbtnPressed < 10) { + if (gdctrl->currFrame - gdctrl->dragStartFrame < 10) { gdctrl->AbtnPressWait = TRUE; } } - if (gdctrl->btnApressed) { - gdctrl->frameAbtnPressed = gdctrl->frameCount; + if (gdctrl->dragging) { + gdctrl->dragStartFrame = gdctrl->currFrame; } - gdctrl->frameCount++; + gdctrl->currFrame++; - if (p1cont->button & START_BUTTON && !(p1contPrev->button & START_BUTTON)) { + if (currInputs->button & START_BUTTON && !(prevInputs->button & START_BUTTON)) { gdctrl->newStartPress ^= 1; } - if (p1cont->button & Z_TRIG && !(p1contPrev->button & Z_TRIG)) { - sNewZPresses++; + if (currInputs->button & Z_TRIG && !(prevInputs->button & Z_TRIG)) { + sCurrDebugViewIndex++; } - if (sNewZPresses > D_801A86F0) { - sNewZPresses = 0; - } else if (sNewZPresses < 0) { - sNewZPresses = D_801A86F0; + if (sCurrDebugViewIndex > sDebugViewsCount) { + sCurrDebugViewIndex = 0; + } else if (sCurrDebugViewIndex < 0) { + sCurrDebugViewIndex = sDebugViewsCount; } - if (sNewZPresses) { + if (sCurrDebugViewIndex) { deactivate_timing(); } else { activate_timing(); } - for (i = 0; ((s32) i) < D_801A86F0; i++) { - D_801BD7A0[i]->flags &= ~VIEW_UPDATE; + for (s32 i = 0; ((s32) i) < sDebugViewsCount; i++) { + sDebugViews[i]->flags &= ~VIEW_UPDATE; } - if (sNewZPresses) { - D_801BD7A0[sNewZPresses - 1]->flags |= VIEW_UPDATE; + if (sCurrDebugViewIndex) { + sDebugViews[sCurrDebugViewIndex - 1]->flags |= VIEW_UPDATE; } - // deadzone checks? + + // deadzone checks if (ABS(gdctrl->stickX) >= 6) { - gdctrl->csrX += gdctrl->stickX * 0.1; //? 0.1f + gdctrl->csrX += gdctrl->stickX * 0.1; } - if (ABS(gdctrl->stickY) >= 6) { - gdctrl->csrY -= gdctrl->stickY * 0.1; //? 0.1f - } - // border checks? is this for the cursor finger movement? - if ((f32) gdctrl->csrX < (sScreenView2->parent->upperLeft.x + (16.0f/aspect))) { - gdctrl->csrX = (s32)(sScreenView2->parent->upperLeft.x + (16.0f/aspect)); + gdctrl->csrY -= gdctrl->stickY * 0.1; } - if ((f32) gdctrl->csrX - > (sScreenView2->parent->upperLeft.x + sScreenView2->parent->lowerRight.x - (48.0/aspect))) { - gdctrl->csrX = - (s32)(sScreenView2->parent->upperLeft.x + sScreenView2->parent->lowerRight.x - (48.0/aspect)); + // clamp cursor position within screen view bounds + if (gdctrl->csrX < sScreenView->parent->upperLeft.x + (16.0f/aspect)) { + gdctrl->csrX = sScreenView->parent->upperLeft.x + (16.0f/aspect); + } + if (gdctrl->csrX > sScreenView->parent->upperLeft.x + sScreenView->parent->lowerRight.x - (48.0f/aspect)) { + gdctrl->csrX = sScreenView->parent->upperLeft.x + sScreenView->parent->lowerRight.x - (48.0f/aspect); + } + if (gdctrl->csrY < sScreenView->parent->upperLeft.y + 16.0f) { + gdctrl->csrY = sScreenView->parent->upperLeft.y + 16.0f; + } + if (gdctrl->csrY > sScreenView->parent->upperLeft.y + sScreenView->parent->lowerRight.y - 32.0f) { + gdctrl->csrY = sScreenView->parent->upperLeft.y + sScreenView->parent->lowerRight.y - 32.0f; } - if ((f32) gdctrl->csrY < (sScreenView2->parent->upperLeft.y + 16.0f)) { - gdctrl->csrY = (s32)(sScreenView2->parent->upperLeft.y + 16.0f); - } - - if ((f32) gdctrl->csrY - > (sScreenView2->parent->upperLeft.y + sScreenView2->parent->lowerRight.y - 32.0f)) { - gdctrl->csrY = - (s32)(sScreenView2->parent->upperLeft.y + sScreenView2->parent->lowerRight.y - 32.0f); - } - - for (i = 0; i < sizeof(OSContPad); i++) { - ((u8 *) p1contPrev)[i] = ((u8 *) p1cont)[i]; + for (u32 i = 0; i < sizeof(OSContPad); i++) { + ((u8 *) prevInputs)[i] = ((u8 *) currInputs)[i]; } } -/* 251A1C -> 251AC4 */ -void Unknown801A324C(f32 arg0) { +void stub_renderer_4(f32 arg0) { return; - if (D_801BD768.x * D_801A86CC.x + arg0 * 2.0f > 160.0) //? 160.0f + // dead code + if (D_801BD768.x * D_801A86CC.x + arg0 * 2.0f > 160.0) { func_801A3370(D_801BD758.x - D_801BD768.x, -20.0f, 0.0f); D_801BD768.x = D_801BD758.x; } } -/* 251AC4 -> 251AF4 */ +/** + * Unused + */ void Unknown801A32F4(s32 arg0) { D_801BD774 = GD_LOWER_24(arg0) + D_801BAF28; } @@ -2501,33 +2554,37 @@ void func_801A3324(f32 x, f32 y, f32 z) { /* 251B40 -> 251BC8 */ void func_801A3370(f32 x, f32 y, f32 z) { - translate_mtx_gddl(x, y, z); + gd_dl_mul_trans_matrix(x, y, z); D_801BD768.x += x; D_801BD768.y += y; D_801BD768.z += z; } -/* 251BC8 -> 251C4C */ +/** + * Unused + */ void Unknown801A33F8(f32 x, f32 y, f32 z) { - translate_mtx_gddl(x - D_801BD768.x, y - D_801BD768.y, z - D_801BD768.z); + gd_dl_mul_trans_matrix(x - D_801BD768.x, y - D_801BD768.y, z - D_801BD768.z); D_801BD768.x = x; D_801BD768.y = y; D_801BD768.z = z; } -/* 251C4C -> 251CB0 */ +/** + * Unused + */ void Unknown801A347C(f32 x, f32 y, f32 z) { D_801A86CC.x = x; D_801A86CC.y = y; D_801A86CC.z = z; - func_8019F258(x, y, z); + gd_dl_scale(x, y, z); } /* 251CB0 -> 251D44; orig name: func_801A34E0 */ void border_active_view(void) { if (sActiveView->flags & VIEW_BORDERED) { - gd_set_fill(gd_get_colour(1)); + gd_dl_set_fill(gd_get_colour(1)); gd_draw_border_rect(0.0f, 0.0f, (sActiveView->lowerRight.x - 1.0f), (sActiveView->lowerRight.y - 1.0f)); } @@ -2563,7 +2620,7 @@ s32 gd_getproperty(s32 prop, UNUSED void *arg1) { /* 251E18 -> 2522B0 */ void gd_setproperty(enum GdProperty prop, f32 f1, f32 f2, f32 f3) { UNUSED f32 sp3C = 1.0f; - s32 parm; // 38 + s32 parm; switch (prop) { case GD_PROP_LIGHTING: @@ -2643,7 +2700,7 @@ void gd_setproperty(enum GdProperty prop, f32 f1, f32 f2, f32 f3) { } /* 2522B0 -> 2522C0 */ -void stub_801A3AE0(void) { +void stub_renderer_5(void) { } /* 2522C0 -> 25245C */ @@ -2695,12 +2752,12 @@ void gd_create_perspective_matrix(f32 fovy, f32 aspect, f32 near, f32 far) { /* 25262C -> 252AF8 */ s32 setup_view_buffers(const char *name, struct ObjView *view, UNUSED s32 ulx, UNUSED s32 uly, UNUSED s32 lrx, UNUSED s32 lry) { - char buf[0x100]; // 18; memtracker name buffer + char memtrackerName[0x100]; if (view->flags & (VIEW_Z_BUF | VIEW_COLOUR_BUF) && !(view->flags & VIEW_UNK_1000)) { if (view->flags & VIEW_COLOUR_BUF) { - sprintf(buf, "%s CBuf", name); - start_memtracker(buf); + sprintf(memtrackerName, "%s CBuf", name); + start_memtracker(memtrackerName); view->colourBufs[0] = gd_malloc((u32)(2.0f * view->lowerRight.x * view->lowerRight.y + 64.0f), 0x20); @@ -2713,19 +2770,19 @@ s32 setup_view_buffers(const char *name, struct ObjView *view, UNUSED s32 ulx, U view->colourBufs[0] = (void *) ALIGN((uintptr_t) view->colourBufs[0], 64); view->colourBufs[1] = (void *) ALIGN((uintptr_t) view->colourBufs[1], 64); - stop_memtracker(buf); + stop_memtracker(memtrackerName); if (view->colourBufs[0] == NULL || view->colourBufs[1] == NULL) { fatal_printf("Not enough DRAM for colour buffers\n"); } view->parent = view; } else { - view->parent = sScreenView2; + view->parent = sScreenView; } if (view->flags & VIEW_Z_BUF) { - sprintf(buf, "%s ZBuf", name); - start_memtracker(buf); + sprintf(memtrackerName, "%s ZBuf", name); + start_memtracker(memtrackerName); if (view->flags & VIEW_ALLOC_ZBUF) { view->zbuf = gd_malloc((u32)(2.0f * view->lowerRight.x * view->lowerRight.y + 64.0f), 0x40); @@ -2734,12 +2791,12 @@ s32 setup_view_buffers(const char *name, struct ObjView *view, UNUSED s32 ulx, U } view->zbuf = (void *) ALIGN((uintptr_t) view->zbuf, 64); } - stop_memtracker(buf); + stop_memtracker(memtrackerName); } else { - view->zbuf = sScreenView2->zbuf; + view->zbuf = sScreenView->zbuf; } } else { - view->parent = sScreenView2; + view->parent = sScreenView; } view->gdDlNum = 0; @@ -2775,27 +2832,45 @@ void gd_init_controllers(void) { } /* 252BAC -> 252BC0 */ -void func_801A43DC(UNUSED struct GdObj *obj) { +void stub_renderer_6(UNUSED struct GdObj *obj) { } -/* 252BC0 -> 252BE0 */ -void *func_801A43F0(UNUSED const char *menufmt, ...) { +/** + * Unused - This is likely a stub version of the `defpup` function from the IRIX + * Graphics Library. It was used to define a popup menu. See the IRIX "Graphics + * Library Reference Manual, C Edition" for details. + * + * @param menufmt a format string defining the menu items to be added to the + * popup menu. + * @return an identifier of the menu just defined + */ +long defpup(UNUSED const char *menufmt, ...) { //! @bug no return; function was stubbed } -/* 252BE0 -> 252BF0 */ -void func_801A4410(UNUSED void *arg0) { +/** + * Unused - called when the user picks an item from the "Control Type" menu. + * Presumably, this would allow switching inputs between controller, keyboard, + * and mouse. + * + * @param itemId ID of the menu item that was clicked + * (1 = "U-64 Analogue Joystick", 2 = "Keyboard", 3 = "Mouse") + */ +void menu_cb_control_type(UNUSED u32 itemId) { } -/* 252BF0 -> 252C08 */ -void func_801A4424(UNUSED void *arg0) { +/** + * Unused - called when the user clicks the "Re-Calibrate Controller" item from + * the "Dynamics" menu. + */ +void menu_cb_recalibrate_controller(UNUSED u32 itemId) { } /* 252C08 -> 252C70 */ void func_801A4438(f32 x, f32 y, f32 z) { - D_801BB0E8.x = x - (sActiveView->lowerRight.x / 2.0f); - D_801BB0E8.y = (sActiveView->lowerRight.y / 2.0f) - y; - D_801BB0E8.z = z; + sTextDrawPos.x = x - (sActiveView->lowerRight.x / 2.0f); + sTextDrawPos.y = (sActiveView->lowerRight.y / 2.0f) - y; + sTextDrawPos.z = z; } /* 252C70 -> 252DB4 */ @@ -2824,20 +2899,22 @@ s32 gd_gentexture(void *texture, s32 fmt, s32 size, UNUSED u32 arg3, UNUSED u32 fatal_printf("gd_gentexture(): bad size"); } - D_801BB020[++D_801A86A0] = texture; + sLoadedTextures[++sTextureCount] = texture; dl = gd_startdisplist(7); if (dl == 0) { fatal_printf("Cant generate DL for texture"); } gd_enddlsplist_parent(); - D_801BB060[D_801A86A0] = dl; + sTextureDisplayLists[sTextureCount] = dl; return dl; } -/* 252DB4 -> 252F88 */ -void *Unknown801A45E4(const char *file, s32 fmt, s32 size, u32 arg3, u32 arg4) { +/** + * Unused (not called) + */ +void *load_texture_from_file(const char *file, s32 fmt, s32 size, u32 arg3, u32 arg4) { struct GdFile *txFile; // 3c void *texture; // 38 u32 txSize; // 34 @@ -2878,14 +2955,16 @@ void Unknown801A47B8(struct ObjView *v) { } } -void stub_801A47DC(void) { +void stub_renderer_7(void) { } /* 252FC4 -> 252FD8 */ -void Unknown801A47F4(UNUSED u32 arg0) { +void stub_renderer_8(UNUSED u32 arg0) { } -/* 252FD8 -> 253018 */ +/** + * Unused - called by func_801A520C and Unknown801A5344 + */ void func_801A4808(void) { while (D_801A8674 != 0) { ; @@ -2899,21 +2978,23 @@ void func_801A4848(s32 linkDl) { struct GdDisplayList *curDl; curDl = sCurrentGdDl; - sCurrentGdDl = sMHeadMainDls[gGdFrameBuf]; + sCurrentGdDl = sMHeadMainDls[gGdFrameBufNum]; branch_cur_dl_to_num(linkDl); sCurrentGdDl = curDl; } -/* 253084 -> 253094 */ -void func_801A48B4(void) { +/** + * Unused - called by func_801A520C and Unknown801A5344 + */ +void stub_renderer_9(void) { } /* 253094 -> 2530A8 */ -void func_801A48C4(UNUSED u32 arg0) { +void stub_renderer_10(UNUSED u32 arg0) { } /* 2530A8 -> 2530C0 */ -void func_801A48D8(UNUSED char *s) { +void stub_draw_label_text(UNUSED char *s) { UNUSED u32 pad2; UNUSED char *save = s; UNUSED u8 pad[0x18]; @@ -2924,10 +3005,12 @@ void set_active_view(struct ObjView *v) { sActiveView = v; } -void stub_801A4908(void) { +void stub_renderer_11(void) { } -/* 2530E8 -> 2532D4 */ +/** + * Unused - called by func_801A520C + */ void func_801A4918(void) { f32 x; // c f32 y; // 8 @@ -2947,7 +3030,7 @@ void func_801A4918(void) { ydiff = (y - sMenuView->upperLeft.y) / 25.0f; if (ydiff < sItemsInMenu) { - sMenuGadgets[ydiff]->drawFlags |= OBJ_USE_ENV_COLOUR; + sMenuGadgets[ydiff]->drawFlags |= OBJ_HIGHLIGHTED; } } @@ -2969,11 +3052,10 @@ void Unknown801A4B04(void) { /* 2533DC -> 253728; orig name: func_801A4C0C */ void update_cursor(void) { - if (sHandView == NULL) { + if (sHandView == NULL) return; - } - if (gGdCtrl.frameCount - gGdCtrl.frameAbtnPressed < 300) { + if (gGdCtrl.currFrame - gGdCtrl.dragStartFrame < 300) { sHandView->flags |= VIEW_UPDATE; // by playing the sfx every frame, it will only play once as it // never leaves the "sfx played last frame" buffer @@ -2986,10 +3068,10 @@ void update_cursor(void) { sHandView->upperLeft.x = (f32) gGdCtrl.csrX; sHandView->upperLeft.y = (f32) gGdCtrl.csrY; - reset_dlnum_indices(sHandShape->gdDls[gGdFrameBuf]); - - if (gGdCtrl.btnApressed) { - gd_put_sprite((u16 *) gd_texture_hand_closed, sHandView->upperLeft.x, sHandView->upperLeft.y, 32, 32); + // Make hand display list + begin_gddl(sHandShape->dlNums[gGdFrameBufNum]); + if (gGdCtrl.dragging) { + gd_put_sprite((u16 *) gd_texture_hand_closed, sHandView->upperLeft.x, sHandView->upperLeft.y, 0x20, 0x20); } else { gd_put_sprite((u16 *) gd_texture_hand_open, sHandView->upperLeft.x, sHandView->upperLeft.y, 32, 32); } @@ -3021,9 +3103,9 @@ void Unknown801A4F58(void) { register s16 b; // t2 register s32 i; // t3 - cbufOff = sScreenView2->colourBufs[gGdFrameBuf ^ 1]; - cbufOn = sScreenView2->colourBufs[gGdFrameBuf]; - zbuf = sScreenView2->zbuf; + cbufOff = sScreenView->colourBufs[gGdFrameBufNum ^ 1]; + cbufOn = sScreenView->colourBufs[gGdFrameBufNum]; + zbuf = sScreenView->zbuf; for (i = 0; i < (320 * 240); i++) { // L801A4FCC colour = cbufOff[i]; @@ -3065,20 +3147,22 @@ void update_view_and_dl(struct ObjView *view) { prevFlags = view->flags; update_view(view); if (prevFlags & VIEW_UPDATE) { - sCurrentGdDl = sMHeadMainDls[gGdFrameBuf]; + sCurrentGdDl = sMHeadMainDls[gGdFrameBufNum]; if (view->gdDlNum != 0) { func_801A4848(view->gdDlNum); } } } -/* 2539DC -> 253B14 */ +/** + * Unused - called by __main__ + */ void func_801A520C(void) { UNUSED u32 pad[2]; start_timer("1frame"); start_timer("cpu"); - func_801A48B4(); + stub_renderer_9(); reset_cur_dl_indices(); parse_p1_controller(); setup_timers(); @@ -3102,21 +3186,23 @@ void func_801A520C(void) { func_801A01EC(); } -/* 253B14 -> 253BC4 */ +/** + * Unused + */ void Unknown801A5344(void) { - if ((sActiveView = sScreenView2) == NULL) { + if ((sActiveView = sScreenView) == NULL) { return; } reset_cur_dl_indices(); - sScreenView2->gdDlNum = gd_startdisplist(8); - start_view_dl(sScreenView2); + sScreenView->gdDlNum = gd_startdisplist(8); + start_view_dl(sScreenView); gd_set_one_cycle(); gd_enddlsplist_parent(); - func_801A4848(sScreenView2->gdDlNum); - func_801A48B4(); + func_801A4848(sScreenView->gdDlNum); + stub_renderer_9(); func_801A4808(); - sScreenView2->gdDlNum = 0; + sScreenView->gdDlNum = 0; } /* 253BC8 -> 2540E0 */ @@ -3125,19 +3211,19 @@ void gd_init(void) { UNUSED u32 pad30; s8 *data; // 2c - add_to_stacktrace("gd_init"); + imin("gd_init"); i = (u32)(sMemBlockPoolSize - DOUBLE_SIZE_ON_64_BIT(0x3E800)); data = gd_allocblock(i); gd_add_mem_to_heap(i, data, 0x10); - D_801BB184 = (u16) 0xff; + sAlpha = (u16) 0xff; D_801A867C = 0; D_801A8680 = 0; - D_801A86A0 = 0; - gGdFrameBuf = 0; + sTextureCount = 0; + gGdFrameBufNum = 0; D_801A86BC = 1; sItemsInMenu = 0; - D_801A86F0 = 0; - sNewZPresses = 0; + sDebugViewsCount = 0; + sCurrDebugViewIndex = 0; sGdDlCount = 0; D_801A8674 = 0; sLightId = 0; @@ -3167,31 +3253,34 @@ void gd_init(void) { stop_memtracker("Static DL"); start_memtracker("Dynamic DLs"); - sDynDlSet1[0] = new_gd_dl(1, 600, 10, 200, 10, 3); - sDynDlSet1[1] = new_gd_dl(1, 600, 10, 200, 10, 3); + sDynamicMainDls[0] = new_gd_dl(1, 600, 10, 200, 10, 3); + sDynamicMainDls[1] = new_gd_dl(1, 600, 10, 200, 10, 3); stop_memtracker("Dynamic DLs"); + sMHeadMainDls[0] = new_gd_dl(1, 100, 0, 0, 0, 0); sMHeadMainDls[1] = new_gd_dl(1, 100, 0, 0, 0, 0); - for (i = 0; i < ARRAY_COUNT(D_801BD7C8); i++) { - D_801BD7C8[i][0] = create_child_gdl(1, sDynDlSet1[0]); - D_801BD7C8[i][1] = create_child_gdl(1, sDynDlSet1[1]); + for (i = 0; i < ARRAY_COUNT(sViewDls); i++) { + sViewDls[i][0] = create_child_gdl(1, sDynamicMainDls[0]); + sViewDls[i][1] = create_child_gdl(1, sDynamicMainDls[1]); } - sScreenView2 = + sScreenView = make_view("screenview2", (VIEW_2_COL_BUF | VIEW_UNK_1000 | VIEW_COLOUR_BUF | VIEW_Z_BUF), 0, 0, 0, 320, 240, NULL); - sScreenView2->colour.r = 0.0f; - sScreenView2->colour.g = 0.0f; - sScreenView2->colour.b = 0.0f; - sScreenView2->parent = sScreenView2; - sScreenView2->flags &= ~VIEW_UPDATE; - sActiveView = sScreenView2; + sScreenView->colour.r = 0.0f; + sScreenView->colour.g = 0.0f; + sScreenView->colour.b = 0.0f; + sScreenView->parent = sScreenView; + sScreenView->flags &= ~VIEW_UPDATE; + sActiveView = sScreenView; + // Zero out controller inputs data = (s8 *) &gGdCtrl; for (i = 0; (u32) i < sizeof(struct GdControl); i++) { *data++ = 0; } + // 801A5868 gGdCtrl.unk88 = 1.0f; gGdCtrl.unkA0 = -45.0f; @@ -3201,40 +3290,45 @@ void gd_init(void) { gGdCtrl.prevFrame = &gGdCtrlPrev; gGdCtrl.csrX = 160; gGdCtrl.csrY = 120; - gGdCtrl.frameAbtnPressed = -1000; - D_801BB0AC = create_mtl_gddl(4); + gGdCtrl.dragStartFrame = -1000; + unusedDl801BB0AC = create_mtl_gddl(4); imout(); } -/* 2540E0 -> 254168 */ -void Unknown801A5910(char *arg0, s32 len) { - char buf[100]; // 4 - s32 i; // 0 +/** + * Unused - reverses the characters in `str`. + */ +void reverse_string(char *str, s32 len) { + char buf[100]; + s32 i; for (i = 0; i < len; i++) { - buf[i] = arg0[len - i - 1]; + buf[i] = str[len - i - 1]; } for (i = 0; i < len; i++) { - arg0[i] = buf[i]; + str[i] = buf[i]; } } /* 254168 -> 25417C */ -void func_801A5998(UNUSED s8 *arg0) { +void stub_renderer_12(UNUSED s8 *arg0) { } /* 25417C -> 254190 */ -void func_801A59AC(UNUSED void *arg0) { +void stub_renderer_13(UNUSED void *arg0) { } /* 254190 -> 2541A4 */ -void func_801A59C0(UNUSED s8 *arg0) { +void stub_renderer_14(UNUSED s8 *arg0) { } -// I wonder why the following three functions are in this file, -// instead of in the drawing file, where they are used... -/* 2541A4 -> 2541D4; orig name: func_801A59D4 */ +/** + * Initializes the pick buffer. This functions like the `pick` or `gselect` + * functions from IRIS GL. + * @param buf pointer to an array of 16-bit values + * @param len maximum number of values to store + */ void init_pick_buf(s16 *buf, s32 len) { buf[0] = 0; buf[1] = 0; @@ -3243,7 +3337,10 @@ void init_pick_buf(s16 *buf, s32 len) { sPickBufPosition = 0; } -/* 2541D4 -> 25421C; orig name: func_801A5A04 */ +/** + * Stores a 16-bit value into the pick buffer. This functions like the + * `pushname` function from IRIS GL. + */ void store_in_pickbuf(s16 data) { sPickBuf[sPickBufPosition++] = data; } @@ -3257,27 +3354,27 @@ s32 get_cur_pickbuf_offset(UNUSED s16 *arg0) { } /* 254250 -> 254264 */ -void Unknown801A5A80(UNUSED u32 arg0) { +void stub_renderer_15(UNUSED u32 arg0) { } /* 254264 -> 254278 */ -void Unknown801A5A94(UNUSED u32 arg0) { +void stub_renderer_16(UNUSED u32 arg0) { } /* 254278 -> 254288 */ -void stub_801A5AA8(void) { +void stub_renderer_17(void) { } /* 254288 -> 2542B0 */ void *Unknown801A5AB8(s32 texnum) { - return D_801BB020[texnum]; + return sLoadedTextures[texnum]; } /* 2542B0 -> 254328 */ void Unknown801A5AE0(s32 arg0) { D_801BB018 = arg0; if (D_801BB01C != D_801BB018) { - branch_cur_dl_to_num(D_801BB060[arg0]); + branch_cur_dl_to_num(sTextureDisplayLists[arg0]); D_801BB01C = D_801BB018; } } @@ -3289,8 +3386,8 @@ void set_vtx_tc_buf(f32 tcS, f32 tcT) { } /* 2543B8 -> 2543F4 */ -void func_801A5BE8(struct ObjView *view) { - D_801BD7A0[D_801A86F0++] = view; +void add_debug_view(struct ObjView *view) { + sDebugViews[sDebugViewsCount++] = view; } /* 2543F4 -> 254450; orig name: Unknown801A5C24 */ @@ -3310,7 +3407,7 @@ void Unknown801A5C80(struct ObjGroup *parentGroup) { label = (struct ObjLabel *) d_makeobj(D_LABEL, 0); d_set_rel_pos(10.0f, 230.0f, 0.0f); d_set_parm_ptr(PARM_PTR_CHAR, gd_strdup("FT %2.2f")); - d_add_valptr(AsDynId(0), 0, OBJ_VALUE_FLOAT, (uintptr_t) &sTracked1FrameTime); + d_add_valptr(NULL, 0, OBJ_VALUE_FLOAT, (uintptr_t) &sTracked1FrameTime); label->unk30 = 3; d_end_group("debugg"); @@ -3328,7 +3425,7 @@ void Unknown801A5D90(struct ObjGroup *arg0) { struct ObjLabel *mtLabel; // 254 struct ObjGroup *labelgrp; // 250 struct ObjView *memview; // 24c - s32 sp248; // memtracker id and/or i + s32 trackerNum; // memtracker id and/or i s32 sp244; // label y position? s32 sp240; // done checking all memtrakcers s32 sp23C; // memtracker label made? @@ -3337,24 +3434,24 @@ void Unknown801A5D90(struct ObjGroup *arg0) { struct MemTracker *mt; // 38 sp240 = FALSE; - sp248 = -1; + trackerNum = -1; while (!sp240) { - sprintf(groupId, "memg%d\n", sp248); - d_start_group(AsDynId(groupId)); + sprintf(groupId, "memg%d\n", trackerNum); + d_start_group(AsDynName(groupId)); sp244 = 20; sp23C = FALSE; for (;;) { - sp248 += 1; - mt = get_memtracker_by_id(sp248); + trackerNum += 1; + mt = get_memtracker_by_index(trackerNum); if (mt->name != NULL) { sprintf(mtStatsFmt, "%s %%6.2fk", mt->name); - mtLabel = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynId(0)); + mtLabel = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynName(0)); d_set_rel_pos(10.0f, sp244, 0.0f); d_set_parm_ptr(PARM_PTR_CHAR, gd_strdup(mtStatsFmt)); - d_add_valptr(AsDynId(0), 0, 2, (uintptr_t) &mt->total); + d_add_valptr(NULL, 0, OBJ_VALUE_FLOAT, (uintptr_t) &mt->total); mtLabel->unk30 = 3; d_add_valproc(cvrt_val_to_kb); sp23C = TRUE; @@ -3364,14 +3461,14 @@ void Unknown801A5D90(struct ObjGroup *arg0) { } } - if (sp248 >= GD_NUM_MEM_TRACKERS) { + if (trackerNum >= GD_NUM_MEM_TRACKERS) { sp240 = TRUE; break; } } - d_end_group(AsDynId(groupId)); - labelgrp = (struct ObjGroup *) d_use_obj(AsDynId(groupId)); + d_end_group(AsDynName(groupId)); + labelgrp = (struct ObjGroup *) d_use_obj(AsDynName(groupId)); if (sp23C) { memview = make_view("memview", @@ -3383,7 +3480,7 @@ void Unknown801A5D90(struct ObjGroup *arg0) { memview->colour.b = 0.0f; addto_group(arg0, &labelgrp->header); memview->flags &= ~VIEW_UPDATE; - func_801A5BE8(memview); + add_debug_view(memview); } } } @@ -3402,7 +3499,7 @@ void Unknown801A5FF8(struct ObjGroup *arg0) { d_set_scale(100.0f, 20.0f, 0.0f); d_set_type(6); d_set_colour_num(2); - label = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynId(0)); + label = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynName(0)); d_set_rel_pos(5.0f, 18.0f, 0.0f); d_set_parm_ptr(PARM_PTR_CHAR, "ITEM 1"); d_add_valptr("menu0", 0x40000, 0, (uintptr_t) NULL); @@ -3413,7 +3510,7 @@ void Unknown801A5FF8(struct ObjGroup *arg0) { d_set_scale(100.0f, 20.0f, 0.0f); d_set_type(6); d_set_colour_num(4); - label = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynId(0)); + label = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynName(0)); d_set_rel_pos(5.0f, 18.0f, 0.0f); d_set_parm_ptr(PARM_PTR_CHAR, "ITEM 2"); d_add_valptr("menu1", 0x40000, 0, (uintptr_t) NULL); @@ -3424,7 +3521,7 @@ void Unknown801A5FF8(struct ObjGroup *arg0) { d_set_scale(100.0f, 20.0f, 0.0f); d_set_type(6); d_set_colour_num(3); - label = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynId(0)); + label = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynName(0)); d_set_rel_pos(5.0f, 18.0f, 0.0f); d_set_parm_ptr(PARM_PTR_CHAR, "ITEM 3"); d_add_valptr("menu2", 0x40000, 0, (uintptr_t) NULL); @@ -3474,15 +3571,15 @@ void gd_setup_cursor(struct ObjGroup *parentgrp) { UNUSED struct ObjNet *net; // 2c sHandShape = make_shape(0, "mouse"); - sHandShape->gdDls[0] = gd_startdisplist(7); + sHandShape->dlNums[0] = gd_startdisplist(7); gd_put_sprite((u16 *) gd_texture_hand_open, 100, 100, 32, 32); gd_enddlsplist_parent(); - sHandShape->gdDls[1] = gd_startdisplist(7); + sHandShape->dlNums[1] = gd_startdisplist(7); gd_put_sprite((u16 *) gd_texture_hand_open, 100, 100, 32, 32); gd_enddlsplist_parent(); d_start_group("mouseg"); - net = (struct ObjNet *) d_makeobj(D_NET, AsDynId(0)); + net = (struct ObjNet *) d_makeobj(D_NET, AsDynName(0)); d_set_init_pos(0.0f, 0.0f, 0.0f); d_set_type(3); d_set_shapeptrptr(&sHandShape); @@ -3513,19 +3610,19 @@ void view_proc_print_timers(struct ObjView *self) { /* 254FE4 -> 255600; not called; orig name: Unknown801A6814 */ void make_timer_gadgets(void) { - struct ObjLabel *timerLabel; // 74 - struct ObjGroup *timerg; // 70 + struct ObjLabel *timerLabel; + struct ObjGroup *timerg; UNUSED u32 pad6C; - struct ObjView *timersview; // 68 - struct ObjGadget *bar1; // 64 - struct ObjGadget *bar2; // 60 - struct ObjGadget *bar3; // 5c - struct ObjGadget *bar4; // 58 - struct ObjGadget *bar5; // 54 - struct ObjGadget *bar6; // 50 - struct GdTimer *timer; // 4c - s32 i; // 48 - char timerNameBuf[0x20]; // 28 + struct ObjView *timersview; + struct ObjGadget *bar1; + struct ObjGadget *bar2; + struct ObjGadget *bar3; + struct ObjGadget *bar4; + struct ObjGadget *bar5; + struct ObjGadget *bar6; + struct GdTimer *timer; + s32 i; + char timerNameBuf[0x20]; d_start_group("timerg"); d_makeobj(D_GADGET, "bar1"); @@ -3533,81 +3630,84 @@ void make_timer_gadgets(void) { d_set_world_pos(20.0f, 5.0f, 0.0f); d_set_scale(50.0f, 5.0f, 0.0f); d_set_type(4); - d_set_parm_f(PARM_F_RANGE_LEFT, 0); - d_set_parm_f(PARM_F_RANGE_RIGHT, sTimeScaleFactor); - d_add_valptr(AsDynId(0), 0, 2, (uintptr_t) &sTimeScaleFactor); + d_set_parm_f(PARM_F_RANGE_MIN, 0); + d_set_parm_f(PARM_F_RANGE_MAX, sTimeScaleFactor); + d_add_valptr(NULL, 0, OBJ_VALUE_FLOAT, (uintptr_t) &sTimeScaleFactor); bar1 = (struct ObjGadget *) d_use_obj("bar1"); - bar1->unk5C = 1; + bar1->colourNum = COLOUR_WHITE; d_makeobj(D_GADGET, "bar2"); d_set_obj_draw_flag(OBJ_IS_GRABBALE); d_set_world_pos(70.0f, 5.0f, 0.0f); d_set_scale(50.0f, 5.0f, 0.0f); d_set_type(4); - d_set_parm_f(PARM_F_RANGE_LEFT, 0); - d_set_parm_f(PARM_F_RANGE_RIGHT, sTimeScaleFactor); - d_add_valptr(AsDynId(0), 0, 2, (uintptr_t) &sTimeScaleFactor); + d_set_parm_f(PARM_F_RANGE_MIN, 0); + d_set_parm_f(PARM_F_RANGE_MAX, sTimeScaleFactor); + d_add_valptr(NULL, 0, OBJ_VALUE_FLOAT, (uintptr_t) &sTimeScaleFactor); bar2 = (struct ObjGadget *) d_use_obj("bar2"); - bar2->unk5C = 9; + bar2->colourNum = COLOUR_PINK; d_makeobj(D_GADGET, "bar3"); d_set_obj_draw_flag(OBJ_IS_GRABBALE); d_set_world_pos(120.0f, 5.0f, 0.0f); d_set_scale(50.0f, 5.0f, 0.0f); d_set_type(4); - d_set_parm_f(PARM_F_RANGE_LEFT, 0); - d_set_parm_f(PARM_F_RANGE_RIGHT, sTimeScaleFactor); - d_add_valptr(AsDynId(0), 0, 2, (uintptr_t) &sTimeScaleFactor); + d_set_parm_f(PARM_F_RANGE_MIN, 0); + d_set_parm_f(PARM_F_RANGE_MAX, sTimeScaleFactor); + d_add_valptr(NULL, 0, OBJ_VALUE_FLOAT, (uintptr_t) &sTimeScaleFactor); bar3 = (struct ObjGadget *) d_use_obj("bar3"); - bar3->unk5C = 1; + bar3->colourNum = COLOUR_WHITE; d_makeobj(D_GADGET, "bar4"); d_set_obj_draw_flag(OBJ_IS_GRABBALE); d_set_world_pos(170.0f, 5.0f, 0.0f); d_set_scale(50.0f, 5.0f, 0.0f); d_set_type(4); - d_set_parm_f(PARM_F_RANGE_LEFT, 0); - d_set_parm_f(PARM_F_RANGE_RIGHT, sTimeScaleFactor); - d_add_valptr(AsDynId(0), 0, 2, (uintptr_t) &sTimeScaleFactor); + d_set_parm_f(PARM_F_RANGE_MIN, 0); + d_set_parm_f(PARM_F_RANGE_MAX, sTimeScaleFactor); + d_add_valptr(NULL, 0, OBJ_VALUE_FLOAT, (uintptr_t) &sTimeScaleFactor); bar4 = (struct ObjGadget *) d_use_obj("bar4"); - bar4->unk5C = 9; + bar4->colourNum = COLOUR_PINK; d_makeobj(D_GADGET, "bar5"); d_set_obj_draw_flag(OBJ_IS_GRABBALE); d_set_world_pos(220.0f, 5.0f, 0.0f); d_set_scale(50.0f, 5.0f, 0.0f); d_set_type(4); - d_set_parm_f(PARM_F_RANGE_LEFT, 0); - d_set_parm_f(PARM_F_RANGE_RIGHT, sTimeScaleFactor); - d_add_valptr(AsDynId(0), 0, 2, (uintptr_t) &sTimeScaleFactor); + d_set_parm_f(PARM_F_RANGE_MIN, 0); + d_set_parm_f(PARM_F_RANGE_MAX, sTimeScaleFactor); + d_add_valptr(NULL, 0, OBJ_VALUE_FLOAT, (uintptr_t) &sTimeScaleFactor); bar5 = (struct ObjGadget *) d_use_obj("bar5"); - bar5->unk5C = 1; + bar5->colourNum = COLOUR_WHITE; d_makeobj(D_GADGET, "bar6"); d_set_obj_draw_flag(OBJ_IS_GRABBALE); d_set_world_pos(270.0f, 5.0f, 0.0f); d_set_scale(50.0f, 5.0f, 0.0f); d_set_type(4); - d_set_parm_f(PARM_F_RANGE_LEFT, 0); - d_set_parm_f(PARM_F_RANGE_RIGHT, sTimeScaleFactor); - d_add_valptr(AsDynId(0), 0, 2, (uintptr_t) &sTimeScaleFactor); + d_set_parm_f(PARM_F_RANGE_MIN, 0); + d_set_parm_f(PARM_F_RANGE_MAX, sTimeScaleFactor); + d_add_valptr(NULL, 0, OBJ_VALUE_FLOAT, (uintptr_t) &sTimeScaleFactor); bar6 = (struct ObjGadget *) d_use_obj("bar6"); - bar6->unk5C = 9; + bar6->colourNum = COLOUR_PINK; for (i = 0; i < GD_NUM_TIMERS; i++) { sprintf(timerNameBuf, "tim%d\n", i); + timer = get_timernum(i); + d_makeobj(D_GADGET, timerNameBuf); d_set_obj_draw_flag(OBJ_IS_GRABBALE); d_set_world_pos(20.0f, (f32)((i * 15) + 15), 0.0f); d_set_scale(50.0f, 14.0f, 0); d_set_type(4); - d_set_parm_f(PARM_F_RANGE_LEFT, 0.0f); - d_set_parm_f(PARM_F_RANGE_RIGHT, 1.0f); - d_add_valptr(AsDynId(0), 0, 2, (uintptr_t) &timer->prevScaledTotal); + d_set_parm_f(PARM_F_RANGE_MIN, 0.0f); + d_set_parm_f(PARM_F_RANGE_MAX, 1.0f); + d_add_valptr(NULL, 0, OBJ_VALUE_FLOAT, (uintptr_t) &timer->prevScaledTotal); sTimerGadgets[i] = (struct ObjGadget *) d_use_obj(timerNameBuf); - sTimerGadgets[i]->unk5C = timer->unk1C; - timerLabel = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynId(0)); + sTimerGadgets[i]->colourNum = timer->gadgetColourNum; + + timerLabel = (struct ObjLabel *) d_makeobj(D_LABEL, AsDynName(0)); d_set_rel_pos(5.0f, 14.0f, 0); d_set_parm_ptr(PARM_PTR_CHAR, (void *) timer->name); d_add_valptr(timerNameBuf, 0x40000, 0, (uintptr_t) NULL); @@ -3624,42 +3724,46 @@ void make_timer_gadgets(void) { timersview->colour.b = 0.0f; timersview->flags &= ~VIEW_UPDATE; timersview->proc = view_proc_print_timers; - func_801A5BE8(timersview); + add_debug_view(timersview); return; } /* 255600 -> 255614 */ -void Unknown801A6E30(UNUSED u32 a0) { +void stub_renderer_18(UNUSED u32 a0) { } /* 255614 -> 255628 */ -void Unknown801A6E44(UNUSED u32 a0) { +void stub_renderer_19(UNUSED u32 a0) { } struct GdObj *load_dynlist(struct DynList *dynlist) { return proc_dynlist(dynlist); } -/* 255988 -> 25599C */ -void stub_801A71B8(UNUSED u32 a0) { +/** + * Unused (not called) + */ +void stub_renderer_20(UNUSED u32 a0) { } -/* 25599C -> 255EB0; not called */ +/** + * Unused (not called) + */ void func_801A71CC(struct ObjNet *net) { s32 i; // spB4 s32 j; // spB0 f32 spAC; f32 spA8; - struct GdPlaneF sp90; + struct GdBoundingBox bbox; UNUSED u32 pad8C; struct ObjZone *sp88; - register struct Links *link; // s0 (84) + register struct ListNode *link; // s0 (84) s32 sp80; // linked planes contained in zone? s32 sp7C; // linked planes in net count? - register struct Links *link1; // s1 (78) - register struct Links *link2; // s2 (74) - register struct Links *link3; // s3 (70) + register struct ListNode *link1; // s1 (78) + register struct ListNode *link2; // s2 (74) + register struct ListNode *link3; // s3 (70) struct GdVec3f sp64; UNUSED u32 pad60; struct ObjPlane *plane; // 5c @@ -3674,26 +3778,26 @@ void func_801A71CC(struct ObjNet *net) { net->unk21C = make_group(0); } - gd_print_plane("making zones for net=", &net->unkBC); + gd_print_bounding_box("making zones for net=", &net->boundingBox); - sp64.x = (ABS(net->unkBC.p0.x) + ABS(net->unkBC.p1.x)) / 16.0f; - sp64.z = (ABS(net->unkBC.p0.z) + ABS(net->unkBC.p1.z)) / 16.0f; + sp64.x = (ABS(net->boundingBox.minX) + ABS(net->boundingBox.maxX)) / 16.0f; + sp64.z = (ABS(net->boundingBox.minZ) + ABS(net->boundingBox.maxZ)) / 16.0f; - spA8 = net->unkBC.p0.z + sp64.z / 2.0f; + spA8 = net->boundingBox.minZ + sp64.z / 2.0f; for (i = 0; i < 16; i++) { - spAC = net->unkBC.p0.x + sp64.x / 2.0f; + spAC = net->boundingBox.minX + sp64.x / 2.0f; for (j = 0; j < 16; j++) { - sp90.p0.x = spAC - (sp64.x / 2.0f); - sp90.p0.y = 0.0f; - sp90.p0.z = spA8 - (sp64.z / 2.0f); + bbox.minX = spAC - (sp64.x / 2.0f); + bbox.minY = 0.0f; + bbox.minZ = spA8 - (sp64.z / 2.0f); - sp90.p1.x = spAC + (sp64.x / 2.0f); - sp90.p1.y = 0.0f; - sp90.p1.z = spA8 + (sp64.z / 2.0f); + bbox.maxX = spAC + (sp64.x / 2.0f); + bbox.maxY = 0.0f; + bbox.maxZ = spA8 + (sp64.z / 2.0f); - sp88 = make_zone(NULL, &sp90, NULL); + sp88 = make_zone(NULL, &bbox, NULL); addto_group(net->unk21C, &sp88->header); sp88->unk2C = make_group(0); @@ -3702,22 +3806,22 @@ void func_801A71CC(struct ObjNet *net) { spA8 += sp64.z; } - for (link = net->unk1CC->link1C; link != NULL; link = link->next) { + for (link = net->unk1CC->firstMember; link != NULL; link = link->next) { plane = (struct ObjPlane *) link->obj; plane->unk18 = FALSE; } i = 0; // acts as Zone N here... kinda - for (link1 = net->unk21C->link1C; link1 != NULL; link1 = link1->next) { + for (link1 = net->unk21C->firstMember; link1 != NULL; link1 = link1->next) { linkedZone = (struct ObjZone *) link1->obj; sp88 = linkedZone; sp7C = 0; sp80 = 0; - for (link2 = net->unk1CC->link1C; link2 != NULL; link2 = link2->next) { + for (link2 = net->unk1CC->firstMember; link2 != NULL; link2 = link2->next) { planeL2 = (struct ObjPlane *) link2->obj; sp7C += 1; - if (gd_plane_point_within(&planeL2->plane28, &sp88->unk14)) { + if (gd_plane_point_within(&planeL2->boundingBox, &sp88->boundingBox)) { planeL2->unk18 = TRUE; addto_group(sp88->unk2C, &planeL2->header); sp80 += 1; @@ -3725,22 +3829,22 @@ void func_801A71CC(struct ObjNet *net) { } if (sp80 == 0) { - func_8017BED0(net->unk21C, &linkedZone->header); // stubbed fatal function? + stub_objects_1(net->unk21C, &linkedZone->header); // stubbed fatal function? } else { gd_printf("%d/%d planes in zone %d\n", sp80, sp7C, i++); } } - for (link3 = net->unk1CC->link1C; link3 != NULL; link3 = link3->next) { + for (link3 = net->unk1CC->firstMember; link3 != NULL; link3 = link3->next) { planeL3 = (struct ObjPlane *) link3->obj; if (!planeL3->unk18) { - gd_print_plane("plane=", &planeL3->plane28); + gd_print_bounding_box("plane=", &planeL3->boundingBox); fatal_printf("plane not in any zones\n"); } } } /* 255EB0 -> 255EC0 */ -void stub_801A76E0(void) { +void stub_renderer_21(void) { } diff --git a/src/goddard/renderer.h b/src/goddard/renderer.h index 8cc2741a..dfd9fe78 100644 --- a/src/goddard/renderer.h +++ b/src/goddard/renderer.h @@ -24,8 +24,17 @@ enum GdProperty { GD_PROP_ZBUF_FN = 22 }; +enum GdSceneId { + GD_SCENE_YOSHI, // create yoshi? + GD_SCENE_YOSHI1, // destroy yoshi? + GD_SCENE_REGULAR_MARIO, + GD_SCENE_DIZZY_MARIO, + GD_SCENE_CAR, // create car? + GD_SCENE_CAR5 // destroy car? +}; + // data -extern s32 gGdFrameBuf; +extern s32 gGdFrameBufNum; // functions u32 get_alloc_mem_amt(void); @@ -41,7 +50,7 @@ void *gd_allocblock(u32 size); void *gd_malloc(u32 size, u8 perm); void *gd_malloc_perm(u32 size); void *gd_malloc_temp(u32 size); -void func_8019BD0C(s32 dlNum, s32 gfxIdx); +void draw_indexed_dl(s32 dlNum, s32 gfxIdx); void gd_add_to_heap(void *addr, u32 size); void gdm_init(void *blockpool, u32 size); void gdm_setup(void); @@ -49,37 +58,37 @@ void gdm_maketestdl(s32 id); void gd_vblank(void); void gd_copy_p1_contpad(OSContPad *p1cont); s32 gd_sfx_to_play(void); -void *gdm_gettestdl(s32 id); +Gfx *gdm_gettestdl(s32 id); void gd_draw_rect(f32 ulx, f32 uly, f32 lrx, f32 lry); void gd_draw_border_rect(f32 ulx, f32 uly, f32 lrx, f32 lry); -void gd_set_fill(struct GdColour *colour); +void gd_dl_set_fill(struct GdColour *colour); void stash_current_gddl(void); void pop_gddl_stash(void); s32 gd_startdisplist(s32 memarea); s32 gd_enddlsplist_parent(void); -void add_mat4_load_to_dl(Mat4f *mtx); -void idn_mtx_push_gddl(void); -void pop_mtx_gddl(void); -void translate_mtx_gddl(f32 x, f32 y, f32 z); -void translate_load_mtx_gddl(f32 x, f32 y, f32 z); -void func_8019F258(f32 x, f32 y, f32 z); +void gd_dl_load_matrix(Mat4f *mtx); +void gd_dl_push_matrix(void); +void gd_dl_pop_matrix(void); +void gd_dl_mul_trans_matrix(f32 x, f32 y, f32 z); +void gd_dl_load_trans_matrix(f32 x, f32 y, f32 z); +void gd_dl_scale(f32 x, f32 y, f32 z); void func_8019F2C4(f32 arg0, s8 arg1); -void func_8019F318(struct ObjCamera *cam, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7); +void gd_dl_lookat(struct ObjCamera *cam, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7); void check_tri_display(s32 vtxcount); -Vtx *make_vtx_if_new(f32 x, f32 y, f32 z, f32 alpha); +Vtx *gd_dl_make_vertex(f32 x, f32 y, f32 z, f32 alpha); void func_8019FEF0(void); -void add_tri_to_dl(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 x3, f32 y3, f32 z3); +void gd_dl_make_triangle(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 x3, f32 y3, f32 z3); void func_801A0038(void); -void func_801A0070(void); -void func_801A02B8(f32 arg0); +void gd_dl_flush_vertices(void); +void set_render_alpha(f32 arg0); void set_light_id(s32 index); void set_light_num(s32 n); s32 create_mtl_gddl(s32 mtlType); void branch_to_gddl(s32 dlNum); -void func_801A0478(s32, struct ObjCamera *, struct GdVec3f *, struct GdVec3f *, struct GdVec3f *, struct GdColour *); -void func_801A0478(s32 idx, struct ObjCamera *cam, UNUSED struct GdVec3f *arg2, UNUSED struct GdVec3f *arg3, +void gd_dl_hilite(s32, struct ObjCamera *, struct GdVec3f *, struct GdVec3f *, struct GdVec3f *, struct GdColour *); +void gd_dl_hilite(s32 idx, struct ObjCamera *cam, UNUSED struct GdVec3f *arg2, UNUSED struct GdVec3f *arg3, struct GdVec3f *arg4, struct GdColour *colour); -s32 func_801A086C(s32 id, struct GdColour *colour, s32 material); +s32 gd_dl_material_lighting(s32 id, struct GdColour *colour, s32 material); void set_Vtx_norm_buf_1(struct GdVec3f *norm); void set_Vtx_norm_buf_2(struct GdVec3f *norm); void set_gd_mtx_parameters(s32 params); @@ -95,19 +104,19 @@ void gd_create_perspective_matrix(f32 fovy, f32 aspect, f32 near, f32 far); s32 setup_view_buffers(const char *name, struct ObjView *view, UNUSED s32 ulx, UNUSED s32 uly, UNUSED s32 lrx, UNUSED s32 lry); void gd_init_controllers(void); -void func_801A43DC(struct GdObj *obj); //apply to OBJ_TYPE_VIEWS -void *func_801A43F0(UNUSED const char *menufmt, ...); // TUI code..? query_user? doesn't actually return anything... maybe it returned a "menu *"? -void func_801A4410(void *arg0); // function looks like it got various controller/input attributes..? -void func_801A4424(void *arg0); // TUI stuff? +void stub_renderer_6(struct GdObj *obj); //apply to OBJ_TYPE_VIEWS +long defpup(UNUSED const char *menufmt, ...); +void menu_cb_control_type(u32); +void menu_cb_recalibrate_controller(u32); void func_801A4438(f32 x, f32 y, f32 z); -void func_801A48C4(u32 arg0); -void func_801A48D8(UNUSED char *s); +void stub_renderer_10(u32 arg0); +void stub_draw_label_text(UNUSED char *s); void set_active_view(struct ObjView *v); void func_801A520C(void); void gd_init(void); -void func_801A5998(s8 *arg0); /* convert LE bytes to BE word? */ -void func_801A59AC(UNUSED void *arg0); -void func_801A59C0(UNUSED s8 *arg0); /* convert LE bytes to BE f32? */ +void stub_renderer_12(s8 *arg0); /* convert LE bytes to BE word? */ +void stub_renderer_13(UNUSED void *arg0); +void stub_renderer_14(UNUSED s8 *arg0); /* convert LE bytes to BE f32? */ void init_pick_buf(s16 *buf, s32 len); void store_in_pickbuf(s16 data); s32 get_cur_pickbuf_offset(UNUSED s16 *arg0); diff --git a/src/goddard/sfx.c b/src/goddard/sfx.c index 03a6afad..5d3b8dc7 100644 --- a/src/goddard/sfx.c +++ b/src/goddard/sfx.c @@ -2,25 +2,37 @@ #include "sfx.h" -static u32 sSfxToPlay; -static u32 sLastPlayedSfx; +static u32 sCurrSfx; // bitset of currently playing sound effects +static u32 sPrevSfx; // bitset of sound effects that were playing on the previous frame +/** + * Stops all sound effects + */ void gd_reset_sfx(void) { - sLastPlayedSfx = GD_SFX_NONE; - sSfxToPlay = GD_SFX_NONE; + sPrevSfx = GD_SFX_NONE; + sCurrSfx = GD_SFX_NONE; } +/** + * Returns a bitset of the newly started sound effects. + * This is used by geo_draw_mario_head_goddard to start new sounds. + */ u32 gd_new_sfx_to_play(void) { - return ~sLastPlayedSfx & sSfxToPlay; + return ~sPrevSfx & sCurrSfx; } -void gd_sfx_played(void) { - sLastPlayedSfx = sSfxToPlay; - sSfxToPlay = GD_SFX_NONE; +/** + * Called at the start of a frame. + */ +void gd_sfx_update(void) { + sPrevSfx = sCurrSfx; + sCurrSfx = GD_SFX_NONE; } -/* Add GdSfx to queue to be played. Note that only the SFX - * with the lowest value from the enum is played on a given frame **/ +/** + * Marks a sound effect to be played. This must be called repeatedly once per + * frame to keep the sound effect playing. + */ void gd_play_sfx(enum GdSfx sfx) { - sSfxToPlay |= sfx; + sCurrSfx |= sfx; } diff --git a/src/goddard/sfx.h b/src/goddard/sfx.h index d75ca38a..8865afc6 100644 --- a/src/goddard/sfx.h +++ b/src/goddard/sfx.h @@ -19,7 +19,7 @@ enum GdSfx { // functions void gd_reset_sfx(void); u32 gd_new_sfx_to_play(void); -void gd_sfx_played(void); +void gd_sfx_update(void); void gd_play_sfx(enum GdSfx sfx); #endif // GD_SFX_H diff --git a/src/goddard/shape_helper.c b/src/goddard/shape_helper.c index 60dd1144..a8d014d6 100644 --- a/src/goddard/shape_helper.c +++ b/src/goddard/shape_helper.c @@ -20,84 +20,68 @@ #include #endif -// types -struct UnkData { - struct GdTriangleF tri; - s32 a, b; - struct UnkData *self; -}; - // data struct ObjGroup *gMarioFaceGrp = NULL; // @ 801A82E0; returned by load_dynlist -struct ObjShape *D_801A82E4 = NULL; // Shape used for drawing lights? -static struct ObjShape *D_801A82E8 = NULL; // returned by load_dynlist +struct ObjShape *gSpotShape = NULL; // Shape used for drawing lights? +static struct ObjShape *sGrabJointTestShape = NULL; // Test shape for showing grab joints. This isn't rendered due to make_grabber_joint setting the drawFlags to OBJ_INVISIBLE. struct ObjShape *gShapeRedSpark = NULL; // @ 801A82EC struct ObjShape *gShapeSilverSpark = NULL; // @ 801A82F0 struct ObjShape *gShapeRedStar = NULL; // @ 801A82F4 struct ObjShape *gShapeSilverStar = NULL; // @ 801A82F8 -static struct UnkData sUnref801A82FC = { { { - 1.0, - 1.0, - 1.0, - }, - { 0.0, 0.0, 0.0 }, - { 0.0, 0.0, 0.0 } }, - 1, - 4, - &sUnref801A82FC }; -static struct UnkData sUnref801A832C = { { { - 1.0, - 1.0, - 1.0, - }, - { 0.0, 0.0, 0.0 }, - { 0.0, 0.0, 0.0 } }, - 1, - 4, - &sUnref801A832C }; -static struct UnkData sUnref801A835C = { { { - 1.0, - 1.0, - 1.0, - }, - { 0.0, 0.0, 0.0 }, - { 0.0, 0.0, 0.0 } }, - 1, - 4, - &sUnref801A835C }; + +// Not sure what this data is, but it looks like stub animation data + +static struct GdAnimTransform unusedAnimData1[] = { + { {1.0, 1.0, 1.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0} }, +}; + +static struct AnimDataInfo unusedAnim1 = { ARRAY_COUNT(unusedAnimData1), GD_ANIM_SCALE3F_ROT3F_POS3F_2, unusedAnimData1 }; + +static struct GdAnimTransform unusedAnimData2[] = { + { {1.0, 1.0, 1.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0} }, +}; + +static struct AnimDataInfo unusedAnim2 = { ARRAY_COUNT(unusedAnimData2), GD_ANIM_SCALE3F_ROT3F_POS3F_2, unusedAnimData2 }; + +static struct GdAnimTransform unusedAnimData3[] = { + { {1.0, 1.0, 1.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0} }, +}; + +static struct AnimDataInfo unusedAnim3 = { ARRAY_COUNT(unusedAnimData3), GD_ANIM_SCALE3F_ROT3F_POS3F_2, unusedAnimData3 }; + static s32 sUnref801A838C[6] = { 0 }; -struct ObjShape *D_801A83A4 = NULL; +struct ObjShape *sSimpleShape = NULL; static s32 sUnref801A83A8[31] = { 0 }; -static struct DynList sSimpleDylist[8] = { - StartList(), +static struct DynList sSimpleDylist[8] = { // unused + BeginList(), StartGroup("simpleg"), MakeDynObj(D_NET, "simple"), SetType(3), - SetShapePtrPtr(&D_801A83A4), + SetShapePtrPtr(&sSimpleShape), EndGroup("simpleg"), UseObj("simpleg"), - StopList(), + EndList(), }; static struct DynList sDynlist801A84E4[3] = { - StartList(), + BeginList(), SetFlag(0x1800), - StopList(), + EndList(), }; static struct DynList sDynlist801A85B3[5] = { - StartList(), JumpToList(sDynlist801A84E4), SetFlag(0x400), SetFriction(0.04, 0.01, 0.01), - StopList(), + BeginList(), CallList(sDynlist801A84E4), SetFlag(0x400), SetFriction(0.04, 0.01, 0.01), + EndList(), }; static struct DynList sDynlist801A85A4[4] = { - StartList(), - JumpToList(sDynlist801A84E4), + BeginList(), + CallList(sDynlist801A84E4), SetFriction(0.04, 0.01, 0.01), - StopList(), + EndList(), }; static struct DynList sDynlist801A8604[4] = { - StartList(), - JumpToList(sDynlist801A84E4), + BeginList(), + CallList(sDynlist801A84E4), SetFriction(0.005, 0.005, 0.005), - StopList(), + EndList(), }; static f64 D_801A8668 = 0.0; @@ -129,7 +113,7 @@ static struct GdVec3f sVertexTranslateOffset; static u8 sUnrefSpaceCD8[0x30]; // @ 801BACD8 static struct ObjGroup *D_801BAD08; // group of planes from make_netfromshape static u8 sUnrefSpaceD10[0x20]; // @ 801BAD10 -static struct GdVec3f D_801BAD30; // printed with "c=" +static struct GdVec3f sShapeCenter; // printed with "c=" static u8 sUnrefSpaceD40[0x120]; // @ 801BAD40 // Forward Declarations @@ -143,52 +127,50 @@ void func_80197280(void) { gGdLightGroup = make_group(0); } -/* @ 245A90 for 0x24C; orig name: func_801972C0 */ +/** + * Computes the normal vector for a face based on three of its vertices. + */ void calc_face_normal(struct ObjFace *face) { UNUSED u32 pad5C; - struct GdVec3f sp50; - struct GdVec3f sp44; - struct GdVec3f sp38; - struct GdVec3f sp2C; // Normal? - struct ObjVertex *sp28; - struct ObjVertex *sp24; - struct ObjVertex *sp20; + struct GdVec3f p1; + struct GdVec3f p2; + struct GdVec3f p3; + struct GdVec3f normal; + struct ObjVertex *vtx1; + struct ObjVertex *vtx2; + struct ObjVertex *vtx3; UNUSED u32 pad1C; - f32 sp18; + f32 mul = 1000.0f; - sp18 = 1000.0f; - add_to_stacktrace("calc_facenormal"); + imin("calc_facenormal"); - if (face->vtxCount > 2) { - sp28 = face->vertices[0]; - sp50.x = sp28->pos.x; // Obj->Vec3f at 0x20 - sp50.y = sp28->pos.y; - sp50.z = sp28->pos.z; + if (face->vtxCount >= 3) { // need at least three points to compute a normal + vtx1 = face->vertices[0]; + p1.x = vtx1->pos.x; + p1.y = vtx1->pos.y; + p1.z = vtx1->pos.z; - sp24 = face->vertices[1]; - sp44.x = sp24->pos.x; - sp44.y = sp24->pos.y; - sp44.z = sp24->pos.z; + vtx2 = face->vertices[1]; + p2.x = vtx2->pos.x; + p2.y = vtx2->pos.y; + p2.z = vtx2->pos.z; - sp20 = face->vertices[2]; - sp38.x = sp20->pos.x; - sp38.y = sp20->pos.y; - sp38.z = sp20->pos.z; + vtx3 = face->vertices[2]; + p3.x = vtx3->pos.x; + p3.y = vtx3->pos.y; + p3.z = vtx3->pos.z; - // Calculate normal cross product ? - sp2C.x = - (((sp44.y - sp50.y) * (sp38.z - sp44.z)) - ((sp44.z - sp50.z) * (sp38.y - sp44.y))) * sp18; - // 245C04 - sp2C.y = - (((sp44.z - sp50.z) * (sp38.x - sp44.x)) - ((sp44.x - sp50.x) * (sp38.z - sp44.z))) * sp18; - // 245C44 - sp2C.z = - (((sp44.x - sp50.x) * (sp38.y - sp44.y)) - ((sp44.y - sp50.y) * (sp38.x - sp44.x))) * sp18; - // 245C84 - gd_normalize_vec3f(&sp2C); - face->normal.x = sp2C.x; - face->normal.y = sp2C.y; - face->normal.z = sp2C.z; + // calculate the cross product of edges (p2 - p1) and (p3 - p2) + // not sure why each component is multiplied by 1000. maybe to avoid loss of precision when normalizing? + normal.x = (((p2.y - p1.y) * (p3.z - p2.z)) - ((p2.z - p1.z) * (p3.y - p2.y))) * mul; + normal.y = (((p2.z - p1.z) * (p3.x - p2.x)) - ((p2.x - p1.x) * (p3.z - p2.z))) * mul; + normal.z = (((p2.x - p1.x) * (p3.y - p2.y)) - ((p2.y - p1.y) * (p3.x - p2.x))) * mul; + + gd_normalize_vec3f(&normal); + + face->normal.x = normal.x; + face->normal.y = normal.y; + face->normal.z = normal.z; } imout(); } @@ -223,7 +205,7 @@ struct ObjVertex *gd_make_vertex(f32 x, f32 y, f32 z) { struct ObjFace *make_face_with_colour(f32 r, f32 g, f32 b) { struct ObjFace *newFace; - add_to_stacktrace("make_face"); + imin("make_face"); newFace = (struct ObjFace *) make_object(OBJ_TYPE_FACES); newFace->colour.r = r; @@ -252,7 +234,7 @@ struct ObjFace *make_face_with_material(struct ObjMaterial *mtl) { } /* @ 245F0C for 0x88 */ -void Unknown8019773C(struct ObjFace *face, struct ObjVertex *vtx1, struct ObjVertex *vtx2, +void add_4_vertices_to_face(struct ObjFace *face, struct ObjVertex *vtx1, struct ObjVertex *vtx2, struct ObjVertex *vtx3, struct ObjVertex *vtx4) { face->vertices[0] = vtx1; face->vertices[1] = vtx2; @@ -272,7 +254,9 @@ void add_3_vtx_to_face(struct ObjFace *face, struct ObjVertex *vtx1, struct ObjV calc_face_normal(face); } -/* @ 24600C for 0x198 */ +/** + * Creates an `ObjShape` object + */ struct ObjShape *make_shape(s32 flag, const char *name) { struct ObjShape *newShape; struct ObjShape *curShapeHead; @@ -301,18 +285,18 @@ struct ObjShape *make_shape(s32 flag, const char *name) { newShape->vtxCount = 0; newShape->faceCount = 0; - newShape->gdDls[0] = 0; - newShape->gdDls[1] = 0; + newShape->dlNums[0] = 0; + newShape->dlNums[1] = 0; newShape->unk3C = 0; newShape->faceGroup = NULL; /* whoops, NULL-ed twice */ - newShape->unk58 = 1.0f; + newShape->alpha = 1.0f; newShape->vtxGroup = NULL; newShape->faceGroup = NULL; newShape->mtlGroup = NULL; newShape->unk30 = 0; - newShape->gdDls[2] = 0; + newShape->unk50 = 0; return newShape; } @@ -418,7 +402,7 @@ s32 getfloat(f32 *floatPtr) { u32 sp34; f64 parsedDouble; - add_to_stacktrace("getfloat"); + imin("getfloat"); if (is_line_end(get_current_buf_char())) { fatal_printf("getfloat(): Unexpected EOL"); @@ -454,7 +438,7 @@ s32 getint(s32 *intPtr) { u32 bufCsr; char curChar; - add_to_stacktrace("getint"); + imin("getint"); if (is_line_end(get_current_buf_char())) { fatal_printf("getint(): Unexpected EOL"); @@ -575,7 +559,7 @@ void translate_verts_in_shape(struct ObjShape *shape, f32 x, f32 y, f32 z) { void Unknown80198444(struct ObjVertex *vtx) { f64 distance; - func_8017BD20(vtx); + add_obj_pos_to_bounding_box(&vtx->header); distance = vtx->pos.x * vtx->pos.x + vtx->pos.y * vtx->pos.y + vtx->pos.z * vtx->pos.z; @@ -590,9 +574,9 @@ void Unknown80198444(struct ObjVertex *vtx) { /* @ 246CF4 for 0xc4 */ void Unknown80198524(struct ObjVertex *vtx) { - vtx->pos.x -= D_801BAD30.x; - vtx->pos.y -= D_801BAD30.y; - vtx->pos.z -= D_801BAD30.z; + vtx->pos.x -= sShapeCenter.x; + vtx->pos.y -= sShapeCenter.y; + vtx->pos.z -= sShapeCenter.z; vtx->pos.x /= D_801A8668; vtx->pos.y /= D_801A8668; @@ -601,19 +585,19 @@ void Unknown80198524(struct ObjVertex *vtx) { /* @ 246DB8 for 0x11c */ void Unknown801985E8(struct ObjShape *shape) { - struct GdPlaneF sp18; + struct GdBoundingBox bbox; D_801A8668 = 0.0; - func_8017BCB0(); + reset_bounding_box(); apply_to_obj_types_in_group(OBJ_TYPE_VERTICES, (applyproc_t) Unknown80198444, shape->vtxGroup); - func_8017BE60(&sp18); + get_some_bounding_box(&bbox); - D_801BAD30.x = (f32)((sp18.p0.x + sp18.p1.x) / 2.0); //? 2.0f - D_801BAD30.y = (f32)((sp18.p0.y + sp18.p1.y) / 2.0); //? 2.0f - D_801BAD30.z = (f32)((sp18.p0.z + sp18.p1.z) / 2.0); //? 2.0f + sShapeCenter.x = (f32)((bbox.minX + bbox.maxX) / 2.0); //? 2.0f + sShapeCenter.y = (f32)((bbox.minY + bbox.maxY) / 2.0); //? 2.0f + sShapeCenter.z = (f32)((bbox.minZ + bbox.maxZ) / 2.0); //? 2.0f - gd_print_vec("c=", &D_801BAD30); + gd_print_vec("c=", &sShapeCenter); apply_to_obj_types_in_group(OBJ_TYPE_VERTICES, (applyproc_t) Unknown80198524, shape->vtxGroup); } @@ -637,7 +621,7 @@ void get_3DG1_shape(struct ObjShape *shape) { struct ObjMaterial *mtl; shape->mtlGroup = make_group(0); - add_to_stacktrace("get_3DG1_shape"); + imin("get_3DG1_shape"); vtxPtrArr = gd_malloc_perm(72000 * sizeof(struct ObjVertex *)); // 288,000 = 72,000 * 4 facePtrArr = gd_malloc_perm(76000 * sizeof(struct ObjFace *)); // 304,000 = 76,000 * 4 @@ -837,13 +821,13 @@ struct ObjGroup *group_faces_in_mtl_grp(struct ObjGroup *mtlGroup, struct GdObj struct ObjMaterial *curObjAsMtl; struct ObjGroup *newGroup; struct GdObj *curObj; - register struct Links *grpLink; + register struct ListNode *node; struct GdObj *curLinkedObj; newGroup = make_group(0); - for (grpLink = mtlGroup->link1C; grpLink != NULL; grpLink = grpLink->next) { - curLinkedObj = grpLink->obj; + for (node = mtlGroup->firstMember; node != NULL; node = node->next) { + curLinkedObj = node->obj; curObjAsMtl = (struct ObjMaterial *) curLinkedObj; curObj = fromObj; @@ -867,11 +851,11 @@ struct ObjGroup *group_faces_in_mtl_grp(struct ObjGroup *mtlGroup, struct GdObj /* @ 247884 for 0x13c; orig name: func_801990B4 */ struct ObjMaterial *find_or_add_new_mtl(struct ObjGroup *group, UNUSED s32 a1, f32 r, f32 g, f32 b) { struct ObjMaterial *newMtl; - register struct Links *curLink; + register struct ListNode *node; struct ObjMaterial *foundMtl; - for (curLink = group->link1C; curLink != NULL; curLink = curLink->next) { - foundMtl = (struct ObjMaterial *) curLink->obj; + for (node = group->firstMember; node != NULL; node = node->next) { + foundMtl = (struct ObjMaterial *) node->obj; if (foundMtl->header.type == OBJ_TYPE_MATERIALS) { if (foundMtl->Kd.r == r) { @@ -950,14 +934,14 @@ void read_ARK_shape(struct ObjShape *shape, char *fileName) { } gd_fread(fileInfo.bytes, 0x48, 1, sGdShapeFile); - func_801A5998(&fileInfo.bytes[0x40]); // face count? - func_801A5998(&fileInfo.bytes[0x44]); + stub_renderer_12(&fileInfo.bytes[0x40]); // face count? + stub_renderer_12(&fileInfo.bytes[0x44]); while (fileInfo.data.word40-- > 0) { gd_fread(faceInfo.bytes, 0x10, 1, sGdShapeFile); - func_801A59C0(&faceInfo.bytes[0x0]); - func_801A59C0(&faceInfo.bytes[0x4]); - func_801A59C0(&faceInfo.bytes[0x8]); + stub_renderer_14(&faceInfo.bytes[0x0]); + stub_renderer_14(&faceInfo.bytes[0x4]); + stub_renderer_14(&faceInfo.bytes[0x8]); sp48.x = faceInfo.data.v[0]; sp48.y = faceInfo.data.v[1]; @@ -965,14 +949,14 @@ void read_ARK_shape(struct ObjShape *shape, char *fileName) { sp34 = find_or_add_new_mtl(shape->mtlGroup, 0, sp48.x, sp48.y, sp48.z); - func_801A5998(&faceInfo.bytes[0xC]); + stub_renderer_12(&faceInfo.bytes[0xC]); while (faceInfo.data.faceCount-- > 0) { shape->faceCount++; gd_fread(face.bytes, 0x10, 1, sGdShapeFile); - func_801A59C0(&face.bytes[0x4]); // read word as f32? - func_801A59C0(&face.bytes[0x8]); - func_801A59C0(&face.bytes[0xC]); + stub_renderer_14(&face.bytes[0x4]); // read word as f32? + stub_renderer_14(&face.bytes[0x8]); + stub_renderer_14(&face.bytes[0xC]); sp44 = make_face_with_material(sp34); @@ -980,7 +964,7 @@ void read_ARK_shape(struct ObjShape *shape, char *fileName) { sp40 = sp44; } - func_801A5998(&face.bytes[0x0]); + stub_renderer_12(&face.bytes[0x0]); if (face.data.vtxCount > 3) { while (face.data.vtxCount-- > 0) { @@ -992,12 +976,12 @@ void read_ARK_shape(struct ObjShape *shape, char *fileName) { while (face.data.vtxCount-- > 0) { shape->vtxCount++; gd_fread(vtx.bytes, 0x18, 1, sGdShapeFile); - func_801A59C0(&vtx.bytes[0x00]); - func_801A59C0(&vtx.bytes[0x04]); - func_801A59C0(&vtx.bytes[0x08]); - func_801A59C0(&vtx.bytes[0x0C]); - func_801A59C0(&vtx.bytes[0x10]); - func_801A59C0(&vtx.bytes[0x14]); + stub_renderer_14(&vtx.bytes[0x00]); + stub_renderer_14(&vtx.bytes[0x04]); + stub_renderer_14(&vtx.bytes[0x08]); + stub_renderer_14(&vtx.bytes[0x0C]); + stub_renderer_14(&vtx.bytes[0x10]); + stub_renderer_14(&vtx.bytes[0x14]); func_801980E8(vtx.data.v); sp3C = gd_make_vertex(vtx.data.v[0], vtx.data.v[1], vtx.data.v[2]); @@ -1157,16 +1141,16 @@ struct ObjShape *make_grid_shape(enum ObjTypeFlag gridType, s32 a1, s32 a2, s32 if (gridType == OBJ_TYPE_PARTICLES) { for (parI = 0; parI <= a3; parI++) { struct ObjParticle* p1 = ((struct ObjParticle *) objBuf[parI][0]); - if (p1 != NULL) { p1->unk54 |= 2; } + if (p1 != NULL) { p1->flags |= 2; } struct ObjParticle* p2 = ((struct ObjParticle *) objBuf[parI][a4]); - if (p2 != NULL) { p2->unk54 |= 2; } + if (p2 != NULL) { p2->flags |= 2; } } for (parI = 0; parI <= a4; parI++) { struct ObjParticle* p1 = ((struct ObjParticle *) objBuf[0][parI]); - if (p1 != NULL) { p1->unk54 |= 2; } + if (p1 != NULL) { p1->flags |= 2; } struct ObjParticle* p2 = ((struct ObjParticle *) objBuf[a3][parI]); - if (p2 != NULL) { p2->unk54 |= 2; } + if (p2 != NULL) { p2->flags |= 2; } } } @@ -1187,7 +1171,6 @@ void Unknown80199E44(UNUSED s32 a0, struct GdObj *a1, struct GdObj *a2, UNUSED s /* @ 248658 for 0x5c */ void Unknown80199E88(struct ObjFace *face) { - // TODO: remove cast when make_plane is updated D_801BAC74 = make_plane(FALSE, face); if (D_801BAC78 == NULL) { @@ -1212,226 +1195,242 @@ struct ObjNet *make_netfromshape(struct ObjShape *shape) { return newNet; } -/* @ 248770 for 0xc8; orig name: Proc80199FA0 */ +/** + * Controls the dizzy (game over) animation of Mario's head. + */ void animate_mario_head_gameover(struct ObjAnimator *self) { - switch (self->unk4C) { + switch (self->state) { case 0: - self->unk28 = 1.0f; - self->unk20 = 1; - self->unk4C = 1; + self->frame = 1.0f; + self->animSeqNum = 1; // game over anim sequence + self->state = 1; break; case 1: - self->unk28 += 1.0f; - if (self->unk28 == 166.0f) { - self->unk28 = 69.0f; - self->unk4C = 4; - self->fn48 = &animate_mario_head_normal; - self->unk20 = 0; + self->frame += 1.0f; + // After the gameover animation ends, switch to the normal animation + if (self->frame == 166.0f) { + self->frame = 69.0f; + self->state = 4; + self->controlFunc = animate_mario_head_normal; + self->animSeqNum = 0; // normal anim sequence } break; } } -/* @ 248838 for 0x310; orig name: Proc8019A068 */ +/** + * Controls the normal animation of Mario's head. This functions like a state machine. + */ void animate_mario_head_normal(struct ObjAnimator *self) { s32 state = 0; // TODO: label these states - s32 aBtnPressed = gGdCtrl.btnApressed; + s32 aBtnPressed = gGdCtrl.dragging; - switch (self->unk4C) { + switch (self->state) { case 0: - self->unk28 = 1.0f; - self->unk20 = 0; + // initialize? + self->frame = 1.0f; + self->animSeqNum = 0; // normal anim sequence state = 2; - self->unk50 = 5; + self->nods = 5; break; case 2: if (aBtnPressed) { state = 5; } - self->unk28 += 1.0f; + self->frame += 1.0f; - if (self->unk28 == 810.0f) { - self->unk28 = 750.0f; - self->unk50 -= 1; - if (self->unk50 == 0) { + if (self->frame == 810.0f) { + self->frame = 750.0f; + self->nods -= 1; + if (self->nods == 0) { state = 3; } } break; case 3: - self->unk28 += 1.0f; + self->frame += 1.0f; - if (self->unk28 == 820.0f) { - self->unk28 = 69.0f; + if (self->frame == 820.0f) { + self->frame = 69.0f; state = 4; } break; case 4: - self->unk28 += 1.0f; + self->frame += 1.0f; - if (self->unk28 == 660.0f) { - self->unk28 = 661.0f; + if (self->frame == 660.0f) { + self->frame = 661.0f; state = 2; - self->unk50 = 5; + self->nods = 5; } break; case 5: - if (self->unk28 == 660.0f) { + if (self->frame == 660.0f) { state = 7; - } else if (self->unk28 > 660.0f) { - self->unk28 -= 1.0f; - } else if (self->unk28 < 660.0f) { - self->unk28 += 1.0f; + } else if (self->frame > 660.0f) { + self->frame -= 1.0f; + } else if (self->frame < 660.0f) { + self->frame += 1.0f; } - self->unk54 = 150; + self->stillTimer = 150; break; - case 7: + case 7: // Mario is staying still while his eyes follow the cursor if (aBtnPressed) { - self->unk54 = 300; + self->stillTimer = 300; } else { - self->unk54--; - if (self->unk54 == 0) { + self->stillTimer--; + if (self->stillTimer == 0) { state = 6; } } - self->unk28 = 660.0f; + self->frame = 660.0f; break; case 6: state = 2; - self->unk50 = 5; + self->nods = 5; break; } if (state != 0) { - self->unk4C = state; + self->state = state; } } -/* @ 248B48 for 0x740; orig name: func_8019A378 */ +/** + * Loads the Mario head from `dynlist_mario_master`, sets up grabbers, and makes + * sparkle particles + */ s32 load_mario_head(void (*aniFn)(struct ObjAnimator *)) { struct ObjNet *sp54; // net made with sp48 group UNUSED u8 pad4C[0x54 - 0x4c]; struct ObjGroup *sp48; // Joint group UNUSED u8 pad40[0x48 - 0x40]; - struct ObjGroup *sp3C; + struct ObjGroup *mainShapesGrp; struct GdObj *sp38; // object list head before making a bunch of joints - struct GdObj *sp34; // d_use_obj returned - struct ObjJoint *sp30; // created joint pointer - struct ObjCamera *sp2C; // dNewCamera - struct ObjAnimator *sp28; // dNewAnim - struct ObjParticle *sp24; // particle (?) + struct GdObj *faceJoint; // joint on the face that `grabberJoint` pulls + struct ObjJoint *grabberJoint; // joint that's dragged by the cursor + struct ObjCamera *camera; + struct ObjAnimator *animator; + struct ObjParticle *particle; + + // Load Mario head from the dynlist start_memtracker("mario face"); - d_copystr_to_idbuf("l"); + d_set_name_suffix("l"); // add "l" to the end of all dynobj names generated by the dynlist, for some reason - dynid_is_int(TRUE); - sp28 = (struct ObjAnimator *) d_makeobj(D_ANIMATOR, AsDynId(1001)); - sp28->fn48 = aniFn; - dynid_is_int(FALSE); + d_use_integer_names(TRUE); + animator = (struct ObjAnimator *) d_makeobj(D_ANIMATOR, AsDynName(DYNOBJ_MARIO_MAIN_ANIMATOR)); + animator->controlFunc = aniFn; + d_use_integer_names(FALSE); // FIXME: make segment address work once seg4 is disassembled gMarioFaceGrp = (struct ObjGroup *) load_dynlist(dynlist_mario_master); stop_memtracker("mario face"); - sp2C = (struct ObjCamera *) d_makeobj(D_CAMERA, NULL); + // Make camera + + camera = (struct ObjCamera *) d_makeobj(D_CAMERA, NULL); d_set_rel_pos(0.0f, 200.0f, 2000.0f); d_set_world_pos(0.0f, 200.0f, 2000.0f); d_set_flags(4); - sp2C->unk34.x = 0.0f; - sp2C->unk34.y = 200.0f; - sp2C->unk34.z = 0.0f; + camera->lookAt.x = 0.0f; + camera->lookAt.y = 200.0f; + camera->lookAt.z = 0.0f; - addto_group(gMarioFaceGrp, &sp2C->header); - addto_group(gMarioFaceGrp, &sp28->header); + addto_group(gMarioFaceGrp, &camera->header); + addto_group(gMarioFaceGrp, &animator->header); - d_copystr_to_idbuf(NULL); - sp24 = make_particle(0, 1, 0.0f, 0.0f, 0.0f); - sp24->unk60 = 3; - sp24->unk64 = 3; - sp24->unkBC = &sp2C->header; - sp24->unk1C = gShapeSilverSpark; - addto_group(gGdLightGroup, &sp24->header); + d_set_name_suffix(NULL); // stop adding "l" to generated dynobj names - sp24 = make_particle(0, 1, 0.0f, 0.0f, 0.0f); - sp24->unk60 = 3; - sp24->unk64 = 2; - sp24->unkBC = d_use_obj("N228l"); // probably a camera - sp24->unk1C = gShapeSilverSpark; - addto_group(gGdLightGroup, &sp24->header); + // Make sparkle particles - sp24 = make_particle(0, 2, 0.0f, 0.0f, 0.0f); - sp24->unk60 = 3; - sp24->unk64 = 2; - sp24->unkBC = d_use_obj("N231l"); // probably a camera - sp24->unk1C = gShapeRedSpark; - addto_group(gGdLightGroup, &sp24->header); + particle = make_particle(0, COLOUR_WHITE, 0.0f, 0.0f, 0.0f); + particle->unk60 = 3; + particle->unk64 = 3; + particle->attachedToObj = &camera->header; + particle->shapePtr = gShapeSilverSpark; + addto_group(gGdLightGroup, &particle->header); - sp3C = (struct ObjGroup *) d_use_obj("N1000l"); - create_gddl_for_shapes(sp3C); + particle = make_particle(0, COLOUR_WHITE, 0.0f, 0.0f, 0.0f); + particle->unk60 = 3; + particle->unk64 = 2; + particle->attachedToObj = d_use_obj("N228l"); // DYNOBJ_SILVER_STAR_LIGHT + particle->shapePtr = gShapeSilverSpark; + addto_group(gGdLightGroup, &particle->header); + + particle = make_particle(0, COLOUR_RED, 0.0f, 0.0f, 0.0f); + particle->unk60 = 3; + particle->unk64 = 2; + particle->attachedToObj = d_use_obj("N231l"); // DYNOBJ_RED_STAR_LIGHT + particle->shapePtr = gShapeRedSpark; + addto_group(gGdLightGroup, &particle->header); + + mainShapesGrp = (struct ObjGroup *) d_use_obj("N1000l"); // DYNOBJ_MARIO_MAIN_SHAPES_GROUP + create_gddl_for_shapes(mainShapesGrp); sp38 = gGdObjectList; - sp30 = make_joint_withshape(D_801A82E8, 0, -500.0f, 0.0f, -150.0f); - sp34 = d_use_obj("N167l"); - sp30->unk1F8 = make_group(1, sp34); + // Make grabbers to move the face with the cursor - sp30 = make_joint_withshape(D_801A82E8, 0, 500.0f, 0.0f, -150.0f); - sp34 = d_use_obj("N176l"); - sp30->unk1F8 = make_group(1, sp34); + grabberJoint = make_grabber_joint(sGrabJointTestShape, 0, -500.0f, 0.0f, -150.0f); + faceJoint = d_use_obj("N167l"); // DYNOBJ_MARIO_LEFT_EAR_JOINT_1 + grabberJoint->attachedObjsGrp = make_group(1, faceJoint); - sp30 = make_joint_withshape(D_801A82E8, 0, 0.0f, 700.0f, 300.0f); - sp34 = d_use_obj("N131l"); - sp30->unk1F8 = make_group(1, sp34); + grabberJoint = make_grabber_joint(sGrabJointTestShape, 0, 500.0f, 0.0f, -150.0f); + faceJoint = d_use_obj("N176l"); // DYNOBJ_MARIO_RIGHT_EAR_JOINT_1 + grabberJoint->attachedObjsGrp = make_group(1, faceJoint); - sp34 = d_use_obj("N206l"); - addto_group(sp30->unk1F8, sp34); + grabberJoint = make_grabber_joint(sGrabJointTestShape, 0, 0.0f, 700.0f, 300.0f); + faceJoint = d_use_obj("N131l"); // DYNOBJ_MARIO_CAP_JOINT_1 + grabberJoint->attachedObjsGrp = make_group(1, faceJoint); - sp34 = d_use_obj("N215l"); - addto_group(sp30->unk1F8, sp34); + // drag eyelids and eyebrows along with cap? + faceJoint = d_use_obj("N206l"); // DYNOBJ_LEFT_EYELID_JOINT_1 + addto_group(grabberJoint->attachedObjsGrp, faceJoint); + faceJoint = d_use_obj("N215l"); // DYNOBJ_RIGHT_EYELID_JOINT_1 + addto_group(grabberJoint->attachedObjsGrp, faceJoint); + faceJoint = d_use_obj("N31l"); // DYNOBJ_MARIO_LEFT_EYEBROW_MPART_JOINT_1 + addto_group(grabberJoint->attachedObjsGrp, faceJoint); + faceJoint = d_use_obj("N65l"); // DYNOBJ_MARIO_RIGHT_EYEBROW_MPART_JOINT_1 + addto_group(grabberJoint->attachedObjsGrp, faceJoint); - sp34 = d_use_obj("N31l"); - addto_group(sp30->unk1F8, sp34); + grabberJoint = make_grabber_joint(sGrabJointTestShape, 0, 0.0f, 0.0f, 600.0f); + faceJoint = d_use_obj("N185l"); // DYNOBJ_MARIO_NOSE_JOINT_1 + grabberJoint->attachedObjsGrp = make_group(1, faceJoint); - sp34 = d_use_obj("N65l"); - addto_group(sp30->unk1F8, sp34); + grabberJoint = make_grabber_joint(sGrabJointTestShape, 0, 0.0f, -300.0f, 300.0f); + faceJoint = d_use_obj("N194l"); // DYNOBJ_MARIO_LEFT_JAW_JOINT + grabberJoint->attachedObjsGrp = make_group(1, faceJoint); - sp30 = make_joint_withshape(D_801A82E8, 0, 0.0f, 0.0f, 600.0f); - sp34 = d_use_obj("N185l"); - sp30->unk1F8 = make_group(1, sp34); + grabberJoint = make_grabber_joint(sGrabJointTestShape, 0, 250.0f, -150.0f, 300.0f); + faceJoint = d_use_obj("N158l"); // DYNOBJ_MARIO_RIGHT_LIP_CORNER_JOINT_1 + grabberJoint->attachedObjsGrp = make_group(1, faceJoint); - sp30 = make_joint_withshape(D_801A82E8, 0, 0.0f, -300.0f, 300.0f); - sp34 = d_use_obj("N194l"); - sp30->unk1F8 = make_group(1, sp34); + faceJoint = d_use_obj("N15l"); // DYNOBJ_MARIO_LEFT_MUSTACHE_JOINT_1 + addto_group(grabberJoint->attachedObjsGrp, faceJoint); - sp30 = make_joint_withshape(D_801A82E8, 0, 250.0f, -150.0f, 300.0f); - sp34 = d_use_obj("N158l"); - sp30->unk1F8 = make_group(1, sp34); + grabberJoint = make_grabber_joint(sGrabJointTestShape, 0, -250.0f, -150.0f, 300.0f); + faceJoint = d_use_obj("N149l"); // DYNOBJ_MARIO_LEFT_LIP_CORNER_JOINT_1 + grabberJoint->attachedObjsGrp = make_group(1, faceJoint); - sp34 = d_use_obj("N15l"); - addto_group(sp30->unk1F8, sp34); + faceJoint = d_use_obj("N6l"); // DYNOBJ_MARIO_RIGHT_MUSTACHE_JOINT_1 + addto_group(grabberJoint->attachedObjsGrp, faceJoint); - sp30 = make_joint_withshape(D_801A82E8, 0, -250.0f, -150.0f, 300.0f); - sp34 = d_use_obj("N149l"); - sp30->unk1F8 = make_group(1, sp34); + // make the left eye follow cursor + grabberJoint = make_grabber_joint(sGrabJointTestShape, 0, 100.0f, 200.0f, 400.0f); + faceJoint = d_use_obj("N112l"); // DYNOBJ_MARIO_RIGHT_EYE_UNKNOWN_NET + grabberJoint->attachedObjsGrp = make_group(1, faceJoint); + grabberJoint->updateFunc = eye_joint_update_func; + grabberJoint->rootAnimator = animator; + grabberJoint->header.drawFlags &= ~OBJ_IS_GRABBALE; - sp34 = d_use_obj("N6l"); - addto_group(sp30->unk1F8, sp34); - - sp30 = make_joint_withshape(D_801A82E8, 0, 100.0f, 200.0f, 400.0f); - sp34 = d_use_obj("N112l"); - sp30->unk1F8 = make_group(1, sp34); - - sp30->fn2C = &func_8018EBE8; - sp30->unk1D0 = sp28; - sp30->header.drawFlags &= ~OBJ_IS_GRABBALE; - - sp30 = make_joint_withshape(D_801A82E8, 0, -100.0f, 200.0f, 400.0f); - sp34 = d_use_obj("N96l"); - sp30->unk1F8 = make_group(1, sp34); - - sp30->fn2C = &func_8018EBE8; - sp30->unk1D0 = sp28; - sp30->header.drawFlags &= ~OBJ_IS_GRABBALE; + // make the right eye follow cursor + grabberJoint = make_grabber_joint(sGrabJointTestShape, 0, -100.0f, 200.0f, 400.0f); + faceJoint = d_use_obj("N96l"); // DYNOBJ_MARIO_LEFT_EYE_UNKNOWN_NET + grabberJoint->attachedObjsGrp = make_group(1, faceJoint); + grabberJoint->updateFunc = eye_joint_update_func; + grabberJoint->rootAnimator = animator; + grabberJoint->header.drawFlags &= ~OBJ_IS_GRABBALE; sp48 = make_group_of_type(OBJ_TYPE_JOINTS, sp38, NULL); sp54 = make_net(0, NULL, sp48, NULL, NULL); @@ -1444,15 +1443,18 @@ s32 load_mario_head(void (*aniFn)(struct ObjAnimator *)) { /* @ 249288 for 0xe0 */ void load_shapes2(void) { - add_to_stacktrace("load_shapes2()"); + imin("load_shapes2()"); reset_dynlist(); func_80197280(); - sCubeShape = make_shape(0, "cube"); - D_801A82E4 = (struct ObjShape *) load_dynlist(dynlist_unused); - scale_verts_in_shape(D_801A82E4, 200.0f, 200.0f, 200.0f); - D_801A82E8 = (struct ObjShape *) load_dynlist(dynlist_test_cube); - scale_verts_in_shape(D_801A82E8, 30.0f, 30.0f, 30.0f); + sCubeShape = make_shape(0, "cube"); + + gSpotShape = (struct ObjShape *) load_dynlist(dynlist_spot_shape); + scale_verts_in_shape(gSpotShape, 200.0f, 200.0f, 200.0f); + + sGrabJointTestShape = (struct ObjShape *) load_dynlist(dynlist_test_cube); + scale_verts_in_shape(sGrabJointTestShape, 30.0f, 30.0f, 30.0f); + sCubeShapeGroup = make_group_of_type(OBJ_TYPE_SHAPES, &sCubeShape->header, NULL); create_gddl_for_shapes(sCubeShapeGroup); diff --git a/src/goddard/shape_helper.h b/src/goddard/shape_helper.h index 81ae06a8..bf55901e 100644 --- a/src/goddard/shape_helper.h +++ b/src/goddard/shape_helper.h @@ -7,7 +7,7 @@ // data extern struct ObjGroup *gMarioFaceGrp; -extern struct ObjShape *D_801A82E4; +extern struct ObjShape *gSpotShape; extern struct ObjShape *gShapeRedSpark; extern struct ObjShape *gShapeSilverSpark; extern struct ObjShape *gShapeRedStar; diff --git a/src/goddard/skin.c b/src/goddard/skin.c index 7b285a10..67173110 100644 --- a/src/goddard/skin.c +++ b/src/goddard/skin.c @@ -1,5 +1,9 @@ #include +#if defined(VERSION_EU) || defined(VERSION_SH) +#include "prevent_bss_reordering.h" +#endif + #include "debug_utils.h" #include "gd_main.h" #include "gd_math.h" @@ -19,58 +23,55 @@ static s32 D_801BAAF4; static s32 sNetCount; // @ 801BAAF8 /* 2406E0 -> 240894 */ -void func_80191F10(struct ObjNet *net) { - func_8017BCB0(); +void compute_net_bounding_box(struct ObjNet *net) { + reset_bounding_box(); if (net->unk1D0 != NULL) { - apply_to_obj_types_in_group(OBJ_TYPE_ALL, (applyproc_t) func_8017BD20, net->unk1D0); + apply_to_obj_types_in_group(OBJ_TYPE_ALL, (applyproc_t) add_obj_pos_to_bounding_box, net->unk1D0); } - // L80191F58 if (net->unk1C8 != NULL) { - apply_to_obj_types_in_group(OBJ_TYPE_ALL, (applyproc_t) func_8017BD20, net->unk1C8); + apply_to_obj_types_in_group(OBJ_TYPE_ALL, (applyproc_t) add_obj_pos_to_bounding_box, net->unk1C8); } - // L80191F8C - D_801B9DA0.p0.x *= net->unk1AC.x; - D_801B9DA0.p1.x *= net->unk1AC.x; - D_801B9DA0.p0.y *= net->unk1AC.y; - D_801B9DA0.p1.y *= net->unk1AC.y; - D_801B9DA0.p0.z *= net->unk1AC.z; - D_801B9DA0.p1.z *= net->unk1AC.z; + gSomeBoundingBox.minX *= net->scale.x; + gSomeBoundingBox.maxX *= net->scale.x; + gSomeBoundingBox.minY *= net->scale.y; + gSomeBoundingBox.maxY *= net->scale.y; + gSomeBoundingBox.minZ *= net->scale.z; + gSomeBoundingBox.maxZ *= net->scale.z; - net->unkBC.p0.x = D_801B9DA0.p0.x; - net->unkBC.p0.y = D_801B9DA0.p0.y; - net->unkBC.p0.z = D_801B9DA0.p0.z; - net->unkBC.p1.x = D_801B9DA0.p1.x; - net->unkBC.p1.y = D_801B9DA0.p1.y; - net->unkBC.p1.z = D_801B9DA0.p1.z; + net->boundingBox.minX = gSomeBoundingBox.minX; + net->boundingBox.minY = gSomeBoundingBox.minY; + net->boundingBox.minZ = gSomeBoundingBox.minZ; + net->boundingBox.maxX = gSomeBoundingBox.maxX; + net->boundingBox.maxY = gSomeBoundingBox.maxY; + net->boundingBox.maxZ = gSomeBoundingBox.maxZ; } /* 240894 -> 240A64; orig name: func_801920C4 */ void reset_net(struct ObjNet *net) { - struct ObjGroup *grp; // 24 + struct ObjGroup *grp; - // based on move_net strings, unk38 is the likely parameter - printf("reset_net %d\n", net->unk38); + printf("reset_net %d\n", net->id); - net->unk14.x = net->unk20.x; - net->unk14.y = net->unk20.y; - net->unk14.z = net->unk20.z; - net->unk50.x = net->unk50.y = net->unk50.z = 0.0f; - net->unkA4.x = net->unkA4.y = net->unkA4.z = 0.0f; + net->worldPos.x = net->initPos.x; + net->worldPos.y = net->initPos.y; + net->worldPos.z = net->initPos.z; + net->velocity.x = net->velocity.y = net->velocity.z = 0.0f; + net->torque.x = net->torque.y = net->torque.z = 0.0f; - func_80191F10(net); - gd_print_vec("net scale: ", &net->unk1AC); - gd_print_plane("net box: ", &net->unkBC); + compute_net_bounding_box(net); + gd_print_vec("net scale: ", &net->scale); + gd_print_bounding_box("net box: ", &net->boundingBox); gGdSkinNet = net; D_801BAAF4 = 0; gd_set_identity_mat4(&net->mat168); gd_set_identity_mat4(&net->matE8); gd_rot_mat_about_vec(&net->matE8, &net->unk68); // set rot mtx to initial rotation? - gd_add_vec3f_to_mat4f_offset(&net->matE8, &net->unk14); // set to initial position? + gd_add_vec3f_to_mat4f_offset(&net->matE8, &net->worldPos); // set to initial position? gd_copy_mat4f(&net->matE8, &net->mat128); if ((grp = net->unk1C8) != NULL) { - apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) func_80191604, grp); + apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) reset_joint, grp); apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) func_80191220, grp); apply_to_obj_types_in_group(OBJ_TYPE_BONES, (applyproc_t) func_8018FB58, grp); apply_to_obj_types_in_group(OBJ_TYPE_BONES, (applyproc_t) func_8018FA68, grp); @@ -81,9 +82,9 @@ void reset_net(struct ObjNet *net) { void func_80192294(struct ObjNet *net) { UNUSED s32 sp1C = 0; - if (net->unk1E8 == NULL) { + if (net->attachedToObj == NULL) { restart_timer("childpos"); - sp1C = func_8017F054(&net->header, NULL); + sp1C = transform_child_objects_recursive(&net->header, NULL); split_timer("childpos"); } } @@ -96,12 +97,12 @@ void func_801922FC(struct ObjNet *net) { gGdSkinNet = net; // TODO: netype constants? if (net->netType == 4) { - if (net->unk1A8 != NULL) { + if (net->shapePtr != NULL) { D_801B9E38 = &net->mat128; - func_80181760(net->unk1A8->vtxGroup); + scale_verts(net->shapePtr->vtxGroup); } if ((group = net->unk1C8) != NULL) { - apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) func_80181B88, group); + apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) reset_joint_weights, group); } } } @@ -109,22 +110,22 @@ void func_801922FC(struct ObjNet *net) { /* 240B84 -> 240CF8 */ struct ObjNet *make_net(UNUSED s32 a0, struct ObjShape *shapedata, struct ObjGroup *a2, struct ObjGroup *a3, struct ObjGroup *a4) { - struct ObjNet *net; // 24 + struct ObjNet *net; net = (struct ObjNet *) make_object(OBJ_TYPE_NETS); gd_set_identity_mat4(&net->mat128); - net->unk20.x = net->unk20.y = net->unk20.z = 0.0f; - net->unk38 = ++sNetCount; - net->unk1AC.x = net->unk1AC.y = net->unk1AC.z = 1.0f; - net->unk1A8 = shapedata; + net->initPos.x = net->initPos.y = net->initPos.z = 0.0f; + net->id = ++sNetCount; + net->scale.x = net->scale.y = net->scale.z = 1.0f; + net->shapePtr = shapedata; net->unk1C8 = a2; net->unk1CC = a3; net->unk1D0 = a4; net->netType = 0; - net->unk210 = 0; + net->ctrlType = 0; net->unk21C = NULL; net->unk3C = 1; - net->unk40 = 0; + net->colourNum = 0; net->skinGrp = NULL; reset_net(net); @@ -133,11 +134,11 @@ struct ObjNet *make_net(UNUSED s32 a0, struct ObjShape *shapedata, struct ObjGro /* 240CF8 -> 240E74 */ void func_80192528(struct ObjNet *net) { - net->unk44.x = net->unk44.y = net->unk44.z = 0.0f; - net->unk74.x = net->unk74.y = net->unk74.z = 0.0f; - net->unk80.x = net->unk80.y = net->unk80.z = 0.0f; - net->unkD4.x = net->unkD4.y = net->unkD4.z = 0.0f; - net->unkE0 = 0.0f; + net->unusedForce.x = net->unusedForce.y = net->unusedForce.z = 0.0f; + net->collDisp.x = net->collDisp.y = net->collDisp.z = 0.0f; + net->collTorque.x = net->collTorque.y = net->collTorque.z = 0.0f; + net->unusedCollDispOff.x = net->unusedCollDispOff.y = net->unusedCollDispOff.z = 0.0f; + net->unusedCollMaxD = 0.0f; gGdCounter.ctr0 = 0; gGdCounter.ctr1 = 0; @@ -149,17 +150,17 @@ void func_80192528(struct ObjNet *net) { D_801B9E28.z = 0.0f; D_801B9E34 = 0.0f; - if (net->unk34 & 0x1) { - net->unk50.y += -4.0; //? 4.0f + if (net->flags & 0x1) { + net->velocity.y += -4.0; //? 4.0f } - net->unk14.x += net->unk50.x / 1.0f; - net->unk14.y += net->unk50.y / 1.0f; - net->unk14.z += net->unk50.z / 1.0f; + net->worldPos.x += net->velocity.x / 1.0f; + net->worldPos.y += net->velocity.y / 1.0f; + net->worldPos.z += net->velocity.z / 1.0f; } /* 240E74 -> 2412A0 */ -void func_801926A4(struct ObjNet *net) { +void collision_something_801926A4(struct ObjNet *net) { if (gGdCounter.ctr1 != 0) { if (D_801B9E34 != 0.0f) { D_801B9E28.x /= D_801B9E34; @@ -178,23 +179,23 @@ void func_801926A4(struct ObjNet *net) { func_8017E838(gGdSkinNet, &D_801B9E28, &D_801B9E18); } - net->unkA4.x += net->unk80.x; - net->unkA4.y += net->unk80.y; - net->unkA4.z += net->unk80.z; - net->unk74.x *= 1.0; // 1.0f; - net->unk74.y *= 1.0; // 1.0f; - net->unk74.z *= 1.0; // 1.0f; - net->unk50.x += net->unk74.x; - net->unk50.y += net->unk74.y; - net->unk50.z += net->unk74.z; - net->unk14.x += net->unk74.x; - net->unk14.y += net->unk74.y; - net->unk14.z += net->unk74.z; + net->torque.x += net->collTorque.x; + net->torque.y += net->collTorque.y; + net->torque.z += net->collTorque.z; + net->collDisp.x *= 1.0; // 1.0f; + net->collDisp.y *= 1.0; // 1.0f; + net->collDisp.z *= 1.0; // 1.0f; + net->velocity.x += net->collDisp.x; + net->velocity.y += net->collDisp.y; + net->velocity.z += net->collDisp.z; + net->worldPos.x += net->collDisp.x; + net->worldPos.y += net->collDisp.y; + net->worldPos.z += net->collDisp.z; func_8017E9EC(net); - net->unkA4.x *= 0.98; //? 0.98f - net->unkA4.z *= 0.98; //? 0.98f - net->unkA4.y *= 0.9; //? 0.9f + net->torque.x *= 0.98; //? 0.98f + net->torque.z *= 0.98; //? 0.98f + net->torque.y *= 0.9; //? 0.9f } /* 2412A0 -> 24142C; not called */ @@ -210,14 +211,14 @@ void func_80192AD0(struct ObjNet *net) { } sp18 = net->unk1F0; - net->unk14.x = net->unk1F4.x; - net->unk14.y = net->unk1F4.y; - net->unk14.z = net->unk1F4.z; - gd_rotate_and_translate_vec3f(&net->unk14, &sp18->mat128); + net->worldPos.x = net->unk1F4.x; + net->worldPos.y = net->unk1F4.y; + net->worldPos.z = net->unk1F4.z; + gd_rotate_and_translate_vec3f(&net->worldPos, &sp18->mat128); - net->unk14.x += net->unk1F0->unk14.x; - net->unk14.y += net->unk1F0->unk14.y; - net->unk14.z += net->unk1F0->unk14.z; + net->worldPos.x += net->unk1F0->worldPos.x; + net->worldPos.y += net->unk1F0->worldPos.y; + net->worldPos.z += net->unk1F0->worldPos.z; net->unk200.x = 0.0f; net->unk200.y = 10.0f; net->unk200.z = -4.0f; @@ -233,7 +234,7 @@ void move_bonesnet(struct ObjNet *net) { struct ObjGroup *sp24; UNUSED u32 pad18[3]; - add_to_stacktrace("move_bonesnet"); + imin("move_bonesnet"); gd_set_identity_mat4(&D_801B9DC8); if ((sp24 = net->unk1C8) != NULL) { apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) func_801913C0, sp24); @@ -250,7 +251,7 @@ void func_80192CCC(struct ObjNet *net) { ctrl = &gGdCtrl; if (gGdCtrl.unk2C != NULL) { - func_8017E2B8(); + menu_cb_reset_positions(); } gd_set_identity_mat4(&D_801B9DC8); @@ -260,7 +261,7 @@ void func_80192CCC(struct ObjNet *net) { sp24.z = net->mat128[0][2]; gd_create_rot_mat_angular(&sp38, &sp24, 4.0f); gd_mult_mat4f(&sp38, &D_801B9DC8, &D_801B9DC8); - net->unkA4.x = net->unkA4.y = net->unkA4.z = 0.0f; + net->torque.x = net->torque.y = net->torque.z = 0.0f; } if (gGdCtrl.unk28 != NULL) { @@ -269,14 +270,14 @@ void func_80192CCC(struct ObjNet *net) { sp24.z = net->mat128[0][2]; gd_create_rot_mat_angular(&sp38, &sp24, -4.0f); gd_mult_mat4f(&sp38, &D_801B9DC8, &D_801B9DC8); - net->unkA4.x = net->unkA4.y = net->unkA4.z = 0.0f; + net->torque.x = net->torque.y = net->torque.z = 0.0f; } if (gGdCtrl.newStartPress) { return; } // start was pressed - switch (net->unk210) { + switch (net->ctrlType) { case 2: break; } @@ -285,11 +286,11 @@ void func_80192CCC(struct ObjNet *net) { if ((group = net->unk1C8) != NULL) { apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) func_80191220, group); apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) func_801913F0, group); - apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) func_801914F8, group); + apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) stub_joints_2, group); apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) func_801911A8, group); } - func_801926A4(net); + collision_something_801926A4(net); gd_mult_mat4f(&net->mat128, &D_801B9DC8, &net->mat128); if (group != NULL) { apply_to_obj_types_in_group(OBJ_TYPE_JOINTS, (applyproc_t) func_801913C0, group); @@ -308,10 +309,10 @@ void convert_gd_verts_to_Vn(struct ObjGroup *grp) { register s16 y; // t0 register s16 z; // t1 register struct ObjVertex *vtx; // t2 - register struct Links *link; // t3 + register struct ListNode *link; // t3 struct GdObj *obj; // sp4 - for (link = grp->link1C; link != NULL; link = link->next) { + for (link = grp->firstMember; link != NULL; link = link->next) { obj = link->obj; vtx = (struct ObjVertex *) obj; x = (s16) vtx->pos.x; @@ -342,10 +343,10 @@ void convert_gd_verts_to_Vtx(struct ObjGroup *grp) { register s16 y; // t0 register s16 z; // t1 register struct ObjVertex *vtx; // t2 - register struct Links *link; // t3 + register struct ListNode *link; // t3 struct GdObj *obj; // sp4 - for (link = grp->link1C; link != NULL; link = link->next) { + for (link = grp->firstMember; link != NULL; link = link->next) { obj = link->obj; vtx = (struct ObjVertex *) obj; x = (s16) vtx->pos.x; @@ -362,34 +363,34 @@ void convert_gd_verts_to_Vtx(struct ObjGroup *grp) { /* 241BCC -> 241CA0; orig name: Proc801933FC */ void convert_net_verts(struct ObjNet *net) { - if (net->unk1A8 != NULL) { - if (net->unk1A8->unk30) { - convert_gd_verts_to_Vn(net->unk1A8->vtxGroup); + if (net->shapePtr != NULL) { + if (net->shapePtr->unk30) { + convert_gd_verts_to_Vn(net->shapePtr->vtxGroup); } } switch (net->netType) { case 2: - if (net->unk1A8 != NULL) { - convert_gd_verts_to_Vtx(net->unk1A8->unk24); + if (net->shapePtr != NULL) { + convert_gd_verts_to_Vtx(net->shapePtr->scaledVtxGroup); } break; } } /* 241CA0 -> 241D6C */ -void func_801934D0(struct ObjNet *net) { +static void move_joints_in_net(struct ObjNet *net) { struct ObjGroup *grp; // 2c - register struct Links *link; // s0 + register struct ListNode *link; // s0 struct GdObj *obj; // 24 if ((grp = net->unk1C8) != NULL) { - for (link = grp->link1C; link != NULL; link = link->next) { + for (link = grp->firstMember; link != NULL; link = link->next) { obj = link->obj; switch (obj->type) { case OBJ_TYPE_JOINTS: - if (((struct ObjJoint *) obj)->fn2C != NULL) { - (*((struct ObjJoint *) obj)->fn2C)((struct ObjJoint *) obj); + if (((struct ObjJoint *) obj)->updateFunc != NULL) { + (*((struct ObjJoint *) obj)->updateFunc)((struct ObjJoint *) obj); } break; default:; @@ -419,7 +420,7 @@ void move_net(struct ObjNet *net) { split_timer("move_skin"); break; case 3: - func_801934D0(net); + move_joints_in_net(net); break; case 5: func_801823A0(net); @@ -427,13 +428,13 @@ void move_net(struct ObjNet *net) { case 6: break; default: - fatal_printf("move_net(%d(%d)): Undefined net type", net->unk38, net->netType); + fatal_printf("move_net(%d(%d)): Undefined net type", net->id, net->netType); } } /* 241E94 -> 241F0C; orig name: func_801936C4 */ void move_nets(struct ObjGroup *group) { - add_to_stacktrace("move_nets"); + imin("move_nets"); restart_timer("move_nets"); apply_to_obj_types_in_group(OBJ_TYPE_NETS, (applyproc_t) func_80192294, group); apply_to_obj_types_in_group(OBJ_TYPE_NETS, (applyproc_t) move_net, group); @@ -443,18 +444,17 @@ void move_nets(struct ObjGroup *group) { /* 241F0C -> 242018 */ void func_8019373C(struct ObjNet *net) { - register struct Links *link; // s0 - struct ObjVertex *vtx; // 20 + register struct ListNode *link; + struct ObjVertex *vtx; switch (net->netType) { case 2: - if (net->unk1A8 != NULL) { - net->unk1A8->unk24 = make_group(0); - for (link = net->unk1A8->vtxGroup->link1C; link != NULL; link = link->next) { + if (net->shapePtr != NULL) { + net->shapePtr->scaledVtxGroup = make_group(0); + for (link = net->shapePtr->vtxGroup->firstMember; link != NULL; link = link->next) { vtx = (struct ObjVertex *) link->obj; - if (vtx->scaleFactor != 1.0) //? 1.0f - { - addto_group(net->unk1A8->unk24, &vtx->header); + if (vtx->scaleFactor != 1.0) { + addto_group(net->shapePtr->scaledVtxGroup, &vtx->header); } } } @@ -472,30 +472,30 @@ void func_80193848(struct ObjGroup *group) { /* 24208C -> 2422E0; not called; orig name: func_801938BC */ void gd_print_net(struct ObjNet *net) { - gd_printf("Flags:%x\n", net->unk34); - gd_print_vec("World:", &net->unk14); - gd_print_vec("Force:", &net->unk44); - gd_print_vec("Vel:", &net->unk50); - gd_print_vec("Rot:", &net->unk5C); - gd_print_vec("CollDisp:", &net->unk74); - gd_print_vec("CollTorque:", &net->unk80); - gd_print_vec("CollTorqueL:", &net->unk8C); - gd_print_vec("CollTorqueD:", &net->unk98); - gd_print_vec("Torque:", &net->unkA4); - gd_print_vec("CofG:", &net->unkB0); - gd_print_plane("BoundBox:", &net->unkBC); - gd_print_vec("CollDispOff:", &net->unkD4); - gd_printf("CollMaxD: %f\n", net->unkE0); - gd_printf("MaxRadius: %f\n", net->unkE4); + gd_printf("Flags:%x\n", net->flags); + gd_print_vec("World:", &net->worldPos); + gd_print_vec("Force:", &net->unusedForce); + gd_print_vec("Vel:", &net->velocity); + gd_print_vec("Rot:", &net->rotation); + gd_print_vec("CollDisp:", &net->collDisp); + gd_print_vec("CollTorque:", &net->collTorque); + gd_print_vec("CollTorqueL:", &net->unusedCollTorqueL); + gd_print_vec("CollTorqueD:", &net->unusedCollTorqueD); + gd_print_vec("Torque:", &net->torque); + gd_print_vec("CofG:", &net->centerOfGravity); + gd_print_bounding_box("BoundBox:", &net->boundingBox); + gd_print_vec("CollDispOff:", &net->unusedCollDispOff); + gd_printf("CollMaxD: %f\n", net->unusedCollMaxD); + gd_printf("MaxRadius: %f\n", net->maxRadius); gd_print_mtx("Matrix:", &net->mat128); - if (net->unk1A8 != NULL) { - gd_printf("ShapePtr: %x (%s)\n", (u32) (uintptr_t) net->unk1A8, net->unk1A8->name); + if (net->shapePtr != NULL) { + gd_printf("ShapePtr: %x (%s)\n", (u32) (uintptr_t) net->shapePtr, net->shapePtr->name); } else { gd_printf("ShapePtr: NULL\n"); } - gd_print_vec("Scale:", &net->unk1AC); - gd_printf("Mass: %f\n", net->unk1B8); - gd_printf("NumModes: %d\n", net->unk1BC); + gd_print_vec("Scale:", &net->scale); + gd_printf("Mass: %f\n", net->unusedMass); + gd_printf("NumModes: %d\n", net->numModes); gd_printf("NodeGroup: %x\n", (u32) (uintptr_t) net->unk1C8); gd_printf("PlaneGroup: %x\n", (u32) (uintptr_t) net->unk1CC); gd_printf("VertexGroup: %x\n", (u32) (uintptr_t) net->unk1D0); diff --git a/src/goddard/skin_movement.c b/src/goddard/skin_movement.c index 0163215a..7105ec76 100644 --- a/src/goddard/skin_movement.c +++ b/src/goddard/skin_movement.c @@ -10,9 +10,9 @@ #include "skin_movement.h" /* bss */ -struct ObjWeight *sSkinNetCurWeight; +struct ObjWeight *sResetCurWeight; static Mat4f D_801B9EA8; // TODO: rename to sHead2Mtx? -static struct ObjJoint *D_801B9EE8; +static struct ObjJoint *D_801B9EE8; // set but not used /* @ 22FDB0 for 0x180 */ void func_801815E0(Mat4f *mtx) { @@ -46,12 +46,12 @@ void func_801815E0(Mat4f *mtx) { /* @ 22FF30 for 0xDC */ /* called with ObjNext->unk1A8 (variable obj ptr?) ->unk20 or ->unk24 ptr*/ // TODO: figure out the proper object type for a0 -void func_80181760(struct ObjGroup *a0) { +void scale_verts(struct ObjGroup *a0) { register f32 sp1C; - register struct Links *link; + register struct ListNode *link; struct ObjVertex *vtx; - for (link = a0->link1C; link != NULL; link = link->next) { + for (link = a0->firstMember; link != NULL; link = link->next) { vtx = (struct ObjVertex *) link->obj; if ((sp1C = vtx->scaleFactor) != 0.0f) { @@ -68,8 +68,8 @@ void func_80181760(struct ObjGroup *a0) { void move_skin(struct ObjNet *net) { UNUSED u8 pad1C[8]; - if (net->unk1A8 != NULL) { - func_80181760(net->unk1A8->unk24); + if (net->shapePtr != NULL) { + scale_verts(net->shapePtr->scaledVtxGroup); } } @@ -79,25 +79,25 @@ void func_80181894(struct ObjJoint *joint) { struct GdVec3f stackVec; register struct ObjWeight *curWeight; register struct ObjVertex *connectedVtx; - register struct Links *link; + register struct ListNode *link; register f32 scaleFactor; struct GdObj *linkedObj; - weightGroup = joint->unk1F4; + weightGroup = joint->weightGrp; if (weightGroup != NULL) { - for (link = weightGroup->link1C; link != NULL; link = link->next) { + for (link = weightGroup->firstMember; link != NULL; link = link->next) { linkedObj = link->obj; curWeight = (struct ObjWeight *) linkedObj; - if (curWeight->unk38 > 0.0) //? 0.0f + if (curWeight->weightVal > 0.0) //? 0.0f { stackVec.x = curWeight->vec20.x; stackVec.y = curWeight->vec20.y; stackVec.z = curWeight->vec20.z; gd_rotate_and_translate_vec3f(&stackVec, &joint->matE8); - connectedVtx = curWeight->unk3C; - scaleFactor = curWeight->unk38; + connectedVtx = curWeight->vtx; + scaleFactor = curWeight->weightVal; connectedVtx->pos.x += stackVec.x * scaleFactor; connectedVtx->pos.y += stackVec.y * scaleFactor; @@ -108,52 +108,51 @@ void func_80181894(struct ObjJoint *joint) { } /* @ 2301A0 for 0x110 */ -void func_801819D0(struct ObjVertex *vtx) { +void reset_weight_vtx(struct ObjVertex *vtx) { struct GdVec3f localVec; UNUSED u8 pad24[0x10]; - if (sTargetWeightID++ == sSkinNetCurWeight->id) { - sSkinNetCurWeight->unk3C = vtx; + if (sResetWeightVtxNum++ == sResetCurWeight->vtxId) { // found matching vertex + sResetCurWeight->vtx = vtx; localVec.x = vtx->pos.x; localVec.y = vtx->pos.y; localVec.z = vtx->pos.z; gd_rotate_and_translate_vec3f(&localVec, &D_801B9EA8); - sSkinNetCurWeight->vec20.x = localVec.x; - sSkinNetCurWeight->vec20.y = localVec.y; - sSkinNetCurWeight->vec20.z = localVec.z; + sResetCurWeight->vec20.x = localVec.x; + sResetCurWeight->vec20.y = localVec.y; + sResetCurWeight->vec20.z = localVec.z; - vtx->scaleFactor -= sSkinNetCurWeight->unk38; + vtx->scaleFactor -= sResetCurWeight->weightVal; } } -/* @ 2302B0 for 0xA8; orig name: func_80181AE0 */ void reset_weight(struct ObjWeight *weight) { UNUSED u32 vtxCount; UNUSED u32 pad20; struct ObjGroup *skinGroup; - sSkinNetCurWeight = weight; - sTargetWeightID = 0; + sResetCurWeight = weight; + sResetWeightVtxNum = 0; if ((skinGroup = gGdSkinNet->skinGrp) != NULL) { + // Go through every vertex in the skin group, and reset the weight if the vertex is managed by the weight vtxCount = - apply_to_obj_types_in_group(OBJ_TYPE_VERTICES, (applyproc_t) func_801819D0, skinGroup); + apply_to_obj_types_in_group(OBJ_TYPE_VERTICES, (applyproc_t) reset_weight_vtx, skinGroup); } else { fatal_printf("reset_weight(): Skin net has no SkinGroup"); } - if (weight->unk3C == NULL) { - fatal_printf("reset_weight(): Skin vertex ID %d not found", weight->id); + if (weight->vtx == NULL) { + fatal_printf("reset_weight(): Skin vertex ID %d not found", weight->vtxId); } } -/* @ 230358 for 0x78; rename to reset_joint_weight? */ -void func_80181B88(struct ObjJoint *joint) { +void reset_joint_weights(struct ObjJoint *joint) { struct ObjGroup *group; gd_inverse_mat4f(&joint->matE8, &D_801B9EA8); D_801B9EE8 = joint; - if ((group = joint->unk1F4) != NULL) { + if ((group = joint->weightGrp) != NULL) { apply_to_obj_types_in_group(OBJ_TYPE_WEIGHTS, (applyproc_t) reset_weight, group); } } diff --git a/src/goddard/skin_movement.h b/src/goddard/skin_movement.h index fbfa9385..c98c2c93 100644 --- a/src/goddard/skin_movement.h +++ b/src/goddard/skin_movement.h @@ -3,9 +3,9 @@ #include "gd_types.h" -void func_80181760(struct ObjGroup *a0); +void scale_verts(struct ObjGroup *a0); void move_skin(struct ObjNet *net); void func_80181894(struct ObjJoint *joint); -void func_80181B88(struct ObjJoint *joint); +void reset_joint_weights(struct ObjJoint *joint); #endif // GD_SKIN_MOVEMENT_H diff --git a/src/menu/file_select.c b/src/menu/file_select.c index 4d7dd9fb..9a4f8715 100644 --- a/src/menu/file_select.c +++ b/src/menu/file_select.c @@ -18,6 +18,7 @@ #include "game/segment2.h" #include "game/segment7.h" #include "game/spawn_object.h" +#include "game/rumble_init.h" #include "sm64.h" #include "text_strings.h" @@ -36,47 +37,27 @@ */ #ifdef VERSION_US -// The current sound mode is automatically centered on US due to -// the large length difference between options. -// sSoundTextY unused (EU supports its existence). +// The current sound mode is automatically centered on US and Shindou. static s16 sSoundTextX; -static s16 sSoundTextY; #endif //! @Bug (UB Array Access) For EU, more buttons were added than the array was extended. //! This causes no currently known issues on console (as the other variables are not changed //! while this is used) but can cause issues with other compilers. -#ifdef VERSION_EU - #ifdef AVOID_UB - #define NUM_BUTTONS 36 - #else - #define NUM_BUTTONS 34 - #endif +#if defined(VERSION_EU) && !defined(AVOID_UB) +#define NUM_BUTTONS (MENU_BUTTON_OPTION_MAX - 1) #else -#define NUM_BUTTONS 32 +#define NUM_BUTTONS MENU_BUTTON_OPTION_MAX #endif // Amount of main menu buttons defined in the code called by spawn_object_rel_with_rot. // See file_select.h for the names in MenuButtonTypes. static struct Object *sMainMenuButtons[NUM_BUTTONS]; -#ifdef VERSION_EU -// The current sound mode is automatically centered on US due to -// the large length difference between options. -// sSoundTextY is unused -static s16 sSoundTextX; -static s16 sSoundTextY; -#endif - // Used to defined yes/no fade colors after a file is selected in the erase menu. // sYesNoColor[0]: YES | sYesNoColor[1]: NO static u8 sYesNoColor[2]; -// Unused variable that is written to define centered X value for some strings. -#ifdef VERSION_EU -static s16 sCenteredX; -#endif - // The button that is selected when it is clicked. static s8 sSelectedButtonID = MENU_BUTTON_NONE; @@ -566,7 +547,10 @@ void exit_score_file_to_score_menu(struct Object *scoreFileButton, s8 scoreButto // Begin exit if (scoreFileButton->oMenuButtonState == MENU_BUTTON_STATE_FULLSCREEN && sCursorClickingTimer == 2) { - play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif scoreFileButton->oMenuButtonState = MENU_BUTTON_STATE_SHRINKING; } // End exit @@ -658,7 +642,10 @@ void check_score_menu_clicked_buttons(struct Object *scoreButton) { // If menu button clicked, select it if (buttonID == MENU_BUTTON_SCORE_RETURN || buttonID == MENU_BUTTON_SCORE_COPY_FILE || buttonID == MENU_BUTTON_SCORE_ERASE_FILE) { - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; sSelectedButtonID = buttonID; } @@ -666,13 +653,19 @@ void check_score_menu_clicked_buttons(struct Object *scoreButton) { if (sMainMenuTimer >= SCORE_TIMER) { // If clicked in a existing save file, select it too see it's score if (save_file_exists(buttonID - MENU_BUTTON_SCORE_MIN) == TRUE) { - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_GROWING; sSelectedButtonID = buttonID; } else { // If clicked in a non-existing save file, play buzz sound - play_sound(SOUND_MENU_CAMERA_BUZZ, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; if (sMainMenuTimer >= SCORE_TIMER) { @@ -765,7 +758,10 @@ void copy_action_file_button(struct Object *copyButton, s32 copyFileButtonID) { } if (save_file_exists(copyFileButtonID - MENU_BUTTON_COPY_MIN) == TRUE) { // If clicked in a existing save file, ask where it wants to copy - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[copyFileButtonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN; sSelectedFileIndex = copyFileButtonID - MENU_BUTTON_COPY_MIN; copyButton->oMenuButtonActionPhase = COPY_PHASE_COPY_WHERE; @@ -773,7 +769,10 @@ void copy_action_file_button(struct Object *copyButton, s32 copyFileButtonID) { sMainMenuTimer = 0; } else { // If clicked in a non-existing save file, play buzz sound - play_sound(SOUND_MENU_CAMERA_BUZZ, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[copyFileButtonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; if (sMainMenuTimer >= BUZZ_TIMER) { sFadeOutText = TRUE; @@ -785,7 +784,10 @@ void copy_action_file_button(struct Object *copyButton, s32 copyFileButtonID) { sMainMenuButtons[copyFileButtonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; if (save_file_exists(copyFileButtonID - MENU_BUTTON_COPY_MIN) == FALSE) { // If clicked in a non-existing save file, copy the file - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif copyButton->oMenuButtonActionPhase = COPY_PHASE_COPY_COMPLETE; sFadeOutText = TRUE; sMainMenuTimer = 0; @@ -797,7 +799,10 @@ void copy_action_file_button(struct Object *copyButton, s32 copyFileButtonID) { } else { // If clicked in a existing save file, play buzz sound if (MENU_BUTTON_COPY_FILE_A + sSelectedFileIndex == copyFileButtonID) { - play_sound(SOUND_MENU_CAMERA_BUZZ, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[MENU_BUTTON_COPY_FILE_A + sSelectedFileIndex]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_OUT; copyButton->oMenuButtonActionPhase = COPY_PHASE_MAIN; @@ -837,7 +842,10 @@ void check_copy_menu_clicked_buttons(struct Object *copyButton) { if (buttonID == MENU_BUTTON_COPY_RETURN || buttonID == MENU_BUTTON_COPY_CHECK_SCORE || buttonID == MENU_BUTTON_COPY_ERASE_FILE) { if (copyButton->oMenuButtonActionPhase == COPY_PHASE_MAIN) { - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; sSelectedButtonID = buttonID; } @@ -932,7 +940,10 @@ void erase_action_file_button(struct Object *eraseButton, s32 eraseFileButtonID) case ERASE_PHASE_MAIN: // Erase Menu Main Phase if (save_file_exists(eraseFileButtonID - MENU_BUTTON_ERASE_MIN) == TRUE) { // If clicked in a existing save file, ask if it wants to delete it - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[eraseFileButtonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN; sSelectedFileIndex = eraseFileButtonID - MENU_BUTTON_ERASE_MIN; eraseButton->oMenuButtonActionPhase = ERASE_PHASE_PROMPT; @@ -940,7 +951,10 @@ void erase_action_file_button(struct Object *eraseButton, s32 eraseFileButtonID) sMainMenuTimer = 0; } else { // If clicked in a non-existing save file, play buzz sound - play_sound(SOUND_MENU_CAMERA_BUZZ, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_BUZZ, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[eraseFileButtonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; if (sMainMenuTimer >= BUZZ_TIMER) { @@ -954,7 +968,10 @@ void erase_action_file_button(struct Object *eraseButton, s32 eraseFileButtonID) // If clicked in a existing save file, play click sound and zoom out button // Note: The prompt functions are actually called when the ERASE_MSG_PROMPT // message is displayed with print_erase_menu_prompt - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[MENU_BUTTON_ERASE_MIN + sSelectedFileIndex]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_OUT; eraseButton->oMenuButtonActionPhase = ERASE_PHASE_MAIN; @@ -981,7 +998,10 @@ void check_erase_menu_clicked_buttons(struct Object *eraseButton) { if (buttonID == MENU_BUTTON_ERASE_RETURN || buttonID == MENU_BUTTON_ERASE_CHECK_SCORE || buttonID == MENU_BUTTON_ERASE_COPY_FILE) { if (eraseButton->oMenuButtonActionPhase == ERASE_PHASE_MAIN) { - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; sSelectedButtonID = buttonID; } @@ -1073,7 +1093,10 @@ void check_sound_mode_menu_clicked_buttons(struct Object *soundModeButton) { if (buttonID == MENU_BUTTON_STEREO || buttonID == MENU_BUTTON_MONO || buttonID == MENU_BUTTON_HEADSET) { if (soundModeButton->oMenuButtonActionPhase == SOUND_MODE_PHASE_MAIN) { - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; #ifndef VERSION_EU // Sound menu buttons don't return to Main Menu in EU @@ -1089,7 +1112,7 @@ void check_sound_mode_menu_clicked_buttons(struct Object *soundModeButton) { if (buttonID == MENU_BUTTON_LANGUAGE_ENGLISH || buttonID == MENU_BUTTON_LANGUAGE_FRENCH || buttonID == MENU_BUTTON_LANGUAGE_GERMAN) { if (soundModeButton->oMenuButtonActionPhase == SOUND_MODE_PHASE_MAIN) { - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; sLanguageMode = buttonID - MENU_BUTTON_LANGUAGE_MIN; eu_set_language(sLanguageMode); @@ -1097,7 +1120,7 @@ void check_sound_mode_menu_clicked_buttons(struct Object *soundModeButton) { } // If neither of the buttons above are pressed, return to main menu if (buttonID == MENU_BUTTON_LANGUAGE_RETURN) { - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); sMainMenuButtons[buttonID]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_IN_OUT; sSelectedButtonID = buttonID; } @@ -1130,7 +1153,7 @@ void return_to_main_menu(s16 prevMenuButtonID, struct Object *sourceButton) { // play zoom out sound and shrink previous menu if (sourceButton->oMenuButtonState == MENU_BUTTON_STATE_DEFAULT && sMainMenuButtons[prevMenuButtonID]->oMenuButtonState == MENU_BUTTON_STATE_FULLSCREEN) { - play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource); sMainMenuButtons[prevMenuButtonID]->oMenuButtonState = MENU_BUTTON_STATE_SHRINKING; sCurrentMenuLevel = MENU_LAYER_MAIN; } @@ -1170,7 +1193,7 @@ void load_score_menu_from_submenu(s16 prevMenuButtonID, struct Object *sourceBut // play zoom out sound and shrink previous menu if (sourceButton->oMenuButtonState == MENU_BUTTON_STATE_DEFAULT && sMainMenuButtons[prevMenuButtonID]->oMenuButtonState == MENU_BUTTON_STATE_FULLSCREEN) { - play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource); sMainMenuButtons[prevMenuButtonID]->oMenuButtonState = MENU_BUTTON_STATE_SHRINKING; sCurrentMenuLevel = MENU_LAYER_MAIN; } @@ -1196,7 +1219,7 @@ void load_score_menu_from_submenu(s16 prevMenuButtonID, struct Object *sourceBut } // Play zoom in sound, select score menu and render it's buttons sSelectedButtonID = MENU_BUTTON_SCORE; - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); sMainMenuButtons[MENU_BUTTON_SCORE]->oMenuButtonState = MENU_BUTTON_STATE_GROWING; render_score_menu_buttons(sMainMenuButtons[MENU_BUTTON_SCORE]); } @@ -1211,7 +1234,7 @@ void load_copy_menu_from_submenu(s16 prevMenuButtonID, struct Object *sourceButt // play zoom out sound and shrink previous menu if (sourceButton->oMenuButtonState == MENU_BUTTON_STATE_DEFAULT && sMainMenuButtons[prevMenuButtonID]->oMenuButtonState == MENU_BUTTON_STATE_FULLSCREEN) { - play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource); sMainMenuButtons[prevMenuButtonID]->oMenuButtonState = MENU_BUTTON_STATE_SHRINKING; sCurrentMenuLevel = MENU_LAYER_MAIN; } @@ -1237,7 +1260,7 @@ void load_copy_menu_from_submenu(s16 prevMenuButtonID, struct Object *sourceButt } // Play zoom in sound, select copy menu and render it's buttons sSelectedButtonID = MENU_BUTTON_COPY; - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); sMainMenuButtons[MENU_BUTTON_COPY]->oMenuButtonState = MENU_BUTTON_STATE_GROWING; render_copy_menu_buttons(sMainMenuButtons[MENU_BUTTON_COPY]); } @@ -1252,7 +1275,7 @@ void load_erase_menu_from_submenu(s16 prevMenuButtonID, struct Object *sourceBut // play zoom out sound and shrink previous menu if (sourceButton->oMenuButtonState == MENU_BUTTON_STATE_DEFAULT && sMainMenuButtons[prevMenuButtonID]->oMenuButtonState == MENU_BUTTON_STATE_FULLSCREEN) { - play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource); sMainMenuButtons[prevMenuButtonID]->oMenuButtonState = MENU_BUTTON_STATE_SHRINKING; sCurrentMenuLevel = MENU_LAYER_MAIN; } @@ -1278,7 +1301,7 @@ void load_erase_menu_from_submenu(s16 prevMenuButtonID, struct Object *sourceBut } // Play zoom in sound, select erase menu and render it's buttons sSelectedButtonID = MENU_BUTTON_ERASE; - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); sMainMenuButtons[MENU_BUTTON_ERASE]->oMenuButtonState = MENU_BUTTON_STATE_GROWING; render_erase_menu_buttons(sMainMenuButtons[MENU_BUTTON_ERASE]); } @@ -1353,7 +1376,7 @@ void bhv_menu_button_manager_init(void) { sTextBaseAlpha = 0; } -#if defined(VERSION_JP) || defined(VERSION_SH) +#if defined(VERSION_JP) #define SAVE_FILE_SOUND SOUND_MENU_STAR_SOUND #else #define SAVE_FILE_SOUND SOUND_MENU_STAR_SOUND_OKEY_DOKEY @@ -1401,32 +1424,60 @@ void check_main_menu_clicked_buttons(void) { // Play sound of the save file clicked switch (sSelectedButtonID) { case MENU_BUTTON_PLAY_FILE_A: - play_sound(SAVE_FILE_SOUND, gDefaultSoundArgs); + play_sound(SAVE_FILE_SOUND, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(60, 70); + func_sh_8024C89C(1); +#endif break; case MENU_BUTTON_PLAY_FILE_B: - play_sound(SAVE_FILE_SOUND, gDefaultSoundArgs); + play_sound(SAVE_FILE_SOUND, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(60, 70); + func_sh_8024C89C(1); +#endif break; case MENU_BUTTON_PLAY_FILE_C: - play_sound(SAVE_FILE_SOUND, gDefaultSoundArgs); + play_sound(SAVE_FILE_SOUND, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(60, 70); + func_sh_8024C89C(1); +#endif break; case MENU_BUTTON_PLAY_FILE_D: - play_sound(SAVE_FILE_SOUND, gDefaultSoundArgs); + play_sound(SAVE_FILE_SOUND, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(60, 70); + func_sh_8024C89C(1); +#endif break; // Play sound of the button clicked and render buttons of that menu. case MENU_BUTTON_SCORE: - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif render_score_menu_buttons(sMainMenuButtons[MENU_BUTTON_SCORE]); break; case MENU_BUTTON_COPY: - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif render_copy_menu_buttons(sMainMenuButtons[MENU_BUTTON_COPY]); break; case MENU_BUTTON_ERASE: - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif render_erase_menu_buttons(sMainMenuButtons[MENU_BUTTON_ERASE]); break; case MENU_BUTTON_SOUND_MODE: - play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gDefaultSoundArgs); + play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif render_sound_mode_menu_buttons(sMainMenuButtons[MENU_BUTTON_SOUND_MODE]); break; } @@ -1580,7 +1631,7 @@ void handle_cursor_button_input(void) { sCursorClickingTimer = 1; } else if (gPlayer1Controller->buttonPressed & A_BUTTON) { sScoreFileCoinScoreMode = 1 - sScoreFileCoinScoreMode; - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); } } else { // If cursor is clicked if (gPlayer1Controller->buttonPressed @@ -1727,12 +1778,16 @@ void print_save_file_star_count(s8 fileIndex, s16 x, s16 y) { #define SCORE_X 50 #define COPY_X 115 #define ERASE_X 180 +#ifdef VERSION_JP #define SOUNDMODE_X1 235 +#else + #define SOUNDMODE_X1 sSoundTextX +#endif #define SAVEFILE_X1 92 #define SAVEFILE_X2 209 #define MARIOTEXT_X1 92 #define MARIOTEXT_X2 207 -#elif VERSION_US +#elif defined(VERSION_US) #define SELECT_FILE_X 93 #define SCORE_X 52 #define COPY_X 117 @@ -1742,12 +1797,7 @@ void print_save_file_star_count(s8 fileIndex, s16 x, s16 y) { #define SAVEFILE_X2 209 #define MARIOTEXT_X1 92 #define MARIOTEXT_X2 207 -#elif VERSION_EU - #define SELECT_FILE_X 93 - #define SCORE_X 52 - #define COPY_X 117 - #define ERASE_X 177 - #define SOUNDMODE_X1 sSoundTextX +#else // VERSION_EU #define SAVEFILE_X1 97 #define SAVEFILE_X2 204 #define MARIOTEXT_X1 97 @@ -1762,6 +1812,10 @@ void print_save_file_star_count(s8 fileIndex, s16 x, s16 y) { * Same rule applies for score, copy and erase strings. */ void print_main_menu_strings(void) { +#ifdef VERSION_SH + // The current sound mode is automatically centered on US and Shindou. + static s16 sSoundTextX; // TODO: There should be a way to make this match on both US and Shindou. +#endif // Print "SELECT FILE" text gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin); gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha); @@ -1775,13 +1829,13 @@ void print_main_menu_strings(void) { print_save_file_star_count(SAVE_FILE_D, SAVEFILE_X2, 118); gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end); #ifndef VERSION_EU - // Print menu names + // Print menu names gSPDisplayList(gDisplayListHead++, dl_ia_text_begin); gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha); print_generic_string(SCORE_X, 39, textScore); print_generic_string(COPY_X, 39, textCopy); print_generic_string(ERASE_X, 39, textErase); -#if !defined(VERSION_JP) && !defined(VERSION_SH) +#ifndef VERSION_JP sSoundTextX = get_str_x_pos_from_center(254, textSoundModes[sSoundMode], 10.0f); #endif print_generic_string(SOUNDMODE_X1, 39, textSoundModes[sSoundMode]); @@ -1804,28 +1858,25 @@ void print_main_menu_strings(void) { * Calls print_main_menu_strings to print the remaining strings. */ void print_main_lang_strings(void) { - s16 centeredX; + static s16 centeredX; + // Print "SELECT FILE" text gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin); gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha); centeredX = get_str_x_pos_from_center_scale(160, textSelectFile[sLanguageMode], 12.0f); - sCenteredX = centeredX; print_hud_lut_string(HUD_LUT_GLOBAL, centeredX, 35, textSelectFile[sLanguageMode]); gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end); + // Print menu names gSPDisplayList(gDisplayListHead++, dl_ia_text_begin); gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha); centeredX = get_str_x_pos_from_center(76, textScore[sLanguageMode], 10.0f); - sCenteredX = centeredX; print_generic_string(centeredX, 39, textScore[sLanguageMode]); centeredX = get_str_x_pos_from_center(131, textCopy[sLanguageMode], 10.0f); - sCenteredX = centeredX; print_generic_string(centeredX, 39, textCopy[sLanguageMode]); centeredX = get_str_x_pos_from_center(189, textErase[sLanguageMode], 10.0f); - sCenteredX = centeredX; print_generic_string(centeredX, 39, textErase[sLanguageMode]); centeredX = get_str_x_pos_from_center(245, textOption[sLanguageMode], 10.0f); - sCenteredX = centeredX; print_generic_string(centeredX, 39, textOption[sLanguageMode]); gSPDisplayList(gDisplayListHead++, dl_ia_text_end); @@ -1836,7 +1887,7 @@ void print_main_lang_strings(void) { #ifdef VERSION_EU #define CHECK_FILE_X checkFileX #define NOSAVE_DATA_X1 noSaveDataX -#elif VERSION_JP +#elif defined(VERSION_JP) || defined(VERSION_SH) #define CHECK_FILE_X 90 #define NOSAVE_DATA_X1 90 #else @@ -1872,7 +1923,7 @@ void score_menu_display_message(s8 messageID) { #define RETURN_X 45 #define COPYFILE_X1 128 #define ERASEFILE_X1 228 -#elif VERSION_EU +#elif defined(VERSION_EU) #define RETURN_X centeredX #define COPYFILE_X1 centeredX #define ERASEFILE_X1 centeredX @@ -1959,7 +2010,7 @@ void print_score_menu_strings(void) { #define NOSAVE_DATA_X2 90 #define COPYCOMPLETE_X 90 #define SAVE_EXISTS_X1 90 -#elif VERSION_EU +#elif defined(VERSION_EU) #define NOFILE_COPY_X centeredX #define COPY_FILE_X centeredX #define COPYIT_WHERE_X centeredX @@ -2071,10 +2122,13 @@ void copy_menu_update_message(void) { } } -#if defined(VERSION_JP) || defined(VERSION_SH) +#if defined(VERSION_JP) #define VIEWSCORE_X1 133 #define ERASEFILE_X2 220 -#elif VERSION_EU +#elif defined(VERSION_SH) + #define VIEWSCORE_X1 133 + #define ERASEFILE_X2 230 +#elif defined(VERSION_EU) #define VIEWSCORE_X1 centeredX #define ERASEFILE_X2 centeredX #else @@ -2134,20 +2188,29 @@ void print_copy_menu_strings(void) { #endif } -#if defined(VERSION_JP) || defined(VERSION_SH) +#if defined(VERSION_JP) #define CURSOR_X 160.0f - #define MENU_ERASE_YES_MIN_X 0x91 - #define MENU_ERASE_YES_MAX_X 0xA4 + #define MENU_ERASE_YES_MIN_X 145 + #define MENU_ERASE_YES_MAX_X 164 +#elif defined(VERSION_SH) + #define CURSOR_X (x + 70) + #define MENU_ERASE_YES_MIN_X 145 + #define MENU_ERASE_YES_MAX_X 164 #else - #define CURSOR_X (x + 0x46) - #define MENU_ERASE_YES_MIN_X 0x8C - #define MENU_ERASE_YES_MAX_X 0xA9 + #define CURSOR_X (x + 70) + #define MENU_ERASE_YES_MIN_X 140 + #define MENU_ERASE_YES_MAX_X 169 #endif -#define MENU_ERASE_YES_NO_MIN_Y 0xBF -#define MENU_ERASE_YES_NO_MAX_Y 0xD2 -#define MENU_ERASE_NO_MIN_X 0xBD -#define MENU_ERASE_NO_MAX_X 0xDA +#define MENU_ERASE_YES_NO_MIN_Y 191 +#define MENU_ERASE_YES_NO_MAX_Y 210 +#ifdef VERSION_SH + #define MENU_ERASE_NO_MIN_X 194 + #define MENU_ERASE_NO_MAX_X 213 +#else + #define MENU_ERASE_NO_MIN_X 189 + #define MENU_ERASE_NO_MAX_X 218 +#endif /** * Prints the "YES NO" prompt and checks if one of the prompts are hovered to do it's functions. @@ -2180,7 +2243,10 @@ void print_erase_menu_prompt(s16 x, s16 y) { if (sCursorClickingTimer == 2) { // ..and is hovering "YES", delete file if (sEraseYesNoHoverState == MENU_ERASE_HOVER_YES) { - play_sound(SOUND_MARIO_WAAAOOOW, gDefaultSoundArgs); + play_sound(SOUND_MARIO_WAAAOOOW, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[MENU_BUTTON_ERASE]->oMenuButtonActionPhase = ERASE_PHASE_MARIO_ERASED; sFadeOutText = TRUE; sMainMenuTimer = 0; @@ -2192,7 +2258,10 @@ void print_erase_menu_prompt(s16 x, s16 y) { sEraseYesNoHoverState = MENU_ERASE_HOVER_NONE; // ..and is hovering "NO", return back to main phase } else if (sEraseYesNoHoverState == MENU_ERASE_HOVER_NO) { - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(5, 80); +#endif sMainMenuButtons[MENU_BUTTON_ERASE_MIN + sSelectedFileIndex]->oMenuButtonState = MENU_BUTTON_STATE_ZOOM_OUT; sMainMenuButtons[MENU_BUTTON_ERASE]->oMenuButtonActionPhase = ERASE_PHASE_MAIN; @@ -2216,12 +2285,16 @@ void print_erase_menu_prompt(s16 x, s16 y) { // M a r i o A --- マ リ オ A // 0 1 2 3 4 5 6 --- 0 1 2 3 #if defined(VERSION_JP) || defined(VERSION_SH) +#ifdef VERSION_SH + #define ERASE_FILE_X 111 +#else #define ERASE_FILE_X 96 +#endif #define NOSAVE_DATA_X3 90 #define MARIO_ERASED_VAR 3 #define MARIO_ERASED_X 90 #define SAVE_EXISTS_X2 90 -#elif VERSION_EU +#elif defined(VERSION_EU) #define ERASE_FILE_X centeredX #define NOSAVE_DATA_X3 centeredX #define MARIO_ERASED_VAR 6 @@ -2393,7 +2466,7 @@ void print_erase_menu_strings(void) { #if defined(VERSION_JP) || defined(VERSION_SH) #define SOUND_HUD_X 96 -#elif VERSION_US +#elif defined(VERSION_US) #define SOUND_HUD_X 88 #endif @@ -2405,9 +2478,9 @@ void print_erase_menu_strings(void) { void print_sound_mode_menu_strings(void) { s32 mode; -#ifdef VERSION_US +#if defined(VERSION_US) || defined(VERSION_SH) s16 textX; -#elif VERSION_EU +#elif defined(VERSION_EU) s32 textX; #endif @@ -2462,11 +2535,11 @@ void print_sound_mode_menu_strings(void) { } else { gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, sTextBaseAlpha); } - #ifdef VERSION_US - // Mode names are centered correctly on US + #ifndef VERSION_JP + // Mode names are centered correctly on US and Shindou textX = get_str_x_pos_from_center(mode * 74 + 87, textSoundModes[mode], 10.0f); print_generic_string(textX, 87, textSoundModes[mode]); - #elif VERSION_JP + #else print_generic_string(mode * 74 + 67, 87, textSoundModes[mode]); #endif } @@ -2480,7 +2553,6 @@ void print_sound_mode_menu_strings(void) { gSPDisplayList(gDisplayListHead++, dl_ia_text_end); } - unsigned char textStarX[] = { TEXT_STAR_X }; /** @@ -2577,15 +2649,24 @@ void print_score_file_star_score(s8 fileIndex, s16 courseIndex, s16 x, s16 y) { #if defined(VERSION_JP) || defined(VERSION_SH) #define MARIO_X 28 #define FILE_LETTER_X 86 +#ifdef VERSION_JP + #define LEVEL_NUM_PAD 0 + #define SECRET_STARS_PAD 0 +#else + #define LEVEL_NUM_PAD 5 + #define SECRET_STARS_PAD 10 +#endif #define LEVEL_NAME_X 23 - #define SECRET_STARS_X 152 + #define STAR_SCORE_X 152 #define MYSCORE_X 237 #define HISCORE_X 237 #else #define MARIO_X 25 #define FILE_LETTER_X 95 - #define LEVEL_NAME_X 29 - #define SECRET_STARS_X 171 + #define LEVEL_NUM_PAD 3 + #define SECRET_STARS_PAD 6 + #define LEVEL_NAME_X 23 + #define STAR_SCORE_X 171 #define MYSCORE_X 238 #define HISCORE_X 231 #endif @@ -2597,25 +2678,23 @@ void print_score_file_star_score(s8 fileIndex, s16 courseIndex, s16 x, s16 y) { /** * Prints save file score strings that shows when a save file is chosen inside the score menu. */ - void print_save_file_scores(s8 fileIndex) { +void print_save_file_scores(s8 fileIndex) { #ifndef VERSION_EU unsigned char textMario[] = { TEXT_MARIO }; -#endif -#ifndef VERSION_US +#ifdef VERSION_JP unsigned char textFileLetter[] = { TEXT_ZERO }; -#endif -#if defined(VERSION_JP) || defined(VERSION_SH) void **levelNameTable = segmented_to_virtual(seg2_course_name_table); #endif -#ifndef VERSION_EU unsigned char textHiScore[] = { TEXT_HI_SCORE }; unsigned char textMyScore[] = { TEXT_MY_SCORE }; - #ifdef VERSION_US - unsigned char textFileLetter[] = { TEXT_ZERO }; - void **levelNameTable = segmented_to_virtual(seg2_course_name_table); - #endif +#if defined(VERSION_US) || defined(VERSION_SH) + unsigned char textFileLetter[] = { TEXT_ZERO }; + void **levelNameTable = segmented_to_virtual(seg2_course_name_table); +#endif #else + unsigned char textFileLetter[] = { TEXT_ZERO }; void **levelNameTable; + switch (sLanguageMode) { case LANGUAGE_ENGLISH: levelNameTable = segmented_to_virtual(eu_course_strings_en_table); @@ -2645,44 +2724,36 @@ void print_score_file_star_score(s8 fileIndex, s16 courseIndex, s16 x, s16 y) { gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha); //! Huge print list, for loops exist for a reason! -// PADCHAR is used to difference an x position value between -// JP and US when the course number is only one digit. -#if defined(VERSION_JP) || defined(VERSION_SH) - #define PADCHAR 0 - #define PRINT_COURSE_SCORES(courseIndex, pad) \ - print_menu_generic_string(23 + (pad * 3), 23 + 12 * courseIndex, segmented_to_virtual(levelNameTable[courseIndex - 1])); \ - print_score_file_star_score(fileIndex, courseIndex - 1, 152, 23 + 12 * courseIndex); \ - print_score_file_course_coin_score(fileIndex, courseIndex - 1, 213, 23 + 12 * courseIndex); -#else - #define PADCHAR 1 - #define PRINT_COURSE_SCORES(courseIndex, pad) \ - print_menu_generic_string(23 + (pad * 3), 23 + 12 * courseIndex, segmented_to_virtual(levelNameTable[courseIndex - 1])); \ - print_score_file_star_score(fileIndex, courseIndex - 1, 171, 23 + 12 * courseIndex); \ - print_score_file_course_coin_score(fileIndex, courseIndex - 1, 213, 23 + 12 * courseIndex); -#endif - // Course values are indexed, from Bob-omb Battlefield to Rainbow Ride - PRINT_COURSE_SCORES(COURSE_BOB, PADCHAR) // BOB - PRINT_COURSE_SCORES(COURSE_WF, PADCHAR) // WF - PRINT_COURSE_SCORES(COURSE_JRB, PADCHAR) // JRB - PRINT_COURSE_SCORES(COURSE_CCM, PADCHAR) // CCM - PRINT_COURSE_SCORES(COURSE_BBH, PADCHAR) // BBH - PRINT_COURSE_SCORES(COURSE_HMC, PADCHAR) // HMC - PRINT_COURSE_SCORES(COURSE_LLL, PADCHAR) // LLL - PRINT_COURSE_SCORES(COURSE_SSL, PADCHAR) // SSL - PRINT_COURSE_SCORES(COURSE_DDD, PADCHAR) // DDD - PRINT_COURSE_SCORES(COURSE_SL, 0) // SL - PRINT_COURSE_SCORES(COURSE_WDW, 0) // WDW - PRINT_COURSE_SCORES(COURSE_TTM, 0) // TTM - PRINT_COURSE_SCORES(COURSE_THI, 0) // THI - PRINT_COURSE_SCORES(COURSE_TTC, 0) // TTC - PRINT_COURSE_SCORES(COURSE_RR, 0) // RR -#undef PRINT_COURSE_SCORES -#undef PADCHAR +#define PRINT_COURSE_SCORES(courseIndex, pad) \ + print_menu_generic_string(LEVEL_NAME_X + (pad * LEVEL_NUM_PAD), 23 + 12 * courseIndex, \ + segmented_to_virtual(levelNameTable[courseIndex - 1])); \ + print_score_file_star_score(fileIndex, courseIndex - 1, STAR_SCORE_X, 23 + 12 * courseIndex); \ + print_score_file_course_coin_score(fileIndex, courseIndex - 1, 213, 23 + 12 * courseIndex); - // Print level name - print_menu_generic_string(LEVEL_NAME_X, 215, segmented_to_virtual(levelNameTable[25])); - // Print castle secret stars - print_score_file_castle_secret_stars(fileIndex, SECRET_STARS_X, 215); + // Course values are indexed, from Bob-omb Battlefield to Rainbow Ride + PRINT_COURSE_SCORES(COURSE_BOB, 1) + PRINT_COURSE_SCORES(COURSE_WF, 1) + PRINT_COURSE_SCORES(COURSE_JRB, 1) + PRINT_COURSE_SCORES(COURSE_CCM, 1) + PRINT_COURSE_SCORES(COURSE_BBH, 1) + PRINT_COURSE_SCORES(COURSE_HMC, 1) + PRINT_COURSE_SCORES(COURSE_LLL, 1) + PRINT_COURSE_SCORES(COURSE_SSL, 1) + PRINT_COURSE_SCORES(COURSE_DDD, 1) + PRINT_COURSE_SCORES(COURSE_SL, 0) + PRINT_COURSE_SCORES(COURSE_WDW, 0) + PRINT_COURSE_SCORES(COURSE_TTM, 0) + PRINT_COURSE_SCORES(COURSE_THI, 0) + PRINT_COURSE_SCORES(COURSE_TTC, 0) + PRINT_COURSE_SCORES(COURSE_RR, 0) + +#undef PRINT_COURSE_SCORES + + // Print castle secret stars text + print_menu_generic_string(LEVEL_NAME_X + SECRET_STARS_PAD, 23 + 12 * 16, + segmented_to_virtual(levelNameTable[25])); + // Print castle secret stars score + print_score_file_castle_secret_stars(fileIndex, STAR_SCORE_X, 23 + 12 * 16); // Print current coin score mode if (sScoreFileCoinScoreMode == 0) { diff --git a/src/menu/intro_geo.c b/src/menu/intro_geo.c index 79566dd0..142cf240 100644 --- a/src/menu/intro_geo.c +++ b/src/menu/intro_geo.c @@ -8,6 +8,9 @@ #include "sm64.h" #include "textures.h" #include "types.h" +#include "buffers/framebuffers.h" +#include "game/game_init.h" +#include "audio/external.h" #include "prevent_bss_reordering.h" #include "gfx_dimensions.h" @@ -29,14 +32,14 @@ struct GraphNodeMore { }; // intro geo bss -s32 gGameOverFrameCounter; -s32 gGameOverTableIndex; -s16 gTitleZoomCounter; -s32 gTitleFadeCounter; +#ifdef VERSION_SH +static u16 *sFrameBuffers[3]; +#endif +static s32 sGameOverFrameCounter; +static s32 sGameOverTableIndex; +static s16 sIntroFrameCounter; +static s32 sTmCopyrightAlpha; -// intro screen background display lists for each of four 80x20 textures -const Gfx *introBackgroundDlRows[] = { title_screen_bg_dl_0A000130, title_screen_bg_dl_0A000148, - title_screen_bg_dl_0A000160, title_screen_bg_dl_0A000178 }; // intro screen background texture X offsets float introBackgroundOffsetX[] = { @@ -51,23 +54,6 @@ float introBackgroundOffsetY[] = { // table that points to either the "Super Mario 64" or "Game Over" tables const u8 *const *introBackgroundTextureType[] = { mario_title_texture_table, game_over_texture_table }; -s8 introBackgroundIndexTable[] = { - INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, - INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, - INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, - INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, -}; - -// only one table of indexes listed -s8 *introBackgroundTables[] = { introBackgroundIndexTable }; - -s8 gameOverBackgroundTable[] = { - INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, - INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, - INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, - INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, -}; - // order of tiles that are flipped from "Game Over" to "Super Mario 64" s8 gameOverBackgroundFlipOrder[] = { 0x00, 0x01, 0x02, 0x03, 0x07, 0x0B, 0x0a, 0x09, 0x08, 0x04, 0x05, 0x06 }; @@ -84,10 +70,10 @@ void patch_title_screen_scales(void) { } } -Gfx *geo_title_screen(s32 sp50, struct GraphNode *sp54, UNUSED void *context) { +Gfx *geo_title_screen(s32 state, struct GraphNode *sp54, UNUSED void *context) { struct GraphNode *graphNode; // sp4c - Gfx *displayList; // sp48 - Gfx *displayListIter; // sp44 + Gfx *dl; // sp48 + Gfx *dlIter; // sp44 Mtx *scaleMat; // sp40 f32 *scaleTable1; // sp3c f32 *scaleTable2; // sp38 @@ -97,31 +83,36 @@ Gfx *geo_title_screen(s32 sp50, struct GraphNode *sp54, UNUSED void *context) { Vec3f scale; Vec3f scaleInterpolated; graphNode = sp54; - displayList = NULL; - displayListIter = NULL; + dl = NULL; + dlIter = NULL; scaleTable1 = segmented_to_virtual(intro_seg7_table_0700C790); scaleTable2 = segmented_to_virtual(intro_seg7_table_0700C880); - if (sp50 != 1) { - gTitleZoomCounter = 0; - } else if (sp50 == 1) { - graphNode->flags = (graphNode->flags & 0xFF) | 0x100; + if (state != 1) { + sIntroFrameCounter = 0; + } else if (state == 1) { + graphNode->flags = (graphNode->flags & 0xFF) | (LAYER_OPAQUE << 8); scaleMat = alloc_display_list(sizeof(*scaleMat)); - displayList = alloc_display_list(4 * sizeof(*displayList)); - displayListIter = displayList; - if (gTitleZoomCounter >= 0 && gTitleZoomCounter < INTRO_STEPS_ZOOM_IN) { - scaleX = scaleTable1[gTitleZoomCounter * 3]; - scaleY = scaleTable1[gTitleZoomCounter * 3 + 1]; - scaleZ = scaleTable1[gTitleZoomCounter * 3 + 2]; - } else if (gTitleZoomCounter >= INTRO_STEPS_ZOOM_IN && gTitleZoomCounter < INTRO_STEPS_HOLD_1) { + dl = alloc_display_list(4 * sizeof(*dl)); + dlIter = dl; + + // determine scale based on the frame counter + if (sIntroFrameCounter >= 0 && sIntroFrameCounter < INTRO_STEPS_ZOOM_IN) { + // zooming in + scaleX = scaleTable1[sIntroFrameCounter * 3]; + scaleY = scaleTable1[sIntroFrameCounter * 3 + 1]; + scaleZ = scaleTable1[sIntroFrameCounter * 3 + 2]; + } else if (sIntroFrameCounter >= INTRO_STEPS_ZOOM_IN && sIntroFrameCounter < INTRO_STEPS_HOLD_1) { + // holding scaleX = 1.0f; scaleY = 1.0f; scaleZ = 1.0f; - } else if (gTitleZoomCounter >= INTRO_STEPS_HOLD_1 - && gTitleZoomCounter < INTRO_STEPS_ZOOM_OUT) { - scaleX = scaleTable2[(gTitleZoomCounter - INTRO_STEPS_HOLD_1) * 3]; - scaleY = scaleTable2[(gTitleZoomCounter - INTRO_STEPS_HOLD_1) * 3 + 1]; - scaleZ = scaleTable2[(gTitleZoomCounter - INTRO_STEPS_HOLD_1) * 3 + 2]; + } else if (sIntroFrameCounter >= INTRO_STEPS_HOLD_1 && sIntroFrameCounter < INTRO_STEPS_ZOOM_OUT) { + // zooming out + scaleX = scaleTable2[(sIntroFrameCounter - INTRO_STEPS_HOLD_1) * 3]; + scaleY = scaleTable2[(sIntroFrameCounter - INTRO_STEPS_HOLD_1) * 3 + 1]; + scaleZ = scaleTable2[(sIntroFrameCounter - INTRO_STEPS_HOLD_1) * 3 + 2]; } else { + // disappeared scaleX = 0.0f; scaleY = 0.0f; scaleZ = 0.0f; @@ -130,70 +121,152 @@ Gfx *geo_title_screen(s32 sp50, struct GraphNode *sp54, UNUSED void *context) { interpolate_vectors(scaleInterpolated, sIntroScale, scale); vec3f_set(sIntroScale, scaleX, scaleY, scaleZ); guScale(scaleMat, scaleInterpolated[0], scaleInterpolated[1], scaleInterpolated[2]); - sIntroScalePos = displayListIter; - gSPMatrix(displayListIter++, scaleMat, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH); - gSPDisplayList(displayListIter++, &intro_seg7_dl_0700B3A0); - gSPPopMatrix(displayListIter++, G_MTX_MODELVIEW); - gSPEndDisplayList(displayListIter); - gTitleZoomCounter++; + sIntroScalePos = dlIter; + gSPMatrix(dlIter++, scaleMat, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH); + gSPDisplayList(dlIter++, &intro_seg7_dl_0700B3A0); // draw model + gSPPopMatrix(dlIter++, G_MTX_MODELVIEW); + gSPEndDisplayList(dlIter); + + sIntroFrameCounter++; } - return displayList; + return dl; } -Gfx *geo_fade_transition(s32 sp40, struct GraphNode *sp44, UNUSED void *context) { - struct GraphNode *graphNode = sp44; // sp3c - Gfx *displayList = NULL; // sp38 - Gfx *displayListIter = NULL; // sp34 - if (sp40 != 1) { - gTitleFadeCounter = 0; // D_801B985C - } else if (sp40 == 1) { - displayList = alloc_display_list(5 * sizeof(*displayList)); - displayListIter = displayList; - gSPDisplayList(displayListIter++, dl_proj_mtx_fullscreen); - gDPSetEnvColor(displayListIter++, 255, 255, 255, gTitleFadeCounter); - if (gTitleFadeCounter == 255) { - if (0) { - } - graphNode->flags = (graphNode->flags & 0xFF) | 0x100; - gDPSetRenderMode(displayListIter++, G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2); +/** + * Geo callback to render the "Super Mario 64" logo on the title screen + */ +Gfx *geo_intro_super_mario_64_logo(s32 state, struct GraphNode *node, UNUSED void *context) { + struct GraphNode *graphNode = node; + Gfx *dl = NULL; + Gfx *dlIter = NULL; + Mtx *scaleMat; + f32 *scaleTable1 = segmented_to_virtual(intro_seg7_table_0700C790); + f32 *scaleTable2 = segmented_to_virtual(intro_seg7_table_0700C880); + f32 scaleX; + f32 scaleY; + f32 scaleZ; + + if (state != 1) { + sIntroFrameCounter = 0; + } else if (state == 1) { + graphNode->flags = (graphNode->flags & 0xFF) | (LAYER_OPAQUE << 8); + scaleMat = alloc_display_list(sizeof(*scaleMat)); + dl = alloc_display_list(4 * sizeof(*dl)); + dlIter = dl; + + // determine scale based on the frame counter + if (sIntroFrameCounter >= 0 && sIntroFrameCounter < INTRO_STEPS_ZOOM_IN) { + // zooming in + scaleX = scaleTable1[sIntroFrameCounter * 3]; + scaleY = scaleTable1[sIntroFrameCounter * 3 + 1]; + scaleZ = scaleTable1[sIntroFrameCounter * 3 + 2]; + } else if (sIntroFrameCounter >= INTRO_STEPS_ZOOM_IN && sIntroFrameCounter < INTRO_STEPS_HOLD_1) { + // holding + scaleX = 1.0f; + scaleY = 1.0f; + scaleZ = 1.0f; + } else if (sIntroFrameCounter >= INTRO_STEPS_HOLD_1 && sIntroFrameCounter < INTRO_STEPS_ZOOM_OUT) { + // zooming out + scaleX = scaleTable2[(sIntroFrameCounter - INTRO_STEPS_HOLD_1) * 3]; + scaleY = scaleTable2[(sIntroFrameCounter - INTRO_STEPS_HOLD_1) * 3 + 1]; + scaleZ = scaleTable2[(sIntroFrameCounter - INTRO_STEPS_HOLD_1) * 3 + 2]; } else { - graphNode->flags = (graphNode->flags & 0xFF) | 0x500; - gDPSetRenderMode(displayListIter++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); - if (0) { - } + // disappeared + scaleX = 0.0f; + scaleY = 0.0f; + scaleZ = 0.0f; } - gSPDisplayList(displayListIter++, &intro_seg7_dl_0700C6A0); - gSPEndDisplayList(displayListIter); - if (gTitleZoomCounter >= 0x13) { - gTitleFadeCounter += 0x1a; - if (gTitleFadeCounter >= 0x100) { - gTitleFadeCounter = 0xFF; + guScale(scaleMat, scaleX, scaleY, scaleZ); + + gSPMatrix(dlIter++, scaleMat, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH); + gSPDisplayList(dlIter++, &intro_seg7_dl_0700B3A0); // draw model + gSPPopMatrix(dlIter++, G_MTX_MODELVIEW); + gSPEndDisplayList(dlIter); + + sIntroFrameCounter++; + } + return dl; +} + +/** + * Geo callback to render TM and Copyright on the title screen + */ +Gfx *geo_intro_tm_copyright(s32 state, struct GraphNode *node, UNUSED void *context) { + struct GraphNode *graphNode = node; + Gfx *dl = NULL; + Gfx *dlIter = NULL; + + if (state != 1) { // reset + sTmCopyrightAlpha = 0; + } else if (state == 1) { // draw + dl = alloc_display_list(5 * sizeof(*dl)); + dlIter = dl; + gSPDisplayList(dlIter++, dl_proj_mtx_fullscreen); + gDPSetEnvColor(dlIter++, 255, 255, 255, sTmCopyrightAlpha); + switch (sTmCopyrightAlpha) { + case 255: // opaque + graphNode->flags = (graphNode->flags & 0xFF) | (LAYER_OPAQUE << 8); + gDPSetRenderMode(dlIter++, G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2); + break; + default: // blend + graphNode->flags = (graphNode->flags & 0xFF) | (LAYER_TRANSPARENT << 8); + gDPSetRenderMode(dlIter++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); + break; + } + gSPDisplayList(dlIter++, &intro_seg7_dl_0700C6A0); // draw model + gSPEndDisplayList(dlIter); + + // Once the "Super Mario 64" logo has just about zoomed fully, fade in the "TM" and copyright text + if (sIntroFrameCounter >= 19) { + sTmCopyrightAlpha += 26; + if (sTmCopyrightAlpha > 255) { + sTmCopyrightAlpha = 255; } } } - return displayList; + return dl; } -Gfx *intro_backdrop_one_image(s32 index, s8 *backgroundTable) { - Mtx *mtx; // sp5c - Gfx *displayList; // sp58 - Gfx *displayListIter; // sp54 - const u8 *const *vIntroBgTable; // sp50 - s32 i; // sp4c - f32 aspect = GFX_DIMENSIONS_ASPECT_RATIO; - int num_tiles_h = (((aspect*SCREEN_HEIGHT)+79)/80); - float x_ofs = (SCREEN_WIDTH/2)-(aspect*SCREEN_HEIGHT/2); - - mtx = alloc_display_list(sizeof(*mtx)); - displayList = alloc_display_list(36 * sizeof(*displayList)); - displayListIter = displayList; - vIntroBgTable = segmented_to_virtual(introBackgroundTextureType[backgroundTable[0]]); - guTranslate(mtx, ((index%num_tiles_h)*80)+x_ofs, (index/num_tiles_h)*80, 0.0f); +/** + * Generates a display list for a single background tile + * + * @param index which tile to render (value from 0 to 11) + * @param backgroundTable array describing which image to use for each tile (0 denotes a "Super Mario 64" image, and 1 denotes a "Game Over" image) + */ +static Gfx *intro_backdrop_one_image(s32 index, s8 *backgroundTable) { + // intro screen background display lists for each of four 80x20 textures + static const Gfx *introBackgroundDlRows[] = { title_screen_bg_dl_0A000130, title_screen_bg_dl_0A000148, + title_screen_bg_dl_0A000160, title_screen_bg_dl_0A000178 }; + + // intro screen background texture X offsets + static float xCoords[] = { + 0, 80, 160, 240, + 0, 80, 160, 240, + 0, 80, 160, 240, + }; + + // intro screen background texture Y offsets + static float yCoords[] = { + 160, 160, 160, 160, + 80, 80, 80, 80, + 0, 0, 0, 0, + }; + + // table that points to either the "Super Mario 64" or "Game Over" tables + static const u8 *const *textureTables[] = { mario_title_texture_table, game_over_texture_table }; + + Mtx *mtx = alloc_display_list(sizeof(*mtx)); + Gfx *displayList = alloc_display_list(36 * sizeof(*displayList)); + Gfx *displayListIter = displayList; + const u8 *const *vIntroBgTable = segmented_to_virtual(textureTables[backgroundTable[index]]); + s32 i; + + guTranslate(mtx, xCoords[index], yCoords[index], 0.0f); gSPMatrix(displayListIter++, mtx, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH); gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000118); for (i = 0; i < 4; ++i) { - gDPLoadTextureBlock(displayListIter++, vIntroBgTable[i], G_IM_FMT_RGBA, G_IM_SIZ_16b, 80, 20, 0, - G_TX_CLAMP, G_TX_CLAMP, 7, 6, G_TX_NOLOD, G_TX_NOLOD) + gDPLoadTextureBlock(displayListIter++, vIntroBgTable[i], G_IM_FMT_RGBA, G_IM_SIZ_16b, 80, 20, 0, + G_TX_CLAMP, G_TX_CLAMP, 7, 6, G_TX_NOLOD, G_TX_NOLOD) gSPDisplayList(displayListIter++, introBackgroundDlRows[i]); } gSPPopMatrix(displayListIter++, G_MTX_MODELVIEW); @@ -201,81 +274,296 @@ Gfx *intro_backdrop_one_image(s32 index, s8 *backgroundTable) { return displayList; } -Gfx *geo_intro_backdrop(s32 sp48, struct GraphNode *sp4c, UNUSED void *context) { - struct GraphNodeMore *graphNode; // sp44 - s32 index; // sp40 - s8 *backgroundTable; // sp3c - Gfx *displayList; // sp38 - Gfx *displayListIter; // sp34 - s32 i; // sp30 - graphNode = (struct GraphNodeMore *) sp4c; - index = graphNode->unk18 & 0xff; // TODO: word at offset 0x18 of struct GraphNode - backgroundTable = introBackgroundTables[index]; - displayList = NULL; - displayListIter = NULL; +static s8 introBackgroundIndexTable[] = { + INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, + INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, + INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, + INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, INTRO_BACKGROUND_SUPER_MARIO, +}; + +// only one table of indexes listed +static s8 *introBackgroundTables[] = { introBackgroundIndexTable }; + +/** + * Geo callback to render the intro background tiles + */ +Gfx *geo_intro_regular_backdrop(s32 state, struct GraphNode *node, UNUSED void *context) { + struct GraphNodeMore *graphNode = (struct GraphNodeMore *) node; + s32 index = graphNode->unk18 & 0xff; // TODO: word at offset 0x18 of struct GraphNode (always ends up being 0) + s8 *backgroundTable = introBackgroundTables[index]; + Gfx *dl = NULL; + Gfx *dlIter = NULL; + s32 i; f32 aspect = GFX_DIMENSIONS_ASPECT_RATIO; - int num_tiles_h = (((aspect*SCREEN_HEIGHT)+79)/80); - - if (sp48 == 1) { - displayList = alloc_display_list(((num_tiles_h*3)+4) * sizeof(*displayList)); - displayListIter = displayList; - graphNode->node.flags = (graphNode->node.flags & 0xFF) | 0x100; - gSPDisplayList(displayListIter++, &dl_proj_mtx_fullscreen); - gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000100); + s32 num_tiles_h = (((aspect*SCREEN_HEIGHT)+79)/80); + + if (state == 1) { // draw + dl = alloc_display_list(((num_tiles_h*3)+4) * sizeof(*dl)); + dlIter = dl; + graphNode->node.flags = (graphNode->node.flags & 0xFF) | (LAYER_OPAQUE << 8); + gSPDisplayList(dlIter++, &dl_proj_mtx_fullscreen); + gSPDisplayList(dlIter++, &title_screen_bg_dl_0A000100); for (i = 0; i < num_tiles_h*3; ++i) { - gSPDisplayList(displayListIter++, intro_backdrop_one_image(i, backgroundTable)); + gSPDisplayList(dlIter++, intro_backdrop_one_image(i, backgroundTable)); } - gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000190); - gSPEndDisplayList(displayListIter); + gSPDisplayList(dlIter++, &title_screen_bg_dl_0A000190); + gSPEndDisplayList(dlIter); } - return displayList; + return dl; } -Gfx *geo_game_over_tile(s32 sp40, struct GraphNode *sp44, UNUSED void *context) { - struct GraphNode *graphNode; // sp3c - Gfx *displayList; // sp38 - Gfx *displayListIter; // sp34 - s32 j; // sp30 - s32 i; // sp2c - graphNode = sp44; - displayList = NULL; - displayListIter = NULL; +static s8 gameOverBackgroundTable[] = { + INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, + INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, + INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, + INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, INTRO_BACKGROUND_GAME_OVER, +}; + +/** + * Geo callback to render the Game Over background tiles + */ +Gfx *geo_intro_gameover_backdrop(s32 state, struct GraphNode *node, UNUSED void *context) { + struct GraphNode *graphNode = node; + Gfx *dl = NULL; + Gfx *dlIter = NULL; f32 aspect = GFX_DIMENSIONS_ASPECT_RATIO; - int num_tiles_h = (((aspect*SCREEN_HEIGHT)+79)/80); - - if (sp40 != 1) { - gGameOverFrameCounter = 0; - gGameOverTableIndex = -2; - for (i = 0; i < (s32) sizeof(gameOverBackgroundTable); ++i) { + s32 num_tiles_h = (((aspect*SCREEN_HEIGHT)+79)/80); + s32 j; + s32 i; + + if (state != 1) { // reset + sGameOverFrameCounter = 0; + sGameOverTableIndex = -2; + for (i = 0; i < ARRAY_COUNT(gameOverBackgroundTable); ++i) gameOverBackgroundTable[i] = INTRO_BACKGROUND_GAME_OVER; - } - } else { - displayList = alloc_display_list(((num_tiles_h*3)+4) * sizeof(*displayList)); - displayListIter = displayList; - if (gGameOverTableIndex == -2) { - if (gGameOverFrameCounter == 180) { - gGameOverTableIndex++; - gGameOverFrameCounter = 0; + } else { // draw + dl = alloc_display_list(((num_tiles_h*3)+4) * sizeof(*dl)); + dlIter = dl; + if (sGameOverTableIndex == -2) { + if (sGameOverFrameCounter == 180) { + sGameOverTableIndex++; + sGameOverFrameCounter = 0; } } else { // transition tile from "Game Over" to "Super Mario 64" - if (gGameOverTableIndex != 11 && !(gGameOverFrameCounter & 0x1)) { - gGameOverTableIndex++; - gameOverBackgroundTable[gameOverBackgroundFlipOrder[gGameOverTableIndex]] = + if (sGameOverTableIndex != 11 && !(sGameOverFrameCounter & 0x1)) { + // order of tiles that are flipped from "Game Over" to "Super Mario 64" + static s8 flipOrder[] = { 0, 1, 2, 3, 7, 11, 10, 9, 8, 4, 5, 6 }; + + sGameOverTableIndex++; + gameOverBackgroundTable[flipOrder[sGameOverTableIndex]] = INTRO_BACKGROUND_SUPER_MARIO; } } - if (gGameOverTableIndex != 11) { - gGameOverFrameCounter++; + if (sGameOverTableIndex != 11) { + sGameOverFrameCounter++; } - graphNode->flags = (graphNode->flags & 0xFF) | 0x100; - gSPDisplayList(displayListIter++, &dl_proj_mtx_fullscreen); - gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000100); - for (j = 0; j < (s32) num_tiles_h*3; ++j) { - gSPDisplayList(displayListIter++, intro_backdrop_one_image(j, gameOverBackgroundTable)); + graphNode->flags = (graphNode->flags & 0xFF) | (LAYER_OPAQUE << 8); + + // draw all the tiles + gSPDisplayList(dlIter++, &dl_proj_mtx_fullscreen); + gSPDisplayList(dlIter++, &title_screen_bg_dl_0A000100); + for (j = 0; j < num_tiles_h*3; ++j) { + gSPDisplayList(dlIter++, intro_backdrop_one_image(j, gameOverBackgroundTable)); } - gSPDisplayList(displayListIter++, &title_screen_bg_dl_0A000190); - gSPEndDisplayList(displayListIter); + gSPDisplayList(dlIter++, &title_screen_bg_dl_0A000190); + gSPEndDisplayList(dlIter); } - return displayList; + return dl; } + +#ifdef VERSION_SH +extern Gfx title_screen_bg_dl_0A0065E8[]; +extern Gfx title_screen_bg_dl_0A006618[]; +extern Gfx title_screen_bg_dl_0A007548[]; + +//Data +s8 sFaceVisible[] = { + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 0, 0, 0, 1, 1, + 1, 1, 0, 0, 0, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, +}; + +s8 sFaceToggleOrder[] = { + 0, 1, 2, 3, 4, 5, 6, 7, + 15, 23, 31, 39, 47, 46, 45, 44, + 43, 42, 41, 40, 32, 24, 16, 8, + 9, 10, 11, 12, 13, 14, 22, 30, + 38, 37, 36, 35, 34, 33, 25, 17, +}; + +s8 sFaceCounter = 0; + +void intro_gen_face_texrect(Gfx **dlIter) +{ + s32 x; + s32 y; + + for (y = 0; y < 6; y++) { + for (x = 0; x < 8; x++) { + if (sFaceVisible[y*8 + x] != 0) { + gSPTextureRectangle((*dlIter)++, (x * 40) << 2, (y * 40) << 2, (x * 40 + 39) << 2, (y * 40 + 39) << 2, 0, + 0, 0, 4 << 10, 1 << 10); + } + } + } +} + +Gfx *intro_draw_face(u16 *image, s32 imageW, s32 imageH) +{ + Gfx *dl; + Gfx *dlIter; + + dl = alloc_display_list(110 * sizeof(Gfx)); + + if (dl == NULL) { + return dl; + } else { + dlIter = dl; + } + + gSPDisplayList(dlIter++, title_screen_bg_dl_0A0065E8); + + gDPLoadTextureBlock(dlIter++, VIRTUAL_TO_PHYSICAL(image), G_IM_FMT_RGBA, G_IM_SIZ_16b, imageW, imageH, 0, G_TX_CLAMP | G_TX_NOMIRROR, G_TX_CLAMP | G_TX_NOMIRROR, 6, 6, G_TX_NOLOD, G_TX_NOLOD); + + intro_gen_face_texrect(&dlIter); + + gSPDisplayList(dlIter++, title_screen_bg_dl_0A006618); + + gSPEndDisplayList(dlIter++); + + return dl; +} + +u16 *intro_sample_frame_buffer(s32 imageW, s32 imageH, s32 sampleW, s32 sampleH) { + u16 *fb; + u16 *image; + s32 pixel; + f32 size; + f32 r, g, b; + s32 iy, ix, sy, sx; + + s32 xOffset = 120; + s32 yOffset = 80; + + fb = sFrameBuffers[frameBufferIndex]; + image = alloc_display_list(imageW * imageH * sizeof(u16)); + + if (image == NULL) { + return image; + } + + for (iy = 0; iy < imageH; iy++) { + for (ix = 0; ix < imageW; ix++) { + r = 0; + g = 0; + b = 0; + + for (sy = 0; sy < sampleH; sy++) { + for (sx = 0; sx < sampleW; sx++) { + u16 fbr, fbg, fbb; + f32 f1, f2, f3; + pixel = 320 * (sampleH * iy + sy + yOffset) + (sampleW * ix + xOffset) + sx; + + fbr = fb[pixel]; + fbg = fb[pixel]; + fbb = fb[pixel]; + + f1 = ((fbr >> 0xB) & 0x1F); + f2 = ((fbg >> 0x6) & 0x1F); + f3 = ((fbb >> 0x1) & 0x1F); + + r += f1; + g += f2; + b += f3; + } + } + + size = sampleW * sampleH; + image[imageH * iy + ix] = ((((u16) (r / size + 0.5) << 0xB) & 0xF800) & 0xffff) + + ((((u16) (g / size + 0.5) << 0x6) & 0x7C0) & 0xffff) + + ((((u16) (b / size + 0.5) << 0x1) & 0x3E) & 0xffff) + 1; + } + } + + return image; +} + +Gfx *geo_intro_face_easter_egg(s32 state, struct GraphNode *node, UNUSED void *context) { + struct GraphNodeGenerated *genNode = (struct GraphNodeGenerated *)node; + u16 *image; + Gfx *dl = NULL; + s32 i; + + if (state != 1) { + sFrameBuffers[0] = gFrameBuffer0; + sFrameBuffers[1] = gFrameBuffer1; + sFrameBuffers[2] = gFrameBuffer2; + + for (i = 0; i < 48; i++) { + sFaceVisible[i] = 0; + } + + } else if (state == 1) { + if (sFaceCounter == 0) { + if (gPlayer1Controller->buttonPressed & Z_TRIG) { + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); + sFaceVisible[0] ^= 1; + sFaceCounter++; + } + } else { + sFaceVisible[sFaceToggleOrder[sFaceCounter++]] ^= 1; + if (sFaceCounter >= 40) { + sFaceCounter = 0; + } + } + + // Draw while the first or last face is visible. + if (sFaceVisible[0] == 1 || sFaceVisible[17] == 1) { + image = intro_sample_frame_buffer(40, 40, 2, 2); + if (image != NULL) { + genNode->fnNode.node.flags = (genNode->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + dl = intro_draw_face(image, 40, 40); + } + } + } + + return dl; +} + +Gfx *geo_intro_rumble_pak_graphic(s32 state, struct GraphNode *node, UNUSED void *context) { + struct GraphNodeGenerated *genNode = (struct GraphNodeGenerated *)node; + Gfx *dlIter; + Gfx *dl; + s32 introContext; + s8 backgroundTileSix; + + if (state != 1) { + dl = NULL; + } else if (state == 1) { + genNode->fnNode.node.flags = (genNode->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8); + introContext = genNode->parameter & 0xFF; + if (introContext == 0) { + backgroundTileSix = introBackgroundIndexTable[6]; + } else if (introContext == 1) { + backgroundTileSix = gameOverBackgroundTable[6]; + } + if (backgroundTileSix == INTRO_BACKGROUND_SUPER_MARIO) { + dl = alloc_display_list(3 * sizeof(*dl)); + if (dl != NULL) { + dlIter = dl; + gSPDisplayList(dlIter++, &title_screen_bg_dl_0A007548); + gSPEndDisplayList(dlIter); + } + } else { + dl = NULL; + } + } + return dl; +} + +#endif + diff --git a/src/menu/intro_geo.h b/src/menu/intro_geo.h index 6fa6c84f..bedafb67 100644 --- a/src/menu/intro_geo.h +++ b/src/menu/intro_geo.h @@ -5,11 +5,16 @@ #include #include "types.h" +#include "engine/graph_node.h" -Gfx *geo_title_screen(s32 sp50, struct GraphNode *sp54, UNUSED void *context); -Gfx *geo_fade_transition(s32 sp40, struct GraphNode *sp44, UNUSED void *context); -Gfx *intro_backdrop_one_image(s32 index, s8 *backgroundTable); -Gfx *geo_intro_backdrop(s32 sp48, struct GraphNode *sp4c, UNUSED void *context); -Gfx *geo_game_over_tile(s32 sp40, struct GraphNode *sp44, UNUSED void *context); +Gfx *geo_intro_super_mario_64_logo(s32 sp50, struct GraphNode *sp54, UNUSED void *context); +Gfx *geo_intro_tm_copyright(s32 sp40, struct GraphNode *sp44, UNUSED void *context); +Gfx *geo_intro_regular_backdrop(s32 sp48, struct GraphNode *sp4c, UNUSED void *context); +Gfx *geo_intro_gameover_backdrop(s32 sp40, struct GraphNode *sp44, UNUSED void *context); + +#ifdef VERSION_SH +Gfx *geo_intro_face_easter_egg(s32 state, struct GraphNode *node, UNUSED void *context); +Gfx *geo_intro_rumble_pak_graphic(s32 state, struct GraphNode *node, UNUSED void *context); +#endif #endif // INTRO_GEO_H diff --git a/src/menu/level_select_menu.c b/src/menu/level_select_menu.c index 097282c1..b23f06de 100644 --- a/src/menu/level_select_menu.c +++ b/src/menu/level_select_menu.c @@ -10,6 +10,7 @@ #include "game/print.h" #include "game/save_file.h" #include "game/sound_init.h" +#include "game/rumble_init.h" #include "level_table.h" #include "seq_ids.h" #include "sm64.h" @@ -122,7 +123,7 @@ s16 level_select_input_loop(void) { // if the stage was changed, play the sound for changing a stage. if (stageChanged) { - play_sound(SOUND_GENERAL_LEVEL_SELECT_CHANGE, gDefaultSoundArgs); + play_sound(SOUND_GENERAL_LEVEL_SELECT_CHANGE, gGlobalSoundSource); } // TODO: enum counts for the stage lists @@ -151,7 +152,7 @@ s16 level_select_input_loop(void) { gDebugLevelSelect = FALSE; return -1; } - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); return gCurrLevelNum; } return 0; @@ -162,14 +163,22 @@ s32 intro_default(void) { #ifndef VERSION_JP if (D_U_801A7C34 == 1) { - play_sound(SOUND_MARIO_HELLO, gDefaultSoundArgs); + if (gGlobalTimer < 0x81) { + play_sound(SOUND_MARIO_HELLO, gGlobalSoundSource); + } else { + play_sound(SOUND_MARIO_PRESS_START_TO_PLAY, gGlobalSoundSource); + } D_U_801A7C34 = 0; } #endif print_intro_text(); if (gPlayer1Controller->buttonPressed & START_BUTTON) { - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(60, 70); + func_sh_8024C89C(1); +#endif sp1C = 100 + gDebugLevelSelect; #ifndef VERSION_JP D_U_801A7C34 = 1; @@ -183,7 +192,7 @@ s32 intro_game_over(void) { #ifndef VERSION_JP if (gameOverNotPlayed == 1) { - play_sound(SOUND_MARIO_GAME_OVER, gDefaultSoundArgs); + play_sound(SOUND_MARIO_GAME_OVER, gGlobalSoundSource); gameOverNotPlayed = 0; } #endif @@ -191,7 +200,11 @@ s32 intro_game_over(void) { print_intro_text(); if (gPlayer1Controller->buttonPressed & START_BUTTON) { - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); +#ifdef VERSION_SH + queue_rumble_data(60, 70); + func_sh_8024C89C(1); +#endif sp1C = 100 + gDebugLevelSelect; #ifndef VERSION_JP gameOverNotPlayed = 1; @@ -202,7 +215,7 @@ s32 intro_game_over(void) { s32 intro_play_its_a_me_mario(void) { set_background_music(0, SEQ_SOUND_PLAYER, 0); - play_sound(SOUND_MENU_COIN_ITS_A_ME_MARIO, gDefaultSoundArgs); + play_sound(SOUND_MENU_COIN_ITS_A_ME_MARIO, gGlobalSoundSource); return 1; } diff --git a/src/menu/star_select.c b/src/menu/star_select.c index 65bc1636..40c5b3ee 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -17,6 +17,7 @@ #include "game/save_file.h" #include "game/segment2.h" #include "game/segment7.h" +#include "game/rumble_init.h" #include "sm64.h" #include "star_select.h" #include "text_strings.h" @@ -259,7 +260,7 @@ void print_course_number(void) { gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end); } -#if defined(VERSION_JP) || defined(VERSION_SH) +#ifdef VERSION_JP #define ACT_NAME_X 158 #else #define ACT_NAME_X 163 @@ -335,9 +336,6 @@ void print_act_selector_strings(void) { if (currLevelName != NULL) { #ifdef VERSION_EU print_generic_string(get_str_x_pos_from_center(160, currLevelName + 3, 10.0f), 33, currLevelName + 3); -#elif defined(VERSION_SH) - lvlNameX = get_str_x_pos_from_center_scale(160, currLevelName + 3, 10.0f); - print_generic_string(lvlNameX, 33, currLevelName + 3); #else lvlNameX = get_str_x_pos_from_center(160, currLevelName + 3, 10.0f); print_generic_string(lvlNameX, 33, currLevelName + 3); @@ -347,7 +345,7 @@ void print_act_selector_strings(void) { gSPDisplayList(gDisplayListHead++, dl_ia_text_end); #ifdef VERSION_EU - print_course_number((u32)language); + print_course_number(language); #else print_course_number(); #endif @@ -360,9 +358,6 @@ void print_act_selector_strings(void) { #ifdef VERSION_EU print_menu_generic_string(get_str_x_pos_from_center(ACT_NAME_X, selectedActName, 8.0f), 81, selectedActName); -#elif defined(VERSION_SH) - actNameX = get_str_x_pos_from_center_scale(ACT_NAME_X, selectedActName, 8.0f); - print_menu_generic_string(actNameX, 81, selectedActName); #else actNameX = get_str_x_pos_from_center(ACT_NAME_X, selectedActName, 8.0f); print_menu_generic_string(actNameX, 81, selectedActName); @@ -377,7 +372,7 @@ void print_act_selector_strings(void) { x = 143 - sVisibleStars * 15 + i * 30; print_menu_generic_string(x, 38, starNumbers); #else - x = i * 34 - sVisibleStars * 17 + 139; + x = 139 - sVisibleStars * 17 + i * 34; print_menu_generic_string(x, 38, starNumbers); #endif // display player HUD head if they're in that act @@ -499,10 +494,14 @@ s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused } void star_select_finish_selection(void) { -#if defined(VERSION_JP) || defined(VERSION_SH) - play_sound(SOUND_MENU_STAR_SOUND, gDefaultSoundArgs); +#if defined(VERSION_JP) + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); #else - play_sound(SOUND_MENU_STAR_SOUND_LETS_A_GO, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND_LETS_A_GO, gGlobalSoundSource); +#endif +#ifdef VERSION_SH + queue_rumble_data(60, 70); + func_sh_8024C89C(1); #endif if (sInitSelectedActNum >= sSelectedActIndex + 1) { sLoadedActNum = sSelectedActIndex + 1; diff --git a/src/pc/djui/djui_bind.c b/src/pc/djui/djui_bind.c index 7640dd08..2171de16 100644 --- a/src/pc/djui/djui_bind.c +++ b/src/pc/djui/djui_bind.c @@ -3,7 +3,7 @@ #include "djui.h" #include "src/pc/controller/controller_api.h" #include "src/pc/controller/controller_bind_mapping.h" -#include "audio_defines.h" +#include "sounds.h" #include "audio/external.h" #define VK_ESCAPE 1 @@ -39,7 +39,7 @@ static void djui_bind_button_on_bind(struct DjuiBase* caller) { djui_text_set_text(button->text, "???"); #endif djui_interactable_set_binding(NULL); - play_sound(SOUND_MENU_CHANGE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CHANGE_SELECT, gGlobalSoundSource); controller_reconfigure(); } diff --git a/src/pc/djui/djui_chat_message.c b/src/pc/djui/djui_chat_message.c index 5d131bd7..e12ad6e6 100644 --- a/src/pc/djui/djui_chat_message.c +++ b/src/pc/djui/djui_chat_message.c @@ -1,7 +1,7 @@ #include #include "pc/network/network.h" #include "pc/utils/misc.h" -#include "audio_defines.h" +#include "sounds.h" #include "audio/external.h" #include "game/mario_misc.h" #include "djui.h" @@ -55,7 +55,7 @@ void djui_chat_message_create_from(u8 globalIndex, const char* message) { char chatMsg[256] = { 0 }; snprintf(chatMsg, 256, "%s%s:\\#dcdcdc\\ %s", playerColorString, (np != NULL) ? np->name : "Player", message); - play_sound((globalIndex == gNetworkPlayerLocal->globalIndex) ? SOUND_MENU_MESSAGE_DISAPPEAR : SOUND_MENU_MESSAGE_APPEAR, gDefaultSoundArgs); + play_sound((globalIndex == gNetworkPlayerLocal->globalIndex) ? SOUND_MENU_MESSAGE_DISAPPEAR : SOUND_MENU_MESSAGE_APPEAR, gGlobalSoundSource); djui_chat_message_create(chatMsg); } diff --git a/src/pc/djui/djui_interactable.c b/src/pc/djui/djui_interactable.c index 7bbc98ed..b9a7232f 100644 --- a/src/pc/djui/djui_interactable.c +++ b/src/pc/djui/djui_interactable.c @@ -6,7 +6,7 @@ #include "src/pc/controller/controller_keyboard.h" #include "src/pc/utils/misc.h" -#include "audio_defines.h" +#include "sounds.h" #include "audio/external.h" #define CALL_CALLBACK(x) if (base->interactable->x != NULL) { base->interactable->x(base); } @@ -399,7 +399,7 @@ void djui_interactable_update(void) { djui_interactable_cursor_update_active(&gDjuiRoot->base); if (lastHovered != gDjuiHovered) { djui_interactable_on_hover_end(lastHovered); - play_sound(SOUND_MENU_MESSAGE_NEXT_PAGE, gDefaultSoundArgs); + play_sound(SOUND_MENU_MESSAGE_NEXT_PAGE, gGlobalSoundSource); } djui_interactable_on_hover(gDjuiHovered); } diff --git a/src/pc/djui/djui_panel.c b/src/pc/djui/djui_panel.c index 2f2e5c29..84381d56 100644 --- a/src/pc/djui/djui_panel.c +++ b/src/pc/djui/djui_panel.c @@ -1,6 +1,6 @@ #include "djui.h" #include "src/pc/utils/misc.h" -#include "audio_defines.h" +#include "sounds.h" #include "audio/external.h" #include "src/game/bettercamera.h" @@ -61,7 +61,7 @@ void djui_panel_add(struct DjuiBase* caller, struct DjuiBase* panelBase, struct djui_cursor_input_controlled_center(panel->defaultElementBase); djui_base_set_enabled(panel->base, true); } else { - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); } } @@ -92,7 +92,7 @@ void djui_panel_back(void) { djui_base_set_visible(sPanelList->base, true); // play a sound - play_sound(SOUND_MENU_CLICK_FILE_SELECT, gDefaultSoundArgs); + play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); gDjuiPanelJoinMessageVisible = false; } diff --git a/src/pc/djui/djui_panel_host_message.c b/src/pc/djui/djui_panel_host_message.c index eedef399..2c3e6536 100644 --- a/src/pc/djui/djui_panel_host_message.c +++ b/src/pc/djui/djui_panel_host_message.c @@ -7,7 +7,7 @@ #include "pc/utils/misc.h" #include "src/game/level_update.h" #include "audio/external.h" -#include "audio_defines.h" +#include "sounds.h" #ifdef DISCORD_SDK static char* sWarningDiscord = "\ @@ -45,7 +45,7 @@ void djui_panel_host_message_do_host(UNUSED struct DjuiBase* caller) { fake_lvl_init_from_save_file(); extern s16 gChangeLevelTransition; gChangeLevelTransition = 16; - play_sound(SOUND_MENU_STAR_SOUND_OKEY_DOKEY, gDefaultSoundArgs); + play_sound(SOUND_MENU_STAR_SOUND_OKEY_DOKEY, gGlobalSoundSource); extern void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue); play_transition(0x09, 0x14, 0x00, 0x00, 0x00); } diff --git a/src/pc/djui/djui_popup.c b/src/pc/djui/djui_popup.c index b16b4547..cdd9dee9 100644 --- a/src/pc/djui/djui_popup.c +++ b/src/pc/djui/djui_popup.c @@ -1,5 +1,5 @@ #include "djui.h" -#include "audio_defines.h" +#include "sounds.h" #include "audio/external.h" #include "pc/network/network.h" #include "pc/utils/misc.h" @@ -56,7 +56,7 @@ void djui_popup_create(const char* message, int lines) { sPopupListY -= height + 4; djui_popup_add_to_list(popup); - play_sound(SOUND_MENU_PINCH_MARIO_FACE, gDefaultSoundArgs); + play_sound(SOUND_MENU_PINCH_MARIO_FACE, gGlobalSoundSource); } void djui_popup_update(void) { diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index f86dc585..e5ba830f 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -678,7 +678,7 @@ static struct LuaObjectField sNetworkPlayerFields[LUA_NETWORK_PLAYER_FIELD_COUNT { "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE }, }; -#define LUA_OBJECT_FIELD_COUNT 750 +#define LUA_OBJECT_FIELD_COUNT 749 static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "activeFlags", LVT_S16, offsetof(struct Object, activeFlags), false, LOT_NONE }, { "areaTimer", LVT_U32, offsetof(struct Object, areaTimer), false, LOT_NONE }, @@ -728,10 +728,10 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "oBBallSpawnerMaxSpawnDist", LVT_F32, offsetof(struct Object, oBBallSpawnerMaxSpawnDist), false, LOT_NONE }, { "oBBallSpawnerPeriodMinus1", LVT_S32, offsetof(struct Object, oBBallSpawnerPeriodMinus1), false, LOT_NONE }, { "oBBallSpawnerSpawnOdds", LVT_F32, offsetof(struct Object, oBBallSpawnerSpawnOdds), false, LOT_NONE }, - { "oBackAndForthPlatformUnk100", LVT_F32, offsetof(struct Object, oBackAndForthPlatformUnk100), false, LOT_NONE }, - { "oBackAndForthPlatformUnkF4", LVT_F32, offsetof(struct Object, oBackAndForthPlatformUnkF4), false, LOT_NONE }, - { "oBackAndForthPlatformUnkF8", LVT_F32, offsetof(struct Object, oBackAndForthPlatformUnkF8), false, LOT_NONE }, - { "oBackAndForthPlatformUnkFC", LVT_F32, offsetof(struct Object, oBackAndForthPlatformUnkFC), false, LOT_NONE }, + { "oBackAndForthPlatformDirection", LVT_F32, offsetof(struct Object, oBackAndForthPlatformDirection), false, LOT_NONE }, + { "oBackAndForthPlatformDistance", LVT_F32, offsetof(struct Object, oBackAndForthPlatformDistance), false, LOT_NONE }, + { "oBackAndForthPlatformPathLength", LVT_F32, offsetof(struct Object, oBackAndForthPlatformPathLength), false, LOT_NONE }, + { "oBackAndForthPlatformVel", LVT_F32, offsetof(struct Object, oBackAndForthPlatformVel), false, LOT_NONE }, { "oBehParams", LVT_S32, offsetof(struct Object, oBehParams), false, LOT_NONE }, { "oBehParams2ndByte", LVT_S32, offsetof(struct Object, oBehParams2ndByte), false, LOT_NONE }, { "oBetaTrampolineMarioOnTrampoline", LVT_S32, offsetof(struct Object, oBetaTrampolineMarioOnTrampoline), false, LOT_NONE }, @@ -744,7 +744,7 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "oBlueFishRandomAngle", LVT_F32, offsetof(struct Object, oBlueFishRandomAngle), false, LOT_NONE }, { "oBlueFishRandomTime", LVT_S32, offsetof(struct Object, oBlueFishRandomTime), false, LOT_NONE }, { "oBlueFishRandomVel", LVT_F32, offsetof(struct Object, oBlueFishRandomVel), false, LOT_NONE }, - { "oBlueFlameUnkF8", LVT_F32, offsetof(struct Object, oBlueFlameUnkF8), false, LOT_NONE }, + { "oBlueFlameNextScale", LVT_F32, offsetof(struct Object, oBlueFlameNextScale), false, LOT_NONE }, { "oBobombBlinkTimer", LVT_S32, offsetof(struct Object, oBobombBlinkTimer), false, LOT_NONE }, { "oBobombBuddyBlinkTimer", LVT_S32, offsetof(struct Object, oBobombBuddyBlinkTimer), false, LOT_NONE }, { "oBobombBuddyCannonStatus", LVT_S32, offsetof(struct Object, oBobombBuddyCannonStatus), false, LOT_NONE }, @@ -941,18 +941,18 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "oFireSpitterScaleVel", LVT_F32, offsetof(struct Object, oFireSpitterScaleVel), false, LOT_NONE }, { "oFishActiveDistance", LVT_F32, offsetof(struct Object, oFishActiveDistance), false, LOT_NONE }, { "oFishDepthDistance", LVT_F32, offsetof(struct Object, oFishDepthDistance), false, LOT_NONE }, - { "oFishPosY", LVT_F32, offsetof(struct Object, oFishPosY), false, LOT_NONE }, - { "oFishRandomOffset", LVT_F32, offsetof(struct Object, oFishRandomOffset), false, LOT_NONE }, - { "oFishRandomSpeed", LVT_S32, offsetof(struct Object, oFishRandomSpeed), false, LOT_NONE }, - { "oFishRandomVel", LVT_F32, offsetof(struct Object, oFishRandomVel), false, LOT_NONE }, - { "oFishRespawnDistance", LVT_F32, offsetof(struct Object, oFishRespawnDistance), false, LOT_NONE }, + { "oFishGoalVel", LVT_F32, offsetof(struct Object, oFishGoalVel), false, LOT_NONE }, + { "oFishGoalY", LVT_F32, offsetof(struct Object, oFishGoalY), false, LOT_NONE }, + { "oFishHeightOffset", LVT_F32, offsetof(struct Object, oFishHeightOffset), false, LOT_NONE }, + { "oFishRoamDistance", LVT_F32, offsetof(struct Object, oFishRoamDistance), false, LOT_NONE }, { "oFishWaterLevel", LVT_F32, offsetof(struct Object, oFishWaterLevel), false, LOT_NONE }, + { "oFishYawVel", LVT_S32, offsetof(struct Object, oFishYawVel), false, LOT_NONE }, { "oFlags", LVT_U32, offsetof(struct Object, oFlags), false, LOT_NONE }, + { "oFlameBowser", LVT_COBJECT_P, offsetof(struct Object, oFlameBowser), false, LOT_OBJECT }, + { "oFlameScale", LVT_F32, offsetof(struct Object, oFlameScale), false, LOT_NONE }, + { "oFlameSpeedTimerOffset", LVT_S32, offsetof(struct Object, oFlameSpeedTimerOffset), false, LOT_NONE }, { "oFlameThowerFlameUnk110", LVT_S32, offsetof(struct Object, oFlameThowerFlameUnk110), false, LOT_NONE }, { "oFlameThowerUnk110", LVT_S32, offsetof(struct Object, oFlameThowerUnk110), false, LOT_NONE }, - { "oFlameUnk100", LVT_COBJECT_P, offsetof(struct Object, oFlameUnk100), false, LOT_OBJECT }, - { "oFlameUnkF4", LVT_F32, offsetof(struct Object, oFlameUnkF4), false, LOT_NONE }, - { "oFlameUnkF8", LVT_S32, offsetof(struct Object, oFlameUnkF8), false, LOT_NONE }, { "oFlameUnkFC", LVT_F32, offsetof(struct Object, oFlameUnkFC), false, LOT_NONE }, { "oFloatingPlatformUnk100", LVT_S32, offsetof(struct Object, oFloatingPlatformUnk100), false, LOT_NONE }, { "oFloatingPlatformUnkF4", LVT_S32, offsetof(struct Object, oFloatingPlatformUnkF4), false, LOT_NONE }, @@ -1080,9 +1080,8 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "oMacroUnk108", LVT_F32, offsetof(struct Object, oMacroUnk108), false, LOT_NONE }, { "oMacroUnk10C", LVT_F32, offsetof(struct Object, oMacroUnk10C), false, LOT_NONE }, { "oMacroUnk110", LVT_F32, offsetof(struct Object, oMacroUnk110), false, LOT_NONE }, - { "oMantaUnk1AC", LVT_S32, offsetof(struct Object, oMantaUnk1AC), false, LOT_NONE }, - { "oMantaUnkF4", LVT_S32, offsetof(struct Object, oMantaUnkF4), false, LOT_NONE }, - { "oMantaUnkF8", LVT_S32, offsetof(struct Object, oMantaUnkF8), false, LOT_NONE }, + { "oMantaTargetPitch", LVT_S32, offsetof(struct Object, oMantaTargetPitch), false, LOT_NONE }, + { "oMantaTargetYaw", LVT_S32, offsetof(struct Object, oMantaTargetYaw), false, LOT_NONE }, { "oMarioBurnTimer", LVT_S32, offsetof(struct Object, oMarioBurnTimer), false, LOT_NONE }, { "oMarioCannonInputYaw", LVT_S32, offsetof(struct Object, oMarioCannonInputYaw), false, LOT_NONE }, { "oMarioCannonObjectYaw", LVT_S32, offsetof(struct Object, oMarioCannonObjectYaw), false, LOT_NONE }, @@ -1241,9 +1240,9 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "oSmallPenguinUnk88", LVT_S32, offsetof(struct Object, oSmallPenguinUnk88), false, LOT_NONE }, { "oSmallPiranhaFlameEndSpeed", LVT_F32, offsetof(struct Object, oSmallPiranhaFlameEndSpeed), false, LOT_NONE }, { "oSmallPiranhaFlameModel", LVT_S32, offsetof(struct Object, oSmallPiranhaFlameModel), false, LOT_NONE }, + { "oSmallPiranhaFlameNextFlameTimer", LVT_S32, offsetof(struct Object, oSmallPiranhaFlameNextFlameTimer), false, LOT_NONE }, + { "oSmallPiranhaFlameSpeed", LVT_F32, offsetof(struct Object, oSmallPiranhaFlameSpeed), false, LOT_NONE }, { "oSmallPiranhaFlameStartSpeed", LVT_F32, offsetof(struct Object, oSmallPiranhaFlameStartSpeed), false, LOT_NONE }, - { "oSmallPiranhaFlameUnk100", LVT_S32, offsetof(struct Object, oSmallPiranhaFlameUnk100), false, LOT_NONE }, - { "oSmallPiranhaFlameUnk104", LVT_F32, offsetof(struct Object, oSmallPiranhaFlameUnk104), false, LOT_NONE }, { "oSmokeTimer", LVT_S32, offsetof(struct Object, oSmokeTimer), false, LOT_NONE }, { "oSnowmansBottomUnk1AC", LVT_S32, offsetof(struct Object, oSnowmansBottomUnk1AC), false, LOT_NONE }, { "oSnowmansBottomUnkF4", LVT_F32, offsetof(struct Object, oSnowmansBottomUnkF4), false, LOT_NONE }, @@ -1606,7 +1605,7 @@ static struct LuaObjectField sWallCollisionDataFields[LUA_WALL_COLLISION_DATA_FI { "numWalls", LVT_S16, offsetof(struct WallCollisionData, numWalls), false, LOT_NONE }, { "offsetY", LVT_F32, offsetof(struct WallCollisionData, offsetY), false, LOT_NONE }, { "radius", LVT_F32, offsetof(struct WallCollisionData, radius), false, LOT_NONE }, - { "unk14", LVT_S16, offsetof(struct WallCollisionData, unk14), false, LOT_NONE }, + { "unused", LVT_S16, offsetof(struct WallCollisionData, unused), false, LOT_NONE }, // { "walls", LOT_???, offsetof(struct WallCollisionData, walls), false, LOT_??? }, <--- UNIMPLEMENTED // { "z", LVT_???, offsetof(struct WallCollisionData, z), false, LOT_??? }, <--- UNIMPLEMENTED }; diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 19fe0a5c..9ed487cb 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -238,479 +238,6 @@ char gSmluaConstants[] = "" "function SOUND_ARG_LOAD(bank, playFlags, soundID, priority, flags2)\n" " return ((bank << 28) | (playFlags << 24) | (soundID << 16) | (priority << 8) | (flags2 << 4) | 1)\n" "end\n" -"SOUNDARGS_MASK_BANK = 0xF0000000\n" -"SOUNDARGS_MASK_SOUNDID = 0x00FF0000\n" -"SOUNDARGS_MASK_PRIORITY = 0x0000FF00\n" -"SOUNDARGS_MASK_STATUS = 0x0000000F\n" -"SOUNDARGS_SHIFT_BANK = 28\n" -"SOUNDARGS_SHIFT_SOUNDID = 16\n" -"SOUNDARGS_SHIFT_PRIORITY = 8\n" -"SOUND_STATUS_STOPPED = 0\n" -"SOUND_STATUS_STARTING = 1\n" -"SOUND_STATUS_PLAYING = 2\n" -"SOUND_LO_BITFLAG_UNK1 = 0x10\n" -"SOUND_NO_ECHO = 0x20\n" -"SOUND_LO_BITFLAG_UNK8 = 0x80\n" -"SOUND_NO_VOLUME_LOSS = 0x1000000\n" -"SOUND_VIBRATO = 0x2000000\n" -"SOUND_NO_PRIORITY_LOSS = 0x4000000\n" -"SOUND_NO_FREQUENCY_LOSS = 0x8000000\n" -"NO_SOUND = 0\n" -"SOUND_TERRAIN_DEFAULT = 0\n" -"SOUND_TERRAIN_GRASS = 1\n" -"SOUND_TERRAIN_WATER = 2\n" -"SOUND_TERRAIN_STONE = 3\n" -"SOUND_TERRAIN_SPOOKY = 4\n" -"SOUND_TERRAIN_SNOW = 5\n" -"SOUND_TERRAIN_ICE = 6\n" -"SOUND_TERRAIN_SAND = 7\n" -"SOUND_ACTION_TERRAIN_JUMP = SOUND_ARG_LOAD(0, 4, 0x00, 0x80, 8)\n" -"SOUND_ACTION_TERRAIN_LANDING = SOUND_ARG_LOAD(0, 4, 0x08, 0x80, 8)\n" -"SOUND_ACTION_TERRAIN_STEP = SOUND_ARG_LOAD(0, 6, 0x10, 0x80, 8)\n" -"SOUND_ACTION_TERRAIN_BODY_HIT_GROUND = SOUND_ARG_LOAD(0, 4, 0x18, 0x80, 8)\n" -"SOUND_ACTION_TERRAIN_STEP_TIPTOE = SOUND_ARG_LOAD(0, 6, 0x20, 0x80, 8)\n" -"SOUND_ACTION_TERRAIN_STUCK_IN_GROUND = SOUND_ARG_LOAD(0, 4, 0x48, 0x80, 8)\n" -"SOUND_ACTION_TERRAIN_HEAVY_LANDING = SOUND_ARG_LOAD(0, 4, 0x60, 0x80, 8)\n" -"SOUND_ACTION_METAL_JUMP = SOUND_ARG_LOAD(0, 4, 0x28, 0x90, 8)\n" -"SOUND_ACTION_METAL_LANDING = SOUND_ARG_LOAD(0, 4, 0x29, 0x90, 8)\n" -"SOUND_ACTION_METAL_STEP = SOUND_ARG_LOAD(0, 4, 0x2A, 0x90, 8)\n" -"SOUND_ACTION_METAL_HEAVY_LANDING = SOUND_ARG_LOAD(0, 4, 0x2B, 0x90, 8)\n" -"SOUND_ACTION_CLAP_HANDS_COLD = SOUND_ARG_LOAD(0, 6, 0x2C, 0x00, 8)\n" -"SOUND_ACTION_HANGING_STEP = SOUND_ARG_LOAD(0, 4, 0x2D, 0xA0, 8)\n" -"SOUND_ACTION_QUICKSAND_STEP = SOUND_ARG_LOAD(0, 4, 0x2E, 0x00, 8)\n" -"SOUND_ACTION_METAL_STEP_TIPTOE = SOUND_ARG_LOAD(0, 4, 0x2F, 0x90, 8)\n" -"SOUND_ACTION_UNKNOWN430 = SOUND_ARG_LOAD(0, 4, 0x30, 0xC0, 8)\n" -"SOUND_ACTION_UNKNOWN431 = SOUND_ARG_LOAD(0, 4, 0x31, 0x60, 8)\n" -"SOUND_ACTION_UNKNOWN432 = SOUND_ARG_LOAD(0, 4, 0x32, 0x80, 8)\n" -"SOUND_ACTION_SWIM = SOUND_ARG_LOAD(0, 4, 0x33, 0x80, 8)\n" -"SOUND_ACTION_UNKNOWN434 = SOUND_ARG_LOAD(0, 4, 0x34, 0x80, 8)\n" -"SOUND_ACTION_THROW = SOUND_ARG_LOAD(0, 4, 0x35, 0x80, 8)\n" -"SOUND_ACTION_KEY_SWISH = SOUND_ARG_LOAD(0, 4, 0x36, 0x80, 8)\n" -"SOUND_ACTION_SPIN = SOUND_ARG_LOAD(0, 4, 0x37, 0x80, 8)\n" -"SOUND_ACTION_TWIRL = SOUND_ARG_LOAD(0, 4, 0x38, 0x80, 8)\n" -"SOUND_ACTION_CLIMB_UP_TREE = SOUND_ARG_LOAD(0, 4, 0x3A, 0x80, 8)\n" -"SOUND_ACTION_CLIMB_DOWN_TREE = 0x003B\n" -"SOUND_ACTION_UNK3C = 0x003C\n" -"SOUND_ACTION_UNKNOWN43D = SOUND_ARG_LOAD(0, 4, 0x3D, 0x80, 8)\n" -"SOUND_ACTION_UNKNOWN43E = SOUND_ARG_LOAD(0, 4, 0x3E, 0x80, 8)\n" -"SOUND_ACTION_PAT_BACK = SOUND_ARG_LOAD(0, 4, 0x3F, 0x80, 8)\n" -"SOUND_ACTION_BRUSH_HAIR = SOUND_ARG_LOAD(0, 4, 0x40, 0x80, 8)\n" -"SOUND_ACTION_CLIMB_UP_POLE = SOUND_ARG_LOAD(0, 4, 0x41, 0x80, 8)\n" -"SOUND_ACTION_METAL_BONK = SOUND_ARG_LOAD(0, 4, 0x42, 0x80, 8)\n" -"SOUND_ACTION_UNSTUCK_FROM_GROUND = SOUND_ARG_LOAD(0, 4, 0x43, 0x80, 8)\n" -"SOUND_ACTION_HIT = SOUND_ARG_LOAD(0, 4, 0x44, 0xC0, 8)\n" -"SOUND_ACTION_HIT_2 = SOUND_ARG_LOAD(0, 4, 0x44, 0xB0, 8)\n" -"SOUND_ACTION_HIT_3 = SOUND_ARG_LOAD(0, 4, 0x44, 0xA0, 8)\n" -"SOUND_ACTION_BONK = SOUND_ARG_LOAD(0, 4, 0x45, 0xA0, 8)\n" -"SOUND_ACTION_SHRINK_INTO_BBH = SOUND_ARG_LOAD(0, 4, 0x46, 0xA0, 8)\n" -"SOUND_ACTION_SWIM_FAST = SOUND_ARG_LOAD(0, 4, 0x47, 0xA0, 8)\n" -"SOUND_ACTION_METAL_JUMP_WATER = SOUND_ARG_LOAD(0, 4, 0x50, 0x90, 8)\n" -"SOUND_ACTION_METAL_LAND_WATER = SOUND_ARG_LOAD(0, 4, 0x51, 0x90, 8)\n" -"SOUND_ACTION_METAL_STEP_WATER = SOUND_ARG_LOAD(0, 4, 0x52, 0x90, 8)\n" -"SOUND_ACTION_UNK53 = 0x0053\n" -"SOUND_ACTION_UNK54 = 0x0054\n" -"SOUND_ACTION_UNK55 = 0x0055\n" -"SOUND_ACTION_FLYING_FAST = SOUND_ARG_LOAD(0, 4, 0x56, 0x80, 8)\n" -"SOUND_ACTION_TELEPORT = SOUND_ARG_LOAD(0, 4, 0x57, 0xC0, 8)\n" -"SOUND_ACTION_UNKNOWN458 = SOUND_ARG_LOAD(0, 4, 0x58, 0xA0, 8)\n" -"SOUND_ACTION_BOUNCE_OFF_OBJECT = SOUND_ARG_LOAD(0, 4, 0x59, 0xB0, 8)\n" -"SOUND_ACTION_SIDE_FLIP_UNK = SOUND_ARG_LOAD(0, 4, 0x5A, 0x80, 8)\n" -"SOUND_ACTION_READ_SIGN = SOUND_ARG_LOAD(0, 4, 0x5B, 0xFF, 8)\n" -"SOUND_ACTION_UNKNOWN45C = SOUND_ARG_LOAD(0, 4, 0x5C, 0x80, 8)\n" -"SOUND_ACTION_UNK5D = 0x005D\n" -"SOUND_ACTION_INTRO_UNK45E = SOUND_ARG_LOAD(0, 4, 0x5E, 0x80, 8)\n" -"SOUND_ACTION_INTRO_UNK45F = SOUND_ARG_LOAD(0, 4, 0x5F, 0x80, 8)\n" -"SOUND_MOVING_TERRAIN_SLIDE = SOUND_ARG_LOAD(1, 4, 0x00, 0x00, 0)\n" -"SOUND_MOVING_TERRAIN_RIDING_SHELL = SOUND_ARG_LOAD(1, 4, 0x20, 0x00, 0)\n" -"SOUND_MOVING_LAVA_BURN = SOUND_ARG_LOAD(1, 4, 0x10, 0x00, 0)\n" -"SOUND_MOVING_SLIDE_DOWN_POLE = SOUND_ARG_LOAD(1, 4, 0x11, 0x00, 0)\n" -"SOUND_MOVING_SLIDE_DOWN_TREE = SOUND_ARG_LOAD(1, 4, 0x12, 0x80, 0)\n" -"SOUND_MOVING_QUICKSAND_DEATH = SOUND_ARG_LOAD(1, 4, 0x14, 0x00, 0)\n" -"SOUND_MOVING_SHOCKED = SOUND_ARG_LOAD(1, 4, 0x16, 0x00, 0)\n" -"SOUND_MOVING_FLYING = SOUND_ARG_LOAD(1, 4, 0x17, 0x00, 0)\n" -"SOUND_MOVING_ALMOST_DROWNING = SOUND_ARG_LOAD(1, 0xC, 0x18, 0x00, 0)\n" -"SOUND_MOVING_AIM_CANNON = SOUND_ARG_LOAD(1, 0xD, 0x19, 0x20, 0)\n" -"SOUND_MOVING_UNK1A = 0x101A\n" -"SOUND_MOVING_RIDING_SHELL_LAVA = SOUND_ARG_LOAD(1, 4, 0x28, 0x00, 0)\n" -"SOUND_MARIO_YAH_WAH_HOO = SOUND_ARG_LOAD(2, 4, 0x00, 0x80, 8)\n" -"SOUND_MARIO_HOOHOO = SOUND_ARG_LOAD(2, 4, 0x03, 0x80, 8)\n" -"SOUND_MARIO_YAHOO = SOUND_ARG_LOAD(2, 4, 0x04, 0x80, 8)\n" -"SOUND_MARIO_UH = SOUND_ARG_LOAD(2, 4, 0x05, 0x80, 8)\n" -"SOUND_MARIO_HRMM = SOUND_ARG_LOAD(2, 4, 0x06, 0x80, 8)\n" -"SOUND_MARIO_WAH2 = SOUND_ARG_LOAD(2, 4, 0x07, 0x80, 8)\n" -"SOUND_MARIO_WHOA = SOUND_ARG_LOAD(2, 4, 0x08, 0xC0, 8)\n" -"SOUND_MARIO_EEUH = SOUND_ARG_LOAD(2, 4, 0x09, 0x80, 8)\n" -"SOUND_MARIO_ATTACKED = SOUND_ARG_LOAD(2, 4, 0x0A, 0xFF, 8)\n" -"SOUND_MARIO_OOOF = SOUND_ARG_LOAD(2, 4, 0x0B, 0x80, 8)\n" -"SOUND_MARIO_OOOF2 = SOUND_ARG_LOAD(2, 4, 0x0B, 0xD0, 8)\n" -"SOUND_MARIO_HERE_WE_GO = SOUND_ARG_LOAD(2, 4, 0x0C, 0x80, 8)\n" -"SOUND_MARIO_YAWNING = SOUND_ARG_LOAD(2, 4, 0x0D, 0x80, 8)\n" -"SOUND_MARIO_SNORING1 = SOUND_ARG_LOAD(2, 4, 0x0E, 0x00, 8)\n" -"SOUND_MARIO_SNORING2 = SOUND_ARG_LOAD(2, 4, 0x0F, 0x00, 8)\n" -"SOUND_MARIO_WAAAOOOW = SOUND_ARG_LOAD(2, 4, 0x10, 0xC0, 8)\n" -"SOUND_MARIO_HAHA = SOUND_ARG_LOAD(2, 4, 0x11, 0x80, 8)\n" -"SOUND_MARIO_HAHA_2 = SOUND_ARG_LOAD(2, 4, 0x11, 0xF0, 8)\n" -"SOUND_MARIO_UH2 = SOUND_ARG_LOAD(2, 4, 0x13, 0xD0, 8)\n" -"SOUND_MARIO_UH2_2 = SOUND_ARG_LOAD(2, 4, 0x13, 0x80, 8)\n" -"SOUND_MARIO_ON_FIRE = SOUND_ARG_LOAD(2, 4, 0x14, 0xA0, 8)\n" -"SOUND_MARIO_DYING = SOUND_ARG_LOAD(2, 4, 0x15, 0xFF, 8)\n" -"SOUND_MARIO_PANTING_COLD = SOUND_ARG_LOAD(2, 4, 0x16, 0x80, 8)\n" -"SOUND_MARIO_PANTING = SOUND_ARG_LOAD(2, 4, 0x18, 0x80, 8)\n" -"SOUND_MARIO_COUGHING1 = SOUND_ARG_LOAD(2, 4, 0x1B, 0x80, 8)\n" -"SOUND_MARIO_COUGHING2 = SOUND_ARG_LOAD(2, 4, 0x1C, 0x80, 8)\n" -"SOUND_MARIO_COUGHING3 = SOUND_ARG_LOAD(2, 4, 0x1D, 0x80, 8)\n" -"SOUND_MARIO_PUNCH_YAH = SOUND_ARG_LOAD(2, 4, 0x1E, 0x80, 8)\n" -"SOUND_MARIO_PUNCH_HOO = SOUND_ARG_LOAD(2, 4, 0x1F, 0x80, 8)\n" -"SOUND_MARIO_MAMA_MIA = SOUND_ARG_LOAD(2, 4, 0x20, 0x80, 8)\n" -"SOUND_MARIO_OKEY_DOKEY = 0x2021\n" -"SOUND_MARIO_GROUND_POUND_WAH = SOUND_ARG_LOAD(2, 4, 0x22, 0x80, 8)\n" -"SOUND_MARIO_DROWNING = SOUND_ARG_LOAD(2, 4, 0x23, 0xF0, 8)\n" -"SOUND_MARIO_PUNCH_WAH = SOUND_ARG_LOAD(2, 4, 0x24, 0x80, 8)\n" -"SOUND_PEACH_DEAR_MARIO = SOUND_ARG_LOAD(2, 4, 0x28, 0xFF, 8)\n" -"SOUND_MARIO_YAHOO_WAHA_YIPPEE = SOUND_ARG_LOAD(2, 4, 0x2B, 0x80, 8)\n" -"SOUND_MARIO_DOH = SOUND_ARG_LOAD(2, 4, 0x30, 0x80, 8)\n" -"SOUND_MARIO_GAME_OVER = SOUND_ARG_LOAD(2, 4, 0x31, 0xFF, 8)\n" -"SOUND_MARIO_HELLO = SOUND_ARG_LOAD(2, 4, 0x32, 0xFF, 8)\n" -"SOUND_MARIO_PRESS_START_TO_PLAY = SOUND_ARG_LOAD(2, 4, 0x33, 0xFF, 0xA)\n" -"SOUND_MARIO_TWIRL_BOUNCE = SOUND_ARG_LOAD(2, 4, 0x34, 0x80, 8)\n" -"SOUND_MARIO_SNORING3 = SOUND_ARG_LOAD(2, 4, 0x35, 0x00, 8)\n" -"SOUND_MARIO_SO_LONGA_BOWSER = SOUND_ARG_LOAD(2, 4, 0x36, 0x80, 8)\n" -"SOUND_MARIO_IMA_TIRED = SOUND_ARG_LOAD(2, 4, 0x37, 0x80, 8)\n" -"SOUND_PEACH_MARIO = SOUND_ARG_LOAD(2, 4, 0x38, 0xFF, 8)\n" -"SOUND_PEACH_POWER_OF_THE_STARS = SOUND_ARG_LOAD(2, 4, 0x39, 0xFF, 8)\n" -"SOUND_PEACH_THANKS_TO_YOU = SOUND_ARG_LOAD(2, 4, 0x3A, 0xFF, 8)\n" -"SOUND_PEACH_THANK_YOU_MARIO = SOUND_ARG_LOAD(2, 4, 0x3B, 0xFF, 8)\n" -"SOUND_PEACH_SOMETHING_SPECIAL = SOUND_ARG_LOAD(2, 4, 0x3C, 0xFF, 8)\n" -"SOUND_PEACH_BAKE_A_CAKE = SOUND_ARG_LOAD(2, 4, 0x3D, 0xFF, 8)\n" -"SOUND_PEACH_FOR_MARIO = SOUND_ARG_LOAD(2, 4, 0x3E, 0xFF, 8)\n" -"SOUND_PEACH_MARIO2 = SOUND_ARG_LOAD(2, 4, 0x3F, 0xFF, 8)\n" -"SOUND_GENERAL_ACTIVATE_CAP_SWITCH = SOUND_ARG_LOAD(3, 0, 0x00, 0x80, 8)\n" -"SOUND_GENERAL_FLAME_OUT = SOUND_ARG_LOAD(3, 0, 0x03, 0x80, 8)\n" -"SOUND_GENERAL_OPEN_WOOD_DOOR = SOUND_ARG_LOAD(3, 0, 0x04, 0xC0, 8)\n" -"SOUND_GENERAL_CLOSE_WOOD_DOOR = SOUND_ARG_LOAD(3, 0, 0x05, 0xC0, 8)\n" -"SOUND_GENERAL_OPEN_IRON_DOOR = SOUND_ARG_LOAD(3, 0, 0x06, 0xC0, 8)\n" -"SOUND_GENERAL_CLOSE_IRON_DOOR = SOUND_ARG_LOAD(3, 0, 0x07, 0xC0, 8)\n" -"SOUND_GENERAL_BUBBLES = 0x3008\n" -"SOUND_GENERAL_MOVING_WATER = SOUND_ARG_LOAD(3, 0, 0x09, 0x00, 8)\n" -"SOUND_GENERAL_SWISH_WATER = SOUND_ARG_LOAD(3, 0, 0x0A, 0x00, 8)\n" -"SOUND_GENERAL_QUIET_BUBBLE = SOUND_ARG_LOAD(3, 0, 0x0B, 0x00, 8)\n" -"SOUND_GENERAL_VOLCANO_EXPLOSION = SOUND_ARG_LOAD(3, 0, 0x0C, 0x80, 8)\n" -"SOUND_GENERAL_QUIET_BUBBLE2 = SOUND_ARG_LOAD(3, 0, 0x0D, 0x00, 8)\n" -"SOUND_GENERAL_CASTLE_TRAP_OPEN = SOUND_ARG_LOAD(3, 0, 0x0E, 0x80, 8)\n" -"SOUND_GENERAL_WALL_EXPLOSION = SOUND_ARG_LOAD(3, 0, 0x0F, 0x00, 8)\n" -"SOUND_GENERAL_COIN = SOUND_ARG_LOAD(3, 8, 0x11, 0x80, 8)\n" -"SOUND_GENERAL_COIN_WATER = SOUND_ARG_LOAD(3, 8, 0x12, 0x80, 8)\n" -"SOUND_GENERAL_SHORT_STAR = SOUND_ARG_LOAD(3, 0, 0x16, 0x00, 9)\n" -"SOUND_GENERAL_BIG_CLOCK = SOUND_ARG_LOAD(3, 0, 0x17, 0x00, 8)\n" -"SOUND_GENERAL_LOUD_POUND = 0x3018\n" -"SOUND_GENERAL_LOUD_POUND2 = 0x3019\n" -"SOUND_GENERAL_SHORT_POUND1 = 0x301A\n" -"SOUND_GENERAL_SHORT_POUND2 = 0x301B\n" -"SOUND_GENERAL_SHORT_POUND3 = 0x301C\n" -"SOUND_GENERAL_SHORT_POUND4 = 0x301D\n" -"SOUND_GENERAL_SHORT_POUND5 = 0x301E\n" -"SOUND_GENERAL_SHORT_POUND6 = 0x301F\n" -"SOUND_GENERAL_OPEN_CHEST = SOUND_ARG_LOAD(3, 1, 0x20, 0x80, 8)\n" -"SOUND_GENERAL_CLAM_SHELL1 = SOUND_ARG_LOAD(3, 1, 0x22, 0x80, 8)\n" -"SOUND_GENERAL_BOX_LANDING = SOUND_ARG_LOAD(3, 0, 0x24, 0x00, 8)\n" -"SOUND_GENERAL_BOX_LANDING_2 = SOUND_ARG_LOAD(3, 2, 0x24, 0x00, 8)\n" -"SOUND_GENERAL_UNKNOWN1 = SOUND_ARG_LOAD(3, 0, 0x25, 0x00, 8)\n" -"SOUND_GENERAL_UNKNOWN1_2 = SOUND_ARG_LOAD(3, 2, 0x25, 0x00, 8)\n" -"SOUND_GENERAL_CLAM_SHELL2 = SOUND_ARG_LOAD(3, 0, 0x26, 0x40, 8)\n" -"SOUND_GENERAL_CLAM_SHELL3 = SOUND_ARG_LOAD(3, 0, 0x27, 0x40, 8)\n" -"SOUND_GENERAL_PAINTING_EJECT = SOUND_ARG_LOAD(3, 9, 0x28, 0x00, 8)\n" -"SOUND_GENERAL_LEVEL_SELECT_CHANGE = SOUND_ARG_LOAD(3, 0, 0x2B, 0x00, 8)\n" -"SOUND_GENERAL_PLATFORM = SOUND_ARG_LOAD(3, 0, 0x2D, 0x80, 8)\n" -"SOUND_GENERAL_DONUT_PLATFORM_EXPLOSION = SOUND_ARG_LOAD(3, 0, 0x2E, 0x20, 8)\n" -"SOUND_GENERAL_BOWSER_BOMB_EXPLOSION = SOUND_ARG_LOAD(3, 1, 0x2F, 0x00, 8)\n" -"SOUND_GENERAL_COIN_SPURT = SOUND_ARG_LOAD(3, 0, 0x30, 0x00, 8)\n" -"SOUND_GENERAL_COIN_SPURT_2 = SOUND_ARG_LOAD(3, 8, 0x30, 0x00, 8)\n" -"SOUND_GENERAL_COIN_SPURT_EU = SOUND_ARG_LOAD(3, 8, 0x30, 0x20, 8)\n" -"SOUND_GENERAL_EXPLOSION6 = 0x3031\n" -"SOUND_GENERAL_UNK32 = 0x3032\n" -"SOUND_GENERAL_BOAT_TILT1 = SOUND_ARG_LOAD(3, 0, 0x34, 0x40, 8)\n" -"SOUND_GENERAL_BOAT_TILT2 = SOUND_ARG_LOAD(3, 0, 0x35, 0x40, 8)\n" -"SOUND_GENERAL_COIN_DROP = SOUND_ARG_LOAD(3, 0, 0x36, 0x40, 8)\n" -"SOUND_GENERAL_UNKNOWN3_LOWPRIO = SOUND_ARG_LOAD(3, 0, 0x37, 0x00, 8)\n" -"SOUND_GENERAL_UNKNOWN3 = SOUND_ARG_LOAD(3, 0, 0x37, 0x80, 8)\n" -"SOUND_GENERAL_UNKNOWN3_2 = SOUND_ARG_LOAD(3, 8, 0x37, 0x80, 8)\n" -"SOUND_GENERAL_PENDULUM_SWING = SOUND_ARG_LOAD(3, 0, 0x38, 0x00, 8)\n" -"SOUND_GENERAL_CHAIN_CHOMP1 = SOUND_ARG_LOAD(3, 0, 0x39, 0x00, 8)\n" -"SOUND_GENERAL_CHAIN_CHOMP2 = SOUND_ARG_LOAD(3, 0, 0x3A, 0x00, 8)\n" -"SOUND_GENERAL_DOOR_TURN_KEY = SOUND_ARG_LOAD(3, 0, 0x3B, 0x00, 8)\n" -"SOUND_GENERAL_MOVING_IN_SAND = SOUND_ARG_LOAD(3, 0, 0x3C, 0x00, 8)\n" -"SOUND_GENERAL_UNKNOWN4_LOWPRIO = SOUND_ARG_LOAD(3, 0, 0x3D, 0x00, 8)\n" -"SOUND_GENERAL_UNKNOWN4 = SOUND_ARG_LOAD(3, 0, 0x3D, 0x80, 8)\n" -"SOUND_GENERAL_MOVING_PLATFORM_SWITCH = SOUND_ARG_LOAD(3, 0, 0x3E, 0x00, 8)\n" -"SOUND_GENERAL_CAGE_OPEN = SOUND_ARG_LOAD(3, 0, 0x3F, 0xA0, 8)\n" -"SOUND_GENERAL_QUIET_POUND1_LOWPRIO = SOUND_ARG_LOAD(3, 0, 0x40, 0x00, 8)\n" -"SOUND_GENERAL_QUIET_POUND1 = SOUND_ARG_LOAD(3, 0, 0x40, 0x40, 8)\n" -"SOUND_GENERAL_BREAK_BOX = SOUND_ARG_LOAD(3, 0, 0x41, 0xC0, 8)\n" -"SOUND_GENERAL_DOOR_INSERT_KEY = SOUND_ARG_LOAD(3, 0, 0x42, 0x00, 8)\n" -"SOUND_GENERAL_QUIET_POUND2 = SOUND_ARG_LOAD(3, 0, 0x43, 0x00, 8)\n" -"SOUND_GENERAL_BIG_POUND = SOUND_ARG_LOAD(3, 0, 0x44, 0x00, 8)\n" -"SOUND_GENERAL_UNK45 = SOUND_ARG_LOAD(3, 0, 0x45, 0x00, 8)\n" -"SOUND_GENERAL_UNK46_LOWPRIO = SOUND_ARG_LOAD(3, 0, 0x46, 0x00, 8)\n" -"SOUND_GENERAL_UNK46 = SOUND_ARG_LOAD(3, 0, 0x46, 0x80, 8)\n" -"SOUND_GENERAL_CANNON_UP = SOUND_ARG_LOAD(3, 0, 0x47, 0x80, 8)\n" -"SOUND_GENERAL_GRINDEL_ROLL = SOUND_ARG_LOAD(3, 0, 0x48, 0x00, 8)\n" -"SOUND_GENERAL_EXPLOSION7 = 0x3049\n" -"SOUND_GENERAL_SHAKE_COFFIN = 0x304A\n" -"SOUND_GENERAL_RACE_GUN_SHOT = SOUND_ARG_LOAD(3, 1, 0x4D, 0x40, 8)\n" -"SOUND_GENERAL_STAR_DOOR_OPEN = SOUND_ARG_LOAD(3, 0, 0x4E, 0xC0, 8)\n" -"SOUND_GENERAL_STAR_DOOR_CLOSE = SOUND_ARG_LOAD(3, 0, 0x4F, 0xC0, 8)\n" -"SOUND_GENERAL_POUND_ROCK = SOUND_ARG_LOAD(3, 0, 0x56, 0x00, 8)\n" -"SOUND_GENERAL_STAR_APPEARS = SOUND_ARG_LOAD(3, 0, 0x57, 0xFF, 9)\n" -"SOUND_GENERAL_COLLECT_1UP = SOUND_ARG_LOAD(3, 0, 0x58, 0xFF, 8)\n" -"SOUND_GENERAL_BUTTON_PRESS_LOWPRIO = SOUND_ARG_LOAD(3, 0, 0x5A, 0x00, 8)\n" -"SOUND_GENERAL_BUTTON_PRESS = SOUND_ARG_LOAD(3, 0, 0x5A, 0x40, 8)\n" -"SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO = SOUND_ARG_LOAD(3, 1, 0x5A, 0x00, 8)\n" -"SOUND_GENERAL_BUTTON_PRESS_2 = SOUND_ARG_LOAD(3, 1, 0x5A, 0x40, 8)\n" -"SOUND_GENERAL_ELEVATOR_MOVE = SOUND_ARG_LOAD(3, 0, 0x5B, 0x00, 8)\n" -"SOUND_GENERAL_ELEVATOR_MOVE_2 = SOUND_ARG_LOAD(3, 1, 0x5B, 0x00, 8)\n" -"SOUND_GENERAL_SWISH_AIR = SOUND_ARG_LOAD(3, 0, 0x5C, 0x00, 8)\n" -"SOUND_GENERAL_SWISH_AIR_2 = SOUND_ARG_LOAD(3, 1, 0x5C, 0x00, 8)\n" -"SOUND_GENERAL_HAUNTED_CHAIR = SOUND_ARG_LOAD(3, 0, 0x5D, 0x00, 8)\n" -"SOUND_GENERAL_SOFT_LANDING = SOUND_ARG_LOAD(3, 0, 0x5E, 0x00, 8)\n" -"SOUND_GENERAL_HAUNTED_CHAIR_MOVE = SOUND_ARG_LOAD(3, 0, 0x5F, 0x00, 8)\n" -"SOUND_GENERAL_BOWSER_PLATFORM = SOUND_ARG_LOAD(3, 0, 0x62, 0x80, 8)\n" -"SOUND_GENERAL_BOWSER_PLATFORM_2 = SOUND_ARG_LOAD(3, 1, 0x62, 0x80, 8)\n" -"SOUND_GENERAL_HEART_SPIN = SOUND_ARG_LOAD(3, 0, 0x64, 0xC0, 8)\n" -"SOUND_GENERAL_POUND_WOOD_POST = SOUND_ARG_LOAD(3, 0, 0x65, 0xC0, 8)\n" -"SOUND_GENERAL_WATER_LEVEL_TRIG = SOUND_ARG_LOAD(3, 0, 0x66, 0x80, 8)\n" -"SOUND_GENERAL_SWITCH_DOOR_OPEN = SOUND_ARG_LOAD(3, 0, 0x67, 0xA0, 8)\n" -"SOUND_GENERAL_RED_COIN = SOUND_ARG_LOAD(3, 0, 0x68, 0x90, 8)\n" -"SOUND_GENERAL_BIRDS_FLY_AWAY = SOUND_ARG_LOAD(3, 0, 0x69, 0x00, 8)\n" -"SOUND_GENERAL_METAL_POUND = SOUND_ARG_LOAD(3, 0, 0x6B, 0x80, 8)\n" -"SOUND_GENERAL_BOING1 = SOUND_ARG_LOAD(3, 0, 0x6C, 0x40, 8)\n" -"SOUND_GENERAL_BOING2_LOWPRIO = SOUND_ARG_LOAD(3, 0, 0x6D, 0x20, 8)\n" -"SOUND_GENERAL_BOING2 = SOUND_ARG_LOAD(3, 0, 0x6D, 0x40, 8)\n" -"SOUND_GENERAL_YOSHI_WALK = SOUND_ARG_LOAD(3, 0, 0x6E, 0x20, 8)\n" -"SOUND_GENERAL_ENEMY_ALERT1 = SOUND_ARG_LOAD(3, 0, 0x6F, 0x30, 8)\n" -"SOUND_GENERAL_YOSHI_TALK = SOUND_ARG_LOAD(3, 0, 0x70, 0x30, 8)\n" -"SOUND_GENERAL_SPLATTERING = SOUND_ARG_LOAD(3, 0, 0x71, 0x30, 8)\n" -"SOUND_GENERAL_BOING3 = 0x3072\n" -"SOUND_GENERAL_GRAND_STAR = SOUND_ARG_LOAD(3, 0, 0x73, 0x00, 8)\n" -"SOUND_GENERAL_GRAND_STAR_JUMP = SOUND_ARG_LOAD(3, 0, 0x74, 0x00, 8)\n" -"SOUND_GENERAL_BOAT_ROCK = SOUND_ARG_LOAD(3, 0, 0x75, 0x00, 8)\n" -"SOUND_GENERAL_VANISH_SFX = SOUND_ARG_LOAD(3, 0, 0x76, 0x20, 8)\n" -"SOUND_ENV_WATERFALL1 = SOUND_ARG_LOAD(4, 0, 0x00, 0x00, 0)\n" -"SOUND_ENV_WATERFALL2 = SOUND_ARG_LOAD(4, 0, 0x01, 0x00, 0)\n" -"SOUND_ENV_ELEVATOR1 = SOUND_ARG_LOAD(4, 0, 0x02, 0x00, 0)\n" -"SOUND_ENV_DRONING1 = SOUND_ARG_LOAD(4, 1, 0x03, 0x00, 0)\n" -"SOUND_ENV_DRONING2 = SOUND_ARG_LOAD(4, 0, 0x04, 0x00, 0)\n" -"SOUND_ENV_WIND1 = SOUND_ARG_LOAD(4, 0, 0x05, 0x00, 0)\n" -"SOUND_ENV_MOVING_SAND_SNOW = 0x4006\n" -"SOUND_ENV_UNK07 = 0x4007\n" -"SOUND_ENV_ELEVATOR2 = SOUND_ARG_LOAD(4, 0, 0x08, 0x00, 0)\n" -"SOUND_ENV_WATER = SOUND_ARG_LOAD(4, 0, 0x09, 0x00, 0)\n" -"SOUND_ENV_UNKNOWN2 = SOUND_ARG_LOAD(4, 0, 0x0A, 0x00, 0)\n" -"SOUND_ENV_BOAT_ROCKING1 = SOUND_ARG_LOAD(4, 0, 0x0B, 0x00, 0)\n" -"SOUND_ENV_ELEVATOR3 = SOUND_ARG_LOAD(4, 0, 0x0C, 0x00, 0)\n" -"SOUND_ENV_ELEVATOR4 = SOUND_ARG_LOAD(4, 0, 0x0D, 0x00, 0)\n" -"SOUND_ENV_ELEVATOR4_2 = SOUND_ARG_LOAD(4, 1, 0x0D, 0x00, 0)\n" -"SOUND_ENV_MOVINGSAND = SOUND_ARG_LOAD(4, 0, 0x0E, 0x00, 0)\n" -"SOUND_ENV_MERRY_GO_ROUND_CREAKING = SOUND_ARG_LOAD(4, 0, 0x0F, 0x40, 0)\n" -"SOUND_ENV_WIND2 = SOUND_ARG_LOAD(4, 0, 0x10, 0x80, 0)\n" -"SOUND_ENV_UNK12 = 0x4012\n" -"SOUND_ENV_SLIDING = SOUND_ARG_LOAD(4, 0, 0x13, 0x00, 0)\n" -"SOUND_ENV_STAR = SOUND_ARG_LOAD(4, 0, 0x14, 0x00, 1)\n" -"SOUND_ENV_UNKNOWN4 = SOUND_ARG_LOAD(4, 1, 0x15, 0x00, 0)\n" -"SOUND_ENV_WATER_DRAIN = SOUND_ARG_LOAD(4, 1, 0x16, 0x00, 0)\n" -"SOUND_ENV_METAL_BOX_PUSH = SOUND_ARG_LOAD(4, 0, 0x17, 0x80, 0)\n" -"SOUND_ENV_SINK_QUICKSAND = SOUND_ARG_LOAD(4, 0, 0x18, 0x80, 0)\n" -"SOUND_OBJ_SUSHI_SHARK_WATER_SOUND = SOUND_ARG_LOAD(5, 0, 0x00, 0x80, 8)\n" -"SOUND_OBJ_MRI_SHOOT = SOUND_ARG_LOAD(5, 0, 0x01, 0x00, 8)\n" -"SOUND_OBJ_BABY_PENGUIN_WALK = SOUND_ARG_LOAD(5, 0, 0x02, 0x00, 8)\n" -"SOUND_OBJ_BOWSER_WALK = SOUND_ARG_LOAD(5, 0, 0x03, 0x00, 8)\n" -"SOUND_OBJ_BOWSER_TAIL_PICKUP = SOUND_ARG_LOAD(5, 0, 0x05, 0x00, 8)\n" -"SOUND_OBJ_BOWSER_DEFEATED = SOUND_ARG_LOAD(5, 0, 0x06, 0x00, 8)\n" -"SOUND_OBJ_BOWSER_SPINNING = SOUND_ARG_LOAD(5, 0, 0x07, 0x00, 8)\n" -"SOUND_OBJ_BOWSER_INHALING = SOUND_ARG_LOAD(5, 0, 0x08, 0x00, 8)\n" -"SOUND_OBJ_BIG_PENGUIN_WALK = SOUND_ARG_LOAD(5, 0, 0x09, 0x80, 8)\n" -"SOUND_OBJ_BOO_BOUNCE_TOP = SOUND_ARG_LOAD(5, 0, 0x0A, 0x00, 8)\n" -"SOUND_OBJ_BOO_LAUGH_SHORT = SOUND_ARG_LOAD(5, 0, 0x0B, 0x00, 8)\n" -"SOUND_OBJ_THWOMP = SOUND_ARG_LOAD(5, 0, 0x0C, 0xA0, 8)\n" -"SOUND_OBJ_CANNON1 = SOUND_ARG_LOAD(5, 0, 0x0D, 0xF0, 8)\n" -"SOUND_OBJ_CANNON2 = SOUND_ARG_LOAD(5, 0, 0x0E, 0xF0, 8)\n" -"SOUND_OBJ_CANNON3 = SOUND_ARG_LOAD(5, 0, 0x0F, 0xF0, 8)\n" -"SOUND_OBJ_JUMP_WALK_WATER = 0x5012\n" -"SOUND_OBJ_UNKNOWN2 = SOUND_ARG_LOAD(5, 0, 0x13, 0x00, 8)\n" -"SOUND_OBJ_MRI_DEATH = SOUND_ARG_LOAD(5, 0, 0x14, 0x00, 8)\n" -"SOUND_OBJ_POUNDING1 = SOUND_ARG_LOAD(5, 0, 0x15, 0x50, 8)\n" -"SOUND_OBJ_POUNDING1_HIGHPRIO = SOUND_ARG_LOAD(5, 0, 0x15, 0x80, 8)\n" -"SOUND_OBJ_WHOMP_LOWPRIO = SOUND_ARG_LOAD(5, 0, 0x16, 0x60, 8)\n" -"SOUND_OBJ_KING_BOBOMB = SOUND_ARG_LOAD(5, 0, 0x16, 0x80, 8)\n" -"SOUND_OBJ_BULLY_METAL = SOUND_ARG_LOAD(5, 0, 0x17, 0x80, 8)\n" -"SOUND_OBJ_BULLY_EXPLODE = SOUND_ARG_LOAD(5, 0, 0x18, 0xA0, 8)\n" -"SOUND_OBJ_BULLY_EXPLODE_2 = SOUND_ARG_LOAD(5, 1, 0x18, 0xA0, 8)\n" -"SOUND_OBJ_POUNDING_CANNON = SOUND_ARG_LOAD(5, 0, 0x1A, 0x50, 8)\n" -"SOUND_OBJ_BULLY_WALK = SOUND_ARG_LOAD(5, 0, 0x1B, 0x30, 8)\n" -"SOUND_OBJ_UNKNOWN3 = SOUND_ARG_LOAD(5, 0, 0x1D, 0x80, 8)\n" -"SOUND_OBJ_UNKNOWN4 = SOUND_ARG_LOAD(5, 0, 0x1E, 0xA0, 8)\n" -"SOUND_OBJ_BABY_PENGUIN_DIVE = SOUND_ARG_LOAD(5, 0, 0x1F, 0x40, 8)\n" -"SOUND_OBJ_GOOMBA_WALK = SOUND_ARG_LOAD(5, 0, 0x20, 0x00, 8)\n" -"SOUND_OBJ_UKIKI_CHATTER_LONG = SOUND_ARG_LOAD(5, 0, 0x21, 0x00, 8)\n" -"SOUND_OBJ_MONTY_MOLE_ATTACK = SOUND_ARG_LOAD(5, 0, 0x22, 0x00, 8)\n" -"SOUND_OBJ_EVIL_LAKITU_THROW = SOUND_ARG_LOAD(5, 0, 0x22, 0x20, 8)\n" -"SOUND_OBJ_UNK23 = 0x5023\n" -"SOUND_OBJ_DYING_ENEMY1 = SOUND_ARG_LOAD(5, 0, 0x24, 0x40, 8)\n" -"SOUND_OBJ_CANNON4 = SOUND_ARG_LOAD(5, 0, 0x25, 0x40, 8)\n" -"SOUND_OBJ_DYING_ENEMY2 = 0x5026\n" -"SOUND_OBJ_BOBOMB_WALK = SOUND_ARG_LOAD(5, 0, 0x27, 0x00, 8)\n" -"SOUND_OBJ_SOMETHING_LANDING = SOUND_ARG_LOAD(5, 0, 0x28, 0x80, 8)\n" -"SOUND_OBJ_DIVING_IN_WATER = SOUND_ARG_LOAD(5, 0, 0x29, 0xA0, 8)\n" -"SOUND_OBJ_SNOW_SAND1 = SOUND_ARG_LOAD(5, 0, 0x2A, 0x00, 8)\n" -"SOUND_OBJ_SNOW_SAND2 = SOUND_ARG_LOAD(5, 0, 0x2B, 0x00, 8)\n" -"SOUND_OBJ_DEFAULT_DEATH = SOUND_ARG_LOAD(5, 0, 0x2C, 0x80, 8)\n" -"SOUND_OBJ_BIG_PENGUIN_YELL = SOUND_ARG_LOAD(5, 0, 0x2D, 0x00, 8)\n" -"SOUND_OBJ_WATER_BOMB_BOUNCING = SOUND_ARG_LOAD(5, 0, 0x2E, 0x80, 8)\n" -"SOUND_OBJ_GOOMBA_ALERT = SOUND_ARG_LOAD(5, 0, 0x2F, 0x00, 8)\n" -"SOUND_OBJ_WIGGLER_JUMP = SOUND_ARG_LOAD(5, 0, 0x2F, 0x60, 8)\n" -"SOUND_OBJ_STOMPED = SOUND_ARG_LOAD(5, 0, 0x30, 0x80, 8)\n" -"SOUND_OBJ_UNKNOWN6 = SOUND_ARG_LOAD(5, 0, 0x31, 0x00, 8)\n" -"SOUND_OBJ_DIVING_INTO_WATER = SOUND_ARG_LOAD(5, 0, 0x32, 0x40, 8)\n" -"SOUND_OBJ_PIRANHA_PLANT_SHRINK = SOUND_ARG_LOAD(5, 0, 0x33, 0x40, 8)\n" -"SOUND_OBJ_KOOPA_THE_QUICK_WALK = SOUND_ARG_LOAD(5, 0, 0x34, 0x20, 8)\n" -"SOUND_OBJ_KOOPA_WALK = SOUND_ARG_LOAD(5, 0, 0x35, 0x00, 8)\n" -"SOUND_OBJ_BULLY_WALKING = SOUND_ARG_LOAD(5, 0, 0x36, 0x60, 8)\n" -"SOUND_OBJ_DORRIE = SOUND_ARG_LOAD(5, 0, 0x37, 0x60, 8)\n" -"SOUND_OBJ_BOWSER_LAUGH = SOUND_ARG_LOAD(5, 0, 0x38, 0x80, 8)\n" -"SOUND_OBJ_UKIKI_CHATTER_SHORT = SOUND_ARG_LOAD(5, 0, 0x39, 0x00, 8)\n" -"SOUND_OBJ_UKIKI_CHATTER_IDLE = SOUND_ARG_LOAD(5, 0, 0x3A, 0x00, 8)\n" -"SOUND_OBJ_UKIKI_STEP_DEFAULT = SOUND_ARG_LOAD(5, 0, 0x3B, 0x00, 8)\n" -"SOUND_OBJ_UKIKI_STEP_LEAVES = SOUND_ARG_LOAD(5, 0, 0x3C, 0x00, 8)\n" -"SOUND_OBJ_KOOPA_TALK = SOUND_ARG_LOAD(5, 0, 0x3D, 0xA0, 8)\n" -"SOUND_OBJ_KOOPA_DAMAGE = SOUND_ARG_LOAD(5, 0, 0x3E, 0xA0, 8)\n" -"SOUND_OBJ_KLEPTO1 = SOUND_ARG_LOAD(5, 0, 0x3F, 0x40, 8)\n" -"SOUND_OBJ_KLEPTO2 = SOUND_ARG_LOAD(5, 0, 0x40, 0x60, 8)\n" -"SOUND_OBJ_KING_BOBOMB_TALK = SOUND_ARG_LOAD(5, 0, 0x41, 0x00, 8)\n" -"SOUND_OBJ_KING_BOBOMB_JUMP = SOUND_ARG_LOAD(5, 0, 0x46, 0x80, 8)\n" -"SOUND_OBJ_KING_WHOMP_DEATH = SOUND_ARG_LOAD(5, 1, 0x47, 0xC0, 8)\n" -"SOUND_OBJ_BOO_LAUGH_LONG = SOUND_ARG_LOAD(5, 0, 0x48, 0x00, 8)\n" -"SOUND_OBJ_EEL = SOUND_ARG_LOAD(5, 0, 0x4A, 0x00, 8)\n" -"SOUND_OBJ_EEL_2 = SOUND_ARG_LOAD(5, 2, 0x4A, 0x00, 8)\n" -"SOUND_OBJ_EYEROK_SHOW_EYE = SOUND_ARG_LOAD(5, 2, 0x4B, 0x00, 8)\n" -"SOUND_OBJ_MR_BLIZZARD_ALERT = SOUND_ARG_LOAD(5, 0, 0x4C, 0x00, 8)\n" -"SOUND_OBJ_SNUFIT_SHOOT = SOUND_ARG_LOAD(5, 0, 0x4D, 0x00, 8)\n" -"SOUND_OBJ_SKEETER_WALK = SOUND_ARG_LOAD(5, 0, 0x4E, 0x00, 8)\n" -"SOUND_OBJ_WALKING_WATER = SOUND_ARG_LOAD(5, 0, 0x4F, 0x00, 8)\n" -"SOUND_OBJ_BIRD_CHIRP3 = SOUND_ARG_LOAD(5, 0, 0x51, 0x40, 0)\n" -"SOUND_OBJ_PIRANHA_PLANT_APPEAR = SOUND_ARG_LOAD(5, 0, 0x54, 0x20, 8)\n" -"SOUND_OBJ_FLAME_BLOWN = SOUND_ARG_LOAD(5, 0, 0x55, 0x80, 8)\n" -"SOUND_OBJ_MAD_PIANO_CHOMPING = SOUND_ARG_LOAD(5, 2, 0x56, 0x40, 8)\n" -"SOUND_OBJ_BOBOMB_BUDDY_TALK = SOUND_ARG_LOAD(5, 0, 0x58, 0x40, 8)\n" -"SOUND_OBJ_SPINY_UNK59 = SOUND_ARG_LOAD(5, 0, 0x59, 0x10, 8)\n" -"SOUND_OBJ_WIGGLER_HIGH_PITCH = SOUND_ARG_LOAD(5, 0, 0x5C, 0x40, 8)\n" -"SOUND_OBJ_HEAVEHO_TOSSED = SOUND_ARG_LOAD(5, 0, 0x5D, 0x40, 8)\n" -"SOUND_OBJ_WIGGLER_DEATH = 0x505E\n" -"SOUND_OBJ_BOWSER_INTRO_LAUGH = SOUND_ARG_LOAD(5, 0, 0x5F, 0x80, 9)\n" -"SOUND_OBJ_ENEMY_DEATH_HIGH = SOUND_ARG_LOAD(5, 0, 0x60, 0xB0, 8)\n" -"SOUND_OBJ_ENEMY_DEATH_LOW = SOUND_ARG_LOAD(5, 0, 0x61, 0xB0, 8)\n" -"SOUND_OBJ_SWOOP_DEATH = SOUND_ARG_LOAD(5, 0, 0x62, 0xB0, 8)\n" -"SOUND_OBJ_KOOPA_FLYGUY_DEATH = SOUND_ARG_LOAD(5, 0, 0x63, 0xB0, 8)\n" -"SOUND_OBJ_POKEY_DEATH = SOUND_ARG_LOAD(5, 0, 0x63, 0xC0, 8)\n" -"SOUND_OBJ_SNOWMAN_BOUNCE = SOUND_ARG_LOAD(5, 0, 0x64, 0xC0, 8)\n" -"SOUND_OBJ_SNOWMAN_EXPLODE = SOUND_ARG_LOAD(5, 0, 0x65, 0xD0, 8)\n" -"SOUND_OBJ_POUNDING_LOUD = SOUND_ARG_LOAD(5, 0, 0x68, 0x40, 8)\n" -"SOUND_OBJ_MIPS_RABBIT = SOUND_ARG_LOAD(5, 0, 0x6A, 0x00, 8)\n" -"SOUND_OBJ_MIPS_RABBIT_WATER = SOUND_ARG_LOAD(5, 0, 0x6C, 0x00, 8)\n" -"SOUND_OBJ_EYEROK_EXPLODE = SOUND_ARG_LOAD(5, 0, 0x6D, 0x00, 8)\n" -"SOUND_OBJ_CHUCKYA_DEATH = SOUND_ARG_LOAD(5, 1, 0x6E, 0x00, 8)\n" -"SOUND_OBJ_WIGGLER_TALK = SOUND_ARG_LOAD(5, 0, 0x6F, 0x00, 8)\n" -"SOUND_OBJ_WIGGLER_ATTACKED = SOUND_ARG_LOAD(5, 0, 0x70, 0x60, 8)\n" -"SOUND_OBJ_WIGGLER_LOW_PITCH = SOUND_ARG_LOAD(5, 0, 0x71, 0x20, 8)\n" -"SOUND_OBJ_SNUFIT_SKEETER_DEATH = SOUND_ARG_LOAD(5, 0, 0x72, 0xC0, 8)\n" -"SOUND_OBJ_BUBBA_CHOMP = SOUND_ARG_LOAD(5, 0, 0x73, 0x40, 8)\n" -"SOUND_OBJ_ENEMY_DEFEAT_SHRINK = SOUND_ARG_LOAD(5, 0, 0x74, 0x40, 8)\n" -"SOUND_AIR_BOWSER_SPIT_FIRE = SOUND_ARG_LOAD(6, 0, 0x00, 0x00, 0)\n" -"SOUND_AIR_UNK01 = 0x6001\n" -"SOUND_AIR_LAKITU_FLY = SOUND_ARG_LOAD(6, 0, 0x02, 0x80, 0)\n" -"SOUND_AIR_LAKITU_FLY_HIGHPRIO = SOUND_ARG_LOAD(6, 0, 0x02, 0xFF, 0)\n" -"SOUND_AIR_AMP_BUZZ = SOUND_ARG_LOAD(6, 0, 0x03, 0x40, 0)\n" -"SOUND_AIR_BLOW_FIRE = SOUND_ARG_LOAD(6, 0, 0x04, 0x80, 0)\n" -"SOUND_AIR_BLOW_WIND = SOUND_ARG_LOAD(6, 0, 0x04, 0x40, 0)\n" -"SOUND_AIR_ROUGH_SLIDE = SOUND_ARG_LOAD(6, 0, 0x05, 0x00, 0)\n" -"SOUND_AIR_HEAVEHO_MOVE = SOUND_ARG_LOAD(6, 0, 0x06, 0x40, 0)\n" -"SOUND_AIR_UNK07 = 0x6007\n" -"SOUND_AIR_BOBOMB_LIT_FUSE = SOUND_ARG_LOAD(6, 0, 0x08, 0x60, 0)\n" -"SOUND_AIR_HOWLING_WIND = SOUND_ARG_LOAD(6, 0, 0x09, 0x80, 0)\n" -"SOUND_AIR_CHUCKYA_MOVE = SOUND_ARG_LOAD(6, 0, 0x0A, 0x40, 0)\n" -"SOUND_AIR_PEACH_TWINKLE = SOUND_ARG_LOAD(6, 0, 0x0B, 0x40, 0)\n" -"SOUND_AIR_CASTLE_OUTDOORS_AMBIENT = SOUND_ARG_LOAD(6, 0, 0x10, 0x40, 0)\n" -"SOUND_MENU_CHANGE_SELECT = SOUND_ARG_LOAD(7, 0, 0x00, 0xF8, 8)\n" -"SOUND_MENU_REVERSE_PAUSE = 0x7001\n" -"SOUND_MENU_PAUSE = SOUND_ARG_LOAD(7, 0, 0x02, 0xF0, 8)\n" -"SOUND_MENU_PAUSE_HIGHPRIO = SOUND_ARG_LOAD(7, 0, 0x02, 0xFF, 8)\n" -"SOUND_MENU_PAUSE_2 = SOUND_ARG_LOAD(7, 0, 0x03, 0xFF, 8)\n" -"SOUND_MENU_MESSAGE_APPEAR = SOUND_ARG_LOAD(7, 0, 0x04, 0x00, 8)\n" -"SOUND_MENU_MESSAGE_DISAPPEAR = SOUND_ARG_LOAD(7, 0, 0x05, 0x00, 8)\n" -"SOUND_MENU_CAMERA_ZOOM_IN = SOUND_ARG_LOAD(7, 0, 0x06, 0x00, 8)\n" -"SOUND_MENU_CAMERA_ZOOM_OUT = SOUND_ARG_LOAD(7, 0, 0x07, 0x00, 8)\n" -"SOUND_MENU_PINCH_MARIO_FACE = SOUND_ARG_LOAD(7, 0, 0x08, 0x00, 8)\n" -"SOUND_MENU_LET_GO_MARIO_FACE = SOUND_ARG_LOAD(7, 0, 0x09, 0x00, 8)\n" -"SOUND_MENU_HAND_APPEAR = SOUND_ARG_LOAD(7, 0, 0x0A, 0x00, 8)\n" -"SOUND_MENU_HAND_DISAPPEAR = SOUND_ARG_LOAD(7, 0, 0x0B, 0x00, 8)\n" -"SOUND_MENU_UNK0C = SOUND_ARG_LOAD(7, 0, 0x0C, 0x00, 8)\n" -"SOUND_MENU_POWER_METER = SOUND_ARG_LOAD(7, 0, 0x0D, 0x00, 8)\n" -"SOUND_MENU_CAMERA_BUZZ = SOUND_ARG_LOAD(7, 0, 0x0E, 0x00, 8)\n" -"SOUND_MENU_CAMERA_TURN = SOUND_ARG_LOAD(7, 0, 0x0F, 0x00, 8)\n" -"SOUND_MENU_UNK10 = 0x7010\n" -"SOUND_MENU_CLICK_FILE_SELECT = SOUND_ARG_LOAD(7, 0, 0x11, 0x00, 8)\n" -"SOUND_MENU_MESSAGE_NEXT_PAGE = SOUND_ARG_LOAD(7, 0, 0x13, 0x00, 8)\n" -"SOUND_MENU_COIN_ITS_A_ME_MARIO = SOUND_ARG_LOAD(7, 0, 0x14, 0x00, 8)\n" -"SOUND_MENU_YOSHI_GAIN_LIVES = SOUND_ARG_LOAD(7, 0, 0x15, 0x00, 8)\n" -"SOUND_MENU_ENTER_PIPE = SOUND_ARG_LOAD(7, 0, 0x16, 0xA0, 8)\n" -"SOUND_MENU_EXIT_PIPE = SOUND_ARG_LOAD(7, 0, 0x17, 0xA0, 8)\n" -"SOUND_MENU_BOWSER_LAUGH = SOUND_ARG_LOAD(7, 0, 0x18, 0x80, 8)\n" -"SOUND_MENU_ENTER_HOLE = SOUND_ARG_LOAD(7, 1, 0x19, 0x80, 8)\n" -"SOUND_MENU_CLICK_CHANGE_VIEW = SOUND_ARG_LOAD(7, 0, 0x1A, 0x80, 8)\n" -"SOUND_MENU_CAMERA_UNUSED1 = 0x701B\n" -"SOUND_MENU_CAMERA_UNUSED2 = 0x701C\n" -"SOUND_MENU_MARIO_CASTLE_WARP = SOUND_ARG_LOAD(7, 0, 0x1D, 0xB0, 8)\n" -"SOUND_MENU_STAR_SOUND = SOUND_ARG_LOAD(7, 0, 0x1E, 0xFF, 8)\n" -"SOUND_MENU_THANK_YOU_PLAYING_MY_GAME = SOUND_ARG_LOAD(7, 0, 0x1F, 0xFF, 8)\n" -"SOUND_MENU_READ_A_SIGN = 0x7020\n" -"SOUND_MENU_EXIT_A_SIGN = 0x7021\n" -"SOUND_MENU_MARIO_CASTLE_WARP2 = SOUND_ARG_LOAD(7, 0, 0x22, 0x20, 8)\n" -"SOUND_MENU_STAR_SOUND_OKEY_DOKEY = SOUND_ARG_LOAD(7, 0, 0x23, 0xFF, 8)\n" -"SOUND_MENU_STAR_SOUND_LETS_A_GO = SOUND_ARG_LOAD(7, 0, 0x24, 0xFF, 8)\n" -"SOUND_MENU_COLLECT_RED_COIN = SOUND_ARG_LOAD(7, 8, 0x28, 0x90, 8)\n" -"SOUND_MENU_COLLECT_SECRET = SOUND_ARG_LOAD(7, 0, 0x30, 0x20, 8)\n" -"SOUND_GENERAL2_BOBOMB_EXPLOSION = SOUND_ARG_LOAD(8, 0, 0x2E, 0x20, 8)\n" -"SOUND_GENERAL2_PURPLE_SWITCH = SOUND_ARG_LOAD(8, 0, 0x3E, 0xC0, 8)\n" -"SOUND_GENERAL2_ROTATING_BLOCK_CLICK = SOUND_ARG_LOAD(8, 0, 0x40, 0x00, 8)\n" -"SOUND_GENERAL2_SPINDEL_ROLL = SOUND_ARG_LOAD(8, 0, 0x48, 0x20, 8)\n" -"SOUND_GENERAL2_PYRAMID_TOP_SPIN = SOUND_ARG_LOAD(8, 1, 0x4B, 0xE0, 8)\n" -"SOUND_GENERAL2_PYRAMID_TOP_EXPLOSION = SOUND_ARG_LOAD(8, 1, 0x4C, 0xF0, 8)\n" -"SOUND_GENERAL2_BIRD_CHIRP2 = SOUND_ARG_LOAD(8, 0, 0x50, 0x40, 0)\n" -"SOUND_GENERAL2_SWITCH_TICK_FAST = SOUND_ARG_LOAD(8, 0, 0x54, 0xF0, 1)\n" -"SOUND_GENERAL2_SWITCH_TICK_SLOW = SOUND_ARG_LOAD(8, 0, 0x55, 0xF0, 1)\n" -"SOUND_GENERAL2_STAR_APPEARS = SOUND_ARG_LOAD(8, 0, 0x57, 0xFF, 9)\n" -"SOUND_GENERAL2_ROTATING_BLOCK_ALERT = SOUND_ARG_LOAD(8, 0, 0x59, 0x00, 8)\n" -"SOUND_GENERAL2_BOWSER_EXPLODE = SOUND_ARG_LOAD(8, 0, 0x60, 0x00, 8)\n" -"SOUND_GENERAL2_BOWSER_KEY = SOUND_ARG_LOAD(8, 0, 0x61, 0x00, 8)\n" -"SOUND_GENERAL2_1UP_APPEAR = SOUND_ARG_LOAD(8, 0, 0x63, 0xD0, 8)\n" -"SOUND_GENERAL2_RIGHT_ANSWER = SOUND_ARG_LOAD(8, 0, 0x6A, 0xA0, 8)\n" -"SOUND_OBJ2_BOWSER_ROAR = SOUND_ARG_LOAD(9, 0, 0x04, 0x00, 8)\n" -"SOUND_OBJ2_PIRANHA_PLANT_BITE = SOUND_ARG_LOAD(9, 0, 0x10, 0x50, 8)\n" -"SOUND_OBJ2_PIRANHA_PLANT_DYING = SOUND_ARG_LOAD(9, 0, 0x11, 0x60, 8)\n" -"SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE = SOUND_ARG_LOAD(9, 0, 0x19, 0x20, 8)\n" -"SOUND_OBJ2_BULLY_ATTACKED = SOUND_ARG_LOAD(9, 0, 0x1C, 0x00, 8)\n" -"SOUND_OBJ2_KING_BOBOMB_DAMAGE = SOUND_ARG_LOAD(9, 1, 0x42, 0x40, 8)\n" -"SOUND_OBJ2_SCUTTLEBUG_WALK = SOUND_ARG_LOAD(9, 0, 0x43, 0x40, 8)\n" -"SOUND_OBJ2_SCUTTLEBUG_ALERT = SOUND_ARG_LOAD(9, 0, 0x44, 0x40, 8)\n" -"SOUND_OBJ2_BABY_PENGUIN_YELL = SOUND_ARG_LOAD(9, 0, 0x45, 0x00, 8)\n" -"SOUND_OBJ2_SWOOP = SOUND_ARG_LOAD(9, 0, 0x49, 0x00, 8)\n" -"SOUND_OBJ2_BIRD_CHIRP1 = SOUND_ARG_LOAD(9, 0, 0x52, 0x40, 0)\n" -"SOUND_OBJ2_LARGE_BULLY_ATTACKED = SOUND_ARG_LOAD(9, 0, 0x57, 0x00, 8)\n" -"SOUND_OBJ2_EYEROK_SOUND_SHORT = SOUND_ARG_LOAD(9, 3, 0x5A, 0x00, 8)\n" -"SOUND_OBJ2_WHOMP_SOUND_SHORT = SOUND_ARG_LOAD(9, 3, 0x5A, 0xC0, 8)\n" -"SOUND_OBJ2_EYEROK_SOUND_LONG = SOUND_ARG_LOAD(9, 2, 0x5B, 0x00, 8)\n" -"SOUND_OBJ2_BOWSER_TELEPORT = SOUND_ARG_LOAD(9, 0, 0x66, 0x80, 8)\n" -"SOUND_OBJ2_MONTY_MOLE_APPEAR = SOUND_ARG_LOAD(9, 0, 0x67, 0x80, 8)\n" -"SOUND_OBJ2_BOSS_DIALOG_GRUNT = SOUND_ARG_LOAD(9, 0, 0x69, 0x40, 8)\n" -"SOUND_OBJ2_MRI_SPINNING = SOUND_ARG_LOAD(9, 0, 0x6B, 0x00, 8)\n" "id_bhvStarDoor = 0\n" "id_bhvMrI = 1\n" "id_bhvMrIBody = 2\n" @@ -913,9 +440,9 @@ char gSmluaConstants[] = "" "id_bhvPenguinBaby = 199\n" "id_bhvUnused20E0 = 200\n" "id_bhvSmallPenguin = 201\n" -"id_bhvFish2 = 202\n" -"id_bhvFish3 = 203\n" -"id_bhvLargeFishGroup = 204\n" +"id_bhvManyBlueFishSpawner = 202\n" +"id_bhvFewBlueFishSpawner = 203\n" +"id_bhvFishSpawner = 204\n" "id_bhvFish = 205\n" "id_bhvWdwExpressElevator = 206\n" "id_bhvWdwExpressElevatorPlatform = 207\n" @@ -2748,6 +2275,498 @@ char gSmluaConstants[] = "" "E_MODEL_WARIOS_WING_CAP = 373\n" "E_MODEL_WARIOS_WINGED_METAL_CAP = 374\n" "E_MODEL_MAX = 375\n" +"SOUNDARGS_MASK_BANK = 0xF0000000\n" +"SOUNDARGS_MASK_SOUNDID = 0x00FF0000\n" +"SOUNDARGS_MASK_PRIORITY = 0x0000FF00\n" +"SOUNDARGS_MASK_STATUS = 0x0000000F\n" +"SOUNDARGS_SHIFT_BANK = 28\n" +"SOUNDARGS_SHIFT_SOUNDID = 16\n" +"SOUNDARGS_SHIFT_PRIORITY = 8\n" +"SOUND_BANK_ACTION = 0\n" +"SOUND_BANK_MOVING = 1\n" +"SOUND_BANK_MARIO_VOICE = 2\n" +"SOUND_BANK_GENERAL = 3\n" +"SOUND_BANK_ENV = 4\n" +"SOUND_BANK_OBJ = 5\n" +"SOUND_BANK_AIR = 6\n" +"SOUND_BANK_MENU = 7\n" +"SOUND_BANK_GENERAL2 = 8\n" +"SOUND_BANK_OBJ2 = 9\n" +"SOUND_BANK_LUIGI_VOICE = 10\n" +"SOUND_BANK_WARIO_VOICE = 11\n" +"SOUND_BANK_COUNT = 12\n" +"SOUND_BANKS_ALL_BITS = 0xffff\n" +"SOUND_BANKS_ALL = ((1 << SOUND_BANK_COUNT) - 1)\n" +"SOUND_BANKS_FOREGROUND = ( (1 << SOUND_BANK_ACTION) | (1 << SOUND_BANK_MARIO_VOICE) | (1 << SOUND_BANK_MENU) | (1 << SOUND_BANK_LUIGI_VOICE) | (1 << SOUND_BANK_WARIO_VOICE))\n" +"SOUND_BANKS_BACKGROUND = (SOUND_BANKS_ALL & ~SOUND_BANKS_FOREGROUND)\n" +"SOUND_BANKS_DISABLED_DURING_INTRO_CUTSCENE = ( (1 << SOUND_BANK_ENV) | (1 << SOUND_BANK_OBJ) | (1 << SOUND_BANK_GENERAL2) | (1 << SOUND_BANK_OBJ2))\n" +"SOUND_BANKS_DISABLED_AFTER_CREDITS = ( (1 << SOUND_BANK_ACTION) | (1 << SOUND_BANK_MOVING) | (1 << SOUND_BANK_MARIO_VOICE) | (1 << SOUND_BANK_GENERAL) | (1 << SOUND_BANK_LUIGI_VOICE) | (1 << SOUND_BANK_WARIO_VOICE))\n" +"SOUND_NO_VOLUME_LOSS = 0x1000000\n" +"SOUND_VIBRATO = 0x2000000\n" +"SOUND_NO_PRIORITY_LOSS = 0x4000000\n" +"SOUND_CONSTANT_FREQUENCY = 0x8000000\n" +"SOUND_LOWER_BACKGROUND_MUSIC = 0x10\n" +"SOUND_NO_ECHO = 0x20\n" +"SOUND_DISCRETE = 0x80\n" +"SOUND_STATUS_STOPPED = 0\n" +"SOUND_STATUS_WAITING = 1\n" +"SOUND_STATUS_PLAYING = 2\n" +"SOUND_TERRAIN_DEFAULT = 0\n" +"SOUND_TERRAIN_GRASS = 1\n" +"SOUND_TERRAIN_WATER = 2\n" +"SOUND_TERRAIN_STONE = 3\n" +"SOUND_TERRAIN_SPOOKY = 4\n" +"SOUND_TERRAIN_SNOW = 5\n" +"SOUND_TERRAIN_ICE = 6\n" +"SOUND_TERRAIN_SAND = 7\n" +"NO_SOUND = 0\n" +"SOUND_ACTION_TERRAIN_JUMP = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x00, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_TERRAIN_LANDING = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x08, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_TERRAIN_STEP = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x10, 0x80, SOUND_VIBRATO | SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_TERRAIN_BODY_HIT_GROUND = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x18, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_TERRAIN_STEP_TIPTOE = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x20, 0x80, SOUND_VIBRATO | SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_TERRAIN_STUCK_IN_GROUND = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x48, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_TERRAIN_HEAVY_LANDING = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x60, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_METAL_JUMP = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x28, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_METAL_LANDING = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x29, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_METAL_STEP = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2A, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_METAL_HEAVY_LANDING = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2B, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_CLAP_HANDS_COLD = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2C, 0x00, SOUND_VIBRATO | SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_HANGING_STEP = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2D, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_QUICKSAND_STEP = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2E, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_METAL_STEP_TIPTOE = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x2F, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNKNOWN430 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x30, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNKNOWN431 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x31, 0x60, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNKNOWN432 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x32, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_SWIM = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x33, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNKNOWN434 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x34, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_THROW = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x35, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_KEY_SWISH = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x36, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_SPIN = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x37, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_TWIRL = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x38, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_CLIMB_UP_TREE = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3A, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_CLIMB_DOWN_TREE = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3B, 0x00, 0)\n" +"SOUND_ACTION_UNK3C = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3C, 0x00, 0)\n" +"SOUND_ACTION_UNKNOWN43D = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNKNOWN43E = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_PAT_BACK = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x3F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_BRUSH_HAIR = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x40, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_CLIMB_UP_POLE = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x41, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_METAL_BONK = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x42, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNSTUCK_FROM_GROUND = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x43, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_HIT = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x44, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_HIT_2 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x44, 0xB0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_HIT_3 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x44, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_BONK = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x45, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_SHRINK_INTO_BBH = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x46, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_SWIM_FAST = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x47, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_METAL_JUMP_WATER = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x50, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_METAL_LAND_WATER = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x51, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_METAL_STEP_WATER = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x52, 0x90, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNK53 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x53, 0x00, 0)\n" +"SOUND_ACTION_UNK54 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x54, 0x00, 0)\n" +"SOUND_ACTION_UNK55 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x55, 0x00, 0)\n" +"SOUND_ACTION_FLYING_FAST = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x56, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_TELEPORT = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x57, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNKNOWN458 = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x58, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_BOUNCE_OFF_OBJECT = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x59, 0xB0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_SIDE_FLIP_UNK = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5A, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_READ_SIGN = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5B, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNKNOWN45C = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_UNK5D = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5D, 0x00, 0)\n" +"SOUND_ACTION_INTRO_UNK45E = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_ACTION_INTRO_UNK45F = SOUND_ARG_LOAD(SOUND_BANK_ACTION, 0x5F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MOVING_TERRAIN_SLIDE = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x00, 0x00, SOUND_NO_PRIORITY_LOSS)\n" +"SOUND_MOVING_TERRAIN_RIDING_SHELL = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x20, 0x00, SOUND_NO_PRIORITY_LOSS)\n" +"SOUND_MOVING_LAVA_BURN = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x10, 0x00, SOUND_NO_PRIORITY_LOSS)\n" +"SOUND_MOVING_SLIDE_DOWN_POLE = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x11, 0x00, SOUND_NO_PRIORITY_LOSS)\n" +"SOUND_MOVING_SLIDE_DOWN_TREE = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x12, 0x80, SOUND_NO_PRIORITY_LOSS)\n" +"SOUND_MOVING_QUICKSAND_DEATH = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x14, 0x00, SOUND_NO_PRIORITY_LOSS)\n" +"SOUND_MOVING_SHOCKED = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x16, 0x00, SOUND_NO_PRIORITY_LOSS)\n" +"SOUND_MOVING_FLYING = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x17, 0x00, SOUND_NO_PRIORITY_LOSS)\n" +"SOUND_MOVING_ALMOST_DROWNING = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x18, 0x00, SOUND_NO_PRIORITY_LOSS | SOUND_CONSTANT_FREQUENCY)\n" +"SOUND_MOVING_AIM_CANNON = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x19, 0x20, SOUND_NO_VOLUME_LOSS | SOUND_NO_PRIORITY_LOSS | SOUND_CONSTANT_FREQUENCY)\n" +"SOUND_MOVING_UNK1A = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x1A, 0x00, 0)\n" +"SOUND_MOVING_RIDING_SHELL_LAVA = SOUND_ARG_LOAD(SOUND_BANK_MOVING, 0x28, 0x00, SOUND_NO_PRIORITY_LOSS)\n" +"SOUND_MARIO_YAH_WAH_HOO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x00, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_HOOHOO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x03, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_YAHOO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x04, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_UH = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x05, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_HRMM = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x06, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_WAH2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x07, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_WHOA = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x08, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_EEUH = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x09, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_ATTACKED = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0A, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_OOOF = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_OOOF2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0B, 0xD0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_HERE_WE_GO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_YAWNING = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_SNORING1 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_SNORING2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x0F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_WAAAOOOW = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x10, 0xC0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_HAHA = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x11, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_HAHA_2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x11, 0xF0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_UH2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x13, 0xD0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_UH2_2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x13, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_ON_FIRE = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x14, 0xA0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_DYING = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x15, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_PANTING_COLD = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x16, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_PANTING = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x18, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_COUGHING1 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_COUGHING2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1C, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_COUGHING3 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1D, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_PUNCH_YAH = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1E, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_PUNCH_HOO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x1F, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_MAMA_MIA = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x20, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_OKEY_DOKEY = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x21, 0x00, 0)\n" +"SOUND_MARIO_GROUND_POUND_WAH = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x22, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_DROWNING = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x23, 0xF0, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_PUNCH_WAH = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x24, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_PEACH_DEAR_MARIO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x28, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_YAHOO_WAHA_YIPPEE = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x2B, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_DOH = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x30, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_GAME_OVER = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x31, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_HELLO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x32, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_PRESS_START_TO_PLAY = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x33, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_NO_ECHO | SOUND_DISCRETE)\n" +"SOUND_MARIO_TWIRL_BOUNCE = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x34, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_SNORING3 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x35, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_SO_LONGA_BOWSER = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x36, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_MARIO_IMA_TIRED = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x37, 0x80, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_PEACH_MARIO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x38, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_PEACH_POWER_OF_THE_STARS = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x39, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_PEACH_THANKS_TO_YOU = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3A, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_PEACH_THANK_YOU_MARIO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3B, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_PEACH_SOMETHING_SPECIAL = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3C, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_PEACH_BAKE_A_CAKE = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3D, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_PEACH_FOR_MARIO = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3E, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_PEACH_MARIO2 = SOUND_ARG_LOAD(SOUND_BANK_MARIO_VOICE, 0x3F, 0xFF, SOUND_NO_PRIORITY_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_ACTIVATE_CAP_SWITCH = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x00, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_FLAME_OUT = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x03, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_OPEN_WOOD_DOOR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x04, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_CLOSE_WOOD_DOOR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x05, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_OPEN_IRON_DOOR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x06, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_CLOSE_IRON_DOOR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x07, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BUBBLES = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x08, 0x00, 0)\n" +"SOUND_GENERAL_MOVING_WATER = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x09, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_SWISH_WATER = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0A, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_QUIET_BUBBLE = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0B, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_VOLCANO_EXPLOSION = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0C, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_QUIET_BUBBLE2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0D, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_CASTLE_TRAP_OPEN = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0E, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_WALL_EXPLOSION = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x0F, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_COIN = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x11, 0x80, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE)\n" +"SOUND_GENERAL_COIN_WATER = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x12, 0x80, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE)\n" +"SOUND_GENERAL_SHORT_STAR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x16, 0x00, SOUND_LOWER_BACKGROUND_MUSIC | SOUND_DISCRETE)\n" +"SOUND_GENERAL_BIG_CLOCK = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x17, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_LOUD_POUND = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x18, 0x00, 0)\n" +"SOUND_GENERAL_LOUD_POUND2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x19, 0x00, 0)\n" +"SOUND_GENERAL_SHORT_POUND1 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1A, 0x00, 0)\n" +"SOUND_GENERAL_SHORT_POUND2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1B, 0x00, 0)\n" +"SOUND_GENERAL_SHORT_POUND3 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1C, 0x00, 0)\n" +"SOUND_GENERAL_SHORT_POUND4 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1D, 0x00, 0)\n" +"SOUND_GENERAL_SHORT_POUND5 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1E, 0x00, 0)\n" +"SOUND_GENERAL_SHORT_POUND6 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x1F, 0x00, 0)\n" +"SOUND_GENERAL_OPEN_CHEST = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x20, 0x80, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_CLAM_SHELL1 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x22, 0x80, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOX_LANDING = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x24, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOX_LANDING_2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x24, 0x00, SOUND_VIBRATO | SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNKNOWN1 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x25, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNKNOWN1_2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x25, 0x00, SOUND_VIBRATO | SOUND_DISCRETE)\n" +"SOUND_GENERAL_CLAM_SHELL2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x26, 0x40, SOUND_DISCRETE)\n" +"SOUND_GENERAL_CLAM_SHELL3 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x27, 0x40, SOUND_DISCRETE)\n" +"SOUND_GENERAL_PAINTING_EJECT = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x28, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE)\n" +"SOUND_GENERAL_LEVEL_SELECT_CHANGE = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x2B, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_PLATFORM = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x2D, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_DONUT_PLATFORM_EXPLOSION = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x2E, 0x20, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOWSER_BOMB_EXPLOSION = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x2F, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_COIN_SPURT = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x30, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_COIN_SPURT_2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x30, 0x00, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE)\n" +"SOUND_GENERAL_COIN_SPURT_EU = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x30, 0x20, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE)\n" +"SOUND_GENERAL_EXPLOSION6 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x31, 0x00, 0)\n" +"SOUND_GENERAL_UNK32 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x32, 0x00, 0)\n" +"SOUND_GENERAL_BOAT_TILT1 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x34, 0x40, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOAT_TILT2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x35, 0x40, SOUND_DISCRETE)\n" +"SOUND_GENERAL_COIN_DROP = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x36, 0x40, SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNKNOWN3_LOWPRIO = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x37, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNKNOWN3 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x37, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNKNOWN3_2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x37, 0x80, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE)\n" +"SOUND_GENERAL_PENDULUM_SWING = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x38, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_CHAIN_CHOMP1 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x39, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_CHAIN_CHOMP2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3A, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_DOOR_TURN_KEY = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3B, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_MOVING_IN_SAND = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3C, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNKNOWN4_LOWPRIO = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3D, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNKNOWN4 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3D, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_MOVING_PLATFORM_SWITCH = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3E, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_CAGE_OPEN = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x3F, 0xA0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_QUIET_POUND1_LOWPRIO = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x40, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_QUIET_POUND1 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x40, 0x40, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BREAK_BOX = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x41, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_DOOR_INSERT_KEY = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x42, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_QUIET_POUND2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x43, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BIG_POUND = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x44, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNK45 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x45, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNK46_LOWPRIO = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x46, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_UNK46 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x46, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_CANNON_UP = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x47, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_GRINDEL_ROLL = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x48, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_EXPLOSION7 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x49, 0x00, 0)\n" +"SOUND_GENERAL_SHAKE_COFFIN = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x4A, 0x00, 0)\n" +"SOUND_GENERAL_RACE_GUN_SHOT = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x4D, 0x40, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_STAR_DOOR_OPEN = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x4E, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_STAR_DOOR_CLOSE = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x4F, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_POUND_ROCK = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x56, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_STAR_APPEARS = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x57, 0xFF, SOUND_LOWER_BACKGROUND_MUSIC | SOUND_DISCRETE)\n" +"SOUND_GENERAL_COLLECT_1UP = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x58, 0xFF, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BUTTON_PRESS_LOWPRIO = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5A, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BUTTON_PRESS = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5A, 0x40, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5A, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_BUTTON_PRESS_2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5A, 0x40, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_ELEVATOR_MOVE = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5B, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_ELEVATOR_MOVE_2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5B, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_SWISH_AIR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5C, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_SWISH_AIR_2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5C, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_HAUNTED_CHAIR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5D, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_SOFT_LANDING = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5E, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_HAUNTED_CHAIR_MOVE = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x5F, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOWSER_PLATFORM = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x62, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOWSER_PLATFORM_2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x62, 0x80, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL_HEART_SPIN = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x64, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_POUND_WOOD_POST = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x65, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_WATER_LEVEL_TRIG = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x66, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_SWITCH_DOOR_OPEN = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x67, 0xA0, SOUND_DISCRETE)\n" +"SOUND_GENERAL_RED_COIN = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x68, 0x90, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BIRDS_FLY_AWAY = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x69, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_METAL_POUND = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6B, 0x80, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOING1 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6C, 0x40, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOING2_LOWPRIO = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6D, 0x20, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOING2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6D, 0x40, SOUND_DISCRETE)\n" +"SOUND_GENERAL_YOSHI_WALK = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6E, 0x20, SOUND_DISCRETE)\n" +"SOUND_GENERAL_ENEMY_ALERT1 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x6F, 0x30, SOUND_DISCRETE)\n" +"SOUND_GENERAL_YOSHI_TALK = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x70, 0x30, SOUND_DISCRETE)\n" +"SOUND_GENERAL_SPLATTERING = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x71, 0x30, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOING3 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x72, 0x00, 0)\n" +"SOUND_GENERAL_GRAND_STAR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x73, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_GRAND_STAR_JUMP = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x74, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_BOAT_ROCK = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x75, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL_VANISH_SFX = SOUND_ARG_LOAD(SOUND_BANK_GENERAL, 0x76, 0x20, SOUND_DISCRETE)\n" +"SOUND_ENV_WATERFALL1 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x00, 0x00, 0)\n" +"SOUND_ENV_WATERFALL2 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x01, 0x00, 0)\n" +"SOUND_ENV_ELEVATOR1 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x02, 0x00, 0)\n" +"SOUND_ENV_DRONING1 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x03, 0x00, SOUND_NO_VOLUME_LOSS)\n" +"SOUND_ENV_DRONING2 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x04, 0x00, 0)\n" +"SOUND_ENV_WIND1 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x05, 0x00, 0)\n" +"SOUND_ENV_MOVING_SAND_SNOW = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x06, 0x00, 0)\n" +"SOUND_ENV_UNK07 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x07, 0x00, 0)\n" +"SOUND_ENV_ELEVATOR2 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x08, 0x00, 0)\n" +"SOUND_ENV_WATER = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x09, 0x00, 0)\n" +"SOUND_ENV_UNKNOWN2 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0A, 0x00, 0)\n" +"SOUND_ENV_BOAT_ROCKING1 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0B, 0x00, 0)\n" +"SOUND_ENV_ELEVATOR3 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0C, 0x00, 0)\n" +"SOUND_ENV_ELEVATOR4 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0D, 0x00, 0)\n" +"SOUND_ENV_ELEVATOR4_2 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0D, 0x00, SOUND_NO_VOLUME_LOSS)\n" +"SOUND_ENV_MOVINGSAND = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0E, 0x00, 0)\n" +"SOUND_ENV_MERRY_GO_ROUND_CREAKING = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x0F, 0x40, 0)\n" +"SOUND_ENV_WIND2 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x10, 0x80, 0)\n" +"SOUND_ENV_UNK12 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x12, 0x00, 0)\n" +"SOUND_ENV_SLIDING = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x13, 0x00, 0)\n" +"SOUND_ENV_STAR = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x14, 0x00, SOUND_LOWER_BACKGROUND_MUSIC)\n" +"SOUND_ENV_UNKNOWN4 = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x15, 0x00, SOUND_NO_VOLUME_LOSS)\n" +"SOUND_ENV_WATER_DRAIN = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x16, 0x00, SOUND_NO_VOLUME_LOSS)\n" +"SOUND_ENV_METAL_BOX_PUSH = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x17, 0x80, 0)\n" +"SOUND_ENV_SINK_QUICKSAND = SOUND_ARG_LOAD(SOUND_BANK_ENV, 0x18, 0x80, 0)\n" +"SOUND_OBJ_SUSHI_SHARK_WATER_SOUND = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x00, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_MRI_SHOOT = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x01, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BABY_PENGUIN_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x02, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BOWSER_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x03, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BOWSER_TAIL_PICKUP = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x05, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BOWSER_DEFEATED = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x06, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BOWSER_SPINNING = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x07, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BOWSER_INHALING = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x08, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BIG_PENGUIN_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x09, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_BOO_BOUNCE_TOP = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0A, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BOO_LAUGH_SHORT = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0B, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_THWOMP = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0C, 0xA0, SOUND_DISCRETE)\n" +"SOUND_OBJ_CANNON1 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0D, 0xF0, SOUND_DISCRETE)\n" +"SOUND_OBJ_CANNON2 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0E, 0xF0, SOUND_DISCRETE)\n" +"SOUND_OBJ_CANNON3 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x0F, 0xF0, SOUND_DISCRETE)\n" +"SOUND_OBJ_JUMP_WALK_WATER = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x12, 0x00, 0)\n" +"SOUND_OBJ_UNKNOWN2 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x13, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_MRI_DEATH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x14, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_POUNDING1 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x15, 0x50, SOUND_DISCRETE)\n" +"SOUND_OBJ_POUNDING1_HIGHPRIO = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x15, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_WHOMP_LOWPRIO = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x16, 0x60, SOUND_DISCRETE)\n" +"SOUND_OBJ_KING_BOBOMB = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x16, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_BULLY_METAL = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x17, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_BULLY_EXPLODE = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x18, 0xA0, SOUND_DISCRETE)\n" +"SOUND_OBJ_BULLY_EXPLODE_2 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x18, 0xA0, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_OBJ_POUNDING_CANNON = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1A, 0x50, SOUND_DISCRETE)\n" +"SOUND_OBJ_BULLY_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1B, 0x30, SOUND_DISCRETE)\n" +"SOUND_OBJ_UNKNOWN3 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1D, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_UNKNOWN4 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1E, 0xA0, SOUND_DISCRETE)\n" +"SOUND_OBJ_BABY_PENGUIN_DIVE = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x1F, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_GOOMBA_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x20, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_UKIKI_CHATTER_LONG = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x21, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_MONTY_MOLE_ATTACK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x22, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_EVIL_LAKITU_THROW = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x22, 0x20, SOUND_DISCRETE)\n" +"SOUND_OBJ_UNK23 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x23, 0x00, 0)\n" +"SOUND_OBJ_DYING_ENEMY1 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x24, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_CANNON4 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x25, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_DYING_ENEMY2 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x26, 0x00, 0)\n" +"SOUND_OBJ_BOBOMB_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x27, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_SOMETHING_LANDING = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x28, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_DIVING_IN_WATER = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x29, 0xA0, SOUND_DISCRETE)\n" +"SOUND_OBJ_SNOW_SAND1 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2A, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_SNOW_SAND2 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2B, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_DEFAULT_DEATH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2C, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_BIG_PENGUIN_YELL = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2D, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_WATER_BOMB_BOUNCING = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2E, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_GOOMBA_ALERT = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2F, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_WIGGLER_JUMP = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x2F, 0x60, SOUND_DISCRETE)\n" +"SOUND_OBJ_STOMPED = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x30, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_UNKNOWN6 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x31, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_DIVING_INTO_WATER = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x32, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_PIRANHA_PLANT_SHRINK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x33, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_KOOPA_THE_QUICK_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x34, 0x20, SOUND_DISCRETE)\n" +"SOUND_OBJ_KOOPA_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x35, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BULLY_WALKING = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x36, 0x60, SOUND_DISCRETE)\n" +"SOUND_OBJ_DORRIE = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x37, 0x60, SOUND_DISCRETE)\n" +"SOUND_OBJ_BOWSER_LAUGH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x38, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_UKIKI_CHATTER_SHORT = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x39, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_UKIKI_CHATTER_IDLE = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3A, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_UKIKI_STEP_DEFAULT = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3B, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_UKIKI_STEP_LEAVES = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3C, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_KOOPA_TALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3D, 0xA0, SOUND_DISCRETE)\n" +"SOUND_OBJ_KOOPA_DAMAGE = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3E, 0xA0, SOUND_DISCRETE)\n" +"SOUND_OBJ_KLEPTO1 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x3F, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_KLEPTO2 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x40, 0x60, SOUND_DISCRETE)\n" +"SOUND_OBJ_KING_BOBOMB_TALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x41, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_KING_BOBOMB_JUMP = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x46, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_KING_WHOMP_DEATH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x47, 0xC0, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_OBJ_BOO_LAUGH_LONG = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x48, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_EEL = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4A, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_EEL_2 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4A, 0x00, SOUND_VIBRATO | SOUND_DISCRETE)\n" +"SOUND_OBJ_EYEROK_SHOW_EYE = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4B, 0x00, SOUND_VIBRATO | SOUND_DISCRETE)\n" +"SOUND_OBJ_MR_BLIZZARD_ALERT = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4C, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_SNUFIT_SHOOT = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4D, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_SKEETER_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4E, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_WALKING_WATER = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x4F, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_BIRD_CHIRP3 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x51, 0x40, 0)\n" +"SOUND_OBJ_PIRANHA_PLANT_APPEAR = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x54, 0x20, SOUND_DISCRETE)\n" +"SOUND_OBJ_FLAME_BLOWN = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x55, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ_MAD_PIANO_CHOMPING = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x56, 0x40, SOUND_VIBRATO | SOUND_DISCRETE)\n" +"SOUND_OBJ_BOBOMB_BUDDY_TALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x58, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_SPINY_UNK59 = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x59, 0x10, SOUND_DISCRETE)\n" +"SOUND_OBJ_WIGGLER_HIGH_PITCH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x5C, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_HEAVEHO_TOSSED = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x5D, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_WIGGLER_DEATH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x5E, 0x00, 0)\n" +"SOUND_OBJ_BOWSER_INTRO_LAUGH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x5F, 0x80, SOUND_LOWER_BACKGROUND_MUSIC | SOUND_DISCRETE)\n" +"SOUND_OBJ_ENEMY_DEATH_HIGH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x60, 0xB0, SOUND_DISCRETE)\n" +"SOUND_OBJ_ENEMY_DEATH_LOW = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x61, 0xB0, SOUND_DISCRETE)\n" +"SOUND_OBJ_SWOOP_DEATH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x62, 0xB0, SOUND_DISCRETE)\n" +"SOUND_OBJ_KOOPA_FLYGUY_DEATH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x63, 0xB0, SOUND_DISCRETE)\n" +"SOUND_OBJ_POKEY_DEATH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x63, 0xC0, SOUND_DISCRETE)\n" +"SOUND_OBJ_SNOWMAN_BOUNCE = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x64, 0xC0, SOUND_DISCRETE)\n" +"SOUND_OBJ_SNOWMAN_EXPLODE = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x65, 0xD0, SOUND_DISCRETE)\n" +"SOUND_OBJ_POUNDING_LOUD = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x68, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_MIPS_RABBIT = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6A, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_MIPS_RABBIT_WATER = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6C, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_EYEROK_EXPLODE = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6D, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_CHUCKYA_DEATH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6E, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_OBJ_WIGGLER_TALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x6F, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ_WIGGLER_ATTACKED = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x70, 0x60, SOUND_DISCRETE)\n" +"SOUND_OBJ_WIGGLER_LOW_PITCH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x71, 0x20, SOUND_DISCRETE)\n" +"SOUND_OBJ_SNUFIT_SKEETER_DEATH = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x72, 0xC0, SOUND_DISCRETE)\n" +"SOUND_OBJ_BUBBA_CHOMP = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x73, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ_ENEMY_DEFEAT_SHRINK = SOUND_ARG_LOAD(SOUND_BANK_OBJ, 0x74, 0x40, SOUND_DISCRETE)\n" +"SOUND_AIR_BOWSER_SPIT_FIRE = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x00, 0x00, 0)\n" +"SOUND_AIR_UNK01 = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x01, 0x00, 0)\n" +"SOUND_AIR_LAKITU_FLY = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x02, 0x80, 0)\n" +"SOUND_AIR_LAKITU_FLY_HIGHPRIO = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x02, 0xFF, 0)\n" +"SOUND_AIR_AMP_BUZZ = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x03, 0x40, 0)\n" +"SOUND_AIR_BLOW_FIRE = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x04, 0x80, 0)\n" +"SOUND_AIR_BLOW_WIND = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x04, 0x40, 0)\n" +"SOUND_AIR_ROUGH_SLIDE = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x05, 0x00, 0)\n" +"SOUND_AIR_HEAVEHO_MOVE = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x06, 0x40, 0)\n" +"SOUND_AIR_UNK07 = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x07, 0x00, 0)\n" +"SOUND_AIR_BOBOMB_LIT_FUSE = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x08, 0x60, 0)\n" +"SOUND_AIR_HOWLING_WIND = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x09, 0x80, 0)\n" +"SOUND_AIR_CHUCKYA_MOVE = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x0A, 0x40, 0)\n" +"SOUND_AIR_PEACH_TWINKLE = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x0B, 0x40, 0)\n" +"SOUND_AIR_CASTLE_OUTDOORS_AMBIENT = SOUND_ARG_LOAD(SOUND_BANK_AIR, 0x10, 0x40, 0)\n" +"SOUND_MENU_CHANGE_SELECT = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x00, 0xF8, SOUND_DISCRETE)\n" +"SOUND_MENU_REVERSE_PAUSE = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x01, 0x00, 0)\n" +"SOUND_MENU_PAUSE = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x02, 0xF0, SOUND_DISCRETE)\n" +"SOUND_MENU_PAUSE_HIGHPRIO = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x02, 0xFF, SOUND_DISCRETE)\n" +"SOUND_MENU_PAUSE_2 = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x03, 0xFF, SOUND_DISCRETE)\n" +"SOUND_MENU_MESSAGE_APPEAR = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x04, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_MESSAGE_DISAPPEAR = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x05, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_CAMERA_ZOOM_IN = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x06, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_CAMERA_ZOOM_OUT = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x07, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_PINCH_MARIO_FACE = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x08, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_LET_GO_MARIO_FACE = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x09, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_HAND_APPEAR = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0A, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_HAND_DISAPPEAR = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0B, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_UNK0C = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0C, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_POWER_METER = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0D, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_CAMERA_BUZZ = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0E, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_CAMERA_TURN = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x0F, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_UNK10 = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x10, 0x00, 0)\n" +"SOUND_MENU_CLICK_FILE_SELECT = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x11, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_MESSAGE_NEXT_PAGE = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x13, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_COIN_ITS_A_ME_MARIO = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x14, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_YOSHI_GAIN_LIVES = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x15, 0x00, SOUND_DISCRETE)\n" +"SOUND_MENU_ENTER_PIPE = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x16, 0xA0, SOUND_DISCRETE)\n" +"SOUND_MENU_EXIT_PIPE = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x17, 0xA0, SOUND_DISCRETE)\n" +"SOUND_MENU_BOWSER_LAUGH = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x18, 0x80, SOUND_DISCRETE)\n" +"SOUND_MENU_ENTER_HOLE = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x19, 0x80, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_MENU_CLICK_CHANGE_VIEW = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1A, 0x80, SOUND_DISCRETE)\n" +"SOUND_MENU_CAMERA_UNUSED1 = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1B, 0x00, 0)\n" +"SOUND_MENU_CAMERA_UNUSED2 = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1C, 0x00, 0)\n" +"SOUND_MENU_MARIO_CASTLE_WARP = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1D, 0xB0, SOUND_DISCRETE)\n" +"SOUND_MENU_STAR_SOUND = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1E, 0xFF, SOUND_DISCRETE)\n" +"SOUND_MENU_THANK_YOU_PLAYING_MY_GAME = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x1F, 0xFF, SOUND_DISCRETE)\n" +"SOUND_MENU_READ_A_SIGN = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x20, 0x00, 0)\n" +"SOUND_MENU_EXIT_A_SIGN = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x21, 0x00, 0)\n" +"SOUND_MENU_MARIO_CASTLE_WARP2 = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x22, 0x20, SOUND_DISCRETE)\n" +"SOUND_MENU_STAR_SOUND_OKEY_DOKEY = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x23, 0xFF, SOUND_DISCRETE)\n" +"SOUND_MENU_STAR_SOUND_LETS_A_GO = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x24, 0xFF, SOUND_DISCRETE)\n" +"SOUND_MENU_COLLECT_RED_COIN = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x28, 0x90, SOUND_CONSTANT_FREQUENCY | SOUND_DISCRETE)\n" +"SOUND_MENU_COLLECT_SECRET = SOUND_ARG_LOAD(SOUND_BANK_MENU, 0x30, 0x20, SOUND_DISCRETE)\n" +"SOUND_GENERAL2_BOBOMB_EXPLOSION = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x2E, 0x20, SOUND_DISCRETE)\n" +"SOUND_GENERAL2_PURPLE_SWITCH = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x3E, 0xC0, SOUND_DISCRETE)\n" +"SOUND_GENERAL2_ROTATING_BLOCK_CLICK = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x40, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL2_SPINDEL_ROLL = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x48, 0x20, SOUND_DISCRETE)\n" +"SOUND_GENERAL2_PYRAMID_TOP_SPIN = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x4B, 0xE0, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL2_PYRAMID_TOP_EXPLOSION = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x4C, 0xF0, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_GENERAL2_BIRD_CHIRP2 = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x50, 0x40, 0)\n" +"SOUND_GENERAL2_SWITCH_TICK_FAST = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x54, 0xF0, SOUND_LOWER_BACKGROUND_MUSIC)\n" +"SOUND_GENERAL2_SWITCH_TICK_SLOW = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x55, 0xF0, SOUND_LOWER_BACKGROUND_MUSIC)\n" +"SOUND_GENERAL2_STAR_APPEARS = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x57, 0xFF, SOUND_LOWER_BACKGROUND_MUSIC | SOUND_DISCRETE)\n" +"SOUND_GENERAL2_ROTATING_BLOCK_ALERT = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x59, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL2_BOWSER_EXPLODE = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x60, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL2_BOWSER_KEY = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x61, 0x00, SOUND_DISCRETE)\n" +"SOUND_GENERAL2_1UP_APPEAR = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x63, 0xD0, SOUND_DISCRETE)\n" +"SOUND_GENERAL2_RIGHT_ANSWER = SOUND_ARG_LOAD(SOUND_BANK_GENERAL2, 0x6A, 0xA0, SOUND_DISCRETE)\n" +"SOUND_OBJ2_BOWSER_ROAR = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x04, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ2_PIRANHA_PLANT_BITE = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x10, 0x50, SOUND_DISCRETE)\n" +"SOUND_OBJ2_PIRANHA_PLANT_DYING = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x11, 0x60, SOUND_DISCRETE)\n" +"SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x19, 0x20, SOUND_DISCRETE)\n" +"SOUND_OBJ2_BULLY_ATTACKED = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x1C, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ2_KING_BOBOMB_DAMAGE = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x42, 0x40, SOUND_NO_VOLUME_LOSS | SOUND_DISCRETE)\n" +"SOUND_OBJ2_SCUTTLEBUG_WALK = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x43, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ2_SCUTTLEBUG_ALERT = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x44, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ2_BABY_PENGUIN_YELL = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x45, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ2_SWOOP = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x49, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ2_BIRD_CHIRP1 = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x52, 0x40, 0)\n" +"SOUND_OBJ2_LARGE_BULLY_ATTACKED = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x57, 0x00, SOUND_DISCRETE)\n" +"SOUND_OBJ2_EYEROK_SOUND_SHORT = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x5A, 0x00, SOUND_NO_VOLUME_LOSS | SOUND_VIBRATO | SOUND_DISCRETE)\n" +"SOUND_OBJ2_WHOMP_SOUND_SHORT = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x5A, 0xC0, SOUND_NO_VOLUME_LOSS | SOUND_VIBRATO | SOUND_DISCRETE)\n" +"SOUND_OBJ2_EYEROK_SOUND_LONG = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x5B, 0x00, SOUND_VIBRATO | SOUND_DISCRETE)\n" +"SOUND_OBJ2_BOWSER_TELEPORT = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x66, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ2_MONTY_MOLE_APPEAR = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x67, 0x80, SOUND_DISCRETE)\n" +"SOUND_OBJ2_BOSS_DIALOG_GRUNT = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x69, 0x40, SOUND_DISCRETE)\n" +"SOUND_OBJ2_MRI_SPINNING = SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x6B, 0x00, SOUND_DISCRETE)\n" "SPTASK_STATE_NOT_STARTED = 0\n" "SPTASK_STATE_RUNNING = 1\n" "SPTASK_STATE_INTERRUPTED = 2\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 83076eda..b18e3ec0 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -419,10 +419,10 @@ int smlua_func_fade_volume_scale(lua_State* L) { if (!gSmLuaConvertSuccess) { return 0; } u8 targetScale = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { return 0; } - u16 fadeTimer = smlua_to_integer(L, 3); + u16 fadeDuration = smlua_to_integer(L, 3); if (!gSmLuaConvertSuccess) { return 0; } - fade_volume_scale(player, targetScale, fadeTimer); + fade_volume_scale(player, targetScale, fadeDuration); return 1; } @@ -596,28 +596,43 @@ int smlua_func_play_toads_jingle(UNUSED lua_State* L) { return 1; } -int smlua_func_sequence_player_fade_out(lua_State* L) { +int smlua_func_seq_player_fade_out(lua_State* L) { if(!smlua_functions_valid_param_count(L, 2)) { return 0; } u8 player = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { return 0; } - u16 fadeTimer = smlua_to_integer(L, 2); + u16 fadeDuration = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { return 0; } - sequence_player_fade_out(player, fadeTimer); + seq_player_fade_out(player, fadeDuration); return 1; } -int smlua_func_sequence_player_unlower(lua_State* L) { +int smlua_func_seq_player_lower_volume(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + u8 player = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + u16 fadeDuration = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + u8 percentage = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + seq_player_lower_volume(player, fadeDuration, percentage); + + return 1; +} + +int smlua_func_seq_player_unlower_volume(lua_State* L) { if(!smlua_functions_valid_param_count(L, 2)) { return 0; } u8 player = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { return 0; } - u16 fadeTimer = smlua_to_integer(L, 2); + u16 fadeDuration = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { return 0; } - sequence_player_unlower(player, fadeTimer); + seq_player_unlower_volume(player, fadeDuration); return 1; } @@ -3263,7 +3278,7 @@ int smlua_func_is_point_close_to_object(lua_State* L) { s32 dist = smlua_to_integer(L, 5); if (!gSmLuaConvertSuccess) { return 0; } - extern s32 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist); + extern s8 is_point_close_to_object(struct Object *obj, f32 x, f32 y, f32 z, s32 dist); lua_pushinteger(L, is_point_close_to_object(obj, x, y, z, dist)); return 1; @@ -3281,7 +3296,7 @@ int smlua_func_is_point_within_radius_of_mario(lua_State* L) { s32 dist = smlua_to_integer(L, 4); if (!gSmLuaConvertSuccess) { return 0; } - extern s32 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist); + extern s8 is_point_within_radius_of_mario(f32 x, f32 y, f32 z, s32 dist); lua_pushinteger(L, is_point_within_radius_of_mario(x, y, z, dist)); return 1; @@ -3335,7 +3350,7 @@ int smlua_func_obj_check_if_facing_toward_angle(lua_State* L) { s16 range = smlua_to_integer(L, 3); if (!gSmLuaConvertSuccess) { return 0; } - extern s32 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range); + extern s8 obj_check_if_facing_toward_angle(u32 base, u32 goal, s16 range); lua_pushinteger(L, obj_check_if_facing_toward_angle(base, goal, range)); return 1; @@ -3355,7 +3370,7 @@ int smlua_func_obj_find_wall(lua_State* L) { f32 objVelZ = smlua_to_number(L, 5); if (!gSmLuaConvertSuccess) { return 0; } - extern s32 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ); + extern s8 obj_find_wall(f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ); lua_pushinteger(L, obj_find_wall(objNewX, objY, objNewZ, objVelX, objVelZ)); return 1; @@ -3381,7 +3396,7 @@ int smlua_func_obj_find_wall_displacement(lua_State* L) { f32 radius = smlua_to_number(L, 5); if (!gSmLuaConvertSuccess) { return 0; } - extern s32 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius); + extern s8 obj_find_wall_displacement(Vec3f dist, f32 x, f32 y, f32 z, f32 radius); lua_pushinteger(L, obj_find_wall_displacement(dist, x, y, z, radius)); smlua_push_number_field(1, "x", dist[0]); @@ -3399,7 +3414,7 @@ int smlua_func_obj_flicker_and_disappear(lua_State* L) { s16 lifeSpan = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { return 0; } - extern s32 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan); + extern s8 obj_flicker_and_disappear(struct Object *obj, s16 lifeSpan); lua_pushinteger(L, obj_flicker_and_disappear(obj, lifeSpan)); return 1; @@ -3409,7 +3424,7 @@ int smlua_func_obj_lava_death(UNUSED lua_State* L) { if(!smlua_functions_valid_param_count(L, 0)) { return 0; } - extern s32 obj_lava_death(void); + extern s8 obj_lava_death(void); lua_pushinteger(L, obj_lava_death()); return 1; @@ -3479,7 +3494,7 @@ int smlua_func_obj_return_home_if_safe(lua_State* L) { s32 dist = smlua_to_integer(L, 5); if (!gSmLuaConvertSuccess) { return 0; } - extern s32 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist); + extern s8 obj_return_home_if_safe(struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist); lua_pushinteger(L, obj_return_home_if_safe(obj, homeX, y, homeZ, dist)); return 1; @@ -3597,7 +3612,7 @@ int smlua_func_turn_obj_away_from_steep_floor(lua_State* L) { f32 objVelZ = smlua_to_number(L, 4); if (!gSmLuaConvertSuccess) { return 0; } - extern s32 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ); + extern s8 turn_obj_away_from_steep_floor(struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ); lua_pushinteger(L, turn_obj_away_from_steep_floor(objFloor, floorY, objVelX, objVelZ)); return 1; @@ -7169,6 +7184,56 @@ int smlua_func_stub_obj_helpers_4(UNUSED lua_State* L) { return 1; } + /////////////////// + // rumble_init.c // +/////////////////// + +int smlua_func_queue_rumble_data(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + + s16 a0 = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { return 0; } + s16 a1 = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + + extern void queue_rumble_data(s16 a0, s16 a1); + queue_rumble_data(a0, a1); + + return 1; +} + +int smlua_func_queue_rumble_data_mario(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + s16 a0 = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + s16 a1 = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + extern void queue_rumble_data_mario(struct MarioState* m, s16 a0, s16 a1); + queue_rumble_data_mario(m, a0, a1); + + return 1; +} + +int smlua_func_queue_rumble_data_object(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + struct Object* object = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); + if (!gSmLuaConvertSuccess) { return 0; } + s16 a0 = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { return 0; } + s16 a1 = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + extern void queue_rumble_data_object(struct Object* object, s16 a0, s16 a1); + queue_rumble_data_object(object, a0, a1); + + return 1; +} + ///////////////// // save_file.h // ///////////////// @@ -8065,56 +8130,6 @@ int smlua_func_load_object_collision_model(UNUSED lua_State* L) { return 1; } - /////////////// - // thread6.c // -/////////////// - -int smlua_func_queue_rumble_data(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 2)) { return 0; } - - s16 a0 = smlua_to_integer(L, 1); - if (!gSmLuaConvertSuccess) { return 0; } - s16 a1 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { return 0; } - - extern void queue_rumble_data(s16 a0, s16 a1); - queue_rumble_data(a0, a1); - - return 1; -} - -int smlua_func_queue_rumble_data_mario(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } - - struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); - if (!gSmLuaConvertSuccess) { return 0; } - s16 a0 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { return 0; } - s16 a1 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { return 0; } - - extern void queue_rumble_data_mario(struct MarioState* m, s16 a0, s16 a1); - queue_rumble_data_mario(m, a0, a1); - - return 1; -} - -int smlua_func_queue_rumble_data_object(lua_State* L) { - if(!smlua_functions_valid_param_count(L, 3)) { return 0; } - - struct Object* object = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT); - if (!gSmLuaConvertSuccess) { return 0; } - s16 a0 = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { return 0; } - s16 a1 = smlua_to_integer(L, 3); - if (!gSmLuaConvertSuccess) { return 0; } - - extern void queue_rumble_data_object(struct Object* object, s16 a0, s16 a1); - queue_rumble_data_object(object, a0, a1); - - return 1; -} - void smlua_bind_functions_autogen(void) { @@ -8174,8 +8189,9 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "play_sound_with_freq_scale", smlua_func_play_sound_with_freq_scale); smlua_bind_function(L, "play_star_fanfare", smlua_func_play_star_fanfare); smlua_bind_function(L, "play_toads_jingle", smlua_func_play_toads_jingle); - smlua_bind_function(L, "sequence_player_fade_out", smlua_func_sequence_player_fade_out); - smlua_bind_function(L, "sequence_player_unlower", smlua_func_sequence_player_unlower); + smlua_bind_function(L, "seq_player_fade_out", smlua_func_seq_player_fade_out); + smlua_bind_function(L, "seq_player_lower_volume", smlua_func_seq_player_lower_volume); + smlua_bind_function(L, "seq_player_unlower_volume", smlua_func_seq_player_unlower_volume); // interaction.h smlua_bind_function(L, "does_mario_have_normal_cap_on_head", smlua_func_does_mario_have_normal_cap_on_head); @@ -8688,6 +8704,11 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "stub_obj_helpers_3", smlua_func_stub_obj_helpers_3); smlua_bind_function(L, "stub_obj_helpers_4", smlua_func_stub_obj_helpers_4); + // rumble_init.c + smlua_bind_function(L, "queue_rumble_data", smlua_func_queue_rumble_data); + smlua_bind_function(L, "queue_rumble_data_mario", smlua_func_queue_rumble_data_mario); + smlua_bind_function(L, "queue_rumble_data_object", smlua_func_queue_rumble_data_object); + // save_file.h smlua_bind_function(L, "save_file_get_cap_pos", smlua_func_save_file_get_cap_pos); smlua_bind_function(L, "save_file_get_course_coin_score", smlua_func_save_file_get_course_coin_score); @@ -8771,9 +8792,4 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "load_area_terrain", smlua_func_load_area_terrain); smlua_bind_function(L, "load_object_collision_model", smlua_func_load_object_collision_model); - // thread6.c - smlua_bind_function(L, "queue_rumble_data", smlua_func_queue_rumble_data); - smlua_bind_function(L, "queue_rumble_data_mario", smlua_func_queue_rumble_data_mario); - smlua_bind_function(L, "queue_rumble_data_object", smlua_func_queue_rumble_data_object); - } diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index fc0833b2..c181d5ab 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -40,7 +40,7 @@ #include "game/game_init.h" #include "game/main.h" -#include "game/thread6.h" +#include "game/rumble_init.h" #ifdef DISCORDRPC #include "pc/discord/discordrpc.h" @@ -61,8 +61,7 @@ s8 gShowProfiler; s8 gShowDebugText; s32 gRumblePakPfs; -struct RumbleData gRumbleDataQueue[3]; -struct StructSH8031D9B0 gCurrRumbleSettings; +u32 gNumVblanks = 0; static struct AudioAPI *audio_api; struct GfxWindowManagerAPI *wm_api; diff --git a/text/jp/dialogs.h b/text/jp/dialogs.h index a190ab54..014cb931 100644 --- a/text/jp/dialogs.h +++ b/text/jp/dialogs.h @@ -1,5 +1,21 @@ // Parameters: dialog enum ID, (unused), lines per box, left offset, width +#ifdef VERSION_JP +#define HOW_TO_READ_SIGNS_1 "\ +カンバンを よむときも\n\ +たちどまって Bボタン!\n\ +AかBボタンですすめる!\n\ +まえにたつだけで はなし\n\ +かける、どうぶつもいます。" +#else +#define HOW_TO_READ_SIGNS_1 "\ +カンバンは まえにたって\n\ +AかBボタンでよめます。\n\ +まえにたつだけで はなし\n\ +かけてくれる どうぶつも\n\ +います。" +#endif + DEFINE_DIALOG(DIALOG_000, 1, 5, 30, 200, _("\ おおっと、ここはキケンな\n\ せんじょうの どまんなか。\n\ @@ -10,12 +26,8 @@ DEFINE_DIALOG(DIALOG_000, 1, 5, 30, 200, _("\ はなしかけてみるといい!\n\ Bボタンではなしができる。\n\ きっと、ちからになって\n\ -くれるはずだ。\n\ -カンバンを よむときも\n\ -たちどまって Bボタン!\n\ -AかBボタンですすめる!\n\ -まえにたつだけで はなし\n\ -かける、どうぶつもいます。")) +くれるはずだ。\n"\ +HOW_TO_READ_SIGNS_1)) DEFINE_DIALOG(DIALOG_001, 1, 4, 95, 200, _("\ あぶない あぶない!!\n\ @@ -1077,9 +1089,15 @@ DEFINE_DIALOG(DIALOG_094, 1, 3, 30, 200, _("\ はしりながら Zボタンで\n\ しゃがんで ジャンプだ!")) +#ifdef VERSION_JP +#define HOW_TO_READ_SIGNS_2 " Bボタンをおすと" +#else +#define HOW_TO_READ_SIGNS_2 "AかBボタンをおし" +#endif + DEFINE_DIALOG(DIALOG_095, 1, 3, 30, 200, _("\ このように カンバンの\n\ -まえで Bボタンをおすと\n\ +まえで" HOW_TO_READ_SIGNS_2 "\n\ よむことができます。\n\ ノコノコや どうぶつたち\n\ と はなすときは、まえに\n\ @@ -1863,15 +1881,32 @@ DEFINE_DIALOG(DIALOG_166, 1, 6, 30, 200, _("\ くるといいッス!\n\        ノコノコ")) -DEFINE_DIALOG(DIALOG_167, 1, 4, 30, 200, _("\ -『ピーチの おしろ』\n\ -     すぐそこ\n\ -Aボタン『ジャンプ』\n\ -Zボタン『しゃがむ』\n\ +#ifdef VERSION_JP +#define A_BUTTON_ACT "\ +Aボタン『ジャンプ』\n" +#define B_BUTTON_ACT "\ Bボタン『カンバンよむ』\n\     『パンチ』\n\     『ものをもつ』\n\ -もういちどおす『なげる』")) +もういちどおす『なげる』" +#else +#define A_BUTTON_ACT "\ +Aボタン『ジャンプ』\n\ +    『カンバンよむ』\n" +#define B_BUTTON_ACT "\ +Bボタン『パンチ』\n\ +    『カンバンよむ』\n\ +    『ものをもつ』\n\ + もういちどおすと\n\ +    『なげる』" +#endif + +DEFINE_DIALOG(DIALOG_167, 1, 4, 30, 200, _("\ +『ピーチの おしろ』\n\ +     すぐそこ\n"\ +A_BUTTON_ACT \ +"Zボタン『しゃがむ』\n"\ +B_BUTTON_ACT)) DEFINE_DIALOG(DIALOG_168, 1, 4, 30, 200, _("\ アーン、またまた \n\ diff --git a/tools/Makefile b/tools/Makefile index 7bec0619..469a0191 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,8 +1,16 @@ -CC := gcc -CXX := g++ -CFLAGS := -I../include -I. -Wall -Wextra -Wno-unused-parameter -Wno-error=implicit-function-declaration -pedantic -std=c99 -O2 -s -LDFLAGS := -lm -PROGRAMS := n64graphics n64graphics_ci mio0 n64cksum textconv patch_libultra_math aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv +include ../util.mk + +HOST_ENV := $(shell uname 2>/dev/null || echo Unknown) +HOST_ENV := $(patsubst MINGW%,MinGW,$(HOST_ENV)) + +CC := gcc +CXX := g++ +CFLAGS := -I../include -I. -Wall -Wextra -Wno-unused-parameter -Wno-error=implicit-function-declaration -pedantic -std=c99 -O2 -s +LDFLAGS := -lm +ALL_PROGRAMS := n64graphics n64graphics_ci mio0 n64cksum textconv patch_libultra_math aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv +LIBAUDIOFILE := audiofile/libaudiofile.a + +BUILD_PROGRAMS := $(ALL_PROGRAMS) default: all @@ -12,45 +20,47 @@ n64graphics_CFLAGS := -DN64GRAPHICS_STANDALONE n64graphics_ci_SOURCES := n64graphics_ci_dir/n64graphics_ci.c n64graphics_ci_dir/exoquant/exoquant.c n64graphics_ci_dir/utils.c mio0_SOURCES := libmio0.c -mio0_CFLAGS := -DMIO0_STANDALONE +mio0_CFLAGS := -DMIO0_STANDALONE n64cksum_SOURCES := n64cksum.c utils.c -n64cksum_CFLAGS := -DN64CKSUM_STANDALONE +n64cksum_CFLAGS := -DN64CKSUM_STANDALONE textconv_SOURCES := textconv.c utf8.c hashtable.c + patch_libultra_math_SOURCES := patch_libultra_math.c aifc_decode_SOURCES := aifc_decode.c aiff_extract_codebook_SOURCES := aiff_extract_codebook.c +tabledesign: $(LIBAUDIOFILE) tabledesign_SOURCES := sdk-tools/tabledesign/codebook.c sdk-tools/tabledesign/estimate.c sdk-tools/tabledesign/print.c sdk-tools/tabledesign/tabledesign.c -tabledesign_CFLAGS := -Iaudiofile -Wno-uninitialized -tabledesign_LDFLAGS := -Laudiofile -laudiofile -lstdc++ -lm +tabledesign_CFLAGS := -Iaudiofile -Wno-uninitialized +tabledesign_LDFLAGS := -Laudiofile -laudiofile -lstdc++ vadpcm_enc_SOURCES := sdk-tools/adpcm/vadpcm_enc.c sdk-tools/adpcm/vpredictor.c sdk-tools/adpcm/quant.c sdk-tools/adpcm/util.c sdk-tools/adpcm/vencode.c -vadpcm_enc_CFLAGS := -Wno-unused-result -Wno-uninitialized -Wno-sign-compare -Wno-absolute-value +vadpcm_enc_CFLAGS := -Wno-unused-result -Wno-uninitialized -Wno-sign-compare -Wno-absolute-value extract_data_for_mio_SOURCES := extract_data_for_mio.c skyconv_SOURCES := skyconv.c n64graphics.c utils.c -LIBAUDIOFILE := audiofile/libaudiofile.a +all-except-recomp: $(LIBAUDIOFILE) $(BUILD_PROGRAMS) -$(LIBAUDIOFILE): - @$(MAKE) -C audiofile - -all: $(LIBAUDIOFILE) $(PROGRAMS) $(CXX_PROGRAMS) +all: all-except-recomp clean: - $(RM) $(PROGRAMS) $(CXX_PROGRAMS) + $(RM) $(ALL_PROGRAMS) $(MAKE) -C audiofile clean define COMPILE $(1): $($1_SOURCES) - $(CC) $(CFLAGS) $($1_CFLAGS) $$^ -o $$@ $(LDFLAGS) $($1_LDFLAGS) + $$(CC) $(CFLAGS) $($1_CFLAGS) $$^ -o $$@ $($1_LDFLAGS) $(LDFLAGS) endef -$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p)))) +$(foreach p,$(BUILD_PROGRAMS),$(eval $(call COMPILE,$(p)))) -.PHONY: all clean default +$(LIBAUDIOFILE): + @$(MAKE) -C audiofile + +.PHONY: all all-except-recomp clean default diff --git a/tools/asm_processor/asm-processor.py b/tools/asm_processor/asm-processor.py index 04b94316..ea18c384 100644 --- a/tools/asm_processor/asm-processor.py +++ b/tools/asm_processor/asm-processor.py @@ -185,7 +185,7 @@ class Section: if self.sh_entsize != 0: assert self.sh_size % self.sh_entsize == 0 if self.sh_type == SHT_NOBITS: - self.data = '' + self.data = b'' else: self.data = data[self.sh_offset:self.sh_offset + self.sh_size] self.index = index @@ -466,6 +466,9 @@ class GlobalAsmBlock: self.fail(".ascii with no string", real_line) return ret + num_parts if z else ret + def align2(self): + while self.fn_section_sizes[self.cur_section] % 2 != 0: + self.fn_section_sizes[self.cur_section] += 1 def align4(self): while self.fn_section_sizes[self.cur_section] % 4 != 0: @@ -553,6 +556,9 @@ class GlobalAsmBlock: self.add_sized(self.count_quoted_size(line, z, real_line, output_enc), real_line) elif line.startswith('.byte'): self.add_sized(len(line.split(',')), real_line) + elif line.startswith('.half'): + self.align2() + self.add_sized(2*len(line.split(',')), real_line) elif line.startswith('.'): # .macro, ... self.fail("asm directive not supported", real_line) @@ -778,7 +784,7 @@ def parse_source(f, opt, framepointer, input_enc, output_enc, print_source=None) output_lines[-1] = ''.join(src) asm_functions.append(fn) global_asm = None - elif ((line.startswith('#include "')) and line.endswith('" EARLY')): + elif line.startswith('#include "') and line.endswith('" EARLY'): # C includes qualified with EARLY (i.e. #include "file.c" EARLY) will be # processed recursively when encountered fpath = os.path.dirname(f.name) @@ -1095,7 +1101,7 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc): except: pass -def run_wrapped(argv, outfile): +def run_wrapped(argv, outfile, functions): parser = argparse.ArgumentParser(description="Pre-process .c files and post-process .o files to enable embedding assembly into C.") parser.add_argument('filename', help="path to .c code") parser.add_argument('--post-process', dest='objfile', help="path to .o file to post-process") @@ -1118,12 +1124,13 @@ def run_wrapped(argv, outfile): if args.objfile is None: with open(args.filename, encoding=args.input_enc) as f: - parse_source(f, opt=opt, framepointer=args.framepointer, input_enc=args.input_enc, output_enc=args.output_enc, print_source=outfile) + return parse_source(f, opt=opt, framepointer=args.framepointer, input_enc=args.input_enc, output_enc=args.output_enc, print_source=outfile) else: if args.assembler is None: raise Failure("must pass assembler command") - with open(args.filename, encoding=args.input_enc) as f: - functions = parse_source(f, opt=opt, framepointer=args.framepointer, input_enc=args.input_enc, output_enc=args.output_enc) + if functions is None: + with open(args.filename, encoding=args.input_enc) as f: + functions = parse_source(f, opt=opt, framepointer=args.framepointer, input_enc=args.input_enc, output_enc=args.output_enc) if not functions: return asm_prelude = b'' @@ -1132,9 +1139,9 @@ def run_wrapped(argv, outfile): asm_prelude = f.read() fixup_objfile(args.objfile, functions, asm_prelude, args.assembler, args.output_enc) -def run(argv, outfile=sys.stdout.buffer): +def run(argv, outfile=sys.stdout.buffer, functions=None): try: - run_wrapped(argv, outfile) + return run_wrapped(argv, outfile, functions) except Failure as e: print("Error:", e, file=sys.stderr) sys.exit(1) diff --git a/tools/asm_processor/build.py b/tools/asm_processor/build.py index 04a93e4c..228dcb03 100644 --- a/tools/asm_processor/build.py +++ b/tools/asm_processor/build.py @@ -27,7 +27,7 @@ del compile_args[out_ind + 1] del compile_args[out_ind] in_dir = os.path.split(os.path.realpath(in_file))[0] -opt_flags = [x for x in compile_args if x in ['-g', '-O2', '-framepointer']] +opt_flags = [x for x in compile_args if x in ['-g', '-O2', '-O1', '-framepointer']] preprocessed_file = tempfile.NamedTemporaryFile(prefix='preprocessed', suffix='.c') diff --git a/tools/assemble_sound.py b/tools/assemble_sound.py index 6e81af4f..9c6598f1 100755 --- a/tools/assemble_sound.py +++ b/tools/assemble_sound.py @@ -9,6 +9,7 @@ import sys TYPE_CTL = 1 TYPE_TBL = 2 +TYPE_SEQ = 3 STACK_TRACES = False DUMP_INDIVIDUAL_BINS = False @@ -34,6 +35,7 @@ class SampleBank: def __init__(self, name, entries): self.name = name self.uses = [] + self.index = None self.entries = entries self.name_to_entry = {} for e in entries: @@ -70,9 +72,9 @@ def strip_comments(string): def pack(fmt, *args): if WORD_BYTES == 4: - fmt = fmt.replace('P', 'I').replace('X', '') + fmt = fmt.replace("P", "I").replace("X", "") else: - fmt = fmt.replace('P', 'Q').replace('X', 'xxxx') + fmt = fmt.replace("P", "Q").replace("X", "xxxx") return struct.pack(ENDIAN_MARKER + fmt, *args) @@ -131,7 +133,7 @@ def parse_aifc(data, name, fname): sections = [] while i < len(data): tp = data[i : i + 4] - le, = struct.unpack(">I", data[i + 4 : i + 8]) + (le,) = struct.unpack(">I", data[i + 4 : i + 8]) i += 8 sections.append((tp, data[i : i + le])) i = align(i + le, 2) @@ -307,7 +309,7 @@ def normalize_sound_json(json): fixup.append((inst, "sound")) fixup.append((inst, "sound_hi")) for (obj, key) in fixup: - if isinstance(obj, dict) and isinstance(obj.get(key, None), str): + if isinstance(obj, dict) and isinstance(obj.get(key), str): obj[key] = {"sample": obj[key]} @@ -449,15 +451,30 @@ def validate_bank(json, sample_bank): validate(inst in seen_instruments, "unreferenced instrument " + inst) +def apply_ifs(json, defines): + if isinstance(json, dict) and "ifdef" in json and "then" in json and "else" in json: + validate_json_format(json, {"ifdef": list}) + true = any(d in defines for d in json["ifdef"]) + return apply_ifs(json["then"] if true else json["else"], defines) + elif isinstance(json, list): + for i in range(len(json)): + json[i] = apply_ifs(json[i], defines) + elif isinstance(json, dict): + for key in json: + json[key] = apply_ifs(json[key], defines) + return json + + def apply_version_diffs(json, defines): - if "VERSION_EU" in defines and isinstance(json.get("date", None), str): - json["date"] = json["date"].replace("1996-03-19", "1996-06-24") + date_str = json.get("date") + if "VERSION_EU" in defines and isinstance(date_str, str): + json["date"] = date_str.replace("1996-03-19", "1996-06-24") ifdef_removed = set() for key, inst in json["instruments"].items(): if ( isinstance(inst, dict) - and isinstance(inst.get("ifdef", None), list) + and isinstance(inst.get("ifdef"), list) and all(d not in defines for d in inst["ifdef"]) ): ifdef_removed.add(key) @@ -484,7 +501,7 @@ def mark_sample_bank_uses(bank): mark_used(inst["sound_hi"]["sample"]) -def serialize_ctl(bank, base_ser): +def serialize_ctl(bank, base_ser, is_shindou): json = bank.json drums = [] @@ -495,17 +512,18 @@ def serialize_ctl(bank, base_ser): else: instruments.append(inst) - y, m, d = map(int, json.get("date", "0000-00-00").split("-")) - date = y * 10000 + m * 100 + d - base_ser.add( - pack( - "IIII", - len(json["instrument_list"]), - len(drums), - 1 if len(bank.sample_bank.uses) > 1 else 0, - to_bcd(date), + if not is_shindou: + y, m, d = map(int, json.get("date", "0000-00-00").split("-")) + date = y * 10000 + m * 100 + d + base_ser.add( + pack( + "IIII", + len(json["instrument_list"]), + len(drums), + 1 if len(bank.sample_bank.uses) > 1 else 0, + to_bcd(date), + ) ) - ) ser = ReserveSerializer() if drums: @@ -538,10 +556,12 @@ def serialize_ctl(bank, base_ser): sample_len = len(aifc.data) # Sample - ser.add(pack("PP", 0, aifc.offset)) + ser.add(pack("IX", align(sample_len, 2) if is_shindou else 0)) + ser.add(pack("P", aifc.offset)) loop_addr_buf = ser.reserve(WORD_BYTES) book_addr_buf = ser.reserve(WORD_BYTES) - ser.add(pack("I", align(sample_len, 2))) + if not is_shindou: + ser.add(pack("I", align(sample_len, 2))) ser.align(16) # Book @@ -638,8 +658,12 @@ def serialize_ctl(bank, base_ser): base_ser.add(ser.finish()) + return pack( + "BBBB", bank.sample_bank.index, 0xFF, len(json["instrument_list"]), len(drums) + ) -def serialize_tbl(sample_bank, ser): + +def serialize_tbl(sample_bank, ser, is_shindou): ser.reset_garbage_pos() base_addr = ser.size for aifc in sample_bank.entries: @@ -649,32 +673,72 @@ def serialize_tbl(sample_bank, ser): aifc.offset = ser.size - base_addr ser.add(aifc.data) ser.align(2) - ser.align_garbage(16) + if is_shindou and sample_bank.index not in [4, 10]: + ser.align(16) + else: + ser.align_garbage(16) -def serialize_seqfile(entries, serialize_entry, entry_list, magic, extra_padding=True): - ser = ReserveSerializer() - ser.add(pack("HHX", magic, len(entry_list))) - table = ser.reserve(len(entry_list) * 2 * WORD_BYTES) - ser.align(16) - data_start = ser.size - - ser2 = GarbageSerializer() +def serialize_seqfile( + out_filename, + out_header_filename, + entries, + serialize_entry, + entry_list, + magic, + is_shindou, + extra_padding=True, +): + data_ser = GarbageSerializer() entry_offsets = [] entry_lens = [] + entry_meta = [] for entry in entries: - entry_offsets.append(ser2.size) - serialize_entry(entry, ser2) - entry_lens.append(ser2.size - entry_offsets[-1]) - ser.add(ser2.finish()) - if extra_padding: - ser.add(b"\0") - ser.align(64) + entry_offsets.append(data_ser.size) + ret = serialize_entry(entry, data_ser, is_shindou) + entry_meta.append(ret) + entry_lens.append(data_ser.size - entry_offsets[-1]) + data = data_ser.finish() - for ent in entry_list: - table.append(pack("P", entry_offsets[ent] + data_start)) - table.append(pack("IX", entry_lens[ent])) - return ser.finish() + if is_shindou: + ser = ReserveSerializer() + ser.add(pack("H", len(entries))) + ser.align(16) + sh_magic = 0x0204 if magic == TYPE_TBL else 0x0203 + + # Ignore entry_list and loop over all entries instead. This makes a + # difference for sample banks, where US/JP/EU doesn't use a normal + # header for sample banks but instead has a mapping from sound bank to + # sample bank offset/length. Shindou uses a normal header and makes the + # mapping part of the sound bank header instead (part of entry_meta). + for i in range(len(entries)): + ser.add(pack("PIH", entry_offsets[i], entry_lens[i], sh_magic)) + ser.add(entry_meta[i] or b"\0\0\0\0") + ser.align(16) + + if out_header_filename: + with open(out_header_filename, "wb") as f: + f.write(ser.finish()) + with open(out_filename, "wb") as f: + f.write(data) + + else: + ser = ReserveSerializer() + ser.add(pack("HHX", magic, len(entry_list))) + table = ser.reserve(len(entry_list) * 2 * WORD_BYTES) + ser.align(16) + data_start = ser.size + + ser.add(data) + if extra_padding: + ser.add(b"\0") + ser.align(64) + + for index in entry_list: + table.append(pack("P", entry_offsets[index] + data_start)) + table.append(pack("IX", entry_lens[index])) + with open(out_filename, "wb") as f: + f.write(ser.finish()) def validate_and_normalize_sequence_json(json, bank_names, defines): @@ -707,7 +771,14 @@ def validate_and_normalize_sequence_json(json, bank_names, defines): def write_sequences( - inputs, out_filename, out_bank_sets, sound_bank_dir, seq_json, defines + inputs, + out_filename, + out_header_filename, + out_bank_sets, + sound_bank_dir, + seq_json, + defines, + is_shindou, ): bank_names = sorted( [os.path.splitext(os.path.basename(x))[0] for x in os.listdir(sound_bank_dir)] @@ -767,28 +838,36 @@ def write_sequences( ) ind_to_name[ind] = key - while ind_to_name and json.get(ind_to_name[-1], None) is None: + while ind_to_name and json.get(ind_to_name[-1]) is None: ind_to_name.pop() - def serialize_file(name, ser): - if json.get(name, None) is None: + def serialize_file(name, ser, is_shindou): + if json.get(name) is None: return ser.reset_garbage_pos() with open(name_to_fname[name], "rb") as f: ser.add(f.read()) - ser.align_garbage(16) + if is_shindou and name.startswith("17"): + ser.align(16) + else: + ser.align_garbage(16) - with open(out_filename, "wb") as f: - n = range(len(ind_to_name)) - f.write(serialize_seqfile(ind_to_name, serialize_file, n, 3, False)) + serialize_seqfile( + out_filename, + out_header_filename, + ind_to_name, + serialize_file, + range(len(ind_to_name)), + TYPE_SEQ, + is_shindou, + extra_padding=False, + ) with open(out_bank_sets, "wb") as f: ser = ReserveSerializer() table = ser.reserve(len(ind_to_name) * 2) for name in ind_to_name: - bank_set = json.get(name, None) - if bank_set is None: - bank_set = [] + bank_set = json.get(name) or [] table.append(pack("H", ser.size)) ser.add(bytes([len(bank_set)])) for bank in bank_set[::-1]: @@ -799,6 +878,7 @@ def write_sequences( def main(): global STACK_TRACES + global DUMP_INDIVIDUAL_BINS global ENDIAN_MARKER global WORD_BYTES need_help = False @@ -806,6 +886,7 @@ def main(): cpp_command = None print_samples = False sequences_out_file = None + sequences_header_out_file = None defines = [] args = [] for i, a in enumerate(sys.argv[1:], 1): @@ -833,10 +914,10 @@ def main(): skip_next = 1 elif a == "--bitwidth": bitwidth = sys.argv[i + 1] - if bitwidth == 'native': - WORD_BYTES = struct.calcsize('P') + if bitwidth == "native": + WORD_BYTES = struct.calcsize("P") else: - if bitwidth not in ['32', '64']: + if bitwidth not in ["32", "64"]: fail("--bitwidth takes argument 32, 64 or native") WORD_BYTES = int(bitwidth) // 8 skip_next = 1 @@ -844,14 +925,17 @@ def main(): defines.append(a[2:]) elif a == "--stack-trace": STACK_TRACES = True + elif a == "--dump-individual-bins": + DUMP_INDIVIDUAL_BINS = True elif a == "--print-samples": print_samples = True elif a == "--sequences": sequences_out_file = sys.argv[i + 1] - bank_sets_out_file = sys.argv[i + 2] - sound_bank_dir = sys.argv[i + 3] - sequence_json = sys.argv[i + 4] - skip_next = 4 + sequences_header_out_file = sys.argv[i + 2] + bank_sets_out_file = sys.argv[i + 3] + sound_bank_dir = sys.argv[i + 4] + sequence_json = sys.argv[i + 5] + skip_next = 5 elif a.startswith("-"): print("Unrecognized option " + a) sys.exit(1) @@ -859,34 +943,42 @@ def main(): args.append(a) defines_set = {d.split("=")[0] for d in defines} + is_shindou = "VERSION_SH" in defines_set if sequences_out_file is not None and not need_help: write_sequences( args, sequences_out_file, + sequences_header_out_file, bank_sets_out_file, sound_bank_dir, sequence_json, defines_set, + is_shindou, ) sys.exit(0) - if need_help or len(args) != 4: + if need_help or len(args) != 6: print( "Usage: {} " - " " + " " + " " " [--cpp ]" " [-D ]" " [--stack-trace]" - " | --sequences " - " ".format(sys.argv[0]) + " | --sequences " + " ".format( + sys.argv[0] + ) ) sys.exit(0 if need_help else 1) sample_bank_dir = args[0] sound_bank_dir = args[1] ctl_data_out = args[2] - tbl_data_out = args[3] + ctl_data_header_out = args[3] + tbl_data_out = args[4] + tbl_data_header_out = args[5] banks = [] sample_banks = [] @@ -932,6 +1024,7 @@ def main(): data = strip_comments(data) bank_json = orderedJsonDecoder.decode(data) + bank_json = apply_ifs(bank_json, defines_set) validate_bank_toplevel(bank_json) apply_version_diffs(bank_json, defines_set) normalize_sound_json(bank_json) @@ -954,34 +1047,40 @@ def main(): sample_banks = [b for b in sample_banks if b.uses] sample_banks.sort(key=lambda b: b.uses[0].name) - sample_bank_index = {} + sample_bank_index = 0 for sample_bank in sample_banks: - sample_bank_index[sample_bank] = len(sample_bank_index) + sample_bank.index = sample_bank_index + sample_bank_index += 1 - with open(tbl_data_out, "wb") as out: - out.write( - serialize_seqfile( - sample_banks, - serialize_tbl, - [sample_bank_index[x.sample_bank] for x in banks], - TYPE_TBL, - ) - ) + serialize_seqfile( + tbl_data_out, + tbl_data_header_out, + sample_banks, + serialize_tbl, + [x.sample_bank.index for x in banks], + TYPE_TBL, + is_shindou, + ) - with open(ctl_data_out, "wb") as out: - if DUMP_INDIVIDUAL_BINS: - # Debug logic, may simplify diffing - os.makedirs("ctl/", exist_ok=True) - for b in banks: - with open("ctl/" + b.name + ".bin", "wb") as f: - ser = GarbageSerializer() - serialize_ctl(b, ser) - f.write(ser.finish()) - print("wrote to ctl/") + if DUMP_INDIVIDUAL_BINS: + # Debug logic, may simplify diffing + os.makedirs("ctl/", exist_ok=True) + for b in banks: + with open("ctl/" + b.name + ".bin", "wb") as f: + ser = GarbageSerializer() + serialize_ctl(b, ser, is_shindou) + f.write(ser.finish()) + print("wrote to ctl/") - out.write( - serialize_seqfile(banks, serialize_ctl, list(range(len(banks))), TYPE_CTL) - ) + serialize_seqfile( + ctl_data_out, + ctl_data_header_out, + banks, + serialize_ctl, + list(range(len(banks))), + TYPE_CTL, + is_shindou, + ) if print_samples: for sample_bank in sample_banks: diff --git a/tools/audiofile/Makefile b/tools/audiofile/Makefile index 5f3f3e1d..8a11925e 100644 --- a/tools/audiofile/Makefile +++ b/tools/audiofile/Makefile @@ -1,12 +1,13 @@ CXX := g++ libaudiofile.a: audiofile.o - ar rcs libaudiofile.a audiofile.o + $(AR) rcs $@ $^ audiofile.o: audiofile.cpp audiofile.h aupvlist.h - $(CXX) -std=c++11 -DNDEBUG -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -O2 -I. -c audiofile.cpp + #$(CXX) -std=c++11 -DNDEBUG -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -O2 -I. -c audiofile.cpp + $(CXX) -std=c++11 -O2 -I. -c $< -o $@ clean: - rm -f audiofile.o libaudiofile.a + $(RM) audiofile.o libaudiofile.a .PHONY: clean diff --git a/tools/audiofile/audiofile.cpp b/tools/audiofile/audiofile.cpp index 88efeddf..7cd78946 100644 --- a/tools/audiofile/audiofile.cpp +++ b/tools/audiofile/audiofile.cpp @@ -6167,7 +6167,7 @@ void PCM::runPull() AFframecount framesRead = bytesRead >= 0 ? bytesRead / m_bytesPerFrame : 0; m_track->nextfframe += framesRead; - assert(!canSeek() || (tell() == m_track->fpos_next_frame)); + //assert(!canSeek() || (tell() == m_track->fpos_next_frame)); /* If we got EOF from read, then we return the actual amount read. @@ -14637,7 +14637,7 @@ static status _afOpenFile (int access, File *f, const char *filename, filehandle->m_access = access; filehandle->m_seekok = f->canSeek(); if (filename != NULL) - filehandle->m_fileName = strdup(filename); + filehandle->m_fileName = _af_strdup(filename); else filehandle->m_fileName = NULL; filehandle->m_fileFormat = fileFormat; diff --git a/tools/disassemble_sound.py b/tools/disassemble_sound.py index 603b8e25..f73fe0d0 100755 --- a/tools/disassemble_sound.py +++ b/tools/disassemble_sound.py @@ -111,7 +111,7 @@ def parse_bcd(data): def serialize_f80(num): num = float(num) - f64, = struct.unpack(">Q", struct.pack(">d", num)) + (f64,) = struct.unpack(">Q", struct.pack(">d", num)) f64_sign_bit = f64 & 2 ** 63 if num == 0.0: if f64_sign_bit: @@ -153,7 +153,7 @@ def parse_drum(data, addr): assert loaded == 0 assert pad == 0 sound = parse_sound(data[4:12]) - env_addr, = struct.unpack(">I", data[12:]) + (env_addr,) = struct.unpack(">I", data[12:]) assert env_addr != 0 return Drum(name, addr, release_rate, pan, env_addr, sound) @@ -205,9 +205,12 @@ def parse_book(addr, bank_data): return Book(order, npredictors, table) -def parse_sample(data, bank_data, sample_bank): - zero, addr, loop, book, sample_size = struct.unpack(">IIIII", data) - assert zero == 0 +def parse_sample(data, bank_data, sample_bank, is_shindou): + if is_shindou: + sample_size, addr, loop, book = struct.unpack(">IIII", data) + else: + zero, addr, loop, book, sample_size = struct.unpack(">IIIII", data) + assert zero == 0 assert loop != 0 assert book != 0 loop = parse_loop(loop, bank_data) @@ -226,9 +229,7 @@ def parse_envelope(addr, data_bank): return entries -def parse_ctl(header, data, sample_bank, index): - name_tbl.clear() - name = "{:02X}".format(index) +def parse_ctl_header(header): num_instruments, num_drums, shared = struct.unpack(">III", header[:12]) date = parse_bcd(header[12:]) y = date // 10000 @@ -236,14 +237,21 @@ def parse_ctl(header, data, sample_bank, index): d = date % 100 iso_date = "{:02}-{:02}-{:02}".format(y, m, d) assert shared in [0, 1] + return num_instruments, num_drums, iso_date + + +def parse_ctl(parsed_header, data, sample_bank, index, is_shindou): + name_tbl.clear() + name = "{:02X}".format(index) + num_instruments, num_drums, iso_date = parsed_header # print("{}: {}, {} + {}".format(name, iso_date, num_instruments, num_drums)) - drum_base_addr, = struct.unpack(">I", data[:4]) + (drum_base_addr,) = struct.unpack(">I", data[:4]) drum_addrs = [] if num_drums != 0: assert drum_base_addr != 0 for i in range(num_drums): - drum_addr, = struct.unpack( + (drum_addr,) = struct.unpack( ">I", data[drum_base_addr + i * 4 : drum_base_addr + i * 4 + 4] ) assert drum_addr != 0 @@ -255,7 +263,7 @@ def parse_ctl(header, data, sample_bank, index): inst_addrs = [] inst_list = [] for i in range(num_instruments): - inst_addr, = struct.unpack( + (inst_addr,) = struct.unpack( ">I", data[inst_base_addr + i * 4 : inst_base_addr + i * 4 + 4] ) if inst_addr == 0: @@ -314,7 +322,9 @@ def parse_ctl(header, data, sample_bank, index): samples = {} for addr in sorted(sample_addrs): - samples[addr] = parse_sample(data[addr : addr + 20], data, sample_bank) + sample_size = 16 if is_shindou else 20 + sample_data = data[addr : addr + sample_size] + samples[addr] = parse_sample(sample_data, data, sample_bank, is_shindou) samples[addr].tunings.extend(tunings[addr]) env_data = {} @@ -331,7 +341,7 @@ def parse_ctl(header, data, sample_bank, index): for addr in range(min(used_env_addrs) + 4, max(used_env_addrs), 4): if addr not in used_env_addrs: unused_envs.add(addr) - stub_marker, = struct.unpack(">I", data[addr : addr + 4]) + (stub_marker,) = struct.unpack(">I", data[addr : addr + 4]) assert stub_marker == 0 env = parse_envelope(addr, data) env_data[addr] = env @@ -375,6 +385,32 @@ def parse_seqfile(data, filetype): return entries +def parse_sh_header(data, filetype): + (num_entries,) = struct.unpack(">H", data[:2]) + assert data[2:16] == b"\0" * 14 + prev = 0 + entries = [] + for i in range(num_entries): + subdata = data[16 + 16 * i : 32 + 16 * i] + offset, length, magic = struct.unpack(">IIH", subdata[:10]) + assert offset == prev + assert magic == (0x0204 if filetype == TYPE_TBL else 0x0203) + prev = offset + length + if filetype == TYPE_CTL: + assert subdata[14:16] == b"\0" * 2 + sample_bank_index, magic2, num_instruments, num_drums = struct.unpack( + ">BBBB", subdata[10:14] + ) + assert magic2 == 0xFF + entries.append( + (offset, length, (sample_bank_index, num_instruments, num_drums)) + ) + else: + assert subdata[10:16] == b"\0" * 6 + entries.append((offset, length)) + return entries + + def parse_tbl(data, entries): seen = {} tbls = [] @@ -543,11 +579,19 @@ def main(): need_help = False only_samples = False only_samples_list = [] - for a in sys.argv[1:]: + shindou_headers = None + skip_next = 0 + for i, a in enumerate(sys.argv[1:], 1): + if skip_next > 0: + skip_next -= 1 + continue if a == "--help" or a == "-h": need_help = True elif a == "--only-samples": only_samples = True + elif a == "--shindou-headers": + shindou_headers = sys.argv[i + 1 : i + 5] + skip_next = 4 elif a.startswith("-"): print("Unrecognized option " + a) sys.exit(1) @@ -556,36 +600,68 @@ def main(): else: args.append(a) - expected_num_args = 2 if only_samples else 4 - if need_help or len(args) != expected_num_args: + expected_num_args = 5 + (0 if only_samples else 2) + if ( + need_help + or len(args) != expected_num_args + or (shindou_headers and len(shindou_headers) != 4) + ): print( "Usage: {}" - " <.ctl file> <.tbl file>" + " <.z64 rom> " + " [--shindou-headers " + " ]" " ( |" " --only-samples file:index ...)".format(sys.argv[0]) ) sys.exit(0 if need_help else 1) - ctl_data = open(args[0], "rb").read() - tbl_data = open(args[1], "rb").read() + rom_file = open(args[0], "rb") + + def read_at(offset, size): + rom_file.seek(int(offset)) + return rom_file.read(int(size)) + + ctl_data = read_at(args[1], args[2]) + tbl_data = read_at(args[3], args[4]) + + ctl_header_data = None + tbl_header_data = None + if shindou_headers: + ctl_header_data = read_at(shindou_headers[0], shindou_headers[1]) + tbl_header_data = read_at(shindou_headers[2], shindou_headers[3]) if not only_samples: - samples_out_dir = args[2] - banks_out_dir = args[3] - - ctl_entries = parse_seqfile(ctl_data, TYPE_CTL) - tbl_entries = parse_seqfile(tbl_data, TYPE_TBL) - assert len(ctl_entries) == len(tbl_entries) - - tbls, sample_banks, sample_bank_map = parse_tbl(tbl_data, tbl_entries) + samples_out_dir = args[5] + banks_out_dir = args[6] banks = [] - for ((offset, length), sample_bank_name, index) in zip( - ctl_entries, tbls, range(len(ctl_entries)) - ): - sample_bank = sample_bank_map[sample_bank_name] - entry = ctl_data[offset : offset + length] - banks.append(parse_ctl(entry[:16], entry[16:], sample_bank, index)) + + if shindou_headers: + ctl_entries = parse_sh_header(ctl_header_data, TYPE_CTL) + tbl_entries = parse_sh_header(tbl_header_data, TYPE_TBL) + + sample_banks = parse_tbl(tbl_data, tbl_entries)[1] + + for index, (offset, length, sh_meta) in enumerate(ctl_entries): + sample_bank = sample_banks[sh_meta[0]] + entry = ctl_data[offset : offset + length] + header = (sh_meta[1], sh_meta[2], "0000-00-00") + banks.append(parse_ctl(header, entry, sample_bank, index, True)) + else: + ctl_entries = parse_seqfile(ctl_data, TYPE_CTL) + tbl_entries = parse_seqfile(tbl_data, TYPE_TBL) + assert len(ctl_entries) == len(tbl_entries) + + tbls, sample_banks, sample_bank_map = parse_tbl(tbl_data, tbl_entries) + + for index, (offset, length), sample_bank_name in zip( + range(len(ctl_entries)), ctl_entries, tbls + ): + sample_bank = sample_bank_map[sample_bank_name] + entry = ctl_data[offset : offset + length] + header = parse_ctl_header(entry[:16]) + banks.append(parse_ctl(header, entry[16:], sample_bank, index, False)) # Special mode used for asset extraction: generate aifc files, with paths # given by command line arguments diff --git a/tools/ido5.3_compiler/lib/libmalloc.so b/tools/ido5.3_compiler/lib/libmalloc.so index 2a59e0a4..a58e1034 100644 Binary files a/tools/ido5.3_compiler/lib/libmalloc.so and b/tools/ido5.3_compiler/lib/libmalloc.so differ diff --git a/tools/ido5.3_recomp/.gitignore b/tools/ido5.3_recomp/.gitignore new file mode 100644 index 00000000..6b747aba --- /dev/null +++ b/tools/ido5.3_recomp/.gitignore @@ -0,0 +1,16 @@ +/recomp +/recomp-conservative + +/cc* +/cfe* +/uopt* +/ugen* +/as1* +/acpp* +/copt* +/ujoin* +/uld* +/umerge* +/usplit* + +/err.english.cc diff --git a/tools/ido5.3_recomp/Makefile b/tools/ido5.3_recomp/Makefile new file mode 100644 index 00000000..84a5de31 --- /dev/null +++ b/tools/ido5.3_recomp/Makefile @@ -0,0 +1,37 @@ +IRIX_ROOT := ../ido5.3_compiler + +cc: OPT_CFLAGS := -O2 +cfe: OPT_CFLAGS := -O2 +uopt: OPT_CFLAGS := -O2 +ugen: OPT_CFLAGS := -O2 +as1: OPT_CFLAGS := -O2 +acpp: OPT_CFLAGS := -O2 + +RECOMP := recomp + +ugen_c.c: RECOMP_FLAGS := --conservative + +all: cc cfe uopt ugen as1 acpp copt ujoin uld umerge usplit err.english.cc + +clean: + $(RM) cc* cfe* uopt* ugen* as1* acpp* copt* ujoin* uld* umerge* usplit* err.english.cc $(RECOMP) libc_impl.o + +$(RECOMP): recomp.cpp + $(CXX) $^ -o $@ -std=c++11 -O2 -Wno-switch `pkg-config --cflags --libs capstone` + +libc_impl.o: libc_impl.c libc_impl.h + $(CC) $< -c -fno-strict-aliasing -O2 -DIDO53 + +err.english.cc: $(IRIX_ROOT)/usr/lib/err.english.cc + cp $^ $@ + +cc_c.c: $(IRIX_ROOT)/usr/bin/cc $(RECOMP) + ./$(RECOMP) $(RECOMP_FLAGS) $< > $@ + +%_c.c: $(IRIX_ROOT)/usr/lib/% $(RECOMP) + ./$(RECOMP) $(RECOMP_FLAGS) $< > $@ + +%: %_c.c libc_impl.o + $(CC) libc_impl.o $< -o $@ $(OPT_CFLAGS) -fno-strict-aliasing -lm -no-pie + +.PHONY: all clean diff --git a/tools/ido5.3_recomp/elf.h b/tools/ido5.3_recomp/elf.h new file mode 100644 index 00000000..91ba5fe2 --- /dev/null +++ b/tools/ido5.3_recomp/elf.h @@ -0,0 +1,99 @@ +#ifndef ELF_H +#define ELF_H + +#include + +#define EI_DATA 5 +#define EI_NIDENT 16 +#define SHT_SYMTAB 2 +#define SHT_DYNAMIC 6 +#define SHT_REL 9 +#define SHT_DYNSYM 11 +#define SHT_MIPS_REGINFO 0x70000006 +#define STN_UNDEF 0 +#define STT_OBJECT 1 +#define STT_FUNC 2 +#define DT_PLTGOT 3 +#define DT_MIPS_LOCAL_GOTNO 0x7000000a +#define DT_MIPS_SYMTABNO 0x70000011 +#define DT_MIPS_GOTSYM 0x70000013 + +#define ELF32_R_SYM(info) ((info) >> 8) +#define ELF32_R_TYPE(info) ((info) & 0xff) + +#define ELF32_ST_TYPE(info) ((info) & 0xf) + +#define R_MIPS_26 4 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 + +#define SHN_UNDEF 0 +#define SHN_COMMON 0xfff2 +#define SHN_MIPS_ACOMMON 0xff00 +#define SHN_MIPS_TEXT 0xff01 +#define SHN_MIPS_DATA 0xff02 + +typedef uint32_t Elf32_Addr; +typedef uint32_t Elf32_Off; + +typedef struct { + uint8_t e_ident[EI_NIDENT]; + uint16_t e_type; + uint16_t e_machine; + uint32_t e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + uint32_t e_flags; + uint16_t e_ehsize; + uint16_t e_phentsize; + uint16_t e_phnum; + uint16_t e_shentsize; + uint16_t e_shnum; + uint16_t e_shstrndx; +} Elf32_Ehdr; + +typedef struct { + uint32_t sh_name; + uint32_t sh_type; + uint32_t sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + uint32_t sh_size; + uint32_t sh_link; + uint32_t sh_info; + uint32_t sh_addralign; + uint32_t sh_entsize; +} Elf32_Shdr; + +typedef struct { + uint32_t st_name; + Elf32_Addr st_value; + uint32_t st_size; + uint8_t st_info; + uint8_t st_other; + uint16_t st_shndx; +} Elf32_Sym; + +typedef struct { + Elf32_Addr r_offset; + uint32_t r_info; +} Elf32_Rel; + +typedef struct +{ + uint32_t ri_gprmask; /* General registers used. */ + uint32_t ri_cprmask[4]; /* Coprocessor registers used. */ + int32_t ri_gp_value; /* $gp register value. */ +} Elf32_RegInfo; + +typedef struct +{ + int32_t d_tag; /* Dynamic entry type */ + union { + uint32_t d_val; /* Integer value */ + Elf32_Addr d_ptr; /* Address value */ + } d_un; +} Elf32_Dyn; + +#endif diff --git a/tools/ido5.3_recomp/header.h b/tools/ido5.3_recomp/header.h new file mode 100644 index 00000000..b4cd0d31 --- /dev/null +++ b/tools/ido5.3_recomp/header.h @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include +#include + +#include "libc_impl.h" +#include "helpers.h" + +#define RM_RN 0 +#define RM_RZ 1 +#define RM_RP 2 +#define RM_RM 3 + +union FloatReg { + float f[2]; + uint32_t w[2]; + double d; +}; + +#define cvt_w_d(f) \ + ((fcsr & RM_RZ) ? ((isnan(f) || f <= -2147483649.0 || f >= 2147483648.0) ? (fcsr |= 0x40, 2147483647) : (int)f) : (assert(0), 0)) + +#define cvt_w_s(f) cvt_w_d((double)f) + +static union FloatReg f0 = {{0, 0}}, f2 = {{0, 0}}, f4 = {{0, 0}}, f6 = {{0, 0}}, f8 = {{0, 0}}, +f10 = {{0, 0}}, f12 = {{0, 0}}, f14 = {{0, 0}}, f16 = {{0, 0}}, f18 = {{0, 0}}, f20 = {{0, 0}}, +f22 = {{0, 0}}, f24 = {{0, 0}}, f26 = {{0, 0}}, f28 = {{0, 0}}, f30 = {{0, 0}}; +static uint32_t fcsr = 1; diff --git a/tools/ido5.3_recomp/helpers.h b/tools/ido5.3_recomp/helpers.h new file mode 100644 index 00000000..b2bd2351 --- /dev/null +++ b/tools/ido5.3_recomp/helpers.h @@ -0,0 +1,13 @@ +#ifndef HELPERS_H +#define HELPERS_H + +#include + +#define MEM_U32(a) (*(uint32_t *)(mem + a)) +#define MEM_S32(a) (*(int32_t *)(mem + a)) +#define MEM_U16(a) (*(uint16_t *)(mem + ((a) ^ 2))) +#define MEM_S16(a) (*(int16_t *)(mem + ((a) ^ 2))) +#define MEM_U8(a) (*(uint8_t *)(mem + ((a) ^ 3))) +#define MEM_S8(a) (*(int8_t *)(mem + ((a) ^ 3))) + +#endif diff --git a/tools/ido5.3_recomp/libc_impl.c b/tools/ido5.3_recomp/libc_impl.c new file mode 100644 index 00000000..929d58fa --- /dev/null +++ b/tools/ido5.3_recomp/libc_impl.c @@ -0,0 +1,2543 @@ +#define _GNU_SOURCE // for sigset +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __CYGWIN__ +#include +#endif +#ifdef __APPLE__ + #include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libc_impl.h" +#include "helpers.h" + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +#define STRING(param) size_t param##_len = wrapper_strlen(mem, param##_addr); \ + char param[param##_len + 1]; \ + for (size_t i = 0; i <= param##_len; i++) { \ + param[i] = MEM_S8(param##_addr + i); \ + } + +#if !defined(IDO53) && !defined(IDO71) +#define IDO71 +#endif + +#define MEM_REGION_START 0xfb00000 +#define MEM_REGION_SIZE (512 * 1024 * 1024) + +#ifdef IDO53 +// IDO 5.3 +#define IOB_ADDR 0x0fb528e4 +#define ERRNO_ADDR 0x0fb52720 +#define CTYPE_ADDR 0x0fb504f0 +#define LIBC_ADDR 0x0fb50000 +#define LIBC_SIZE 0x3000 +#endif + +#ifdef IDO71 +// IDO 7.1 +#define IOB_ADDR 0x0fb4ee44 +#define ERRNO_ADDR 0x0fb4ec80 +#define CTYPE_ADDR 0x0fb4cba0 +#define LIBC_ADDR 0x0fb4c000 +#define LIBC_SIZE 0x3000 +#endif + +#define STDIN_ADDR IOB_ADDR +#define STDOUT_ADDR (IOB_ADDR + 0x10) +#define STDERR_ADDR (IOB_ADDR + 0x20) +#define STDIN ((struct FILE_irix *)&MEM_U32(STDIN_ADDR)) +#define STDOUT ((struct FILE_irix *)&MEM_U32(STDOUT_ADDR)) +#define STDERR ((struct FILE_irix *)&MEM_U32(STDERR_ADDR)) + +#define MALLOC_BINS_ADDR custom_libc_data_addr +#define STRTOK_DATA_ADDR (MALLOC_BINS_ADDR + (30 - 3) * 4) +#define INTBUF_ADDR (STRTOK_DATA_ADDR + 4) + +#define SIGNAL_HANDLER_STACK_START LIBC_ADDR + +#define NFILE 100 + +#define IOFBF 0000 /* full buffered */ +#define IOLBF 0100 /* line buffered */ +#define IONBF 0004 /* not buffered */ +#define IOEOF 0020 /* EOF reached on read */ +#define IOERR 0040 /* I/O error from system */ + +#define IOREAD 0001 /* currently reading */ +#define IOWRT 0002 /* currently writing */ +#define IORW 0200 /* opened for reading and writing */ +#define IOMYBUF 0010 /* stdio malloc()'d buffer */ + +#define STDIO_BUFSIZE 16384 + +struct timespec_t_irix { + int tv_sec; + int tv_nsec; +}; + +struct FILE_irix { + int _cnt; + uint32_t _ptr_addr; + uint32_t _base_addr; + uint8_t pad[2]; + uint8_t _file; + uint8_t _flag; +}; + +static struct { + struct { + uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest); + uint8_t *mem; + uint32_t fp_dest; + } handlers[65]; + volatile uint32_t recursion_level; +} signal_context; + +static uint32_t cur_sbrk; +static uint32_t bufendtab[NFILE]; // this version contains the size and not the end ptr +static uint32_t custom_libc_data_addr; + +#define _U 01 /* Upper case */ +#define _L 02 /* Lower case */ +#define _N 04 /* Numeral (digit) */ +#define _S 010 /* Spacing character */ +#define _P 020 /* Punctuation */ +#define _C 040 /* Control character */ +#define _B 0100 /* Blank */ +#define _X 0200 /* heXadecimal digit */ + +static char ctype[] = { 0, + +/* 0 1 2 3 4 5 6 7 */ + +/* 0*/ _C, _C, _C, _C, _C, _C, _C, _C, +/* 10*/ _C, _S|_C, _S|_C, _S|_C, _S|_C, _S|_C, _C, _C, +/* 20*/ _C, _C, _C, _C, _C, _C, _C, _C, +/* 30*/ _C, _C, _C, _C, _C, _C, _C, _C, +/* 40*/ _S|_B, _P, _P, _P, _P, _P, _P, _P, +/* 50*/ _P, _P, _P, _P, _P, _P, _P, _P, +/* 60*/ _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, +/* 70*/ _N|_X, _N|_X, _P, _P, _P, _P, _P, _P, +/*100*/ _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, +/*110*/ _U, _U, _U, _U, _U, _U, _U, _U, +/*120*/ _U, _U, _U, _U, _U, _U, _U, _U, +/*130*/ _U, _U, _U, _P, _P, _P, _P, _P, +/*140*/ _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, +/*150*/ _L, _L, _L, _L, _L, _L, _L, _L, +/*160*/ _L, _L, _L, _L, _L, _L, _L, _L, +/*170*/ _L, _L, _L, _P, _P, _P, _P, _C, +/*200*/ 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#define REDIRECT_USR_LIB + +#ifdef REDIRECT_USR_LIB +static char bin_dir[PATH_MAX + 1]; +#endif +static int g_file_max = 3; + +#ifdef __CYGWIN__ +static size_t g_Pagesize; +#endif + +static uint8_t *memory_map(size_t length) +{ +#ifdef __CYGWIN__ + uint8_t *mem = mmap(0, length, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0); + g_Pagesize = sysconf(_SC_PAGESIZE); + assert(((uintptr_t)mem & (g_Pagesize-1)) == 0); +#else + uint8_t *mem = mmap(0, length, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +#endif + if (mem == MAP_FAILED) { + perror("mmap"); + exit(1); + } + return mem; +} + +static void memory_allocate(uint8_t *mem, uint32_t start, uint32_t end) +{ + assert(start >= MEM_REGION_START); + assert(end <= MEM_REGION_START + MEM_REGION_SIZE); +#ifdef __CYGWIN__ + uintptr_t _start = ((uintptr_t)mem + start) & ~(g_Pagesize-1); + uintptr_t _end = ((uintptr_t)mem + end + (g_Pagesize-1)) & ~(g_Pagesize-1); + + if(mprotect((void*)_start, _end - _start, PROT_READ | PROT_WRITE) < 0) { + perror("mprotect"); + exit(1); + } +#else + if (mmap(mem + start, end - start, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) == MAP_FAILED) { + perror("mmap"); + exit(1); + } +#endif +} + +static void memory_unmap(uint8_t *mem, size_t length) +{ + if (munmap(mem, length)) { + perror("munmap"); + exit(1); + } +} + + +static void free_all_file_bufs(uint8_t *mem) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(IOB_ADDR); + for (int i = 0; i < g_file_max; i++) { + if (f[i]._flag & IOMYBUF) { + wrapper_free(mem, f[i]._base_addr); + } + } +} + +static void find_bin_dir(void) { +#ifdef REDIRECT_USR_LIB + // gets the current executable's path + char path[PATH_MAX + 1] = {0}; +#ifdef __CYGWIN__ + uint32_t size = GetModuleFileName(NULL, path, PATH_MAX); + if (size == 0 || size == PATH_MAX) { + return; + } +#elif defined __APPLE__ + uint32_t size = PATH_MAX; + if (_NSGetExecutablePath(path, &size) < 0) { + return; + } +#else + ssize_t size = readlink("/proc/self/exe", path, PATH_MAX); + if (size < 0 || size == PATH_MAX) { + return; + } +#endif + + strcpy(bin_dir, dirname(path)); +#endif +} + +int main(int argc, char *argv[]) { + int ret; + + find_bin_dir(); + + uint8_t *mem = memory_map(MEM_REGION_SIZE); + mem -= MEM_REGION_START; + int run(uint8_t *mem, int argc, char *argv[]); + ret = run(mem, argc, argv); + wrapper_fflush(mem, 0); + free_all_file_bufs(mem); + mem += MEM_REGION_START; + memory_unmap(mem, MEM_REGION_SIZE); + return ret; +} + +void mmap_initial_data_range(uint8_t *mem, uint32_t start, uint32_t end) { + custom_libc_data_addr = end; + end += 4096; + memory_allocate(mem, start, end); + cur_sbrk = end; +} + +void setup_libc_data(uint8_t *mem) { + memory_allocate(mem, LIBC_ADDR, (LIBC_ADDR + LIBC_SIZE)); + for (size_t i = 0; i < sizeof(ctype); i++) { + MEM_S8(CTYPE_ADDR + i) = ctype[i]; + } + STDIN->_flag = IOREAD; + STDIN->_file = 0; + STDOUT->_flag = IOWRT; + STDOUT->_file = 1; + STDERR->_flag = IOWRT | IONBF; + STDERR->_file = 2; +} + +static uint32_t strcpy1(uint8_t *mem, uint32_t dest_addr, const char *str) { + for (;;) { + char c = *str; + ++str; + MEM_S8(dest_addr) = c; + ++dest_addr; + if (c == '\0') { + return dest_addr - 1; + } + } +} + +static uint32_t strcpy2(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr) { + for (;;) { + char c = MEM_S8(src_addr); + ++src_addr; + MEM_S8(dest_addr) = c; + ++dest_addr; + if (c == '\0') { + return dest_addr - 1; + } + } +} + +uint32_t wrapper_sbrk(uint8_t *mem, int increment) { + uint32_t old = cur_sbrk; + memory_allocate(mem, old, (old + increment)); + cur_sbrk += increment; + return old; +} + +#if 0 +uint32_t wrapper_malloc(uint8_t *mem, uint32_t size) { + uint32_t orig_size = size; + size += 8; + size = (size + 0xfff) & ~0xfff; + uint32_t ret = wrapper_sbrk(mem, size); + MEM_U32(ret) = orig_size; + return ret + 8; +} + +uint32_t wrapper_calloc(uint8_t *mem, uint32_t num, uint32_t size) { + uint64_t new_size = (uint64_t)num * size; + assert(new_size == (uint32_t)new_size); + uint32_t ret = wrapper_malloc(mem, new_size); + return wrapper_memset(mem, ret, 0, new_size); +} + +uint32_t wrapper_realloc(uint8_t *mem, uint32_t data_addr, uint32_t size) { + if (data_addr == 0) { + return wrapper_malloc(mem, size); + } + uint32_t orig_size = MEM_U32(data_addr - 8); + if (size < orig_size || orig_size < 4088 && size < 4088) { + MEM_U32(data_addr - 8) = size; + return data_addr; + } + uint32_t new_addr = wrapper_malloc(mem, size); + return wrapper_memcpy(mem, new_addr, data_addr, MIN(size, orig_size)); +} + +void wrapper_free(uint8_t *mem, uint32_t data_addr) { + // NOP +} +#else + +/* +Simple bin-based malloc algorithm + +The memory is divided into bins of item sizes 8, 16, 32, 64, 128, ..., 2^30. +Size requests are divided into these bin sizes and each bin is handled +completely separate from other bins. + +For each bin there is a linked list of free'd items. +Linked list node: +struct FreeListNode { + struct Node *next; + size_t free_space_after; + uint8_t data[bin_item_size]; +}; +At most one value of next and space_after is non-zero. +If a node exists in the linked list, it is the memory node to return. +struct AllocatedNode { + int bin; + uint32_t current_size; + uint8_t data[bin_item_size]; +}; +The returned address is the data element. +When the last list node is returned, and free_space_after is big enough +for a new node, a new node is created having free_space_after set to +(free_space_after - (8 + bin_item_size)), and is appended to the list. + +If the list was empty, a new memory chunk is requested from the system +of 65536 bytes, or at least (8 + bin_item_size), rounded up to nearest +page size boundary. It can also be smaller if it leaves holes bigger than +4096 bytes that can never be used. This chunk is then inserted to the list, +and the algorithm restarts. + +This algorithm, for each bin, never uses more than twice as much as is +maximally in use (plus 65536 bytes). +The malloc/free calls run in O(1) and calloc/realloc calls run in O(size). +*/ + +size_t mem_used; +size_t mem_allocated; +size_t max_mem_used; +size_t num_sbrks; +size_t num_allocs; +uint32_t wrapper_malloc(uint8_t *mem, uint32_t size) { + int bin = -1; + for (int i = 3; i < 30; i++) { + if (size <= (1 << i)) { + bin = i; + break; + } + } + if (bin == -1) { + return 0; + } + ++num_allocs; + mem_used += size; + max_mem_used = MAX(mem_used, max_mem_used); + uint32_t item_size = 1 << bin; + uint32_t list_ptr = MALLOC_BINS_ADDR + (bin - 3) * 4; + uint32_t node_ptr = MEM_U32(list_ptr); + if (node_ptr == 0) { + uint32_t sbrk_request = 0x10000; + if (8 + item_size > sbrk_request) { + sbrk_request = 8 + item_size; + sbrk_request = (sbrk_request + 0xfff) & ~0xfff; + } + uint32_t left_over = sbrk_request % (8 + item_size); + sbrk_request -= left_over & ~0xfff; + mem_allocated += sbrk_request; + ++num_sbrks; + node_ptr = wrapper_sbrk(mem, sbrk_request); + MEM_U32(node_ptr + 4) = sbrk_request - (8 + item_size); + } + uint32_t next = MEM_U32(node_ptr); + if (next == 0) { + uint32_t free_space_after = MEM_U32(node_ptr + 4); + if (free_space_after >= 8 + item_size) { + next = node_ptr + 8 + item_size; + MEM_U32(next + 4) = free_space_after - (8 + item_size); + } + } else { + assert(MEM_U32(node_ptr + 4) == 0); + } + MEM_U32(list_ptr) = next; + MEM_U32(node_ptr) = bin; + MEM_U32(node_ptr + 4) = size; + return node_ptr + 8; +} + +uint32_t wrapper_calloc(uint8_t *mem, uint32_t num, uint32_t size) { + uint64_t new_size = (uint64_t)num * size; + assert(new_size == (uint32_t)new_size); + uint32_t ret = wrapper_malloc(mem, new_size); + return wrapper_memset(mem, ret, 0, new_size); +} + +uint32_t wrapper_realloc(uint8_t *mem, uint32_t data_addr, uint32_t size) { + if (data_addr == 0) { + return wrapper_malloc(mem, size); + } else { + uint32_t node_ptr = data_addr - 8; + int bin = MEM_U32(node_ptr); + uint32_t old_size = MEM_U32(node_ptr + 4); + uint32_t max_size = 1 << bin; + assert(bin >= 3 && bin < 30); + assert(old_size <= max_size); + if (size <= max_size) { + mem_used = mem_used - old_size + size; + MEM_U32(node_ptr + 4) = size; + return data_addr; + } else { + uint32_t new_addr = wrapper_malloc(mem, size); + wrapper_memcpy(mem, new_addr, data_addr, old_size); + wrapper_free(mem, data_addr); + return new_addr; + } + } +} + +void wrapper_free(uint8_t *mem, uint32_t data_addr) { + uint32_t node_ptr = data_addr - 8; + int bin = MEM_U32(node_ptr); + uint32_t size = MEM_U32(node_ptr + 4); + uint32_t list_ptr = MALLOC_BINS_ADDR + (bin - 3) * 4; + assert(bin >= 3 && bin < 30); + assert(size <= (1 << bin)); + MEM_U32(node_ptr) = MEM_U32(list_ptr); + MEM_U32(node_ptr + 4) = 0; + MEM_U32(list_ptr) = node_ptr; + mem_used -= size; +} +#endif + +int wrapper_fscanf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + STRING(format) // for debug + + int ret = 0; + char c; + int ch; + sp += 2 * 4; + for (;;) { + c = MEM_S8(format_addr); + ++format_addr; + if (c == '%') { + c = MEM_S8(format_addr); + ++format_addr; + if (c == '%') { + goto percent; + } + for (;;) { + ch = wrapper_fgetc(mem, fp_addr); + if (ch == -1) { + return ret; + } + if (!isspace(ch)) { + //wrapper_ungetc(mem, ch, fp_addr); + break; + } + } + bool l = false; + continue_format: + switch (c) { + case 'l': + assert(!l && "ll not implemented in fscanf"); + l = true; + c = MEM_S8(format_addr); + ++format_addr; + goto continue_format; + case 'd': + { + int64_t num = 0; + int sign = 1; + bool found_first = false; + if (ch == '-') { + sign = -1; + ch = wrapper_fgetc(mem, fp_addr); + if (ch == -1) { + return ret; + } + } + for (;;) { + if (isdigit(ch)) { + num *= 10; + num += ch - '0'; + found_first = true; + ch = wrapper_fgetc(mem, fp_addr); + if (ch == -1) { + break; + } + } else { + wrapper_ungetc(mem, ch, fp_addr); + break; + } + } + if (found_first) { + uint32_t int_addr = MEM_U32(sp); + sp += 4; + MEM_S32(int_addr) = (int)(num * sign); + ++ret; + } else { + return ret; + } + break; + } + default: + assert(0 && "fscanf format not implemented"); + } + } else if (c == '\0') { + break; + } else { + percent: + ch = wrapper_fgetc(mem, fp_addr); + if (ch == -1) { + break; + } + if ((char)ch != c) { + break; + } + } + } + + return ret; +} + +int wrapper_printf(uint8_t *mem, uint32_t format_addr, uint32_t sp) { + STRING(format) + if (!strcmp(format, " child died due to signal %d.\n")) { + printf(format, MEM_U32(sp + 4)); + return 1; + } + assert(0 && "printf not implemented"); + return 0; +} + +int wrapper_sprintf(uint8_t *mem, uint32_t str_addr, uint32_t format_addr, uint32_t sp) { + STRING(format) // for debug + char temp[32]; + + if (!strcmp(format, "%.16e")) { + union { + uint32_t w[2]; + double d; + } d; + d.w[1] = MEM_U32(sp + 2 * 4); + d.w[0] = MEM_U32(sp + 3 * 4); + sprintf(temp, "%.16e", d.d); + strcpy1(mem, str_addr, temp); + return 1; + } + if (!strcmp(format, "\\%03o")) { + sprintf(temp, "\\%03o", MEM_U32(sp + 2 * 4)); + strcpy1(mem, str_addr, temp); + return 1; + } + if (!strcmp(format, "%*ld=")) { + sprintf(temp, "%*d=", MEM_U32(sp + 2 * 4), MEM_U32(sp + 3 * 4)); + strcpy1(mem, str_addr, temp); + return 1; + } + + uint32_t orig_str_addr = str_addr; + uint32_t pos = 0; + int ret = 0; + char c; + sp += 2 * 4; + for (;;) { + c = MEM_S8(format_addr + pos); + ++pos; + if (c == '%') { + bool l = false; + c = MEM_S8(format_addr + pos); + ++pos; + uint32_t zeros = 0; + bool zero_prefix = false; + continue_format: + switch (c) { + case '0': + do { + c = MEM_S8(format_addr + pos); + ++pos; + if (c >= '0' && c <= '9') { + zeros *= 10; + zeros += c - '0'; + } + } while (c >= '0' && c <= '9'); + goto continue_format; + case '#': + c = MEM_S8(format_addr + pos); + ++pos; + zero_prefix = true; + goto continue_format; + break; + case 'l': + assert(!l && "ll not implemented in fscanf"); + c = MEM_S8(format_addr + pos); + ++pos; + l = true; + goto continue_format; + break; + case 'd': + if (zeros != 0) { + char temp1[32]; + sprintf(temp1, "%%0%dd", zeros); + sprintf(temp, temp1, MEM_S32(sp)); + } else { + sprintf(temp, "%d", MEM_S32(sp)); + } + sp += 4; + str_addr = strcpy1(mem, str_addr, temp); + ++ret; + break; + case 'o': + if (zero_prefix) { + sprintf(temp, "%#o", MEM_S32(sp)); + } else { + sprintf(temp, "%o", MEM_S32(sp)); + } + sp += 4; + str_addr = strcpy1(mem, str_addr, temp); + ++ret; + break; + case 'x': + if (zero_prefix) { + sprintf(temp, "%#x", MEM_S32(sp)); + } else { + sprintf(temp, "%x", MEM_S32(sp)); + } + sp += 4; + str_addr = strcpy1(mem, str_addr, temp); + ++ret; + break; + case 'u': + sprintf(temp, "%u", MEM_S32(sp)); + sp += 4; + str_addr = strcpy1(mem, str_addr, temp); + ++ret; + break; + case 's': + str_addr = strcpy2(mem, str_addr, MEM_U32(sp)); + sp += 4; + ++ret; + break; + case 'c': + MEM_S8(str_addr) = (char)MEM_U32(sp); + ++str_addr; + sp += 4; + ++ret; + break; + case '%': + MEM_S8(str_addr) = '%'; + ++str_addr; + break; + default: + fprintf(stderr, "%s\n", format); + assert(0 && "non-implemented sprintf format"); + } + } else if (c == '\0') { + break; + } else { + MEM_S8(str_addr) = c; + ++str_addr; + } + } + + MEM_S8(str_addr) = '\0'; + STRING(orig_str) // for debug + //printf("result: '%s' '%s'\n", format, orig_str); + return ret; +} + +int wrapper_fprintf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + STRING(format) + sp += 8; + /*if (!strcmp(format, "%s")) { + uint32_t s_addr = MEM_U32(sp); + STRING(s) + if (fp_addr == STDERR_ADDR) { + fprintf(stderr, "%s", s); + fflush(stderr); + return 1; + } + } + if (!strcmp(format, "%s: %s: ")) { + uint32_t s1_addr = MEM_U32(sp), s2_addr = MEM_U32(sp + 4); + STRING(s1) + STRING(s2) + if (fp_addr == STDERR_ADDR) { + fprintf(stderr, "%s: %s: ", s1, s2); + fflush(stderr); + return 1; + } + }*/ + int ret = 0; + for (;;) { + uint32_t pos = format_addr; + char ch = MEM_S8(pos); + while (ch != '%' && ch != '\0') { + ++pos; + ch = MEM_S8(pos); + } + if (format_addr != pos) { + if (wrapper_fwrite(mem, format_addr, 1, pos - format_addr, fp_addr) != pos - format_addr) { + break; + } + } + if (ch == '\0') { + break; + } + ++pos; + ch = MEM_S8(pos); + switch (ch) { + case 'd': + { + char buf[32]; + sprintf(buf, "%d", MEM_U32(sp)); + strcpy1(mem, INTBUF_ADDR, buf); + if (wrapper_fputs(mem, INTBUF_ADDR, fp_addr) == -1) { + return ret; + } + sp += 4; + ++ret; + break; + } + case 's': + { + if (wrapper_fputs(mem, MEM_U32(sp), fp_addr) == -1) { + return ret; + } + sp += 4; + ++ret; + break; + } + case 'c': + { + char buf[32]; + sprintf(buf, "%c", MEM_U32(sp)); + strcpy1(mem, INTBUF_ADDR, buf); + if (wrapper_fputs(mem, INTBUF_ADDR, fp_addr) == -1) { + return ret; + } + sp += 4; + ++ret; + break; + } + default: + fprintf(stderr, "missing format: '%s'\n", format); + assert(0 && "non-implemented fprintf format"); + } + format_addr = ++pos; + } + return ret; +} + +int wrapper__doprnt(uint8_t *mem, uint32_t format_addr, uint32_t params_addr, uint32_t fp_addr) { + assert(0 && "_doprnt not implemented"); + return 0; +} + +uint32_t wrapper_strlen(uint8_t *mem, uint32_t str_addr) { + uint32_t len = 0; + while (MEM_S8(str_addr) != '\0') { + ++str_addr; + ++len; + } + return len; +} + +int wrapper_open(uint8_t *mem, uint32_t pathname_addr, int flags, int mode) { + STRING(pathname) + int f = flags & O_ACCMODE; + if (flags & 0x100) { + f |= O_CREAT; + } + if (flags & 0x200) { + f |= O_TRUNC; + } + if (flags & 0x400) { + f |= O_EXCL; + } + if (flags & 0x800) { + f |= O_NOCTTY; + } + if (flags & 0x08) { + f |= O_APPEND; + } + int fd = open(pathname, f, mode); + MEM_U32(ERRNO_ADDR) = errno; + return fd; +} + +int wrapper_creat(uint8_t *mem, uint32_t pathname_addr, int mode) { + STRING(pathname) + int ret = creat(pathname, mode); + if (ret < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_access(uint8_t *mem, uint32_t pathname_addr, int mode) { + STRING(pathname) + int ret = access(pathname, mode); + if (ret != 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_rename(uint8_t *mem, uint32_t oldpath_addr, uint32_t newpath_addr) { + STRING(oldpath) + STRING(newpath) + int ret = rename(oldpath, newpath); + if (ret != 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_utime(uint8_t *mem, uint32_t filename_addr, uint32_t times_addr) { + STRING(filename) + struct utimbuf buf = {0, 0}; + int ret = utime(filename, times_addr == 0 ? NULL : &buf); + if (ret == 0) { + if (times_addr != 0) { + MEM_U32(times_addr + 0) = buf.actime; + MEM_U32(times_addr + 4) = buf.modtime; + } + } else { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_flock(uint8_t *mem, int fd, int operation) { + int ret = flock(fd, operation); + if (ret != 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_chmod(uint8_t *mem, uint32_t path_addr, uint32_t mode) { + STRING(path) + int ret = chmod(path, mode); + if (ret < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_umask(int mode) { + return umask(mode); +} + +uint32_t wrapper_ecvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr) { + assert(0); +} + +uint32_t wrapper_fcvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr) { + assert(0); +} + +double wrapper_sqrt(double v) { + return sqrt(v); +} + +float wrapper_sqrtf(float v) { + return sqrtf(v); +} + +int wrapper_atoi(uint8_t *mem, uint32_t nptr_addr) { + STRING(nptr) + return atoi(nptr); +} + +int wrapper_atol(uint8_t *mem, uint32_t nptr_addr) { + return wrapper_atoi(mem, nptr_addr); +} + +double wrapper_atof(uint8_t *mem, uint32_t nptr_addr) { + STRING(nptr); + return atof(nptr); +} + +int wrapper_strtol(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base) { + STRING(nptr) + char *endptr = NULL; + int64_t res = strtoll(nptr, endptr_addr != 0 ? &endptr : NULL, base); + if (res > INT_MAX) { + MEM_U32(ERRNO_ADDR) = ERANGE; + res = INT_MAX; + } + if (res < INT_MIN) { + MEM_U32(ERRNO_ADDR) = ERANGE; + res = INT_MIN; + } + if (endptr != NULL) { + MEM_U32(endptr_addr) = nptr_addr + (uint32_t)(endptr - nptr); + } + return res; +} + +uint32_t wrapper_strtoul(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base) { + STRING(nptr) + char *endptr = NULL; + uint64_t res = strtoull(nptr, endptr_addr != 0 ? &endptr : NULL, base); + if (res > INT_MAX) { + MEM_U32(ERRNO_ADDR) = ERANGE; + res = INT_MAX; + } + if (endptr != NULL) { + MEM_U32(endptr_addr) = nptr_addr + (uint32_t)(endptr - nptr); + } + return res; +} + +double wrapper_strtod(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr) { + STRING(nptr) + char *endptr = NULL; + errno = 0; + double res = strtod(nptr, endptr_addr != 0 ? &endptr : NULL); + if (errno != 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + if (endptr != NULL) { + MEM_U32(endptr_addr) = nptr_addr + (uint32_t)(endptr - nptr); + } + return res; +} + +uint32_t wrapper_strchr(uint8_t *mem, uint32_t str_addr, int c) { + c = c & 0xff; + for (;;) { + unsigned char ch = MEM_U8(str_addr); + if (ch == c) { + return str_addr; + } + if (ch == '\0') { + return 0; + } + ++str_addr; + } +} + +uint32_t wrapper_strrchr(uint8_t *mem, uint32_t str_addr, int c) { + c = c & 0xff; + uint32_t ret = 0; + for (;;) { + unsigned char ch = MEM_U8(str_addr); + if (ch == c) { + ret = str_addr; + } + if (ch == '\0') { + return ret; + } + ++str_addr; + } +} + +uint32_t wrapper_strcspn(uint8_t *mem, uint32_t str_addr, uint32_t invalid_addr) { + STRING(invalid) + uint32_t n = strlen(invalid); + uint32_t pos = 0; + char c; + while ((c = MEM_S8(str_addr)) != 0) { + for (int i = 0; i < n; i++) { + if (c == invalid[i]) { + return pos; + } + } + ++pos; + ++str_addr; + } + return pos; +} + +uint32_t wrapper_strpbrk(uint8_t *mem, uint32_t str_addr, uint32_t accept_addr) { + STRING(accept) + uint32_t n = strlen(accept); + char c; + while ((c = MEM_S8(str_addr)) != 0) { + for (int i = 0; i < n; i++) { + if (c == accept[i]) { + return str_addr; + } + } + ++str_addr; + } + return 0; +} + +static void stat_common(uint8_t *mem, uint32_t buf_addr, struct stat *statbuf) { + struct irix_stat { + int st_dev; + int pad1[3]; + int st_ino; + int st_mode; + int st_nlink; + int st_uid; + int st_gid; + int st_rdev; + int pad2[2]; + int st_size; + int pad3; + struct timespec_t_irix st_atim; + struct timespec_t_irix st_mtim; + struct timespec_t_irix st_ctim; + int st_blksize; + int st_blocks; + } s; + s.st_dev = statbuf->st_dev; + s.st_ino = statbuf->st_ino; + s.st_mode = statbuf->st_mode; + s.st_nlink = statbuf->st_nlink; + s.st_uid = statbuf->st_uid; + s.st_gid = statbuf->st_gid; + s.st_rdev = statbuf->st_rdev; + s.st_size = statbuf->st_size; +#ifdef __APPLE__ + s.st_atim.tv_sec = statbuf->st_atimespec.tv_sec; + s.st_atim.tv_nsec = statbuf->st_atimespec.tv_nsec; + s.st_mtim.tv_sec = statbuf->st_mtimespec.tv_sec; + s.st_mtim.tv_nsec = statbuf->st_mtimespec.tv_nsec; + s.st_ctim.tv_sec = statbuf->st_ctimespec.tv_sec; + s.st_ctim.tv_nsec = statbuf->st_ctimespec.tv_nsec; +#else + s.st_atim.tv_sec = statbuf->st_atim.tv_sec; + s.st_atim.tv_nsec = statbuf->st_atim.tv_nsec; + s.st_mtim.tv_sec = statbuf->st_mtim.tv_sec; + s.st_mtim.tv_nsec = statbuf->st_mtim.tv_nsec; + s.st_ctim.tv_sec = statbuf->st_ctim.tv_sec; + s.st_ctim.tv_nsec = statbuf->st_ctim.tv_nsec; +#endif + memcpy(&MEM_U32(buf_addr), &s, sizeof(s)); +} + +int wrapper_fstat(uint8_t *mem, int fildes, uint32_t buf_addr) { + struct stat statbuf; + if (fstat(fildes, &statbuf) < 0) { + MEM_U32(ERRNO_ADDR) = errno; + return -1; + } else { + stat_common(mem, buf_addr, &statbuf); + return 0; + } +} + +int wrapper_stat(uint8_t *mem, uint32_t pathname_addr, uint32_t buf_addr) { + STRING(pathname) + struct stat statbuf; + if (stat(pathname, &statbuf) < 0) { + MEM_U32(ERRNO_ADDR) = errno; + return -1; + } else { + stat_common(mem, buf_addr, &statbuf); + return 0; + } +} + +int wrapper_ftruncate(uint8_t *mem, int fd, int length) { + int ret = ftruncate(fd, length); + if (ret != 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +void wrapper_bcopy(uint8_t *mem, uint32_t src_addr, uint32_t dst_addr, uint32_t len) { + wrapper_memcpy(mem, dst_addr, src_addr, len); +} + +uint32_t wrapper_memcpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, uint32_t len) { + uint32_t saved = dst_addr; + if (dst_addr % 4 == 0 && src_addr % 4 == 0 && len % 4 == 0) { + memcpy(&MEM_U32(dst_addr), &MEM_U32(src_addr), len); + } else { + while (len--) { + MEM_U8(dst_addr) = MEM_U8(src_addr); + ++dst_addr; + ++src_addr; + } + } + return saved; +} + +uint32_t wrapper_memccpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, int c, uint32_t len) { + while (len--) { + uint8_t ch = MEM_U8(src_addr); + MEM_U8(dst_addr) = ch; + ++dst_addr; + ++src_addr; + if (ch == c) { + return dst_addr; + } + } + return 0; +} + +int wrapper_read(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes) { + uint8_t *buf = (uint8_t *)malloc(nbytes); + ssize_t ret = read(fd, buf, nbytes); + if (ret < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } else { + for (ssize_t i = 0; i < ret; i++) { + MEM_U8(buf_addr + i) = buf[i]; + } + } + free(buf); + return (int)ret; +} + +int wrapper_write(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes) { + uint8_t *buf = (uint8_t *)malloc(nbytes); + for (size_t i = 0; i < nbytes; i++) { + buf[i] = MEM_U8(buf_addr + i); + } + ssize_t ret = write(fd, buf, nbytes); + if (ret < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + free(buf); + return (int)ret; +} + +static uint32_t init_file(uint8_t *mem, int fd, int i, const char *path, const char *mode) { + int flags = O_RDONLY; + if (strcmp(mode, "r") == 0 || strcmp(mode, "rb") == 0) { + flags = O_RDONLY; + } else if (strcmp(mode, "w") == 0 || strcmp(mode, "wb") == 0) { + flags = O_WRONLY | O_CREAT | O_TRUNC; + } else if (strcmp(mode, "a") == 0 || strcmp(mode, "ab") == 0) { + flags = O_WRONLY | O_CREAT | O_APPEND; + } else if (strcmp(mode, "r+") == 0 || strcmp(mode, "r+b") == 0) { + flags = O_RDWR; + } else if (strcmp(mode, "w+") == 0 || strcmp(mode, "w+b") == 0) { + flags = O_RDWR | O_CREAT | O_TRUNC; + } else if (strcmp(mode, "a+") == 0 || strcmp(mode, "a+b") == 0) { + flags = O_RDWR | O_CREAT | O_APPEND; + } + if (fd == -1) { + +#ifdef REDIRECT_USR_LIB + char fixed_path[PATH_MAX + 1]; + if (!strcmp(path, "/usr/lib/err.english.cc") && bin_dir[0] != '\0') { + int n = snprintf(fixed_path, sizeof(fixed_path), "%s/err.english.cc", bin_dir); + if (n >= 0 && n < sizeof(fixed_path)) { + path = fixed_path; + } + } +#endif + fd = open(path, flags, 0666); + if (fd < 0) { + MEM_U32(ERRNO_ADDR) = errno; + return 0; + } + } + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(IOB_ADDR); + uint32_t ret = 0; + if (i == -1) { + for (i = 3; i < NFILE; i++) { + if (f[i]._flag == 0) { + break; + } + } + } + assert(i < NFILE); + g_file_max = i + 1; + ret = IOB_ADDR + i * sizeof(struct FILE_irix); + f[i]._cnt = 0; + f[i]._ptr_addr = 0; + f[i]._base_addr = 0; + f[i]._file = fd; + f[i]._flag = (flags & O_ACCMODE) == O_RDONLY ? IOREAD : 0; + f[i]._flag |= (flags & O_ACCMODE) == O_WRONLY ? IOWRT : 0; + f[i]._flag |= (flags & O_ACCMODE) == O_RDWR ? IORW : 0; + bufendtab[i] = 0; + return ret; +} + +uint32_t wrapper_fopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr) { + STRING(path) + STRING(mode) + return init_file(mem, -1, -1, path, mode); +} + +uint32_t wrapper_freopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr, uint32_t fp_addr) { + STRING(path) + STRING(mode) + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + wrapper_fclose(mem, fp_addr); + return init_file(mem, -1, f - (struct FILE_irix *)&MEM_U32(IOB_ADDR), path, mode); +} + +int wrapper_fclose(uint8_t *mem, uint32_t fp_addr) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + wrapper_fflush(mem, fp_addr); + if (f->_flag & IOMYBUF) { + wrapper_free(mem, f->_base_addr); + } + f->_flag = 0; + close(f->_file); + return 0; +} + +static int flush_all(uint8_t *mem) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(IOB_ADDR); + int ret = 0; + for (int i = 0; i < g_file_max; i++) { + if (f[i]._flag & IOWRT) { + ret |= wrapper_fflush(mem, IOB_ADDR + i * sizeof(struct FILE_irix)); + } + } + return ret; +} + +int wrapper_fflush(uint8_t *mem, uint32_t fp_addr) { + if (fp_addr == 0) { + // Flush all + return flush_all(mem); + } + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + if (f->_flag & IOWRT) { + int p = 0; + int to_flush = f->_ptr_addr - f->_base_addr; + int c = to_flush; + while (c > 0) { + int r = wrapper_write(mem, f->_file, f->_base_addr + p, c); + if (r < 0) { + f->_file |= IOERR; + return -1; + } + p += r; + c -= r; + } + f->_ptr_addr = f->_base_addr; + f->_cnt += to_flush; + } + return 0; +} + +int wrapper_ftell(uint8_t *mem, uint32_t fp_addr) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + int adjust; + if (f->_cnt < 0) { + f->_cnt = 0; + } + if (f->_flag & IOREAD) { + adjust = -f->_cnt; + } else if (f->_flag & (IOWRT | IORW)) { + adjust = 0; + if ((f->_flag & IOWRT) && f->_base_addr != 0 && (f->_flag & IONBF) == 0) { + adjust = f->_ptr_addr - f->_base_addr; + } + } else { + return -1; + } + int res = wrapper_lseek(mem, f->_file, 0, 1); + if (res >= 0) { + res += adjust; + } + return res; +} + +void wrapper_rewind(uint8_t *mem, uint32_t fp_addr) { + (void)wrapper_fseek(mem, fp_addr, 0, SEEK_SET); + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + f->_flag &= ~IOERR; +} + +int wrapper_fseek(uint8_t *mem, uint32_t fp_addr, int offset, int origin) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + int c, p; + f->_flag &= ~IOEOF; + if (f->_flag & IOREAD) { + if (origin < SEEK_END && f->_base_addr && !(f->_flag & IONBF)) { + c = f->_cnt; + p = offset; + if (origin == SEEK_SET) { + p += c - lseek(f->_file, 0L, SEEK_CUR); + } else { + offset -= c; + } + if (!(f->_flag & IORW) && c > 0 && p <= c && p >= f->_base_addr - f->_ptr_addr) { + f->_ptr_addr += p; + f->_cnt -= p; + return 0; + } + } + if (f->_flag & IORW) { + f->_ptr_addr = f->_base_addr; + f->_flag &= ~IOREAD; + } + p = lseek(f->_file, offset, origin); + f->_cnt = 0; + } else if (f->_flag & (IOWRT | IORW)) { + wrapper_fflush(mem, fp_addr); + if (f->_flag & IORW) { + f->_cnt = 0; + f->_flag &= ~IOWRT; + f->_ptr_addr = f->_base_addr; + } + p = lseek(f->_file, offset, origin); + } + if (p < 0) { + MEM_U32(ERRNO_ADDR) = errno; + return p; + } + return 0; +} + +int wrapper_lseek(uint8_t *mem, int fd, int offset, int whence) { + int ret = (int)lseek(fd, offset, whence); + if (ret == -1) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_dup(uint8_t *mem, int fd) { + fd = dup(fd); + if (fd < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return fd; +} + +int wrapper_dup2(uint8_t *mem, int oldfd, int newfd) { + int fd = dup2(oldfd, newfd); + if (fd < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return fd; +} + +int wrapper_pipe(uint8_t *mem, uint32_t pipefd_addr) { + int pipefd[2]; + int ret = pipe(pipefd); + if (ret == 0) { + MEM_U32(pipefd_addr + 0) = pipefd[0]; + MEM_U32(pipefd_addr + 4) = pipefd[1]; + } else { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +void wrapper_perror(uint8_t *mem, uint32_t str_addr) { + STRING(str) + perror(str); +} + +int wrapper_fdopen(uint8_t *mem, int fd, uint32_t mode_addr) { + STRING(mode) + return init_file(mem, fd, -1, NULL, mode); +} + +uint32_t wrapper_memset(uint8_t *mem, uint32_t dest_addr, int byte, uint32_t n) { + uint32_t saved = dest_addr; + if (dest_addr % 4 == 0 && n % 4 == 0) { + memset(&MEM_U32(dest_addr), byte, n); + } else { + while (n--) { + MEM_U8(dest_addr) = (uint8_t)byte; + ++dest_addr; + } + } + return saved; +} + +int wrapper_bcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n) { + while (n--) { + if (MEM_U8(s1_addr) != MEM_U8(s2_addr)) { + return 1; + } + ++s1_addr; + ++s2_addr; + } + return 0; +} + +int wrapper_memcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n) { + while (n--) { + unsigned char c1 = MEM_U8(s1_addr); + unsigned char c2 = MEM_U8(s2_addr); + if (c1 < c2) { + return -1; + } + if (c1 > c2) { + return 1; + } + ++s1_addr; + ++s2_addr; + } + return 0; +} + +int wrapper_getpid(void) { + return getpid(); +} + +int wrapper_getpgrp(uint8_t *mem) { + int ret = getpgrp(); + if (ret == -1) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_remove(uint8_t *mem, uint32_t path_addr) { + STRING(path) + int ret = remove(path); + if (ret < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_unlink(uint8_t *mem, uint32_t path_addr) { + if (path_addr == 0) { + fprintf(stderr, "Warning: unlink with NULL as arguement\n"); + MEM_U32(ERRNO_ADDR) = EFAULT; + return -1; + } + STRING(path) + int ret = unlink(path); + if (ret < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_close(uint8_t *mem, int fd) { + int ret = close(fd); + if (ret < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_strcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr) { + for (;;) { + char c1 = MEM_S8(s1_addr); + char c2 = MEM_S8(s2_addr); + if (c1 != c2) { + return c1 < c2 ? -1 : 1; + } + if (c1 == '\0') { + return 0; + } + ++s1_addr; + ++s2_addr; + } +} + +int wrapper_strncmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n) { + if (n == 0) { + return 0; + } + for (;;) { + char c1 = MEM_S8(s1_addr); + char c2 = MEM_S8(s2_addr); + if (c1 != c2) { + return c1 < c2 ? -1 : 1; + } + if (--n == 0 || c1 == '\0') { + return 0; + } + ++s1_addr; + ++s2_addr; + } +} + +uint32_t wrapper_strcpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr) { + uint32_t saved = dest_addr; + for (;;) { + char c = MEM_S8(src_addr); + ++src_addr; + MEM_S8(dest_addr) = c; + ++dest_addr; + if (c == '\0') { + return saved; + } + } +} + +uint32_t wrapper_strncpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n) { + uint32_t i; + for (i = 0; i < n && MEM_S8(src_addr) != '\0'; i++) { + MEM_S8(dest_addr + i) = MEM_S8(src_addr + i); + } + for (; i < n; i++) { + MEM_S8(dest_addr + i) = '\0'; + } + return dest_addr; +} + +uint32_t wrapper_strcat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr) { + uint32_t saved = dest_addr; + while (MEM_S8(dest_addr) != '\0') { + ++dest_addr; + } + while (MEM_S8(src_addr) != '\0') { + MEM_S8(dest_addr) = MEM_S8(src_addr); + ++src_addr; + ++dest_addr; + } + MEM_S8(dest_addr) = '\0'; + return saved; +} + +uint32_t wrapper_strncat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n) { + uint32_t saved = dest_addr; + while (MEM_S8(dest_addr) != '\0') { + ++dest_addr; + } + while (n-- && MEM_S8(src_addr) != '\0') { + MEM_S8(dest_addr) = MEM_S8(src_addr); + ++src_addr; + ++dest_addr; + } + MEM_S8(dest_addr) = '\0'; + return saved; +} + +uint32_t wrapper_strtok(uint8_t *mem, uint32_t str_addr, uint32_t delimiters_addr) { + if (str_addr == 0) { + str_addr = MEM_U32(STRTOK_DATA_ADDR); + } + if (str_addr == 0) { + // nothing remaining + return 0; + } + uint32_t p; + for (p = str_addr; MEM_S8(p) != '\0'; p++) { + uint32_t q; + for (q = delimiters_addr; MEM_S8(q) != '\0' && MEM_S8(q) != MEM_S8(p); q++) { + } + if (MEM_S8(q) == '\0') { + break; + } + } + if (MEM_S8(p) == '\0') { + return 0; + } + uint32_t ret = p; + for (;;) { + uint32_t q; + for (q = delimiters_addr; MEM_S8(q) != '\0' && MEM_S8(q) != MEM_S8(p); q++) { + } + if (MEM_S8(q) != '\0') { + MEM_S8(p) = '\0'; + MEM_U32(STRTOK_DATA_ADDR) = ++p; + return ret; + } + char next = MEM_S8(p); + ++p; + if (next == '\0') { + MEM_U32(STRTOK_DATA_ADDR) = 0; + return ret; + } + } +} + +uint32_t wrapper_strstr(uint8_t *mem, uint32_t str1_addr, uint32_t str2_addr) { + for (;;) { + if (MEM_S8(str1_addr) == '\0') { + return 0; + } + uint32_t s1 = str1_addr; + uint32_t s2 = str2_addr; + for (;;) { + char c2 = MEM_S8(s2); + if (c2 == '\0') { + return str1_addr; + } + if (MEM_S8(s1) == c2) { + ++s1; + ++s2; + } else { + break; + } + } + ++str1_addr; + } +} + +uint32_t wrapper_strdup(uint8_t *mem, uint32_t str_addr) { + uint32_t len = wrapper_strlen(mem, str_addr) + 1; + uint32_t ret = wrapper_malloc(mem, len); + if (ret == 0) { + MEM_U32(ERRNO_ADDR) = ENOMEM; + return 0; + } + return wrapper_memcpy(mem, ret, str_addr, len); +} + +int wrapper_toupper(int c) { + return toupper(c); +} + +int wrapper_tolower(int c) { + return tolower(c); +} + +int wrapper_gethostname(uint8_t *mem, uint32_t name_addr, uint32_t len) { + char buf[256] = {0}; + if (len > 256) { + len = 256; + } + int ret = gethostname(buf, len); + if (ret < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } else { + for (uint32_t i = 0; i < len; i++) { + MEM_S8(name_addr + i) = buf[i]; + } + } + return ret; +} + +int wrapper_isatty(uint8_t *mem, int fd) { + int ret = isatty(fd); + if (ret == 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +uint32_t wrapper_strftime(uint8_t *mem, uint32_t ptr_addr, uint32_t maxsize, uint32_t format_addr, uint32_t timeptr_addr) { + //assert(0 && "strftime not implemented"); + MEM_S8(ptr_addr) = 0; + return 0; +} + +int wrapper_times(uint8_t *mem, uint32_t buffer_addr) { + struct tms_irix { + int tms_utime; + int tms_stime; + int tms_cutime; + int tms_cstime; + } r; + struct tms t; + clock_t ret = times(&t); + if (ret == (clock_t)-1) { + MEM_U32(ERRNO_ADDR) = errno; + } else { + r.tms_utime = t.tms_utime; + r.tms_stime = t.tms_stime; + r.tms_cutime = t.tms_cutime; + r.tms_cstime = t.tms_cstime; + } + return (int)ret; +} + +int wrapper_clock(void) { + return (int)clock(); +} + +uint32_t wrapper_ctime(uint8_t *mem, uint32_t timep_addr) { + time_t t = MEM_S32(timep_addr); + char *res = ctime(&t); + size_t len = strlen(res) + 1; + uint32_t ret_addr = wrapper_malloc(mem, len); + uint32_t pos = ret_addr; + while (len--) { + MEM_S8(pos) = *res; + ++pos; + ++res; + } + return ret_addr; + //assert(0 && "ctime not implemented"); + //return 0; +} + +uint32_t wrapper_localtime(uint8_t *mem, uint32_t timep_addr) { + time_t t = MEM_S32(timep_addr); + struct irix_tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + }; + uint32_t ret = wrapper_malloc(mem, sizeof(struct irix_tm)); + struct irix_tm *r = (struct irix_tm *)&MEM_U32(ret); + struct tm *l = localtime(&t); + r->tm_sec = l->tm_sec; + r->tm_min = l->tm_min; + r->tm_hour = l->tm_hour; + r->tm_mday = l->tm_mday; + r->tm_mon = l->tm_mon; + r->tm_year = l->tm_year; + r->tm_wday = l->tm_wday; + r->tm_yday = l->tm_yday; + r->tm_isdst = l->tm_isdst; + return ret; +} + +int wrapper_setvbuf(uint8_t *mem, uint32_t fp_addr, uint32_t buf_addr, int mode, uint32_t size) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + wrapper_fflush(mem, fp_addr); + if ((f->_flag & IOMYBUF) && f->_base_addr != 0) { + wrapper_free(mem, f->_base_addr); + } + size &= ~0xf; + f->_flag &= ~IOMYBUF; + f->_base_addr = buf_addr; + f->_ptr_addr = buf_addr; + f->_cnt = 0; + bufendtab[(fp_addr - IOB_ADDR) / sizeof(struct FILE_irix)] = size; + return 0; +} + +int wrapper___semgetc(uint8_t *mem, uint32_t fp_addr) { + assert(0); +} + +int wrapper___semputc(uint8_t *mem, int c, uint32_t fp_addr) { + assert(0); +} + +int wrapper_fgetc(uint8_t *mem, uint32_t fp_addr) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + if (--f->_cnt < 0) { + return wrapper___filbuf(mem, fp_addr); + } else { + int ret = MEM_U8(f->_ptr_addr); + ++f->_ptr_addr; + return ret; + } +} + +int wrapper_fgets(uint8_t *mem, uint32_t str_addr, int count, uint32_t fp_addr) { + bool modified = false; + uint32_t saved = str_addr; + for (count--; count > 0; count--) { + int ch = wrapper_fgetc(mem, fp_addr); + if (ch == -1) { + MEM_S8(str_addr) = '\0'; + return modified ? saved : 0; + } + modified = true; + MEM_S8(str_addr) = (char)ch; + ++str_addr; + if (ch == '\n') { + break; + } + } + MEM_S8(str_addr) = '\0'; + return saved; +} + +static void file_assign_buffer(uint8_t *mem, struct FILE_irix *f) { + f->_base_addr = wrapper_malloc(mem, STDIO_BUFSIZE); + f->_ptr_addr = f->_base_addr; + f->_flag |= IOMYBUF; + f->_cnt = 0; + bufendtab[f - (struct FILE_irix *)&MEM_U32(IOB_ADDR)] = STDIO_BUFSIZE; +} + +int wrapper___filbuf(uint8_t *mem, uint32_t fp_addr) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + if (!(f->_flag & IOREAD)) { + if (f->_flag & IORW) { + f->_flag |= IOREAD; + } else { + MEM_U32(ERRNO_ADDR) = 9; // EBADF + return -1; + } + } + if (f->_base_addr == 0) { + file_assign_buffer(mem, f); + } + uint32_t size = bufendtab[(fp_addr - IOB_ADDR) / sizeof(struct FILE_irix)]; + int nread = wrapper_read(mem, f->_file, f->_base_addr, size); + int ret = -1; + if (nread > 0) { + f->_ptr_addr = f->_base_addr; + f->_cnt = nread; + ret = MEM_U8(f->_ptr_addr); + ++f->_ptr_addr; + --f->_cnt; + } else if (nread == 0) { + f->_flag |= IOEOF; + } else { + f->_flag |= IOERR; + } + return ret; +} + +int wrapper___flsbuf(uint8_t *mem, int ch, uint32_t fp_addr) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + if (wrapper_fflush(mem, fp_addr) != 0) { + return -1; + } + if (f->_base_addr == 0) { + file_assign_buffer(mem, f); + f->_cnt = bufendtab[f - (struct FILE_irix *)&MEM_U32(IOB_ADDR)]; + } + MEM_U8(f->_ptr_addr) = ch; + ++f->_ptr_addr; + --f->_cnt; + if (f->_flag & IONBF) { + if (wrapper_fflush(mem, fp_addr) != 0) { + return -1; + } + f->_cnt = 0; + } + return ch; +} + +int wrapper_ungetc(uint8_t *mem, int ch, uint32_t fp_addr) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + if (ch == -1 || f->_ptr_addr == f->_base_addr) { + return -1; + } + --f->_ptr_addr; + MEM_U8(f->_ptr_addr) = (uint8_t)ch; + ++f->_cnt; + f->_flag &= ~IOEOF; + return ch; +} + +uint32_t wrapper_gets(uint8_t *mem, uint32_t str_addr) { + uint32_t p, str0 = str_addr; + int n; + + for (;;) { + if (STDIN->_cnt <= 0) { + if (wrapper___filbuf(mem, STDIN_ADDR) == -1) { + if (str0 == str_addr) { + return 0; + } + break; + } + --STDIN->_ptr_addr; + ++STDIN->_cnt; + } + n = STDIN->_cnt; + if ((p = wrapper_memccpy(mem, str_addr, STDIN->_ptr_addr, '\n', n)) != 0) { + n = p - str_addr; + } + str_addr += n; + STDIN->_cnt -= n; + STDIN->_ptr_addr += n; + // bufsync + if (p != 0) { + // found '\n' in buffer + --str_addr; + break; + } + } + MEM_S8(str_addr) = '\0'; + return str0; +} + +uint32_t wrapper_fread(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + int nleft = count * size; + int n; + for (;;) { + if (f->_cnt <= 0) { + if (wrapper___filbuf(mem, fp_addr) == -1) { + return count - (nleft + size - 1) / size; + } + --f->_ptr_addr; + ++f->_cnt; + } + n = MIN(nleft, f->_cnt); + data_addr = wrapper_memcpy(mem, data_addr, f->_ptr_addr, n) + n; + f->_cnt -= n; + f->_ptr_addr += n; + if ((nleft -= n) <= 0) { + return count; + } + } +} + +uint32_t wrapper_fwrite(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr) { + struct FILE_irix *f = (struct FILE_irix *)&MEM_U32(fp_addr); + if (size > 0 && count > 0 && f->_base_addr == 0) { + file_assign_buffer(mem, f); + f->_cnt = bufendtab[f - (struct FILE_irix *)&MEM_U32(IOB_ADDR)]; + f->_flag |= IOWRT; + } + uint32_t num_written = 0; + while (count--) { + uint32_t s = size; + while (s > 0) { + uint32_t to_write = f->_cnt; + if (s < to_write) { + to_write = s; + } + if (f->_cnt == 0) { + if (wrapper_fflush(mem, fp_addr) != 0) { + return num_written; + } + } + wrapper_memcpy(mem, f->_ptr_addr, data_addr, to_write); + data_addr += to_write; + f->_ptr_addr += to_write; + f->_cnt -= to_write; + s -= to_write; + } + num_written++; + } + if (f->_flag & IONBF) { + wrapper_fflush(mem, fp_addr); // TODO check error return value + } + return num_written; +} + +int wrapper_fputs(uint8_t *mem, uint32_t str_addr, uint32_t fp_addr) { + uint32_t len = wrapper_strlen(mem, str_addr); + uint32_t ret = wrapper_fwrite(mem, str_addr, 1, len, fp_addr); + return ret == 0 && len != 0 ? -1 : 0; +} + +int wrapper_puts(uint8_t *mem, uint32_t str_addr) { + int ret = wrapper_fputs(mem, str_addr, STDOUT_ADDR); + if (ret != 0) { + return ret; + } + struct FILE_irix *f = STDOUT; + if (--f->_cnt < 0) { + if (wrapper___flsbuf(mem, '\n', STDOUT_ADDR) != '\n') { + return -1; + } + } else { + MEM_S8(f->_ptr_addr) = '\n'; + ++f->_ptr_addr; + } + return 0; +} + +uint32_t wrapper_getcwd(uint8_t *mem, uint32_t buf_addr, uint32_t size) { + char buf[size]; + if (getcwd(buf, size) == NULL) { + MEM_U32(ERRNO_ADDR) = errno; + return 0; + } else { + if (buf_addr == 0) { + buf_addr = wrapper_malloc(mem, size); + } + strcpy1(mem, buf_addr, buf); + return buf_addr; + } +} + +int wrapper_time(uint8_t *mem, uint32_t tloc_addr) { + time_t ret = time(NULL); + if (ret == (time_t)-1) { + MEM_U32(ERRNO_ADDR) = errno; + } else if (tloc_addr != 0) { + MEM_S32(tloc_addr) = ret; + } + return ret; +} + +void wrapper_bzero(uint8_t *mem, uint32_t str_addr, uint32_t n) { + while (n--) { + MEM_U8(str_addr) = 0; + ++str_addr; + } +} + +int wrapper_fp_class_d(double d) { + union { + uint32_t w[2]; + double d; + } bits; + bits.d = d; + uint32_t a2 = bits.w[1]; + uint32_t a1 = a2 >> 20; + uint32_t a0 = a1; + a2 &= 0xfffff; + uint32_t a3 = bits.w[0]; + a1 &= 0x7ff; + a0 &= 0x800; + if (a1 == 0x7ff) { + if (a2 == 0 && a3 == 0) { + return a0 == 0 ? 2 : 3; + } + a0 = a2 & 0x80000; + return a0 == 0 ? 1 : 0; + } + if (a1 == 0) { + if (a2 == 0 && a3 == 0) { + return a0 == 0 ? 8 : 9; + } + return a0 == 0 ? 6 : 7; + } + return a0 == 0 ? 4 : 5; +} + +double wrapper_ldexp(double d, int i) { + return ldexp(d, i); +} + +int64_t wrapper___ll_mul(int64_t a0, int64_t a1) { + return a0 * a1; +} + +int64_t wrapper___ll_div(int64_t a0, int64_t a1) { + return a0 / a1; +} + +int64_t wrapper___ll_rem(uint64_t a0, int64_t a1) { + return a0 % a1; +} + +int64_t wrapper___ll_lshift(int64_t a0, uint64_t shift) { + return a0 << (shift & 0x3f); +} + +int64_t wrapper___ll_rshift(int64_t a0, uint64_t shift) { + return a0 >> (shift & 0x3f); +} + +uint64_t wrapper___ull_div(uint64_t a0, uint64_t a1) { + return a0 / a1; +} + +uint64_t wrapper___ull_rem(uint64_t a0, uint64_t a1) { + return a0 % a1; +} + +uint64_t wrapper___ull_rshift(uint64_t a0, uint64_t shift) { + return a0 >> (shift & 0x3f); +} + +uint64_t wrapper___d_to_ull(double d) { + return d; +} + +int64_t wrapper___d_to_ll(double d) { + return d; +} + +uint64_t wrapper___f_to_ull(float f) { + return f; +} + +int64_t wrapper___f_to_ll(float f) { + return f; +} + +float wrapper___ull_to_f(uint64_t v) { + return v; +} + +float wrapper___ll_to_f(int64_t v) { + return v; +} + +double wrapper___ull_to_d(uint64_t v) { + return v; +} + +double wrapper___ll_to_d(int64_t v) { + return v; +} + +void wrapper_abort(uint8_t *mem) { + abort(); +} + +void wrapper_exit(uint8_t *mem, int status) { + exit(status); +} + +void wrapper__exit(uint8_t *mem, int status) { + assert(0 && "_exit not implemented"); // exit() is already overridden +} + +void wrapper__cleanup(uint8_t *mem) { +} + +uint32_t wrapper__rld_new_interface(uint8_t *mem, uint32_t operation, uint32_t sp) { + assert(0 && "_rld_new_interface not implemented"); + return 0; +} + +void wrapper__exithandle(uint8_t *mem) { + assert(0 && "_exithandle not implemented"); +} + +int wrapper__prctl(uint8_t *mem, int operation, uint32_t sp) { + assert(0 && "_prctl not implemented"); + return 0; +} + +double wrapper__atod(uint8_t *mem, uint32_t buffer_addr, int ndigits, int dexp) { + // ftp://atoum.hst.nerim.net/irix/src/irix-6.5.5-src/6.5.5/m/irix/lib/libc/src/math/atod.c + assert(0 && "_atod not implemented"); + return 0.0; +} + +int wrapper_pathconf(uint8_t *mem, uint32_t path_addr, int name) { + STRING(path) + if (name == 5) { + errno = 0; + int ret = pathconf(path, _PC_PATH_MAX); + if (errno != 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; + } + assert(0 && "pathconf not implemented for the specific 'name'"); + return 0; +} + +uint32_t wrapper_getenv(uint8_t *mem, uint32_t name_addr) { + // Return null for everything, for now + return 0; +} + +uint32_t wrapper_gettxt(uint8_t *mem, uint32_t msgid_addr, uint32_t default_str_addr) { + // Return default for now + return default_str_addr; +} + +uint32_t wrapper_setlocale(uint8_t *mem, int category, uint32_t locale_addr) { + assert(locale_addr != 0); + STRING(locale) + assert(category == 6); // LC_ALL + char *ret = setlocale(LC_ALL, locale); + // Let's hope the caller doesn't use the return value + return 0; +} + +uint32_t wrapper_mmap(uint8_t *mem, uint32_t addr, uint32_t length, int prot, int flags, int fd, int offset) { + assert(0 && "mmap not implemented"); + return 0; +} + +int wrapper_munmap(uint8_t *mem, uint32_t addr, uint32_t length) { + assert(0 && "munmap not implemented"); + return 0; +} + +int wrapper_mprotect(uint8_t *mem, uint32_t addr, uint32_t length, int prot) { + assert(0 && "mprotect not implemented"); + return 0; +} + +int wrapper_sysconf(uint8_t *mem, int name) { + assert(0 && "sysconf not implemented"); + return 0; +} + +int wrapper_getpagesize(uint8_t *mem) { + return 4096; +} + +int wrapper_strerror(uint8_t *mem, int errnum) { + errno = errnum; + perror("strerror"); + assert(0 && "strerror not implemented"); + return 0; +} + +int wrapper_ioctl(uint8_t *mem, int fd, uint32_t request, uint32_t sp) { + assert(0 && "ioctl not implemented"); + return 0; +} + +int wrapper_fcntl(uint8_t *mem, int fd, int cmd, uint32_t sp) { + assert(0 && "fcntl not implemented"); + return 0; +} + +static void signal_handler(int signum) { + uint32_t level = signal_context.recursion_level++; + uint8_t *mem = signal_context.handlers[signum].mem; + uint32_t fp_dest = signal_context.handlers[signum].fp_dest; + uint32_t sp = SIGNAL_HANDLER_STACK_START - 16 - level * 0x1000; + signal_context.handlers[signum].trampoline(mem, sp, signum, 0, 0, 0, fp_dest); + signal_context.recursion_level--; +} + +uint32_t wrapper_signal(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t handler_addr, uint32_t sp) { + //assert(0 && "signal not implemented"); + return 0; +} + +uint32_t wrapper_sigset(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t disp_addr, uint32_t sp) { + void (*handler)(int) = signal_handler; + + if ((int)disp_addr >= -1 && (int)disp_addr <= 1) { + // SIG_DFL etc. + handler = (void (*)(int))(intptr_t)(int)disp_addr; + } + + switch (signum) { + case 2: + signum = SIGINT; + break; + case 13: + signum = SIGPIPE; + break; + case 15: + signum = SIGTERM; + break; + default: + assert(0 && "sigset with this signum not implemented"); + break; + } + + signal_context.handlers[signum].trampoline = trampoline; + signal_context.handlers[signum].mem = mem; + signal_context.handlers[signum].fp_dest = disp_addr; + + return (uint32_t)(uintptr_t)sigset(signum, handler); // for now only support SIG_DFL etc. as return value +} + +int wrapper_get_fpc_csr(uint8_t *mem) { + //assert(0 && "get_fpc_csr not implemented"); + return 0; +} + +int wrapper_set_fpc_csr(uint8_t *mem, int csr) { + //assert(0 && "set_fpc_csr not implemented"); + return 0; +} + +int wrapper_setjmp(uint8_t *mem, uint32_t addr) { + return 0; +} + +void wrapper_longjmp(uint8_t *mem, uint32_t addr, int status) { + assert(0 && "longjmp not implemented"); +} + +uint32_t wrapper_tempnam(uint8_t *mem, uint32_t dir_addr, uint32_t pfx_addr) { + STRING(dir) + STRING(pfx) + char *ret = tempnam(dir, pfx); + char *ret_saved = ret; + if (ret == NULL) { + MEM_U32(ERRNO_ADDR) = errno; + return 0; + } + size_t len = strlen(ret) + 1; + uint32_t ret_addr = wrapper_malloc(mem, len); + uint32_t pos = ret_addr; + while (len--) { + MEM_S8(pos) = *ret; + ++pos; + ++ret; + } + free(ret_saved); + return ret_addr; +} + +uint32_t wrapper_tmpnam(uint8_t *mem, uint32_t str_addr) { + char buf[1024]; + assert(str_addr != 0 && "s NULL not implemented for tmpnam"); + char *ret = tmpnam(buf); + if (ret == NULL) { + return 0; + } else { + strcpy1(mem, str_addr, ret); + return str_addr; + } +} + +uint32_t wrapper_mktemp(uint8_t *mem, uint32_t template_addr) { + STRING(template) + mktemp(template); + strcpy1(mem, template_addr, template); + return template_addr; +} + +int wrapper_mkstemp(uint8_t *mem, uint32_t name_addr) { + STRING(name) + int fd = mkstemp(name); + if (fd < 0) { + MEM_U32(ERRNO_ADDR) = errno; + } else { + strcpy1(mem, name_addr, name); + } + return fd; +} + +uint32_t wrapper_tmpfile(uint8_t *mem) { + // create and fopen a temporary file that is removed when the program exits + char name[] = "/tmp/copt_temp_XXXXXX"; + int fd = mkstemp(name); + if (fd < 0) { + MEM_U32(ERRNO_ADDR) = errno; + return 0; + } + + // the file will be removed from disk when it's closed later + unlink(name); + + // fdopen: + uint32_t ret = init_file(mem, fd, -1, NULL, "w+"); + if (ret == 0) { + close(fd); + } + return ret; +} + +int wrapper_wait(uint8_t *mem, uint32_t wstatus_addr) { + int wstatus; + pid_t ret = wait(&wstatus); + MEM_S32(wstatus_addr) = wstatus; + return ret; +} + +int wrapper_kill(uint8_t *mem, int pid, int sig) { + int ret = kill(pid, sig); + if (ret != 0) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_execlp(uint8_t *mem, uint32_t file_addr, uint32_t sp) { + uint32_t argv_addr = sp + 4; + return wrapper_execvp(mem, file_addr, argv_addr); +} + +int wrapper_execv(uint8_t *mem, uint32_t pathname_addr, uint32_t argv_addr) { + STRING(pathname) + uint32_t argc = 0; + while (MEM_U32(argv_addr + argc * 4) != 0) { + ++argc; + } + char *argv[argc + 1]; + for (uint32_t i = 0; i < argc; i++) { + uint32_t str_addr = MEM_U32(argv_addr + i * 4); + uint32_t len = wrapper_strlen(mem, str_addr) + 1; + argv[i] = (char *)malloc(len); + char *pos = argv[i]; + while (len--) { + *pos++ = MEM_S8(str_addr); + ++str_addr; + } + } + argv[argc] = NULL; + execv(pathname, argv); + MEM_U32(ERRNO_ADDR) = errno; + for (uint32_t i = 0; i < argc; i++) { + free(argv[i]); + } + return -1; +} + +int wrapper_execvp(uint8_t *mem, uint32_t file_addr, uint32_t argv_addr) { + STRING(file) + uint32_t argc = 0; + while (MEM_U32(argv_addr + argc * 4) != 0) { + ++argc; + } + char *argv[argc + 1]; + for (uint32_t i = 0; i < argc; i++) { + uint32_t str_addr = MEM_U32(argv_addr + i * 4); + uint32_t len = wrapper_strlen(mem, str_addr) + 1; + argv[i] = (char *)malloc(len); + char *pos = argv[i]; + while (len--) { + *pos++ = MEM_S8(str_addr); + ++str_addr; + } + } + argv[argc] = NULL; + +#ifdef REDIRECT_USR_LIB + if (!strncmp(file, "/usr/lib/", 9) && bin_dir[0] != '\0') { + char fixed_path[PATH_MAX + 1]; +#ifdef __CYGWIN__ + int n = snprintf(fixed_path, sizeof(fixed_path), "%s/%s.exe", bin_dir, file + 9); +#else + int n = snprintf(fixed_path, sizeof(fixed_path), "%s/%s", bin_dir, file + 9); +#endif + if (n > 0 && n < sizeof(fixed_path)) { + execvp(fixed_path, argv); + } else { + execvp(file, argv); + } + } else { + execvp(file, argv); + } +#else + execvp(file, argv); +#endif + + MEM_U32(ERRNO_ADDR) = errno; + for (uint32_t i = 0; i < argc; i++) { + free(argv[i]); + } + return -1; +} + +int wrapper_fork(uint8_t *mem) { + int ret = fork(); + if (ret == -1) { + MEM_U32(ERRNO_ADDR) = errno; + } + return ret; +} + +int wrapper_system(uint8_t *mem, uint32_t command_addr) { + STRING(command) + return system(command); // no errno +} + +static int name_compare(uint8_t *mem, uint32_t a_addr, uint32_t b_addr) { + //printf("pc=0x00438180\n"); + return wrapper_strcmp(mem, MEM_U32(a_addr), MEM_U32(b_addr)); +} + +static uint32_t tsearch_tfind(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr, bool insert) { + //assert(compar_addr == 0x438180); // name_compare in as1 + + if (rootp_addr == 0) { + return 0; + } + while (MEM_U32(rootp_addr) != 0) { + uint32_t node_addr = MEM_U32(rootp_addr); + int r = name_compare(mem, key_addr, MEM_U32(node_addr)); + if (r == 0) { + return node_addr; + } + rootp_addr = r < 0 ? node_addr + 4 : node_addr + 8; + } + if (insert) { + uint32_t node_addr = wrapper_malloc(mem, 12); + if (node_addr != 0) { + MEM_U32(rootp_addr) = node_addr; + MEM_U32(node_addr) = key_addr; + MEM_U32(node_addr + 4) = 0; + MEM_U32(node_addr + 8) = 0; + return node_addr; + } + } + return 0; +} + +uint32_t wrapper_tsearch(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr) { + return tsearch_tfind(mem, key_addr, rootp_addr, compar_addr, true); +} + +uint32_t wrapper_tfind(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr) { + return tsearch_tfind(mem, key_addr, rootp_addr, compar_addr, false); +} + +uint32_t wrapper_qsort(uint8_t *mem, uint32_t base_addr, uint32_t num, uint32_t size, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t compare_addr, uint32_t sp) { + assert(0 && "qsort not implemented"); + return 0; +} + +uint32_t wrapper_regcmp(uint8_t *mem, uint32_t string1_addr, uint32_t sp) { + STRING(string1); + fprintf(stderr, "regex string: %s\n", string1); + assert(0 && "regcmp not implemented"); + return 0; +} + +uint32_t wrapper_regex(uint8_t *mem, uint32_t re_addr, uint32_t subject_addr, uint32_t sp) { + STRING(subject); + assert(0 && "regex not implemented"); + return 0; +} + +void wrapper___assert(uint8_t *mem, uint32_t assertion_addr, uint32_t file_addr, int line) { + STRING(assertion) + STRING(file) + __assert(assertion, file, line); +} diff --git a/tools/ido5.3_recomp/libc_impl.h b/tools/ido5.3_recomp/libc_impl.h new file mode 100644 index 00000000..0f1d920f --- /dev/null +++ b/tools/ido5.3_recomp/libc_impl.h @@ -0,0 +1,163 @@ +#include + +void mmap_initial_data_range(uint8_t *mem, uint32_t start, uint32_t end); +void setup_libc_data(uint8_t *mem); + +uint32_t wrapper_sbrk(uint8_t *mem, int increment); +uint32_t wrapper_malloc(uint8_t *mem, uint32_t size); +uint32_t wrapper_calloc(uint8_t *mem, uint32_t num, uint32_t size); +uint32_t wrapper_realloc(uint8_t *mem, uint32_t data_addr, uint32_t size); +int wrapper_fscanf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp); +int wrapper_printf(uint8_t *mem, uint32_t format_addr, uint32_t sp); +int wrapper_sprintf(uint8_t *mem, uint32_t str_addr, uint32_t format_addr, uint32_t sp); +int wrapper_fprintf(uint8_t *mem, uint32_t fp_addr, uint32_t format_addr, uint32_t sp); +int wrapper__doprnt(uint8_t *mem, uint32_t format_addr, uint32_t params_addr, uint32_t fp_addr); +void wrapper_free(uint8_t *mem, uint32_t data_addr); +uint32_t wrapper_strlen(uint8_t *mem, uint32_t str_addr); +int wrapper_open(uint8_t *mem, uint32_t pathname_addr, int flags, int mode); +int wrapper_creat(uint8_t *mem, uint32_t pathname_addr, int mode); +int wrapper_access(uint8_t *mem, uint32_t pathname_addr, int mode); +int wrapper_rename(uint8_t *mem, uint32_t oldpath_addr, uint32_t newpath_addr); +int wrapper_utime(uint8_t *mem, uint32_t filename_addr, uint32_t times_addr); +int wrapper_flock(uint8_t *mem, int fd, int operation); +int wrapper_chmod(uint8_t *mem, uint32_t path_addr, uint32_t mode); +int wrapper_umask(int mode); +uint32_t wrapper_ecvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr); +uint32_t wrapper_fcvt(uint8_t *mem, double number, int ndigits, uint32_t decpt_addr, uint32_t sign_addr); +double wrapper_sqrt(double v); +float wrapper_sqrtf(float v); +int wrapper_atoi(uint8_t *mem, uint32_t nptr_addr); +int wrapper_atol(uint8_t *mem, uint32_t nptr_addr); +double wrapper_atof(uint8_t *mem, uint32_t nptr_addr); +int wrapper_strtol(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base); +uint32_t wrapper_strtoul(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr, int base); +double wrapper_strtod(uint8_t *mem, uint32_t nptr_addr, uint32_t endptr_addr); +uint32_t wrapper_strchr(uint8_t *mem, uint32_t str_addr, int c); +uint32_t wrapper_strrchr(uint8_t *mem, uint32_t str_addr, int c); +uint32_t wrapper_strcspn(uint8_t *mem, uint32_t str_addr, uint32_t invalid_addr); +uint32_t wrapper_strpbrk(uint8_t *mem, uint32_t str_addr, uint32_t accept_addr); +int wrapper_fstat(uint8_t *mem, int fildes, uint32_t buf_addr); +int wrapper_stat(uint8_t *mem, uint32_t pathname_addr, uint32_t buf_addr); +int wrapper_ftruncate(uint8_t *mem, int fd, int length); +void wrapper_bcopy(uint8_t *mem, uint32_t src_addr, uint32_t dst_addr, uint32_t len); +uint32_t wrapper_memcpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, uint32_t len); +uint32_t wrapper_memccpy(uint8_t *mem, uint32_t dst_addr, uint32_t src_addr, int c, uint32_t len); +int wrapper_read(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes); +int wrapper_write(uint8_t *mem, int fd, uint32_t buf_addr, uint32_t nbytes); +uint32_t wrapper_fopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr); +uint32_t wrapper_freopen(uint8_t *mem, uint32_t path_addr, uint32_t mode_addr, uint32_t fp_addr); +int wrapper_fclose(uint8_t *mem, uint32_t fp_addr); +int wrapper_fflush(uint8_t *mem, uint32_t fp_addr); +int wrapper_ftell(uint8_t *mem, uint32_t fp_addr); +void wrapper_rewind(uint8_t *mem, uint32_t fp_addr); +int wrapper_fseek(uint8_t *mem, uint32_t fp_addr, int offset, int origin); +int wrapper_lseek(uint8_t *mem, int fd, int offset, int whence); +int wrapper_dup(uint8_t *mem, int fd); +int wrapper_dup2(uint8_t *mem, int oldfd, int newfd); +int wrapper_pipe(uint8_t *mem, uint32_t pipefd_addr); +void wrapper_perror(uint8_t *mem, uint32_t str_addr); +int wrapper_fdopen(uint8_t *mem, int fd, uint32_t mode_addr); +uint32_t wrapper_memset(uint8_t *mem, uint32_t dest_addr, int byte, uint32_t n); +int wrapper_bcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n); +int wrapper_memcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n); +int wrapper_getpid(void); +int wrapper_getpgrp(uint8_t *mem); +int wrapper_remove(uint8_t *mem, uint32_t path_addr); +int wrapper_unlink(uint8_t *mem, uint32_t path_addr); +int wrapper_close(uint8_t *mem, int fd); +int wrapper_strcmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr); +int wrapper_strncmp(uint8_t *mem, uint32_t s1_addr, uint32_t s2_addr, uint32_t n); +uint32_t wrapper_strcpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr); +uint32_t wrapper_strncpy(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n); +uint32_t wrapper_strcat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr); +uint32_t wrapper_strncat(uint8_t *mem, uint32_t dest_addr, uint32_t src_addr, uint32_t n); +uint32_t wrapper_strtok(uint8_t *mem, uint32_t str_addr, uint32_t delimiters_addr); +uint32_t wrapper_strstr(uint8_t *mem, uint32_t str1_addr, uint32_t str2_addr); +uint32_t wrapper_strdup(uint8_t *mem, uint32_t str_addr); +int wrapper_toupper(int c); +int wrapper_tolower(int c); +int wrapper_gethostname(uint8_t *mem, uint32_t name_addr, uint32_t len); +int wrapper_isatty(uint8_t *mem, int fd); +int wrapper_times(uint8_t *mem, uint32_t buffer_addr); +uint32_t wrapper_strftime(uint8_t *mem, uint32_t ptr_addr, uint32_t maxsize, uint32_t format_addr, uint32_t timeptr_addr); +int wrapper_clock(void); +uint32_t wrapper_ctime(uint8_t *mem, uint32_t timep_addr); +uint32_t wrapper_localtime(uint8_t *mem, uint32_t timep_addr); +int wrapper_setvbuf(uint8_t *mem, uint32_t fp_addr, uint32_t buf_addr, int mode, uint32_t size); +int wrapper___semgetc(uint8_t *mem, uint32_t fp_addr); +int wrapper___semputc(uint8_t *mem, int c, uint32_t fp_addr); +int wrapper_fgetc(uint8_t *mem, uint32_t fp_addr); +int wrapper_fgets(uint8_t *mem, uint32_t str_addr, int count, uint32_t fp_addr); +int wrapper___filbuf(uint8_t *mem, uint32_t fp_addr); +int wrapper___flsbuf(uint8_t *mem, int ch, uint32_t fp_addr); +int wrapper_ungetc(uint8_t *mem, int ch, uint32_t fp_addr); +uint32_t wrapper_gets(uint8_t *mem, uint32_t str_addr); +uint32_t wrapper_fread(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr); +uint32_t wrapper_fwrite(uint8_t *mem, uint32_t data_addr, uint32_t size, uint32_t count, uint32_t fp_addr); +int wrapper_fputs(uint8_t *mem, uint32_t str_addr, uint32_t fp_addr); +int wrapper_puts(uint8_t *mem, uint32_t str_addr); +uint32_t wrapper_getcwd(uint8_t *mem, uint32_t buf_addr, uint32_t size); +int wrapper_time(uint8_t *mem, uint32_t tloc_addr); +void wrapper_bzero(uint8_t *mem, uint32_t str_addr, uint32_t n); +int wrapper_fp_class_d(double d); +double wrapper_ldexp(double d, int i); +int64_t wrapper___ll_mul(int64_t a0, int64_t a1); +int64_t wrapper___ll_div(int64_t a0, int64_t a1); +int64_t wrapper___ll_rem(uint64_t a0, int64_t a1); +int64_t wrapper___ll_lshift(int64_t a0, uint64_t shift); +int64_t wrapper___ll_rshift(int64_t a0, uint64_t shift); +uint64_t wrapper___ull_div(uint64_t a0, uint64_t a1); +uint64_t wrapper___ull_rem(uint64_t a0, uint64_t a1); +uint64_t wrapper___ull_rshift(uint64_t a0, uint64_t shift); +uint64_t wrapper___d_to_ull(double d); +int64_t wrapper___d_to_ll(double d); +uint64_t wrapper___f_to_ull(float f); +int64_t wrapper___f_to_ll(float f); +float wrapper___ull_to_f(uint64_t v); +float wrapper___ll_to_f(int64_t v); +double wrapper___ull_to_d(uint64_t v); +double wrapper___ll_to_d(int64_t v); +void wrapper_abort(uint8_t *mem); +void wrapper_exit(uint8_t *mem, int status); +void wrapper__exit(uint8_t *mem, int status); +void wrapper__cleanup(uint8_t *mem); +uint32_t wrapper__rld_new_interface(uint8_t *mem, uint32_t operation, uint32_t sp); +void wrapper__exithandle(uint8_t *mem); +int wrapper__prctl(uint8_t *mem, int operation, uint32_t sp); +double wrapper__atod(uint8_t *mem, uint32_t buffer_addr, int ndigits, int dexp); +int wrapper_pathconf(uint8_t *mem, uint32_t path_addr, int name); +uint32_t wrapper_getenv(uint8_t *mem, uint32_t name_addr); +uint32_t wrapper_gettxt(uint8_t *mem, uint32_t msgid_addr, uint32_t default_str_addr); +uint32_t wrapper_setlocale(uint8_t *mem, int category, uint32_t locale_addr); +uint32_t wrapper_mmap(uint8_t *mem, uint32_t addr, uint32_t length, int prot, int flags, int fd, int offset); +int wrapper_munmap(uint8_t *mem, uint32_t addr, uint32_t length); +int wrapper_mprotect(uint8_t *mem, uint32_t addr, uint32_t length, int prot); +int wrapper_sysconf(uint8_t *mem, int name); +int wrapper_getpagesize(uint8_t *mem); +int wrapper_strerror(uint8_t *mem, int errnum); +int wrapper_ioctl(uint8_t *mem, int fd, uint32_t request, uint32_t sp); +int wrapper_fcntl(uint8_t *mem, int fd, int cmd, uint32_t sp); +uint32_t wrapper_signal(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t handler_addr, uint32_t sp); +uint32_t wrapper_sigset(uint8_t *mem, int signum, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t disp_addr, uint32_t sp); +int wrapper_get_fpc_csr(uint8_t *mem); +int wrapper_set_fpc_csr(uint8_t *mem, int csr); +int wrapper_setjmp(uint8_t *mem, uint32_t addr); +void wrapper_longjmp(uint8_t *mem, uint32_t addr, int status); +uint32_t wrapper_tempnam(uint8_t *mem, uint32_t dir_addr, uint32_t pfx_addr); +uint32_t wrapper_tmpnam(uint8_t *mem, uint32_t str_addr); +uint32_t wrapper_mktemp(uint8_t *mem, uint32_t template_addr); +int wrapper_mkstemp(uint8_t *mem, uint32_t name_addr); +uint32_t wrapper_tmpfile(uint8_t *mem); +int wrapper_wait(uint8_t *mem, uint32_t wstatus_addr); +int wrapper_kill(uint8_t *mem, int pid, int sig); +int wrapper_execlp(uint8_t *mem, uint32_t file_addr, uint32_t sp); +int wrapper_execv(uint8_t *mem, uint32_t pathname_addr, uint32_t argv_addr); +int wrapper_execvp(uint8_t *mem, uint32_t file_addr, uint32_t argv_addr); +int wrapper_fork(uint8_t *mem); +int wrapper_system(uint8_t *mem, uint32_t command_addr); +uint32_t wrapper_tsearch(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr); +uint32_t wrapper_tfind(uint8_t *mem, uint32_t key_addr, uint32_t rootp_addr, uint32_t compar_addr); +uint32_t wrapper_qsort(uint8_t *mem, uint32_t base_addr, uint32_t num, uint32_t size, uint64_t (*trampoline)(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest), uint32_t compare_addr, uint32_t sp); +uint32_t wrapper_regcmp(uint8_t *mem, uint32_t string1_addr, uint32_t sp); +uint32_t wrapper_regex(uint8_t *mem, uint32_t re_addr, uint32_t subject_addr, uint32_t sp); +void wrapper___assert(uint8_t *mem, uint32_t assertion_addr, uint32_t file_addr, int line); diff --git a/tools/ido5.3_recomp/recomp.cpp b/tools/ido5.3_recomp/recomp.cpp new file mode 100644 index 00000000..59543056 --- /dev/null +++ b/tools/ido5.3_recomp/recomp.cpp @@ -0,0 +1,2933 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "elf.h" + +#define INSPECT_FUNCTION_POINTERS 0 // set this to 1 when testing a new program, to verify that no false function pointers are found + +#ifndef TRACE +#define TRACE 0 +#endif + +#define LABELS_64_BIT 1 + +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +#define u32be(x) (uint32_t)(((x & 0xff) << 24) + ((x & 0xff00) << 8) + ((x & 0xff0000) >> 8) + ((uint32_t)(x) >> 24)) +#define u16be(x) (uint16_t)(((x & 0xff) << 8) + ((x & 0xff00) >> 8)) +#define read_u32_be(buf) (uint32_t)(((buf)[0] << 24) + ((buf)[1] << 16) + ((buf)[2] << 8) + ((buf)[3])) + +using namespace std; + +struct Edge { + uint32_t i; + uint8_t function_entry: 1; + uint8_t function_exit: 1; + uint8_t extern_function: 1; + uint8_t function_pointer: 1; +}; + +struct Insn { + uint32_t id; + uint8_t op_count; + string mnemonic; + string op_str; + cs_mips_op operands[8]; + + uint8_t is_jump: 1; + uint8_t is_global_got_memop: 1; + uint8_t no_following_successor: 1; + int linked_insn; + union { + uint32_t linked_value; + float linked_float; + }; + uint32_t jtbl_addr; + uint32_t num_cases; + mips_reg index_reg; + vector successors; + vector predecessors; + uint64_t b_liveout; + uint64_t b_livein; + uint64_t f_livein; + uint64_t f_liveout; +}; + +struct Function { + vector returns; //points to delay slots + uint32_t end_addr; //address after end + uint32_t nargs; + uint32_t nret; + bool v0_in; + bool referenced_by_function_pointer; +}; + +static bool conservative; + +static csh handle; + +static const uint8_t *text_section; +static uint32_t text_section_len; +static uint32_t text_vaddr; + +static const uint8_t *rodata_section; +static uint32_t rodata_section_len; +static uint32_t rodata_vaddr; + +static const uint8_t *data_section; +static uint32_t data_section_len; +static uint32_t data_vaddr; + +static uint32_t bss_section_len; +static uint32_t bss_vaddr; + +static vector insns; +static set label_addresses; +static vector got_globals; +static vector got_locals; +static uint32_t gp_value; +static uint32_t gp_value_adj; + +static map symbol_names; + +static vector> data_function_pointers; +static set li_function_pointers; +static map functions; +static uint32_t main_addr; +static uint32_t mcount_addr; +static uint32_t procedure_table_start; +static uint32_t procedure_table_len; + +#define FLAG_NO_MEM 1 +#define FLAG_VARARG 2 + +static const struct { + const char *name; + const char *params; + int flags; +} extern_functions[] = { + {"exit", "vi"}, // override exit from application + {"abort", "v"}, + {"sbrk", "pi"}, + {"malloc", "pu"}, + {"calloc", "puu"}, + {"realloc", "ppu"}, + {"free", "vp"}, + {"fscanf", "ipp", FLAG_VARARG}, + {"printf", "ip", FLAG_VARARG}, + {"sprintf", "ipp", FLAG_VARARG}, + {"fprintf", "ipp", FLAG_VARARG}, + {"_doprnt", "ippp"}, + {"strlen", "up"}, + {"open", "ipii"}, + {"creat", "ipi"}, + {"access", "ipi"}, + {"rename", "ipp"}, + {"utime", "ipp"}, + {"flock", "iii"}, + {"chmod", "ipu"}, + {"umask", "ii", FLAG_NO_MEM}, + {"ecvt", "pdipp"}, + {"fcvt", "pdipp"}, + {"sqrt", "dd", FLAG_NO_MEM}, + {"sqrtf", "ff", FLAG_NO_MEM}, + {"atoi", "ip"}, + {"atol", "ip"}, + {"atof", "dp"}, + {"strtol", "ippi"}, + {"strtoul", "uppi"}, + {"strtod", "dpp"}, + {"strchr", "ppi"}, + {"strrchr", "ppi"}, + {"strcspn", "upp"}, + {"strpbrk", "ppp"}, + {"fstat", "iip"}, + {"stat", "ipp"}, + {"ftruncate", "iii"}, + {"bcopy", "vppu"}, + {"memcpy", "pppu"}, + {"memccpy", "pppiu"}, + {"read", "iipu"}, + {"write", "iipu"}, + {"fopen", "ppp"}, + {"freopen", "pppp"}, + {"fclose", "ip"}, + {"ftell", "ip"}, + {"rewind", "vp"}, + {"fseek", "ipii"}, + {"lseek", "iiii"}, + {"fflush", "ip"}, + {"dup", "ii"}, + {"dup2", "iii"}, + {"pipe", "ip"}, + {"perror", "vp"}, + {"fdopen", "iip"}, + {"memset", "ppiu"}, + {"bcmp", "ippu"}, + {"memcmp", "ippu"}, + {"getpid", "i", FLAG_NO_MEM}, + {"getpgrp", "i"}, + {"remove", "ip"}, + {"unlink", "ip"}, + {"close", "ii"}, + {"strcmp", "ipp"}, + {"strncmp", "ippu"}, + {"strcpy", "ppp"}, + {"strncpy", "pppu"}, + {"strcat", "ppp"}, + {"strncat", "pppu"}, + {"strtok", "ppp"}, + {"strstr", "ppp"}, + {"strdup", "pp"}, + {"toupper", "ii", FLAG_NO_MEM}, + {"tolower", "ii", FLAG_NO_MEM}, + {"gethostname", "ipu"}, + {"isatty", "ii"}, + {"strftime", "upupp"}, + {"times", "ip"}, + {"clock", "i", FLAG_NO_MEM}, + {"ctime", "pp"}, + {"localtime", "pp"}, + {"setvbuf", "ippiu"}, + {"__semgetc", "ip"}, + {"__semputc", "iip"}, + {"fgetc", "ip"}, + {"fgets", "ipip"}, + {"__filbuf", "ip"}, + {"__flsbuf", "iip"}, + {"ungetc", "iip"}, + {"gets", "pp"}, + {"fread", "upuup"}, + {"fwrite", "upuup"}, + {"fputs", "ipp"}, + {"puts", "ip"}, + {"getcwd", "ppu"}, + {"time", "ip"}, + {"bzero", "vpu"}, + {"fp_class_d", "id", FLAG_NO_MEM}, + {"ldexp", "ddi", FLAG_NO_MEM}, + {"__ll_mul", "lll", FLAG_NO_MEM}, + {"__ll_div", "lll", FLAG_NO_MEM}, + {"__ll_rem", "ljl", FLAG_NO_MEM}, + {"__ll_lshift", "llj", FLAG_NO_MEM}, + {"__ll_rshift", "llj", FLAG_NO_MEM}, + {"__ull_div", "jjj", FLAG_NO_MEM}, + {"__ull_rem", "jjj", FLAG_NO_MEM}, + {"__ull_rshift", "jjj", FLAG_NO_MEM}, + {"__d_to_ull", "jd", FLAG_NO_MEM}, + {"__d_to_ll", "ld", FLAG_NO_MEM}, + {"__f_to_ull", "jf", FLAG_NO_MEM}, + {"__f_to_ll", "lf", FLAG_NO_MEM}, + {"__ull_to_f", "fj", FLAG_NO_MEM}, + {"__ll_to_f", "fl", FLAG_NO_MEM}, + {"__ull_to_d", "dj", FLAG_NO_MEM}, + {"__ll_to_d", "dl", FLAG_NO_MEM}, + {"_exit", "vi"}, + {"_cleanup", "v"}, + {"_rld_new_interface", "pu", FLAG_VARARG}, + {"_exithandle", "v"}, + {"_prctl", "ii", FLAG_VARARG}, + {"_atod", "dpii"}, + {"pathconf", "ipi"}, + {"getenv", "pp"}, + {"gettxt", "ppp"}, + {"setlocale", "pip"}, + {"mmap", "ppuiiii"}, + {"munmap", "ipu"}, + {"mprotect", "ipui"}, + {"sysconf", "ii"}, + {"getpagesize", "i"}, + {"strerror", "pi"}, + {"ioctl", "iiu", FLAG_VARARG}, + {"fcntl", "iii", FLAG_VARARG}, + {"signal", "pit"}, + {"sigset", "pit"}, + {"get_fpc_csr", "i"}, + {"set_fpc_csr", "ii"}, + {"setjmp", "ip"}, + {"longjmp", "vpi"}, + {"tempnam", "ppp"}, + {"tmpnam", "pp"}, + {"mktemp", "pp"}, + {"mkstemp", "ip"}, + {"tmpfile", "p"}, + {"wait", "ip"}, + {"kill", "iii"}, + {"execlp", "ip", FLAG_VARARG}, + {"execv", "ipp"}, + {"execvp", "ipp"}, + {"fork", "i"}, + {"system", "ip"}, + {"tsearch", "pppp"}, + {"tfind", "pppp"}, + {"qsort", "vpuut"}, + {"regcmp", "pp", FLAG_VARARG}, + {"regex", "ppp", FLAG_VARARG}, + {"__assert", "vppi"}, +}; + +static void disassemble(void) { + csh handle; + cs_insn *disasm; + static size_t disasm_size; + assert(cs_open(CS_ARCH_MIPS, (cs_mode)(CS_MODE_MIPS64 | CS_MODE_BIG_ENDIAN), &handle) == CS_ERR_OK); + cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON); + disasm_size = cs_disasm(handle, text_section, text_section_len, text_vaddr, 0, &disasm); + for (size_t i = 0; i < disasm_size; i++) { + insns.push_back(Insn()); + Insn& insn = insns.back(); + insn.id = disasm[i].id; + insn.mnemonic = disasm[i].mnemonic; + insn.op_str = disasm[i].op_str; + if (disasm[i].detail != nullptr && disasm[i].detail->mips.op_count > 0) { + insn.op_count = disasm[i].detail->mips.op_count; + memcpy(insn.operands, disasm[i].detail->mips.operands, sizeof(insn.operands)); + } + insn.is_jump = cs_insn_group(handle, &disasm[i], MIPS_GRP_JUMP) || insn.id == MIPS_INS_JAL || insn.id == MIPS_INS_BAL || insn.id == MIPS_INS_JALR; + insn.linked_insn = -1; + } + cs_free(disasm, disasm_size); + cs_close(&handle); + + { + // Add dummy instruction to avoid out of bounds + insns.push_back(Insn()); + Insn& insn = insns.back(); + insn.id = MIPS_INS_NOP; + insn.mnemonic = "nop"; + insn.no_following_successor = true; + } +} + +static void add_function(uint32_t addr) { + if (addr >= text_vaddr && addr < text_vaddr + text_section_len) { + functions[addr]; + } +} + +static map::iterator find_function(uint32_t addr) { + if (functions.size() == 0) { + return functions.end(); + } + auto it = functions.upper_bound(addr); + if (it == functions.begin()) { + return functions.end(); + } + --it; + return it; +} + +// try to find a matching LUI for a given register +static void link_with_lui(int offset, uint32_t reg, int mem_imm) +{ +#define MAX_LOOKBACK 128 + // don't attempt to compute addresses for zero offset + // end search after some sane max number of instructions + int end_search = MAX(0, offset - MAX_LOOKBACK); + for (int search = offset - 1; search >= end_search; search--) { + // use an `if` instead of `case` block to allow breaking out of the `for` loop + if (insns[search].id == MIPS_INS_LUI) { + uint32_t rd = insns[search].operands[0].reg; + if (reg == rd) { + break; + } + } else if (insns[search].id == MIPS_INS_LW || + insns[search].id == MIPS_INS_LD || + insns[search].id == MIPS_INS_ADDIU || + //insns[search].id == MIPS_INS_ADDU || used in jump tables for offset + insns[search].id == MIPS_INS_ADD || + insns[search].id == MIPS_INS_SUB || + insns[search].id == MIPS_INS_SUBU) { + uint32_t rd = insns[search].operands[0].reg; + if (reg == rd) { + if (insns[search].id == MIPS_INS_LW && insns[search].operands[1].mem.base == MIPS_REG_GP) { + int mem_imm0 = (int)insns[search].operands[1].mem.disp; + uint32_t got_entry = (mem_imm0 + gp_value_adj) / sizeof(uint32_t); + if (got_entry < got_locals.size()) { + // used for static functions + char buf[32]; + uint32_t addr = got_locals[got_entry] + mem_imm; + insns[search].linked_insn = offset; + insns[search].linked_value = addr; + insns[offset].linked_insn = search; + insns[offset].linked_value = addr; + + //vaddr_references[addr].insert(text_vaddr + offset * 4); + + insns[search].id = MIPS_INS_LI; + insns[search].mnemonic = "li"; + sprintf(buf, "$%s, 0x%x", cs_reg_name(handle, rd), addr); + insns[search].op_str = buf; + insns[search].operands[1].type = MIPS_OP_IMM; + insns[search].operands[1].imm = addr; + + switch (insns[offset].id) { + case MIPS_INS_ADDIU: + insns[offset].id = MIPS_INS_MOVE; + insns[offset].operands[1].type = MIPS_OP_REG; + insns[offset].mnemonic = "move"; + sprintf(buf, "$%s, $%s", cs_reg_name(handle, insns[offset].operands[0].reg), cs_reg_name(handle, rd)); + insns[offset].op_str = buf; + if (addr >= text_vaddr && addr < text_vaddr + text_section_len) { + add_function(addr); + } + break; + case MIPS_INS_LB: + case MIPS_INS_LBU: + case MIPS_INS_SB: + case MIPS_INS_LH: + case MIPS_INS_LHU: + case MIPS_INS_SH: + case MIPS_INS_LW: + case MIPS_INS_SW: + case MIPS_INS_LDC1: + case MIPS_INS_LWC1: + case MIPS_INS_SWC1: + insns[offset].operands[1].mem.disp = 0; + sprintf(buf, "$%s, ($%s)", cs_reg_name(handle, insns[offset].operands[0].reg), cs_reg_name(handle, rd)); + insns[offset].op_str = buf; + break; + default: + assert(0); + } + } + break; + } else { + // ignore: reg is pointer, offset is probably struct data member + break; + } + } + } else if (insns[search].id == MIPS_INS_JR && + insns[search].operands[0].reg == MIPS_REG_RA && offset - search >= 2) { + // stop looking when previous `jr ra` is hit, + // but ignore if `offset` is branch delay slot for this `jr ra` + break; + } + } +} + +// for a given `jalr t9`, find the matching t9 load +static void link_with_jalr(int offset) +{ + // end search after some sane max number of instructions + int end_search = MAX(0, offset - MAX_LOOKBACK); + for (int search = offset - 1; search >= end_search; search--) { + if (insns[search].operands[0].reg == MIPS_REG_T9) { + if (insns[search].id == MIPS_INS_LW || insns[search].id == MIPS_INS_LI) { + if (insns[search].is_global_got_memop || insns[search].id == MIPS_INS_LI) { + char buf[32]; + sprintf(buf, "0x%x", insns[search].linked_value); + insns[search].linked_insn = offset; + insns[offset].linked_insn = search; + insns[offset].linked_value = insns[search].linked_value; + //insns[offset].label = insns[search].label; + //function_entry_points.insert(insns[search].linked_value); + insns[offset].id = MIPS_INS_JAL; + insns[offset].mnemonic = "jal"; + insns[offset].op_str = buf; + insns[offset].operands[0].type = MIPS_OP_IMM; + insns[offset].operands[0].imm = insns[search].linked_value; + insns[search].id = MIPS_INS_NOP; + insns[search].mnemonic = "nop"; + insns[search].op_str = ""; + insns[search].is_global_got_memop = false; + add_function(insns[search].linked_value); + } + break; + } else if (insns[search].id == MIPS_INS_ADDIU) { + if (insns[search].linked_insn != -1) { + //function_entry_points.insert(insns[search].linked_value); + uint32_t first = insns[search].linked_insn; + insns[search].linked_insn = offset; + insns[offset].linked_insn = first; + insns[offset].linked_value = insns[search].linked_value; + } + break; + } else if (insns[search].id == MIPS_INS_LI) { + if (insns[search].linked_insn != -1) { + //function_entry_points.insert(insns[search].linked_value); + uint32_t first = insns[search].linked_insn; + insns[search].linked_insn = offset; + insns[offset].linked_insn = first; + insns[offset].linked_value = insns[search].linked_value; + insns[search].id = MIPS_INS_NOP; + insns[search].mnemonic = "nop"; + insns[search].op_str = ""; + } + break; + } else if (insns[search].id == MIPS_INS_LD || + insns[search].id == MIPS_INS_ADDU || + insns[search].id == MIPS_INS_ADD || + insns[search].id == MIPS_INS_SUB || + insns[search].id == MIPS_INS_SUBU) { + break; + } + } else if (insns[search].id == MIPS_INS_JR && + insns[search].operands[0].reg == MIPS_REG_RA) + { + // stop looking when previous `jr ra` is hit + break; + } + } +} + +static void pass1(void) { + for (size_t i = 0; i < insns.size(); i++) { + Insn& insn = insns[i]; + if (insn.id == MIPS_INS_BAL) { + insn.id = MIPS_INS_JAL; + insn.mnemonic = "jal"; + } + if (insn.is_jump) { + if (insn.id == MIPS_INS_JAL || insn.id == MIPS_INS_J) { + uint32_t target = (uint32_t)insn.operands[0].imm; + label_addresses.insert(target); + add_function(target); + } else if (insn.id == MIPS_INS_JR) { + // sltiu $at, $ty, z + // sw $reg, offset($sp) (very seldom, one or more, usually in func entry) + // lw $gp, offset($sp) (if PIC, and very seldom) + // beqz $at, .L + // some other instruction (not always) + // lui $at, %hi(jtbl) + // sll $tx, $ty, 2 + // addu $at, $at, $tx + // lw $tx, %lo(jtbl)($at) + // nop (code compiled with 5.3) + // addu $tx, $tx, $gp (if PIC) + // jr $tx + + // IDO 7.1: + //lw at,offset(gp) + //andi t9,t8,0x3f + //sll t9,t9,0x2 + //addu at,at,t9 + //lw t9,offset(at) + //addu t9,t9,gp + //jr t9 + + // IDO 5.3: + //lw at,offset(gp) + //andi t3,t2,0x3f + //sll t3,t3,0x2 + //addu at,at,t3 + //something + //lw t3,offset(at) + //something + //addu t3,t3,gp + //jr t3 + if (i >= 7 && rodata_section != NULL) { + bool is_pic = insns[i - 1].id == MIPS_INS_ADDU && insns[i - 1].operands[2].reg == MIPS_REG_GP; + bool has_nop = insns[i - is_pic - 1].id == MIPS_INS_NOP; + bool has_extra = insns[i - is_pic - has_nop - 5].id != MIPS_INS_BEQZ; + int lw = i - is_pic - has_nop - 1; + if (insns[lw].id != MIPS_INS_LW) { + --lw; + } + if (insns[lw].id == MIPS_INS_LW && insns[lw].linked_insn != -1) { + int sltiu_index = -1; + int andi_index = -1; + uint32_t addu_index = lw - 1; + uint32_t num_cases; + bool found = false; + bool and_variant = false; + int end = 14; + if (insns[addu_index].id != MIPS_INS_ADDU) { + --addu_index; + } + mips_reg index_reg = (mips_reg)insns[addu_index - 1].operands[1].reg; + if (insns[addu_index].id != MIPS_INS_ADDU) { + goto skip; + } + if (insns[addu_index - 1].id != MIPS_INS_SLL) { + goto skip; + } + if (insns[addu_index - 1].operands[0].reg != insn.operands[0].reg) { + goto skip; + } + for (int j = 3; j <= 4; j++) { + if (insns[lw - j].id == MIPS_INS_ANDI) { + andi_index = lw - j; + break; + } + } + if (i == 368393) { + // In copt + end = 18; + } + for (int j = 5; j <= end; j++) { + if (insns[lw - has_extra - j].id == MIPS_INS_SLTIU && + insns[lw - has_extra - j].operands[0].reg == MIPS_REG_AT) + { + sltiu_index = j; + break; + } + if (insns[lw - has_extra - j].id == MIPS_INS_JR) { + // Prevent going into a previous switch + break; + } + } + if (sltiu_index != -1) { + andi_index = -1; + } + if (sltiu_index != -1 && insns[lw - has_extra - sltiu_index].id == MIPS_INS_SLTIU) { + num_cases = insns[lw - has_extra - sltiu_index].operands[2].imm; + found = true; + } else if (andi_index != -1) { + num_cases = insns[andi_index].operands[2].imm + 1; + found = true; + and_variant = true; + } else if (i == 219382) { + // Special hard case in copt where the initial sltiu is in another basic block + found = true; + num_cases = 13; + } else if (i == 370995) { + // Special hard case in copt where the initial sltiu is in another basic block + found = true; + num_cases = 12; + } + if (found) { + uint32_t jtbl_addr = insns[lw].linked_value; + if (is_pic) { + insns[i - 1].id = MIPS_INS_NOP; + } + //printf("jump table at %08x, size %u\n", jtbl_addr, num_cases); + insn.jtbl_addr = jtbl_addr; + insn.num_cases = num_cases; + insn.index_reg = index_reg; + insns[lw].id = MIPS_INS_NOP; + insns[addu_index].id = MIPS_INS_NOP; + insns[addu_index - 1].id = MIPS_INS_NOP; + if (!and_variant) { + insns[addu_index - 2].id = MIPS_INS_NOP; + } + + if (jtbl_addr < rodata_vaddr || jtbl_addr + num_cases * sizeof(uint32_t) > rodata_vaddr + rodata_section_len) { + fprintf(stderr, "jump table outside rodata\n"); + exit(EXIT_FAILURE); + } + for (uint32_t i = 0; i < num_cases; i++) { + uint32_t target_addr = read_u32_be(rodata_section + (jtbl_addr - rodata_vaddr) + i * sizeof(uint32_t)); + target_addr += gp_value; + //printf("%08X\n", target_addr); + label_addresses.insert(target_addr); + } + } + skip:; + } + } + } else { + for (int j = 0; j < insn.op_count; j++) { + if (insn.operands[j].type == MIPS_OP_IMM) { + uint32_t target = (uint32_t)insn.operands[j].imm; + label_addresses.insert(target); + } + } + } + } + switch (insns[i].id) { + // find floating point LI + case MIPS_INS_MTC1: + { + unsigned int rt = insns[i].operands[0].reg; + for (int s = i - 1; s >= 0; s--) { + if (insns[s].id == MIPS_INS_LUI && insns[s].operands[0].reg == rt) { + float f; + uint32_t lui_imm = (uint32_t)(insns[s].operands[1].imm << 16); + memcpy(&f, &lui_imm, sizeof(f)); + insns[s].operands[1].imm <<= 16; + // link up the LUI with this instruction and the float + insns[s].linked_insn = i; + insns[s].linked_float = f; + // rewrite LUI instruction to be LI + insns[s].id = MIPS_INS_LI; + insns[s].mnemonic = "li"; + break; + } else if (insns[s].id == MIPS_INS_LW || + insns[s].id == MIPS_INS_LD || + insns[s].id == MIPS_INS_LH || + insns[s].id == MIPS_INS_LHU || + insns[s].id == MIPS_INS_LB || + insns[s].id == MIPS_INS_LBU || + insns[s].id == MIPS_INS_ADDIU || + insns[s].id == MIPS_INS_ADD || + insns[s].id == MIPS_INS_SUB || + insns[s].id == MIPS_INS_SUBU) { + unsigned int rd = insns[s].operands[0].reg; + if (rt == rd) { + break; + } + } else if (insns[s].id == MIPS_INS_JR && + insns[s].operands[0].reg == MIPS_REG_RA) { + // stop looking when previous `jr ra` is hit + break; + } + } + break; + } + case MIPS_INS_SD: + case MIPS_INS_SW: + case MIPS_INS_SH: + case MIPS_INS_SB: + case MIPS_INS_LB: + case MIPS_INS_LBU: + case MIPS_INS_LD: + case MIPS_INS_LDL: + case MIPS_INS_LDR: + case MIPS_INS_LH: + case MIPS_INS_LHU: + case MIPS_INS_LW: + case MIPS_INS_LWU: + case MIPS_INS_LDC1: + case MIPS_INS_LWC1: + case MIPS_INS_LWC2: + case MIPS_INS_LWC3: + case MIPS_INS_SWC1: + case MIPS_INS_SWC2: + case MIPS_INS_SWC3: + { + unsigned int mem_rs = insns[i].operands[1].mem.base; + int mem_imm = (int)insns[i].operands[1].mem.disp; + if (mem_rs == MIPS_REG_GP) { + unsigned int got_entry = (mem_imm + gp_value_adj) / sizeof(unsigned int); + if (got_entry >= got_locals.size()) { + got_entry -= got_locals.size(); + if (got_entry < got_globals.size()) { + assert(insn.id == MIPS_INS_LW); + //printf("gp 0x%08x %s\n", mem_imm, got_globals[got_entry].name); + unsigned int dest_vaddr = got_globals[got_entry]; + insns[i].is_global_got_memop = true; + insns[i].linked_value = dest_vaddr; + //insns[i].label = got_globals[got_entry].name; + + //vaddr_references[dest_vaddr].insert(vaddr + i * 4); + //disasm_add_data_addr(state, dest_vaddr); + insns[i].id = MIPS_INS_LI; + insns[i].operands[1].imm = dest_vaddr; + char buf[32]; + sprintf(buf, "$%s, 0x%x", cs_reg_name(handle, insn.operands[0].reg), dest_vaddr); + insns[i].op_str = buf; + } + } + } else { + link_with_lui(i, mem_rs, mem_imm); + } + break; + } + case MIPS_INS_ADDIU: + case MIPS_INS_ORI: + { + unsigned int rd = insns[i].operands[0].reg; + unsigned int rs = insns[i].operands[1].reg; + int64_t imm = insns[i].operands[2].imm; + if (rs == MIPS_REG_ZERO) { // becomes LI + char buf[32]; + insns[i].id = MIPS_INS_LI; + insns[i].operands[1].imm = imm; + insns[i].mnemonic = "li"; + sprintf(buf, "$%s, %" PRIi64, cs_reg_name(handle, rd), imm); + insns[i].op_str = buf; + } else if (/*rd == rs &&*/ rd != MIPS_REG_GP) { // only look for LUI if rd and rs are the same + link_with_lui(i, rs, (int)imm); + } + break; + } + case MIPS_INS_JALR: + { + unsigned int r = insn.operands[0].reg; + if (r == MIPS_REG_T9) { + link_with_jalr(i); + if (insn.linked_insn != -1) { + char buf[32]; + sprintf(buf, "0x%x", insn.linked_value); + insn.id = MIPS_INS_JAL; + insn.mnemonic = "jal"; + insn.op_str = buf; + insn.operands[0].type = MIPS_OP_IMM; + insn.operands[0].imm = insn.linked_value; + label_addresses.insert(insn.linked_value); + add_function(insn.linked_value); + } + } + break; + } + } + if (insn.id == MIPS_INS_ADDU && insn.operands[0].reg == MIPS_REG_GP && insn.operands[1].reg == MIPS_REG_GP && insn.operands[2].reg == MIPS_REG_T9 && i >= 2) { + //state->function_entry_points.insert(vaddr + (i - 2) * 4); + for (int j = i - 2; j <= i; j++) { + insns[j].id = MIPS_INS_NOP; + insns[j].mnemonic = "nop"; + insns[j].op_str = ""; + } + } + } +} + +static uint32_t addr_to_i(uint32_t addr) { + return (addr - text_vaddr) / 4; +} + +static void pass2(void) { + // Find returns in each function + for (size_t i = 0; i < insns.size(); i++) { + uint32_t addr = text_vaddr + i * 4; + Insn& insn = insns[i]; + if (insn.id == MIPS_INS_JR && insn.operands[0].reg == MIPS_REG_RA) { + auto it = find_function(addr); + assert(it != functions.end()); + it->second.returns.push_back(addr + 4); + } + if (insn.is_global_got_memop && text_vaddr <= insn.operands[1].imm && insn.operands[1].imm < text_vaddr + text_section_len) { + uint32_t faddr = insn.operands[1].imm; + li_function_pointers.insert(faddr); + functions[faddr].referenced_by_function_pointer = true; +#if INSPECT_FUNCTION_POINTERS + fprintf(stderr, "li function pointer: 0x%x at 0x%x\n", faddr, addr); +#endif + } + } + for (auto it = functions.begin(); it != functions.end(); ++it) { + if (it->second.returns.size() == 0) { + uint32_t i = addr_to_i(it->first); + auto str_it = symbol_names.find(it->first); + if (str_it != symbol_names.end() && str_it->second == "__start") { + + } else if (str_it != symbol_names.end() && str_it->second == "xmalloc") { + // orig 5.3: + /* + 496bf4: 3c1c0fb9 lui gp,0xfb9 + 496bf8: 279c366c addiu gp,gp,13932 + 496bfc: 0399e021 addu gp,gp,t9 + 496c00: 27bdffd8 addiu sp,sp,-40 + 496c04: 8f858de8 lw a1,-29208(gp) + 496c08: 10000006 b 496c24 + 496c0c: afbf0020 sw ra,32(sp) + */ + + // jal alloc_new + // lui $a1, malloc_scb + // jr $ra + // nop + uint32_t alloc_new_addr = text_vaddr + (i + 7) * 4; + insns[i].id = MIPS_INS_JAL; + insns[i].op_count = 1; + insns[i].mnemonic = "jal"; + insns[i].op_str = "alloc_new"; + insns[i].operands[0].imm = alloc_new_addr; + assert(symbol_names.count(alloc_new_addr) && symbol_names[alloc_new_addr] == "alloc_new"); + i++; + if (insns[i + 5].id == MIPS_INS_LI) { + // 7.1 + insns[i] = insns[i + 5]; + } else { + // 5.3 + insns[i] = insns[i + 3]; + } + i++; + insns[i].id = MIPS_INS_JR; + insns[i].op_count = 1; + insns[i].mnemonic = "jr"; + insns[i].op_str = "$ra"; + insns[i].operands[0].reg = MIPS_REG_RA; + it->second.returns.push_back(text_vaddr + i * 4 + 4); + i++; + for (uint32_t j = 0; j < 4; j++) { + insns[i].id = MIPS_INS_NOP; + insns[i].op_count = 0; + insns[i].mnemonic = "nop"; + i++; + } + } else if (str_it != symbol_names.end() && str_it->second == "xfree") { + // jal alloc_dispose + // lui $a1, malloc_scb + // jr $ra + // nop + uint32_t alloc_dispose_addr = text_vaddr + (i + 4) * 4; + if (symbol_names.count(alloc_dispose_addr + 4) && symbol_names[alloc_dispose_addr + 4] == "alloc_dispose") { + alloc_dispose_addr += 4; + } + insns[i].id = MIPS_INS_JAL; + insns[i].op_count = 1; + insns[i].mnemonic = "jal"; + insns[i].op_str = "alloc_dispose"; + insns[i].operands[0].imm = alloc_dispose_addr; + assert(symbol_names.count(alloc_dispose_addr) && symbol_names[alloc_dispose_addr] == "alloc_dispose"); + i++; + insns[i] = insns[i + 2]; + i++; + insns[i].id = MIPS_INS_JR; + insns[i].op_count = 1; + insns[i].mnemonic = "jr"; + insns[i].op_str = "$ra"; + insns[i].operands[0].reg = MIPS_REG_RA; + it->second.returns.push_back(text_vaddr + i * 4 + 4); + i++; + insns[i].id = MIPS_INS_NOP; + insns[i].op_count = 0; + insns[i].mnemonic = "nop"; + } else if (insns[i].id == MIPS_INS_LW && insns[i + 1].id == MIPS_INS_MOVE && insns[i + 2].id == MIPS_INS_JALR) { + /* + 408f50: 8f998010 lw t9,-32752(gp) + 408f54: 03e07821 move t7,ra + 408f58: 0320f809 jalr t9 + */ + } else if (it->first > mcount_addr) { + fprintf(stderr, "no ret: 0x%x\n", it->first); + abort(); + } + } + auto next = it; + ++next; + if (next == functions.end()) { + it->second.end_addr = text_vaddr + text_section_len; + } else { + it->second.end_addr = next->first; + } + } +} + +static void add_edge(uint32_t from, uint32_t to, bool function_entry = false, bool function_exit = false, bool extern_function = false, bool function_pointer = false) { + Edge fe = Edge(), be = Edge(); + fe.i = to; + be.i = from; + fe.function_entry = function_entry; + be.function_entry = function_entry; + fe.function_exit = function_exit; + be.function_exit = function_exit; + fe.extern_function = extern_function; + be.extern_function = extern_function; + fe.function_pointer = function_pointer; + be.function_pointer = function_pointer; + insns[from].successors.push_back(fe); + insns[to].predecessors.push_back(be); +} + +static void pass3(void) { + // Build graph + for (size_t i = 0; i < insns.size(); i++) { + uint32_t addr = text_vaddr + i * 4; + Insn& insn = insns[i]; + if (insn.no_following_successor) { + continue; + } + switch (insn.id) { + case MIPS_INS_BEQ: + case MIPS_INS_BGEZ: + case MIPS_INS_BGTZ: + case MIPS_INS_BLEZ: + case MIPS_INS_BLTZ: + case MIPS_INS_BNE: + case MIPS_INS_BEQZ: + case MIPS_INS_BNEZ: + case MIPS_INS_BC1F: + case MIPS_INS_BC1T: + add_edge(i, i + 1); + add_edge(i + 1, addr_to_i((uint32_t)insn.operands[insn.op_count - 1].imm)); + break; + + case MIPS_INS_BEQL: + case MIPS_INS_BGEZL: + case MIPS_INS_BGTZL: + case MIPS_INS_BLEZL: + case MIPS_INS_BLTZL: + case MIPS_INS_BNEL: + case MIPS_INS_BC1FL: + case MIPS_INS_BC1TL: + add_edge(i, i + 1); + add_edge(i, i + 2); + add_edge(i + 1, addr_to_i((uint32_t)insn.operands[insn.op_count - 1].imm)); + insns[i + 1].no_following_successor = true; // don't inspect delay slot + break; + + case MIPS_INS_B: + case MIPS_INS_J: + add_edge(i, i + 1); + add_edge(i + 1, addr_to_i((uint32_t)insn.operands[0].imm)); + insns[i + 1].no_following_successor = true; // don't inspect delay slot + break; + + case MIPS_INS_JR: { + add_edge(i, i + 1); + if (insn.jtbl_addr != 0) { + uint32_t jtbl_pos = insn.jtbl_addr - rodata_vaddr; + assert(jtbl_pos < rodata_section_len && jtbl_pos + insn.num_cases * 4 <= rodata_section_len); + for (uint32_t j = 0; j < insn.num_cases; j++) { + uint32_t dest_addr = read_u32_be(rodata_section + jtbl_pos + j * 4) + gp_value; + add_edge(i + 1, addr_to_i(dest_addr)); + } + } else { + assert(insn.operands[0].reg == MIPS_REG_RA && "jump to address in register not supported"); + } + insns[i + 1].no_following_successor = true; // don't inspect delay slot + break; + } + + case MIPS_INS_JAL: { + add_edge(i, i + 1); + uint32_t dest = (uint32_t)insn.operands[0].imm; + if (dest > mcount_addr && dest >= text_vaddr && dest < text_vaddr + text_section_len) { + add_edge(i + 1, addr_to_i(dest), true); + auto it = functions.find(dest); + assert(it != functions.end()); + for (uint32_t ret_instr : it->second.returns) { + add_edge(addr_to_i(ret_instr), i + 2, false, true); + } + } else { + add_edge(i + 1, i + 2, false, false, true); + } + insns[i + 1].no_following_successor = true; // don't inspect delay slot + break; + } + + case MIPS_INS_JALR: + // function pointer + add_edge(i, i + 1); + add_edge(i + 1, i + 2, false, false, false, true); + insns[i + 1].no_following_successor = true; // don't inspect delay slot + break; + + default: + add_edge(i, i + 1); + break; + } + } +} + +static uint64_t map_reg(int32_t reg) { + if (reg > MIPS_REG_31) { + if (reg == MIPS_REG_HI) { + reg = MIPS_REG_31 + 1; + } else if (reg == MIPS_REG_LO) { + reg = MIPS_REG_31 + 2; + } else { + return 0; + } + } + return (uint64_t)1 << (reg - MIPS_REG_0 + 1); +} + +static uint64_t temporary_regs(void) { + return + map_reg(MIPS_REG_T0) | + map_reg(MIPS_REG_T1) | + map_reg(MIPS_REG_T2) | + map_reg(MIPS_REG_T3) | + map_reg(MIPS_REG_T4) | + map_reg(MIPS_REG_T5) | + map_reg(MIPS_REG_T6) | + map_reg(MIPS_REG_T7) | + map_reg(MIPS_REG_T8) | + map_reg(MIPS_REG_T9); +} + +typedef enum { + TYPE_NOP, + TYPE_1S, + TYPE_2S, + TYPE_1D, + TYPE_1D_1S, + TYPE_1D_2S, + TYPE_D_LO_HI_2S, + TYPE_1S_POS1 +} TYPE; +static TYPE insn_to_type(Insn& i) { + switch (i.id) { + case MIPS_INS_ADD: + case MIPS_INS_ADDU: + if (i.mnemonic != "add.s" && i.mnemonic != "add.d") { + return TYPE_1D_2S; + } else { + return TYPE_NOP; + } + + case MIPS_INS_ADDI: + case MIPS_INS_ADDIU: + case MIPS_INS_ANDI: + case MIPS_INS_ORI: + case MIPS_INS_LB: + case MIPS_INS_LBU: + case MIPS_INS_LH: + case MIPS_INS_LHU: + case MIPS_INS_LW: + case MIPS_INS_LWL: + //case MIPS_INS_LWR: + case MIPS_INS_MOVE: + case MIPS_INS_NEGU: + case MIPS_INS_NOT: + case MIPS_INS_SLL: + case MIPS_INS_SLTI: + case MIPS_INS_SLTIU: + case MIPS_INS_SRA: + case MIPS_INS_SRL: + case MIPS_INS_XORI: + return TYPE_1D_1S; + + case MIPS_INS_MFHI: + i.operands[1].reg = MIPS_REG_HI; + return TYPE_1D_1S; + + case MIPS_INS_MFLO: + i.operands[1].reg = MIPS_REG_LO; + return TYPE_1D_1S; + + case MIPS_INS_AND: + case MIPS_INS_OR: + case MIPS_INS_NOR: + case MIPS_INS_SLLV: + case MIPS_INS_SLT: + case MIPS_INS_SLTU: + case MIPS_INS_SRAV: + case MIPS_INS_SRLV: + case MIPS_INS_SUBU: + case MIPS_INS_XOR: + return TYPE_1D_2S; + + case MIPS_INS_CFC1: + case MIPS_INS_MFC1: + case MIPS_INS_LI: + case MIPS_INS_LUI: + return TYPE_1D; + + case MIPS_INS_CTC1: + case MIPS_INS_BGEZ: + case MIPS_INS_BGEZL: + case MIPS_INS_BGTZ: + case MIPS_INS_BGTZL: + case MIPS_INS_BLEZ: + case MIPS_INS_BLEZL: + case MIPS_INS_BLTZ: + case MIPS_INS_BLTZL: + case MIPS_INS_BEQZ: + case MIPS_INS_BNEZ: + case MIPS_INS_MTC1: + return TYPE_1S; + + case MIPS_INS_BEQ: + case MIPS_INS_BEQL: + case MIPS_INS_BNE: + case MIPS_INS_BNEL: + case MIPS_INS_SB: + case MIPS_INS_SH: + case MIPS_INS_SW: + case MIPS_INS_SWL: + //case MIPS_INS_SWR: + case MIPS_INS_TNE: + case MIPS_INS_TEQ: + case MIPS_INS_TGE: + case MIPS_INS_TGEU: + case MIPS_INS_TLT: + return TYPE_2S; + + case MIPS_INS_DIV: + if (i.mnemonic != "div.s" && i.mnemonic != "div.d") { + return TYPE_D_LO_HI_2S; + } else { + return TYPE_NOP; + } + + case MIPS_INS_DIVU: + case MIPS_INS_MULT: + case MIPS_INS_MULTU: + return TYPE_D_LO_HI_2S; + + case MIPS_INS_NEG: + if (i.mnemonic != "neg.s" && i.mnemonic != "neg.d") { + return TYPE_1D_1S; + } else { + return TYPE_NOP; + } + + case MIPS_INS_JALR: + return TYPE_1S; + + case MIPS_INS_JR: + if (i.jtbl_addr != 0) { + i.operands[0].reg = i.index_reg; + } + if (i.operands[0].reg == MIPS_REG_RA) { + return TYPE_NOP; + } + return TYPE_1S; + + case MIPS_INS_LWC1: + case MIPS_INS_LDC1: + case MIPS_INS_SWC1: + case MIPS_INS_SDC1: + return TYPE_1S_POS1; + + default: + return TYPE_NOP; + } +} + +static void pass4(void) { + vector q; + uint64_t livein_func_start = 1U | map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | map_reg(MIPS_REG_SP) | map_reg(MIPS_REG_ZERO); + + q.push_back(main_addr); + insns[addr_to_i(main_addr)].f_livein = livein_func_start; + + for (auto& it : data_function_pointers) { + q.push_back(it.second); + insns[addr_to_i(it.second)].f_livein = livein_func_start | map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3); + } + for (auto& addr : li_function_pointers) { + q.push_back(addr); + insns[addr_to_i(addr)].f_livein = livein_func_start | map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3); + } + + while (!q.empty()) { + uint32_t addr = q.back(); + q.pop_back(); + uint32_t idx = addr_to_i(addr); + Insn& i = insns[idx]; + uint64_t live = i.f_livein | 1; + switch (insn_to_type(i)) { + case TYPE_1D: + live |= map_reg(i.operands[0].reg); + break; + + case TYPE_1D_1S: + if (live & map_reg(i.operands[1].reg)) { + live |= map_reg(i.operands[0].reg); + } + break; + + case TYPE_1D_2S: + if ((live & map_reg(i.operands[1].reg)) && (live & map_reg(i.operands[2].reg))) { + live |= map_reg(i.operands[0].reg); + } + break; + + case TYPE_D_LO_HI_2S: + if ((live & map_reg(i.operands[0].reg)) && (live & map_reg(i.operands[1].reg))) { + live |= map_reg(MIPS_REG_LO); + live |= map_reg(MIPS_REG_HI); + } + break; + } + if ((i.f_liveout | live) == i.f_liveout) { + // No new bits + continue; + } + live |= i.f_liveout; + i.f_liveout = live; + + bool function_entry = false; + for (Edge& e : i.successors) { + uint64_t new_live = live; + if (e.function_exit) { + new_live &= 1U | map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_V1) | map_reg(MIPS_REG_ZERO); + } else if (e.function_entry) { + new_live &= 1U | map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | + map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3) | map_reg(MIPS_REG_SP) | map_reg(MIPS_REG_ZERO); + function_entry = true; + } else if (e.extern_function) { + string name; + bool is_extern_function = false; + size_t extern_function_id; + auto it = symbol_names.find(insns[idx - 1].operands[0].imm); + if (it != symbol_names.end()) { + name = it->second; + for (size_t i = 0; i < sizeof(extern_functions) / sizeof(extern_functions[0]); i++) { + if (name == extern_functions[i].name) { + is_extern_function = true; + extern_function_id = i; + break; + } + } + if (!is_extern_function) { + fprintf(stderr, "missing extern function: %s\n", name.c_str()); + } + } + assert(is_extern_function); + auto& fn = extern_functions[extern_function_id]; + char ret_type = fn.params[0]; + new_live &= ~(map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | + map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3) | map_reg(MIPS_REG_V1) | temporary_regs()); + switch (ret_type) { + case 'i': + case 'u': + case 'p': + new_live |= map_reg(MIPS_REG_V0); + break; + case 'f': + break; + case 'd': + break; + case 'v': + break; + case 'l': + case 'j': + new_live |= map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_V1); + break; + } + } else if (e.function_pointer) { + new_live &= ~(map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | + map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3) | map_reg(MIPS_REG_V1) | temporary_regs()); + new_live |= map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_V1); + } + if ((insns[e.i].f_livein | new_live) != insns[e.i].f_livein) { + insns[e.i].f_livein |= new_live; + q.push_back(text_vaddr + e.i * 4); + } + } + if (function_entry) { + // add one edge that skips the function call, for callee-saved register liveness propagation + live &= ~(map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | + map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3) | map_reg(MIPS_REG_V1) | temporary_regs()); + if ((insns[idx + 1].f_livein | live) != insns[idx + 1].f_livein) { + insns[idx + 1].f_livein |= live; + q.push_back(text_vaddr + (idx + 1) * 4); + } + } + } +} + +static void pass5(void) { + vector q; + + assert(functions.count(main_addr)); + + q = functions[main_addr].returns; + for (auto addr : q) { + insns[addr_to_i(addr)].b_liveout = 1U | map_reg(MIPS_REG_V0); + } + for (auto& it : data_function_pointers) { + for (auto addr : functions[it.second].returns) { + q.push_back(addr); + insns[addr_to_i(addr)].b_liveout = 1U | map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_V1); + } + } + for (auto& func_addr : li_function_pointers) { + for (auto addr : functions[func_addr].returns) { + q.push_back(addr); + insns[addr_to_i(addr)].b_liveout = 1U | map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_V1); + } + } + for (size_t i = 0; i < insns.size(); i++) { + if (insns[i].f_livein != 0) { + // Instruction is reachable + q.push_back(text_vaddr + i * 4); + } + } + + while (!q.empty()) { + uint32_t addr = q.back(); + q.pop_back(); + uint32_t idx = addr_to_i(addr); + Insn& i = insns[idx]; + uint64_t live = i.b_liveout | 1; + switch (insn_to_type(i)) { + case TYPE_1S: + live |= map_reg(i.operands[0].reg); + break; + + case TYPE_1S_POS1: + live |= map_reg(i.operands[1].reg); + break; + + case TYPE_2S: + live |= map_reg(i.operands[0].reg); + live |= map_reg(i.operands[1].reg); + break; + + case TYPE_1D: + live &= ~map_reg(i.operands[0].reg); + break; + + case TYPE_1D_1S: + if (live & map_reg(i.operands[0].reg)) { + live &= ~map_reg(i.operands[0].reg); + live |= map_reg(i.operands[1].reg); + } + break; + + case TYPE_1D_2S: + if (live & map_reg(i.operands[0].reg)) { + live &= ~map_reg(i.operands[0].reg); + live |= map_reg(i.operands[1].reg); + live |= map_reg(i.operands[2].reg); + } + break; + + case TYPE_D_LO_HI_2S: { + bool used = (live & map_reg(MIPS_REG_LO)) || (live & map_reg(MIPS_REG_HI)); + live &= ~map_reg(MIPS_REG_LO); + live &= ~map_reg(MIPS_REG_HI); + if (used) { + live |= map_reg(i.operands[0].reg); + live |= map_reg(i.operands[1].reg); + } + break; + } + } + if ((i.b_livein | live) == i.b_livein) { + // No new bits + continue; + } + live |= i.b_livein; + i.b_livein = live; + + bool function_exit = false; + for (Edge& e : i.predecessors) { + uint64_t new_live = live; + if (e.function_exit) { + new_live &= 1U | map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_V1); + function_exit = true; + } else if (e.function_entry) { + new_live &= 1U | map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | + map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3) | map_reg(MIPS_REG_SP); + } else if (e.extern_function) { + string name; + bool is_extern_function = false; + size_t extern_function_id; + auto it = symbol_names.find(insns[idx - 2].operands[0].imm); + if (it != symbol_names.end()) { + name = it->second; + for (size_t i = 0; i < sizeof(extern_functions) / sizeof(extern_functions[0]); i++) { + if (name == extern_functions[i].name) { + is_extern_function = true; + extern_function_id = i; + break; + } + } + } + assert(is_extern_function); + auto& fn = extern_functions[extern_function_id]; + uint64_t args = 1U; + if (fn.flags & FLAG_VARARG) { + // Assume the worst, that all four registers are used + for (int j = 0; j < 4; j++) { + args |= map_reg(MIPS_REG_A0 + j); + } + } + int pos = 0; + int pos_float = 0; + bool only_floats_so_far = true; + for (const char *p = fn.params + 1; *p != '\0'; ++p) { + switch (*p) { + case 'i': + case 'u': + case 'p': + case 't': + only_floats_so_far = false; + if (pos < 4) { + args |= map_reg(MIPS_REG_A0 + pos); + } + ++pos; + break; + case 'f': + if (only_floats_so_far && pos_float < 4) { + pos_float += 2; + } else if (pos < 4) { + args |= map_reg(MIPS_REG_A0 + pos); + } + ++pos; + break; + case 'd': + if (pos % 1 != 0) { + ++pos; + } + if (only_floats_so_far && pos_float < 4) { + pos_float += 2; + } else if (pos < 4) { + args |= map_reg(MIPS_REG_A0 + pos) | map_reg(MIPS_REG_A0 + pos + 1); + } + pos += 2; + break; + case 'l': + case 'j': + if (pos % 1 != 0) { + ++pos; + } + only_floats_so_far = false; + if (pos < 4) { + args |= map_reg(MIPS_REG_A0 + pos) | map_reg(MIPS_REG_A0 + pos + 1); + } + pos += 2; + break; + } + } + args |= map_reg(MIPS_REG_SP); + new_live &= ~(map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | + map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3) | map_reg(MIPS_REG_V1) | temporary_regs()); + new_live |= args; + } else if (e.function_pointer) { + new_live &= ~(map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | + map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3) | map_reg(MIPS_REG_V1) | temporary_regs()); + new_live |= map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3); + } + if ((insns[e.i].b_liveout | new_live) != insns[e.i].b_liveout) { + insns[e.i].b_liveout |= new_live; + q.push_back(text_vaddr + e.i * 4); + } + } + if (function_exit) { + // add one edge that skips the function call, for callee-saved register liveness propagation + live &= ~(map_reg(MIPS_REG_V0) | map_reg(MIPS_REG_A0) | map_reg(MIPS_REG_A1) | + map_reg(MIPS_REG_A2) | map_reg(MIPS_REG_A3) | map_reg(MIPS_REG_V1) | temporary_regs()); + if ((insns[idx - 1].b_liveout | live) != insns[idx - 1].b_liveout) { + insns[idx - 1].b_liveout |= live; + q.push_back(text_vaddr + (idx - 1) * 4); + } + } + } +} + +static void pass6(void) { + for (auto& it : functions) { + uint32_t addr = it.first; + Function& f = it.second; + for (uint32_t ret : f.returns) { + Insn& i = insns[addr_to_i(ret)]; + if (i.f_liveout & i.b_liveout & map_reg(MIPS_REG_V1)) { + f.nret = 2; + } else if ((i.f_liveout & i.b_liveout & map_reg(MIPS_REG_V0)) && f.nret == 0) { + f.nret = 1; + } + } + Insn& insn = insns.at(addr_to_i(addr)); + for (int i = 0; i < 4; i++) { + if (insn.f_livein & insn.b_livein & map_reg(MIPS_REG_A0 + i)) { + f.nargs = 1 + i; + } + } + f.v0_in = (insn.f_livein & insn.b_livein & map_reg(MIPS_REG_V0)) != 0 && !f.referenced_by_function_pointer; + } +} + +static void dump(void) { + for (size_t i = 0; i < insns.size(); i++) { + Insn& insn = insns[i]; + uint32_t vaddr = text_vaddr + i * 4; + if (label_addresses.count(vaddr)) { + if (symbol_names.count(vaddr)) { + printf("L%08x: //%s\n", vaddr, symbol_names[vaddr].c_str()); + } else { + printf("L%08x:\n", vaddr); + } + } + printf("\t%s %s\n", insn.mnemonic.c_str(), insn.op_str.c_str()); + } +} + +static const char *r(uint32_t reg) { + return cs_reg_name(handle, reg); +} + +static const char *wr(uint32_t reg) { + static const char *regs[] = { + "f0.w[0]", "f0.w[1]", + "f2.w[0]", "f2.w[1]", + "f4.w[0]", "f4.w[1]", + "f6.w[0]", "f6.w[1]", + "f8.w[0]", "f8.w[1]", + "f10.w[0]", "f10.w[1]", + "f12.w[0]", "f12.w[1]", + "f14.w[0]", "f14.w[1]", + "f16.w[0]", "f16.w[1]", + "f18.w[0]", "f18.w[1]", + "f20.w[0]", "f20.w[1]", + "f22.w[0]", "f22.w[1]", + "f24.w[0]", "f24.w[1]", + "f26.w[0]", "f26.w[1]", + "f28.w[0]", "f28.w[1]", + "f30.w[0]", "f30.w[1]" + }; + assert(reg >= MIPS_REG_F0 && reg <= MIPS_REG_F31); + return regs[reg - MIPS_REG_F0]; +} + +static const char *fr(uint32_t reg) { + static const char *regs[] = { + "f0.f[0]", "f0.f[1]", + "f2.f[0]", "f2.f[1]", + "f4.f[0]", "f4.f[1]", + "f6.f[0]", "f6.f[1]", + "f8.f[0]", "f8.f[1]", + "f10.f[0]", "f10.f[1]", + "f12.f[0]", "f12.f[1]", + "f14.f[0]", "f14.f[1]", + "f16.f[0]", "f16.f[1]", + "f18.f[0]", "f18.f[1]", + "f20.f[0]", "f20.f[1]", + "f22.f[0]", "f22.f[1]", + "f24.f[0]", "f24.f[1]", + "f26.f[0]", "f26.f[1]", + "f28.f[0]", "f28.f[1]", + "f30.f[0]", "f30.f[1]" + }; + assert(reg >= MIPS_REG_F0 && reg <= MIPS_REG_F31); + return regs[reg - MIPS_REG_F0]; +} + +static const char *dr(uint32_t reg) { + static const char *regs[] = { + "f0.d", + "f2.d", + "f4.d", + "f6.d", + "f8.d", + "f10.d", + "f12.d", + "f14.d", + "f16.d", + "f18.d", + "f20.d", + "f22.d", + "f24.d", + "f26.d", + "f28.d", + "f30.d" + }; + assert(reg >= MIPS_REG_F0 && reg <= MIPS_REG_F31 && (reg - MIPS_REG_F0) % 2 == 0); + return regs[(reg - MIPS_REG_F0) / 2]; +} + +static void dump_instr(int i); + +static void dump_cond_branch(int i, const char *lhs, const char *op, const char *rhs) { + Insn& insn = insns[i]; + const char *cast1 = ""; + const char *cast2 = ""; + if (strcmp(op, "==") && strcmp(op, "!=")) { + cast1 = "(int)"; + if (strcmp(rhs, "0")) { + cast2 = "(int)"; + } + } + printf("if (%s%s %s %s%s) {", cast1, lhs, op, cast2, rhs); + dump_instr(i + 1); + printf("goto L%x;}\n", (uint32_t)insn.operands[insn.op_count - 1].imm); +} + +static void dump_cond_branch_likely(int i, const char *lhs, const char *op, const char *rhs) { + uint32_t target = text_vaddr + (i + 2) * 4; + dump_cond_branch(i, lhs, op, rhs); + if (!TRACE) { + printf("else goto L%x;\n", target); + } else { + printf("else {printf(\"pc=0x%08x (ignored)\\n\"); goto L%x;}\n", text_vaddr + (i + 1) * 4, target); + } + label_addresses.insert(target); +} + +static void dump_instr(int i) { + const char *symbol_name = NULL; + if (symbol_names.count(text_vaddr + i * 4) != 0) { + symbol_name = symbol_names[text_vaddr + i * 4].c_str(); + printf("//%s:\n", symbol_name); + } + if (TRACE) { + printf("++cnt; printf(\"pc=0x%08x%s%s\\n\"); ", text_vaddr + i * 4, symbol_name ? " " : "", symbol_name ? symbol_name : ""); + } + Insn& insn = insns[i]; + if (!insn.is_jump && !conservative) { + switch (insn_to_type(insn)) { + case TYPE_1S: + if (!(insn.f_livein & map_reg(insn.operands[0].reg))) { + printf("// fdead %llx ", (unsigned long long)insn.f_livein); + } + break; + case TYPE_1S_POS1: + if (!(insn.f_livein & map_reg(insn.operands[1].reg))) { + printf("// fdead %llx ", (unsigned long long)insn.f_livein); + } + break; + case TYPE_2S: + if (!(insn.f_livein & map_reg(insn.operands[0].reg)) || !(insn.f_livein & map_reg(insn.operands[1].reg))) { + printf("// fdead %llx ", (unsigned long long)insn.f_livein); + } + break; + case TYPE_1D_2S: + if (!(insn.f_livein & map_reg(insn.operands[2].reg))) { + printf("// fdead %llx ", (unsigned long long)insn.f_livein); + break; + } + // fallthrough + case TYPE_1D_1S: + if (!(insn.f_livein & map_reg(insn.operands[1].reg))) { + printf("// fdead %llx ", (unsigned long long)insn.f_livein); + break; + } + // fallthrough + case TYPE_1D: + if (!(insn.b_liveout & map_reg(insn.operands[0].reg))) { + printf("// bdead %llx ", (unsigned long long)insn.b_liveout); + } + break; + case TYPE_D_LO_HI_2S: + if (!(insn.f_livein & map_reg(insn.operands[0].reg)) || !(insn.f_livein & map_reg(insn.operands[1].reg))) { + printf("// fdead %llx ", (unsigned long long)insn.f_livein); + break; + } + if (!(insn.b_liveout & (map_reg(MIPS_REG_LO) | map_reg(MIPS_REG_HI)))) { + printf("// bdead %llx ", (unsigned long long)insn.b_liveout); + } + break; + } + } + switch (insn.id) { + case MIPS_INS_ADD: + case MIPS_INS_ADDU: + if (insn.mnemonic == "add.s") { + printf("%s = %s + %s;\n", fr(insn.operands[0].reg), fr(insn.operands[1].reg), fr(insn.operands[2].reg)); + } else if (insn.mnemonic == "add.d") { + printf("%s = %s + %s;\n", dr(insn.operands[0].reg), dr(insn.operands[1].reg), dr(insn.operands[2].reg)); + } else { + printf("%s = %s + %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + } + break; + case MIPS_INS_ADDI: + case MIPS_INS_ADDIU: + printf("%s = %s + 0x%x;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (uint32_t)insn.operands[2].imm); + break; + case MIPS_INS_AND: + printf("%s = %s & %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_ANDI: + printf("%s = %s & 0x%x;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (uint32_t)insn.operands[2].imm); + break; + case MIPS_INS_BEQ: + dump_cond_branch(i, r(insn.operands[0].reg), "==", r(insn.operands[1].reg)); + break; + case MIPS_INS_BEQL: + dump_cond_branch_likely(i, r(insn.operands[0].reg), "==", r(insn.operands[1].reg)); + break; + case MIPS_INS_BGEZ: + dump_cond_branch(i, r(insn.operands[0].reg), ">=", "0"); + break; + case MIPS_INS_BGEZL: + dump_cond_branch_likely(i, r(insn.operands[0].reg), ">=", "0"); + break; + case MIPS_INS_BGTZ: + dump_cond_branch(i, r(insn.operands[0].reg), ">", "0"); + break; + case MIPS_INS_BGTZL: + dump_cond_branch_likely(i, r(insn.operands[0].reg), ">", "0"); + break; + case MIPS_INS_BLEZ: + dump_cond_branch(i, r(insn.operands[0].reg), "<=", "0"); + break; + case MIPS_INS_BLEZL: + dump_cond_branch_likely(i, r(insn.operands[0].reg), "<=", "0"); + break; + case MIPS_INS_BLTZ: + dump_cond_branch(i, r(insn.operands[0].reg), "<", "0"); + break; + case MIPS_INS_BLTZL: + dump_cond_branch_likely(i, r(insn.operands[0].reg), "<", "0"); + break; + case MIPS_INS_BNE: + dump_cond_branch(i, r(insn.operands[0].reg), "!=", r(insn.operands[1].reg)); + break; + case MIPS_INS_BNEL: + dump_cond_branch_likely(i, r(insn.operands[0].reg), "!=", insn.mnemonic == "bnezl" ? "0" : r(insn.operands[1].reg)); + break; + case MIPS_INS_BREAK: + printf("abort();\n"); + break; + case MIPS_INS_BEQZ: + dump_cond_branch(i, r(insn.operands[0].reg), "==", "0"); + break; + /*case MIPS_INS_BEQZL: + dump_cond_branch_likely(i, r(insn.operands[0].reg), "==", "0"); + break;*/ + case MIPS_INS_B: + dump_instr(i + 1); + printf("goto L%x;\n", (int32_t)insn.operands[0].imm); + break; + case MIPS_INS_BC1F: + case MIPS_INS_BC1T: + printf("if (%scf) {", insn.id == MIPS_INS_BC1F ? "!" : ""); + dump_instr(i + 1); + printf("goto L%x;}\n", (int32_t)insn.operands[0].imm); + break; + case MIPS_INS_BC1FL: + case MIPS_INS_BC1TL: + { + uint32_t target = text_vaddr + (i + 2) * 4; + printf("if (%scf) {", insn.id == MIPS_INS_BC1FL ? "!" : ""); + dump_instr(i + 1); + printf("goto L%x;}\n", (int32_t)insn.operands[0].imm); + if (!TRACE) { + printf("else goto L%x;\n", target); + } else { + printf("else {printf(\"pc=0x%08x (ignored)\\n\"); goto L%x;}\n", text_vaddr + (i + 1) * 4, target); + } + label_addresses.insert(target); + break; + } + case MIPS_INS_BNEZ: + dump_cond_branch(i, r(insn.operands[0].reg), "!=", "0"); + break; + /*case MIPS_INS_BNEZL: + dump_cond_branch_likely(i, r(insn.operands[0].reg), "!=", "0"); + break;*/ + case MIPS_INS_C: + if (insn.mnemonic == "c.lt.s") { + printf("cf = %s < %s;\n", fr(insn.operands[0].reg), fr(insn.operands[1].reg)); + } else if (insn.mnemonic == "c.le.s") { + printf("cf = %s <= %s;\n", fr(insn.operands[0].reg), fr(insn.operands[1].reg)); + } else if (insn.mnemonic == "c.eq.s") { + printf("cf = %s == %s;\n", fr(insn.operands[0].reg), fr(insn.operands[1].reg)); + } else if (insn.mnemonic == "c.lt.d") { + printf("cf = %s < %s;\n", dr(insn.operands[0].reg), dr(insn.operands[1].reg)); + } else if (insn.mnemonic == "c.le.d") { + printf("cf = %s <= %s;\n", dr(insn.operands[0].reg), dr(insn.operands[1].reg)); + } else if (insn.mnemonic == "c.eq.d") { + printf("cf = %s == %s;\n", dr(insn.operands[0].reg), dr(insn.operands[1].reg)); + } + break; + case MIPS_INS_CVT: + if (insn.mnemonic == "cvt.s.w") { + printf("%s = (int)%s;\n", fr(insn.operands[0].reg), wr(insn.operands[1].reg)); + } else if (insn.mnemonic == "cvt.d.w") { + printf("%s = (int)%s;\n", dr(insn.operands[0].reg), wr(insn.operands[1].reg)); + } else if (insn.mnemonic == "cvt.d.s") { + printf("%s = %s;\n", dr(insn.operands[0].reg), fr(insn.operands[1].reg)); + } else if (insn.mnemonic == "cvt.s.d") { + printf("%s = %s;\n", fr(insn.operands[0].reg), dr(insn.operands[1].reg)); + } else if (insn.mnemonic == "cvt.w.d") { + printf("%s = cvt_w_d(%s);\n", wr(insn.operands[0].reg), dr(insn.operands[1].reg)); + } else if (insn.mnemonic == "cvt.w.s") { + printf("%s = cvt_w_s(%s);\n", wr(insn.operands[0].reg), fr(insn.operands[1].reg)); + } else { + goto unimplemented; + } + break; + case MIPS_INS_CFC1: + assert(insn.operands[1].reg == MIPS_REG_31); + printf("%s = fcsr;\n", r(insn.operands[0].reg)); + break; + case MIPS_INS_CTC1: + assert(insn.operands[1].reg == MIPS_REG_31); + printf("fcsr = %s;\n", r(insn.operands[0].reg)); + break; + case MIPS_INS_DIV: + if (insn.mnemonic == "div.s") { + assert(insn.op_count == 3); + printf("%s = %s / %s;\n", fr(insn.operands[0].reg), fr(insn.operands[1].reg), fr(insn.operands[2].reg)); + } else if (insn.mnemonic == "div.d") { + assert(insn.op_count == 3); + printf("%s = %s / %s;\n", dr(insn.operands[0].reg), dr(insn.operands[1].reg), dr(insn.operands[2].reg)); + } else { + assert(insn.op_count == 2); + printf("lo = (int)%s / (int)%s; ", r(insn.operands[0].reg), r(insn.operands[1].reg)); + printf("hi = (int)%s %% (int)%s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + } + break; + case MIPS_INS_DIVU: + assert(insn.op_count == 2); + printf("lo = %s / %s; ", r(insn.operands[0].reg), r(insn.operands[1].reg)); + printf("hi = %s %% %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + break; + case MIPS_INS_MOV: + if (insn.mnemonic == "mov.s") { + printf("%s = %s;\n", fr(insn.operands[0].reg), fr(insn.operands[1].reg)); + } else if (insn.mnemonic == "mov.d") { + printf("%s = %s;\n", dr(insn.operands[0].reg), dr(insn.operands[1].reg)); + } else { + goto unimplemented; + } + break; + case MIPS_INS_MUL: + if (insn.mnemonic == "mul.s") { + printf("%s = %s * %s;\n", fr(insn.operands[0].reg), fr(insn.operands[1].reg), fr(insn.operands[2].reg)); + } else if (insn.mnemonic == "mul.d") { + printf("%s = %s * %s;\n", dr(insn.operands[0].reg), dr(insn.operands[1].reg), dr(insn.operands[2].reg)); + } else { + goto unimplemented; + } + break; + case MIPS_INS_NEG: + if (insn.mnemonic == "neg.s") { + printf("%s = -%s;\n", fr(insn.operands[0].reg), fr(insn.operands[1].reg)); + } else if (insn.mnemonic == "neg.d") { + printf("%s = -%s;\n", dr(insn.operands[0].reg), dr(insn.operands[1].reg)); + } else { + printf("%s = -%s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + } + break; + case MIPS_INS_SUB: + if (insn.mnemonic == "sub.s") { + printf("%s = %s - %s;\n", fr(insn.operands[0].reg), fr(insn.operands[1].reg), fr(insn.operands[2].reg)); + } else if (insn.mnemonic == "sub.d") { + printf("%s = %s - %s;\n", dr(insn.operands[0].reg), dr(insn.operands[1].reg), dr(insn.operands[2].reg)); + } else { + goto unimplemented; + } + break; + case MIPS_INS_J: + dump_instr(i + 1); + printf("goto L%x;\n", (uint32_t)insn.operands[0].imm); + break; + case MIPS_INS_JAL: + { + string name; + bool is_extern_function = false; + size_t extern_function_id; + auto it = symbol_names.find(insn.operands[0].imm); + if (it != symbol_names.end()) { + name = it->second; + for (size_t i = 0; i < sizeof(extern_functions) / sizeof(extern_functions[0]); i++) { + if (name == extern_functions[i].name) { + is_extern_function = true; + extern_function_id = i; + break; + } + } + } + dump_instr(i + 1); + if (is_extern_function) { + auto& fn = extern_functions[extern_function_id]; + if (fn.flags & FLAG_VARARG) { + for (int j = 0; j < 4; j++) { + printf("MEM_U32(sp + %d) = %s;\n", j * 4, r(MIPS_REG_A0 + j)); + } + } + char ret_type = fn.params[0]; + if (ret_type != 'v') { + switch (ret_type) { + case 'i': + case 'u': + case 'p': + printf("%s = ", r(MIPS_REG_V0)); + break; + case 'f': + printf("%s = ", fr(MIPS_REG_F0)); + break; + case 'd': + printf("%s = ", dr(MIPS_REG_F0)); + break; + case 'l': + case 'j': + printf("temp64 = "); + break; + } + } + printf("wrapper_%s(", name.c_str()); + bool first = true; + if (!(fn.flags & FLAG_NO_MEM)) { + printf("mem"); + first = false; + } + int pos = 0; + int pos_float = 0; + bool only_floats_so_far = true; + bool needs_sp = false; + for (const char *p = fn.params + 1; *p != '\0'; ++p) { + if (!first) { + printf(", "); + } + first = false; + switch (*p) { + case 't': + printf("trampoline, "); + needs_sp = true; + // fallthrough + case 'i': + case 'u': + case 'p': + only_floats_so_far = false; + if (pos < 4) { + printf("%s", r(MIPS_REG_A0 + pos)); + } else { + printf("MEM_%c32(sp + %d)", *p == 'i' ? 'S' : 'U', pos * 4); + } + ++pos; + break; + case 'f': + if (only_floats_so_far && pos_float < 4) { + printf("%s", fr(MIPS_REG_F12 + pos_float)); + pos_float += 2; + } else if (pos < 4) { + printf("BITCAST_U32_TO_F32(%s)", r(MIPS_REG_A0 + pos)); + } else { + printf("BITCAST_U32_TO_F32(MEM_U32(sp + %d))", pos * 4); + } + ++pos; + break; + case 'd': + if (pos % 1 != 0) { + ++pos; + } + if (only_floats_so_far && pos_float < 4) { + printf("%s", dr(MIPS_REG_F12 + pos_float)); + pos_float += 2; + } else if (pos < 4) { + printf("BITCAST_U64_TO_F64(((uint64_t)%s << 32) | (uint64_t)%s)", r(MIPS_REG_A0 + pos), r(MIPS_REG_A0 + pos + 1)); + } else { + printf("BITCAST_U64_TO_F64(((uint64_t)MEM_U32(sp + %d) << 32) | (uint64_t)MEM_U32(sp + %d))", pos * 4, (pos + 1) * 4); + } + pos += 2; + break; + case 'l': + case 'j': + if (pos % 1 != 0) { + ++pos; + } + only_floats_so_far = false; + if (*p == 'l') { + printf("(int64_t)"); + } + if (pos < 4) { + printf("(((uint64_t)%s << 32) | (uint64_t)%s)", r(MIPS_REG_A0 + pos), r(MIPS_REG_A0 + pos + 1)); + } else { + printf("(((uint64_t)MEM_U32(sp + %d) << 32) | (uint64_t)MEM_U32(sp + %d))", pos * 4, (pos + 1) * 4); + } + pos += 2; + break; + } + } + if ((fn.flags & FLAG_VARARG) || needs_sp) { + printf("%s%s", first ? "" : ", ", r(MIPS_REG_SP)); + } + printf(");\n"); + if (ret_type == 'l' || ret_type == 'j') { + printf("%s = (uint32_t)(temp64 >> 32);\n", r(MIPS_REG_V0)); + printf("%s = (uint32_t)temp64;\n", r(MIPS_REG_V1)); + } + if (!name.empty()) { + //printf("printf(\"%s %%x\\n\", %s);\n", name.c_str(), r(MIPS_REG_A0)); + } + } else { + Function& f = functions.find((uint32_t)insn.operands[0].imm)->second; + if (f.nret == 1) { + printf("v0 = "); + } else if (f.nret == 2) { + printf("temp64 = "); + } + if (!name.empty()) { + //printf("printf(\"%s %%x\\n\", %s);\n", name.c_str(), r(MIPS_REG_A0)); + printf("f_%s", name.c_str()); + } else { + printf("func_%x", (uint32_t)insn.operands[0].imm); + } + printf("(mem, sp"); + if (f.v0_in) { + printf(", %s", r(MIPS_REG_V0)); + } + for (uint32_t i = 0; i < f.nargs; i++) { + printf(", %s", r(MIPS_REG_A0 + i)); + } + printf(");\n"); + if (f.nret == 2) { + printf("%s = (uint32_t)(temp64 >> 32);\n", r(MIPS_REG_V0)); + printf("%s = (uint32_t)temp64;\n", r(MIPS_REG_V1)); + } + } + printf("goto L%x;\n", text_vaddr + (i + 2) * 4); + label_addresses.insert(text_vaddr + (i + 2) * 4); + break; + } + case MIPS_INS_JALR: + printf("fp_dest = %s;\n", r(insn.operands[0].reg)); + dump_instr(i + 1); + printf("temp64 = trampoline(mem, sp, %s, %s, %s, %s, fp_dest);\n", + r(MIPS_REG_A0), r(MIPS_REG_A1), r(MIPS_REG_A2), r(MIPS_REG_A3)); + printf("%s = (uint32_t)(temp64 >> 32);\n", r(MIPS_REG_V0)); + printf("%s = (uint32_t)temp64;\n", r(MIPS_REG_V1)); + printf("goto L%x;\n", text_vaddr + (i + 2) * 4); + label_addresses.insert(text_vaddr + (i + 2) * 4); + break; + case MIPS_INS_JR: + if (insn.jtbl_addr != 0) { + uint32_t jtbl_pos = insn.jtbl_addr - rodata_vaddr; + assert(jtbl_pos < rodata_section_len && jtbl_pos + insn.num_cases * 4 <= rodata_section_len); +#if 1 + printf(";static void *const Lswitch%x[] = {\n", insn.jtbl_addr); + for (uint32_t i = 0; i < insn.num_cases; i++) { + uint32_t dest_addr = read_u32_be(rodata_section + jtbl_pos + i * 4) + gp_value; + printf("&&L%x,\n", dest_addr); + label_addresses.insert(dest_addr); + } + printf("};\n"); + printf("dest = Lswitch%x[%s];\n", insn.jtbl_addr, r(insn.index_reg)); + dump_instr(i + 1); + printf("goto *dest;\n"); +#else + assert(insns[i + 1].id == MIPS_INS_NOP); + printf("switch (%s) {\n", r(insn.index_reg)); + for (uint32_t i = 0; i < insn.num_cases; i++) { + uint32_t dest_addr = read_u32_be(rodata_section + jtbl_pos + i * 4) + gp_value; + printf("case %u: goto L%x;\n", i, dest_addr); + label_addresses.insert(dest_addr); + } + printf("}\n"); +#endif + } else { + if (insn.operands[0].reg != MIPS_REG_RA) { + printf("UNSUPPORTED JR %s %s\n", insn.op_str.c_str(), r(insn.operands[0].reg)); + } else { + dump_instr(i + 1); + switch (find_function(text_vaddr + i * 4)->second.nret) { + case 0: + printf("return;\n"); + break; + case 1: + printf("return v0;\n"); + break; + case 2: + printf("return ((uint64_t)v0 << 32) | v1;\n"); + break; + } + } + } + break; + case MIPS_INS_LB: + printf("%s = MEM_S8(%s + %d);\n", r(insn.operands[0].reg), r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp); + break; + case MIPS_INS_LBU: + printf("%s = MEM_U8(%s + %d);\n", r(insn.operands[0].reg), r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp); + break; + case MIPS_INS_LH: + printf("%s = MEM_S16(%s + %d);\n", r(insn.operands[0].reg), r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp); + break; + case MIPS_INS_LHU: + printf("%s = MEM_U16(%s + %d);\n", r(insn.operands[0].reg), r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp); + break; + case MIPS_INS_LUI: + printf("%s = 0x%x;\n", r(insn.operands[0].reg), ((uint32_t)insn.operands[1].imm) << 16); + break; + case MIPS_INS_LW: + printf("%s = MEM_U32(%s + %d);\n", r(insn.operands[0].reg), r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp); + break; + case MIPS_INS_LWC1: + printf("%s = MEM_U32(%s + %d);\n", wr(insn.operands[0].reg), r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp); + break; + case MIPS_INS_LDC1: + assert((insn.operands[0].reg - MIPS_REG_F0) % 2 == 0); + printf("%s = MEM_U32(%s + %d);\n", wr(insn.operands[0].reg + 1), r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp); + printf("%s = MEM_U32(%s + %d + 4);\n", wr(insn.operands[0].reg), r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp); + break; + case MIPS_INS_LWL: + { + const char *reg = r(insn.operands[0].reg); + printf("%s = %s + %d; ", reg, r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp); + printf("%s = (MEM_U8(%s) << 24) | (MEM_U8(%s + 1) << 16) | (MEM_U8(%s + 2) << 8) | MEM_U8(%s + 3);\n", reg, reg, reg, reg, reg); + break; + } + case MIPS_INS_LWR: + printf("//lwr %s\n", insn.op_str.c_str()); + break; + case MIPS_INS_LI: + if (insn.is_global_got_memop && text_vaddr <= insn.operands[1].imm && insn.operands[1].imm < text_vaddr + text_section_len) { + printf("%s = 0x%x; // function pointer\n", r(insn.operands[0].reg), (uint32_t)insn.operands[1].imm); + label_addresses.insert((uint32_t)insn.operands[1].imm); + } else { + printf("%s = 0x%x;\n", r(insn.operands[0].reg), (uint32_t)insn.operands[1].imm); + } + break; + case MIPS_INS_MFC1: + printf("%s = %s;\n", r(insn.operands[0].reg), wr(insn.operands[1].reg)); + break; + case MIPS_INS_MFHI: + printf("%s = hi;\n", r(insn.operands[0].reg)); + break; + case MIPS_INS_MFLO: + printf("%s = lo;\n", r(insn.operands[0].reg)); + break; + case MIPS_INS_MOVE: + printf("%s = %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + break; + case MIPS_INS_MTC1: + printf("%s = %s;\n", wr(insn.operands[1].reg), r(insn.operands[0].reg)); + break; + case MIPS_INS_MULT: + printf("lo = %s * %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + printf("hi = (uint32_t)((int64_t)(int)%s * (int64_t)(int)%s >> 32);\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + break; + case MIPS_INS_MULTU: + printf("lo = %s * %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + printf("hi = (uint32_t)((uint64_t)%s * (uint64_t)%s >> 32);\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + break; + case MIPS_INS_NEGU: + printf("%s = -%s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + break; + case MIPS_INS_NOR: + printf("%s = ~(%s | %s);\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_NOT: + printf("%s = ~%s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg)); + break; + case MIPS_INS_OR: + printf("%s = %s | %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_ORI: + printf("%s = %s | 0x%x;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (uint32_t)insn.operands[2].imm); + break; + case MIPS_INS_SB: + printf("MEM_U8(%s + %d) = (uint8_t)%s;\n", r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp, r(insn.operands[0].reg)); + break; + case MIPS_INS_SH: + printf("MEM_U16(%s + %d) = (uint16_t)%s;\n", r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp, r(insn.operands[0].reg)); + break; + case MIPS_INS_SLL: + printf("%s = %s << %d;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (uint32_t)insn.operands[2].imm); + break; + case MIPS_INS_SLLV: + printf("%s = %s << (%s & 0x1f);\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_SLT: + printf("%s = (int)%s < (int)%s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_SLTI: + printf("%s = (int)%s < (int)0x%x;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (uint32_t)insn.operands[2].imm); + break; + case MIPS_INS_SLTIU: + printf("%s = %s < 0x%x;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (uint32_t)insn.operands[2].imm); + break; + case MIPS_INS_SLTU: + printf("%s = %s < %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_SRA: + printf("%s = (int)%s >> %d;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (uint32_t)insn.operands[2].imm); + break; + case MIPS_INS_SRAV: + printf("%s = (int)%s >> (%s & 0x1f);\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_SRL: + printf("%s = %s >> %d;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (uint32_t)insn.operands[2].imm); + break; + case MIPS_INS_SRLV: + printf("%s = %s >> (%s & 0x1f);\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_SUBU: + printf("%s = %s - %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_SW: + printf("MEM_U32(%s + %d) = %s;\n", r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp, r(insn.operands[0].reg)); + break; + case MIPS_INS_SWC1: + printf("MEM_U32(%s + %d) = %s;\n", r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp, wr(insn.operands[0].reg)); + break; + case MIPS_INS_SDC1: + assert((insn.operands[0].reg - MIPS_REG_F0) % 2 == 0); + printf("MEM_U32(%s + %d) = %s;\n", r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp, wr(insn.operands[0].reg + 1)); + printf("MEM_U32(%s + %d + 4) = %s;\n", r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp, wr(insn.operands[0].reg)); + break; + case MIPS_INS_SWL: + for (int i = 0; i < 4; i++) { + printf("MEM_U8(%s + %d + %d) = (uint8_t)(%s >> %d);\n", r(insn.operands[1].mem.base), (int)insn.operands[1].mem.disp, i, r(insn.operands[0].reg), (3 - i) * 8); + } + break; + case MIPS_INS_SWR: + printf("//swr %s\n", insn.op_str.c_str()); + break; + case MIPS_INS_TRUNC: + if (insn.mnemonic == "trunc.w.s") { + printf("%s = (int)%s;\n", wr(insn.operands[0].reg), fr(insn.operands[1].reg)); + } else if (insn.mnemonic == "trunc.w.d") { + printf("%s = (int)%s;\n", wr(insn.operands[0].reg), dr(insn.operands[1].reg)); + } else { + goto unimplemented; + } + break; + case MIPS_INS_XOR: + printf("%s = %s ^ %s;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), r(insn.operands[2].reg)); + break; + case MIPS_INS_XORI: + printf("%s = %s ^ 0x%x;\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (uint32_t)insn.operands[2].imm); + break; + case MIPS_INS_TNE: + printf("assert(%s == %s && \"tne %d\");\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (int)insn.operands[2].imm); + break; + case MIPS_INS_TEQ: + printf("assert(%s != %s && \"teq %d\");\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (int)insn.operands[2].imm); + break; + case MIPS_INS_TGE: + printf("assert((int)%s < (int)%s && \"tge %d\");\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (int)insn.operands[2].imm); + break; + case MIPS_INS_TGEU: + printf("assert(%s < %s && \"tgeu %d\");\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (int)insn.operands[2].imm); + break; + case MIPS_INS_TLT: + printf("assert((int)%s >= (int)%s && \"tlt %d\");\n", r(insn.operands[0].reg), r(insn.operands[1].reg), (int)insn.operands[2].imm); + break; + case MIPS_INS_NOP: + printf("//nop;\n"); + break; + default: + unimplemented: + printf("UNIMPLEMENTED %s %s\n", insn.mnemonic.c_str(), insn.op_str.c_str()); + break; + } +} + +static void inspect_data_function_pointers(vector>& ret, const uint8_t *section, uint32_t section_vaddr, uint32_t len) { + for (uint32_t i = 0; i < len; i += 4) { + uint32_t addr = read_u32_be(section + i); + if (addr == 0x430b00 || addr == 0x433b00) { + // in as1, not function pointers (normal integers) + continue; + } + if (addr == 0x4a0000) { + // in copt + continue; + } + if (section_vaddr + i >= procedure_table_start && section_vaddr + i < procedure_table_start + procedure_table_len) { + // some linking table with a "all" functions, in as1 5.3 + continue; + } + if (addr >= text_vaddr && addr < text_vaddr + text_section_len && addr % 4 == 0) { +#if INSPECT_FUNCTION_POINTERS + fprintf(stderr, "assuming function pointer 0x%x at 0x%x\n", addr, section_vaddr + i); +#endif + ret.push_back(make_pair(section_vaddr + i, addr)); + label_addresses.insert(addr); + functions[addr].referenced_by_function_pointer = true; + } + } +} + +static void dump_function_signature(Function& f, uint32_t vaddr) { + printf("static "); + switch (f.nret) { + case 0: + printf("void "); + break; + case 1: + printf("uint32_t "); + break; + case 2: + printf("uint64_t "); + break; + } + auto name_it = symbol_names.find(vaddr); + if (name_it != symbol_names.end()) { + printf("f_%s", name_it->second.c_str()); + } else { + printf("func_%x", vaddr); + } + printf("(uint8_t *mem, uint32_t sp"); + if (f.v0_in) { + printf(", uint32_t %s", r(MIPS_REG_V0)); + } + for (uint32_t i = 0; i < f.nargs; i++) { + printf(", uint32_t %s", r(MIPS_REG_A0 + i)); + } + printf(")"); +} + +static void dump_c(void) { + map symbol_names_inv; + for (auto& it : symbol_names) { + symbol_names_inv[it.second] = it.first; + } + + uint32_t min_addr = ~0; + uint32_t max_addr = 0; + + if (data_section_len > 0) { + min_addr = MIN(min_addr, data_vaddr); + max_addr = MAX(max_addr, data_vaddr + data_section_len); + } + if (rodata_section_len > 0) { + min_addr = MIN(min_addr, rodata_vaddr); + max_addr = MAX(max_addr, rodata_vaddr + rodata_section_len); + } + if (bss_section_len) { + min_addr = MIN(min_addr, bss_vaddr); + max_addr = MAX(max_addr, bss_vaddr + bss_section_len); + } + + min_addr = min_addr & ~0xfff; + max_addr = (max_addr + 0xfff) & ~0xfff; + + uint32_t stack_bottom = min_addr; + min_addr -= 1 * 1024 * 1024; // 1 MB stack + stack_bottom -= 16; // for main's stack frame + + printf("#include \"header.h\"\n"); + if (conservative) { + printf("static uint32_t s0, s1, s2, s3, s4, s5, s6, s7, fp;\n"); + } + printf("static const uint32_t rodata[] = {\n"); + for (size_t i = 0; i < rodata_section_len; i += 4) { + printf("0x%x,%s", read_u32_be(rodata_section + i), i % 32 == 28 ? "\n" : ""); + } + printf("};\n"); + printf("static const uint32_t data[] = {\n"); + for (size_t i = 0; i < data_section_len; i += 4) { + printf("0x%x,%s", read_u32_be(data_section + i), i % 32 == 28 ? "\n" : ""); + } + printf("};\n"); + + /*if (!data_function_pointers.empty()) { + printf("static const struct { uint32_t orig_addr; void *recompiled_addr; } data_function_pointers[] = {\n"); + for (auto item : data_function_pointers) { + printf("{0x%x, &&L%x},\n", item.first, item.second); + } + printf("};\n"); + }*/ + + if (TRACE) { + printf("static unsigned long long int cnt = 0;\n"); + } + + for (auto& f_it : functions) { + if (insns[addr_to_i(f_it.first)].f_livein != 0) { + // Function is used + dump_function_signature(f_it.second, f_it.first); + printf(";\n"); + } + } + + if (!data_function_pointers.empty() || !li_function_pointers.empty()) { + printf("uint64_t trampoline(uint8_t *mem, uint32_t sp, uint32_t a0, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t fp_dest) {\n"); + printf("switch (fp_dest) {\n"); + for (auto& it : functions) { + Function& f = it.second; + if (f.referenced_by_function_pointer) { + printf("case 0x%x: ", it.first); + if (f.nret == 1) { + printf("return (uint64_t)"); + } else if (f.nret == 2) { + printf("return "); + } + auto name_it = symbol_names.find(it.first); + if (name_it != symbol_names.end()) { + printf("f_%s", name_it->second.c_str()); + } else { + printf("func_%x", it.first); + } + printf("(mem, sp"); + for (int i = 0; i < f.nargs; i++) { + printf(", a%d", i); + } + printf(")"); + if (f.nret == 1) { + printf(" << 32"); + } + printf(";"); + if (f.nret == 0) { + printf(" return 0;"); + } + printf("\n"); + } + } + printf("default: abort();"); + printf("}\n"); + printf("}\n"); + } + + printf("int run(uint8_t *mem, int argc, char *argv[]) {\n"); + printf("mmap_initial_data_range(mem, 0x%x, 0x%x);\n", min_addr, max_addr); + + printf("memcpy(mem + 0x%x, rodata, 0x%x);\n", rodata_vaddr, rodata_section_len); + printf("memcpy(mem + 0x%x, data, 0x%x);\n", data_vaddr, data_section_len); + + /*if (!data_function_pointers.empty()) { + if (!LABELS_64_BIT) { + printf("for (int i = 0; i < %d; i++) MEM_U32(data_function_pointers[i].orig_addr) = (uint32_t)(uintptr_t)data_function_pointers[i].recompiled_addr;\n", (int)data_function_pointers.size()); + } else { + printf("for (int i = 0; i < %d; i++) MEM_U32(data_function_pointers[i].orig_addr) = (uint32_t)((uintptr_t)data_function_pointers[i].recompiled_addr - (uintptr_t)&&Loffset);\n", (int)data_function_pointers.size()); + } + }*/ + + printf("MEM_S32(0x%x) = argc;\n", symbol_names_inv.at("__Argc")); + printf("MEM_S32(0x%x) = argc;\n", stack_bottom); + printf("uint32_t al = argc * 4; for (int i = 0; i < argc; i++) al += strlen(argv[i]) + 1;\n"); + printf("uint32_t arg_addr = wrapper_malloc(mem, al);\n"); + printf("MEM_U32(0x%x) = arg_addr;\n", symbol_names_inv.at("__Argv")); + printf("MEM_U32(0x%x) = arg_addr;\n", stack_bottom + 4); + printf("uint32_t arg_strpos = arg_addr + argc * 4;\n"); + printf("for (int i = 0; i < argc; i++) {MEM_U32(arg_addr + i * 4) = arg_strpos; uint32_t p = 0; do { MEM_S8(arg_strpos) = argv[i][p]; ++arg_strpos; } while (argv[i][p++] != '\\0');}\n"); + + printf("setup_libc_data(mem);\n"); + + //printf("gp = 0x%x;\n", gp_value); // only to recreate the outcome when ugen reads uninitialized stack memory + + printf("int ret = f_main(mem, 0x%x", stack_bottom); + Function& main_func = functions[main_addr]; + if (main_func.nargs >= 1) { + printf(", argc"); + } + if (main_func.nargs >= 2) { + printf(", arg_addr"); + } + printf(");\n"); + if (TRACE) { + printf("end: fprintf(stderr, \"cnt: %%llu\\n\", cnt);\n"); + } + printf("return ret;\n"); + printf("}\n"); + + for (auto& f_it : functions) { + Function& f = f_it.second; + uint32_t start_addr = f_it.first; + uint32_t end_addr = f.end_addr; + + if (insns[addr_to_i(start_addr)].f_livein == 0) { + // Non-used function, skip + continue; + } + + printf("\n"); + dump_function_signature(f, start_addr); + printf(" {\n"); + printf("const uint32_t zero = 0;\n"); + if (!conservative) { + printf("uint32_t at = 0, v1 = 0, t0 = 0, t1 = 0, t2 = 0,\n"); + printf("t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0,\n"); + printf("s6 = 0, s7 = 0, t8 = 0, t9 = 0, gp = 0, fp = 0, s8 = 0, ra = 0;\n"); + } else { + printf("uint32_t at = 0, v1 = 0, t0 = 0, t1 = 0, t2 = 0,\n"); + printf("t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, gp = 0x10000, ra = 0x10000;\n"); + } + printf("uint32_t lo = 0, hi = 0;\n"); + printf("int cf = 0;\n"); + printf("uint64_t temp64;\n"); + printf("uint32_t fp_dest;\n"); + printf("void *dest;\n"); + if (!f.v0_in) { + printf("uint32_t v0 = 0;\n"); + } + for (uint32_t j = f.nargs; j < 4; j++) { + printf("uint32_t %s = 0;\n", r(MIPS_REG_A0 + j)); + } + + for (size_t i = addr_to_i(start_addr), end_i = addr_to_i(end_addr); i < end_i; i++) { + Insn& insn = insns[i]; + uint32_t vaddr = text_vaddr + i * 4; + if (label_addresses.count(vaddr)) { + printf("L%x:\n", vaddr); + } + dump_instr(i); + } + + printf("}\n"); + } + /*for (size_t i = 0; i < insns.size(); i++) { + Insn& insn = insns[i]; + uint32_t vaddr = text_vaddr + i * 4; + auto fn_it = functions.find(vaddr); + if (fn_it != functions.end()) { + Function& f = fn_it->second; + printf("}\n\n"); + switch (f.nret) { + case 0: + printf("void "); + break; + case 1: + printf("uint32_t "); + break; + case 2: + printf("uint64_t "); + break; + } + auto name_it = symbol_names.find(vaddr); + if (name_it != symbol_names.end()) { + printf("%s", name_it->second.c_str()); + } else { + printf("func_%x", vaddr); + } + printf("(uint8_t *mem, uint32_t sp"); + if (f.v0_in) { + printf(", uint32_t %s", r(MIPS_REG_V0)); + } + for (uint32_t i = 0; i < f.nargs; i++) { + printf(", uint32_t %s", r(MIPS_REG_A0 + i)); + } + printf(") {\n"); + printf("const uint32_t zero = 0;\n"); + printf("uint32_t at = 0, v1 = 0, t0 = 0, t1 = 0, t2 = 0,\n"); + printf("t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0,\n"); + printf("s6 = 0, s7 = 0, t8 = 0, t9 = 0, gp = 0, fp = 0, s8 = 0, ra = 0;\n"); + printf("uint32_t lo = 0, hi = 0;\n"); + printf("int cf = 0;\n"); + if (!f.v0_in) { + printf("uint32_t v0 = 0;\n"); + } + for (uint32_t j = f.nargs; j < 4; j++) { + printf("uint32_t %s = 0;\n", r(MIPS_REG_A0 + j)); + } + } + if (label_addresses.count(vaddr)) { + printf("L%x:\n", vaddr); + } + dump_instr(i); + }*/ +} + +static void parse_elf(const uint8_t *data, size_t file_len) { + Elf32_Ehdr *ehdr; + Elf32_Shdr *shdr, *str_shdr, *sym_shdr = NULL, *dynsym_shdr, *dynamic_shdr, *reginfo_shdr, *got_shdr, *sym_strtab, *sym_dynstr; + int text_section_index = -1; + int symtab_section_index = -1; + int dynsym_section_index = -1; + int reginfo_section_index = -1; + int dynamic_section_index = -1; + int got_section_index = -1; + int rodata_section_index = -1; + int data_section_index = -1; + int bss_section_index = -1; + uint32_t text_offset = 0; + uint32_t vaddr_adj = 0; + + if (file_len < 4 || data[0] != 0x7f || data[1] != 'E' || data[2] != 'L' || data[3] != 'F') { + fprintf(stderr, "Not an ELF file.\n"); + exit(EXIT_FAILURE); + } + + ehdr = (Elf32_Ehdr *) data; + if (ehdr->e_ident[EI_DATA] != 2 || u16be(ehdr->e_machine) != 8) { + fprintf(stderr, "Not big-endian MIPS.\n"); + exit(EXIT_FAILURE); + } + + if (u16be(ehdr->e_shstrndx) == 0) { + // (We could look at program headers instead in this case.) + fprintf(stderr, "Missing section headers; stripped binaries are not yet supported.\n"); + exit(EXIT_FAILURE); + } + +#define SECTION(index) (Elf32_Shdr *)(data + u32be(ehdr->e_shoff) + (index) * u16be(ehdr->e_shentsize)) +#define STR(strtab, offset) (const char *)(data + u32be(strtab->sh_offset) + offset) + + str_shdr = SECTION(u16be(ehdr->e_shstrndx)); + for (int i = 0; i < u16be(ehdr->e_shnum); i++) { + shdr = SECTION(i); + const char *name = STR(str_shdr, u32be(shdr->sh_name)); + if (strcmp(name, ".text") == 0) { + text_offset = u32be(shdr->sh_offset); + text_vaddr = u32be(shdr->sh_addr); + vaddr_adj = text_vaddr - u32be(shdr->sh_addr); + text_section_len = u32be(shdr->sh_size); + text_section = data + text_offset; + text_section_index = i; + } + if (u32be(shdr->sh_type) == SHT_SYMTAB) { + symtab_section_index = i; + } + if (u32be(shdr->sh_type) == SHT_DYNSYM) { + dynsym_section_index = i; + } + if (u32be(shdr->sh_type) == SHT_MIPS_REGINFO) { + reginfo_section_index = i; + } + if (u32be(shdr->sh_type) == SHT_DYNAMIC) { + dynamic_section_index = i; + } + if (strcmp(name, ".got") == 0) { + got_section_index = i; + } + if (strcmp(name, ".rodata") == 0) { + rodata_section_index = i; + } + if (strcmp(name, ".data") == 0) { + data_section_index = i; + } + if (strcmp(name, ".bss") == 0) { + bss_section_index = i; + } + } + + if (text_section_index == -1) { + fprintf(stderr, "Missing .text section.\n"); + exit(EXIT_FAILURE); + } + + if (symtab_section_index == -1 && dynsym_section_index == -1) { + fprintf(stderr, "Missing .symtab or .dynsym section.\n"); + exit(EXIT_FAILURE); + } + + if (dynsym_section_index != -1) { + if (reginfo_section_index == -1) { + fprintf(stderr, "Missing .reginfo section.\n"); + exit(EXIT_FAILURE); + } + if (dynamic_section_index == -1) { + fprintf(stderr, "Missing .dynamic section.\n"); + exit(EXIT_FAILURE); + } + if (got_section_index == -1) { + fprintf(stderr, "Missing .got section.\n"); + exit(EXIT_FAILURE); + } + } + + if (rodata_section_index != -1) { + shdr = SECTION(rodata_section_index); + uint32_t size = u32be(shdr->sh_size); + rodata_section = data + u32be(shdr->sh_offset); + rodata_section_len = size; + rodata_vaddr = u32be(shdr->sh_addr); + } + + if (data_section_index != -1) { + shdr = SECTION(data_section_index); + uint32_t size = u32be(shdr->sh_size); + data_section = data + u32be(shdr->sh_offset); + data_section_len = size; + data_vaddr = u32be(shdr->sh_addr); + } + + if (bss_section_index != -1) { + shdr = SECTION(bss_section_index); + uint32_t size = u32be(shdr->sh_size); + bss_section_len = size; + bss_vaddr = u32be(shdr->sh_addr); + } + + + // add symbols + if (symtab_section_index != -1) { + sym_shdr = SECTION(symtab_section_index); + sym_strtab = SECTION(u32be(sym_shdr->sh_link)); + assert(0 && ".symtab not supported - use a program with .dynsym instead"); + + assert(u32be(sym_shdr->sh_entsize) == sizeof(Elf32_Sym)); + for (uint32_t i = 0; i < u32be(sym_shdr->sh_size); i += sizeof(Elf32_Sym)) { + Elf32_Sym *sym = (Elf32_Sym *)(data + u32be(sym_shdr->sh_offset) + i); + const char *name = STR(sym_strtab, u32be(sym->st_name)); + uint32_t addr = u32be(sym->st_value); + if (u16be(sym->st_shndx) != text_section_index || name[0] == '.') { + continue; + } + addr += vaddr_adj; + //disasm_label_add(state, name, addr, u32be(sym->st_size), true); + } + } + + if (dynsym_section_index != -1) { + dynsym_shdr = SECTION(dynsym_section_index); + sym_dynstr = SECTION(u32be(dynsym_shdr->sh_link)); + reginfo_shdr = SECTION(reginfo_section_index); + dynamic_shdr = SECTION(dynamic_section_index); + got_shdr = SECTION(got_section_index); + + Elf32_RegInfo *reg_info = (Elf32_RegInfo *)(data + u32be(reginfo_shdr->sh_offset)); + uint32_t gp_base = u32be(reg_info->ri_gp_value); // gp should have this value through the program run + uint32_t got_start = 0; + uint32_t local_got_no = 0; + uint32_t first_got_sym = 0; + uint32_t dynsym_no = 0; // section size can't be used due to alignment 16 padding + + assert(u32be(dynamic_shdr->sh_entsize) == sizeof(Elf32_Dyn)); + for (uint32_t i = 0; i < u32be(dynamic_shdr->sh_size); i += sizeof(Elf32_Dyn)) { + Elf32_Dyn *dyn = (Elf32_Dyn *)(data + u32be(dynamic_shdr->sh_offset) + i); + if (u32be(dyn->d_tag) == DT_PLTGOT) { + got_start = u32be(dyn->d_un.d_ptr); + } + if (u32be(dyn->d_tag) == DT_MIPS_LOCAL_GOTNO) { + local_got_no = u32be(dyn->d_un.d_val); + } + if (u32be(dyn->d_tag) == DT_MIPS_GOTSYM) { + first_got_sym = u32be(dyn->d_un.d_val); + } + if (u32be(dyn->d_tag) == DT_MIPS_SYMTABNO) { + dynsym_no = u32be(dyn->d_un.d_val); + } + } + + assert(got_start != 0); + + // value to add to asm gp offset, for example 32752, if -32752(gp) refers to the first entry in got. + uint32_t gp_adj = gp_base - got_start; + assert(gp_adj < 0x10000); + + assert(u32be(dynsym_shdr->sh_entsize) == sizeof(Elf32_Sym)); + uint32_t global_got_no = dynsym_no - first_got_sym; + //global_got_entry *global_entries = (global_got_entry *)calloc(global_got_no, sizeof(global_got_entry)); + got_globals.resize(global_got_no); + + uint32_t common_start = ~0U; + vector common_order; + + for (uint32_t i = 0; i < dynsym_no; i++) { + Elf32_Sym *sym = (Elf32_Sym *)(data + u32be(dynsym_shdr->sh_offset) + i * sizeof(Elf32_Sym)); + const char *name = STR(sym_dynstr, u32be(sym->st_name)); + uint32_t addr = u32be(sym->st_value); + addr += vaddr_adj; + uint8_t type = ELF32_ST_TYPE(sym->st_info); + if (!strcmp(name, "_procedure_table")) { + procedure_table_start = addr; + } else if (!strcmp(name, "_procedure_table_size")) { + procedure_table_len = 40 * u32be(sym->st_value); + } + if ((u16be(sym->st_shndx) == SHN_MIPS_TEXT && type == STT_FUNC) || + (type == STT_OBJECT && (u16be(sym->st_shndx) == SHN_MIPS_ACOMMON || u16be(sym->st_shndx) == SHN_MIPS_DATA))) + { + //disasm_label_add(state, name, addr, u32be(sym->st_size), true); + if (type == STT_OBJECT) { + } + if (u16be(sym->st_shndx) == SHN_MIPS_ACOMMON) { + if (addr < common_start) { + common_start = addr; + } + common_order.push_back(name); + } + if (type == STT_FUNC) { + add_function(addr); + if (strcmp(name, "main") == 0) { + main_addr = addr; + } + if (strcmp(name, "_mcount") == 0) { + mcount_addr = addr; + } + symbol_names[addr] = name; + } + } + if (i >= first_got_sym) { + uint32_t got_value = u32be(*(uint32_t *)(data + u32be(got_shdr->sh_offset) + (local_got_no + (i - first_got_sym)) * sizeof(uint32_t))); + if (u16be(sym->st_shndx) == SHN_MIPS_TEXT && type == STT_FUNC) { + //got_globals[i - first_got_sym] = got_value; + //label_addresses.insert(got_value); + got_globals[i - first_got_sym] = addr; // to include the 3 instr gp header thing + label_addresses.insert(addr); + } else if (type == STT_OBJECT && (u16be(sym->st_shndx) == SHN_UNDEF || u16be(sym->st_shndx) == SHN_COMMON)) { + // symbol defined externally (for example in libc) + got_globals[i - first_got_sym] = got_value; + } else { + got_globals[i - first_got_sym] = addr; + } + symbol_names[got_globals[i - first_got_sym]] = name; + } + } + + uint32_t *local_entries = (uint32_t *)calloc(local_got_no, sizeof(uint32_t)); + got_locals.resize(local_got_no); + for (uint32_t i = 0; i < local_got_no; i++) { + uint32_t *entry = (uint32_t *)(data + u32be(got_shdr->sh_offset) + i * sizeof(uint32_t)); + got_locals[i] = u32be(*entry); + } + + gp_value = gp_base; + gp_value_adj = gp_adj; + //disasm_got_entries_set(state, gp_base, gp_adj, local_entries, local_got_no, global_entries, global_got_no); + + //out_range.common_start = common_start; + //out_range.common_order.swap(common_order); + } + + // add relocations + for (int i = 0; i < u16be(ehdr->e_shnum); i++) { + Elf32_Rel *prevHi = NULL; + shdr = SECTION(i); + if (u32be(shdr->sh_type) != SHT_REL || u32be(shdr->sh_info) != (uint32_t) text_section_index) + continue; + + if (sym_shdr == NULL) { + fprintf(stderr, "Relocations without .symtab section\n"); + exit(EXIT_FAILURE); + } + + assert(u32be(shdr->sh_link) == (uint32_t) symtab_section_index); + assert(u32be(shdr->sh_entsize) == sizeof(Elf32_Rel)); + for (uint32_t i = 0; i < u32be(shdr->sh_size); i += sizeof(Elf32_Rel)) { + Elf32_Rel *rel = (Elf32_Rel *)(data + u32be(shdr->sh_offset) + i); + uint32_t offset = text_offset + u32be(rel->r_offset); + uint32_t symIndex = ELF32_R_SYM(u32be(rel->r_info)); + uint32_t rtype = ELF32_R_TYPE(u32be(rel->r_info)); + const char *symName = "0"; + if (symIndex != STN_UNDEF) { + Elf32_Sym *sym = (Elf32_Sym *)(data + u32be(sym_shdr->sh_offset) + symIndex * sizeof(Elf32_Sym)); + symName = STR(sym_strtab, u32be(sym->st_name)); + } + + if (rtype == R_MIPS_HI16) { + if (prevHi != NULL) { + fprintf(stderr, "Consecutive R_MIPS_HI16.\n"); + exit(EXIT_FAILURE); + } + prevHi = rel; + continue; + } + if (rtype == R_MIPS_LO16) { + int32_t addend = (int16_t)((data[offset + 2] << 8) + data[offset + 3]); + if (prevHi != NULL) { + uint32_t offset2 = text_offset + u32be(prevHi->r_offset); + addend += (uint32_t)((data[offset2 + 2] << 8) + data[offset2 + 3]) << 16; + //add_reloc(state, offset2, symName, addend, out_range.vaddr); + } + prevHi = NULL; + //add_reloc(state, offset, symName, addend, out_range.vaddr); + } + else if (rtype == R_MIPS_26) { + int32_t addend = (u32be(*(uint32_t*)(data + offset)) & ((1 << 26) - 1)) << 2; + if (addend >= (1 << 27)) { + addend -= 1 << 28; + } + //add_reloc(state, offset, symName, addend, out_range.vaddr); + } + else { + fprintf(stderr, "Bad relocation type %d.\n", rtype); + exit(EXIT_FAILURE); + } + } + if (prevHi != NULL) { + fprintf(stderr, "R_MIPS_HI16 without matching R_MIPS_LO16.\n"); + exit(EXIT_FAILURE); + } + } +} +#undef SECTION +#undef STR + +size_t read_file(const char *file_name, uint8_t **data) { + FILE *in; + uint8_t *in_buf = NULL; + long file_size; + long bytes_read; + in = fopen(file_name, "rb"); + assert(in != nullptr); + + // allocate buffer to read from offset to end of file + fseek(in, 0, SEEK_END); + file_size = ftell(in); + assert(file_size != -1L); + + in_buf = (uint8_t *)malloc(file_size); + fseek(in, 0, SEEK_SET); + + // read bytes + bytes_read = fread(in_buf, 1, file_size, in); + assert(bytes_read == file_size); + + fclose(in); + *data = in_buf; + return bytes_read; +} + +int main(int argc, char *argv[]) { + const char *filename = argv[1]; + if (strcmp(filename, "--conservative") == 0) { + conservative = true; + filename = argv[2]; + } + + uint8_t *data; + size_t len = read_file(filename, &data); + parse_elf(data, len); + assert(cs_open(CS_ARCH_MIPS, (cs_mode)(CS_MODE_MIPS64 | CS_MODE_BIG_ENDIAN), &handle) == CS_ERR_OK); + cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON); + disassemble(); + inspect_data_function_pointers(data_function_pointers, rodata_section, rodata_vaddr, rodata_section_len); + inspect_data_function_pointers(data_function_pointers, data_section, data_vaddr, data_section_len); + pass1(); + pass2(); + pass3(); + pass4(); + pass5(); + pass6(); + //dump(); + dump_c(); + free(data); + cs_close(&handle); +} + diff --git a/tools/n64graphics.c b/tools/n64graphics.c index a52e7401..f1783137 100644 --- a/tools/n64graphics.c +++ b/tools/n64graphics.c @@ -238,6 +238,7 @@ int ia2raw(uint8_t *raw, const ia *img, int width, int height, int depth) { int size = (width * height * depth + 7) / 8; INFO("Converting IA%d %dx%d to raw\n", depth, width, height); + memset(raw, 0, size); switch (depth) { case 16: @@ -290,6 +291,7 @@ int i2raw(uint8_t *raw, const ia *img, int width, int height, int depth) { int size = (width * height * depth + 7) / 8; INFO("Converting I%d %dx%d to raw\n", depth, width, height); + memset(raw, 0, size); switch (depth) { case 8: @@ -591,6 +593,7 @@ typedef struct char *bin_filename; char *pal_filename; tool_mode mode; + write_encoding encoding; unsigned int bin_offset; unsigned int pal_offset; img_format format; @@ -607,6 +610,7 @@ static const graphics_config default_config = .bin_filename = NULL, .pal_filename = NULL, .mode = MODE_EXPORT, + .encoding = ENCODING_RAW, .bin_offset = 0, .pal_offset = 0, .format = {IMG_FORMAT_RGBA, 16}, @@ -659,6 +663,42 @@ static int parse_format(img_format *format, const char *str) return 0; } +typedef struct +{ + const char *name; + write_encoding encoding; +} scheme_entry; + +static const scheme_entry encoding_table[] = +{ + {"raw", ENCODING_RAW}, + {"u8", ENCODING_U8}, + {"u16", ENCODING_U16}, + {"u32", ENCODING_U32}, + {"u64", ENCODING_U64}, +}; + +static const char *encoding2str(write_encoding encoding) +{ + for (unsigned i = 0; i < DIM(encoding_table); i++) { + if (encoding == encoding_table[i].encoding) { + return encoding_table[i].name; + } + } + return "unknown"; +} + +static int parse_encoding(write_encoding *encoding, const char *str) +{ + for (unsigned i = 0; i < DIM(encoding_table); i++) { + if (!strcasecmp(str, encoding_table[i].name)) { + *encoding = encoding_table[i].encoding; + return 1; + } + } + return 0; +} + static void print_usage(void) { ERROR("Usage: n64graphics -e/-i BIN_FILE -g IMG_FILE [-p PAL_FILE] [-o BIN_OFFSET] [-P PAL_OFFSET] [-f FORMAT] [-c CI_FORMAT] [-w WIDTH] [-h HEIGHT] [-V]\n" @@ -672,6 +712,7 @@ static void print_usage(void) "Optional arguments:\n" " -o BIN_OFFSET starting offset in BIN_FILE (prevents truncation during import)\n" " -f FORMAT texture format: rgba16, rgba32, ia1, ia4, ia8, ia16, i4, i8, ci4, ci8 (default: %s)\n" + " -s SCHEME output scheme: raw, u8 (hex), u64 (hex) (default: %s)\n" " -w WIDTH export texture width (default: %d)\n" " -h HEIGHT export texture height (default: %d)\n" "CI arguments:\n" @@ -682,6 +723,7 @@ static void print_usage(void) " -v verbose logging\n" " -V print version information\n", format2str(&default_config.format), + encoding2str(default_config.encoding), default_config.width, default_config.height, format2str(&default_config.pal_format)); @@ -745,6 +787,12 @@ static int parse_arguments(int argc, char *argv[], graphics_config *config) config->pal_offset = strtoul(argv[i], NULL, 0); config->pal_truncate = 0; break; + case 's': + if (++i >= argc) return 0; + if (!parse_encoding(&config->encoding, argv[i])) { + return 0; + } + break; case 'v': g_verbosity = 1; break; @@ -801,10 +849,14 @@ int main(int argc, char *argv[]) } if (config.mode == MODE_IMPORT) { - if (config.bin_truncate) { - bin_fp = fopen(config.bin_filename, "wb"); + if (0 == strcmp("-", config.bin_filename)) { + bin_fp = stdout; } else { - bin_fp = fopen(config.bin_filename, "r+b"); + if (config.bin_truncate) { + bin_fp = fopen(config.bin_filename, "wb"); + } else { + bin_fp = fopen(config.bin_filename, "r+b"); + } } if (!bin_fp) { ERROR("Error opening \"%s\"\n", config.bin_filename); @@ -843,7 +895,7 @@ int main(int argc, char *argv[]) break; case IMG_FORMAT_CI: { - palette_t pal; + palette_t pal = {0}; FILE *pal_fp; uint8_t *raw16; int raw16_size; @@ -896,17 +948,18 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } + // pack the bytes + uint8_t raw_pal[sizeof(pal.data)]; + for (int i = 0; i < pal.max; i++) { + write_u16_be(&raw_pal[2*i], pal.data[i]); + } pal_length = pal.max * sizeof(pal.data[0]); INFO("Writing 0x%X bytes to offset 0x%X of \"%s\"\n", pal_length, config.pal_offset, config.pal_filename); - flength = 0; - for (int i = 0; i < pal.max; i++) { - uint8_t entry[2]; - write_u16_be(entry, pal.data[i]); - flength += fwrite(entry, 1, sizeof(entry), pal_fp); - } - if (flength != pal_length) { + flength = fprint_write_output(pal_fp, config.encoding, raw_pal, pal_length); + if (config.encoding == ENCODING_RAW && flength != pal_length) { ERROR("Error writing %d bytes to \"%s\"\n", pal_length, config.pal_filename); } + INFO("Wrote 0x%X bytes to \"%s\"\n", flength, config.pal_filename); raw = ci; length = ci_length; @@ -923,11 +976,14 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } INFO("Writing 0x%X bytes to offset 0x%X of \"%s\"\n", length, config.bin_offset, config.bin_filename); - flength = fwrite(raw, 1, length, bin_fp); - if (flength != length) { + flength = fprint_write_output(bin_fp, config.encoding, raw, length); + if (config.encoding == ENCODING_RAW && flength != length) { ERROR("Error writing %d bytes to \"%s\"\n", length, config.bin_filename); } - fclose(bin_fp); + INFO("Wrote 0x%X bytes to \"%s\"\n", flength, config.bin_filename); + if (bin_fp != stdout) { + fclose(bin_fp); + } } else { if (config.width <= 0 || config.height <= 0 || config.format.depth <= 0) { diff --git a/tools/n64graphics_ci_dir/exoquant/exoquant.h b/tools/n64graphics_ci_dir/exoquant/exoquant.h index 241e39c2..6d822406 100644 --- a/tools/n64graphics_ci_dir/exoquant/exoquant.h +++ b/tools/n64graphics_ci_dir/exoquant/exoquant.h @@ -147,4 +147,4 @@ extern exq_color exq_sort_dir; } #endif -#endif // __EXOQUANT_H \ No newline at end of file +#endif // __EXOQUANT_H diff --git a/tools/n64graphics_ci_dir/n64graphics_ci.h b/tools/n64graphics_ci_dir/n64graphics_ci.h index 2b5eb045..91423143 100644 --- a/tools/n64graphics_ci_dir/n64graphics_ci.h +++ b/tools/n64graphics_ci_dir/n64graphics_ci.h @@ -39,4 +39,4 @@ const char *n64graphics_get_read_version(void); // get version of underlying graphics writing library const char *n64graphics_get_write_version(void); -#endif \ No newline at end of file +#endif diff --git a/tools/seq_decoder.py b/tools/seq_decoder.py index 07e59c3c..ce238209 100755 --- a/tools/seq_decoder.py +++ b/tools/seq_decoder.py @@ -34,11 +34,11 @@ commands['seq'] = { 0xc9: ['bitand', 'u8'], 0xc8: ['subtract', 'u8'], # arg commands - 0x00: ['testchdisabled', 'arg'], - 0x50: ['subvariation', 'ign-arg'], - 0x70: ['setvariation', 'ign-arg'], - 0x80: ['getvariation', 'ign-arg'], - 0x90: ['startchannel', 'arg', 'addr'], + 0x00: ['testchdisabled', 'bits:4'], + 0x50: ['subvariation', 'bits:4:ign'], + 0x70: ['setvariation', 'bits:4:ign'], + 0x80: ['getvariation', 'bits:4:ign'], + 0x90: ['startchannel', 'bits:4', 'addr'], } commands['chan'] = { @@ -90,25 +90,25 @@ commands['chan'] = { 0xc2: ['setdyntable', 'addr'], 0xc1: ['setinstr', 'u8'], # arg commands - 0x00: ['testlayerfinished', 'arg'], - 0x10: ['startchannel', 'arg', 'addr'], - 0x20: ['disablechannel', 'arg'], - 0x30: ['iowriteval2', 'arg', 'u8'], - 0x40: ['ioreadval2', 'arg', 'u8'], - 0x50: ['ioreadvalsub', 'arg'], - 0x60: ['setnotepriority', 'arg'], - 0x70: ['iowriteval', 'arg'], - 0x80: ['ioreadval', 'arg'], - 0x90: ['setlayer', 'arg', 'addr'], - 0xa0: ['freelayer', 'arg'], - 0xb0: ['dynsetlayer', 'arg'], + 0x00: ['testlayerfinished', 'bits:4'], + 0x10: ['startchannel', 'bits:4', 'addr'], + 0x20: ['disablechannel', 'bits:4'], + 0x30: ['iowriteval2', 'bits:4', 'u8'], + 0x40: ['ioreadval2', 'bits:4', 'u8'], + 0x50: ['ioreadvalsub', 'bits:4'], + 0x60: ['setnotepriority', 'bits:4'], + 0x70: ['iowriteval', 'bits:4'], + 0x80: ['ioreadval', 'bits:4'], + 0x90: ['setlayer', 'bits:4', 'addr'], + 0xa0: ['freelayer', 'bits:4'], + 0xb0: ['dynsetlayer', 'bits:4'], } commands_layer_base = { # non-arg commands 0xc0: ['delay', 'var'], 0xc1: ['setshortnotevelocity', 'u8'], - 0xc2: ['transpose', 'u8'], + 0xc2: ['transpose', 's8'], 0xc3: ['setshortnotedefaultplaypercentage', 'var'], 0xc4: ['somethingon'], # ?? (something to do with decay behavior) 0xc5: ['somethingoff'], # ?? @@ -123,22 +123,35 @@ commands_layer_base = { 0xfc: ['call', 'addr'], 0xff: ['end'], # arg commands - 0xd0: ['setshortnotevelocityfromtable', 'arg'], - 0xe0: ['setshortnotedurationfromtable', 'arg'], + 0xd0: ['setshortnotevelocityfromtable', 'bits:4'], + 0xe0: ['setshortnotedurationfromtable', 'bits:4'], } commands['layer_large'] = dict(list(commands_layer_base.items()) + list({ - 0x00: ['note0', 'arg', 'var', 'u8', 'u8'], - 0x40: ['note1', 'arg', 'var', 'u8'], - 0x80: ['note2', 'arg', 'u8', 'u8'], + 0x00: ['note0', 'bits:6', 'var', 'u8', 'u8'], + 0x40: ['note1', 'bits:6', 'var', 'u8'], + 0x80: ['note2', 'bits:6', 'u8', 'u8'], }.items())) commands['layer_small'] = dict(list(commands_layer_base.items()) + list({ - 0x00: ['smallnote0', 'arg', 'var'], - 0x40: ['smallnote1', 'arg'], - 0x80: ['smallnote2', 'arg'], + 0x00: ['smallnote0', 'bits:6', 'var'], + 0x40: ['smallnote1', 'bits:6'], + 0x80: ['smallnote2', 'bits:6'], }.items())) +sh_chan_overrides = [ + (0x80, ['testlayerfinished', 'bits:3']), + (0x88, ['setlayer', 'bits:3', 'addr']), + (0x60, ['ioreadval', 'bits:4']), + (0x90, ['freelayer', 'bits:4']), +] + +def valid_cmd_for_nbits(cmd_list, nbits): + for arg in cmd_list: + if arg.startswith('bits:'): + return int(arg.split(':')[1]) == nbits + return nbits == 0 + print_end_padding = False if "--print-end-padding" in sys.argv: print_end_padding = True @@ -160,20 +173,20 @@ if sys.argv[1] == "--emit-asm-macros": args = cmd[1:] param_names = [] param_list = [] - nibble_param_name = None + bits_param_name = None for i, arg in enumerate(args): param_name = chr(97 + i) param_names.append(param_name) - param_list.append(param_name + ("=0" if arg == "ign-arg" else "")) - if arg == "ign-arg" or arg == "arg": - nibble_param_name = param_name + param_list.append(param_name + ("=0" if arg.endswith(":ign") else "")) + if arg.startswith("bits:"): + bits_param_name = param_name print(f".macro {key}_{mn} {', '.join(param_list)}".rstrip()) - if nibble_param_name is not None: - print(f" .byte {hex(op)} + \\{nibble_param_name}") + if bits_param_name is not None: + print(f" .byte {hex(op)} + \\{bits_param_name}") else: print(f" .byte {hex(op)}") for arg, param_name in zip(args, param_names): - if arg in ['arg', 'ign-arg']: + if arg.startswith('bits:'): pass elif arg in ['s8', 'u8', 'hex8']: print(f" .byte \\{param_name}") @@ -192,13 +205,16 @@ if sys.argv[1] == "--emit-asm-macros": def emit_env_cmd(op, cmd): mn = cmd[0] + param_names = [] param_list = [] for i, arg in enumerate(cmd[1:]): - param_list.append(chr(97 + i)) + param_name = chr(97 + i) + param_names.append(param_name) + param_list.append(param_name + ("=0" if arg.endswith(":ign") else "")) print(f".macro envelope_{mn} {', '.join(param_list)}".rstrip()) if op is not None: print(f" .byte {hex(op >> 8)}, {hex(op & 0xff)}") - for param in param_list: + for param in param_names: print_hword("\\" + param) print(".endm\n") @@ -211,16 +227,20 @@ if sys.argv[1] == "--emit-asm-macros": emit_cmd(key, op, commands['layer_small'][op]) else: cmds = commands[key] - eu = [] - non_eu = [] + eu_sh = [] + us_jp = [] + sh = sh_chan_overrides if key == 'chan' else [] + non_sh = [] for op in sorted(cmds.keys()): mn = cmds[op][0] if mn == 'setnotepriority': - eu.append((0xe9, ['setnotepriority', 'u8'])) - non_eu.append((op, cmds[op])) + eu_sh.append((0xe9, ['setnotepriority', 'u8'])) + us_jp.append((op, cmds[op])) elif mn in ['reservenotes', 'unreservenotes']: - eu.append((op - 1, cmds[op])) - non_eu.append((op, cmds[op])) + eu_sh.append((op - 1, cmds[op])) + us_jp.append((op, cmds[op])) + elif mn in ['testlayerfinished', 'setlayer', 'ioreadval', 'freelayer']: + non_sh.append((op, cmds[op])) elif mn not in ['portamento', 'writeseq']: emit_cmd(key, op, cmds[op]) @@ -245,21 +265,30 @@ if sys.argv[1] == "--emit-asm-macros": emit_cmd(key, 0xfd, ['delay_long', 'var_long']) if key == 'layer': emit_cmd(key, 0xc0, ['delay_long', 'var_long']) - emit_cmd(key, 0x40, ['note1_long', 'arg', 'var_long', 'u8']) - if eu: - print(".ifdef VERSION_EU\n") - for (op, cmd) in eu: + emit_cmd(key, 0x40, ['note1_long', 'bits:4', 'var_long', 'u8']) + if eu_sh or us_jp or sh or non_sh: + print(".ifdef VERSION_SH\n") + for (op, cmd) in eu_sh: + emit_cmd(key, op, cmd) + for (op, cmd) in sh: emit_cmd(key, op, cmd) print(".else\n") - for (op, cmd) in non_eu: + for (op, cmd) in non_sh: emit_cmd(key, op, cmd) + print(".ifdef VERSION_EU\n") + for (op, cmd) in eu_sh: + emit_cmd(key, op, cmd) + print(".else\n") + for (op, cmd) in us_jp: + emit_cmd(key, op, cmd) + print(".endif\n") print(".endif\n") print("# envelope commands\n") emit_env_cmd(0, ['disable', 'u16']) - emit_env_cmd(2**16-1, ['hang', 'u16']) + emit_env_cmd(2**16-1, ['hang', 'u16:ign']) emit_env_cmd(2**16-2, ['goto', 'u16']) - emit_env_cmd(2**16-3, ['restart', 'u16']) + emit_env_cmd(2**16-3, ['restart', 'u16:ign']) emit_env_cmd(None, ['line', 'u16', 'u16']) print("# other commands\n") @@ -281,7 +310,7 @@ if sys.argv[1] == "--emit-asm-macros": filename = sys.argv[1] try: lang = filename.split('/')[-2] - assert lang in ['us', 'jp', 'eu'] + assert lang in ['us', 'jp', 'eu', 'sh'] seq_num = int(filename.split('/')[-1].split('_')[0], 16) except Exception: lang = '' @@ -306,7 +335,7 @@ seq_writes = [] # For simplicity, we force large notes always instead, which is valid for SM64. force_large_notes = True -if lang == 'eu': +if lang in ['eu', 'sh']: # unreservenotes moved to 0xf0 in EU, and reservenotes took its place commands['chan'][0xf0] = commands['chan'][0xf1] commands['chan'][0xf1] = commands['chan'][0xf2] @@ -319,8 +348,11 @@ if lang == 'eu': commands['chan'][0xe9] = ['setnotepriority', 'u8'] del commands['chan'][0x60] -def is_arg_command(cmd_args): - return 'arg' in cmd_args or 'ign-arg' in cmd_args +if lang == 'sh': + del commands['chan'][0x00] + del commands['chan'][0xa0] + for op, cmd_list in sh_chan_overrides: + commands['chan'][op] = cmd_list def gen_label(ind, tp): nice_tp = tp.replace('_small', '').replace('_large', '') @@ -412,18 +444,16 @@ def decode_one(state): ins_byte = u8() cmds = commands[tp] - if ins_byte in cmds and not is_arg_command(cmds[ins_byte]): - used_b = ins_byte - arg = None - elif ins_byte & 0xf0 in cmds and is_arg_command(cmds[ins_byte & 0xf0]): - used_b = ins_byte & 0xf0 - arg = ins_byte & 0xf - elif ins_byte & 0xc0 in cmds and is_arg_command(cmds[ins_byte & 0xc0]) and tp.startswith('layer'): - used_b = ins_byte & 0xc0 - arg = ins_byte & 0x3f - else: - errors.append(f"unrecognized instruction {hex(ins_byte)} for type {tp} at label {gen_label(orig_pos, tp)}") - return + nbits = 0 + used_b = ins_byte + while True: + if used_b in cmds and valid_cmd_for_nbits(cmds[used_b], nbits): + break + used_b &= ~(1 << nbits) + nbits += 1 + if nbits == 8: + errors.append(f"unrecognized instruction {hex(ins_byte)} for type {tp} at label {gen_label(orig_pos, tp)}") + return out_mn = gen_mnemonic(tp, used_b) out_args = [] @@ -434,10 +464,10 @@ def decode_one(state): for a in cmd_args: if cmd_mn == 'portamento' and len(out_args) == 2 and (int(out_args[0], 0) & 0x80) == 0: a = 'var' - if a == 'arg': - out_args.append(str(arg)) - elif a == 'ign-arg' and arg != 0: - out_args.append(str(arg)) + if a.startswith('bits:'): + low_bits = ins_byte & ((1 << nbits) - 1) + if not (a.endswith(':ign') and low_bits == 0): + out_args.append(str(low_bits)) elif a == 'u8': out_args.append(str(u8())) elif a == 'hex8': @@ -588,10 +618,10 @@ def main(): elif lang == 'eu': sound_banks = [ (0x154, 0x70), - (0x8FE, 0x38), # stated as 0x30? + (0x8FE, 0x38), # stated as 0x30 (0xBBC, 0x40), (0xFA5, 0x80), - (0x1B0C, 0x28), # stated as 0x20? + (0x1B0C, 0x28), # stated as 0x20 (0x1E67, 0x80), (0x298A, 0x20), (0x2B36, 0x40), @@ -607,6 +637,30 @@ def main(): (0x33CC, 'envelope'), (0x34A8, 'envelope'), ] + elif lang == 'sh': + sound_banks = [ + (0x154, 0x70), + (0x8FE, 0x38), # stated as 0x30 + (0xBBC, 0x40), + (0xFA5, 0x80), + (0x1B11, 0x28), # stated as 0x20 + (0x1E6C, 0x80), + (0x298F, 0x20), + (0x2B3B, 0x40), + # same script as bank 3 + # same script as bank 5 + ] + + unused = [ + (0xF9A, 'chan'), + (0x218A, 'layer_large'), + (0x230F, 'layer_large'), + (0x23E9, 'layer_large'), + (0x2A8B, 'chan'), + (0x33D0, 'envelope'), + (0x34AC, 'envelope'), + ] + for (addr, count) in sound_banks: for i in range(count): diff --git a/tools/skyconv.c b/tools/skyconv.c index 4c2245a1..ff4cbfd2 100644 --- a/tools/skyconv.c +++ b/tools/skyconv.c @@ -13,6 +13,8 @@ #include "n64graphics.h" #include "utils.h" +#define SKYCONV_ENCODING ENCODING_U8 + typedef struct { rgba *px; bool useless; @@ -267,16 +269,14 @@ static void print_raw_data(FILE *cFile, TextureTile *tile) { ImageProps props = IMAGE_PROPERTIES[type][true]; uint8_t *raw = malloc(props.tileWidth * props.tileHeight * 2); int size = rgba2raw(raw, tile->px, props.tileWidth, props.tileHeight, 16); - for (int i = 0; i < size; ++i) { - fprintf(cFile, "0x%hhX,", raw[i]); - } + fprint_write_output(cFile, SKYCONV_ENCODING, raw, size); free(raw); } static void write_skybox_c() { /* write c data to disc */ const ImageProps props = IMAGE_PROPERTIES[type][true]; - char fBuffer[PATH_MAX] = ""; + char fBuffer[PATH_MAX * 2] = ""; FILE *cFile; if (realpath(output, fBuffer) == NULL) { @@ -293,26 +293,26 @@ static void write_skybox_c() { /* write c data to disc */ fprintf(stderr, "err: Could not open %s\n", fBuffer); } - fprintf(cFile, "#include \"sm64.h\"\n\n#include \"make_const_nonconst.h\"\n\n"); + fprintf(cFile, "#include \"types.h\"\n\n#include \"make_const_nonconst.h\"\n\n"); for (int i = 0; i < props.numRows * props.numCols; i++) { if (!tiles[i].useless) { if (storeNamesOnly) { fprintf( cFile, - "ALIGNED8 static const u8 %s_skybox_texture_%05X[] = " + "ALIGNED8 static const Texture %s_skybox_texture_%05X[] = " "\"textures/skybox_tiles/%s.%d.rgba16\";\n\n", skyboxName, tiles[i].pos, skyboxName, tiles[i].pos ); } else { - fprintf(cFile, "ALIGNED8 static const u8 %s_skybox_texture_%05X[] = {\n", skyboxName, tiles[i].pos); + fprintf(cFile, "ALIGNED8 static const Texture %s_skybox_texture_%05X[] = {\n", skyboxName, tiles[i].pos); print_raw_data(cFile, &tiles[i]); fputs("};\n\n", cFile); } } } - fprintf(cFile, "const u8 *const %s_skybox_ptrlist[] = {\n", skyboxName); + fprintf(cFile, "const Texture *const %s_skybox_ptrlist[] = {\n", skyboxName); for (int row = 0; row < 8; row++) { for (int col = 0; col < 10; col++) { @@ -350,12 +350,12 @@ static void write_cake_c() { if (storeNamesOnly) { fprintf( cFile, - "ALIGNED8 static const u8 cake_end_texture_%s%d[] = " + "ALIGNED8 static const Texture cake_end_texture_%s%d[] = " "\"textures/skybox_tiles/cake%s.%d.rgba16\";\n\n", euSuffx, i, *euSuffx ? "_eu" : "", tiles[i].pos ); } else { - fprintf(cFile, "ALIGNED8 static const u8 cake_end_texture_%s%d[] = {\n", euSuffx, i); + fprintf(cFile, "ALIGNED8 static const Texture cake_end_texture_%s%d[] = {\n", euSuffx, i); print_raw_data(cFile, &tiles[i]); fputs("};\n\n", cFile); } diff --git a/tools/utils.c b/tools/utils.c index 3ba6e3e6..e9974a1c 100644 --- a/tools/utils.c +++ b/tools/utils.c @@ -45,28 +45,40 @@ int is_power2(unsigned int val) return (val == 1); } -void fprint_hex(FILE *fp, const unsigned char *buf, int length) +int fprint_write_output(FILE *fp, write_encoding encoding, const uint8_t *raw, int length) { - int i; - for (i = 0; i < length; i++) { - fprint_byte(fp, buf[i]); - fputc(' ', fp); + typedef struct { + int bytes_per_val; + const char *suffix; + } encoding_format; + const encoding_format enc_fmt[] = { + [ENCODING_RAW] = {0, ""}, + [ENCODING_U8] = {sizeof(uint8_t), ""}, + [ENCODING_U16] = {sizeof(uint16_t), ""}, + [ENCODING_U32] = {sizeof(uint32_t), ""}, + [ENCODING_U64] = {sizeof(uint64_t), "ULL"}, + }; + int flength = 0; + const encoding_format *fmt = &enc_fmt[encoding]; + switch (encoding) { + case ENCODING_RAW: + flength = fwrite(raw, 1, length, fp); + break; + case ENCODING_U8: + case ENCODING_U16: + case ENCODING_U32: + case ENCODING_U64: + for (int w = 0; w < length; w += fmt->bytes_per_val) { + flength += fprintf(fp, "0x"); + for (int b = 0; b < fmt->bytes_per_val; b++) { + int off = w + b; + flength += fprintf(fp, "%02x", off < length ? raw[off] : 0x00); + } + flength += fprintf(fp, "%s%c", fmt->suffix, (w < length - fmt->bytes_per_val) ? ',' : '\n'); + } + break; } -} - -void fprint_hex_source(FILE *fp, const unsigned char *buf, int length) -{ - int i; - for (i = 0; i < length; i++) { - if (i > 0) fputs(", ", fp); - fputs("0x", fp); - fprint_byte(fp, buf[i]); - } -} - -void print_hex(const unsigned char *buf, int length) -{ - fprint_hex(stdout, buf, length); + return flength; } void swap_bytes(unsigned char *data, long length) diff --git a/tools/utils.h b/tools/utils.h index 5112b1bf..80f4acc7 100644 --- a/tools/utils.h +++ b/tools/utils.h @@ -2,6 +2,7 @@ #define UTILS_H_ #include +#include // defines @@ -41,15 +42,6 @@ (buf)[1] = ((val)) & 0xFF; \ } while(0) -// print nibbles and bytes -#define fprint_nibble(FP, NIB_) fputc((NIB_) < 10 ? ('0' + (NIB_)) : ('A' + (NIB_) - 0xA), FP) -#define fprint_byte(FP, BYTE_) do { \ - fprint_nibble(FP, (BYTE_) >> 4); \ - fprint_nibble(FP, (BYTE_) & 0x0F); \ - } while(0) -#define print_nibble(NIB_) fprint_nibble(stdout, NIB_) -#define print_byte(BYTE_) fprint_byte(stdout, BYTE_) - // Windows compatibility #if defined(_MSC_VER) || defined(__MINGW32__) #include @@ -68,13 +60,21 @@ typedef struct int count; } dir_list; +typedef enum +{ + ENCODING_RAW, + ENCODING_U8, + ENCODING_U16, + ENCODING_U32, + ENCODING_U64, +} write_encoding; + // global verbosity setting extern int g_verbosity; #undef ERROR #define ERROR(...) fprintf(stderr, __VA_ARGS__) #define INFO(...) if (g_verbosity) printf(__VA_ARGS__) -#define INFO_HEX(...) if (g_verbosity) print_hex(__VA_ARGS__) // functions @@ -88,13 +88,12 @@ float read_f32_be(unsigned char *buf); // returns 1 if val is power of 2, 0 otherwise int is_power2(unsigned int val); -// print buffer as hex bytes +// print buffer as raw binary, hex u8, hex u16, hex u32, hex u64. pads to encoding size // fp: file pointer +// encoding: encoding type to use (see write_encoding) // buf: buffer to read bytes from // length: length of buffer to print -void fprint_hex(FILE *fp, const unsigned char *buf, int length); -void fprint_hex_source(FILE *fp, const unsigned char *buf, int length); -void print_hex(const unsigned char *buf, int length); +int fprint_write_output(FILE *fp, write_encoding encoding, const uint8_t *buf, int length); // perform byteswapping to convert from v64 to z64 ordering void swap_bytes(unsigned char *data, long length); diff --git a/undefined_syms.txt b/undefined_syms.txt index c4ab1176..057abcec 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -37,6 +37,10 @@ PI_DRAM_ADDR_REG = 0xA4600000; PI_CART_ADDR_REG = 0xA4600004; PI_WR_LEN_REG = 0xA460000C; PI_STATUS_REG = 0xA4600010; +PI_BSD_DOM1_LAT_REG = 0xA4600014; +PI_BSD_DOM1_PWD_REG = 0xA4600018; +PI_BSD_DOM1_PGS_REG = 0xA460001C; +PI_BSD_DOM1_RLS_REG = 0xA4600020; /* RI */ @@ -55,12 +59,3 @@ D_B0000014 = 0xB0000014; D_C0000000 = 0xC0000000; D_C0000008 = 0xC0000008; D_C000000C = 0xC000000C; - -/* Shindou functions */ -func_sh_802F69CC = 0x802F69CC; -osMotorStop = 0x80302EF0; -osMotorStart = 0x80303090; -osMotorInit = 0x803033AC; -func_sh_803016A0 = 0x803016A0; -func_sh_803016D0 = 0x803016D0; -func_sh_80301820 = 0x80301820; diff --git a/util.mk b/util.mk new file mode 100644 index 00000000..75af9817 --- /dev/null +++ b/util.mk @@ -0,0 +1,16 @@ +# util.mk - Miscellaneous utility functions for use in Makefiles + +# Throws an error if the value of the variable named by $(1) is not in the list given by $(2) +define validate-option + # value must be part of the list + ifeq ($$(filter $($(1)),$(2)),) + $$(error Value of $(1) must be one of the following: $(2)) + endif + # value must be a single word (no whitespace) + ifneq ($$(words $($(1))),1) + $$(error Value of $(1) must be one of the following: $(2)) + endif +endef + +# Returns the path to the command $(1) if exists. Otherwise returns an empty string. +find-command = $(shell which $(1) 2>/dev/null)