Refresh 8

This commit is contained in:
n64 2020-04-03 14:57:26 -04:00
parent 06ec56df7f
commit c45aa301bb
279 changed files with 6522 additions and 7273 deletions

42
CHANGES
View File

@ -1,3 +1,45 @@
Refresh #8
1.) Use INT_STATUS_ macros for oInteractStatus (#911)
2.) Update bullet_bill.inc.c (#912)
3.) Make geo.c in levels nonconst to reduce diffs with gcc enhancement patch in future (#913)
4.) Improve process_level_music_dynamics (#915)
5.) add AVOID_UB define for fixing libultra aliasing. (#916)
6.) const hack to TARGET_N64 and tweak ld script (#918)
7.) Replace raw level/course numbers with defines (#919)
8.) Label all graph node flags. (#920)
9.) readme.md capitalization
10.) The Big Function PR (Part 5) (#910)
11.) Label hardware registers (#922)
12.) Match EU synthesis_process_note (#923)
13.) Some quick value changes (#909)
14.) Added sequence player defines (#926)
15.) Shindou diffs 2 [merge game.c and display.c, required for SH] (#927)
16.) Match synthesis_process_notes and use -sopt for synthesis.c (#928)
17.) Fix mips64-binutils for Fedora 31 and similar Linux distros (#931)
18.) Update first-diff.py to work with Shindou (#933)
19.) Labelled behavior_script.c (#929)
20.) shindou diffs up to level_update (#932)
21.) Update diff.py and diff_settings.py to work with SH (#936)
22.) Add some Shindou resources to extract_assets.py (#939)
23.) Label and document gd_math.c (#930)
24.) Label all of Mario's actions. (#941)
25.) Label all particles. (#940)
26.) Renamed death related warpBhvs (#942)
27.) Small Shindou differences (#945)
28.) match player_performed_grab_escape_action in all versions (#943)
29.) add main alignment (aglab2, #947)
30.) Match a bunch of fake EU matchings (#944)
31.) Shindou diffs round 4 (#937)
32.) Easy PAL fake matchings (#946)
33.) Merge object_helpers and object_helpers2 headers (#948)
34.) match cap_check_quicksand (#950)
35.) Shindou crash screen diffs (#938)
36.) Thread6 (#951)
37.) Correct IPL3 function and label addresses (#952)
38.) Add COMPILER flag for Makefile and add official mips gcc support. (#953)
39.) add align to sequence_00 (fixes gcc build) (#957)
40.) Fixed itty bitty typo (#959)
Refresh #7
1.) update README.md (#861)
2.) [eu] fix decompilation bugs in synthesis_process_note (#862)

View File

@ -19,6 +19,12 @@ COMPARE ?= 1
NON_MATCHING ?= 0
# Build for the N64 (turn this off for ports)
TARGET_N64 ?= 1
# Compiler to use (ido or gcc)
COMPILER ?= ido
ifeq ($(COMPILER),gcc)
NON_MATCHING := 1
endif
# Release
@ -51,7 +57,7 @@ ifeq ($(VERSION),sh)
GRUCODE_ASFLAGS := --defsym F3D_NEW=1
TARGET := sm64.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
NOEXTRACT := 1
else
$(error unknown version "$(VERSION)")
endif
@ -96,6 +102,7 @@ endif
ifeq ($(NON_MATCHING),1)
VERSION_CFLAGS := $(VERSION_CFLAGS) -DNON_MATCHING -DAVOID_UB
VERSION_ASFLAGS := --defsym AVOID_UB=1
COMPARE := 0
endif
@ -153,8 +160,12 @@ ULTRA_BIN_DIRS := lib/bin
GODDARD_SRC_DIRS := src/goddard src/goddard/dynlists
MIPSISET := -mips2
MIPSBIT := -32
MIPSISET := -mips2 -32
ifeq ($(COMPILER),gcc)
MIPSISET := -mips3
endif
ifeq ($(VERSION),eu)
OPT_FLAGS := -O2
@ -166,6 +177,11 @@ else
endif
endif
# Use a default opt flag for gcc
ifeq ($(COMPILER),gcc)
OPT_FLAGS := -O2
endif
# File dependencies and variables for specific files
include Makefile.split
@ -228,6 +244,8 @@ IRIX_ROOT := tools/ido5.3_compiler
ifeq ($(shell type mips-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
CROSS := mips-linux-gnu-
else ifeq ($(shell type mips64-linux-gnu-ld >/dev/null 2>/dev/null; echo $$?), 0)
CROSS := mips64-linux-gnu-
else
CROSS := mips64-elf-
endif
@ -249,6 +267,11 @@ OBJDUMP := $(CROSS)objdump
OBJCOPY := $(CROSS)objcopy
PYTHON := python3
# change the compiler to gcc, to use the default, install the gcc-mips-linux-gnu package
ifeq ($(COMPILER),gcc)
CC := $(CROSS)gcc
endif
ifeq ($(TARGET_N64),1)
TARGET_CFLAGS := -nostdinc -I include/libc -DTARGET_N64
CC_CFLAGS := -fno-builtin
@ -259,13 +282,19 @@ INCLUDE_CFLAGS := -I include -I $(BUILD_DIR) -I $(BUILD_DIR)/include -I src -I .
# Check code syntax with host compiler
CC_CHECK := gcc -fsyntax-only -fsigned-char $(CC_CFLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) -std=gnu90 -Wall -Wextra -Wno-format-security -Wno-main -DNON_MATCHING -DAVOID_UB $(VERSION_CFLAGS) $(GRUCODE_CFLAGS)
COMMON_CFLAGS = $(OPT_FLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(MIPSISET) $(GRUCODE_CFLAGS)
ASFLAGS := -march=vr4300 -mabi=32 -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS) $(GRUCODE_ASFLAGS)
CFLAGS = -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -Xfullwarn -signed $(OPT_FLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(MIPSISET) $(GRUCODE_CFLAGS)
CFLAGS = -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -Xfullwarn -signed $(COMMON_CFLAGS) $(MIPSBIT)
OBJCOPYFLAGS := --pad-to=0x800000 --gap-fill=0xFF
SYMBOL_LINKING_FLAGS := $(addprefix -R ,$(SEG_FILES))
LDFLAGS := -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/sm64.$(VERSION).map --no-check-sections $(SYMBOL_LINKING_FLAGS)
ENDIAN_BITWIDTH := $(BUILD_DIR)/endian-and-bitwidth
ifeq ($(COMPILER),gcc)
CFLAGS := -march=vr4300 -mfix4300 -mno-shared -G 0 -mhard-float -fno-stack-protector -fno-common -I include -I src/ -I $(BUILD_DIR)/include -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra $(COMMON_CFLAGS)
endif
ifeq ($(shell getconf LONG_BIT), 32)
# Work around memory allocation bug in QEMU
export QEMU_GUEST_BASE := 1
@ -297,6 +326,11 @@ LOADER = loader64
LOADER_FLAGS = -vwf
SHA1SUM = sha1sum
# Use Objcopy instead of extract_data_for_mio
ifeq ($(COMPILER),gcc)
EXTRACT_DATA_FOR_MIO := $(OBJCOPY) -O binary --only-section=.data
endif
###################### Dependency Check #####################
BINUTILS_VER_MAJOR := $(shell $(LD) --version | grep ^GNU | sed 's/^.* //; s/\..*//g')
@ -339,6 +373,10 @@ $(BUILD_DIR)/include/text_strings.h: include/text_strings.h.in
$(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
@ -486,7 +524,7 @@ $(BUILD_DIR)/assets/mario_anim_data.c: $(wildcard assets/anims/*.inc.c)
$(BUILD_DIR)/assets/demo_data.c: assets/demo_data.json $(wildcard assets/demos/*.bin)
$(PYTHON) tools/demo_data_converter.py assets/demo_data.json $(VERSION_CFLAGS) > $@
ifeq ($(COMPILER),ido)
# Source code
$(BUILD_DIR)/levels/%/leveldata.o: OPT_FLAGS := -g
$(BUILD_DIR)/actors/%.o: OPT_FLAGS := -g
@ -520,6 +558,7 @@ else
# The source-to-source optimizer copt is enabled for audio. This makes it use
# acpp, which needs -Wp,-+ to handle C++-style comments.
$(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,-+
# Add a target for build/eu/src/audio/*.copt to make it easier to see debug
$(BUILD_DIR)/src/audio/%.acpp: src/audio/%.c
@ -527,6 +566,7 @@ $(BUILD_DIR)/src/audio/%.acpp: src/audio/%.c
$(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
endif
endif
ifeq ($(NON_MATCHING),0)
$(GLOBAL_ASM_O_FILES): CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) --

View File

@ -113,4 +113,4 @@ discuss what you would like to change.
Run clang-format on your code to ensure it meets the project's coding standards.
Official discord: https://discord.gg/27JtCWs
Official Discord: https://discord.gg/27JtCWs

View File

@ -5,15 +5,24 @@
.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(D_A4700000)
addiu $t0, %lo(D_A4700000)
lui $t0, %hi(RI_MODE_REG)
addiu $t0, %lo(RI_MODE_REG)
lw $t1, 0xc($t0)
bnez $t1, .L000003D0
bnez $t1, .LA4000410
nop
addiu $sp, $sp, -0x18
sw $s3, ($sp)
@ -21,47 +30,47 @@
sw $s5, 8($sp)
sw $s6, 0xc($sp)
sw $s7, 0x10($sp)
lui $t0, %hi(D_A4700000)
addiu $t0, %lo(D_A4700000)
lui $t2, (0xa3f80000 >> 16) # $t2, 0xa3f8
lui $t3, (0xa3f00000 >> 16) # $t3, 0xa3f0
lui $t4, %hi(D_A4300000)
addiu $t4, %lo(D_A4300000)
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
.L0000005C:
.LA400009C:
nop
addi $s1, $s1, -1
bnez $s1, .L0000005C
bnez $s1, .LA400009C
nop
sw $zero, 8($t0)
ori $t1, $zero, 20
sw $t1, 0xc($t0)
sw $zero, ($t0)
li $s1, 4
.L00000080:
.LA40000C0:
nop
addi $s1, $s1, -1
bnez $s1, .L00000080
bnez $s1, .LA40000C0
nop
ori $t1, $zero, 14
sw $t1, ($t0)
li $s1, 32
.L0000009C:
.LA40000DC:
addi $s1, $s1, -1
bnez $s1, .L0000009C
bnez $s1, .LA40000DC
ori $t1, $zero, 271
sw $t1, ($t4)
lui $t1, (0x18082838 >> 16) # lui $t1, 0x1808
ori $t1, (0x18082838 & 0xFFFF) # ori $t1, $t1, 0x2838
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) # $t7, 0xa3f0
lui $t7, (0xA3F00000 >> 16)
move $t8, $zero
lui $t9, (0xA3F00000 >> 16)
lui $s6, (0xA0000000 >> 16)
@ -72,25 +81,25 @@
lui $s4, (0xA0000000 >> 16)
addiu $sp, $sp, -0x48
move $fp, $sp
lui $s0, %hi(D_A4300004) # $s0, 0xa430
lw $s0, %lo(D_A4300004)($s0)
lui $s1, 0x0101 # $s1, 0x101
addiu $s1, 0x0101 # addiu $s1, $s1, 0x101
bne $s0, $s1, .L00000120
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 .L00000128
b .LA4000168
nop
.L00000120:
.LA4000160:
li $s0, 1024
ori $s1, $t3, 0x8000
.L00000128:
.LA4000168:
sw $t6, 4($s1)
addiu $s5, $t7, 0xc
jal func_04000778
jal func_A4000778
nop
beqz $v0, .L0000021C
beqz $v0, .LA400025C
nop
sw $v0, ($sp)
li $t1, 8192
@ -103,7 +112,7 @@
li $t1, 4096
sw $t1, ($t4)
lui $t0, 0xb019
bne $t3, $t0, .L000001A0
bne $t3, $t0, .LA40001E0
nop
lui $t0, 0x800
add $t8, $t8, $t0
@ -114,12 +123,12 @@
add $s4, $s4, $t0
sll $s2, $s2, 1
addi $s2, $s2, 1
b .L000001A8
b .LA40001E8
nop
.L000001A0:
.LA40001E0:
lui $t0, 0x10
add $s4, $s4, $t0
.L000001A8:
.LA40001E8:
li $t0, 8192
sw $t0, ($t4)
lw $t1, 0x24($t7)
@ -128,47 +137,47 @@
sw $t0, ($t4)
andi $t1, $t1, 0xffff
li $t0, 1280
bne $t1, $t0, .L000001F0
bne $t1, $t0, .LA4000230
nop
lui $k1, 0x100
and $k0, $k0, $k1
bnez $k0, .L000001F0
bnez $k0, .LA4000230
nop
lui $t0, (0x101C0A04 >> 16) # lui $t0, 0x101c
ori $t0, (0x101C0A04 & 0xFFFF) # ori $t0, $t0, 0xa04
lui $t0, (0x101C0A04 >> 16)
ori $t0, (0x101C0A04 & 0xFFFF)
sw $t0, 0x18($t7)
b .L000001FC
.L000001F0:
lui $t0, (0x080C1204 >> 16) # lui $t0, 0x80c
ori $t0, (0x080C1204 & 0xFFFF) # ori $t0, $t0, 0x1204
b .LA400023C
.LA4000230:
lui $t0, (0x080C1204 >> 16)
ori $t0, (0x080C1204 & 0xFFFF)
sw $t0, 0x18($t7)
.L000001FC:
.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, .L00000128
bnez $t0, .LA4000168
nop
.L0000021C:
.LA400025C:
li $t0, 0xc4000000
sw $t0, 0xc($t2)
li $t0, 0x80000000
sw $t0, 0x4($t2)
move $sp, $fp
move $v1, $zero
.L00000234:
.LA4000274:
lw $t1, 4($sp)
lui $t0, 0xb009
bne $t1, $t0, .L00000298
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_04000A40
jal func_A4000A40
nop
lw $t0, ($s6)
lui $t0, 8
@ -183,14 +192,14 @@
add $t9, $t9, $s0
lui $t0, 0x10
add $s6, $s6, $t0
b .L0000031C
.L00000298:
b .LA400035C
.LA40002D8:
sw $s7, 4($s1)
addiu $s5, $a2, 0xc
lw $a0, ($sp)
addi $sp, $sp, 8
li $a1, 1
jal func_04000A40
jal func_A4000A40
nop
lw $t0, ($a3)
lui $t0, 8
@ -218,22 +227,22 @@
add $a2, $a2, $s0
lui $t0, 0x20
add $a3, $a3, $t0
.L0000031C:
.LA400035C:
addiu $v1, $v1, 1
slt $t0, $v1, $t5
bnez $t0, .L00000234
bnez $t0, .LA4000274
nop
lui $t2, %hi(D_A4700010) # $t2, 0xa470
lui $t2, %hi(RI_REFRESH_REG)
sll $s2, $s2, 0x13
lui $t1, (0x00063634 >> 16) # lui $t1, 6
ori $t1, (0x00063634 & 0xFFFF) # ori $t1, $t1, 0x3634
lui $t1, (0x00063634 >> 16)
ori $t1, (0x00063634 & 0xFFFF)
or $t1, $t1, $s2
sw $t1, %lo(D_A4700010)($t2)
lw $t1, %lo(D_A4700010)($t2)
lui $t0, (0xA0000300 >> 16) # $t0, 0xa000
ori $t0, (0xA0000300 & 0xFFFF) # ori $t0, $t0, 0x300
lui $t1, (0x0FFFFFFF >> 16) # lui $t1, 0xfff
ori $t1, (0x0FFFFFFF & 0xFFFF) # ori $t1, $t1, 0xffff
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
@ -244,101 +253,101 @@
lw $s6, 0xc($sp)
lw $s7, 0x10($sp)
addiu $sp, $sp, 0x18
lui $t0, %hi(D_80000000)
addiu $t0, $t0, %lo(D_80000000)
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
.L00000398:
.LA40003D8:
cache 8, ($t0)
sltu $at, $t0, $t1
bnez $at, .L00000398
bnez $at, .LA40003D8
addiu $t0, $t0, 0x20
lui $t0, %hi(D_80000000)
addiu $t0, %lo(D_80000000)
lui $t0, %hi(EXCEPTION_TLB_MISS)
addiu $t0, %lo(EXCEPTION_TLB_MISS)
addiu $t1, $t0, 0x2000
addiu $t1, $t1, -0x10
.L000003B8:
.LA40003F8:
cache 9, ($t0)
sltu $at, $t0, $t1
bnez $at, .L000003B8
bnez $at, .LA40003F8
addiu $t0, $t0, 0x10
b .L00000418
b .LA4000458
nop
.L000003D0:
lui $t0, %hi(D_80000000)
addiu $t0, %lo(D_80000000)
.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
.L000003E8:
.LA4000428:
cache 8, ($t0)
sltu $at, $t0, $t1
bnez $at, .L000003E8
bnez $at, .LA4000428
addiu $t0, $t0, 0x20
lui $t0, %hi(D_80000000)
addiu $t0, %lo(D_80000000)
lui $t0, %hi(EXCEPTION_TLB_MISS)
addiu $t0, %lo(EXCEPTION_TLB_MISS)
addiu $t1, $t0, 0x2000
addiu $t1, $t1, -0x10
.L00000408:
.LA4000448:
cache 1, ($t0)
sltu $at, $t0, $t1
bnez $at, .L00000408
bnez $at, .LA4000448
addiu $t0, $t0, 0x10
.L00000418:
lui $t2, %hi(D_A4000000)
addiu $t2, $t2, %lo(D_A4000000)
.LA4000458:
lui $t2, %hi(SP_DMEM)
addiu $t2, $t2, %lo(SP_DMEM)
lui $t3, 0xfff0
lui $t1, 0x0010 # $t1, 0x10
lui $t1, 0x0010
and $t2, $t2, $t3
lui $t0, %hi(D_A40004C0) # $t0, 0xa400
addiu $t1, -1 # addiu $t1, $t1, -1
lui $t3, %hi(D_A4000774) # $t3, 0xa400
addiu $t0, %lo(D_A40004C0) # addiu $t0, $t0, 0x4c0
addiu $t3, %lo(D_A4000774) # addiu $t3, $t3, 0x774
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
.L00000458:
.LA4000498:
lw $t5, ($t0)
addiu $t0, $t0, 4
sltu $at, $t0, $t3
addiu $t1, $t1, 4
bnez $at, .L00000458
bnez $at, .LA4000498
sw $t5, -4($t1)
lui $t4, %hi(D_80000000)
addiu $t4, %lo(D_80000000)
lui $t4, %hi(EXCEPTION_TLB_MISS)
addiu $t4, %lo(EXCEPTION_TLB_MISS)
jr $t4
nop
lui $t3, %hi(D_B0000008) # $t3, 0xb000
lui $t3, %hi(D_B0000008)
lw $t1, %lo(D_B0000008)($t3)
lui $t2, (0x1FFFFFFF >> 16) # lui $t2, 0x1fff
ori $t2, (0x1FFFFFFF & 0xFFFF) # ori $t2, $t2, 0xffff
lui $at, %hi(D_A4600000)
lui $t2, (0x1FFFFFFF >> 16)
ori $t2, (0x1FFFFFFF & 0xFFFF)
lui $at, %hi(PI_DRAM_ADDR_REG)
and $t1, $t1, $t2
sw $t1, %lo(D_A4600000)($at)
lui $t0, %hi(D_A4600010) # $t0, 0xa460
.L000004A0:
lw $t0, %lo(D_A4600010)($t0)
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, .L000004A0
lui $t0, %hi(D_A4600010)
bnezl $t0, .LA40004D0
lui $t0, %hi(PI_STATUS_REG)
li $t0, 0x1000
add $t0, $t0, $t3
and $t0, $t0, $t2
lui $at, %hi(D_A4600004) # $at, 0xa460
sw $t0, %lo(D_A4600004)($at)
lui $t2, 0x0010 # $t2, 0x10
addiu $t2, 0xFFFF # addiu $t2, $t2, -1
lui $at, %hi(D_A460000C) # $at, 0xa460
sw $t2, %lo(D_A460000C)($at)
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)
.L000004D4:
.LA4000514:
nop
nop
nop
@ -367,16 +376,16 @@
nop
nop
nop
lui $t3, %hi(D_A4600010) # $t3, 0xa460
lw $t3, %lo(D_A4600010)($t3)
andi $t3, $t3, 1
bnez $t3, .L000004D4
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) # $t3, 0xb000
lui $t3, %hi(D_B0000008)
lw $a0, %lo(D_B0000008)($t3)
move $a1, $s6
lui $at, (0x5D588B65 >> 16) # lui $at, 0x5d58
ori $at, (0x5D588B65 & 0xFFFF) # ori $at, $at, 0x8b65
lui $at, (0x5D588B65 >> 16)
ori $at, (0x5D588B65 & 0xFFFF)
multu $a1, $at
addiu $sp, $sp, -0x20
sw $ra, 0x1c($sp)
@ -394,14 +403,14 @@
move $s0, $v0
move $a2, $v0
move $t4, $v0
.L000005B0:
.LA40005F0:
lw $v0, ($t1)
addu $v1, $a3, $v0
sltu $at, $v1, $a3
beqz $at, .L000005C8
beqz $at, .LA4000608
move $a1, $v1
addiu $t2, $t2, 1
.L000005C8:
.LA4000608:
andi $v1, $v0, 0x1f
subu $t7, $t5, $v1
srlv $t8, $v0, $t7
@ -410,104 +419,103 @@
sltu $at, $a2, $v0
move $a3, $a1
xor $t3, $t3, $v0
beqz $at, .L000005FC
beqz $at, .LA400063C
addu $s0, $s0, $a0
xor $t9, $a3, $v0
b .L00000600
b .LA4000640
xor $a2, $t9, $a2
.L000005FC:
.LA400063C:
xor $a2, $a2, $a0
.L00000600:
.LA4000640:
addiu $t0, $t0, 4
xor $t7, $v0, $s0
addiu $t1, $t1, 4
bne $t0, $ra, .L000005B0
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) # $t3, 0xb000
lui $t3, %hi(D_B0000010)
lw $t0, %lo(D_B0000010)($t3)
bne $a3, $t0, .L00000648
bne $a3, $t0, halt
nop
lw $t0, %lo(D_B0000014)($t3)
bne $s0, $t0, .L00000648
bne $s0, $t0, halt
nop
bal func_00000650
bal func_A4000690
nop
func_00000648:
.L00000648:
bal func_00000648
halt:
bal halt
nop
func_00000650:
lui $t1, %hi(D_A4080000)
lw $t1, %lo(D_A4080000)($t1)
func_A4000690:
lui $t1, %hi(SP_PC)
lw $t1, %lo(SP_PC)($t1)
lw $s0, 0x14($sp)
lw $ra, 0x1c($sp)
beqz $t1, .L0000067C
beqz $t1, .LA40006BC
addiu $sp, $sp, 0x20
li $t2, 65
lui $at, %hi(D_A4040010) # $at, 0xa404
sw $t2, %lo(D_A4040010)($at)
lui $at, %hi(D_A4080000)
sw $zero, %lo(D_A4080000)($at)
.L0000067C:
lui $t3, (0x00AAAAAE >> 16) # lui $t3, 0xaa
ori $t3, (0x00AAAAAE & 0xFFFF) # ori $t3, $t3, 0xaaae
lui $at, %hi(D_A4040010) # $at, 0xa404
sw $t3, %lo(D_A4040010)($at)
lui $at, %hi(D_A430000C) # $at, 0xa430
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(D_A430000C)($at)
lui $at, %hi(D_A4800018) # $at, 0xa480
sw $zero, %lo(D_A4800018)($at)
lui $at, %hi(D_A450000C) # $at, 0xa450
sw $zero, %lo(D_A450000C)($at)
lui $at, %hi(D_A4300000)
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(D_A4300000)($at)
sw $t1, %lo(MI_MODE_REG)($at)
li $t1, 2
lui $at, %hi(D_A4600010) # $at, 0xa460
lui $t0, (0xA0000300 >> 16) # $t0, 0xa000
ori $t0, (0xA0000300 & 0xFFFF) # ori $t0, $t0, 0x300
sw $t1, %lo(D_A4600010)($at)
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, .L000006E8
beqz $s3, .LA4000728
sw $s4, ($t0)
lui $t1, 0xa600
b .L000006F0
b .LA4000730
addiu $t1, $t1, 0
.L000006E8:
.LA4000728:
lui $t1, 0xb000
addiu $t1, $t1, 0
.L000006F0:
.LA4000730:
sw $t1, 0x8($t0)
lui $t0, %hi(D_A4000000)
addiu $t0, %lo(D_A4000000)
lui $t0, %hi(SP_DMEM)
addiu $t0, %lo(SP_DMEM)
addi $t1, $t0, 0x1000
.L00000700:
.LA4000740:
addiu $t0, $t0, 4
bne $t0, $t1, .L00000700
bne $t0, $t1, .LA4000740
sw $zero, -4($t0)
lui $t0, %hi(D_A4001000) # $t0, 0xa400
addiu $t0, %lo(D_A4001000) # addiu $t0, $t0, 0x1000
lui $t0, %hi(SP_IMEM)
addiu $t0, %lo(SP_IMEM)
addi $t1, $t0, 0x1000
.L00000718:
.LA4000758:
addiu $t0, $t0, 4
bne $t0, $t1, .L00000718
bne $t0, $t1, .LA4000758
sw $zero, -4($t0)
lui $t3, %hi(D_B0000008) # $t3, 0xb000
lui $t3, %hi(D_B0000008)
lw $t1, %lo(D_B0000008)($t3)
jr $t1
nop
nop
func_04000778:
func_A4000778:
addiu $sp, $sp, -0xa0
sw $s0, 0x40($sp)
sw $s1, 0x44($sp)
@ -537,15 +545,15 @@ func_04000778:
sw $s7, 0x5c($sp)
sw $fp, 0x60($sp)
sw $ra, 0x64($sp)
.L000007AC:
jal func_04000880
.LA40007EC:
jal func_A4000880
nop
addiu $s0, $s0, 1
slti $t1, $s0, 4
bnez $t1, .L000007AC
bnez $t1, .LA40007EC
addu $s1, $s1, $v0
srl $a0, $s1, 2
jal func_04000A40
jal func_A4000A40
li $a1, 1
lw $ra, 0x64($sp)
srl $v0, $s1, 2
@ -576,19 +584,19 @@ func_04000778:
jr $ra
addiu $sp, $sp, 0xa0
func_04000880:
func_A4000880:
addiu $sp, $sp, -0x20
sw $ra, 0x1c($sp)
move $t1, $zero
move $t3, $zero
move $t4, $zero
.L00000854:
.LA4000894:
slti $k0, $t4, 0x40
beql $k0, $zero, .L000008BC
beql $k0, $zero, .LA40008FC
move $v0, $zero
jal func_0400090C
jal func_A400090C
move $a0, $t4
blezl $v0, .L0000088C
blezl $v0, .LA40008CC
slti $k0, $t1, 0x50
subu $k0, $v0, $t1
multu $k0, $t4
@ -597,61 +605,61 @@ func_04000880:
addu $t3, $t3, $k0
nop
slti $k0, $t1, 0x50
.L0000088C:
bnez $k0, .L00000854
.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_04000980
addiu $a0, $a0, -0x370 # compute (t3 - 40) * 22
b .L000008C0
jal func_A4000980
addiu $a0, $a0, -0x370
b .LA4000900
lw $ra, 0x1c($sp)
move $v0, $zero
.L000008BC:
.LA40008FC:
lw $ra, 0x1c($sp)
.L000008C0:
.LA4000900:
addiu $sp, $sp, 0x20
jr $ra
nop
func_0400090C:
func_A400090C:
addiu $sp, $sp, -0x28
sw $ra, 0x1c($sp)
move $v0, $zero
jal func_04000A40
jal func_A4000A40
li $a1, 2
move $fp, $zero
li $k0, -1
.L000008E8:
.LA4000928:
sw $k0, 4($s4)
lw $v1, 4($s4)
sw $k0, ($s4)
sw $k0, ($s4)
move $gp, $zero
srl $v1, $v1, 0x10
.L00000900:
.LA4000940:
andi $k0, $v1, 1
beql $k0, $zero, .L00000914
beql $k0, $zero, .LA4000954
addiu $gp, $gp, 1
addiu $v0, $v0, 1
addiu $gp, $gp, 1
.L00000914:
.LA4000954:
slti $k0, $gp, 8
bnez $k0, .L00000900
bnez $k0, .LA4000940
srl $v1, $v1, 1
addiu $fp, $fp, 1
slti $k0, $fp, 0xa
bnezl $k0, .L000008E8
bnezl $k0, .LA4000928
li $k0, -1
lw $ra, 0x1c($sp)
addiu $sp, $sp, 0x28
jr $ra
nop
func_04000980:
func_A4000980:
addiu $sp, $sp, -0x28
sw $ra, 0x1c($sp)
sw $a0, 0x20($sp)
@ -661,18 +669,18 @@ func_04000980:
li $t5, 51200
move $t6, $zero
slti $k0, $t6, 0x40
.L00000964:
bnezl $k0, .L00000978
.LA40009A4:
bnezl $k0, .LA40009B8
move $a0, $t6
b .L000009F0
b .LA4000A30
move $v0, $zero
move $a0, $t6
.L00000978:
jal func_04000A40
.LA40009B8:
jal func_A4000A40
li $a1, 1
jal func_04000AD0
jal func_A4000AD0
addiu $a0, $sp, 0x27
jal func_04000AD0
jal func_A4000AD0
addiu $a0, $sp, 0x27
lbu $k0, 0x27($sp)
li $k1, 800
@ -680,44 +688,44 @@ func_04000980:
multu $k0, $k1
mflo $t0
subu $k0, $t0, $a0
bgezl $k0, .L000009B8
bgezl $k0, .LA40009F8
slt $k1, $k0, $t5
subu $k0, $a0, $t0
slt $k1, $k0, $t5
.L000009B8:
beql $k1, $zero, .L000009CC
.LA40009F8:
beql $k1, $zero, .LA4000A0C
lw $a0, 0x20($sp)
move $t5, $k0
move $t2, $t6
lw $a0, 0x20($sp)
.L000009CC:
.LA4000A0C:
slt $k1, $t0, $a0
beql $k1, $zero, .L000009EC
beql $k1, $zero, .LA4000A2C
addu $v0, $t2, $t6
addiu $t6, $t6, 1
slti $k1, $t6, 0x41
bnezl $k1, .L00000964
bnezl $k1, .LA40009A4
slti $k0, $t6, 0x40
addu $v0, $t2, $t6
.L000009EC:
.LA4000A2C:
srl $v0, $v0, 1
.L000009F0:
.LA4000A30:
lw $ra, 0x1c($sp)
addiu $sp, $sp, 0x28
jr $ra
nop
func_04000A40:
func_A4000A40:
addiu $sp, $sp, -0x28
andi $a0, $a0, 0xff
li $k1, 1
xori $a0, $a0, 0x3f
sw $ra, 0x1c($sp)
bne $a1, $k1, .L00000A24
bne $a1, $k1, .LA4000A64
lui $t7, 0x4600
lui $k0, 0x8000
or $t7, $t7, $k0
.L00000A24:
.LA4000A64:
andi $k0, $a0, 1
sll $k0, $k0, 6
or $t7, $t7, $k0
@ -737,26 +745,26 @@ func_04000A40:
sll $k0, $k0, 0x12
or $t7, $t7, $k0
li $k1, 1
bne $a1, $k1, .L00000A80
bne $a1, $k1, .LA4000AC0
sw $t7, ($s5)
lui $k0, %hi(D_A4300000)
sw $zero, %lo(D_A4300000)($k0)
.L00000A80:
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_04000AD0:
func_A4000AD0:
addiu $sp, $sp, -0x28
sw $ra, 0x1c($sp)
li $k0, 0x2000
lui $k1, %hi(D_A4300000)
sw $k0, %lo(D_A4300000)($k1)
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(D_A4300000)($k1)
sw $k0, %lo(MI_MODE_REG)($k1)
li $k1, 0x40
and $k1, $k1, $fp
srl $k1, $k1, 6
@ -789,4 +797,6 @@ func_04000AD0:
nop
nop
# 0xA4000B70-0xA4000FFF: IPL3 Font
glabel ipl3_font
.incbin "lib/bin/ipl3_font.bin"

View File

@ -11,7 +11,51 @@
# This file is handwritten.
glabel decompress
.ifdef VERSION_EU
.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)

View File

@ -1,657 +0,0 @@
glabel synthesis_process_note
/* 09FEF0 802E06F0 27BDFEB8 */ addiu $sp, $sp, -0x148
/* 09FEF4 802E06F4 AFBF004C */ sw $ra, 0x4c($sp)
/* 09FEF8 802E06F8 AFBE0048 */ sw $fp, 0x48($sp)
/* 09FEFC 802E06FC AFB70044 */ sw $s7, 0x44($sp)
/* 09FF00 802E0700 AFB60040 */ sw $s6, 0x40($sp)
/* 09FF04 802E0704 AFB5003C */ sw $s5, 0x3c($sp)
/* 09FF08 802E0708 AFB40038 */ sw $s4, 0x38($sp)
/* 09FF0C 802E070C AFB30034 */ sw $s3, 0x34($sp)
/* 09FF10 802E0710 AFB20030 */ sw $s2, 0x30($sp)
/* 09FF14 802E0714 AFB1002C */ sw $s1, 0x2c($sp)
/* 09FF18 802E0718 AFB00028 */ sw $s0, 0x28($sp)
/* 09FF1C 802E071C AFA40148 */ sw $a0, 0x148($sp)
/* 09FF20 802E0720 AFA70154 */ sw $a3, 0x154($sp)
/* 09FF24 802E0724 AFA00130 */ sw $zero, 0x130($sp)
/* 09FF28 802E0728 8C8F00B0 */ lw $t7, 0xb0($a0)
/* 09FF2C 802E072C 00A08825 */ move $s1, $a1
/* 09FF30 802E0730 00C0B825 */ move $s7, $a2
/* 09FF34 802E0734 000FC7C2 */ srl $t8, $t7, 0x1f
/* 09FF38 802E0738 57000004 */ bnezl $t8, .L802010FC
/* 09FF3C 802E073C 8E390000 */ lw $t9, ($s1)
/* 09FF40 802E0740 1000023E */ b .L802019EC
/* 09FF44 802E0744 8FA2015C */ lw $v0, 0x15c($sp)
/* 09FF48 802E0748 8E390000 */ lw $t9, ($s1)
.L802010FC:
/* 09FF4C 802E074C 24130001 */ li $s3, 1
/* 09FF50 802E0750 00001825 */ move $v1, $zero
/* 09FF54 802E0754 00197040 */ sll $t6, $t9, 1
/* 09FF58 802E0758 000E7FC2 */ srl $t7, $t6, 0x1f
/* 09FF5C 802E075C 166F0009 */ bne $s3, $t7, .L80201134
/* 09FF60 802E0760 02202825 */ move $a1, $s1
/* 09FF64 802E0764 02601825 */ move $v1, $s3
/* 09FF68 802E0768 A2E00000 */ sb $zero, ($s7)
/* 09FF6C 802E076C AEE00008 */ sw $zero, 8($s7)
/* 09FF70 802E0770 A6E00004 */ sh $zero, 4($s7)
/* 09FF74 802E0774 A6F30010 */ sh $s3, 0x10($s7)
/* 09FF78 802E0778 A6F30012 */ sh $s3, 0x12($s7)
/* 09FF7C 802E077C A2E00002 */ sb $zero, 2($s7)
/* 09FF80 802E0780 A2E00003 */ sb $zero, 3($s7)
.L80201134:
/* 09FF84 802E0784 9638000A */ lhu $t8, 0xa($s1)
/* 09FF88 802E0788 02E03025 */ move $a2, $s7
/* 09FF8C 802E078C A7B8011A */ sh $t8, 0x11a($sp)
/* 09FF90 802E0790 96390000 */ lhu $t9, ($s1)
/* 09FF94 802E0794 3318FFFF */ andi $t8, $t8, 0xffff
/* 09FF98 802E0798 332E0001 */ andi $t6, $t9, 1
/* 09FF9C 802E079C 8FB90158 */ lw $t9, 0x158($sp)
/* 09FFA0 802E07A0 25CF0001 */ addiu $t7, $t6, 1
/* 09FFA4 802E07A4 AFAF00BC */ sw $t7, 0xbc($sp)
/* 09FFA8 802E07A8 03190019 */ multu $t8, $t9
/* 09FFAC 802E07AC 96F80004 */ lhu $t8, 4($s7)
/* 09FFB0 802E07B0 00007012 */ mflo $t6
/* 09FFB4 802E07B4 000E7840 */ sll $t7, $t6, 1
/* 09FFB8 802E07B8 01F81021 */ addu $v0, $t7, $t8
/* 09FFBC 802E07BC A6E20004 */ sh $v0, 4($s7)
/* 09FFC0 802E07C0 8E270000 */ lw $a3, ($s1)
/* 09FFC4 802E07C4 8FA4015C */ lw $a0, 0x15c($sp)
/* 09FFC8 802E07C8 00028402 */ srl $s0, $v0, 0x10
/* 09FFCC 802E07CC 00077B80 */ sll $t7, $a3, 0xe
/* 09FFD0 802E07D0 05E3000D */ bgezl $t7, .L802011B8
/* 09FFD4 802E07D4 8E2F000C */ lw $t7, 0xc($s1)
/* 09FFD8 802E07D8 0C0B841B */ jal load_wave_samples
/* 09FFDC 802E07DC 02003825 */ move $a3, $s0
/* 09FFE0 802E07E0 8EE60008 */ lw $a2, 8($s7)
/* 09FFE4 802E07E4 0006C040 */ sll $t8, $a2, 1
/* 09FFE8 802E07E8 27190180 */ addiu $t9, $t8, 0x180
/* 09FFEC 802E07EC A7B900AA */ sh $t9, 0xaa($sp)
/* 09FFF0 802E07F0 00D07021 */ addu $t6, $a2, $s0
/* 09FFF4 802E07F4 AEEE0008 */ sw $t6, 8($s7)
/* 09FFF8 802E07F8 8E270000 */ lw $a3, ($s1)
/* 09FFFC 802E07FC 100001D4 */ b .L80201900
/* 0A0000 802E0800 AFA2015C */ sw $v0, 0x15c($sp)
/* 0A0004 802E0804 8E2F000C */ lw $t7, 0xc($s1)
.L802011B8:
/* 0A0008 802E0808 241F0009 */ li $ra, 9
/* 0A000C 802E080C 3C0D8000 */ lui $t5, 0x8000
/* 0A0010 802E0810 8DF80000 */ lw $t8, ($t7)
/* 0A0014 802E0814 AFB80138 */ sw $t8, 0x138($sp)
/* 0A0018 802E0818 8F0E0008 */ lw $t6, 8($t8)
/* 0A001C 802E081C AFAE0134 */ sw $t6, 0x134($sp)
/* 0A0020 802E0820 8DCF0004 */ lw $t7, 4($t6)
/* 0A0024 802E0824 8FAE00BC */ lw $t6, 0xbc($sp)
/* 0A0028 802E0828 AFAF00E4 */ sw $t7, 0xe4($sp)
/* 0A002C 802E082C 8F180004 */ lw $t8, 4($t8)
/* 0A0030 802E0830 AFA000AC */ sw $zero, 0xac($sp)
/* 0A0034 802E0834 AFA000B8 */ sw $zero, 0xb8($sp)
/* 0A0038 802E0838 19C001C5 */ blez $t6, .L80201900
/* 0A003C 802E083C AFB800F4 */ sw $t8, 0xf4($sp)
/* 0A0040 802E0840 00027C02 */ srl $t7, $v0, 0x10
/* 0A0044 802E0844 AFAF0050 */ sw $t7, 0x50($sp)
/* 0A0048 802E0848 AFA3011C */ sw $v1, 0x11c($sp)
/* 0A004C 802E084C AFB1014C */ sw $s1, 0x14c($sp)
/* 0A0050 802E0850 8FB2015C */ lw $s2, 0x15c($sp)
.L80201204:
/* 0A0054 802E0854 8FB90138 */ lw $t9, 0x138($sp)
/* 0A0058 802E0858 8FB800BC */ lw $t8, 0xbc($sp)
/* 0A005C 802E085C 24010001 */ li $at, 1
/* 0A0060 802E0860 8F24000C */ lw $a0, 0xc($t9)
/* 0A0064 802E0864 0000F025 */ move $fp, $zero
/* 0A0068 802E0868 0000A025 */ move $s4, $zero
/* 0A006C 802E086C 17010003 */ bne $t8, $at, .L8020122C
/* 0A0070 802E0870 24850008 */ addiu $a1, $a0, 8
/* 0A0074 802E0874 1000000B */ b .L80201254
/* 0A0078 802E0878 8FAC0050 */ lw $t4, 0x50($sp)
.L8020122C:
/* 0A007C 802E087C 8FAE0050 */ lw $t6, 0x50($sp)
/* 0A0080 802E0880 8FB800B8 */ lw $t8, 0xb8($sp)
/* 0A0084 802E0884 8FAC0050 */ lw $t4, 0x50($sp)
/* 0A0088 802E0888 31CF0001 */ andi $t7, $t6, 1
/* 0A008C 802E088C 11E00005 */ beqz $t7, .L80201254
/* 0A0090 802E0890 2401FFFE */ li $at, -2
/* 0A0094 802E0894 01C1C824 */ and $t9, $t6, $at
/* 0A0098 802E0898 00187840 */ sll $t7, $t8, 1
/* 0A009C 802E089C 10000001 */ b .L80201254
/* 0A00A0 802E08A0 032F6021 */ addu $t4, $t9, $t7
.L80201254:
/* 0A00A4 802E08A4 8FAE0130 */ lw $t6, 0x130($sp)
/* 0A00A8 802E08A8 51C5001A */ beql $t6, $a1, .L802012C4
/* 0A00AC 802E08AC 0007C2C0 */ sll $t8, $a3, 0xb
/* 0A00B0 802E08B0 AFA50130 */ sw $a1, 0x130($sp)
/* 0A00B4 802E08B4 8C980000 */ lw $t8, ($a0)
/* 0A00B8 802E08B8 8C8F0004 */ lw $t7, 4($a0)
/* 0A00BC 802E08BC 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0A00C0 802E08C0 0018C900 */ sll $t9, $t8, 4
/* 0A00C4 802E08C4 032F0019 */ multu $t9, $t7
/* 0A00C8 802E08C8 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0A00CC 802E08CC 8FA6014C */ lw $a2, 0x14c($sp)
/* 0A00D0 802E08D0 02401025 */ move $v0, $s2
/* 0A00D4 802E08D4 26520008 */ addiu $s2, $s2, 8
/* 0A00D8 802E08D8 00001812 */ mflo $v1
/* 0A00DC 802E08DC 00617024 */ and $t6, $v1, $at
/* 0A00E0 802E08E0 3C010B00 */ lui $at, 0xb00
/* 0A00E4 802E08E4 01C1C025 */ or $t8, $t6, $at
/* 0A00E8 802E08E8 AC580000 */ sw $t8, ($v0)
/* 0A00EC 802E08EC 8CD90000 */ lw $t9, ($a2)
/* 0A00F0 802E08F0 00197AC0 */ sll $t7, $t9, 0xb
/* 0A00F4 802E08F4 8FB90130 */ lw $t9, 0x130($sp)
/* 0A00F8 802E08F8 000F7742 */ srl $t6, $t7, 0x1d
/* 0A00FC 802E08FC 000EC040 */ sll $t8, $t6, 1
/* 0A0100 802E0900 03197821 */ addu $t7, $t8, $t9
/* 0A0104 802E0904 01ED7021 */ addu $t6, $t7, $t5
/* 0A0108 802E0908 AC4E0004 */ sw $t6, 4($v0)
/* 0A010C 802E090C 8CC70000 */ lw $a3, ($a2)
/* 0A0110 802E0910 0007C2C0 */ sll $t8, $a3, 0xb
.L802012C4:
/* 0A0114 802E0914 0018CF42 */ srl $t9, $t8, 0x1d
/* 0A0118 802E0918 13200003 */ beqz $t9, .L802012D8
/* 0A011C 802E091C 3C0F8030 */ lui $t7, %hi(euUnknownData_80301950) # $t7, 0x8030
/* 0A0120 802E0920 25EF1970 */ addiu $t7, %lo(euUnknownData_80301950) # addiu $t7, $t7, 0x1970
/* 0A0124 802E0924 AFAF0130 */ sw $t7, 0x130($sp)
.L802012D8:
/* 0A0128 802E0928 51800108 */ beql $t4, $zero, .L802016FC
/* 0A012C 802E092C 8FA400BC */ lw $a0, 0xbc($sp)
/* 0A0130 802E0930 8EE60008 */ lw $a2, 8($s7)
.L802012E4:
/* 0A0134 802E0934 8FAE00E4 */ lw $t6, 0xe4($sp)
/* 0A0138 802E0938 019E2023 */ subu $a0, $t4, $fp
/* 0A013C 802E093C 30D3000F */ andi $s3, $a2, 0xf
/* 0A0140 802E0940 00004825 */ move $t1, $zero
/* 0A0144 802E0944 00005025 */ move $t2, $zero
/* 0A0148 802E0948 00805825 */ move $t3, $a0
/* 0A014C 802E094C 16600005 */ bnez $s3, .L80201314
/* 0A0150 802E0950 01C61823 */ subu $v1, $t6, $a2
/* 0A0154 802E0954 92F80000 */ lbu $t8, ($s7)
/* 0A0158 802E0958 57000003 */ bnezl $t8, .L80201318
/* 0A015C 802E095C 24190010 */ li $t9, 16
/* 0A0160 802E0960 24130010 */ li $s3, 16
.L80201314:
/* 0A0164 802E0964 24190010 */ li $t9, 16
.L80201318:
/* 0A0168 802E0968 03332823 */ subu $a1, $t9, $s3
/* 0A016C 802E096C 0083082A */ slt $at, $a0, $v1
/* 0A0170 802E0970 1020000C */ beqz $at, .L80201354
/* 0A0174 802E0974 00A0A825 */ move $s5, $a1
/* 0A0178 802E0978 00851023 */ subu $v0, $a0, $a1
/* 0A017C 802E097C 2442000F */ addiu $v0, $v0, 0xf
/* 0A0180 802E0980 04410003 */ bgez $v0, .L80201340
/* 0A0184 802E0984 00027903 */ sra $t7, $v0, 4
/* 0A0188 802E0988 2441000F */ addiu $at, $v0, 0xf
/* 0A018C 802E098C 00017903 */ sra $t7, $at, 4
.L80201340:
/* 0A0190 802E0990 000F8900 */ sll $s1, $t7, 4
/* 0A0194 802E0994 00B17021 */ addu $t6, $a1, $s1
/* 0A0198 802E0998 01E04025 */ move $t0, $t7
/* 0A019C 802E099C 10000013 */ b .L8020139C
/* 0A01A0 802E09A0 01C4B023 */ subu $s6, $t6, $a0
.L80201354:
/* 0A01A4 802E09A4 00658823 */ subu $s1, $v1, $a1
/* 0A01A8 802E09A8 1E200003 */ bgtz $s1, .L80201368
/* 0A01AC 802E09AC 0000B025 */ move $s6, $zero
/* 0A01B0 802E09B0 00008825 */ move $s1, $zero
/* 0A01B4 802E09B4 0060A825 */ move $s5, $v1
.L80201368:
/* 0A01B8 802E09B8 8FB90134 */ lw $t9, 0x134($sp)
/* 0A01BC 802E09BC 2628000F */ addiu $t0, $s1, 0xf
/* 0A01C0 802E09C0 05010003 */ bgez $t0, .L80201380
/* 0A01C4 802E09C4 0008C103 */ sra $t8, $t0, 4
/* 0A01C8 802E09C8 2501000F */ addiu $at, $t0, 0xf
/* 0A01CC 802E09CC 0001C103 */ sra $t8, $at, 4
.L80201380:
/* 0A01D0 802E09D0 8F2F0008 */ lw $t7, 8($t9)
/* 0A01D4 802E09D4 03004025 */ move $t0, $t8
/* 0A01D8 802E09D8 51E00004 */ beql $t7, $zero, .L8020139C
/* 0A01DC 802E09DC 24090001 */ li $t1, 1
/* 0A01E0 802E09E0 10000002 */ b .L8020139C
/* 0A01E4 802E09E4 240A0001 */ li $t2, 1
/* 0A01E8 802E09E8 24090001 */ li $t1, 1
.L8020139C:
/* 0A01EC 802E09EC 1100003C */ beqz $t0, .L80201490
/* 0A01F0 802E09F0 8FB80138 */ lw $t8, 0x138($sp)
/* 0A01F4 802E09F4 00D31023 */ subu $v0, $a2, $s3
/* 0A01F8 802E09F8 24420010 */ addiu $v0, $v0, 0x10
/* 0A01FC 802E09FC 93190001 */ lbu $t9, 1($t8)
/* 0A0200 802E0A00 04410003 */ bgez $v0, .L802013C0
/* 0A0204 802E0A04 00027103 */ sra $t6, $v0, 4
/* 0A0208 802E0A08 2441000F */ addiu $at, $v0, 0xf
/* 0A020C 802E0A0C 00017103 */ sra $t6, $at, 4
.L802013C0:
/* 0A0210 802E0A10 24010081 */ li $at, 129
/* 0A0214 802E0A14 17210009 */ bne $t9, $at, .L802013EC
/* 0A0218 802E0A18 01C01025 */ move $v0, $t6
/* 0A021C 802E0A1C 01DF0019 */ multu $t6, $ra
/* 0A0220 802E0A20 8FAE00F4 */ lw $t6, 0xf4($sp)
/* 0A0224 802E0A24 000880C0 */ sll $s0, $t0, 3
/* 0A0228 802E0A28 02088021 */ addu $s0, $s0, $t0
/* 0A022C 802E0A2C 00007812 */ mflo $t7
/* 0A0230 802E0A30 01EE2821 */ addu $a1, $t7, $t6
/* 0A0234 802E0A34 10000019 */ b .L8020144C
/* 0A0238 802E0A38 30A8000F */ andi $t0, $a1, 0xf
.L802013EC:
/* 0A023C 802E0A3C 005F0019 */ multu $v0, $ra
/* 0A0240 802E0A40 8FB900F4 */ lw $t9, 0xf4($sp)
/* 0A0244 802E0A44 8FA6011C */ lw $a2, 0x11c($sp)
/* 0A0248 802E0A48 26E70001 */ addiu $a3, $s7, 1
/* 0A024C 802E0A4C AFA90124 */ sw $t1, 0x124($sp)
/* 0A0250 802E0A50 AFAA0120 */ sw $t2, 0x120($sp)
/* 0A0254 802E0A54 AFAB00E0 */ sw $t3, 0xe0($sp)
/* 0A0258 802E0A58 AFAC00EC */ sw $t4, 0xec($sp)
/* 0A025C 802E0A5C 0000C012 */ mflo $t8
/* 0A0260 802E0A60 03192021 */ addu $a0, $t8, $t9
/* 0A0264 802E0A64 00000000 */ nop
/* 0A0268 802E0A68 011F0019 */ multu $t0, $ra
/* 0A026C 802E0A6C 00008012 */ mflo $s0
/* 0A0270 802E0A70 02002825 */ move $a1, $s0
/* 0A0274 802E0A74 0C0B8D57 */ jal dma_sample_data
/* 0A0278 802E0A78 00000000 */ nop
/* 0A027C 802E0A7C 8FA90124 */ lw $t1, 0x124($sp)
/* 0A0280 802E0A80 8FAA0120 */ lw $t2, 0x120($sp)
/* 0A0284 802E0A84 8FAB00E0 */ lw $t3, 0xe0($sp)
/* 0A0288 802E0A88 8FAC00EC */ lw $t4, 0xec($sp)
/* 0A028C 802E0A8C 3C0D8000 */ lui $t5, 0x8000
/* 0A0290 802E0A90 241F0009 */ li $ra, 9
/* 0A0294 802E0A94 00402825 */ move $a1, $v0
/* 0A0298 802E0A98 30A8000F */ andi $t0, $a1, 0xf
.L8020144C:
/* 0A029C 802E0A9C 02401825 */ move $v1, $s2
/* 0A02A0 802E0AA0 3C0F0800 */ lui $t7, (0x080003F0 >> 16) # lui $t7, 0x800
/* 0A02A4 802E0AA4 35EF03F0 */ ori $t7, (0x080003F0 & 0xFFFF) # ori $t7, $t7, 0x3f0
/* 0A02A8 802E0AA8 02087021 */ addu $t6, $s0, $t0
/* 0A02AC 802E0AAC 31D8FFFF */ andi $t8, $t6, 0xffff
/* 0A02B0 802E0AB0 AC6F0000 */ sw $t7, ($v1)
/* 0A02B4 802E0AB4 26520008 */ addiu $s2, $s2, 8
/* 0A02B8 802E0AB8 AC780004 */ sw $t8, 4($v1)
/* 0A02BC 802E0ABC 02402025 */ move $a0, $s2
/* 0A02C0 802E0AC0 00A87823 */ subu $t7, $a1, $t0
/* 0A02C4 802E0AC4 01ED7021 */ addu $t6, $t7, $t5
/* 0A02C8 802E0AC8 3C190400 */ lui $t9, 0x400
/* 0A02CC 802E0ACC AC990000 */ sw $t9, ($a0)
/* 0A02D0 802E0AD0 AC8E0004 */ sw $t6, 4($a0)
/* 0A02D4 802E0AD4 92E60000 */ lbu $a2, ($s7)
/* 0A02D8 802E0AD8 10000004 */ b .L8020149C
/* 0A02DC 802E0ADC 26520008 */ addiu $s2, $s2, 8
.L80201490:
/* 0A02E0 802E0AE0 00008825 */ move $s1, $zero
/* 0A02E4 802E0AE4 00004025 */ move $t0, $zero
/* 0A02E8 802E0AE8 92E60000 */ lbu $a2, ($s7)
.L8020149C:
/* 0A02EC 802E0AEC 10C0000D */ beqz $a2, .L802014D4
/* 0A02F0 802E0AF0 02401025 */ move $v0, $s2
/* 0A02F4 802E0AF4 3C180F00 */ lui $t8, 0xf00
/* 0A02F8 802E0AF8 AC580000 */ sw $t8, ($v0)
/* 0A02FC 802E0AFC 8FB90138 */ lw $t9, 0x138($sp)
/* 0A0300 802E0B00 3C018000 */ lui $at, (0x80000010 >> 16) # lui $at, 0x8000
/* 0A0304 802E0B04 34210010 */ ori $at, (0x80000010 & 0xFFFF) # ori $at, $at, 0x10
/* 0A0308 802E0B08 8F2F0008 */ lw $t7, 8($t9)
/* 0A030C 802E0B0C 24180002 */ li $t8, 2
/* 0A0310 802E0B10 26520008 */ addiu $s2, $s2, 8
/* 0A0314 802E0B14 01E17021 */ addu $t6, $t7, $at
/* 0A0318 802E0B18 AC4E0004 */ sw $t6, 4($v0)
/* 0A031C 802E0B1C AFB8011C */ sw $t8, 0x11c($sp)
/* 0A0320 802E0B20 A2E00000 */ sb $zero, ($s7)
.L802014D4:
/* 0A0324 802E0B24 17C0001D */ bnez $fp, .L8020154C
/* 0A0328 802E0B28 02401825 */ move $v1, $s2
/* 0A032C 802E0B2C 251903F0 */ addiu $t9, $t0, 0x3f0
/* 0A0330 802E0B30 332FFFFF */ andi $t7, $t9, 0xffff
/* 0A0334 802E0B34 3C010800 */ lui $at, 0x800
/* 0A0338 802E0B38 01E17025 */ or $t6, $t7, $at
/* 0A033C 802E0B3C 00113040 */ sll $a2, $s1, 1
/* 0A0340 802E0B40 30D8FFFF */ andi $t8, $a2, 0xffff
/* 0A0344 802E0B44 3C010180 */ lui $at, 0x180
/* 0A0348 802E0B48 02401025 */ move $v0, $s2
/* 0A034C 802E0B4C 0301C825 */ or $t9, $t8, $at
/* 0A0350 802E0B50 AC590004 */ sw $t9, 4($v0)
/* 0A0354 802E0B54 AC4E0000 */ sw $t6, ($v0)
/* 0A0358 802E0B58 8FAF011C */ lw $t7, 0x11c($sp)
/* 0A035C 802E0B5C 26520008 */ addiu $s2, $s2, 8
/* 0A0360 802E0B60 3C010100 */ lui $at, 0x100
/* 0A0364 802E0B64 31EE00FF */ andi $t6, $t7, 0xff
/* 0A0368 802E0B68 000EC400 */ sll $t8, $t6, 0x10
/* 0A036C 802E0B6C 0301C825 */ or $t9, $t8, $at
/* 0A0370 802E0B70 02401825 */ move $v1, $s2
/* 0A0374 802E0B74 AC790000 */ sw $t9, ($v1)
/* 0A0378 802E0B78 8EEF000C */ lw $t7, 0xc($s7)
/* 0A037C 802E0B7C 0235C821 */ addu $t9, $s1, $s5
/* 0A0380 802E0B80 0013C040 */ sll $t8, $s3, 1
/* 0A0384 802E0B84 01ED7021 */ addu $t6, $t7, $t5
/* 0A0388 802E0B88 AC6E0004 */ sw $t6, 4($v1)
/* 0A038C 802E0B8C 26520008 */ addiu $s2, $s2, 8
/* 0A0390 802E0B90 AFB80104 */ sw $t8, 0x104($sp)
/* 0A0394 802E0B94 1000002F */ b .L80201604
/* 0A0398 802E0B98 03363823 */ subu $a3, $t9, $s6
.L8020154C:
/* 0A039C 802E0B9C 250F03F0 */ addiu $t7, $t0, 0x3f0
/* 0A03A0 802E0BA0 31EEFFFF */ andi $t6, $t7, 0xffff
/* 0A03A4 802E0BA4 3C010800 */ lui $at, 0x800
/* 0A03A8 802E0BA8 01C1C025 */ or $t8, $t6, $at
/* 0A03AC 802E0BAC 2401FFE0 */ li $at, -32
/* 0A03B0 802E0BB0 2682001F */ addiu $v0, $s4, 0x1f
/* 0A03B4 802E0BB4 0041C824 */ and $t9, $v0, $at
/* 0A03B8 802E0BB8 272E0180 */ addiu $t6, $t9, 0x180
/* 0A03BC 802E0BBC 03201025 */ move $v0, $t9
/* 0A03C0 802E0BC0 AC780000 */ sw $t8, ($v1)
/* 0A03C4 802E0BC4 00113040 */ sll $a2, $s1, 1
/* 0A03C8 802E0BC8 30D9FFFF */ andi $t9, $a2, 0xffff
/* 0A03CC 802E0BCC 000EC400 */ sll $t8, $t6, 0x10
/* 0A03D0 802E0BD0 03197825 */ or $t7, $t8, $t9
/* 0A03D4 802E0BD4 AC6F0004 */ sw $t7, 4($v1)
/* 0A03D8 802E0BD8 8FAE011C */ lw $t6, 0x11c($sp)
/* 0A03DC 802E0BDC 26520008 */ addiu $s2, $s2, 8
/* 0A03E0 802E0BE0 3C010100 */ lui $at, 0x100
/* 0A03E4 802E0BE4 31D800FF */ andi $t8, $t6, 0xff
/* 0A03E8 802E0BE8 0018CC00 */ sll $t9, $t8, 0x10
/* 0A03EC 802E0BEC 03217825 */ or $t7, $t9, $at
/* 0A03F0 802E0BF0 02402025 */ move $a0, $s2
/* 0A03F4 802E0BF4 AC8F0000 */ sw $t7, ($a0)
/* 0A03F8 802E0BF8 8EEE000C */ lw $t6, 0xc($s7)
/* 0A03FC 802E0BFC 0013C840 */ sll $t9, $s3, 1
/* 0A0400 802E0C00 00597821 */ addu $t7, $v0, $t9
/* 0A0404 802E0C04 01CDC021 */ addu $t8, $t6, $t5
/* 0A0408 802E0C08 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0A040C 802E0C0C AC980004 */ sw $t8, 4($a0)
/* 0A0410 802E0C10 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0A0414 802E0C14 25EE0180 */ addiu $t6, $t7, 0x180
/* 0A0418 802E0C18 01C1C024 */ and $t8, $t6, $at
/* 0A041C 802E0C1C 3C010A00 */ lui $at, 0xa00
/* 0A0420 802E0C20 26520008 */ addiu $s2, $s2, 8
/* 0A0424 802E0C24 0301C825 */ or $t9, $t8, $at
/* 0A0428 802E0C28 02357821 */ addu $t7, $s1, $s5
/* 0A042C 802E0C2C 01F63823 */ subu $a3, $t7, $s6
/* 0A0430 802E0C30 02402825 */ move $a1, $s2
/* 0A0434 802E0C34 ACB90000 */ sw $t9, ($a1)
/* 0A0438 802E0C38 00077840 */ sll $t7, $a3, 1
/* 0A043C 802E0C3C 26980180 */ addiu $t8, $s4, 0x180
/* 0A0440 802E0C40 0018CC00 */ sll $t9, $t8, 0x10
/* 0A0444 802E0C44 31EEFFFF */ andi $t6, $t7, 0xffff
/* 0A0448 802E0C48 032EC025 */ or $t8, $t9, $t6
/* 0A044C 802E0C4C ACB80004 */ sw $t8, 4($a1)
/* 0A0450 802E0C50 26520008 */ addiu $s2, $s2, 8
.L80201604:
/* 0A0454 802E0C54 8FAF011C */ lw $t7, 0x11c($sp)
/* 0A0458 802E0C58 24010001 */ li $at, 1
/* 0A045C 802E0C5C 03C7F021 */ addu $fp, $fp, $a3
/* 0A0460 802E0C60 11E10005 */ beq $t7, $at, .L80201628
/* 0A0464 802E0C64 39E20002 */ xori $v0, $t7, 2
/* 0A0468 802E0C68 10400007 */ beqz $v0, .L80201638
/* 0A046C 802E0C6C AFA0011C */ sw $zero, 0x11c($sp)
/* 0A0470 802E0C70 10000008 */ b .L80201644
/* 0A0474 802E0C74 00077040 */ sll $t6, $a3, 1
.L80201628:
/* 0A0478 802E0C78 AFA00104 */ sw $zero, 0x104($sp)
/* 0A047C 802E0C7C 00D4A021 */ addu $s4, $a2, $s4
/* 0A0480 802E0C80 1000000B */ b .L80201660
/* 0A0484 802E0C84 AFA0011C */ sw $zero, 0x11c($sp)
.L80201638:
/* 0A0488 802E0C88 0007C840 */ sll $t9, $a3, 1
/* 0A048C 802E0C8C 10000008 */ b .L80201660
/* 0A0490 802E0C90 0334A021 */ addu $s4, $t9, $s4
.L80201644:
/* 0A0494 802E0C94 52800004 */ beql $s4, $zero, .L80201658
/* 0A0498 802E0C98 0267A021 */ addu $s4, $s3, $a3
/* 0A049C 802E0C9C 10000004 */ b .L80201660
/* 0A04A0 802E0CA0 01D4A021 */ addu $s4, $t6, $s4
/* 0A04A4 802E0CA4 0267A021 */ addu $s4, $s3, $a3
.L80201658:
/* 0A04A8 802E0CA8 0014C040 */ sll $t8, $s4, 1
/* 0A04AC 802E0CAC 0300A025 */ move $s4, $t8
.L80201660:
/* 0A04B0 802E0CB0 11200019 */ beqz $t1, .L802016C8
/* 0A04B4 802E0CB4 24190001 */ li $t9, 1
/* 0A04B8 802E0CB8 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0A04BC 802E0CBC 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0A04C0 802E0CC0 268F0180 */ addiu $t7, $s4, 0x180
/* 0A04C4 802E0CC4 01E1C824 */ and $t9, $t7, $at
/* 0A04C8 802E0CC8 8FA3014C */ lw $v1, 0x14c($sp)
/* 0A04CC 802E0CCC 8FA60148 */ lw $a2, 0x148($sp)
/* 0A04D0 802E0CD0 3C010200 */ lui $at, 0x200
/* 0A04D4 802E0CD4 02401025 */ move $v0, $s2
/* 0A04D8 802E0CD8 019EC023 */ subu $t8, $t4, $fp
/* 0A04DC 802E0CDC 00187840 */ sll $t7, $t8, 1
/* 0A04E0 802E0CE0 03217025 */ or $t6, $t9, $at
/* 0A04E4 802E0CE4 AC4E0000 */ sw $t6, ($v0)
/* 0A04E8 802E0CE8 AC4F0004 */ sw $t7, 4($v0)
/* 0A04EC 802E0CEC 906E0000 */ lbu $t6, ($v1)
/* 0A04F0 802E0CF0 26520008 */ addiu $s2, $s2, 8
/* 0A04F4 802E0CF4 35D80020 */ ori $t8, $t6, 0x20
/* 0A04F8 802E0CF8 A0780000 */ sb $t8, ($v1)
/* 0A04FC 802E0CFC 90D900B0 */ lbu $t9, 0xb0($a2)
/* 0A0500 802E0D00 372E0020 */ ori $t6, $t9, 0x20
/* 0A0504 802E0D04 A0CE00B0 */ sb $t6, 0xb0($a2)
/* 0A0508 802E0D08 90D800B0 */ lbu $t8, 0xb0($a2)
/* 0A050C 802E0D0C 330FFF7F */ andi $t7, $t8, 0xff7f
/* 0A0510 802E0D10 1000000D */ b .L802016F8
/* 0A0514 802E0D14 A0CF00B0 */ sb $t7, 0xb0($a2)
.L802016C8:
/* 0A0518 802E0D18 51400007 */ beql $t2, $zero, .L802016E8
/* 0A051C 802E0D1C 8EEF0008 */ lw $t7, 8($s7)
/* 0A0520 802E0D20 A2F90000 */ sb $t9, ($s7)
/* 0A0524 802E0D24 8FAE0134 */ lw $t6, 0x134($sp)
/* 0A0528 802E0D28 8DD80000 */ lw $t8, ($t6)
/* 0A052C 802E0D2C 10000004 */ b .L802016F0
/* 0A0530 802E0D30 AEF80008 */ sw $t8, 8($s7)
/* 0A0534 802E0D34 8EEF0008 */ lw $t7, 8($s7)
.L802016E8:
/* 0A0538 802E0D38 01EBC821 */ addu $t9, $t7, $t3
/* 0A053C 802E0D3C AEF90008 */ sw $t9, 8($s7)
.L802016F0:
/* 0A0540 802E0D40 57CCFEFC */ bnel $fp, $t4, .L802012E4
/* 0A0544 802E0D44 8EE60008 */ lw $a2, 8($s7)
.L802016F8:
/* 0A0548 802E0D48 8FA400BC */ lw $a0, 0xbc($sp)
.L802016FC:
/* 0A054C 802E0D4C 24010001 */ li $at, 1
/* 0A0550 802E0D50 8FA3014C */ lw $v1, 0x14c($sp)
/* 0A0554 802E0D54 10810009 */ beq $a0, $at, .L8020172C
/* 0A0558 802E0D58 8FB80104 */ lw $t8, 0x104($sp)
/* 0A055C 802E0D5C 24010002 */ li $at, 2
/* 0A0560 802E0D60 1081000D */ beq $a0, $at, .L80201748
/* 0A0564 802E0D64 8FAE00B8 */ lw $t6, 0xb8($sp)
/* 0A0568 802E0D68 8C670000 */ lw $a3, ($v1)
/* 0A056C 802E0D6C 00072880 */ sll $a1, $a3, 2
/* 0A0570 802E0D70 000577C2 */ srl $t6, $a1, 0x1f
/* 0A0574 802E0D74 1000006A */ b .L802018D0
/* 0A0578 802E0D78 01C02825 */ move $a1, $t6
.L8020172C:
/* 0A057C 802E0D7C 270F0180 */ addiu $t7, $t8, 0x180
/* 0A0580 802E0D80 A7AF00AA */ sh $t7, 0xaa($sp)
/* 0A0584 802E0D84 8C670000 */ lw $a3, ($v1)
/* 0A0588 802E0D88 00072880 */ sll $a1, $a3, 2
/* 0A058C 802E0D8C 0005CFC2 */ srl $t9, $a1, 0x1f
/* 0A0590 802E0D90 10000063 */ b .L802018D0
/* 0A0594 802E0D94 03202825 */ move $a1, $t9
.L80201748:
/* 0A0598 802E0D98 11C00009 */ beqz $t6, .L80201770
/* 0A059C 802E0D9C 8FA6014C */ lw $a2, 0x14c($sp)
/* 0A05A0 802E0DA0 24010001 */ li $at, 1
/* 0A05A4 802E0DA4 11C10036 */ beq $t6, $at, .L80201830
/* 0A05A8 802E0DA8 02401025 */ move $v0, $s2
/* 0A05AC 802E0DAC 8C670000 */ lw $a3, ($v1)
/* 0A05B0 802E0DB0 00072880 */ sll $a1, $a3, 2
/* 0A05B4 802E0DB4 0005C7C2 */ srl $t8, $a1, 0x1f
/* 0A05B8 802E0DB8 10000059 */ b .L802018D0
/* 0A05BC 802E0DBC 03002825 */ move $a1, $t8
.L80201770:
/* 0A05C0 802E0DC0 8FAF0104 */ lw $t7, 0x104($sp)
/* 0A05C4 802E0DC4 3C010800 */ lui $at, 0x800
/* 0A05C8 802E0DC8 02401025 */ move $v0, $s2
/* 0A05CC 802E0DCC 25F90180 */ addiu $t9, $t7, 0x180
/* 0A05D0 802E0DD0 332EFFFF */ andi $t6, $t9, 0xffff
/* 0A05D4 802E0DD4 01C1C025 */ or $t8, $t6, $at
/* 0A05D8 802E0DD8 25840004 */ addiu $a0, $t4, 4
/* 0A05DC 802E0DDC 308FFFFF */ andi $t7, $a0, 0xffff
/* 0A05E0 802E0DE0 3C010020 */ lui $at, 0x20
/* 0A05E4 802E0DE4 01E1C825 */ or $t9, $t7, $at
/* 0A05E8 802E0DE8 26520008 */ addiu $s2, $s2, 8
/* 0A05EC 802E0DEC 3C0E0501 */ lui $t6, (0x0501FF60 >> 16) # lui $t6, 0x501
/* 0A05F0 802E0DF0 AC590004 */ sw $t9, 4($v0)
/* 0A05F4 802E0DF4 AC580000 */ sw $t8, ($v0)
/* 0A05F8 802E0DF8 35CEFF60 */ ori $t6, (0x0501FF60 & 0xFFFF) # ori $t6, $t6, 0xff60
/* 0A05FC 802E0DFC 02401825 */ move $v1, $s2
/* 0A0600 802E0E00 AC6E0000 */ sw $t6, ($v1)
/* 0A0604 802E0E04 8EF8000C */ lw $t8, 0xc($s7)
/* 0A0608 802E0E08 3C018000 */ lui $at, (0x800000F0 >> 16) # lui $at, 0x8000
/* 0A060C 802E0E0C 342100F0 */ ori $at, (0x800000F0 & 0xFFFF) # ori $at, $at, 0xf0
/* 0A0610 802E0E10 03017821 */ addu $t7, $t8, $at
/* 0A0614 802E0E14 AC6F0004 */ sw $t7, 4($v1)
/* 0A0618 802E0E18 24190024 */ li $t9, 36
/* 0A061C 802E0E1C AFA400AC */ sw $a0, 0xac($sp)
/* 0A0620 802E0E20 A7B900AA */ sh $t9, 0xaa($sp)
/* 0A0624 802E0E24 8CC70000 */ lw $a3, ($a2)
/* 0A0628 802E0E28 26520008 */ addiu $s2, $s2, 8
/* 0A062C 802E0E2C 02401025 */ move $v0, $s2
/* 0A0630 802E0E30 00072880 */ sll $a1, $a3, 2
/* 0A0634 802E0E34 000577C2 */ srl $t6, $a1, 0x1f
/* 0A0638 802E0E38 11C0000F */ beqz $t6, .L80201828
/* 0A063C 802E0E3C 01C02825 */ move $a1, $t6
/* 0A0640 802E0E40 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0A0644 802E0E44 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0A0648 802E0E48 24980020 */ addiu $t8, $a0, 0x20
/* 0A064C 802E0E4C 03017824 */ and $t7, $t8, $at
/* 0A0650 802E0E50 3C010200 */ lui $at, 0x200
/* 0A0654 802E0E54 01E1C825 */ or $t9, $t7, $at
/* 0A0658 802E0E58 258E0010 */ addiu $t6, $t4, 0x10
/* 0A065C 802E0E5C AC4E0004 */ sw $t6, 4($v0)
/* 0A0660 802E0E60 AC590000 */ sw $t9, ($v0)
/* 0A0664 802E0E64 8CC70000 */ lw $a3, ($a2)
/* 0A0668 802E0E68 26520008 */ addiu $s2, $s2, 8
/* 0A066C 802E0E6C 00072880 */ sll $a1, $a3, 2
/* 0A0670 802E0E70 0005C7C2 */ srl $t8, $a1, 0x1f
/* 0A0674 802E0E74 03002825 */ move $a1, $t8
.L80201828:
/* 0A0678 802E0E78 10000029 */ b .L802018D0
/* 0A067C 802E0E7C 8FA400BC */ lw $a0, 0xbc($sp)
.L80201830:
/* 0A0680 802E0E80 8FAF0104 */ lw $t7, 0x104($sp)
/* 0A0684 802E0E84 3C010800 */ lui $at, 0x800
/* 0A0688 802E0E88 26520008 */ addiu $s2, $s2, 8
/* 0A068C 802E0E8C 25F90180 */ addiu $t9, $t7, 0x180
/* 0A0690 802E0E90 332EFFFF */ andi $t6, $t9, 0xffff
/* 0A0694 802E0E94 01C1C025 */ or $t8, $t6, $at
/* 0A0698 802E0E98 258F0008 */ addiu $t7, $t4, 8
/* 0A069C 802E0E9C 31F9FFFF */ andi $t9, $t7, 0xffff
/* 0A06A0 802E0EA0 AC580000 */ sw $t8, ($v0)
/* 0A06A4 802E0EA4 3C010160 */ lui $at, 0x160
/* 0A06A8 802E0EA8 03217025 */ or $t6, $t9, $at
/* 0A06AC 802E0EAC 3C180501 */ lui $t8, (0x0501FF60 >> 16) # lui $t8, 0x501
/* 0A06B0 802E0EB0 AC4E0004 */ sw $t6, 4($v0)
/* 0A06B4 802E0EB4 3718FF60 */ ori $t8, (0x0501FF60 & 0xFFFF) # ori $t8, $t8, 0xff60
/* 0A06B8 802E0EB8 02401825 */ move $v1, $s2
/* 0A06BC 802E0EBC AC780000 */ sw $t8, ($v1)
/* 0A06C0 802E0EC0 8EEF000C */ lw $t7, 0xc($s7)
/* 0A06C4 802E0EC4 3C018000 */ lui $at, (0x800000F0 >> 16) # lui $at, 0x8000
/* 0A06C8 802E0EC8 342100F0 */ ori $at, (0x800000F0 & 0xFFFF) # ori $at, $at, 0xf0
/* 0A06CC 802E0ECC 26520008 */ addiu $s2, $s2, 8
/* 0A06D0 802E0ED0 3C0E0A00 */ lui $t6, (0x0A000164 >> 16) # lui $t6, 0xa00
/* 0A06D4 802E0ED4 01E1C821 */ addu $t9, $t7, $at
/* 0A06D8 802E0ED8 AC790004 */ sw $t9, 4($v1)
/* 0A06DC 802E0EDC 35CE0164 */ ori $t6, (0x0A000164 & 0xFFFF) # ori $t6, $t6, 0x164
/* 0A06E0 802E0EE0 02402025 */ move $a0, $s2
/* 0A06E4 802E0EE4 AC8E0000 */ sw $t6, ($a0)
/* 0A06E8 802E0EE8 8FB800AC */ lw $t8, 0xac($sp)
/* 0A06EC 802E0EEC 26520008 */ addiu $s2, $s2, 8
/* 0A06F0 802E0EF0 27190020 */ addiu $t9, $t8, 0x20
/* 0A06F4 802E0EF4 25980004 */ addiu $t8, $t4, 4
/* 0A06F8 802E0EF8 330FFFFF */ andi $t7, $t8, 0xffff
/* 0A06FC 802E0EFC 00197400 */ sll $t6, $t9, 0x10
/* 0A0700 802E0F00 01CFC825 */ or $t9, $t6, $t7
/* 0A0704 802E0F04 AC990004 */ sw $t9, 4($a0)
/* 0A0708 802E0F08 8FB8014C */ lw $t8, 0x14c($sp)
/* 0A070C 802E0F0C 8FA400BC */ lw $a0, 0xbc($sp)
/* 0A0710 802E0F10 8F070000 */ lw $a3, ($t8)
/* 0A0714 802E0F14 00072880 */ sll $a1, $a3, 2
/* 0A0718 802E0F18 000577C2 */ srl $t6, $a1, 0x1f
/* 0A071C 802E0F1C 01C02825 */ move $a1, $t6
.L802018D0:
/* 0A0720 802E0F20 10A00005 */ beqz $a1, .L802018E8
/* 0A0724 802E0F24 8FA200B8 */ lw $v0, 0xb8($sp)
/* 0A0728 802E0F28 AFB2015C */ sw $s2, 0x15c($sp)
/* 0A072C 802E0F2C 24130001 */ li $s3, 1
/* 0A0730 802E0F30 10000007 */ b .L80201900
/* 0A0734 802E0F34 8FB1014C */ lw $s1, 0x14c($sp)
.L802018E8:
/* 0A0738 802E0F38 24420001 */ addiu $v0, $v0, 1
/* 0A073C 802E0F3C 1444FE45 */ bne $v0, $a0, .L80201204
/* 0A0740 802E0F40 AFA200B8 */ sw $v0, 0xb8($sp)
/* 0A0744 802E0F44 AFB2015C */ sw $s2, 0x15c($sp)
/* 0A0748 802E0F48 24130001 */ li $s3, 1
/* 0A074C 802E0F4C 8FB1014C */ lw $s1, 0x14c($sp)
.L80201900:
/* 0A0750 802E0F50 00077840 */ sll $t7, $a3, 1
/* 0A0754 802E0F54 000FCFC2 */ srl $t9, $t7, 0x1f
/* 0A0758 802E0F58 8FB2015C */ lw $s2, 0x15c($sp)
/* 0A075C 802E0F5C 16790005 */ bne $s3, $t9, .L80201924
/* 0A0760 802E0F60 00001825 */ move $v1, $zero
/* 0A0764 802E0F64 92380000 */ lbu $t8, ($s1)
/* 0A0768 802E0F68 24030001 */ li $v1, 1
/* 0A076C 802E0F6C 330EFFBF */ andi $t6, $t8, 0xffbf
/* 0A0770 802E0F70 A22E0000 */ sb $t6, ($s1)
.L80201924:
/* 0A0774 802E0F74 8FB30158 */ lw $s3, 0x158($sp)
/* 0A0778 802E0F78 97B900AA */ lhu $t9, 0xaa($sp)
/* 0A077C 802E0F7C 02402025 */ move $a0, $s2
/* 0A0780 802E0F80 00133040 */ sll $a2, $s3, 1
/* 0A0784 802E0F84 00C09825 */ move $s3, $a2
/* 0A0788 802E0F88 02E02825 */ move $a1, $s7
/* 0A078C 802E0F8C 97A7011A */ lhu $a3, 0x11a($sp)
/* 0A0790 802E0F90 AFA30014 */ sw $v1, 0x14($sp)
/* 0A0794 802E0F94 AFA3011C */ sw $v1, 0x11c($sp)
/* 0A0798 802E0F98 0C0B8449 */ jal final_resample
/* 0A079C 802E0F9C AFB90010 */ sw $t9, 0x10($sp)
/* 0A07A0 802E0FA0 92380003 */ lbu $t8, 3($s1)
/* 0A07A4 802E0FA4 00409025 */ move $s2, $v0
/* 0A07A8 802E0FA8 8FB4011C */ lw $s4, 0x11c($sp)
/* 0A07AC 802E0FAC 17000004 */ bnez $t8, .L80201970
/* 0A07B0 802E0FB0 02402025 */ move $a0, $s2
/* 0A07B4 802E0FB4 92EE0002 */ lbu $t6, 2($s7)
/* 0A07B8 802E0FB8 51C00004 */ beql $t6, $zero, .L8020197C
/* 0A07BC 802E0FBC 922F0004 */ lbu $t7, 4($s1)
.L80201970:
/* 0A07C0 802E0FC0 1000000A */ b .L8020199C
/* 0A07C4 802E0FC4 24100001 */ li $s0, 1
/* 0A07C8 802E0FC8 922F0004 */ lbu $t7, 4($s1)
.L8020197C:
/* 0A07CC 802E0FCC 15E00005 */ bnez $t7, .L80201994
/* 0A07D0 802E0FD0 00000000 */ nop
/* 0A07D4 802E0FD4 92F90003 */ lbu $t9, 3($s7)
/* 0A07D8 802E0FD8 00008025 */ move $s0, $zero
/* 0A07DC 802E0FDC 13200003 */ beqz $t9, .L8020199C
/* 0A07E0 802E0FE0 00000000 */ nop
.L80201994:
/* 0A07E4 802E0FE4 10000001 */ b .L8020199C
/* 0A07E8 802E0FE8 24100002 */ li $s0, 2
.L8020199C:
/* 0A07EC 802E0FEC 02202825 */ move $a1, $s1
/* 0A07F0 802E0FF0 02E03025 */ move $a2, $s7
/* 0A07F4 802E0FF4 8FA70158 */ lw $a3, 0x158($sp)
/* 0A07F8 802E0FF8 AFA00010 */ sw $zero, 0x10($sp)
/* 0A07FC 802E0FFC AFB00014 */ sw $s0, 0x14($sp)
/* 0A0800 802E1000 0C0B8460 */ jal process_envelope
/* 0A0804 802E1004 AFB40018 */ sw $s4, 0x18($sp)
/* 0A0808 802E1008 92380000 */ lbu $t8, ($s1)
/* 0A080C 802E100C 00409025 */ move $s2, $v0
/* 0A0810 802E1010 00402025 */ move $a0, $v0
/* 0A0814 802E1014 330E0001 */ andi $t6, $t8, 1
/* 0A0818 802E1018 11C00007 */ beqz $t6, .L802019E8
/* 0A081C 802E101C 02202825 */ move $a1, $s1
/* 0A0820 802E1020 02E03025 */ move $a2, $s7
/* 0A0824 802E1024 02603825 */ move $a3, $s3
/* 0A0828 802E1028 AFB40010 */ sw $s4, 0x10($sp)
/* 0A082C 802E102C 0C0B85E6 */ jal note_apply_headset_pan_effects
/* 0A0830 802E1030 AFB00014 */ sw $s0, 0x14($sp)
/* 0A0834 802E1034 00409025 */ move $s2, $v0
.L802019E8:
/* 0A0838 802E1038 02401025 */ move $v0, $s2
.L802019EC:
/* 0A083C 802E103C 8FBF004C */ lw $ra, 0x4c($sp)
/* 0A0840 802E1040 8FB00028 */ lw $s0, 0x28($sp)
/* 0A0844 802E1044 8FB1002C */ lw $s1, 0x2c($sp)
/* 0A0848 802E1048 8FB20030 */ lw $s2, 0x30($sp)
/* 0A084C 802E104C 8FB30034 */ lw $s3, 0x34($sp)
/* 0A0850 802E1050 8FB40038 */ lw $s4, 0x38($sp)
/* 0A0854 802E1054 8FB5003C */ lw $s5, 0x3c($sp)
/* 0A0858 802E1058 8FB60040 */ lw $s6, 0x40($sp)
/* 0A085C 802E105C 8FB70044 */ lw $s7, 0x44($sp)
/* 0A0860 802E1060 8FBE0048 */ lw $fp, 0x48($sp)
/* 0A0864 802E1064 03E00008 */ jr $ra
/* 0A0868 802E1068 27BD0148 */ addiu $sp, $sp, 0x148

View File

@ -1,738 +0,0 @@
.late_rodata
glabel D_80337BB0
.word 0x3FFFFFD6, 0x0E94EE39
glabel D_80337BB8
.word 0x3FFFFEB0, 0
glabel D_80337BC0
.word 0x400FFFDB, 0x4CC25072
glabel D_80337BC8
.word 0x407FFEDA, 0
.text
glabel synthesis_process_notes
/* 0CF480 80314480 27BDFE88 */ addiu $sp, $sp, -0x178
/* 0CF484 80314484 3C0E8022 */ lui $t6, %hi(gMaxSimultaneousNotes) # $t6, 0x8022
/* 0CF488 80314488 8DCE6D70 */ lw $t6, %lo(gMaxSimultaneousNotes)($t6)
/* 0CF48C 8031448C AFB40030 */ sw $s4, 0x30($sp)
/* 0CF490 80314490 00C0A025 */ move $s4, $a2
/* 0CF494 80314494 AFBF0044 */ sw $ra, 0x44($sp)
/* 0CF498 80314498 AFBE0040 */ sw $fp, 0x40($sp)
/* 0CF49C 8031449C AFB7003C */ sw $s7, 0x3c($sp)
/* 0CF4A0 803144A0 AFB60038 */ sw $s6, 0x38($sp)
/* 0CF4A4 803144A4 AFB50034 */ sw $s5, 0x34($sp)
/* 0CF4A8 803144A8 AFB3002C */ sw $s3, 0x2c($sp)
/* 0CF4AC 803144AC AFB20028 */ sw $s2, 0x28($sp)
/* 0CF4B0 803144B0 AFB10024 */ sw $s1, 0x24($sp)
/* 0CF4B4 803144B4 AFB00020 */ sw $s0, 0x20($sp)
/* 0CF4B8 803144B8 AFA40178 */ sw $a0, 0x178($sp)
/* 0CF4BC 803144BC AFA5017C */ sw $a1, 0x17c($sp)
/* 0CF4C0 803144C0 AFA00174 */ sw $zero, 0x174($sp)
/* 0CF4C4 803144C4 19C00267 */ blez $t6, .L80314E64
/* 0CF4C8 803144C8 AFA0015C */ sw $zero, 0x15c($sp)
/* 0CF4CC 803144CC AFA0006C */ sw $zero, 0x6c($sp)
/* 0CF4D0 803144D0 3C1F8000 */ lui $ra, 0x8000
.L803144D4:
/* 0CF4D4 803144D4 3C188022 */ lui $t8, %hi(gNotes) # $t8, 0x8022
/* 0CF4D8 803144D8 8F182A10 */ lw $t8, %lo(gNotes)($t8)
/* 0CF4DC 803144DC 8FAF006C */ lw $t7, 0x6c($sp)
/* 0CF4E0 803144E0 3C198022 */ lui $t9, %hi(gBankLoadStatus)
/* 0CF4E4 803144E4 3C010100 */ lui $at, 0x100
/* 0CF4E8 803144E8 01F8B821 */ addu $s7, $t7, $t8
/* 0CF4EC 803144EC 92E20007 */ lbu $v0, 7($s7)
/* 0CF4F0 803144F0 8FB80174 */ lw $t8, 0x174($sp)
/* 0CF4F4 803144F4 0322C821 */ addu $t9, $t9, $v0
/* 0CF4F8 803144F8 933918D0 */ lbu $t9, %lo(gBankLoadStatus)($t9)
/* 0CF4FC 803144FC 2B2E0002 */ slti $t6, $t9, 2
/* 0CF500 80314500 11C00006 */ beqz $t6, .L8031451C
/* 0CF504 80314504 00027A00 */ sll $t7, $v0, 8
/* 0CF508 80314508 01F8C821 */ addu $t9, $t7, $t8
/* 0CF50C 8031450C 03217021 */ addu $t6, $t9, $at
/* 0CF510 80314510 3C018033 */ lui $at, %hi(gAudioErrorFlags)
/* 0CF514 80314514 10000249 */ b .L80314E3C
/* 0CF518 80314518 AC2E1D40 */ sw $t6, %lo(gAudioErrorFlags)($at)
.L8031451C:
/* 0CF51C 8031451C 8EEF0000 */ lw $t7, ($s7)
/* 0CF520 80314520 000FC7C2 */ srl $t8, $t7, 0x1f
/* 0CF524 80314524 53000246 */ beql $t8, $zero, .L80314E40
/* 0CF528 80314528 8FAE0174 */ lw $t6, 0x174($sp)
/* 0CF52C 8031452C 8FB9017C */ lw $t9, 0x17c($sp)
/* 0CF530 80314530 AFA00148 */ sw $zero, 0x148($sp)
/* 0CF534 80314534 24010001 */ li $at, 1
/* 0CF538 80314538 00197040 */ sll $t6, $t9, 1
/* 0CF53C 8031453C AFAE0048 */ sw $t6, 0x48($sp)
/* 0CF540 80314540 8EEF0000 */ lw $t7, ($s7)
/* 0CF544 80314544 44802000 */ mtc1 $zero, $f4
/* 0CF548 80314548 240E0001 */ li $t6, 1
/* 0CF54C 8031454C 000FC040 */ sll $t8, $t7, 1
/* 0CF550 80314550 0018CFC2 */ srl $t9, $t8, 0x1f
/* 0CF554 80314554 17210004 */ bne $t9, $at, .L80314568
/* 0CF558 80314558 02802025 */ move $a0, $s4
/* 0CF55C 8031455C AFAE0148 */ sw $t6, 0x148($sp)
/* 0CF560 80314560 AEE00014 */ sw $zero, 0x14($s7)
/* 0CF564 80314564 A6E00020 */ sh $zero, 0x20($s7)
.L80314568:
/* 0CF568 80314568 C6E20038 */ lwc1 $f2, 0x38($s7)
/* 0CF56C 8031456C 3C014000 */ li $at, 0x40000000 # 2.000000
/* 0CF570 80314570 44812800 */ mtc1 $at, $f5
/* 0CF574 80314574 46001021 */ cvt.d.s $f0, $f2
/* 0CF578 80314578 3C018033 */ lui $at, %hi(D_80337BC0)
/* 0CF57C 8031457C 4624003C */ c.lt.d $f0, $f4
/* 0CF580 80314580 02E02825 */ move $a1, $s7
/* 0CF584 80314584 4500000E */ bc1f .L803145C0
/* 0CF588 80314588 00000000 */ nop
/* 0CF58C 8031458C 3C018033 */ lui $at, %hi(D_80337BB0)
/* 0CF590 80314590 D4267BB0 */ ldc1 $f6, %lo(D_80337BB0)($at)
/* 0CF594 80314594 240F0001 */ li $t7, 1
/* 0CF598 80314598 AFAF00E8 */ sw $t7, 0xe8($sp)
/* 0CF59C 8031459C 4620303C */ c.lt.d $f6, $f0
/* 0CF5A0 803145A0 3C018033 */ lui $at, %hi(D_80337BB8)
/* 0CF5A4 803145A4 45000004 */ bc1f .L803145B8
/* 0CF5A8 803145A8 00000000 */ nop
/* 0CF5AC 803145AC C4287BB8 */ lwc1 $f8, %lo(D_80337BB8)($at)
/* 0CF5B0 803145B0 E6E80038 */ swc1 $f8, 0x38($s7)
/* 0CF5B4 803145B4 C6E20038 */ lwc1 $f2, 0x38($s7)
.L803145B8:
/* 0CF5B8 803145B8 10000012 */ b .L80314604
/* 0CF5BC 803145BC 46001306 */ mov.s $f12, $f2
.L803145C0:
/* 0CF5C0 803145C0 D42A7BC0 */ ldc1 $f10, %lo(D_80337BC0)($at)
/* 0CF5C4 803145C4 24180002 */ li $t8, 2
/* 0CF5C8 803145C8 44802000 */ mtc1 $zero, $f4
/* 0CF5CC 803145CC 4620503E */ c.le.d $f10, $f0
/* 0CF5D0 803145D0 AFB800E8 */ sw $t8, 0xe8($sp)
/* 0CF5D4 803145D4 3C018033 */ lui $at, %hi(D_80337BC8)
/* 0CF5D8 803145D8 45020006 */ bc1fl .L803145F4
/* 0CF5DC 803145DC 3C013FE0 */ lui $at, 0x3fe0
/* 0CF5E0 803145E0 C4307BC8 */ lwc1 $f16, %lo(D_80337BC8)($at)
/* 0CF5E4 803145E4 E6F00038 */ swc1 $f16, 0x38($s7)
/* 0CF5E8 803145E8 C6F20038 */ lwc1 $f18, 0x38($s7)
/* 0CF5EC 803145EC 46009021 */ cvt.d.s $f0, $f18
/* 0CF5F0 803145F0 3C013FE0 */ li $at, 0x3FE00000 # 1.750000
.L803145F4:
/* 0CF5F4 803145F4 44812800 */ mtc1 $at, $f5
/* 0CF5F8 803145F8 00000000 */ nop
/* 0CF5FC 803145FC 46240182 */ mul.d $f6, $f0, $f4
/* 0CF600 80314600 46203320 */ cvt.s.d $f12, $f6
.L80314604:
/* 0CF604 80314604 3C014700 */ li $at, 0x47000000 # 32768.000000
/* 0CF608 80314608 44814000 */ mtc1 $at, $f8
/* 0CF60C 8031460C 8FB8017C */ lw $t8, 0x17c($sp)
/* 0CF610 80314610 46086282 */ mul.s $f10, $f12, $f8
/* 0CF614 80314614 4600540D */ trunc.w.s $f16, $f10
/* 0CF618 80314618 440E8000 */ mfc1 $t6, $f16
/* 0CF61C 8031461C 00000000 */ nop
/* 0CF620 80314620 31CFFFFF */ andi $t7, $t6, 0xffff
/* 0CF624 80314624 01F80019 */ multu $t7, $t8
/* 0CF628 80314628 AFAF005C */ sw $t7, 0x5c($sp)
/* 0CF62C 8031462C 96EF0020 */ lhu $t7, 0x20($s7)
/* 0CF630 80314630 8EE20024 */ lw $v0, 0x24($s7)
/* 0CF634 80314634 0000C812 */ mflo $t9
/* 0CF638 80314638 00197040 */ sll $t6, $t9, 1
/* 0CF63C 8031463C 01EE1821 */ addu $v1, $t7, $t6
/* 0CF640 80314640 1440000E */ bnez $v0, .L8031467C
/* 0CF644 80314644 A6E30020 */ sh $v1, 0x20($s7)
/* 0CF648 80314648 00038402 */ srl $s0, $v1, 0x10
/* 0CF64C 8031464C 02003025 */ move $a2, $s0
/* 0CF650 80314650 0C0C53C2 */ jal load_wave_samples
/* 0CF654 80314654 AFA00148 */ sw $zero, 0x148($sp)
/* 0CF658 80314658 8EE90014 */ lw $t1, 0x14($s7)
/* 0CF65C 8031465C 0040A025 */ move $s4, $v0
/* 0CF660 80314660 0009C840 */ sll $t9, $t1, 1
/* 0CF664 80314664 272F0180 */ addiu $t7, $t9, 0x180
/* 0CF668 80314668 A7AF00D6 */ sh $t7, 0xd6($sp)
/* 0CF66C 8031466C 01307021 */ addu $t6, $t1, $s0
/* 0CF670 80314670 AEEE0014 */ sw $t6, 0x14($s7)
/* 0CF674 80314674 100001B9 */ b .L80314D5C
/* 0CF678 80314678 8EE50000 */ lw $a1, ($s7)
.L8031467C:
/* 0CF67C 8031467C 8C460000 */ lw $a2, ($v0)
/* 0CF680 80314680 00031402 */ srl $v0, $v1, 0x10
/* 0CF684 80314684 8CD80008 */ lw $t8, 8($a2)
/* 0CF688 80314688 AFB80160 */ sw $t8, 0x160($sp)
/* 0CF68C 8031468C 8F0F0004 */ lw $t7, 4($t8)
/* 0CF690 80314690 8FB800E8 */ lw $t8, 0xe8($sp)
/* 0CF694 80314694 AFAF0110 */ sw $t7, 0x110($sp)
/* 0CF698 80314698 8CCE0004 */ lw $t6, 4($a2)
/* 0CF69C 8031469C AFA000D8 */ sw $zero, 0xd8($sp)
/* 0CF6A0 803146A0 AFA000E4 */ sw $zero, 0xe4($sp)
/* 0CF6A4 803146A4 1B0001AB */ blez $t8, .L80314D54
/* 0CF6A8 803146A8 AFAE0120 */ sw $t6, 0x120($sp)
/* 0CF6AC 803146AC 3B190001 */ xori $t9, $t8, 1
/* 0CF6B0 803146B0 2F390001 */ sltiu $t9, $t9, 1
/* 0CF6B4 803146B4 AFB90054 */ sw $t9, 0x54($sp)
/* 0CF6B8 803146B8 AFA20058 */ sw $v0, 0x58($sp)
/* 0CF6BC 803146BC AFA60164 */ sw $a2, 0x164($sp)
/* 0CF6C0 803146C0 8FA60164 */ lw $a2, 0x164($sp)
.L803146C4:
/* 0CF6C4 803146C4 8FAF0054 */ lw $t7, 0x54($sp)
/* 0CF6C8 803146C8 8FA20058 */ lw $v0, 0x58($sp)
/* 0CF6CC 803146CC 8CC4000C */ lw $a0, 0xc($a2)
/* 0CF6D0 803146D0 0000F025 */ move $fp, $zero
/* 0CF6D4 803146D4 0000A825 */ move $s5, $zero
/* 0CF6D8 803146D8 11E00003 */ beqz $t7, .L803146E8
/* 0CF6DC 803146DC 24850008 */ addiu $a1, $a0, 8
/* 0CF6E0 803146E0 1000000B */ b .L80314710
/* 0CF6E4 803146E4 00406825 */ move $t5, $v0
.L803146E8:
/* 0CF6E8 803146E8 304E0001 */ andi $t6, $v0, 1
/* 0CF6EC 803146EC 11C00007 */ beqz $t6, .L8031470C
/* 0CF6F0 803146F0 AFA60164 */ sw $a2, 0x164($sp)
/* 0CF6F4 803146F4 8FB900E4 */ lw $t9, 0xe4($sp)
/* 0CF6F8 803146F8 2401FFFE */ li $at, -2
/* 0CF6FC 803146FC 0041C024 */ and $t8, $v0, $at
/* 0CF700 80314700 00197840 */ sll $t7, $t9, 1
/* 0CF704 80314704 10000002 */ b .L80314710
/* 0CF708 80314708 030F6821 */ addu $t5, $t8, $t7
.L8031470C:
/* 0CF70C 8031470C 00406825 */ move $t5, $v0
.L80314710:
/* 0CF710 80314710 8FAE015C */ lw $t6, 0x15c($sp)
/* 0CF714 80314714 AFA20058 */ sw $v0, 0x58($sp)
/* 0CF718 80314718 11C50012 */ beq $t6, $a1, .L80314764
/* 0CF71C 8031471C 00000000 */ nop
/* 0CF720 80314720 AFA5015C */ sw $a1, 0x15c($sp)
/* 0CF724 80314724 8C980000 */ lw $t8, ($a0)
/* 0CF728 80314728 8C990004 */ lw $t9, 4($a0)
/* 0CF72C 8031472C 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0CF730 80314730 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0CF734 80314734 03380019 */ multu $t9, $t8
/* 0CF738 80314738 02801025 */ move $v0, $s4
/* 0CF73C 8031473C 26940008 */ addiu $s4, $s4, 8
/* 0CF740 80314740 00001812 */ mflo $v1
/* 0CF744 80314744 00037900 */ sll $t7, $v1, 4
/* 0CF748 80314748 01E17024 */ and $t6, $t7, $at
/* 0CF74C 8031474C 3C010B00 */ lui $at, 0xb00
/* 0CF750 80314750 01C1C825 */ or $t9, $t6, $at
/* 0CF754 80314754 AC590000 */ sw $t9, ($v0)
/* 0CF758 80314758 8FB8015C */ lw $t8, 0x15c($sp)
/* 0CF75C 8031475C 031F7821 */ addu $t7, $t8, $ra
/* 0CF760 80314760 AC4F0004 */ sw $t7, 4($v0)
.L80314764:
/* 0CF764 80314764 11A00101 */ beqz $t5, .L80314B6C
/* 0CF768 80314768 8FA20058 */ lw $v0, 0x58($sp)
/* 0CF76C 8031476C AFA20058 */ sw $v0, 0x58($sp)
/* 0CF770 80314770 8EE90014 */ lw $t1, 0x14($s7)
.L80314774:
/* 0CF774 80314774 8FAE0110 */ lw $t6, 0x110($sp)
/* 0CF778 80314778 01BE2023 */ subu $a0, $t5, $fp
/* 0CF77C 8031477C 3132000F */ andi $s2, $t1, 0xf
/* 0CF780 80314780 00005025 */ move $t2, $zero
/* 0CF784 80314784 00005825 */ move $t3, $zero
/* 0CF788 80314788 00806025 */ move $t4, $a0
/* 0CF78C 8031478C 16400006 */ bnez $s2, .L803147A8
/* 0CF790 80314790 01C91823 */ subu $v1, $t6, $t1
/* 0CF794 80314794 8EF90000 */ lw $t9, ($s7)
/* 0CF798 80314798 00197880 */ sll $t7, $t9, 2
/* 0CF79C 8031479C 05E20003 */ bltzl $t7, .L803147AC
/* 0CF7A0 803147A0 240E0010 */ li $t6, 16
/* 0CF7A4 803147A4 24120010 */ li $s2, 16
.L803147A8:
/* 0CF7A8 803147A8 240E0010 */ li $t6, 16
.L803147AC:
/* 0CF7AC 803147AC 01D22823 */ subu $a1, $t6, $s2
/* 0CF7B0 803147B0 0083082A */ slt $at, $a0, $v1
/* 0CF7B4 803147B4 1020000C */ beqz $at, .L803147E8
/* 0CF7B8 803147B8 00A0B025 */ move $s6, $a1
/* 0CF7BC 803147BC 00851023 */ subu $v0, $a0, $a1
/* 0CF7C0 803147C0 2442000F */ addiu $v0, $v0, 0xf
/* 0CF7C4 803147C4 04410003 */ bgez $v0, .L803147D4
/* 0CF7C8 803147C8 0002C903 */ sra $t9, $v0, 4
/* 0CF7CC 803147CC 2441000F */ addiu $at, $v0, 0xf
/* 0CF7D0 803147D0 0001C903 */ sra $t9, $at, 4
.L803147D4:
/* 0CF7D4 803147D4 00198100 */ sll $s0, $t9, 4
/* 0CF7D8 803147D8 00B0C021 */ addu $t8, $a1, $s0
/* 0CF7DC 803147DC 03204025 */ move $t0, $t9
/* 0CF7E0 803147E0 10000014 */ b .L80314834
/* 0CF7E4 803147E4 03049823 */ subu $s3, $t8, $a0
.L803147E8:
/* 0CF7E8 803147E8 00721021 */ addu $v0, $v1, $s2
/* 0CF7EC 803147EC 2450FFF0 */ addiu $s0, $v0, -0x10
/* 0CF7F0 803147F0 1E000003 */ bgtz $s0, .L80314800
/* 0CF7F4 803147F4 00009825 */ move $s3, $zero
/* 0CF7F8 803147F8 00008025 */ move $s0, $zero
/* 0CF7FC 803147FC 0060B025 */ move $s6, $v1
.L80314800:
/* 0CF800 80314800 8FAE0160 */ lw $t6, 0x160($sp)
/* 0CF804 80314804 2608000F */ addiu $t0, $s0, 0xf
/* 0CF808 80314808 05010003 */ bgez $t0, .L80314818
/* 0CF80C 8031480C 00087903 */ sra $t7, $t0, 4
/* 0CF810 80314810 2501000F */ addiu $at, $t0, 0xf
/* 0CF814 80314814 00017903 */ sra $t7, $at, 4
.L80314818:
/* 0CF818 80314818 8DD90008 */ lw $t9, 8($t6)
/* 0CF81C 8031481C 01E04025 */ move $t0, $t7
/* 0CF820 80314820 53200004 */ beql $t9, $zero, .L80314834
/* 0CF824 80314824 240A0001 */ li $t2, 1
/* 0CF828 80314828 10000002 */ b .L80314834
/* 0CF82C 8031482C 240B0001 */ li $t3, 1
/* 0CF830 80314830 240A0001 */ li $t2, 1
.L80314834:
/* 0CF834 80314834 11000030 */ beqz $t0, .L803148F8
/* 0CF838 80314838 24030009 */ li $v1, 9
/* 0CF83C 8031483C 01321023 */ subu $v0, $t1, $s2
/* 0CF840 80314840 24420010 */ addiu $v0, $v0, 0x10
/* 0CF844 80314844 04410003 */ bgez $v0, .L80314854
/* 0CF848 80314848 0002C103 */ sra $t8, $v0, 4
/* 0CF84C 8031484C 2441000F */ addiu $at, $v0, 0xf
/* 0CF850 80314850 0001C103 */ sra $t8, $at, 4
.L80314854:
/* 0CF854 80314854 03030019 */ multu $t8, $v1
/* 0CF858 80314858 8FAE0120 */ lw $t6, 0x120($sp)
/* 0CF85C 8031485C 8FA60148 */ lw $a2, 0x148($sp)
/* 0CF860 80314860 26E70003 */ addiu $a3, $s7, 3
/* 0CF864 80314864 AFAA0150 */ sw $t2, 0x150($sp)
/* 0CF868 80314868 AFAB014C */ sw $t3, 0x14c($sp)
/* 0CF86C 8031486C AFAC010C */ sw $t4, 0x10c($sp)
/* 0CF870 80314870 AFAD0118 */ sw $t5, 0x118($sp)
/* 0CF874 80314874 00007812 */ mflo $t7
/* 0CF878 80314878 01EE2021 */ addu $a0, $t7, $t6
/* 0CF87C 8031487C 00000000 */ nop
/* 0CF880 80314880 01030019 */ multu $t0, $v1
/* 0CF884 80314884 00008812 */ mflo $s1
/* 0CF888 80314888 02202825 */ move $a1, $s1
/* 0CF88C 8031488C 0C0C5C9C */ jal dma_sample_data
/* 0CF890 80314890 00000000 */ nop
/* 0CF894 80314894 3047000F */ andi $a3, $v0, 0xf
/* 0CF898 80314898 02802025 */ move $a0, $s4
/* 0CF89C 8031489C 3C190800 */ lui $t9, (0x080003F0 >> 16) # lui $t9, 0x800
/* 0CF8A0 803148A0 8FAA0150 */ lw $t2, 0x150($sp)
/* 0CF8A4 803148A4 8FAB014C */ lw $t3, 0x14c($sp)
/* 0CF8A8 803148A8 8FAC010C */ lw $t4, 0x10c($sp)
/* 0CF8AC 803148AC 8FAD0118 */ lw $t5, 0x118($sp)
/* 0CF8B0 803148B0 373903F0 */ ori $t9, (0x080003F0 & 0xFFFF) # ori $t9, $t9, 0x3f0
/* 0CF8B4 803148B4 0227C021 */ addu $t8, $s1, $a3
/* 0CF8B8 803148B8 330FFFFF */ andi $t7, $t8, 0xffff
/* 0CF8BC 803148BC AC990000 */ sw $t9, ($a0)
/* 0CF8C0 803148C0 26940008 */ addiu $s4, $s4, 8
/* 0CF8C4 803148C4 3C1F8000 */ lui $ra, 0x8000
/* 0CF8C8 803148C8 AC8F0004 */ sw $t7, 4($a0)
/* 0CF8CC 803148CC 02802825 */ move $a1, $s4
/* 0CF8D0 803148D0 0047C823 */ subu $t9, $v0, $a3
/* 0CF8D4 803148D4 033FC021 */ addu $t8, $t9, $ra
/* 0CF8D8 803148D8 3C0E0400 */ lui $t6, 0x400
/* 0CF8DC 803148DC ACAE0000 */ sw $t6, ($a1)
/* 0CF8E0 803148E0 ACB80004 */ sw $t8, 4($a1)
/* 0CF8E4 803148E4 8EE60000 */ lw $a2, ($s7)
/* 0CF8E8 803148E8 26940008 */ addiu $s4, $s4, 8
/* 0CF8EC 803148EC 00067880 */ sll $t7, $a2, 2
/* 0CF8F0 803148F0 10000006 */ b .L8031490C
/* 0CF8F4 803148F4 000F37C2 */ srl $a2, $t7, 0x1f
.L803148F8:
/* 0CF8F8 803148F8 8EE60000 */ lw $a2, ($s7)
/* 0CF8FC 803148FC 00008025 */ move $s0, $zero
/* 0CF900 80314900 00003825 */ move $a3, $zero
/* 0CF904 80314904 0006C880 */ sll $t9, $a2, 2
/* 0CF908 80314908 001937C2 */ srl $a2, $t9, 0x1f
.L8031490C:
/* 0CF90C 8031490C 10C0000F */ beqz $a2, .L8031494C
/* 0CF910 80314910 02801025 */ move $v0, $s4
/* 0CF914 80314914 3C0F0F00 */ lui $t7, 0xf00
/* 0CF918 80314918 AC4F0000 */ sw $t7, ($v0)
/* 0CF91C 8031491C 8FAE0164 */ lw $t6, 0x164($sp)
/* 0CF920 80314920 3C018000 */ lui $at, (0x80000010 >> 16) # lui $at, 0x8000
/* 0CF924 80314924 34210010 */ ori $at, (0x80000010 & 0xFFFF) # ori $at, $at, 0x10
/* 0CF928 80314928 8DD90008 */ lw $t9, 8($t6)
/* 0CF92C 8031492C 240F0002 */ li $t7, 2
/* 0CF930 80314930 26940008 */ addiu $s4, $s4, 8
/* 0CF934 80314934 0321C021 */ addu $t8, $t9, $at
/* 0CF938 80314938 AC580004 */ sw $t8, 4($v0)
/* 0CF93C 8031493C AFAF0148 */ sw $t7, 0x148($sp)
/* 0CF940 80314940 92EE0000 */ lbu $t6, ($s7)
/* 0CF944 80314944 31D9FFDF */ andi $t9, $t6, 0xffdf
/* 0CF948 80314948 A2F90000 */ sb $t9, ($s7)
.L8031494C:
/* 0CF94C 8031494C 17C0001B */ bnez $fp, .L803149BC
/* 0CF950 80314950 02801025 */ move $v0, $s4
/* 0CF954 80314954 24F803F0 */ addiu $t8, $a3, 0x3f0
/* 0CF958 80314958 330FFFFF */ andi $t7, $t8, 0xffff
/* 0CF95C 8031495C 3C010800 */ lui $at, 0x800
/* 0CF960 80314960 01E17025 */ or $t6, $t7, $at
/* 0CF964 80314964 00103040 */ sll $a2, $s0, 1
/* 0CF968 80314968 30D9FFFF */ andi $t9, $a2, 0xffff
/* 0CF96C 8031496C 3C010180 */ lui $at, 0x180
/* 0CF970 80314970 02801025 */ move $v0, $s4
/* 0CF974 80314974 0321C025 */ or $t8, $t9, $at
/* 0CF978 80314978 AC580004 */ sw $t8, 4($v0)
/* 0CF97C 8031497C AC4E0000 */ sw $t6, ($v0)
/* 0CF980 80314980 8FAF0148 */ lw $t7, 0x148($sp)
/* 0CF984 80314984 26940008 */ addiu $s4, $s4, 8
/* 0CF988 80314988 3C010100 */ lui $at, 0x100
/* 0CF98C 8031498C 31EE00FF */ andi $t6, $t7, 0xff
/* 0CF990 80314990 000ECC00 */ sll $t9, $t6, 0x10
/* 0CF994 80314994 0321C025 */ or $t8, $t9, $at
/* 0CF998 80314998 02801825 */ move $v1, $s4
/* 0CF99C 8031499C AC780000 */ sw $t8, ($v1)
/* 0CF9A0 803149A0 8EEF0034 */ lw $t7, 0x34($s7)
/* 0CF9A4 803149A4 0012C840 */ sll $t9, $s2, 1
/* 0CF9A8 803149A8 26940008 */ addiu $s4, $s4, 8
/* 0CF9AC 803149AC 01FF7021 */ addu $t6, $t7, $ra
/* 0CF9B0 803149B0 AC6E0004 */ sw $t6, 4($v1)
/* 0CF9B4 803149B4 1000002F */ b .L80314A74
/* 0CF9B8 803149B8 AFB90130 */ sw $t9, 0x130($sp)
.L803149BC:
/* 0CF9BC 803149BC 24F803F0 */ addiu $t8, $a3, 0x3f0
/* 0CF9C0 803149C0 330FFFFF */ andi $t7, $t8, 0xffff
/* 0CF9C4 803149C4 3C010800 */ lui $at, 0x800
/* 0CF9C8 803149C8 01E17025 */ or $t6, $t7, $at
/* 0CF9CC 803149CC 2401FFE0 */ li $at, -32
/* 0CF9D0 803149D0 26A3001F */ addiu $v1, $s5, 0x1f
/* 0CF9D4 803149D4 0061C824 */ and $t9, $v1, $at
/* 0CF9D8 803149D8 272F0180 */ addiu $t7, $t9, 0x180
/* 0CF9DC 803149DC 03201825 */ move $v1, $t9
/* 0CF9E0 803149E0 AC4E0000 */ sw $t6, ($v0)
/* 0CF9E4 803149E4 00103040 */ sll $a2, $s0, 1
/* 0CF9E8 803149E8 30D9FFFF */ andi $t9, $a2, 0xffff
/* 0CF9EC 803149EC 000F7400 */ sll $t6, $t7, 0x10
/* 0CF9F0 803149F0 01D9C025 */ or $t8, $t6, $t9
/* 0CF9F4 803149F4 AC580004 */ sw $t8, 4($v0)
/* 0CF9F8 803149F8 8FAF0148 */ lw $t7, 0x148($sp)
/* 0CF9FC 803149FC 26940008 */ addiu $s4, $s4, 8
/* 0CFA00 80314A00 3C010100 */ lui $at, 0x100
/* 0CFA04 80314A04 31EE00FF */ andi $t6, $t7, 0xff
/* 0CFA08 80314A08 000ECC00 */ sll $t9, $t6, 0x10
/* 0CFA0C 80314A0C 0321C025 */ or $t8, $t9, $at
/* 0CFA10 80314A10 02802025 */ move $a0, $s4
/* 0CFA14 80314A14 AC980000 */ sw $t8, ($a0)
/* 0CFA18 80314A18 8EEF0034 */ lw $t7, 0x34($s7)
/* 0CFA1C 80314A1C 0012C840 */ sll $t9, $s2, 1
/* 0CFA20 80314A20 0079C021 */ addu $t8, $v1, $t9
/* 0CFA24 80314A24 01FF7021 */ addu $t6, $t7, $ra
/* 0CFA28 80314A28 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0CFA2C 80314A2C AC8E0004 */ sw $t6, 4($a0)
/* 0CFA30 80314A30 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0CFA34 80314A34 270F0180 */ addiu $t7, $t8, 0x180
/* 0CFA38 80314A38 01E17024 */ and $t6, $t7, $at
/* 0CFA3C 80314A3C 26940008 */ addiu $s4, $s4, 8
/* 0CFA40 80314A40 3C010A00 */ lui $at, 0xa00
/* 0CFA44 80314A44 01C1C825 */ or $t9, $t6, $at
/* 0CFA48 80314A48 02802825 */ move $a1, $s4
/* 0CFA4C 80314A4C ACB90000 */ sw $t9, ($a1)
/* 0CFA50 80314A50 0216C821 */ addu $t9, $s0, $s6
/* 0CFA54 80314A54 26AF0180 */ addiu $t7, $s5, 0x180
/* 0CFA58 80314A58 000F7400 */ sll $t6, $t7, 0x10
/* 0CFA5C 80314A5C 0333C023 */ subu $t8, $t9, $s3
/* 0CFA60 80314A60 00187840 */ sll $t7, $t8, 1
/* 0CFA64 80314A64 31F9FFFF */ andi $t9, $t7, 0xffff
/* 0CFA68 80314A68 01D9C025 */ or $t8, $t6, $t9
/* 0CFA6C 80314A6C ACB80004 */ sw $t8, 4($a1)
/* 0CFA70 80314A70 26940008 */ addiu $s4, $s4, 8
.L80314A74:
/* 0CFA74 80314A74 8FB90148 */ lw $t9, 0x148($sp)
/* 0CFA78 80314A78 03D07821 */ addu $t7, $fp, $s0
/* 0CFA7C 80314A7C 01F67021 */ addu $t6, $t7, $s6
/* 0CFA80 80314A80 24010001 */ li $at, 1
/* 0CFA84 80314A84 13210008 */ beq $t9, $at, .L80314AA8
/* 0CFA88 80314A88 01D3F023 */ subu $fp, $t6, $s3
/* 0CFA8C 80314A8C 3B220002 */ xori $v0, $t9, 2
/* 0CFA90 80314A90 0216C021 */ addu $t8, $s0, $s6
/* 0CFA94 80314A94 03131823 */ subu $v1, $t8, $s3
/* 0CFA98 80314A98 10400007 */ beqz $v0, .L80314AB8
/* 0CFA9C 80314A9C AFA00148 */ sw $zero, 0x148($sp)
/* 0CFAA0 80314AA0 10000008 */ b .L80314AC4
/* 0CFAA4 80314AA4 00037040 */ sll $t6, $v1, 1
.L80314AA8:
/* 0CFAA8 80314AA8 AFA00130 */ sw $zero, 0x130($sp)
/* 0CFAAC 80314AAC 02A6A821 */ addu $s5, $s5, $a2
/* 0CFAB0 80314AB0 1000000B */ b .L80314AE0
/* 0CFAB4 80314AB4 AFA00148 */ sw $zero, 0x148($sp)
.L80314AB8:
/* 0CFAB8 80314AB8 00037840 */ sll $t7, $v1, 1
/* 0CFABC 80314ABC 10000008 */ b .L80314AE0
/* 0CFAC0 80314AC0 02AFA821 */ addu $s5, $s5, $t7
.L80314AC4:
/* 0CFAC4 80314AC4 52A00004 */ beql $s5, $zero, .L80314AD8
/* 0CFAC8 80314AC8 0072A821 */ addu $s5, $v1, $s2
/* 0CFACC 80314ACC 10000004 */ b .L80314AE0
/* 0CFAD0 80314AD0 02AEA821 */ addu $s5, $s5, $t6
/* 0CFAD4 80314AD4 0072A821 */ addu $s5, $v1, $s2
.L80314AD8:
/* 0CFAD8 80314AD8 0015C840 */ sll $t9, $s5, 1
/* 0CFADC 80314ADC 0320A825 */ move $s5, $t9
.L80314AE0:
/* 0CFAE0 80314AE0 11400014 */ beqz $t2, .L80314B34
/* 0CFAE4 80314AE4 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0CFAE8 80314AE8 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0CFAEC 80314AEC 26B80180 */ addiu $t8, $s5, 0x180
/* 0CFAF0 80314AF0 03017824 */ and $t7, $t8, $at
/* 0CFAF4 80314AF4 3C010200 */ lui $at, 0x200
/* 0CFAF8 80314AF8 02801025 */ move $v0, $s4
/* 0CFAFC 80314AFC 01BEC823 */ subu $t9, $t5, $fp
/* 0CFB00 80314B00 0019C040 */ sll $t8, $t9, 1
/* 0CFB04 80314B04 01E17025 */ or $t6, $t7, $at
/* 0CFB08 80314B08 AC4E0000 */ sw $t6, ($v0)
/* 0CFB0C 80314B0C AC580004 */ sw $t8, 4($v0)
/* 0CFB10 80314B10 92EE0000 */ lbu $t6, ($s7)
/* 0CFB14 80314B14 26940008 */ addiu $s4, $s4, 8
/* 0CFB18 80314B18 AEE00014 */ sw $zero, 0x14($s7)
/* 0CFB1C 80314B1C 35D90010 */ ori $t9, $t6, 0x10
/* 0CFB20 80314B20 A2F90000 */ sb $t9, ($s7)
/* 0CFB24 80314B24 92F80000 */ lbu $t8, ($s7)
/* 0CFB28 80314B28 330FFF7F */ andi $t7, $t8, 0xff7f
/* 0CFB2C 80314B2C 1000000F */ b .L80314B6C
/* 0CFB30 80314B30 A2EF0000 */ sb $t7, ($s7)
.L80314B34:
/* 0CFB34 80314B34 51600009 */ beql $t3, $zero, .L80314B5C
/* 0CFB38 80314B38 8EF90014 */ lw $t9, 0x14($s7)
/* 0CFB3C 80314B3C 92F90000 */ lbu $t9, ($s7)
/* 0CFB40 80314B40 37380020 */ ori $t8, $t9, 0x20
/* 0CFB44 80314B44 A2F80000 */ sb $t8, ($s7)
/* 0CFB48 80314B48 8FAF0160 */ lw $t7, 0x160($sp)
/* 0CFB4C 80314B4C 8DEE0000 */ lw $t6, ($t7)
/* 0CFB50 80314B50 10000004 */ b .L80314B64
/* 0CFB54 80314B54 AEEE0014 */ sw $t6, 0x14($s7)
/* 0CFB58 80314B58 8EF90014 */ lw $t9, 0x14($s7)
.L80314B5C:
/* 0CFB5C 80314B5C 032CC021 */ addu $t8, $t9, $t4
/* 0CFB60 80314B60 AEF80014 */ sw $t8, 0x14($s7)
.L80314B64:
/* 0CFB64 80314B64 57CDFF03 */ bnel $fp, $t5, .L80314774
/* 0CFB68 80314B68 8EE90014 */ lw $t1, 0x14($s7)
.L80314B6C:
/* 0CFB6C 80314B6C 8FAF0054 */ lw $t7, 0x54($sp)
/* 0CFB70 80314B70 8FAE00E8 */ lw $t6, 0xe8($sp)
/* 0CFB74 80314B74 24010002 */ li $at, 2
/* 0CFB78 80314B78 15E00008 */ bnez $t7, .L80314B9C
/* 0CFB7C 80314B7C 8FB80130 */ lw $t8, 0x130($sp)
/* 0CFB80 80314B80 11C1000D */ beq $t6, $at, .L80314BB8
/* 0CFB84 80314B84 8FB900E4 */ lw $t9, 0xe4($sp)
/* 0CFB88 80314B88 8EE50000 */ lw $a1, ($s7)
/* 0CFB8C 80314B8C 000530C0 */ sll $a2, $a1, 3
/* 0CFB90 80314B90 0006CFC2 */ srl $t9, $a2, 0x1f
/* 0CFB94 80314B94 10000066 */ b .L80314D30
/* 0CFB98 80314B98 03203025 */ move $a2, $t9
.L80314B9C:
/* 0CFB9C 80314B9C 270F0180 */ addiu $t7, $t8, 0x180
/* 0CFBA0 80314BA0 A7AF00D6 */ sh $t7, 0xd6($sp)
/* 0CFBA4 80314BA4 8EE50000 */ lw $a1, ($s7)
/* 0CFBA8 80314BA8 000530C0 */ sll $a2, $a1, 3
/* 0CFBAC 80314BAC 000677C2 */ srl $t6, $a2, 0x1f
/* 0CFBB0 80314BB0 1000005F */ b .L80314D30
/* 0CFBB4 80314BB4 01C03025 */ move $a2, $t6
.L80314BB8:
/* 0CFBB8 80314BB8 13200009 */ beqz $t9, .L80314BE0
/* 0CFBBC 80314BBC 02801025 */ move $v0, $s4
/* 0CFBC0 80314BC0 24010001 */ li $at, 1
/* 0CFBC4 80314BC4 13210034 */ beq $t9, $at, .L80314C98
/* 0CFBC8 80314BC8 02801025 */ move $v0, $s4
/* 0CFBCC 80314BCC 8EE50000 */ lw $a1, ($s7)
/* 0CFBD0 80314BD0 000530C0 */ sll $a2, $a1, 3
/* 0CFBD4 80314BD4 0006C7C2 */ srl $t8, $a2, 0x1f
/* 0CFBD8 80314BD8 10000055 */ b .L80314D30
/* 0CFBDC 80314BDC 03003025 */ move $a2, $t8
.L80314BE0:
/* 0CFBE0 80314BE0 8FAF0130 */ lw $t7, 0x130($sp)
/* 0CFBE4 80314BE4 3C010800 */ lui $at, 0x800
/* 0CFBE8 80314BE8 25A30004 */ addiu $v1, $t5, 4
/* 0CFBEC 80314BEC 25EE0180 */ addiu $t6, $t7, 0x180
/* 0CFBF0 80314BF0 31D9FFFF */ andi $t9, $t6, 0xffff
/* 0CFBF4 80314BF4 0321C025 */ or $t8, $t9, $at
/* 0CFBF8 80314BF8 3C010020 */ lui $at, 0x20
/* 0CFBFC 80314BFC 306FFFFF */ andi $t7, $v1, 0xffff
/* 0CFC00 80314C00 01E17025 */ or $t6, $t7, $at
/* 0CFC04 80314C04 26940008 */ addiu $s4, $s4, 8
/* 0CFC08 80314C08 3C190501 */ lui $t9, (0x0501FF60 >> 16) # lui $t9, 0x501
/* 0CFC0C 80314C0C AC4E0004 */ sw $t6, 4($v0)
/* 0CFC10 80314C10 AC580000 */ sw $t8, ($v0)
/* 0CFC14 80314C14 3739FF60 */ ori $t9, (0x0501FF60 & 0xFFFF) # ori $t9, $t9, 0xff60
/* 0CFC18 80314C18 02802025 */ move $a0, $s4
/* 0CFC1C 80314C1C AC990000 */ sw $t9, ($a0)
/* 0CFC20 80314C20 8EF80034 */ lw $t8, 0x34($s7)
/* 0CFC24 80314C24 3C018000 */ lui $at, (0x800000F0 >> 16) # lui $at, 0x8000
/* 0CFC28 80314C28 342100F0 */ ori $at, (0x800000F0 & 0xFFFF) # ori $at, $at, 0xf0
/* 0CFC2C 80314C2C 03017821 */ addu $t7, $t8, $at
/* 0CFC30 80314C30 AC8F0004 */ sw $t7, 4($a0)
/* 0CFC34 80314C34 240E0024 */ li $t6, 36
/* 0CFC38 80314C38 AFA300D8 */ sw $v1, 0xd8($sp)
/* 0CFC3C 80314C3C A7AE00D6 */ sh $t6, 0xd6($sp)
/* 0CFC40 80314C40 8EE50000 */ lw $a1, ($s7)
/* 0CFC44 80314C44 26940008 */ addiu $s4, $s4, 8
/* 0CFC48 80314C48 02801025 */ move $v0, $s4
/* 0CFC4C 80314C4C 000530C0 */ sll $a2, $a1, 3
/* 0CFC50 80314C50 0006CFC2 */ srl $t9, $a2, 0x1f
/* 0CFC54 80314C54 13200036 */ beqz $t9, .L80314D30
/* 0CFC58 80314C58 03203025 */ move $a2, $t9
/* 0CFC5C 80314C5C 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0CFC60 80314C60 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0CFC64 80314C64 25B80024 */ addiu $t8, $t5, 0x24
/* 0CFC68 80314C68 03017824 */ and $t7, $t8, $at
/* 0CFC6C 80314C6C 3C010200 */ lui $at, 0x200
/* 0CFC70 80314C70 01E17025 */ or $t6, $t7, $at
/* 0CFC74 80314C74 25B90010 */ addiu $t9, $t5, 0x10
/* 0CFC78 80314C78 AC590004 */ sw $t9, 4($v0)
/* 0CFC7C 80314C7C AC4E0000 */ sw $t6, ($v0)
/* 0CFC80 80314C80 8EE50000 */ lw $a1, ($s7)
/* 0CFC84 80314C84 26940008 */ addiu $s4, $s4, 8
/* 0CFC88 80314C88 000530C0 */ sll $a2, $a1, 3
/* 0CFC8C 80314C8C 0006C7C2 */ srl $t8, $a2, 0x1f
/* 0CFC90 80314C90 10000027 */ b .L80314D30
/* 0CFC94 80314C94 03003025 */ move $a2, $t8
.L80314C98:
/* 0CFC98 80314C98 8FAF0130 */ lw $t7, 0x130($sp)
/* 0CFC9C 80314C9C 3C010800 */ lui $at, 0x800
/* 0CFCA0 80314CA0 26940008 */ addiu $s4, $s4, 8
/* 0CFCA4 80314CA4 25EE0180 */ addiu $t6, $t7, 0x180
/* 0CFCA8 80314CA8 31D9FFFF */ andi $t9, $t6, 0xffff
/* 0CFCAC 80314CAC 0321C025 */ or $t8, $t9, $at
/* 0CFCB0 80314CB0 25AF0008 */ addiu $t7, $t5, 8
/* 0CFCB4 80314CB4 31EEFFFF */ andi $t6, $t7, 0xffff
/* 0CFCB8 80314CB8 AC580000 */ sw $t8, ($v0)
/* 0CFCBC 80314CBC 3C010160 */ lui $at, 0x160
/* 0CFCC0 80314CC0 01C1C825 */ or $t9, $t6, $at
/* 0CFCC4 80314CC4 3C180501 */ lui $t8, (0x0501FF60 >> 16) # lui $t8, 0x501
/* 0CFCC8 80314CC8 AC590004 */ sw $t9, 4($v0)
/* 0CFCCC 80314CCC 3718FF60 */ ori $t8, (0x0501FF60 & 0xFFFF) # ori $t8, $t8, 0xff60
/* 0CFCD0 80314CD0 02801825 */ move $v1, $s4
/* 0CFCD4 80314CD4 AC780000 */ sw $t8, ($v1)
/* 0CFCD8 80314CD8 8EEF0034 */ lw $t7, 0x34($s7)
/* 0CFCDC 80314CDC 3C018000 */ lui $at, (0x800000F0 >> 16) # lui $at, 0x8000
/* 0CFCE0 80314CE0 342100F0 */ ori $at, (0x800000F0 & 0xFFFF) # ori $at, $at, 0xf0
/* 0CFCE4 80314CE4 26940008 */ addiu $s4, $s4, 8
/* 0CFCE8 80314CE8 3C190A00 */ lui $t9, (0x0A000164 >> 16) # lui $t9, 0xa00
/* 0CFCEC 80314CEC 01E17021 */ addu $t6, $t7, $at
/* 0CFCF0 80314CF0 AC6E0004 */ sw $t6, 4($v1)
/* 0CFCF4 80314CF4 37390164 */ ori $t9, (0x0A000164 & 0xFFFF) # ori $t9, $t9, 0x164
/* 0CFCF8 80314CF8 02802025 */ move $a0, $s4
/* 0CFCFC 80314CFC AC990000 */ sw $t9, ($a0)
/* 0CFD00 80314D00 8FB800D8 */ lw $t8, 0xd8($sp)
/* 0CFD04 80314D04 26940008 */ addiu $s4, $s4, 8
/* 0CFD08 80314D08 270E0020 */ addiu $t6, $t8, 0x20
/* 0CFD0C 80314D0C 25B80004 */ addiu $t8, $t5, 4
/* 0CFD10 80314D10 330FFFFF */ andi $t7, $t8, 0xffff
/* 0CFD14 80314D14 000ECC00 */ sll $t9, $t6, 0x10
/* 0CFD18 80314D18 032F7025 */ or $t6, $t9, $t7
/* 0CFD1C 80314D1C AC8E0004 */ sw $t6, 4($a0)
/* 0CFD20 80314D20 8EE50000 */ lw $a1, ($s7)
/* 0CFD24 80314D24 000530C0 */ sll $a2, $a1, 3
/* 0CFD28 80314D28 0006C7C2 */ srl $t8, $a2, 0x1f
/* 0CFD2C 80314D2C 03003025 */ move $a2, $t8
.L80314D30:
/* 0CFD30 80314D30 10C00003 */ beqz $a2, .L80314D40
/* 0CFD34 80314D34 8FA200E4 */ lw $v0, 0xe4($sp)
/* 0CFD38 80314D38 10000008 */ b .L80314D5C
/* 0CFD3C 80314D3C AFA00148 */ sw $zero, 0x148($sp)
.L80314D40:
/* 0CFD40 80314D40 8FB900E8 */ lw $t9, 0xe8($sp)
/* 0CFD44 80314D44 24420001 */ addiu $v0, $v0, 1
/* 0CFD48 80314D48 AFA200E4 */ sw $v0, 0xe4($sp)
/* 0CFD4C 80314D4C 5459FE5D */ bnel $v0, $t9, .L803146C4
/* 0CFD50 80314D50 8FA60164 */ lw $a2, 0x164($sp)
.L80314D54:
/* 0CFD54 80314D54 AFA00148 */ sw $zero, 0x148($sp)
/* 0CFD58 80314D58 8EE50000 */ lw $a1, ($s7)
.L80314D5C:
/* 0CFD5C 80314D5C 00057840 */ sll $t7, $a1, 1
/* 0CFD60 80314D60 000F77C2 */ srl $t6, $t7, 0x1f
/* 0CFD64 80314D64 24010001 */ li $at, 1
/* 0CFD68 80314D68 15C10006 */ bne $t6, $at, .L80314D84
/* 0CFD6C 80314D6C 02802025 */ move $a0, $s4
/* 0CFD70 80314D70 24180001 */ li $t8, 1
/* 0CFD74 80314D74 AFB80148 */ sw $t8, 0x148($sp)
/* 0CFD78 80314D78 92F90000 */ lbu $t9, ($s7)
/* 0CFD7C 80314D7C 332FFFBF */ andi $t7, $t9, 0xffbf
/* 0CFD80 80314D80 A2EF0000 */ sb $t7, ($s7)
.L80314D84:
/* 0CFD84 80314D84 8FB10048 */ lw $s1, 0x48($sp)
/* 0CFD88 80314D88 97AE00D6 */ lhu $t6, 0xd6($sp)
/* 0CFD8C 80314D8C 8FB80148 */ lw $t8, 0x148($sp)
/* 0CFD90 80314D90 02E02825 */ move $a1, $s7
/* 0CFD94 80314D94 97A7005E */ lhu $a3, 0x5e($sp)
/* 0CFD98 80314D98 02203025 */ move $a2, $s1
/* 0CFD9C 80314D9C AFAE0010 */ sw $t6, 0x10($sp)
/* 0CFDA0 80314DA0 0C0C53F5 */ jal final_resample
/* 0CFDA4 80314DA4 AFB80014 */ sw $t8, 0x14($sp)
/* 0CFDA8 80314DA8 96F9000C */ lhu $t9, 0xc($s7)
/* 0CFDAC 80314DAC 0040A025 */ move $s4, $v0
/* 0CFDB0 80314DB0 02802025 */ move $a0, $s4
/* 0CFDB4 80314DB4 17200004 */ bnez $t9, .L80314DC8
/* 0CFDB8 80314DB8 02E02825 */ move $a1, $s7
/* 0CFDBC 80314DBC 96EF0010 */ lhu $t7, 0x10($s7)
/* 0CFDC0 80314DC0 51E00004 */ beql $t7, $zero, .L80314DD4
/* 0CFDC4 80314DC4 96EE000E */ lhu $t6, 0xe($s7)
.L80314DC8:
/* 0CFDC8 80314DC8 1000000A */ b .L80314DF4
/* 0CFDCC 80314DCC 24100001 */ li $s0, 1
/* 0CFDD0 80314DD0 96EE000E */ lhu $t6, 0xe($s7)
.L80314DD4:
/* 0CFDD4 80314DD4 15C00005 */ bnez $t6, .L80314DEC
/* 0CFDD8 80314DD8 00000000 */ nop
/* 0CFDDC 80314DDC 96F80012 */ lhu $t8, 0x12($s7)
/* 0CFDE0 80314DE0 00008025 */ move $s0, $zero
/* 0CFDE4 80314DE4 13000003 */ beqz $t8, .L80314DF4
/* 0CFDE8 80314DE8 00000000 */ nop
.L80314DEC:
/* 0CFDEC 80314DEC 10000001 */ b .L80314DF4
/* 0CFDF0 80314DF0 24100002 */ li $s0, 2
.L80314DF4:
/* 0CFDF4 80314DF4 8FB90148 */ lw $t9, 0x148($sp)
/* 0CFDF8 80314DF8 8FA6017C */ lw $a2, 0x17c($sp)
/* 0CFDFC 80314DFC 00003825 */ move $a3, $zero
/* 0CFE00 80314E00 AFB00010 */ sw $s0, 0x10($sp)
/* 0CFE04 80314E04 0C0C540C */ jal process_envelope
/* 0CFE08 80314E08 AFB90014 */ sw $t9, 0x14($sp)
/* 0CFE0C 80314E0C 92EF0001 */ lbu $t7, 1($s7)
/* 0CFE10 80314E10 3C1F8000 */ lui $ra, 0x8000
/* 0CFE14 80314E14 0040A025 */ move $s4, $v0
/* 0CFE18 80314E18 11E00008 */ beqz $t7, .L80314E3C
/* 0CFE1C 80314E1C 00402025 */ move $a0, $v0
/* 0CFE20 80314E20 02E02825 */ move $a1, $s7
/* 0CFE24 80314E24 02203025 */ move $a2, $s1
/* 0CFE28 80314E28 8FA70148 */ lw $a3, 0x148($sp)
/* 0CFE2C 80314E2C 0C0C557D */ jal note_apply_headset_pan_effects
/* 0CFE30 80314E30 AFB00010 */ sw $s0, 0x10($sp)
/* 0CFE34 80314E34 3C1F8000 */ lui $ra, 0x8000
/* 0CFE38 80314E38 0040A025 */ move $s4, $v0
.L80314E3C:
/* 0CFE3C 80314E3C 8FAE0174 */ lw $t6, 0x174($sp)
.L80314E40:
/* 0CFE40 80314E40 8FB9006C */ lw $t9, 0x6c($sp)
/* 0CFE44 80314E44 25D80001 */ addiu $t8, $t6, 1
/* 0CFE48 80314E48 3C0E8022 */ lui $t6, %hi(gMaxSimultaneousNotes) # $t6, 0x8022
/* 0CFE4C 80314E4C 8DCE6D70 */ lw $t6, %lo(gMaxSimultaneousNotes)($t6)
/* 0CFE50 80314E50 272F00C0 */ addiu $t7, $t9, 0xc0
/* 0CFE54 80314E54 AFAF006C */ sw $t7, 0x6c($sp)
/* 0CFE58 80314E58 030E082A */ slt $at, $t8, $t6
/* 0CFE5C 80314E5C 1420FD9D */ bnez $at, .L803144D4
/* 0CFE60 80314E60 AFB80174 */ sw $t8, 0x174($sp)
.L80314E64:
/* 0CFE64 80314E64 3C080800 */ lui $t0, 0x800
/* 0CFE68 80314E68 02802025 */ move $a0, $s4
/* 0CFE6C 80314E6C AC880000 */ sw $t0, ($a0)
/* 0CFE70 80314E70 8FA3017C */ lw $v1, 0x17c($sp)
/* 0CFE74 80314E74 26940008 */ addiu $s4, $s4, 8
/* 0CFE78 80314E78 02802825 */ move $a1, $s4
/* 0CFE7C 80314E7C 0003C840 */ sll $t9, $v1, 1
/* 0CFE80 80314E80 332FFFFF */ andi $t7, $t9, 0xffff
/* 0CFE84 80314E84 AC8F0004 */ sw $t7, 4($a0)
/* 0CFE88 80314E88 26940008 */ addiu $s4, $s4, 8
/* 0CFE8C 80314E8C 3C180D00 */ lui $t8, 0xd00
/* 0CFE90 80314E90 3C0E04C0 */ lui $t6, (0x04C00600 >> 16) # lui $t6, 0x4c0
/* 0CFE94 80314E94 35CE0600 */ ori $t6, (0x04C00600 & 0xFFFF) # ori $t6, $t6, 0x600
/* 0CFE98 80314E98 ACB80000 */ sw $t8, ($a1)
/* 0CFE9C 80314E9C 02803025 */ move $a2, $s4
/* 0CFEA0 80314EA0 ACAE0004 */ sw $t6, 4($a1)
/* 0CFEA4 80314EA4 0019C840 */ sll $t9, $t9, 1
/* 0CFEA8 80314EA8 332FFFFF */ andi $t7, $t9, 0xffff
/* 0CFEAC 80314EAC 26940008 */ addiu $s4, $s4, 8
/* 0CFEB0 80314EB0 ACCF0004 */ sw $t7, 4($a2)
/* 0CFEB4 80314EB4 ACC80000 */ sw $t0, ($a2)
/* 0CFEB8 80314EB8 02803825 */ move $a3, $s4
/* 0CFEBC 80314EBC 3C180600 */ lui $t8, 0x600
/* 0CFEC0 80314EC0 ACF80000 */ sw $t8, ($a3)
/* 0CFEC4 80314EC4 8FAE0178 */ lw $t6, 0x178($sp)
/* 0CFEC8 80314EC8 3C1F8000 */ lui $ra, 0x8000
/* 0CFECC 80314ECC 26820008 */ addiu $v0, $s4, 8
/* 0CFED0 80314ED0 01DFC821 */ addu $t9, $t6, $ra
/* 0CFED4 80314ED4 ACF90004 */ sw $t9, 4($a3)
/* 0CFED8 80314ED8 8FBF0044 */ lw $ra, 0x44($sp)
/* 0CFEDC 80314EDC 8FBE0040 */ lw $fp, 0x40($sp)
/* 0CFEE0 80314EE0 8FB7003C */ lw $s7, 0x3c($sp)
/* 0CFEE4 80314EE4 8FB60038 */ lw $s6, 0x38($sp)
/* 0CFEE8 80314EE8 8FB50034 */ lw $s5, 0x34($sp)
/* 0CFEEC 80314EEC 8FB40030 */ lw $s4, 0x30($sp)
/* 0CFEF0 80314EF0 8FB3002C */ lw $s3, 0x2c($sp)
/* 0CFEF4 80314EF4 8FB20028 */ lw $s2, 0x28($sp)
/* 0CFEF8 80314EF8 8FB10024 */ lw $s1, 0x24($sp)
/* 0CFEFC 80314EFC 8FB00020 */ lw $s0, 0x20($sp)
/* 0CFF00 80314F00 03E00008 */ jr $ra
/* 0CFF04 80314F04 27BD0178 */ addiu $sp, $sp, 0x178

View File

@ -1,733 +0,0 @@
.late_rodata
glabel D_80337BB0
.word 0x3FFFFEB0, 0x3FFFFEB0
glabel D_80337BB8
.word 0x407FFEDA, 0x407FFEDA
.text
glabel synthesis_process_notes
/* 0D0590 80315590 27BDFE90 */ addiu $sp, $sp, -0x170
/* 0D0594 80315594 3C0E8022 */ lui $t6, %hi(gMaxSimultaneousNotes) # $t6, 0x8022
/* 0D0598 80315598 8DCE6B70 */ lw $t6, %lo(gMaxSimultaneousNotes)($t6)
/* 0D059C 8031559C AFB40030 */ sw $s4, 0x30($sp)
/* 0D05A0 803155A0 00C0A025 */ move $s4, $a2
/* 0D05A4 803155A4 AFBF0044 */ sw $ra, 0x44($sp)
/* 0D05A8 803155A8 AFBE0040 */ sw $fp, 0x40($sp)
/* 0D05AC 803155AC AFB7003C */ sw $s7, 0x3c($sp)
/* 0D05B0 803155B0 AFB60038 */ sw $s6, 0x38($sp)
/* 0D05B4 803155B4 AFB50034 */ sw $s5, 0x34($sp)
/* 0D05B8 803155B8 AFB3002C */ sw $s3, 0x2c($sp)
/* 0D05BC 803155BC AFB20028 */ sw $s2, 0x28($sp)
/* 0D05C0 803155C0 AFB10024 */ sw $s1, 0x24($sp)
/* 0D05C4 803155C4 AFB00020 */ sw $s0, 0x20($sp)
/* 0D05C8 803155C8 AFA40170 */ sw $a0, 0x170($sp)
/* 0D05CC 803155CC AFA50174 */ sw $a1, 0x174($sp)
/* 0D05D0 803155D0 AFA0016C */ sw $zero, 0x16c($sp)
/* 0D05D4 803155D4 19C00265 */ blez $t6, .L_US_80315F6C
/* 0D05D8 803155D8 AFA00154 */ sw $zero, 0x154($sp)
/* 0D05DC 803155DC AFA00064 */ sw $zero, 0x64($sp)
.L_US_803155E0:
/* 0D05E0 803155E0 3C188022 */ lui $t8, %hi(gNotes) # $t8, 0x8022
/* 0D05E4 803155E4 8F182610 */ lw $t8, %lo(gNotes)($t8)
/* 0D05E8 803155E8 8FAF0064 */ lw $t7, 0x64($sp)
/* 0D05EC 803155EC 01F8B821 */ addu $s7, $t7, $t8
/* 0D05F0 803155F0 8EF90000 */ lw $t9, ($s7)
/* 0D05F4 803155F4 001977C2 */ srl $t6, $t9, 0x1f
/* 0D05F8 803155F8 51C00010 */ beql $t6, $zero, .L_US_8031563C
/* 0D05FC 803155FC 8EF90000 */ lw $t9, ($s7)
/* 0D0600 80315600 92E20007 */ lbu $v0, 7($s7)
/* 0D0604 80315604 3C0F8022 */ lui $t7, %hi(gBankLoadStatus)
/* 0D0608 80315608 8FAE016C */ lw $t6, 0x16c($sp)
/* 0D060C 8031560C 01E27821 */ addu $t7, $t7, $v0
/* 0D0610 80315610 91EF14D0 */ lbu $t7, %lo(gBankLoadStatus)($t7)
/* 0D0614 80315614 3C010100 */ lui $at, 0x100
/* 0D0618 80315618 29F80002 */ slti $t8, $t7, 2
/* 0D061C 8031561C 13000006 */ beqz $t8, .L_US_80315638
/* 0D0620 80315620 0002CA00 */ sll $t9, $v0, 8
/* 0D0624 80315624 032E7821 */ addu $t7, $t9, $t6
/* 0D0628 80315628 01E1C021 */ addu $t8, $t7, $at
/* 0D062C 8031562C 3C018033 */ lui $at, %hi(gAudioErrorFlags) # $at, 0x8033
/* 0D0630 80315630 10000244 */ b .L_US_80315F44
/* 0D0634 80315634 AC382E50 */ sw $t8, %lo(gAudioErrorFlags)($at)
.L_US_80315638:
/* 0D0638 80315638 8EF90000 */ lw $t9, ($s7)
.L_US_8031563C:
/* 0D063C 8031563C 001977C2 */ srl $t6, $t9, 0x1f
/* 0D0640 80315640 51C00241 */ beql $t6, $zero, .L_US_80315F48
/* 0D0644 80315644 8FB9016C */ lw $t9, 0x16c($sp)
/* 0D0648 80315648 8FAF0174 */ lw $t7, 0x174($sp)
/* 0D064C 8031564C AFA00140 */ sw $zero, 0x140($sp)
/* 0D0650 80315650 24010001 */ li $at, 1
/* 0D0654 80315654 000FC040 */ sll $t8, $t7, 1
/* 0D0658 80315658 AFB80048 */ sw $t8, 0x48($sp)
/* 0D065C 8031565C 8EF90000 */ lw $t9, ($s7)
/* 0D0660 80315660 24180001 */ li $t8, 1
/* 0D0664 80315664 02802025 */ move $a0, $s4
/* 0D0668 80315668 00197040 */ sll $t6, $t9, 1
/* 0D066C 8031566C 000E7FC2 */ srl $t7, $t6, 0x1f
/* 0D0670 80315670 15E10004 */ bne $t7, $at, .L_US_80315684
/* 0D0674 80315674 02E02825 */ move $a1, $s7
/* 0D0678 80315678 AFB80140 */ sw $t8, 0x140($sp)
/* 0D067C 8031567C AEE00014 */ sw $zero, 0x14($s7)
/* 0D0680 80315680 A6E00020 */ sh $zero, 0x20($s7)
.L_US_80315684:
/* 0D0684 80315684 3C014000 */ li $at, 0x40000000 # 2.000000
/* 0D0688 80315688 44812000 */ mtc1 $at, $f4
/* 0D068C 8031568C C6E00038 */ lwc1 $f0, 0x38($s7)
/* 0D0690 80315690 3C018034 */ lui $at, %hi(D_80337BB8)
/* 0D0694 80315694 4604003C */ c.lt.s $f0, $f4
/* 0D0698 80315698 00000000 */ nop
/* 0D069C 8031569C 4500000E */ bc1f .L_US_803156D8
/* 0D06A0 803156A0 00000000 */ nop
/* 0D06A4 803156A4 3C018034 */ lui $at, %hi(D_80337BB0) # $at, 0x8034
/* 0D06A8 803156A8 C4268DA0 */ lwc1 $f6, %lo(D_80337BB0)($at)
/* 0D06AC 803156AC 24190001 */ li $t9, 1
/* 0D06B0 803156B0 AFB900E0 */ sw $t9, 0xe0($sp)
/* 0D06B4 803156B4 4600303C */ c.lt.s $f6, $f0
/* 0D06B8 803156B8 3C018034 */ lui $at, %hi(D_80337BB0 + 0x4) # $at, 0x8034
/* 0D06BC 803156BC 45000004 */ bc1f .L_US_803156D0
/* 0D06C0 803156C0 00000000 */ nop
/* 0D06C4 803156C4 C4288DA4 */ lwc1 $f8, %lo(D_80337BB0 + 0x4)($at)
/* 0D06C8 803156C8 E6E80038 */ swc1 $f8, 0x38($s7)
/* 0D06CC 803156CC C6E00038 */ lwc1 $f0, 0x38($s7)
.L_US_803156D0:
/* 0D06D0 803156D0 10000010 */ b .L_US_80315714
/* 0D06D4 803156D4 46000086 */ mov.s $f2, $f0
.L_US_803156D8:
/* 0D06D8 803156D8 C42A8DA8 */ lwc1 $f10, %lo(D_80337BB8)($at)
/* 0D06DC 803156DC 240E0002 */ li $t6, 2
/* 0D06E0 803156E0 AFAE00E0 */ sw $t6, 0xe0($sp)
/* 0D06E4 803156E4 4600503E */ c.le.s $f10, $f0
/* 0D06E8 803156E8 3C018034 */ lui $at, %hi(D_80337BB8)
/* 0D06EC 803156EC 45020005 */ bc1fl .L_US_80315704
/* 0D06F0 803156F0 3C013F00 */ lui $at, 0x3f00 # $at, 0x3f00
/* 0D06F4 803156F4 C4308DAC */ lwc1 $f16, %lo(D_80337BB8 + 0x4)($at)
/* 0D06F8 803156F8 E6F00038 */ swc1 $f16, 0x38($s7)
/* 0D06FC 803156FC C6E00038 */ lwc1 $f0, 0x38($s7)
/* 0D0700 80315700 3C013F00 */ li $at, 0x3F000000 # 0.500000
.L_US_80315704:
/* 0D0704 80315704 44819000 */ mtc1 $at, $f18
/* 0D0708 80315708 00000000 */ nop
/* 0D070C 8031570C 46120082 */ mul.s $f2, $f0, $f18
/* 0D0710 80315710 00000000 */ nop
.L_US_80315714:
/* 0D0714 80315714 3C014700 */ li $at, 0x47000000 # 32768.000000
/* 0D0718 80315718 44812000 */ mtc1 $at, $f4
/* 0D071C 8031571C 8FAE0174 */ lw $t6, 0x174($sp)
/* 0D0720 80315720 46041182 */ mul.s $f6, $f2, $f4
/* 0D0724 80315724 4600320D */ trunc.w.s $f8, $f6
/* 0D0728 80315728 44184000 */ mfc1 $t8, $f8
/* 0D072C 8031572C 00000000 */ nop
/* 0D0730 80315730 3319FFFF */ andi $t9, $t8, 0xffff
/* 0D0734 80315734 032E0019 */ multu $t9, $t6
/* 0D0738 80315738 AFB9005C */ sw $t9, 0x5c($sp)
/* 0D073C 8031573C 96F90020 */ lhu $t9, 0x20($s7)
/* 0D0740 80315740 8EE20024 */ lw $v0, 0x24($s7)
/* 0D0744 80315744 00007812 */ mflo $t7
/* 0D0748 80315748 000FC040 */ sll $t8, $t7, 1
/* 0D074C 8031574C 03381821 */ addu $v1, $t9, $t8
/* 0D0750 80315750 1440000E */ bnez $v0, .L_US_8031578C
/* 0D0754 80315754 A6E30020 */ sh $v1, 0x20($s7)
/* 0D0758 80315758 00038402 */ srl $s0, $v1, 0x10
/* 0D075C 8031575C 02003025 */ move $a2, $s0
/* 0D0760 80315760 0C0C5804 */ jal load_wave_samples
/* 0D0764 80315764 AFA00140 */ sw $zero, 0x140($sp)
/* 0D0768 80315768 8EE90014 */ lw $t1, 0x14($s7)
/* 0D076C 8031576C 0040A025 */ move $s4, $v0
/* 0D0770 80315770 00097840 */ sll $t7, $t1, 1
/* 0D0774 80315774 25F90180 */ addiu $t9, $t7, 0x180
/* 0D0778 80315778 A7B900CE */ sh $t9, 0xce($sp)
/* 0D077C 8031577C 0130C021 */ addu $t8, $t1, $s0
/* 0D0780 80315780 AEF80014 */ sw $t8, 0x14($s7)
/* 0D0784 80315784 100001B9 */ b .L_US_80315E6C
/* 0D0788 80315788 8EE50000 */ lw $a1, ($s7)
.L_US_8031578C:
/* 0D078C 8031578C 8C4E0000 */ lw $t6, ($v0)
/* 0D0790 80315790 00031402 */ srl $v0, $v1, 0x10
/* 0D0794 80315794 AFAE015C */ sw $t6, 0x15c($sp)
/* 0D0798 80315798 8DDF0008 */ lw $ra, 8($t6)
/* 0D079C 8031579C 8FF90004 */ lw $t9, 4($ra)
/* 0D07A0 803157A0 AFB90108 */ sw $t9, 0x108($sp)
/* 0D07A4 803157A4 8DD80004 */ lw $t8, 4($t6)
/* 0D07A8 803157A8 8FAE00E0 */ lw $t6, 0xe0($sp)
/* 0D07AC 803157AC AFA000D0 */ sw $zero, 0xd0($sp)
/* 0D07B0 803157B0 AFA000DC */ sw $zero, 0xdc($sp)
/* 0D07B4 803157B4 19C001AB */ blez $t6, .L_US_80315E64
/* 0D07B8 803157B8 AFB80118 */ sw $t8, 0x118($sp)
/* 0D07BC 803157BC 39D90001 */ xori $t9, $t6, 1
/* 0D07C0 803157C0 2F390001 */ sltiu $t9, $t9, 1
/* 0D07C4 803157C4 AFB90054 */ sw $t9, 0x54($sp)
/* 0D07C8 803157C8 AFA20058 */ sw $v0, 0x58($sp)
/* 0D07CC 803157CC 8FAF015C */ lw $t7, 0x15c($sp)
.L_US_803157D0:
/* 0D07D0 803157D0 8FB80054 */ lw $t8, 0x54($sp)
/* 0D07D4 803157D4 8FA20058 */ lw $v0, 0x58($sp)
/* 0D07D8 803157D8 8DE4000C */ lw $a0, 0xc($t7)
/* 0D07DC 803157DC 0000F025 */ move $fp, $zero
/* 0D07E0 803157E0 0000A825 */ move $s5, $zero
/* 0D07E4 803157E4 13000003 */ beqz $t8, .L_US_803157F4
/* 0D07E8 803157E8 24850008 */ addiu $a1, $a0, 8
/* 0D07EC 803157EC 1000000A */ b .L_US_80315818
/* 0D07F0 803157F0 00406825 */ move $t5, $v0
.L_US_803157F4:
/* 0D07F4 803157F4 304E0001 */ andi $t6, $v0, 1
/* 0D07F8 803157F8 11C00007 */ beqz $t6, .L_US_80315818
/* 0D07FC 803157FC 00406825 */ move $t5, $v0
/* 0D0800 80315800 8FAF00DC */ lw $t7, 0xdc($sp)
/* 0D0804 80315804 2401FFFE */ li $at, -2
/* 0D0808 80315808 0041C824 */ and $t9, $v0, $at
/* 0D080C 8031580C 000FC040 */ sll $t8, $t7, 1
/* 0D0810 80315810 10000001 */ b .L_US_80315818
/* 0D0814 80315814 03386821 */ addu $t5, $t9, $t8
.L_US_80315818:
/* 0D0818 80315818 8FAE0154 */ lw $t6, 0x154($sp)
/* 0D081C 8031581C AFA20058 */ sw $v0, 0x58($sp)
/* 0D0820 80315820 11C50013 */ beq $t6, $a1, .L_US_80315870
/* 0D0824 80315824 00000000 */ nop
/* 0D0828 80315828 AFA50154 */ sw $a1, 0x154($sp)
/* 0D082C 8031582C 8C990000 */ lw $t9, ($a0)
/* 0D0830 80315830 8C8F0004 */ lw $t7, 4($a0)
/* 0D0834 80315834 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0D0838 80315838 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0D083C 8031583C 01F90019 */ multu $t7, $t9
/* 0D0840 80315840 02801025 */ move $v0, $s4
/* 0D0844 80315844 26940008 */ addiu $s4, $s4, 8
/* 0D0848 80315848 00001812 */ mflo $v1
/* 0D084C 8031584C 0003C100 */ sll $t8, $v1, 4
/* 0D0850 80315850 03017024 */ and $t6, $t8, $at
/* 0D0854 80315854 3C010B00 */ lui $at, 0xb00
/* 0D0858 80315858 01C17825 */ or $t7, $t6, $at
/* 0D085C 8031585C AC4F0000 */ sw $t7, ($v0)
/* 0D0860 80315860 8FB90154 */ lw $t9, 0x154($sp)
/* 0D0864 80315864 3C018000 */ lui $at, 0x8000
/* 0D0868 80315868 0321C021 */ addu $t8, $t9, $at
/* 0D086C 8031586C AC580004 */ sw $t8, 4($v0)
.L_US_80315870:
/* 0D0870 80315870 11A00102 */ beqz $t5, .L_US_80315C7C
/* 0D0874 80315874 8FA20058 */ lw $v0, 0x58($sp)
/* 0D0878 80315878 AFA20058 */ sw $v0, 0x58($sp)
/* 0D087C 8031587C 8EE90014 */ lw $t1, 0x14($s7)
.L_US_80315880:
/* 0D0880 80315880 8FAE0108 */ lw $t6, 0x108($sp)
/* 0D0884 80315884 01BE2023 */ subu $a0, $t5, $fp
/* 0D0888 80315888 3132000F */ andi $s2, $t1, 0xf
/* 0D088C 8031588C 00005025 */ move $t2, $zero
/* 0D0890 80315890 00005825 */ move $t3, $zero
/* 0D0894 80315894 00806025 */ move $t4, $a0
/* 0D0898 80315898 16400006 */ bnez $s2, .L_US_803158B4
/* 0D089C 8031589C 01C91823 */ subu $v1, $t6, $t1
/* 0D08A0 803158A0 8EEF0000 */ lw $t7, ($s7)
/* 0D08A4 803158A4 000FC080 */ sll $t8, $t7, 2
/* 0D08A8 803158A8 07020003 */ bltzl $t8, .L_US_803158B8
/* 0D08AC 803158AC 240E0010 */ li $t6, 16
/* 0D08B0 803158B0 24120010 */ li $s2, 16
.L_US_803158B4:
/* 0D08B4 803158B4 240E0010 */ li $t6, 16
.L_US_803158B8:
/* 0D08B8 803158B8 01D22823 */ subu $a1, $t6, $s2
/* 0D08BC 803158BC 0083082A */ slt $at, $a0, $v1
/* 0D08C0 803158C0 1020000C */ beqz $at, .L_US_803158F4
/* 0D08C4 803158C4 00A0B025 */ move $s6, $a1
/* 0D08C8 803158C8 00851023 */ subu $v0, $a0, $a1
/* 0D08CC 803158CC 2442000F */ addiu $v0, $v0, 0xf
/* 0D08D0 803158D0 04410003 */ bgez $v0, .L_US_803158E0
/* 0D08D4 803158D4 00027903 */ sra $t7, $v0, 4
/* 0D08D8 803158D8 2441000F */ addiu $at, $v0, 0xf
/* 0D08DC 803158DC 00017903 */ sra $t7, $at, 4
.L_US_803158E0:
/* 0D08E0 803158E0 000F8100 */ sll $s0, $t7, 4
/* 0D08E4 803158E4 00B0C821 */ addu $t9, $a1, $s0
/* 0D08E8 803158E8 01E04025 */ move $t0, $t7
/* 0D08EC 803158EC 10000012 */ b .L_US_80315938
/* 0D08F0 803158F0 03249823 */ subu $s3, $t9, $a0
.L_US_803158F4:
/* 0D08F4 803158F4 00721021 */ addu $v0, $v1, $s2
/* 0D08F8 803158F8 2450FFF0 */ addiu $s0, $v0, -0x10
/* 0D08FC 803158FC 1E000003 */ bgtz $s0, .L_US_8031590C
/* 0D0900 80315900 00009825 */ move $s3, $zero
/* 0D0904 80315904 00008025 */ move $s0, $zero
/* 0D0908 80315908 0060B025 */ move $s6, $v1
.L_US_8031590C:
/* 0D090C 8031590C 2608000F */ addiu $t0, $s0, 0xf
/* 0D0910 80315910 8FEE0008 */ lw $t6, 8($ra)
/* 0D0914 80315914 05010003 */ bgez $t0, .L_US_80315924
/* 0D0918 80315918 0008C103 */ sra $t8, $t0, 4
/* 0D091C 8031591C 2501000F */ addiu $at, $t0, 0xf
/* 0D0920 80315920 0001C103 */ sra $t8, $at, 4
.L_US_80315924:
/* 0D0924 80315924 11C00003 */ beqz $t6, .L_US_80315934
/* 0D0928 80315928 03004025 */ move $t0, $t8
/* 0D092C 8031592C 10000002 */ b .L_US_80315938
/* 0D0930 80315930 240B0001 */ li $t3, 1
.L_US_80315934:
/* 0D0934 80315934 240A0001 */ li $t2, 1
.L_US_80315938:
/* 0D0938 80315938 11000032 */ beqz $t0, .L_US_80315A04
/* 0D093C 8031593C 24030009 */ li $v1, 9
/* 0D0940 80315940 01321023 */ subu $v0, $t1, $s2
/* 0D0944 80315944 24420010 */ addiu $v0, $v0, 0x10
/* 0D0948 80315948 04410003 */ bgez $v0, .L_US_80315958
/* 0D094C 8031594C 00027903 */ sra $t7, $v0, 4
/* 0D0950 80315950 2441000F */ addiu $at, $v0, 0xf
/* 0D0954 80315954 00017903 */ sra $t7, $at, 4
.L_US_80315958:
/* 0D0958 80315958 01E30019 */ multu $t7, $v1
/* 0D095C 8031595C 8FB80118 */ lw $t8, 0x118($sp)
/* 0D0960 80315960 AFBF0158 */ sw $ra, 0x158($sp)
/* 0D0964 80315964 8FA60140 */ lw $a2, 0x140($sp)
/* 0D0968 80315968 26E70003 */ addiu $a3, $s7, 3
/* 0D096C 8031596C AFAA0148 */ sw $t2, 0x148($sp)
/* 0D0970 80315970 AFAB0144 */ sw $t3, 0x144($sp)
/* 0D0974 80315974 AFAC0104 */ sw $t4, 0x104($sp)
/* 0D0978 80315978 AFAD0110 */ sw $t5, 0x110($sp)
/* 0D097C 8031597C 0000C812 */ mflo $t9
/* 0D0980 80315980 03382021 */ addu $a0, $t9, $t8
/* 0D0984 80315984 00000000 */ nop
/* 0D0988 80315988 01030019 */ multu $t0, $v1
/* 0D098C 8031598C 00008812 */ mflo $s1
/* 0D0990 80315990 02202825 */ move $a1, $s1
/* 0D0994 80315994 0C0C60C0 */ jal dma_sample_data
/* 0D0998 80315998 00000000 */ nop
/* 0D099C 8031599C 3047000F */ andi $a3, $v0, 0xf
/* 0D09A0 803159A0 02802025 */ move $a0, $s4
/* 0D09A4 803159A4 3C0E0800 */ lui $t6, (0x080003F0 >> 16) # lui $t6, 0x800
/* 0D09A8 803159A8 8FAA0148 */ lw $t2, 0x148($sp)
/* 0D09AC 803159AC 8FAB0144 */ lw $t3, 0x144($sp)
/* 0D09B0 803159B0 8FAC0104 */ lw $t4, 0x104($sp)
/* 0D09B4 803159B4 8FAD0110 */ lw $t5, 0x110($sp)
/* 0D09B8 803159B8 8FBF0158 */ lw $ra, 0x158($sp)
/* 0D09BC 803159BC 35CE03F0 */ ori $t6, (0x080003F0 & 0xFFFF) # ori $t6, $t6, 0x3f0
/* 0D09C0 803159C0 02277821 */ addu $t7, $s1, $a3
/* 0D09C4 803159C4 31F9FFFF */ andi $t9, $t7, 0xffff
/* 0D09C8 803159C8 AC8E0000 */ sw $t6, ($a0)
/* 0D09CC 803159CC 26940008 */ addiu $s4, $s4, 8
/* 0D09D0 803159D0 AC990004 */ sw $t9, 4($a0)
/* 0D09D4 803159D4 02802825 */ move $a1, $s4
/* 0D09D8 803159D8 00477023 */ subu $t6, $v0, $a3
/* 0D09DC 803159DC 3C018000 */ lui $at, 0x8000
/* 0D09E0 803159E0 01C17821 */ addu $t7, $t6, $at
/* 0D09E4 803159E4 3C180400 */ lui $t8, 0x400
/* 0D09E8 803159E8 ACB80000 */ sw $t8, ($a1)
/* 0D09EC 803159EC ACAF0004 */ sw $t7, 4($a1)
/* 0D09F0 803159F0 8EE60000 */ lw $a2, ($s7)
/* 0D09F4 803159F4 26940008 */ addiu $s4, $s4, 8
/* 0D09F8 803159F8 0006C880 */ sll $t9, $a2, 2
/* 0D09FC 803159FC 10000006 */ b .L_US_80315A18
/* 0D0A00 80315A00 001937C2 */ srl $a2, $t9, 0x1f
.L_US_80315A04:
/* 0D0A04 80315A04 8EE60000 */ lw $a2, ($s7)
/* 0D0A08 80315A08 00008025 */ move $s0, $zero
/* 0D0A0C 80315A0C 00003825 */ move $a3, $zero
/* 0D0A10 80315A10 00067080 */ sll $t6, $a2, 2
/* 0D0A14 80315A14 000E37C2 */ srl $a2, $t6, 0x1f
.L_US_80315A18:
/* 0D0A18 80315A18 10C0000F */ beqz $a2, .L_US_80315A58
/* 0D0A1C 80315A1C 02801025 */ move $v0, $s4
/* 0D0A20 80315A20 3C190F00 */ lui $t9, 0xf00
/* 0D0A24 80315A24 AC590000 */ sw $t9, ($v0)
/* 0D0A28 80315A28 8FB8015C */ lw $t8, 0x15c($sp)
/* 0D0A2C 80315A2C 3C018000 */ lui $at, (0x80000010 >> 16) # lui $at, 0x8000
/* 0D0A30 80315A30 34210010 */ ori $at, (0x80000010 & 0xFFFF) # ori $at, $at, 0x10
/* 0D0A34 80315A34 8F0E0008 */ lw $t6, 8($t8)
/* 0D0A38 80315A38 24190002 */ li $t9, 2
/* 0D0A3C 80315A3C 26940008 */ addiu $s4, $s4, 8
/* 0D0A40 80315A40 01C17821 */ addu $t7, $t6, $at
/* 0D0A44 80315A44 AC4F0004 */ sw $t7, 4($v0)
/* 0D0A48 80315A48 AFB90140 */ sw $t9, 0x140($sp)
/* 0D0A4C 80315A4C 92F80000 */ lbu $t8, ($s7)
/* 0D0A50 80315A50 330EFFDF */ andi $t6, $t8, 0xffdf
/* 0D0A54 80315A54 A2EE0000 */ sb $t6, ($s7)
.L_US_80315A58:
/* 0D0A58 80315A58 17C0001C */ bnez $fp, .L_US_80315ACC
/* 0D0A5C 80315A5C 02801025 */ move $v0, $s4
/* 0D0A60 80315A60 24EF03F0 */ addiu $t7, $a3, 0x3f0
/* 0D0A64 80315A64 31F9FFFF */ andi $t9, $t7, 0xffff
/* 0D0A68 80315A68 3C010800 */ lui $at, 0x800
/* 0D0A6C 80315A6C 0321C025 */ or $t8, $t9, $at
/* 0D0A70 80315A70 00103040 */ sll $a2, $s0, 1
/* 0D0A74 80315A74 30CEFFFF */ andi $t6, $a2, 0xffff
/* 0D0A78 80315A78 3C010180 */ lui $at, 0x180
/* 0D0A7C 80315A7C 02801025 */ move $v0, $s4
/* 0D0A80 80315A80 01C17825 */ or $t7, $t6, $at
/* 0D0A84 80315A84 AC4F0004 */ sw $t7, 4($v0)
/* 0D0A88 80315A88 AC580000 */ sw $t8, ($v0)
/* 0D0A8C 80315A8C 8FB90140 */ lw $t9, 0x140($sp)
/* 0D0A90 80315A90 26940008 */ addiu $s4, $s4, 8
/* 0D0A94 80315A94 3C010100 */ lui $at, 0x100
/* 0D0A98 80315A98 333800FF */ andi $t8, $t9, 0xff
/* 0D0A9C 80315A9C 00187400 */ sll $t6, $t8, 0x10
/* 0D0AA0 80315AA0 01C17825 */ or $t7, $t6, $at
/* 0D0AA4 80315AA4 02801825 */ move $v1, $s4
/* 0D0AA8 80315AA8 AC6F0000 */ sw $t7, ($v1)
/* 0D0AAC 80315AAC 8EF90034 */ lw $t9, 0x34($s7)
/* 0D0AB0 80315AB0 3C018000 */ lui $at, 0x8000
/* 0D0AB4 80315AB4 00127040 */ sll $t6, $s2, 1
/* 0D0AB8 80315AB8 0321C021 */ addu $t8, $t9, $at
/* 0D0ABC 80315ABC AC780004 */ sw $t8, 4($v1)
/* 0D0AC0 80315AC0 26940008 */ addiu $s4, $s4, 8
/* 0D0AC4 80315AC4 10000030 */ b .L_US_80315B88
/* 0D0AC8 80315AC8 AFAE0128 */ sw $t6, 0x128($sp)
.L_US_80315ACC:
/* 0D0ACC 80315ACC 24EF03F0 */ addiu $t7, $a3, 0x3f0
/* 0D0AD0 80315AD0 31F9FFFF */ andi $t9, $t7, 0xffff
/* 0D0AD4 80315AD4 3C010800 */ lui $at, 0x800
/* 0D0AD8 80315AD8 0321C025 */ or $t8, $t9, $at
/* 0D0ADC 80315ADC 2401FFE0 */ li $at, -32
/* 0D0AE0 80315AE0 26A3001F */ addiu $v1, $s5, 0x1f
/* 0D0AE4 80315AE4 00617024 */ and $t6, $v1, $at
/* 0D0AE8 80315AE8 25D90180 */ addiu $t9, $t6, 0x180
/* 0D0AEC 80315AEC 01C01825 */ move $v1, $t6
/* 0D0AF0 80315AF0 AC580000 */ sw $t8, ($v0)
/* 0D0AF4 80315AF4 00103040 */ sll $a2, $s0, 1
/* 0D0AF8 80315AF8 30CEFFFF */ andi $t6, $a2, 0xffff
/* 0D0AFC 80315AFC 0019C400 */ sll $t8, $t9, 0x10
/* 0D0B00 80315B00 030E7825 */ or $t7, $t8, $t6
/* 0D0B04 80315B04 AC4F0004 */ sw $t7, 4($v0)
/* 0D0B08 80315B08 8FB90140 */ lw $t9, 0x140($sp)
/* 0D0B0C 80315B0C 26940008 */ addiu $s4, $s4, 8
/* 0D0B10 80315B10 3C010100 */ lui $at, 0x100
/* 0D0B14 80315B14 333800FF */ andi $t8, $t9, 0xff
/* 0D0B18 80315B18 00187400 */ sll $t6, $t8, 0x10
/* 0D0B1C 80315B1C 01C17825 */ or $t7, $t6, $at
/* 0D0B20 80315B20 02802025 */ move $a0, $s4
/* 0D0B24 80315B24 AC8F0000 */ sw $t7, ($a0)
/* 0D0B28 80315B28 8EF90034 */ lw $t9, 0x34($s7)
/* 0D0B2C 80315B2C 3C018000 */ lui $at, 0x8000
/* 0D0B30 80315B30 00127040 */ sll $t6, $s2, 1
/* 0D0B34 80315B34 0321C021 */ addu $t8, $t9, $at
/* 0D0B38 80315B38 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0D0B3C 80315B3C 006E7821 */ addu $t7, $v1, $t6
/* 0D0B40 80315B40 AC980004 */ sw $t8, 4($a0)
/* 0D0B44 80315B44 25F90180 */ addiu $t9, $t7, 0x180
/* 0D0B48 80315B48 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0D0B4C 80315B4C 0321C024 */ and $t8, $t9, $at
/* 0D0B50 80315B50 26940008 */ addiu $s4, $s4, 8
/* 0D0B54 80315B54 3C010A00 */ lui $at, 0xa00
/* 0D0B58 80315B58 03017025 */ or $t6, $t8, $at
/* 0D0B5C 80315B5C 02802825 */ move $a1, $s4
/* 0D0B60 80315B60 ACAE0000 */ sw $t6, ($a1)
/* 0D0B64 80315B64 02167021 */ addu $t6, $s0, $s6
/* 0D0B68 80315B68 26B90180 */ addiu $t9, $s5, 0x180
/* 0D0B6C 80315B6C 0019C400 */ sll $t8, $t9, 0x10
/* 0D0B70 80315B70 01D37823 */ subu $t7, $t6, $s3
/* 0D0B74 80315B74 000FC840 */ sll $t9, $t7, 1
/* 0D0B78 80315B78 332EFFFF */ andi $t6, $t9, 0xffff
/* 0D0B7C 80315B7C 030E7825 */ or $t7, $t8, $t6
/* 0D0B80 80315B80 ACAF0004 */ sw $t7, 4($a1)
/* 0D0B84 80315B84 26940008 */ addiu $s4, $s4, 8
.L_US_80315B88:
/* 0D0B88 80315B88 8FAE0140 */ lw $t6, 0x140($sp)
/* 0D0B8C 80315B8C 03D0C821 */ addu $t9, $fp, $s0
/* 0D0B90 80315B90 0336C021 */ addu $t8, $t9, $s6
/* 0D0B94 80315B94 24010001 */ li $at, 1
/* 0D0B98 80315B98 11C10008 */ beq $t6, $at, .L_US_80315BBC
/* 0D0B9C 80315B9C 0313F023 */ subu $fp, $t8, $s3
/* 0D0BA0 80315BA0 39C20002 */ xori $v0, $t6, 2
/* 0D0BA4 80315BA4 02167821 */ addu $t7, $s0, $s6
/* 0D0BA8 80315BA8 01F31823 */ subu $v1, $t7, $s3
/* 0D0BAC 80315BAC 10400007 */ beqz $v0, .L_US_80315BCC
/* 0D0BB0 80315BB0 AFA00140 */ sw $zero, 0x140($sp)
/* 0D0BB4 80315BB4 10000008 */ b .L_US_80315BD8
/* 0D0BB8 80315BB8 0003C040 */ sll $t8, $v1, 1
.L_US_80315BBC:
/* 0D0BBC 80315BBC AFA00128 */ sw $zero, 0x128($sp)
/* 0D0BC0 80315BC0 02A6A821 */ addu $s5, $s5, $a2
/* 0D0BC4 80315BC4 1000000B */ b .L_US_80315BF4
/* 0D0BC8 80315BC8 AFA00140 */ sw $zero, 0x140($sp)
.L_US_80315BCC:
/* 0D0BCC 80315BCC 0003C840 */ sll $t9, $v1, 1
/* 0D0BD0 80315BD0 10000008 */ b .L_US_80315BF4
/* 0D0BD4 80315BD4 02B9A821 */ addu $s5, $s5, $t9
.L_US_80315BD8:
/* 0D0BD8 80315BD8 52A00004 */ beql $s5, $zero, .L_US_80315BEC
/* 0D0BDC 80315BDC 0072A821 */ addu $s5, $v1, $s2
/* 0D0BE0 80315BE0 10000004 */ b .L_US_80315BF4
/* 0D0BE4 80315BE4 02B8A821 */ addu $s5, $s5, $t8
/* 0D0BE8 80315BE8 0072A821 */ addu $s5, $v1, $s2
.L_US_80315BEC:
/* 0D0BEC 80315BEC 00157040 */ sll $t6, $s5, 1
/* 0D0BF0 80315BF0 01C0A825 */ move $s5, $t6
.L_US_80315BF4:
/* 0D0BF4 80315BF4 11400014 */ beqz $t2, .L_US_80315C48
/* 0D0BF8 80315BF8 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0D0BFC 80315BFC 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0D0C00 80315C00 26AF0180 */ addiu $t7, $s5, 0x180
/* 0D0C04 80315C04 01E1C824 */ and $t9, $t7, $at
/* 0D0C08 80315C08 3C010200 */ lui $at, 0x200
/* 0D0C0C 80315C0C 02801025 */ move $v0, $s4
/* 0D0C10 80315C10 01BE7023 */ subu $t6, $t5, $fp
/* 0D0C14 80315C14 000E7840 */ sll $t7, $t6, 1
/* 0D0C18 80315C18 0321C025 */ or $t8, $t9, $at
/* 0D0C1C 80315C1C AC580000 */ sw $t8, ($v0)
/* 0D0C20 80315C20 AC4F0004 */ sw $t7, 4($v0)
/* 0D0C24 80315C24 92F80000 */ lbu $t8, ($s7)
/* 0D0C28 80315C28 26940008 */ addiu $s4, $s4, 8
/* 0D0C2C 80315C2C AEE00014 */ sw $zero, 0x14($s7)
/* 0D0C30 80315C30 370E0010 */ ori $t6, $t8, 0x10
/* 0D0C34 80315C34 A2EE0000 */ sb $t6, ($s7)
/* 0D0C38 80315C38 92EF0000 */ lbu $t7, ($s7)
/* 0D0C3C 80315C3C 31F9FF7F */ andi $t9, $t7, 0xff7f
/* 0D0C40 80315C40 1000000E */ b .L_US_80315C7C
/* 0D0C44 80315C44 A2F90000 */ sb $t9, ($s7)
.L_US_80315C48:
/* 0D0C48 80315C48 51600008 */ beql $t3, $zero, .L_US_80315C6C
/* 0D0C4C 80315C4C 8EF80014 */ lw $t8, 0x14($s7)
/* 0D0C50 80315C50 92EE0000 */ lbu $t6, ($s7)
/* 0D0C54 80315C54 35CF0020 */ ori $t7, $t6, 0x20
/* 0D0C58 80315C58 A2EF0000 */ sb $t7, ($s7)
/* 0D0C5C 80315C5C 8FF90000 */ lw $t9, ($ra)
/* 0D0C60 80315C60 10000004 */ b .L_US_80315C74
/* 0D0C64 80315C64 AEF90014 */ sw $t9, 0x14($s7)
/* 0D0C68 80315C68 8EF80014 */ lw $t8, 0x14($s7)
.L_US_80315C6C:
/* 0D0C6C 80315C6C 030C7021 */ addu $t6, $t8, $t4
/* 0D0C70 80315C70 AEEE0014 */ sw $t6, 0x14($s7)
.L_US_80315C74:
/* 0D0C74 80315C74 57CDFF02 */ bnel $fp, $t5, .L_US_80315880
/* 0D0C78 80315C78 8EE90014 */ lw $t1, 0x14($s7)
.L_US_80315C7C:
/* 0D0C7C 80315C7C 8FAF0054 */ lw $t7, 0x54($sp)
/* 0D0C80 80315C80 8FB900E0 */ lw $t9, 0xe0($sp)
/* 0D0C84 80315C84 24010002 */ li $at, 2
/* 0D0C88 80315C88 15E00008 */ bnez $t7, .L_US_80315CAC
/* 0D0C8C 80315C8C 8FAE0128 */ lw $t6, 0x128($sp)
/* 0D0C90 80315C90 1321000D */ beq $t9, $at, .L_US_80315CC8
/* 0D0C94 80315C94 8FB800DC */ lw $t8, 0xdc($sp)
/* 0D0C98 80315C98 8EE50000 */ lw $a1, ($s7)
/* 0D0C9C 80315C9C 000530C0 */ sll $a2, $a1, 3
/* 0D0CA0 80315CA0 0006C7C2 */ srl $t8, $a2, 0x1f
/* 0D0CA4 80315CA4 10000066 */ b .L_US_80315E40
/* 0D0CA8 80315CA8 03003025 */ move $a2, $t8
.L_US_80315CAC:
/* 0D0CAC 80315CAC 25CF0180 */ addiu $t7, $t6, 0x180
/* 0D0CB0 80315CB0 A7AF00CE */ sh $t7, 0xce($sp)
/* 0D0CB4 80315CB4 8EE50000 */ lw $a1, ($s7)
/* 0D0CB8 80315CB8 000530C0 */ sll $a2, $a1, 3
/* 0D0CBC 80315CBC 0006CFC2 */ srl $t9, $a2, 0x1f
/* 0D0CC0 80315CC0 1000005F */ b .L_US_80315E40
/* 0D0CC4 80315CC4 03203025 */ move $a2, $t9
.L_US_80315CC8:
/* 0D0CC8 80315CC8 13000009 */ beqz $t8, .L_US_80315CF0
/* 0D0CCC 80315CCC 02801025 */ move $v0, $s4
/* 0D0CD0 80315CD0 24010001 */ li $at, 1
/* 0D0CD4 80315CD4 13010034 */ beq $t8, $at, .L_US_80315DA8
/* 0D0CD8 80315CD8 02801025 */ move $v0, $s4
/* 0D0CDC 80315CDC 8EE50000 */ lw $a1, ($s7)
/* 0D0CE0 80315CE0 000530C0 */ sll $a2, $a1, 3
/* 0D0CE4 80315CE4 000677C2 */ srl $t6, $a2, 0x1f
/* 0D0CE8 80315CE8 10000055 */ b .L_US_80315E40
/* 0D0CEC 80315CEC 01C03025 */ move $a2, $t6
.L_US_80315CF0:
/* 0D0CF0 80315CF0 8FAF0128 */ lw $t7, 0x128($sp)
/* 0D0CF4 80315CF4 3C010800 */ lui $at, 0x800
/* 0D0CF8 80315CF8 25A30004 */ addiu $v1, $t5, 4
/* 0D0CFC 80315CFC 25F90180 */ addiu $t9, $t7, 0x180
/* 0D0D00 80315D00 3338FFFF */ andi $t8, $t9, 0xffff
/* 0D0D04 80315D04 03017025 */ or $t6, $t8, $at
/* 0D0D08 80315D08 3C010020 */ lui $at, 0x20
/* 0D0D0C 80315D0C 306FFFFF */ andi $t7, $v1, 0xffff
/* 0D0D10 80315D10 01E1C825 */ or $t9, $t7, $at
/* 0D0D14 80315D14 26940008 */ addiu $s4, $s4, 8
/* 0D0D18 80315D18 3C180501 */ lui $t8, (0x0501FF60 >> 16) # lui $t8, 0x501
/* 0D0D1C 80315D1C AC590004 */ sw $t9, 4($v0)
/* 0D0D20 80315D20 AC4E0000 */ sw $t6, ($v0)
/* 0D0D24 80315D24 3718FF60 */ ori $t8, (0x0501FF60 & 0xFFFF) # ori $t8, $t8, 0xff60
/* 0D0D28 80315D28 02802025 */ move $a0, $s4
/* 0D0D2C 80315D2C AC980000 */ sw $t8, ($a0)
/* 0D0D30 80315D30 8EEE0034 */ lw $t6, 0x34($s7)
/* 0D0D34 80315D34 3C018000 */ lui $at, (0x800000F0 >> 16) # lui $at, 0x8000
/* 0D0D38 80315D38 342100F0 */ ori $at, (0x800000F0 & 0xFFFF) # ori $at, $at, 0xf0
/* 0D0D3C 80315D3C 01C17821 */ addu $t7, $t6, $at
/* 0D0D40 80315D40 AC8F0004 */ sw $t7, 4($a0)
/* 0D0D44 80315D44 24190024 */ li $t9, 36
/* 0D0D48 80315D48 AFA300D0 */ sw $v1, 0xd0($sp)
/* 0D0D4C 80315D4C A7B900CE */ sh $t9, 0xce($sp)
/* 0D0D50 80315D50 8EE50000 */ lw $a1, ($s7)
/* 0D0D54 80315D54 26940008 */ addiu $s4, $s4, 8
/* 0D0D58 80315D58 02801025 */ move $v0, $s4
/* 0D0D5C 80315D5C 000530C0 */ sll $a2, $a1, 3
/* 0D0D60 80315D60 0006C7C2 */ srl $t8, $a2, 0x1f
/* 0D0D64 80315D64 13000036 */ beqz $t8, .L_US_80315E40
/* 0D0D68 80315D68 03003025 */ move $a2, $t8
/* 0D0D6C 80315D6C 3C0100FF */ lui $at, (0x00FFFFFF >> 16) # lui $at, 0xff
/* 0D0D70 80315D70 3421FFFF */ ori $at, (0x00FFFFFF & 0xFFFF) # ori $at, $at, 0xffff
/* 0D0D74 80315D74 25AE0024 */ addiu $t6, $t5, 0x24
/* 0D0D78 80315D78 01C17824 */ and $t7, $t6, $at
/* 0D0D7C 80315D7C 3C010200 */ lui $at, 0x200
/* 0D0D80 80315D80 01E1C825 */ or $t9, $t7, $at
/* 0D0D84 80315D84 25B80010 */ addiu $t8, $t5, 0x10
/* 0D0D88 80315D88 AC580004 */ sw $t8, 4($v0)
/* 0D0D8C 80315D8C AC590000 */ sw $t9, ($v0)
/* 0D0D90 80315D90 8EE50000 */ lw $a1, ($s7)
/* 0D0D94 80315D94 26940008 */ addiu $s4, $s4, 8
/* 0D0D98 80315D98 000530C0 */ sll $a2, $a1, 3
/* 0D0D9C 80315D9C 000677C2 */ srl $t6, $a2, 0x1f
/* 0D0DA0 80315DA0 10000027 */ b .L_US_80315E40
/* 0D0DA4 80315DA4 01C03025 */ move $a2, $t6
.L_US_80315DA8:
/* 0D0DA8 80315DA8 8FAF0128 */ lw $t7, 0x128($sp)
/* 0D0DAC 80315DAC 3C010800 */ lui $at, 0x800
/* 0D0DB0 80315DB0 26940008 */ addiu $s4, $s4, 8
/* 0D0DB4 80315DB4 25F90180 */ addiu $t9, $t7, 0x180
/* 0D0DB8 80315DB8 3338FFFF */ andi $t8, $t9, 0xffff
/* 0D0DBC 80315DBC 03017025 */ or $t6, $t8, $at
/* 0D0DC0 80315DC0 25AF0008 */ addiu $t7, $t5, 8
/* 0D0DC4 80315DC4 31F9FFFF */ andi $t9, $t7, 0xffff
/* 0D0DC8 80315DC8 AC4E0000 */ sw $t6, ($v0)
/* 0D0DCC 80315DCC 3C010160 */ lui $at, 0x160
/* 0D0DD0 80315DD0 0321C025 */ or $t8, $t9, $at
/* 0D0DD4 80315DD4 3C0E0501 */ lui $t6, (0x0501FF60 >> 16) # lui $t6, 0x501
/* 0D0DD8 80315DD8 AC580004 */ sw $t8, 4($v0)
/* 0D0DDC 80315DDC 35CEFF60 */ ori $t6, (0x0501FF60 & 0xFFFF) # ori $t6, $t6, 0xff60
/* 0D0DE0 80315DE0 02801825 */ move $v1, $s4
/* 0D0DE4 80315DE4 AC6E0000 */ sw $t6, ($v1)
/* 0D0DE8 80315DE8 8EEF0034 */ lw $t7, 0x34($s7)
/* 0D0DEC 80315DEC 3C018000 */ lui $at, (0x800000F0 >> 16) # lui $at, 0x8000
/* 0D0DF0 80315DF0 342100F0 */ ori $at, (0x800000F0 & 0xFFFF) # ori $at, $at, 0xf0
/* 0D0DF4 80315DF4 26940008 */ addiu $s4, $s4, 8
/* 0D0DF8 80315DF8 3C180A00 */ lui $t8, (0x0A000164 >> 16) # lui $t8, 0xa00
/* 0D0DFC 80315DFC 01E1C821 */ addu $t9, $t7, $at
/* 0D0E00 80315E00 AC790004 */ sw $t9, 4($v1)
/* 0D0E04 80315E04 37180164 */ ori $t8, (0x0A000164 & 0xFFFF) # ori $t8, $t8, 0x164
/* 0D0E08 80315E08 02802025 */ move $a0, $s4
/* 0D0E0C 80315E0C AC980000 */ sw $t8, ($a0)
/* 0D0E10 80315E10 8FAE00D0 */ lw $t6, 0xd0($sp)
/* 0D0E14 80315E14 26940008 */ addiu $s4, $s4, 8
/* 0D0E18 80315E18 25D90020 */ addiu $t9, $t6, 0x20
/* 0D0E1C 80315E1C 25AE0004 */ addiu $t6, $t5, 4
/* 0D0E20 80315E20 31CFFFFF */ andi $t7, $t6, 0xffff
/* 0D0E24 80315E24 0019C400 */ sll $t8, $t9, 0x10
/* 0D0E28 80315E28 030FC825 */ or $t9, $t8, $t7
/* 0D0E2C 80315E2C AC990004 */ sw $t9, 4($a0)
/* 0D0E30 80315E30 8EE50000 */ lw $a1, ($s7)
/* 0D0E34 80315E34 000530C0 */ sll $a2, $a1, 3
/* 0D0E38 80315E38 000677C2 */ srl $t6, $a2, 0x1f
/* 0D0E3C 80315E3C 01C03025 */ move $a2, $t6
.L_US_80315E40:
/* 0D0E40 80315E40 10C00003 */ beqz $a2, .L_US_80315E50
/* 0D0E44 80315E44 8FA200DC */ lw $v0, 0xdc($sp)
/* 0D0E48 80315E48 10000008 */ b .L_US_80315E6C
/* 0D0E4C 80315E4C AFA00140 */ sw $zero, 0x140($sp)
.L_US_80315E50:
/* 0D0E50 80315E50 8FB800E0 */ lw $t8, 0xe0($sp)
/* 0D0E54 80315E54 24420001 */ addiu $v0, $v0, 1
/* 0D0E58 80315E58 AFA200DC */ sw $v0, 0xdc($sp)
/* 0D0E5C 80315E5C 5458FE5C */ bnel $v0, $t8, .L_US_803157D0
/* 0D0E60 80315E60 8FAF015C */ lw $t7, 0x15c($sp)
.L_US_80315E64:
/* 0D0E64 80315E64 AFA00140 */ sw $zero, 0x140($sp)
/* 0D0E68 80315E68 8EE50000 */ lw $a1, ($s7)
.L_US_80315E6C:
/* 0D0E6C 80315E6C 00057840 */ sll $t7, $a1, 1
/* 0D0E70 80315E70 000FCFC2 */ srl $t9, $t7, 0x1f
/* 0D0E74 80315E74 24010001 */ li $at, 1
/* 0D0E78 80315E78 17210006 */ bne $t9, $at, .L_US_80315E94
/* 0D0E7C 80315E7C 02802025 */ move $a0, $s4
/* 0D0E80 80315E80 240E0001 */ li $t6, 1
/* 0D0E84 80315E84 AFAE0140 */ sw $t6, 0x140($sp)
/* 0D0E88 80315E88 92F80000 */ lbu $t8, ($s7)
/* 0D0E8C 80315E8C 330FFFBF */ andi $t7, $t8, 0xffbf
/* 0D0E90 80315E90 A2EF0000 */ sb $t7, ($s7)
.L_US_80315E94:
/* 0D0E94 80315E94 8FB10048 */ lw $s1, 0x48($sp)
/* 0D0E98 80315E98 97B900CE */ lhu $t9, 0xce($sp)
/* 0D0E9C 80315E9C 8FAE0140 */ lw $t6, 0x140($sp)
/* 0D0EA0 80315EA0 02E02825 */ move $a1, $s7
/* 0D0EA4 80315EA4 97A7005E */ lhu $a3, 0x5e($sp)
/* 0D0EA8 80315EA8 02203025 */ move $a2, $s1
/* 0D0EAC 80315EAC AFB90010 */ sw $t9, 0x10($sp)
/* 0D0EB0 80315EB0 0C0C5837 */ jal final_resample
/* 0D0EB4 80315EB4 AFAE0014 */ sw $t6, 0x14($sp)
/* 0D0EB8 80315EB8 96F8000C */ lhu $t8, 0xc($s7)
/* 0D0EBC 80315EBC 0040A025 */ move $s4, $v0
/* 0D0EC0 80315EC0 02802025 */ move $a0, $s4
/* 0D0EC4 80315EC4 17000004 */ bnez $t8, .L_US_80315ED8
/* 0D0EC8 80315EC8 02E02825 */ move $a1, $s7
/* 0D0ECC 80315ECC 96EF0010 */ lhu $t7, 0x10($s7)
/* 0D0ED0 80315ED0 51E00004 */ beql $t7, $zero, .L_US_80315EE4
/* 0D0ED4 80315ED4 96F9000E */ lhu $t9, 0xe($s7)
.L_US_80315ED8:
/* 0D0ED8 80315ED8 1000000A */ b .L_US_80315F04
/* 0D0EDC 80315EDC 24100001 */ li $s0, 1
/* 0D0EE0 80315EE0 96F9000E */ lhu $t9, 0xe($s7)
.L_US_80315EE4:
/* 0D0EE4 80315EE4 17200005 */ bnez $t9, .L_US_80315EFC
/* 0D0EE8 80315EE8 00000000 */ nop
/* 0D0EEC 80315EEC 96EE0012 */ lhu $t6, 0x12($s7)
/* 0D0EF0 80315EF0 00008025 */ move $s0, $zero
/* 0D0EF4 80315EF4 11C00003 */ beqz $t6, .L_US_80315F04
/* 0D0EF8 80315EF8 00000000 */ nop
.L_US_80315EFC:
/* 0D0EFC 80315EFC 10000001 */ b .L_US_80315F04
/* 0D0F00 80315F00 24100002 */ li $s0, 2
.L_US_80315F04:
/* 0D0F04 80315F04 8FB80140 */ lw $t8, 0x140($sp)
/* 0D0F08 80315F08 8FA60174 */ lw $a2, 0x174($sp)
/* 0D0F0C 80315F0C 00003825 */ move $a3, $zero
/* 0D0F10 80315F10 AFB00010 */ sw $s0, 0x10($sp)
/* 0D0F14 80315F14 0C0C584E */ jal process_envelope
/* 0D0F18 80315F18 AFB80014 */ sw $t8, 0x14($sp)
/* 0D0F1C 80315F1C 92EF0001 */ lbu $t7, 1($s7)
/* 0D0F20 80315F20 0040A025 */ move $s4, $v0
/* 0D0F24 80315F24 00402025 */ move $a0, $v0
/* 0D0F28 80315F28 11E00006 */ beqz $t7, .L_US_80315F44
/* 0D0F2C 80315F2C 02E02825 */ move $a1, $s7
/* 0D0F30 80315F30 02203025 */ move $a2, $s1
/* 0D0F34 80315F34 8FA70140 */ lw $a3, 0x140($sp)
/* 0D0F38 80315F38 0C0C59BF */ jal note_apply_headset_pan_effects
/* 0D0F3C 80315F3C AFB00010 */ sw $s0, 0x10($sp)
/* 0D0F40 80315F40 0040A025 */ move $s4, $v0
.L_US_80315F44:
/* 0D0F44 80315F44 8FB9016C */ lw $t9, 0x16c($sp)
.L_US_80315F48:
/* 0D0F48 80315F48 8FB80064 */ lw $t8, 0x64($sp)
/* 0D0F4C 80315F4C 272E0001 */ addiu $t6, $t9, 1
/* 0D0F50 80315F50 3C198022 */ lui $t9, %hi(gMaxSimultaneousNotes) # $t9, 0x8022
/* 0D0F54 80315F54 8F396B70 */ lw $t9, %lo(gMaxSimultaneousNotes)($t9)
/* 0D0F58 80315F58 270F00C0 */ addiu $t7, $t8, 0xc0
/* 0D0F5C 80315F5C AFAF0064 */ sw $t7, 0x64($sp)
/* 0D0F60 80315F60 01D9082A */ slt $at, $t6, $t9
/* 0D0F64 80315F64 1420FD9E */ bnez $at, .L_US_803155E0
/* 0D0F68 80315F68 AFAE016C */ sw $t6, 0x16c($sp)
.L_US_80315F6C:
/* 0D0F6C 80315F6C 3C080800 */ lui $t0, 0x800
/* 0D0F70 80315F70 02802025 */ move $a0, $s4
/* 0D0F74 80315F74 AC880000 */ sw $t0, ($a0)
/* 0D0F78 80315F78 8FA30174 */ lw $v1, 0x174($sp)
/* 0D0F7C 80315F7C 26940008 */ addiu $s4, $s4, 8
/* 0D0F80 80315F80 02802825 */ move $a1, $s4
/* 0D0F84 80315F84 0003C040 */ sll $t8, $v1, 1
/* 0D0F88 80315F88 330FFFFF */ andi $t7, $t8, 0xffff
/* 0D0F8C 80315F8C AC8F0004 */ sw $t7, 4($a0)
/* 0D0F90 80315F90 26940008 */ addiu $s4, $s4, 8
/* 0D0F94 80315F94 3C0E0D00 */ lui $t6, 0xd00
/* 0D0F98 80315F98 3C1904C0 */ lui $t9, (0x04C00600 >> 16) # lui $t9, 0x4c0
/* 0D0F9C 80315F9C 37390600 */ ori $t9, (0x04C00600 & 0xFFFF) # ori $t9, $t9, 0x600
/* 0D0FA0 80315FA0 ACAE0000 */ sw $t6, ($a1)
/* 0D0FA4 80315FA4 02803025 */ move $a2, $s4
/* 0D0FA8 80315FA8 ACB90004 */ sw $t9, 4($a1)
/* 0D0FAC 80315FAC 0018C040 */ sll $t8, $t8, 1
/* 0D0FB0 80315FB0 330FFFFF */ andi $t7, $t8, 0xffff
/* 0D0FB4 80315FB4 26940008 */ addiu $s4, $s4, 8
/* 0D0FB8 80315FB8 ACCF0004 */ sw $t7, 4($a2)
/* 0D0FBC 80315FBC ACC80000 */ sw $t0, ($a2)
/* 0D0FC0 80315FC0 02803825 */ move $a3, $s4
/* 0D0FC4 80315FC4 3C0E0600 */ lui $t6, 0x600
/* 0D0FC8 80315FC8 ACEE0000 */ sw $t6, ($a3)
/* 0D0FCC 80315FCC 8FB90170 */ lw $t9, 0x170($sp)
/* 0D0FD0 80315FD0 3C018000 */ lui $at, 0x8000
/* 0D0FD4 80315FD4 26820008 */ addiu $v0, $s4, 8
/* 0D0FD8 80315FD8 0321C021 */ addu $t8, $t9, $at
/* 0D0FDC 80315FDC ACF80004 */ sw $t8, 4($a3)
/* 0D0FE0 80315FE0 8FBF0044 */ lw $ra, 0x44($sp)
/* 0D0FE4 80315FE4 8FBE0040 */ lw $fp, 0x40($sp)
/* 0D0FE8 80315FE8 8FB7003C */ lw $s7, 0x3c($sp)
/* 0D0FEC 80315FEC 8FB60038 */ lw $s6, 0x38($sp)
/* 0D0FF0 80315FF0 8FB50034 */ lw $s5, 0x34($sp)
/* 0D0FF4 80315FF4 8FB40030 */ lw $s4, 0x30($sp)
/* 0D0FF8 80315FF8 8FB3002C */ lw $s3, 0x2c($sp)
/* 0D0FFC 80315FFC 8FB20028 */ lw $s2, 0x28($sp)
/* 0D1000 80316000 8FB10024 */ lw $s1, 0x24($sp)
/* 0D1004 80316004 8FB00020 */ lw $s0, 0x20($sp)
/* 0D1008 80316008 03E00008 */ jr $ra
/* 0D100C 8031600C 27BD0170 */ addiu $sp, $sp, 0x170

View File

@ -38,4 +38,9 @@
.ascii "P" /* PAL (Europe) */
.endif
.byte 0x00 /* Version */
.if VERSION_SH == 1
.byte 0x03 /* Version (Shindou) */
.else
.byte 0x00 /* Version */
.endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@ parser.add_argument('-m', '--make', dest='make', action='store_true',
help="Automatically run 'make' on the .o file or binary before diffing.")
parser.add_argument('-l', '--skip-lines', dest='skip_lines', type=int, default=0,
help="Skip the first N lines of output.")
parser.add_argument('-s', '--stop-jr-ra', dest='stop_jrra', action='store_true',
parser.add_argument('-f', '--stop-jr-ra', dest='stop_jrra', action='store_true',
help="Stop disassembling at the first 'jr ra'. Some functions have multiple return points, so use with care!")
parser.add_argument('-i', '--ignore-large-imms', dest='ignore_large_imms', action='store_true',
help="Pretend all large enough immediates are the same.")

View File

@ -8,6 +8,8 @@ def add_custom_arguments(parser):
help="Set version to US.")
group.add_argument('-e', dest='lang', action='store_const', const='eu',
help="Set version to EU.")
group.add_argument('-s', dest='lang', action='store_const', const='sh',
help="Set version to SH.")
def apply(config, args):
lang = args.lang or 'us'

View File

@ -2,15 +2,16 @@ diff --git a/src/game/area.c b/src/game/area.c
index 240605d8..88c1a314 100644
--- a/src/game/area.c
+++ b/src/game/area.c
@@ -19,6 +19,7 @@
@@ -19,7 +19,8 @@
#include "level_update.h"
#include "engine/geo_layout.h"
#include "save_file.h"
#include "level_table.h"
+#include "debug_box.h"
struct SpawnInfo gPlayerSpawnInfos[1];
struct GraphNode *D_8033A160[0x100];
@@ -352,6 +353,8 @@ void render_game(void) {
@@ -353,6 +354,8 @@ void render_game(void) {
if (gCurrentArea != NULL && !gWarpTransition.pauseRendering) {
geo_process_root(gCurrentArea->unk04, D_8032CE74, D_8032CE78, gFBSetColor);
@ -28,7 +29,7 @@ index 00000000..0ee87ec7
+#include <ultra64.h>
+
+#include "sm64.h"
+#include "game/game.h"
+#include "game/game_init.h"
+#include "game/geo_misc.h"
+#include "engine/math_util.h"
+

View File

@ -1,8 +1,8 @@
diff --git a/src/game/game.c b/src/game/game.c
index ad800839..4a37549b 100644
--- a/src/game/game.c
+++ b/src/game/game.c
@@ -52,6 +52,47 @@ struct DemoInput *gCurrDemoInput = NULL; // demo input sequence
diff --git a/src/game/game_init.c b/src/game/game_init.c
index 0852a141..18c5e8fe 100644
--- a/src/game/game_init.c
+++ b/src/game/game_init.c
@@ -56,6 +56,47 @@ struct DemoInput *gCurrDemoInput = NULL; // demo input sequence
u16 gDemoInputListID = 0;
struct DemoInput gRecordedDemoInput = { 0 }; // possibly removed in EU. TODO: Check
@ -47,10 +47,10 @@ index ad800839..4a37549b 100644
+ }
+}
+
// this function records distinct inputs over a 255-frame interval to RAM locations and was likely
// used to record the demo sequences seen in the final game. This function is unused.
static void record_demo(void) {
@@ -334,5 +375,7 @@ void thread5_game_loop(UNUSED void *arg) {
/**
* Initializes the Reality Display Processor (RDP).
* This function initializes settings such as texture filtering mode,
@@ -614,5 +655,7 @@ void thread5_game_loop(UNUSED void *arg) {
// amount of free space remaining.
print_text_fmt_int(180, 20, "BUF %d", gGfxPoolEnd - (u8 *) gDisplayListHead);
}

View File

@ -1,8 +1,8 @@
diff --git a/Makefile b/Makefile
index 26c76d3d..bfc8bb18 100644
index 88c8dbbe..f60df04f 100644
--- a/Makefile
+++ b/Makefile
@@ -341,6 +341,7 @@ $(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h
@@ -382,6 +382,7 @@ $(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h
$(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/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h
@ -11,7 +11,7 @@ index 26c76d3d..bfc8bb18 100644
################################################################
# TEXTURE GENERATION #
diff --git a/include/segments.h b/include/segments.h
index ccc989aa..e54c3eab 100644
index c98040a8..eeecb4f6 100644
--- a/include/segments.h
+++ b/include/segments.h
@@ -1,6 +1,9 @@
@ -25,7 +25,7 @@ index ccc989aa..e54c3eab 100644
* Memory addresses for segments. Ideally, this header file would not be
* needed, and the addresses would be defined in sm64.ld and linker-inserted
diff --git a/include/text_strings.h.in b/include/text_strings.h.in
index 2fda11d7..8ba0a1c9 100644
index 4e36eb96..7aadf0cb 100644
--- a/include/text_strings.h.in
+++ b/include/text_strings.h.in
@@ -25,6 +25,11 @@
@ -58,10 +58,10 @@ index 015eeb6b..cc010ca1 100644
+ JUMP(/*target*/ level_script_entry_error_screen),
+};
diff --git a/levels/intro/geo.c b/levels/intro/geo.c
index 7fbee0c5..e7effd85 100644
index 8ac70024..72766f3f 100644
--- a/levels/intro/geo.c
+++ b/levels/intro/geo.c
@@ -13,6 +13,24 @@
@@ -15,6 +15,24 @@
#include "levels/intro/header.h"
@ -100,7 +100,7 @@ index e0f6292d..8f77fb26 100644
+
#endif
diff --git a/levels/intro/script.c b/levels/intro/script.c
index 3ffd7859..b8c3ae41 100644
index 4975dbb2..5ee6c688 100644
--- a/levels/intro/script.c
+++ b/levels/intro/script.c
@@ -18,6 +18,21 @@
@ -137,18 +137,18 @@ index 89bfb4ed..0ea607c5 100644
#endif /* _LEVEL_SCRIPT_H */
diff --git a/src/game/main.c b/src/game/main.c
index f677f6f9..a164beb1 100644
index a3afffee..8b05fcf1 100644
--- a/src/game/main.c
+++ b/src/game/main.c
@@ -12,6 +12,7 @@
#include "buffers/buffers.h"
#include "segments.h"
#include "main.h"
#include "thread6.h"
+#include "mem_error_screen.h"
// Message IDs
#define MESG_SP_COMPLETE 100
@@ -125,6 +126,10 @@ void AllocPool(void) {
@@ -125,6 +126,10 @@ void alloc_pool(void) {
void *start = (void *) SEG_POOL_START;
void *end = (void *) SEG_POOL_END;
@ -159,7 +159,7 @@ index f677f6f9..a164beb1 100644
main_pool_init(start, end);
gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
}
@@ -314,7 +319,10 @@ void thread3_main(UNUSED void *arg) {
@@ -330,7 +335,10 @@ void thread3_main(UNUSED void *arg) {
create_thread(&gSoundThread, 4, thread4_sound, NULL, gThread4Stack + 0x2000, 20);
osStartThread(&gSoundThread);
@ -173,10 +173,10 @@ index f677f6f9..a164beb1 100644
while (1) {
diff --git a/src/game/mem_error_screen.c b/src/game/mem_error_screen.c
new file mode 100644
index 00000000..20eeef8f
index 00000000..81efaf91
--- /dev/null
+++ b/src/game/mem_error_screen.c
@@ -0,0 +1,105 @@
@@ -0,0 +1,104 @@
+/* clang-format off */
+/*
+ * mem_error_screen.inc.c
@ -189,9 +189,8 @@ index 00000000..20eeef8f
+#include <types.h>
+#include "segments.h"
+#include "text_strings.h"
+#include "game.h"
+#include "game_init.h"
+#include "main.h"
+#include "display.h"
+#include "print.h"
+#include "ingame_menu.h"
+#include "segment2.h"
@ -282,6 +281,7 @@ index 00000000..20eeef8f
+ display_and_vsync();
+ }
+}
\ No newline at end of file
diff --git a/src/game/mem_error_screen.h b/src/game/mem_error_screen.h
new file mode 100644
index 00000000..9fbff34c

View File

@ -1,10 +1,10 @@
diff --git a/src/game/game.c b/src/game/game.c
index ad800839..810e2ba3 100644
--- a/src/game/game.c
+++ b/src/game/game.c
@@ -52,6 +52,45 @@ struct DemoInput *gCurrDemoInput = NULL; // demo input sequence
u16 gDemoInputListID = 0;
struct DemoInput gRecordedDemoInput = { 0 }; // possibly removed in EU. TODO: Check
diff --git a/src/game/game_init.c b/src/game/game_init.c
index 0852a141..004941d8 100644
--- a/src/game/game_init.c
+++ b/src/game/game_init.c
@@ -332,6 +332,45 @@ void display_and_vsync(void) {
gGlobalTimer++;
}
+/*
+ * This enhancement allows you to record gameplay demos for the mario head screen.
@ -48,7 +48,7 @@ index ad800839..810e2ba3 100644
// this function records distinct inputs over a 255-frame interval to RAM locations and was likely
// used to record the demo sequences seen in the final game. This function is unused.
static void record_demo(void) {
@@ -85,6 +124,118 @@ static void record_demo(void) {
@@ -365,6 +404,118 @@ static void record_demo(void) {
gRecordedDemoInput.timer++;
}
@ -167,9 +167,9 @@ index ad800839..810e2ba3 100644
// take the updated controller struct and calculate
// the new x, y, and distance floats.
void adjust_analog_stick(struct Controller *controller) {
@@ -325,6 +476,7 @@ void thread5_game_loop(UNUSED void *arg) {
@@ -605,6 +756,7 @@ void thread5_game_loop(UNUSED void *arg) {
audio_game_loop_tick();
func_80247FAC();
config_gfx_pool();
read_controller_inputs();
+ recordingDemo();
addr = level_script_execute(addr);

View File

@ -74,7 +74,7 @@ def main():
clean_assets(local_asset_file)
sys.exit(0)
all_langs = ["jp", "us", "eu"]
all_langs = ["jp", "us", "eu", "sh"]
if not langs or not all(a in all_langs for a in langs):
langs_str = " ".join("[" + lang + "]" for lang in all_langs)
print("Usage: " + sys.argv[0] + " " + langs_str)

View File

@ -13,13 +13,15 @@ for arg in sys.argv[1:]:
lang = 'us'
elif arg == '-e':
lang = 'eu'
elif arg == '-s':
lang = 'sh'
else:
args.append(arg)
if lang is None:
lang = 'us'
best = 0
for path in ['build/us/sm64.us.z64', 'build/jp/sm64.jp.z64', 'build/eu/sm64.eu.z64']:
for path in ['build/us/sm64.us.z64', 'build/jp/sm64.jp.z64', 'build/eu/sm64.eu.z64', 'build/sh/sm64.sh.z64']:
try:
mtime = os.path.getmtime(path)
if mtime > best:
@ -187,7 +189,7 @@ if diffs > 100:
i = found_instr_diff
print("First instruction difference at ROM addr " + hex(i) + ", " + search_map(i))
print("Bytes:", hexbytes(mybin[i:i+4]), 'vs', hexbytes(basebin[i:i+4]))
if lang == 'eu':
if lang == 'sh':
print("Shifted ROM, as expected.")
else:
if not os.path.isfile(basemap):

View File

@ -18,13 +18,13 @@ extern const BehaviorScript bhvKingBobomb[];
extern const BehaviorScript bhvBobombAnchorMario[];
extern const BehaviorScript bhvBetaChestBottom[];
extern const BehaviorScript bhvBetaChestLid[];
extern const BehaviorScript bhvBubbleMario[];
extern const BehaviorScript bhvBubbleParticleSpawner[];
extern const BehaviorScript bhvBubbleMaybe[];
extern const BehaviorScript bhvSmallWaterWave[];
extern const BehaviorScript bhvSmallWaterWave398[];
extern const BehaviorScript bhvWaterAirBubble[];
extern const BehaviorScript bhvSmallParticle[];
extern const BehaviorScript bhvWaterWaves[];
extern const BehaviorScript bhvPlungeBubble[];
extern const BehaviorScript bhvSmallParticleSnow[];
extern const BehaviorScript bhvSmallParticleBubbles[];
extern const BehaviorScript bhvFishGroup[];
@ -64,11 +64,11 @@ extern const BehaviorScript bhvSingleCoinGetsSpawned[];
extern const BehaviorScript bhvCoinSparkles[];
extern const BehaviorScript bhvGoldenCoinSparkles[];
extern const BehaviorScript bhvWallTinyStarParticle[];
extern const BehaviorScript bhvWallTinyStarParticleSpawn[];
extern const BehaviorScript bhvVertStarParticleSpawner[];
extern const BehaviorScript bhvPoundTinyStarParticle[];
extern const BehaviorScript bhvPoundTinyStarParticleSpawn[];
extern const BehaviorScript bhvHorStarParticleSpawner[];
extern const BehaviorScript bhvPunchTinyTriangle[];
extern const BehaviorScript bhvPunchTinyTriangleSpawn[];
extern const BehaviorScript bhvTriangleParticleSpawner[];
extern const BehaviorScript bhvDoorWarp[];
extern const BehaviorScript bhvDoor[];
extern const BehaviorScript bhvGrindel[];
@ -83,14 +83,14 @@ extern const BehaviorScript bhvAnotherElavator[];
extern const BehaviorScript bhvRrElevatorPlatform[];
extern const BehaviorScript bhvHmcElevatorPlatform[];
extern const BehaviorScript bhvWaterMist[];
extern const BehaviorScript bhvWaterMistSpawn[];
extern const BehaviorScript bhvBreathParticleSpawner[];
extern const BehaviorScript bhvBreakBoxTriangle[];
extern const BehaviorScript bhvWaterMist2[];
extern const BehaviorScript bhvUnused0DFC[];
extern const BehaviorScript bhvPoundWhitePuffs[];
extern const BehaviorScript bhvGroundSand[];
extern const BehaviorScript bhvMistCircParticleSpawner[];
extern const BehaviorScript bhvDirtParticleSpawner[];
extern const BehaviorScript bhvUnused0E40[];
extern const BehaviorScript bhvGroundSnow[];
extern const BehaviorScript bhvSnowParticleSpawner[];
extern const BehaviorScript bhvWind[];
extern const BehaviorScript bhvEndToad[];
extern const BehaviorScript bhvEndPeach[];
@ -113,7 +113,7 @@ extern const BehaviorScript bhvFlamethrowerFlame[];
extern const BehaviorScript bhvBouncingFireball[];
extern const BehaviorScript bhvBouncingFireballFlame[];
extern const BehaviorScript bhvBowserShockWave[];
extern const BehaviorScript bhvFlameMario[];
extern const BehaviorScript bhvFireParticleSpawner[];
extern const BehaviorScript bhvBlackSmokeMario[];
extern const BehaviorScript bhvBlackSmokeBowser[];
extern const BehaviorScript bhvBlackSmokeUpward[];
@ -123,7 +123,7 @@ extern const BehaviorScript bhvTowerPlatformGroup[];
extern const BehaviorScript bhvWfSlidingTowerPlatform[];
extern const BehaviorScript bhvWfElevatorTowerPlatform[];
extern const BehaviorScript bhvWfSolidTowerPlatform[];
extern const BehaviorScript bhvSnowLeafParticleSpawn[];
extern const BehaviorScript bhvLeafParticleSpawner[];
extern const BehaviorScript bhvTreeSnow[];
extern const BehaviorScript bhvTreeLeaf[];
extern const BehaviorScript bhvAnotherTiltingPlatform[];
@ -235,7 +235,7 @@ extern const BehaviorScript bhvUnused243C[];
extern const BehaviorScript bhvSunkenShipPart2[];
extern const BehaviorScript bhvInSunkenShip[];
extern const BehaviorScript bhvInSunkenShip2[];
extern const BehaviorScript bhvMarioDustGenerator[];
extern const BehaviorScript bhvMistParticleSpawner[];
extern const BehaviorScript bhvWhitePuff1[];
extern const BehaviorScript bhvWhitePuff2[];
extern const BehaviorScript bhvWhitePuffSmoke2[];
@ -278,7 +278,7 @@ extern const BehaviorScript bhvFloorTrapInCastle[];
extern const BehaviorScript bhvTree[];
extern const BehaviorScript bhvSparkle[];
extern const BehaviorScript bhvSparkleSpawn[];
extern const BehaviorScript bhvSpecialTripleJumpSparkles[];
extern const BehaviorScript bhvSparkleParticleSpawner[];
extern const BehaviorScript bhvSomeGfx[];
extern const BehaviorScript bhvScuttlebug[];
extern const BehaviorScript bhvScuttlebugSpawn[];
@ -306,11 +306,11 @@ extern const BehaviorScript bhvWarps60[];
extern const BehaviorScript bhvWarps64[];
extern const BehaviorScript bhvWarps68[];
extern const BehaviorScript bhvWarps6C[];
extern const BehaviorScript bhvWarps70[];
extern const BehaviorScript bhvDeathWarp[];
extern const BehaviorScript bhvWarps74[];
extern const BehaviorScript bhvWarps78[];
extern const BehaviorScript bhvWarps7C[];
extern const BehaviorScript bhvWarps80[];
extern const BehaviorScript bhvPaintingDeathWarp[];
extern const BehaviorScript bhvWarps84[];
extern const BehaviorScript bhvWarps88[];
extern const BehaviorScript bhvWarps8C[];

View File

@ -10,16 +10,16 @@
// Bug Fixes
// --| US Version Nintendo Bug Fixes
/// 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)
#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)
/// 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)
#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
/// player exits their activation radius.
#define BUGFIX_PIRANHA_PLANT_STATE_RESET (0 || VERSION_US || VERSION_EU)
#define BUGFIX_PIRANHA_PLANT_STATE_RESET (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where sleeping Piranha Plants damage players that bump into them
#define BUGFIX_PIRANHA_PLANT_SLEEP_DAMAGE (0 || VERSION_US)
#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)

View File

@ -5,7 +5,6 @@
#include "game/shadow.h"
#include "game/object_helpers.h"
#include "game/object_helpers2.h"
#include "game/behavior_actions.h"
#include "game/segment2.h"
#include "game/mario_misc.h"

View File

@ -7,7 +7,7 @@
struct MacroPreset
{
/*0x00*/ const BehaviorScript *beh;
/*0x00*/ const BehaviorScript *behavior;
/*0x04*/ s16 model;
/*0x06*/ s16 param;
};

View File

@ -3,6 +3,10 @@
#include "platform_info.h"
#ifndef __sgi
#define GLOBAL_ASM(...)
#endif
#if !defined(__sgi) && (!defined(NON_MATCHING) || !defined(AVOID_UB))
// asm-process isn't supported outside of IDO, and undefined behavior causes
// crashes.

View File

@ -1,9 +1,10 @@
#ifndef MAKE_CONST_NONCONST_H
#define MAKE_CONST_NONCONST_H
#ifdef __sgi
#ifdef TARGET_N64
// IDO sometimes puts const variables in .rodata and sometimes in .data, which breaks ordering.
// This makes sure all variables are put into the same section (.data).
// This makes sure all variables are put into the same section (.data). We need to do this for
// both IDO and gcc for TARGET_N64.
#define const
#endif

View File

@ -32,14 +32,14 @@
#define OBJ_FLAG_MOVE_XZ_USING_FVEL (1 << 1) // 0x00000002
#define OBJ_FLAG_MOVE_Y_WITH_TERMINAL_VEL (1 << 2) // 0x00000004
#define OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW (1 << 3) // 0x00000008
#define OBJ_FLAG_0010 (1 << 4) // 0x00000010
#define OBJ_FLAG_SET_FACE_ANGLE_TO_MOVE_ANGLE (1 << 4) // 0x00000010
#define OBJ_FLAG_0020 (1 << 5) // 0x00000020
#define OBJ_FLAG_COMPUTE_DIST_TO_MARIO (1 << 6) // 0x00000040
#define OBJ_FLAG_ACTIVE_FROM_AFAR (1 << 7) // 0x00000080
#define OBJ_FLAG_0100 (1 << 8) // 0x00000100
#define OBJ_FLAG_TRANSFORM_RELATIVE_TO_PARENT (1 << 9) // 0x00000200
#define OBJ_FLAG_HOLDABLE (1 << 10) // 0x00000400
#define OBJ_FLAG_0800 (1 << 11) // 0x00000800
#define OBJ_FLAG_SET_THROW_MATRIX_FROM_TRANSFORM (1 << 11) // 0x00000800
#define OBJ_FLAG_1000 (1 << 12) // 0x00001000
#define OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO (1 << 13) // 0x00002000
#define OBJ_FLAG_PERSISTENT_RESPAWN (1 << 14) // 0x00004000
@ -106,26 +106,26 @@
OBJ_MOVE_UNDERWATER_ON_GROUND)
/* oActiveParticleFlags */
#define ACTIVE_PARTICLE_0 (1 << 0) // 0x00000001
#define ACTIVE_PARTICLE_DUST (1 << 0) // 0x00000001
#define ACTIVE_PARTICLE_UNUSED_1 (1 << 1) // 0x00000002
#define ACTIVE_PARTICLE_UNUSED_2 (1 << 2) // 0x00000004
#define ACTIVE_PARTICLE_3 (1 << 3) // 0x00000008
#define ACTIVE_PARTICLE_4 (1 << 4) // 0x00000010
#define ACTIVE_PARTICLE_5 (1 << 5) // 0x00000020
#define ACTIVE_PARTICLE_6 (1 << 6) // 0x00000040
#define ACTIVE_PARTICLE_SPARKLES (1 << 3) // 0x00000008
#define ACTIVE_PARTICLE_H_STAR (1 << 4) // 0x00000010
#define ACTIVE_PARTICLE_BUBBLE (1 << 5) // 0x00000020
#define ACTIVE_PARTICLE_WATER_SPLASH (1 << 6) // 0x00000040
#define ACTIVE_PARTICLE_IDLE_WATER_WAVE (1 << 7) // 0x00000080
#define ACTIVE_PARTICLE_SHALLOW_WATER_WAVE (1 << 8) // 0x00000100
#define ACTIVE_PARTICLE_9 (1 << 9) // 0x00000200
#define ACTIVE_PARTICLE_PLUNGE_BUBBLE (1 << 9) // 0x00000200
#define ACTIVE_PARTICLE_WAVE_TRAIL (1 << 10) // 0x00000400
#define ACTIVE_PARTICLE_11 (1 << 11) // 0x00000800
#define ACTIVE_PARTICLE_FIRE (1 << 11) // 0x00000800
#define ACTIVE_PARTICLE_SHALLOW_WATER_SPLASH (1 << 12) // 0x00001000
#define ACTIVE_PARTICLE_13 (1 << 13) // 0x00002000
#define ACTIVE_PARTICLE_14 (1 << 14) // 0x00004000
#define ACTIVE_PARTICLE_15 (1 << 15) // 0x00008000
#define ACTIVE_PARTICLE_16 (1 << 16) // 0x00010000
#define ACTIVE_PARTICLE_17 (1 << 17) // 0x00020000
#define ACTIVE_PARTICLE_18 (1 << 18) // 0x00040000
#define ACTIVE_PARTICLE_19 (1 << 19) // 0x00080000
#define ACTIVE_PARTICLE_LEAF (1 << 13) // 0x00002000
#define ACTIVE_PARTICLE_DIRT (1 << 14) // 0x00004000
#define ACTIVE_PARTICLE_MIST_CIRCLE (1 << 15) // 0x00008000
#define ACTIVE_PARTICLE_SNOW (1 << 16) // 0x00010000
#define ACTIVE_PARTICLE_BREATH (1 << 17) // 0x00020000
#define ACTIVE_PARTICLE_V_STAR (1 << 18) // 0x00040000
#define ACTIVE_PARTICLE_TRIANGLE (1 << 19) // 0x00080000
/* oAction */
#define OBJ_ACT_LAVA_DEATH 100

View File

@ -107,7 +107,7 @@
#define /*0x14C*/ oAction OBJECT_FIELD_S32(0x31)
#define /*0x150*/ oSubAction OBJECT_FIELD_S32(0x32)
#define /*0x154*/ oTimer OBJECT_FIELD_S32(0x33)
#define /*0x158*/ oBounce OBJECT_FIELD_F32(0x34)
#define /*0x158*/ oBounciness OBJECT_FIELD_F32(0x34)
#define /*0x15C*/ oDistanceToMario OBJECT_FIELD_F32(0x35)
#define /*0x160*/ oAngleToMario OBJECT_FIELD_S32(0x36)
#define /*0x164*/ oHomeX OBJECT_FIELD_F32(0x37)
@ -129,7 +129,7 @@
// 0x1A4 is unused, possibly related to 0x1A8 in removed macro purposes.
#define /*0x1A8*/ oUnk1A8 OBJECT_FIELD_U32(0x48)
// 0x1AC-0x1B2 (0x48-0x4A) are object specific and defined below the common fields.
#define /*0x1B4*/ oWallAngle OBJECT_FIELD_U32(0x4B)
#define /*0x1B4*/ oWallAngle OBJECT_FIELD_S32(0x4B)
#define /*0x1B8*/ oFloorType OBJECT_FIELD_S16(0x4C, 0)
#define /*0x1BA*/ oFloorRoom OBJECT_FIELD_S16(0x4C, 1)
#define /*0x1BC*/ oAngleToHome OBJECT_FIELD_S32(0x4D)

View File

@ -89,24 +89,24 @@
#define WATER_STEP_HIT_WALL 4
#define PARTICLE_DUST /* 0x00000001 */ (1 << 0)
#define PARTICLE_1 /* 0x00000002 */ (1 << 1)
#define PARTICLE_VERTICAL_STAR /* 0x00000002 */ (1 << 1)
#define PARTICLE_2 /* 0x00000004 */ (1 << 2)
#define PARTICLE_SPARKLES /* 0x00000008 */ (1 << 3)
#define PARTICLE_4 /* 0x00000010 */ (1 << 4)
#define PARTICLE_5 /* 0x00000020 */ (1 << 5)
#define PARTICLE_HORIZONTAL_STAR /* 0x00000010 */ (1 << 4)
#define PARTICLE_BUBBLE /* 0x00000020 */ (1 << 5)
#define PARTICLE_WATER_SPLASH /* 0x00000040 */ (1 << 6)
#define PARTICLE_IDLE_WATER_WAVE /* 0x00000080 */ (1 << 7)
#define PARTICLE_SHALLOW_WATER_WAVE /* 0x00000100 */ (1 << 8)
#define PARTICLE_9 /* 0x00000200 */ (1 << 9)
#define PARTICLE_PLUNGE_BUBBLE /* 0x00000200 */ (1 << 9)
#define PARTICLE_WAVE_TRAIL /* 0x00000400 */ (1 << 10)
#define PARTICLE_11 /* 0x00000800 */ (1 << 11)
#define PARTICLE_FIRE /* 0x00000800 */ (1 << 11)
#define PARTICLE_SHALLOW_WATER_SPLASH /* 0x00001000 */ (1 << 12)
#define PARTICLE_LEAVES /* 0x00002000 */ (1 << 13)
#define PARTICLE_14 /* 0x00004000 */ (1 << 14)
#define PARTICLE_15 /* 0x00008000 */ (1 << 15)
#define PARTICLE_16 /* 0x00010000 */ (1 << 16)
#define PARTICLE_17 /* 0x00020000 */ (1 << 17)
#define PARTICLE_18 /* 0x00040000 */ (1 << 18)
#define PARTICLE_LEAF /* 0x00002000 */ (1 << 13)
#define PARTICLE_SNOW /* 0x00004000 */ (1 << 14)
#define PARTICLE_DIRT /* 0x00008000 */ (1 << 15)
#define PARTICLE_MIST_CIRCLE /* 0x00010000 */ (1 << 16)
#define PARTICLE_BREATH /* 0x00020000 */ (1 << 17)
#define PARTICLE_TRIANGLE /* 0x00040000 */ (1 << 18)
#define PARTICLE_19 /* 0x00080000 */ (1 << 19)
#define MODEL_STATE_NOISE_ALPHA 0x180
@ -185,19 +185,19 @@
#define ACT_IN_QUICKSAND 0x0002020D // (0x00D | ACT_FLAG_STATIONARY | ACT_FLAG_INVULNERABLE)
#define ACT_CROUCHING 0x0C008220 // (0x020 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_START_CROUCHING 0x0C008221 // (0x021 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_UNKNOWN_022 0x0C008222 // (0x022 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_STOP_CROUCHING 0x0C008222 // (0x022 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_START_CRAWLING 0x0C008223 // (0x023 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_UNKNOWN_024 0x0C008224 // (0x024 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_STOP_CRAWLING 0x0C008224 // (0x024 | ACT_FLAG_STATIONARY | ACT_FLAG_SHORT_HITBOX | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_SLIDE_KICK_SLIDE_STOP 0x08000225 // (0x025 | ACT_FLAG_STATIONARY | ACT_FLAG_PAUSE_EXIT)
#define ACT_UNKNOWN_026 0x00020226 // (0x026 | ACT_FLAG_STATIONARY | ACT_FLAG_INVULNERABLE)
#define ACT_SHOCKWAVE_BOUNCE 0x00020226 // (0x026 | ACT_FLAG_STATIONARY | ACT_FLAG_INVULNERABLE)
#define ACT_FIRST_PERSON 0x0C000227 // (0x027 | ACT_FLAG_STATIONARY | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_BACKFLIP_LAND_STOP 0x0800022F // (0x02F | ACT_FLAG_STATIONARY | ACT_FLAG_PAUSE_EXIT)
#define ACT_JUMP_LAND_STOP 0x0C000230 // (0x030 | ACT_FLAG_STATIONARY | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_DOUBLE_JUMP_LAND_STOP 0x0C000231 // (0x031 | ACT_FLAG_STATIONARY | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_FREEFALL_LAND_STOP 0x0C000232 // (0x032 | ACT_FLAG_STATIONARY | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_SIDE_FLIP_LAND_STOP 0x0C000233 // (0x033 | ACT_FLAG_STATIONARY | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_UNKNOWN_034 0x08000234 // (0x034 | ACT_FLAG_STATIONARY | ACT_FLAG_PAUSE_EXIT)
#define ACT_UNKNOWN_035 0x08000235 // (0x035 | ACT_FLAG_STATIONARY | ACT_FLAG_PAUSE_EXIT)
#define ACT_HOLD_JUMP_LAND_STOP 0x08000234 // (0x034 | ACT_FLAG_STATIONARY | ACT_FLAG_PAUSE_EXIT)
#define ACT_HOLD_FREEFALL_LAND_STOP 0x08000235 // (0x035 | ACT_FLAG_STATIONARY | ACT_FLAG_PAUSE_EXIT)
#define ACT_AIR_THROW_LAND 0x80000A36 // (0x036 | ACT_FLAG_STATIONARY | ACT_FLAG_AIR | ACT_FLAG_THROWING)
#define ACT_TWIRL_LAND 0x18800238 // (0x038 | ACT_FLAG_STATIONARY | ACT_FLAG_ATTACKING | ACT_FLAG_PAUSE_EXIT | ACT_FLAG_SWIMMING_OR_FLYING)
#define ACT_LAVA_BOOST_LAND 0x08000239 // (0x039 | ACT_FLAG_STATIONARY | ACT_FLAG_PAUSE_EXIT)
@ -206,7 +206,7 @@
#define ACT_GROUND_POUND_LAND 0x0080023C // (0x03C | ACT_FLAG_STATIONARY | ACT_FLAG_ATTACKING)
#define ACT_BRAKING_STOP 0x0C00023D // (0x03D | ACT_FLAG_STATIONARY | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_BUTT_SLIDE_STOP 0x0C00023E // (0x03E | ACT_FLAG_STATIONARY | ACT_FLAG_ALLOW_FIRST_PERSON | ACT_FLAG_PAUSE_EXIT)
#define ACT_UNKNOWN_03F 0x0800043F // (0x03F | ACT_FLAG_MOVING | ACT_FLAG_PAUSE_EXIT)
#define ACT_HOLD_BUTT_SLIDE_STOP 0x0800043F // (0x03F | ACT_FLAG_MOVING | ACT_FLAG_PAUSE_EXIT)
// group 0x040: moving (ground) actions
#define ACT_WALKING 0x04000440 // (0x040 | ACT_FLAG_MOVING | ACT_FLAG_ALLOW_FIRST_PERSON)

View File

@ -30,6 +30,9 @@ struct Controller
/*0x12*/ u16 buttonPressed;
/*0x14*/ OSContStatus *statusData;
/*0x18*/ OSContPad *controllerData;
#ifdef VERSION_SH
/*0x1C*/ int port;
#endif
};
typedef f32 Vec2f[2];
@ -185,10 +188,10 @@ struct Object
} ptrData;
#endif
/*0x1C8*/ u32 unused1;
/*0x1CC*/ const BehaviorScript *behScript;
/*0x1D0*/ u32 stackIndex;
/*0x1D4*/ uintptr_t stack[8];
/*0x1F4*/ s16 unk1F4;
/*0x1CC*/ const BehaviorScript *curBhvCommand;
/*0x1D0*/ u32 bhvStackIndex;
/*0x1D4*/ uintptr_t bhvStack[8];
/*0x1F4*/ s16 bhvDelayTimer;
/*0x1F6*/ s16 respawnInfoType;
/*0x1F8*/ f32 hitboxRadius;
/*0x1FC*/ f32 hitboxHeight;

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/bbh/header.h"
#include "levels/bbh/staircase_step/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/bitdw/header.h"
#include "levels/bitdw/areas/1/starting_platform/geo.inc.c"

View File

@ -89,7 +89,7 @@ const LevelScript level_bitdw_entry[] = {
AREA(/*index*/ 1, geo_bitdw_000618),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -7443, -2153, 3886, /*angle*/ 0, 90, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps64),
OBJECT(/*model*/ MODEL_BITDW_WARP_PIPE, /*pos*/ 6816, 2860, -7, /*angle*/ 0, 0, 0, /*behParam*/ 0x000B0000, /*beh*/ bhvWarpPipe),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5910, 3500, -7, /*angle*/ 0, 90, 0, /*behParam*/ 0x000C0000, /*beh*/ bhvWarps70),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5910, 3500, -7, /*angle*/ 0, 90, 0, /*behParam*/ 0x000C0000, /*beh*/ bhvDeathWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BITDW, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0B, /*destLevel*/ LEVEL_BOWSER_1, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0C, /*destLevel*/ LEVEL_BITDW, /*destArea*/ 0x01, /*destNode*/ 0x0C, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/bitfs/header.h"
#include "levels/bitfs/areas/1/2/geo.inc.c"

View File

@ -102,7 +102,7 @@ const LevelScript level_bitfs_entry[] = {
AREA(/*index*/ 1, bitfs_geo_0007A0),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -7577, -1764, 0, /*angle*/ 0, 90, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps64),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 6735, 3681, 99, /*angle*/ 0, 0, 0, /*behParam*/ 0x140B0000, /*beh*/ bhvWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5886, 5000, 99, /*angle*/ 0, 90, 0, /*behParam*/ 0x000C0000, /*beh*/ bhvWarps70),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5886, 5000, 99, /*angle*/ 0, 90, 0, /*behParam*/ 0x000C0000, /*beh*/ bhvDeathWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BITFS, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0B, /*destLevel*/ LEVEL_BOWSER_2, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0C, /*destLevel*/ LEVEL_BITFS, /*destArea*/ 0x01, /*destNode*/ 0x0C, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/bits/header.h"
#include "levels/bits/areas/1/2/geo.inc.c"

View File

@ -92,7 +92,7 @@ const LevelScript level_bits_entry[] = {
AREA(/*index*/ 1, bits_geo_000718),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -7039, -3812, 4, /*angle*/ 0, 90, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps64),
OBJECT(/*model*/ MODEL_BITS_WARP_PIPE, /*pos*/ 351, 6652, -6030, /*angle*/ 0, 0, 0, /*behParam*/ 0x000B0000, /*beh*/ bhvWarpPipe),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 351, 6800, -3900, /*angle*/ 0, 180, 0, /*behParam*/ 0x000C0000, /*beh*/ bhvWarps70),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 351, 6800, -3900, /*angle*/ 0, 180, 0, /*behParam*/ 0x000C0000, /*beh*/ bhvDeathWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BITS, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0B, /*destLevel*/ LEVEL_BOWSER_3, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0C, /*destLevel*/ LEVEL_BITS, /*destArea*/ 0x01, /*destNode*/ 0x0C, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/bob/header.h"
#include "levels/bob/chain_chomp_gate/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/bowser_1/header.h"
#include "levels/bowser_1/areas/1/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/bowser_2/header.h"
#include "levels/bowser_2/tilting_platform/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/bowser_3/header.h"
#include "levels/bowser_3/falling_platform_1/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/castle_courtyard/header.h"
#include "levels/castle_courtyard/areas/1/spire/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/castle_grounds/header.h"
#include "levels/castle_grounds/areas/1/11/geo.inc.c"

View File

@ -19,7 +19,7 @@ static const LevelScript script_func_local_1[] = {
WARP_NODE(/*id*/ 0x00, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x00, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x01, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x01, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x02, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x02, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 900, -1710, /*angle*/ 0, 180, 0, /*behParam*/ 0x00030000, /*beh*/ bhvWarps70),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 900, -1710, /*angle*/ 0, 180, 0, /*behParam*/ 0x00030000, /*beh*/ bhvDeathWarp),
WARP_NODE(/*id*/ 0x03, /*destLevel*/ LEVEL_CASTLE_GROUNDS, /*destArea*/ 0x01, /*destNode*/ 0x03, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1328, 260, 4664, /*angle*/ 0, 180, 0, /*behParam*/ 0x00040000, /*beh*/ bhvWarps6C),
WARP_NODE(/*id*/ 0x04, /*destLevel*/ LEVEL_CASTLE_GROUNDS, /*destArea*/ 0x01, /*destNode*/ 0x04, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/castle_inside/header.h"
#include "levels/castle_inside/star_door/geo.inc.c"

View File

@ -54,12 +54,12 @@ static const LevelScript script_func_local_1[] = {
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x00200000, /*beh*/ bhvWarps64),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x00210000, /*beh*/ bhvWarps84),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x00220000, /*beh*/ bhvWarps68),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x00230000, /*beh*/ bhvWarps70),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x00230000, /*beh*/ bhvDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -5513, 512, -4324, /*angle*/ 0, -135, 0, /*behParam*/ 0x00240000, /*beh*/ bhvWarps8C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -5513, 512, -4324, /*angle*/ 0, -135, 0, /*behParam*/ 0x00250000, /*beh*/ bhvWarps90),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 0, 0, /*behParam*/ 0x00260000, /*beh*/ bhvWarps88),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2816, 1200, -256, /*angle*/ 0, 90, 0, /*behParam*/ 0x00270000, /*beh*/ bhvWarps88),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2816, 1200, -256, /*angle*/ 0, 270, 0, /*behParam*/ 0x00280000, /*beh*/ bhvWarps70),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2816, 1200, -256, /*angle*/ 0, 270, 0, /*behParam*/ 0x00280000, /*beh*/ bhvDeathWarp),
WARP_NODE(/*id*/ 0x1E, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x1E, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x1F, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x1F, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x20, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x20, /*flags*/ WARP_NO_CHECKPOINT),
@ -79,10 +79,10 @@ static const LevelScript script_func_local_1[] = {
WARP_NODE(/*id*/ 0x33, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x33, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x34, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x34, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x35, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x35, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -5422, 717, -461, /*angle*/ 0, 270, 0, /*behParam*/ 0x00640000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -2304, 0, -4552, /*angle*/ 0, 180, 0, /*behParam*/ 0x00650000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 256, 102, -4706, /*angle*/ 0, 180, 0, /*behParam*/ 0x00660000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4501, 717, -230, /*angle*/ 0, 90, 0, /*behParam*/ 0x00670000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -5422, 717, -461, /*angle*/ 0, 270, 0, /*behParam*/ 0x00640000, /*beh*/ bhvPaintingDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -2304, 0, -4552, /*angle*/ 0, 180, 0, /*behParam*/ 0x00650000, /*beh*/ bhvPaintingDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 256, 102, -4706, /*angle*/ 0, 180, 0, /*behParam*/ 0x00660000, /*beh*/ bhvPaintingDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4501, 717, -230, /*angle*/ 0, 90, 0, /*behParam*/ 0x00670000, /*beh*/ bhvPaintingDeathWarp),
WARP_NODE(/*id*/ 0x64, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x64, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x65, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x65, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x66, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x66, /*flags*/ WARP_NO_CHECKPOINT),
@ -138,12 +138,12 @@ static const LevelScript script_func_local_2[] = {
WARP_NODE(/*id*/ 0x37, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x37, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x38, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x38, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x3A, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x3A, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -659, 1613, -350, /*angle*/ 0, 180, 0, /*behParam*/ 0x00640000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -4693, 2157, 1828, /*angle*/ 0, 270, 0, /*behParam*/ 0x00650000, /*beh*/ bhvWarps70),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -675, 1400, 3870, /*angle*/ 0, 0, 0, /*behParam*/ 0x00660000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -205, 2918, 7300, /*angle*/ 0, 0, 0, /*behParam*/ 0x00670000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 3538, 1766, -400, /*angle*/ 0, 180, 0, /*behParam*/ 0x00680000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -4693, 2157, 1828, /*angle*/ 0, 270, 0, /*behParam*/ 0x00690000, /*beh*/ bhvWarps70),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -659, 1613, -350, /*angle*/ 0, 180, 0, /*behParam*/ 0x00640000, /*beh*/ bhvPaintingDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -4693, 2157, 1828, /*angle*/ 0, 270, 0, /*behParam*/ 0x00650000, /*beh*/ bhvDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -675, 1400, 3870, /*angle*/ 0, 0, 0, /*behParam*/ 0x00660000, /*beh*/ bhvPaintingDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -205, 2918, 7300, /*angle*/ 0, 0, 0, /*behParam*/ 0x00670000, /*beh*/ bhvPaintingDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 3538, 1766, -400, /*angle*/ 0, 180, 0, /*behParam*/ 0x00680000, /*beh*/ bhvPaintingDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -4693, 2157, 1828, /*angle*/ 0, 270, 0, /*behParam*/ 0x00690000, /*beh*/ bhvDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -230, 4813, -3352, /*angle*/ 0, 180, 0, /*behParam*/ 0x006B0000, /*beh*/ bhvWarps90),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3412, 2816, 5886, /*angle*/ 0, 270, 0, /*behParam*/ 0x006C0000, /*beh*/ bhvWarps90),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 3002, 2816, 5886, /*angle*/ 0, 90, 0, /*behParam*/ 0x006D0000, /*beh*/ bhvWarps90),
@ -189,10 +189,10 @@ static const LevelScript script_func_local_3[] = {
WARP_NODE(/*id*/ 0x34, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x34, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x35, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x35, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x36, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x36, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1382, -819, -4150, /*angle*/ 0, 180, 0, /*behParam*/ 0x00640000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -2918, -870, -875, /*angle*/ 0, 0, 0, /*behParam*/ 0x00650000, /*beh*/ bhvWarps80),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1382, -819, -4150, /*angle*/ 0, 180, 0, /*behParam*/ 0x00640000, /*beh*/ bhvPaintingDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -2918, -870, -875, /*angle*/ 0, 0, 0, /*behParam*/ 0x00650000, /*beh*/ bhvPaintingDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2483, -1688, -2662, /*angle*/ 0, 270, 0, /*behParam*/ 0x00660000, /*beh*/ bhvWarps90),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2381, -500, 2011, /*angle*/ 0, 90, 0, /*behParam*/ 0x00670000, /*beh*/ bhvWarps70),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2381, -500, 2011, /*angle*/ 0, 90, 0, /*behParam*/ 0x00670000, /*beh*/ bhvDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4147, -1100, 1997, /*angle*/ 0, 90, 0, /*behParam*/ 0x00680000, /*beh*/ bhvWarps90),
WARP_NODE(/*id*/ 0x64, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x64, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x65, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x65, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/ccm/header.h"
#include "levels/ccm/ropeway_lift/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/cotmc/header.h"
#include "levels/cotmc/areas/1/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/ddd/header.h"
#include "levels/ddd/pole/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/ending/header.h"
// 0x0E000050

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/hmc/header.h"
#include "levels/hmc/areas/1/grill_door/geo.inc.c"

View File

@ -11,6 +11,8 @@
#include "menu/debug_level_select.h"
#include "menu/intro_geo.h"
#include "make_const_nonconst.h"
#include "levels/intro/header.h"
// 0x0E0002D0
@ -30,13 +32,13 @@ const GeoLayout intro_geo_0002D0[] = {
GEO_OPEN_NODE(),
GEO_CAMERA(0, 0, 0, 3200, 0, 0, 0, 0x00000000),
GEO_OPEN_NODE(),
GEO_ASM(0, geo18_title_screen),
GEO_ASM(0, geo_title_screen),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_ZBUFFER(0),
GEO_OPEN_NODE(),
GEO_ASM(0, geo18_fade_transition),
GEO_ASM(0, geo_fade_transition),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_END(),
@ -50,7 +52,7 @@ const GeoLayout intro_geo_00035C[] = {
GEO_OPEN_NODE(),
GEO_NODE_ORTHO(100),
GEO_OPEN_NODE(),
GEO_ASM(0, geo18_intro_backdrop),
GEO_ASM(0, geo_intro_backdrop),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_ZBUFFER(1),
@ -72,7 +74,7 @@ const GeoLayout intro_geo_0003B8[] = {
GEO_OPEN_NODE(),
GEO_NODE_ORTHO(100),
GEO_OPEN_NODE(),
GEO_ASM(0, geo18_game_over_tile),
GEO_ASM(0, geo_game_over_tile),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_ZBUFFER(1),
@ -94,7 +96,7 @@ const GeoLayout intro_geo_000414[] = {
GEO_OPEN_NODE(),
GEO_NODE_ORTHO(100),
GEO_OPEN_NODE(),
GEO_ASM(0, geo18_intro_backdrop),
GEO_ASM(0, geo_intro_backdrop),
GEO_CLOSE_NODE(),
GEO_CLOSE_NODE(),
GEO_ZBUFFER(1),

View File

@ -30,7 +30,7 @@ const LevelScript level_intro_entry_1[] = {
FREE_LEVEL_POOL(),
LOAD_AREA(/*area*/ 1),
CALL(/*arg*/ 0, /*func*/ LevelProc_8016F508),
CALL(/*arg*/ 0, /*func*/ lvl_intro_update),
SLEEP(/*frames*/ 75),
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00),
SLEEP(/*frames*/ 16),
@ -59,7 +59,7 @@ const LevelScript level_intro_entry_2[] = {
SET_MENU_MUSIC(/*seq*/ 0x0002),
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00),
SLEEP(/*frames*/ 20),
CALL_LOOP(/*arg*/ 1, /*func*/ LevelProc_8016F508),
CALL_LOOP(/*arg*/ 1, /*func*/ lvl_intro_update),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2),
JUMP(script_intro_L4),
@ -84,7 +84,7 @@ const LevelScript level_intro_entry_3[] = {
SET_MENU_MUSIC(/*seq*/ 0x0082),
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00),
SLEEP(/*frames*/ 20),
CALL_LOOP(/*arg*/ 2, /*func*/ LevelProc_8016F508),
CALL_LOOP(/*arg*/ 2, /*func*/ lvl_intro_update),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2),
JUMP(script_intro_L4),
@ -106,7 +106,7 @@ const LevelScript level_intro_entry_4[] = {
SET_MENU_MUSIC(/*seq*/ 0x0002),
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
SLEEP(/*frames*/ 16),
CALL_LOOP(/*arg*/ 3, /*func*/ LevelProc_8016F508),
CALL_LOOP(/*arg*/ 3, /*func*/ lvl_intro_update),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ -1, script_intro_L5),
JUMP(script_intro_L3),
};

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/jrb/header.h"
#include "levels/jrb/falling_pillar/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/lll/header.h"
#include "levels/lll/areas/1/4/geo.inc.c"

View File

@ -11,6 +11,8 @@
#include "menu/file_select.h"
#include "menu/star_select.h"
#include "make_const_nonconst.h"
#include "levels/menu/header.h"
// 0x0E0001D0

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/pss/header.h"
#include "levels/pss/areas/1/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/rr/header.h"
#include "levels/rr/areas/1/2/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/sa/header.h"
#include "levels/sa/areas/1/geo.inc.c"

View File

@ -4,6 +4,8 @@
#include "level_commands.h"
#include "game/area.h"
#include "make_const_nonconst.h"
#include "segment_symbols.h"
#include "actors/common0.h"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/sl/header.h"
#include "levels/sl/unused_cracked_ice/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/ssl/header.h"
#include "levels/ssl/areas/1/5/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/thi/header.h"
#include "levels/thi/areas/1/6/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/totwc/header.h"
#include "levels/totwc/cloud/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/ttc/header.h"
#include "levels/ttc/rotating_cube/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/ttm/header.h"
#include "levels/ttm/star_cage/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/vcutm/header.h"
#include "levels/vcutm/seesaw/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/wdw/header.h"
#include "levels/wdw/square_floating_platform/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/wf/header.h"
#include "levels/wf/areas/1/5/geo.inc.c"

View File

@ -9,6 +9,8 @@
#include "game/screen_transition.h"
#include "game/paintings.h"
#include "make_const_nonconst.h"
#include "levels/wmotr/header.h"
#include "levels/wmotr/areas/1/geo.inc.c"

View File

@ -10,6 +10,10 @@
.section .text, "ax"
.ifdef AVOID_UB
.set D_80334890, D_80334890_fix
.endif
glabel __osExceptionPreamble
lui $k0, %hi(__osException) # $k0, 0x8032
addiu $k0, %lo(__osException) # addiu $k0, $k0, 0x66d0
@ -60,8 +64,8 @@ glabel __osException
move $t0, $k0
sw $zero, %lo(D_80334938)($at)
lui $k0, %hi(D_803348A0) # $k0, 0x8033
lw $k0, %lo(D_803348A0)($k0)
lui $k0, %hi(D_80334890 + 0x10) # $k0, 0x8033
lw $k0, %lo(D_80334890 + 0x10)($k0)
ld $t1, 0x20($t0)
sd $t1, 0x20($k0)
ld $t1, 0x118($t0)
@ -119,8 +123,8 @@ glabel __osException
or $k1, $k1, $t1
sw $k1, 0x118($k0)
.L802F3A18:
lui $t1, %hi(D_A430000C) # $t1, 0xa430
lw $t1, %lo(D_A430000C)($t1)
lui $t1, %hi(MI_INTR_MASK_REG) # $t1, 0xa430
lw $t1, %lo(MI_INTR_MASK_REG)($t1)
beqz $t1, .L802F3A50
nop
lui $t0, %hi(D_8030208C) # $t0, 0x8030
@ -165,8 +169,8 @@ glabel __osException
.L80326868:
mfc0 $t0, $13
sw $t0, 0x120($k0)
lui $t1, %hi(D_A430000C) # $t1, 0xa430
lw $t1, %lo(D_A430000C)($t1)
lui $t1, %hi(MI_INTR_MASK_REG) # $t1, 0xa430
lw $t1, %lo(MI_INTR_MASK_REG)($t1)
sw $t1, 0x128($k0)
li $t1, 2
sh $t1, 0x10($k0)
@ -256,20 +260,20 @@ glabel L80326984
b .L8032692C
and $s0, $s0, $at
glabel L803269B8
lui $s1, %hi(D_A4300008) # $s1, 0xa430
lw $s1, %lo(D_A4300008)($s1)
lui $s1, %hi(MI_INTR_REG) # $s1, 0xa430
lw $s1, %lo(MI_INTR_REG)($s1)
andi $s1, $s1, 0x3f
andi $t1, $s1, 1
beqz $t1, .L80326A18
nop
lui $t4, %hi(D_A4040010) # $t4, 0xa404
lw $t4, %lo(D_A4040010)($t4)
lui $t4, %hi(SP_STATUS_REG) # $t4, 0xa404
lw $t4, %lo(SP_STATUS_REG)($t4)
li $t1, 8
lui $at, %hi(D_A4040010) # $at, 0xa404
lui $at, %hi(SP_STATUS_REG) # $at, 0xa404
andi $t4, $t4, 0x300
andi $s1, $s1, 0x3e
beqz $t4, .L80326A08
sw $t1, %lo(D_A4040010)($at)
sw $t1, %lo(SP_STATUS_REG)($at)
jal send_mesg
li $a0, 32
beqz $s1, .L80326ADC
@ -284,9 +288,9 @@ glabel L803269B8
.L80326A18:
andi $t1, $s1, 8
beqz $t1, .L80326A3C
lui $at, %hi(D_A4400010) # $at, 0xa440
lui $at, %hi(VI_CURRENT_REG) # $at, 0xa440
andi $s1, $s1, 0x37
sw $zero, %lo(D_A4400010)($at)
sw $zero, %lo(VI_CURRENT_REG)($at)
jal send_mesg
li $a0, 56
beqz $s1, .L80326ADC
@ -296,9 +300,9 @@ glabel L803269B8
beqz $t1, .L80326A68
nop
li $t1, 1
lui $at, %hi(D_A450000C) # $at, 0xa450
lui $at, %hi(AI_STATUS_REG) # $at, 0xa450
andi $s1, $s1, 0x3b
sw $t1, %lo(D_A450000C)($at)
sw $t1, %lo(AI_STATUS_REG)($at)
jal send_mesg
li $a0, 48
beqz $s1, .L80326ADC
@ -306,9 +310,9 @@ glabel L803269B8
.L80326A68:
andi $t1, $s1, 2
beqz $t1, .L80326A8C
lui $at, %hi(D_A4800018) # $at, 0xa480
lui $at, %hi(SI_STATUS_REG) # $at, 0xa480
andi $s1, $s1, 0x3d
sw $zero, %lo(D_A4800018)($at)
sw $zero, %lo(SI_STATUS_REG)($at)
jal send_mesg
li $a0, 40
beqz $s1, .L80326ADC
@ -318,9 +322,9 @@ glabel L803269B8
beqz $t1, .L80326AB8
nop
li $t1, 2
lui $at, %hi(D_A4600010) # $at, 0xa460
lui $at, %hi(PI_STATUS_REG) # $at, 0xa460
andi $s1, $s1, 0x2f
sw $t1, %lo(D_A4600010)($at)
sw $t1, %lo(PI_STATUS_REG)($at)
jal send_mesg
li $a0, 64
beqz $s1, .L80326ADC
@ -330,9 +334,9 @@ glabel L803269B8
beqz $t1, .L80326ADC
nop
li $t1, 2048
lui $at, %hi(D_A4300000)
lui $at, %hi(MI_MODE_REG)
andi $s1, $s1, 0x1f
sw $t1, %lo(D_A4300000)($at)
sw $t1, %lo(MI_MODE_REG)($at)
jal send_mesg
li $a0, 72
.L80326ADC:
@ -356,8 +360,8 @@ glabel L80326AE8
sw $t2, ($t1)
jal send_mesg
li $a0, 112
lui $t2, %hi(D_80334898) # $t2, 0x8033
lw $t2, %lo(D_80334898)($t2)
lui $t2, %hi(D_80334890 + 0x8) # $t2, 0x8033
lw $t2, %lo(D_80334890 + 0x8)($t2)
li $at, -4097
and $s0, $s0, $at
lw $k1, 0x118($t2)
@ -391,23 +395,23 @@ glabel L80326B64
nop
.L80326B9C:
glabel L80326B9C
lui $t2, %hi(D_80334898) # $t2, 0x8033
lw $t2, %lo(D_80334898)($t2)
lui $t2, %hi(D_80334890 + 0x8) # $t2, 0x8033
lw $t2, %lo(D_80334890 + 0x8)($t2)
lw $t1, 4($k0)
lw $t3, 4($t2)
slt $at, $t1, $t3
beqz $at, .L80326BD0
nop
lui $a0, %hi(D_80334898) # $a0, 0x8033
lui $a0, %hi(D_80334890 + 0x8) # $a0, 0x8033
move $a1, $k0
jal __osEnqueueThread
addiu $a0, %lo(D_80334898) # addiu $a0, $a0, 0x4898
addiu $a0, %lo(D_80334890 + 0x8) # addiu $a0, $a0, 0x4898
j __osDispatchThread
nop
.L80326BD0:
lui $t1, %hi(D_80334898) # $t1, 0x8033
addiu $t1, %lo(D_80334898) # addiu $t1, $t1, 0x4898
lui $t1, %hi(D_80334890 + 0x8) # $t1, 0x8033
addiu $t1, %lo(D_80334890 + 0x8) # addiu $t1, $t1, 0x4898
lw $t2, ($t1)
sw $t2, ($k0)
j __osDispatchThread
@ -415,8 +419,8 @@ glabel L80326B9C
.L80326BE8:
glabel L80326BE8
lui $at, %hi(D_803348A4) # $at, 0x8033
sw $k0, %lo(D_803348A4)($at)
lui $at, %hi(D_80334890 + 0x14) # $at, 0x8033
sw $k0, %lo(D_80334890 + 0x14)($at)
li $t1, 1
sh $t1, 0x10($k0)
li $t1, 2
@ -442,8 +446,8 @@ glabel L80326BE8
sw $zero, 0x18($k0)
mfc0 $t0, $13
move $t0, $k0
lui $k0, %hi(D_803348A0) # $k0, 0x8030
lw $k0, %lo(D_803348A0)($k0)
lui $k0, %hi(D_80334890 + 0x10) # $k0, 0x8030
lw $k0, %lo(D_80334890 + 0x10)($k0)
ld $t1, 0x20($t0)
sd $t1, 0x20($k0)
ld $t1, 0x118($t0)
@ -499,8 +503,8 @@ glabel L80326BE8
or $k1, $k1, $t1
sw $k1, 0x118($k0)
.L802F3A18:
lui $t1, %hi(D_A430000C) # $t1, 0xa430
lw $t1, %lo(D_A430000C)($t1)
lui $t1, %hi(MI_INTR_MASK_REG) # $t1, 0xa430
lw $t1, %lo(MI_INTR_MASK_REG)($t1)
beqz $t1, .L802F3A50
nop
lui $t0, %hi(D_8030208C) # $t0, 0x8030
@ -613,21 +617,21 @@ glabel L803269B8
lui $t0, %hi(D_8030208C) # $t0, 0x8030
addiu $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
lw $t0, ($t0)
lui $s1, %hi(D_A4300008) # $s1, 0xa430
lw $s1, %lo(D_A4300008)($s1)
lui $s1, %hi(MI_INTR_REG) # $s1, 0xa430
lw $s1, %lo(MI_INTR_REG)($s1)
srl $t0, $t0, 0x10
and $s1, $s1, $t0
andi $t1, $s1, 1
beqz $t1, .L802F3C24
nop
lui $t4, %hi(D_A4040010) # $t4, 0xa404
lw $t4, %lo(D_A4040010)($t4)
lui $t4, %hi(SP_STATUS_REG) # $t4, 0xa404
lw $t4, %lo(SP_STATUS_REG)($t4)
li $t1, 8
lui $at, %hi(D_A4040010) # $at, 0xa404
lui $at, %hi(SP_STATUS_REG) # $at, 0xa404
andi $t4, $t4, 0x300
andi $s1, $s1, 0x3e
beqz $t4, .L802F3C14
sw $t1, %lo(D_A4040010)($at)
sw $t1, %lo(SP_STATUS_REG)($at)
jal send_mesg
li $a0, 32
beqz $s1, .L802F3CE8
@ -642,9 +646,9 @@ glabel L803269B8
.L802F3C24:
andi $t1, $s1, 8
beqz $t1, .L802F3C48
lui $at, %hi(D_A4400010) # $at, 0xa440
lui $at, %hi(VI_CURRENT_REG) # $at, 0xa440
andi $s1, $s1, 0x37
sw $zero, %lo(D_A4400010)($at)
sw $zero, %lo(VI_CURRENT_REG)($at)
jal send_mesg
li $a0, 56
beqz $s1, .L802F3CE8
@ -654,9 +658,9 @@ glabel L803269B8
beqz $t1, .L802F3C74
nop
li $t1, 1
lui $at, %hi(D_A450000C) # $at, 0xa450
lui $at, %hi(AI_STATUS_REG) # $at, 0xa450
andi $s1, $s1, 0x3b
sw $t1, %lo(D_A450000C)($at)
sw $t1, %lo(AI_STATUS_REG)($at)
jal send_mesg
li $a0, 48
beqz $s1, .L802F3CE8
@ -664,9 +668,9 @@ glabel L803269B8
.L802F3C74:
andi $t1, $s1, 2
beqz $t1, .L802F3C98
lui $at, %hi(D_A4800018) # $at, 0xa480
lui $at, %hi(SI_STATUS_REG) # $at, 0xa480
andi $s1, $s1, 0x3d
sw $zero, %lo(D_A4800018)($at)
sw $zero, %lo(SI_STATUS_REG)($at)
jal send_mesg
li $a0, 40
beqz $s1, .L802F3CE8
@ -676,9 +680,9 @@ glabel L803269B8
beqz $t1, .L802F3CC4
nop
li $t1, 2
lui $at, %hi(D_A4600010) # $at, 0xa460
lui $at, %hi(PI_STATUS_REG) # $at, 0xa460
andi $s1, $s1, 0x2f
sw $t1, %lo(D_A4600010)($at)
sw $t1, %lo(PI_STATUS_REG)($at)
jal send_mesg
li $a0, 64
beqz $s1, .L802F3CE8
@ -714,8 +718,8 @@ glabel L80326AE8
sw $t2, ($t1)
jal send_mesg
li $a0, 112
lui $t2, %hi(D_80334898) # $t2, 0x8030
lw $t2, %lo(D_80334898)($t2)
lui $t2, %hi(D_80334890 + 0x8) # $t2, 0x8030
lw $t2, %lo(D_80334890 + 0x8)($t2)
li $at, -4097
and $s0, $s0, $at
lw $k1, 0x118($t2)
@ -749,23 +753,23 @@ glabel L80326B64
nop
.L802F3DA8:
glabel L80326B9C
lui $t2, %hi(D_80334898) # $t2, 0x8030
lw $t2, %lo(D_80334898)($t2)
lui $t2, %hi(D_80334890 + 0x8) # $t2, 0x8030
lw $t2, %lo(D_80334890 + 0x8)($t2)
lw $t1, 4($k0)
lw $t3, 4($t2)
slt $at, $t1, $t3
beqz $at, .L80326BD0
nop
lui $a0, %hi(D_80334898) # $a0, 0x8030
lui $a0, %hi(D_80334890 + 0x8) # $a0, 0x8030
move $a1, $k0
jal __osEnqueueThread
addiu $a0, %lo(D_80334898) # addiu $a0, $a0, 0x2ef8
addiu $a0, %lo(D_80334890 + 0x8) # addiu $a0, $a0, 0x2ef8
j __osDispatchThread
nop
.L80326BD0:
lui $t1, %hi(D_80334898) # $t1, 0x8030
addiu $t1, %lo(D_80334898) # addiu $t1, $t1, 0x2ef8
lui $t1, %hi(D_80334890 + 0x8) # $t1, 0x8030
addiu $t1, %lo(D_80334890 + 0x8) # addiu $t1, $t1, 0x2ef8
lw $t2, ($t1)
sw $t2, ($k0)
j __osDispatchThread
@ -773,8 +777,8 @@ glabel L80326B9C
.L80326BE8:
glabel L80326BE8
lui $at, %hi(D_803348A4) # $at, 0x8030
sw $k0, %lo(D_803348A4)($at)
lui $at, %hi(D_80334890 + 0x14) # $at, 0x8030
sw $k0, %lo(D_80334890 + 0x14)($at)
li $t1, 1
sh $t1, 0x10($k0)
li $t1, 2
@ -829,10 +833,10 @@ glabel send_mesg
jal __osPopThread
move $a0, $t1
move $t2, $v0
lui $a0, %hi(D_80334898) # $a0, 0x8033
lui $a0, %hi(D_80334890 + 0x8) # $a0, 0x8033
move $a1, $t2
jal __osEnqueueThread
addiu $a0, %lo(D_80334898) # addiu $a0, $a0, 0x4898
addiu $a0, %lo(D_80334890 + 0x8) # addiu $a0, $a0, 0x4898
.L80326CC4:
jr $s2
nop
@ -853,8 +857,8 @@ glabel send_mesg
glabel __osEnqueueAndYield
lui $a1, %hi(D_803348A0) # $a1, 0x8033
lw $a1, %lo(D_803348A0)($a1)
lui $a1, %hi(D_80334890 + 0x10) # $a1, 0x8033
lw $a1, %lo(D_80334890 + 0x10)($a1)
mfc0 $t0, $12
lw $k1, 0x18($a1)
ori $t0, $t0, 2
@ -905,8 +909,8 @@ glabel __osEnqueueAndYield
/* 0B37B4 802F3FB4 0369D825 */ or $k1, $k1, $t1
/* 0B37B8 802F3FB8 ACBB0118 */ sw $k1, 0x118($a1)
.L802F3FBC:
/* 0B37BC 802F3FBC 3C1BA430 */ lui $k1, %hi(D_A430000C) # $k1, 0xa430
/* 0B37C0 802F3FC0 8F7B000C */ lw $k1, %lo(D_A430000C)($k1)
/* 0B37BC 802F3FBC 3C1BA430 */ lui $k1, %hi(MI_INTR_MASK_REG) # $k1, 0xa430
/* 0B37C0 802F3FC0 8F7B000C */ lw $k1, %lo(MI_INTR_MASK_REG)($k1)
/* 0B37C4 802F3FC4 1360000B */ beqz $k1, .L802F3FF4
/* 0B37C8 802F3FC8 00000000 */ nop
/* 0B37CC 802F3FCC 3C1A8030 */ lui $k0, %hi(D_8030208C) # $k0, 0x8030
@ -925,8 +929,8 @@ glabel __osEnqueueAndYield
.L80326D70:
.ifndef VERSION_EU
lui $k1, %hi(D_A430000C) # $k1, 0xa430
lw $k1, %lo(D_A430000C)($k1)
lui $k1, %hi(MI_INTR_MASK_REG) # $k1, 0xa430
lw $k1, %lo(MI_INTR_MASK_REG)($k1)
.endif
beqz $a0, .L80326D88
sw $k1, 0x128($a1)
@ -967,11 +971,11 @@ glabel __osPopThread
sw $t9, ($a0)
glabel __osDispatchThread
lui $a0, %hi(D_80334898) # $a0, 0x8033
lui $a0, %hi(D_80334890 + 0x8) # $a0, 0x8033
jal __osPopThread
addiu $a0, %lo(D_80334898) # addiu $a0, $a0, 0x4898
lui $at, %hi(D_803348A0) # $at, 0x8033
sw $v0, %lo(D_803348A0)($at)
addiu $a0, %lo(D_80334890 + 0x8) # addiu $a0, $a0, 0x4898
lui $at, %hi(D_80334890 + 0x10) # $at, 0x8033
sw $v0, %lo(D_80334890 + 0x10)($at)
li $t0, 4
sh $t0, 0x10($v0)
move $k0, $v0
@ -1066,8 +1070,8 @@ glabel __osDispatchThread
addiu $k0, %lo(D_803386D0) # addiu $k0, $k0, -0x7930
addu $k1, $k1, $k0
lhu $k1, ($k1)
lui $k0, %hi(D_A430000C) # $k0, 0xa430
addiu $k0, %lo(D_A430000C) # addiu $k0, $k0, 0xc
lui $k0, %hi(MI_INTR_MASK_REG) # $k0, 0xa430
addiu $k0, %lo(MI_INTR_MASK_REG) # addiu $k0, $k0, 0xc
sw $k1, ($k0)
nop
nop

100
lib/asm/llmuldiv_gcc.s Normal file
View File

@ -0,0 +1,100 @@
# 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"
/* -------------------------------------------------------------------------------------- */
/* need to asm these functions because lib32gcc-7-dev-mips-cross does not exist so we */
/* cannot naturally link a libgcc variant for this target given this architecture and */
/* compiler. Until we have a good workaround with a gcc target that doesn't involve */
/* assuming a 32-bit to 64-bit change, we have to encode these functions as raw assembly */
/* for it to compile. */
/* -------------------------------------------------------------------------------------- */
/* TODO: Is there a non-insane way to fix this hack that doesn't involve the user compiling */
/* a library themselves? */
glabel __umoddi3
sw $a0, ($sp)
sw $a1, 4($sp)
sw $a2, 8($sp)
sw $a3, 0xc($sp)
ld $t7, 8($sp)
ld $t6, ($sp)
ddivu $zero, $t6, $t7
bnez $t7, .L80324144
nop
break 7
.L80324144:
mfhi $v0
dsll32 $v1, $v0, 0
dsra32 $v1, $v1, 0
jr $ra
dsra32 $v0, $v0, 0
glabel __udivdi3
sw $a0, ($sp)
sw $a1, 4($sp)
sw $a2, 8($sp)
sw $a3, 0xc($sp)
ld $t7, 8($sp)
ld $t6, ($sp)
ddivu $zero, $t6, $t7
bnez $t7, .L80324180
nop
break 7
.L80324180:
mflo $v0
dsll32 $v1, $v0, 0
dsra32 $v1, $v1, 0
jr $ra
dsra32 $v0, $v0, 0
glabel __moddi3
sw $a0, ($sp)
sw $a1, 4($sp)
sw $a2, 8($sp)
sw $a3, 0xc($sp)
ld $t7, 8($sp)
ld $t6, ($sp)
ddivu $zero, $t6, $t7
bnez $t7, .L803241E8
nop
break 7
.L803241E8:
mfhi $v0
dsll32 $v1, $v0, 0
dsra32 $v1, $v1, 0
jr $ra
dsra32 $v0, $v0, 0
glabel __divdi3
sw $a0, ($sp)
sw $a1, 4($sp)
sw $a2, 8($sp)
sw $a3, 0xc($sp)
ld $t7, 8($sp)
ld $t6, ($sp)
ddiv $zero, $t6, $t7
nop
bnez $t7, .L80324228
nop
break 7
.L80324228:
daddiu $at, $zero, -1
bne $t7, $at, .L80324244
daddiu $at, $zero, 1
dsll32 $at, $at, 0x1f
bne $t6, $at, .L80324244
nop
break 6
.L80324244:
mflo $v0
dsll32 $v1, $v0, 0
dsra32 $v1, $v1, 0
jr $ra
dsra32 $v0, $v0, 0

View File

@ -2,12 +2,16 @@
// these don't feel like they belong here
// but it makes the most logical since there was printf data before
#ifndef AVOID_UB
OSThread *D_80334890 = NULL;
u32 unknown = -1;
u32 D_80334894 = -1;
OSThread *D_80334898 = (OSThread *) &D_80334890;
OSThread *D_8033489C = (OSThread *) &D_80334890;
OSThread *D_803348A0 = NULL;
u32 D_803348A4 = 0; // UNKNOWN
#else
OSThread_ListHead D_80334890_fix = {NULL, -1, (OSThread *) &D_80334890_fix, (OSThread *) &D_80334890_fix, NULL, 0};
#endif
void __osDequeueThread(OSThread **queue, OSThread *thread) {
register OSThread **a2;

View File

@ -1,5 +1,5 @@
#include "libultra_internal.h"
extern OSThread* D_8033489C;
OSThread *__osGetCurrFaultedThread() {
return D_8033489C; // 80302efc
}

View File

@ -1,6 +1,5 @@
#include "new_func.h"
extern OSThread *D_80334898;
void func_802F4A20() {
__OSTranxInfo *sp1c;
volatile u32 sp18;
@ -11,8 +10,8 @@ void func_802F4A20() {
// addiu $t7, $t6, 0x14
// sw $t7, 0x1c($sp)
sp1c = &__osDiskHandle->transferInfo;
// lui $t8, %hi(D_A4600010) # $t8, 0xa460
// lw $t9, %lo(D_A4600010)($t8)
// lui $t8, %hi(PI_STATUS_REG) # $t8, 0xa460
// lw $t9, %lo(PI_STATUS_REG)($t8)
// sw $t9, 0x18($sp)
// sp18 = HW_REG(PI_STATUS_REG, u32);
// while(sp18 & 0x2) sp18 = HW_REG(PI_STATUS_REG, u32);
@ -22,8 +21,8 @@ void func_802F4A20() {
// beqz $t1, .L802F4A70
// nop
// L802F4A54:
// lui $t2, %hi(D_A4600010) # $t2, 0xa460
// lw $t3, %lo(D_A4600010)($t2)
// lui $t2, %hi(PI_STATUS_REG) # $t2, 0xa460
// lw $t3, %lo(PI_STATUS_REG)($t2)
// sw $t3, 0x18($sp)
// lw $t4, 0x18($sp)
// andi $t5, $t4, 2
@ -35,11 +34,11 @@ void func_802F4A20() {
// lui $at, 0x1000
// lui $t9, %hi(D_A5000510) # $t9, 0xa500
// lw $t7, 0x14($t6)
// lui $t0, %hi(D_A4600010) # $t0, 0xa460
// lui $t0, %hi(PI_STATUS_REG) # $t0, 0xa460
// or $t8, $t7, $at
// sw $t8, %lo(D_A5000510)($t9)
HW_REG(ASIC_BM_CTL, u32) = BUFFER_MANAGER_RESET | sp1c->bmCtlShadow; //should be unk10??
// lw $t1, %lo(D_A4600010)($t0)
// lw $t1, %lo(PI_STATUS_REG)($t0)
// sw $t1, 0x18($sp)
// lw $t2, 0x18($sp)
// andi $t3, $t2, 2
@ -47,8 +46,8 @@ void func_802F4A20() {
// nop
WAIT_ON_IOBUSY(sp18);
// L802F4AA4:
// lui $t4, %hi(D_A4600010) # $t4, 0xa460
// lw $t5, %lo(D_A4600010)($t4)
// lui $t4, %hi(PI_STATUS_REG) # $t4, 0xa460
// lw $t5, %lo(PI_STATUS_REG)($t4)
// sw $t5, 0x18($sp)
// lw $t6, 0x18($sp)
// andi $t7, $t6, 2
@ -64,8 +63,8 @@ void func_802F4A20() {
HW_REG(ASIC_BM_CTL, u32) = sp1c->bmCtlShadow;
func_802F4B08();
// li $t1, 2
// lui $t2, %hi(D_A4600010) # $t2, 0xa460
// sw $t1, %lo(D_A4600010)($t2)
// lui $t2, %hi(PI_STATUS_REG) # $t2, 0xa460
// sw $t1, %lo(PI_STATUS_REG)($t2)
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
// lui $t3, %hi(D_8030208C) # $t3, 0x8030
// lw $t3, %lo(D_8030208C)($t3)

View File

@ -10,16 +10,16 @@ s32 func_802F71A0(OSPiHandle *a0, u32 a1, u32 a2) {
return 0;
}
/*
/ 0B69A0 802F71A0 3C0EA460 / lui $t6, %hi(D_A4600010) # $t6, 0xa460
/ 0B69A4 802F71A4 8DC70010 / lw $a3, %lo(D_A4600010)($t6)
/ 0B69A0 802F71A0 3C0EA460 / lui $t6, %hi(PI_STATUS_REG) # $t6, 0xa460
/ 0B69A4 802F71A4 8DC70010 / lw $a3, %lo(PI_STATUS_REG)($t6)
/ 0B69A8 802F71A8 27BDFFF8 / addiu $sp, $sp, -8
/ 0B69AC 802F71AC 30EF0003 / andi $t7, $a3, 3
/ 0B69B0 802F71B0 11E00006 / beqz $t7, .L802F71CC
/ 0B69B4 802F71B4 00000000 / nop
.L802F71B8:
/ 0B69B8 802F71B8 3C18A460 / lui $t8, %hi(D_A4600010) # $t8, 0xa460
/ 0B69BC 802F71BC 8F070010 / lw $a3, %lo(D_A4600010)($t8)
/ 0B69B8 802F71B8 3C18A460 / lui $t8, %hi(PI_STATUS_REG) # $t8, 0xa460
/ 0B69BC 802F71BC 8F070010 / lw $a3, %lo(PI_STATUS_REG)($t8)
/ 0B69C0 802F71C0 30F90003 / andi $t9, $a3, 3
/ 0B69C4 802F71C4 1720FFFC / bnez $t9, .L802F71B8
/ 0B69C8 802F71C8 00000000 / nop

View File

@ -1,7 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_803348A0;
extern OSThread *D_80334898;
void func_802F71F0() {
register u32 s0 = __osDisableInt();
D_803348A0->state = OS_STATE_RUNNABLE;

View File

@ -2,6 +2,50 @@
#define _LIBULTRA_INTERNAL_H_
#include <ultra64.h>
/*
* This define is needed because the original definitions in __osDequeueThread.c are declared
* seperately instead of part of a single struct, however some code alises over this memory
* assuming a unified structure. To fix this, we declare the full type here and then alias the
* symbol names to the correct members in AVOID_UB.
*/
#ifdef AVOID_UB
typedef struct OSThread_ListHead_s
{
/*0x00*/ struct OSThread_s *next;
/*0x04*/ OSPri priority;
/*0x08*/ struct OSThread_s *queue;
/*0x0C*/ struct OSThread_s *tlnext;
/*0x10*/ struct OSThread_s *unk10;
/*0x14*/ u32 unk14;
} OSThread_ListHead;
// Now fix the symbols to the new one.
extern OSThread_ListHead D_80334890_fix;
#define D_80334890 D_80334890_fix.next
#define D_80334894 D_80334890_fix.priority
#define D_80334898 D_80334890_fix.queue
#define D_8033489C D_80334890_fix.tlnext
#define D_803348A0 D_80334890_fix.unk10
// Fix for the EEPROM array.
extern u32 D_80365E00[16];
// alias the last array element correctly
#define D_80365E3C D_80365E00[15]
#else
// Original OSThread_ListHead definitions
extern OSThread *D_80334890;
extern u32 D_80334894;
extern OSThread *D_80334898;
extern OSThread *D_8033489C;
extern OSThread *D_803348A0;
// Original EEPROM definitions
extern u32 D_80365E00[15];
extern u32 D_80365E3C;
#endif
typedef struct {
u32 initialized; // probably something like initialized?
OSThread *mgrThread;

View File

@ -6,7 +6,6 @@ void __osContGetInitData(u8 *, OSContStatus *);
u32 D_80334810 = 0; // probably initialized
extern u32 D_80365D1C;
extern u64 osClockRate;
// these probably belong in EEPROMlongread or something

View File

@ -27,9 +27,19 @@ typedef struct
typedef union {
OSContPackedRead read;
OSContPackedRequest request;
u32 as_raw[2];
} OSContPackedStruct;
#ifdef AVOID_UB
// Fix the OSContPackedStruct array
extern OSContPackedStruct D_80365CE0[8];
// And fix the last element
#define D_80365D1C D_80365CE0[7].as_raw[1]
#else
// Original OSContPackedStruct definitions
extern OSContPackedStruct D_80365CE0[7];
extern u32 D_80365D1C;
#endif
#endif

View File

@ -2,9 +2,14 @@
#include "osContInternal.h"
#include <macros.h>
#ifndef AVOID_UB
OSContPackedStruct D_80365CE0[7];
UNUSED static u32 unused; // padding between these two variables
u32 D_80365D1C;
#else
// Reordered gcc vars above will disturb the aliasing done to access all 8 members of this array, hence AVOID_UB.
OSContPackedStruct D_80365CE0[8];
#endif
extern u8 D_80365D20;
extern u8 _osCont_numControllers;
@ -52,6 +57,7 @@ void __osPackReadData() {
for (i = 0; i < 0x10; i++) {
*((u32 *) &D_80365CE0 + i) = 0;
}
D_80365D1C = 1;
sp4.unk00 = 255;
sp4.unk01 = 1;

View File

@ -1,7 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_80334890;
void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msgBuf, s32 count) {
mq->mtqueue = (OSThread *) &D_80334890; //?
mq->fullqueue = (OSThread *) &D_80334890;

View File

@ -1,6 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_8033489C;
void __osCleanupThread(void);
// Don't warn about pointer->u64 cast

View File

@ -1,8 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_803348A0;
extern OSThread *D_8033489C;
void osDestroyThread(OSThread *thread) {
register s32 int_disabled;
register OSThread *s1;

View File

@ -1,7 +1,5 @@
#include "libultra_internal.h"
extern u32 D_80365E00[15];
extern u32 D_80365E3C;
extern u8 D_80365D20;
typedef struct {

View File

@ -1,8 +1,14 @@
#include "libultra_internal.h"
#include "osContInternal.h"
u32 D_80365E00[0x3c >> 2];
#ifndef AVOID_UB
u32 D_80365E00[15];
u32 D_80365E3C;
#else
// Certain code accesses the 16th element (D_80365E3C) in this array, making a seperate
// definition UB when gcc rearranges those.
u32 D_80365E00[16];
#endif
extern u8 D_80365D20;
typedef struct {

View File

@ -1,7 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_803348A0;
OSPri osGetThreadPri(OSThread *thread) {
if (thread == NULL) {
thread = D_803348A0;

View File

@ -1,7 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_803348A0;
s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag) {
register s32 int_disabled;
int_disabled = __osDisableInt();

View File

@ -1,7 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_803348A0;
s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flag) {
register u32 int_disabled;
register OSThread *thread;

View File

@ -1,7 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_803348A0;
s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flag) {
register u32 int_disabled;
register s32 index;

View File

@ -1,8 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_803348A0;
extern OSThread *D_80334898;
void osSetThreadPri(OSThread *thread, OSPri pri) {
register u32 int_disabled = __osDisableInt();
if (thread == NULL) {

View File

@ -1,6 +1,5 @@
#include "libultra_internal.h"
extern OSThread *D_803348A0;
extern OSThread *D_80334898;
void osStartThread(OSThread *thread) {
register u32 int_disabled;
register uintptr_t state;

21
sm64.ld
View File

@ -90,9 +90,11 @@ SECTIONS
BUILD_DIR/asm/entry.o(.text);
BUILD_DIR/src/game/crash_screen.o(.text);
BUILD_DIR/src/game/main.o(.text);
BUILD_DIR/src/game/display.o(.text);
BUILD_DIR/src/game/game.o(.text);
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);
#endif
BUILD_DIR/src/game/level_update.o(.text);
BUILD_DIR/src/game/interaction.o(.text);
BUILD_DIR/src/game/mario.o(.text);
@ -291,6 +293,7 @@ SECTIONS
BUILD_DIR/libultra.a:osContInit.o(.text);
BUILD_DIR/libultra.a:osEepromProbe.o(.text);
BUILD_DIR/libultra.a:llmuldiv.o(.text);
BUILD_DIR/libultra.a:llmuldiv_gcc.o(.text);
BUILD_DIR/libultra.a:osInvalDCache.o(.text);
BUILD_DIR/libultra.a:osPiStartDma.o(.text);
BUILD_DIR/libultra.a:bzero.o(.text);
@ -375,8 +378,7 @@ SECTIONS
/* data */
BUILD_DIR/src/game/crash_screen.o(.data*);
BUILD_DIR/src/game/main.o(.data*);
BUILD_DIR/src/game/display.o(.data*);
BUILD_DIR/src/game/game.o(.data*);
BUILD_DIR/src/game/game_init.o(.data*);
BUILD_DIR/src/game/sound_init.o(.data*);
BUILD_DIR/src/game/level_update.o(.data*);
BUILD_DIR/src/game/interaction.o(.data*);
@ -475,7 +477,7 @@ SECTIONS
/* rodata */
BUILD_DIR/src/game/crash_screen.o(.rodata*);
BUILD_DIR/src/game/main.o(.rodata*);
BUILD_DIR/src/game/game.o(.rodata*);
BUILD_DIR/src/game/game_init.o(.rodata*);
BUILD_DIR/src/game/sound_init.o(.rodata*);
BUILD_DIR/src/game/level_update.o(.rodata*);
BUILD_DIR/src/game/interaction.o(.rodata*);
@ -570,7 +572,7 @@ SECTIONS
{
BUILD_DIR/src/game/crash_screen.o(.bss*);
BUILD_DIR/src/game/main.o(.bss*);
BUILD_DIR/src/game/game.o(.bss*);
BUILD_DIR/src/game/game_init.o(.bss*);
BUILD_DIR/src/game/sound_init.o(.bss*);
BUILD_DIR/src/game/level_update.o(.bss*);
BUILD_DIR/src/game/interaction.o(.bss*);
@ -654,6 +656,8 @@ SECTIONS
BUILD_DIR/libultra.a:kdebugserver.o(.bss*);
BUILD_DIR/libultra.a:*.o(.bss*);
#endif
. = ALIGN(0x8);
}
END_NOLOAD(main)
_mainSegmentNoloadSizeLo = SIZEOF (.main.noload) & 0xffff;
@ -930,8 +934,8 @@ SECTIONS
BUILD_DIR/libgoddard.a:anim_mario_eyebrows_1.o(.data);
BUILD_DIR/libgoddard.a:anim_group_1.o(.data);
BUILD_DIR/libgoddard.a:anim_group_2.o(.data);
BUILD_DIR/libgoddard.a:dynlist_test_cube.o(.rodata);
BUILD_DIR/libgoddard.a:dynlist_unused.o(.rodata);
BUILD_DIR/libgoddard.a:dynlist_test_cube.o(.rodata*);
BUILD_DIR/libgoddard.a:dynlist_unused.o(.rodata*);
BUILD_DIR/libgoddard.a:*.o(.data);
BUILD_DIR/libgoddard.a:*.o(.rodata);
}
@ -996,6 +1000,7 @@ SECTIONS
BEGIN_SEG(assets, __romPos)
{
BUILD_DIR/assets/mario_anim_data.o(.data);
BUILD_DIR/assets/mario_anim_data.o(.rodata);
BUILD_DIR/assets/demo_data.o(.data);
gSoundDataADSR = .;
BUILD_DIR/sound/sound_data.ctl.o(.data);

View File

@ -7986,11 +7986,7 @@ layer_note0 38, 0x3, 127, 127
layer_delay 0x2a
layer_jump .layer_32B7
.ifndef VERSION_US
# padding
.byte 0
.endif
.align 2, 0
.envelope_32C4:
envelope_line 7 20000
envelope_line 6 32700

View File

@ -22,10 +22,6 @@
#define EU_FLOAT(x) x
#endif
#ifndef __sgi
#define GLOBAL_ASM(...)
#endif
#ifdef VERSION_EU
u8 audioString1[] = "pitch %x: delaybytes %d : olddelay %d\n";
u8 audioString2[] = "cont %x: delaybytes %d : olddelay %d\n";
@ -607,9 +603,9 @@ void unused_8031E4F0(void) {
stubbed_printf("CHANNELS %2d / MAX %3d \n", 0, 0);
stubbed_printf("TEMPOMAX %d\n", gTempoInternalToExternal / TEMPO_SCALE);
stubbed_printf("TEMPO G0 %d\n", gSequencePlayers[0].tempo / TEMPO_SCALE);
stubbed_printf("TEMPO G1 %d\n", gSequencePlayers[1].tempo / TEMPO_SCALE);
stubbed_printf("TEMPO G2 %d\n", gSequencePlayers[2].tempo / TEMPO_SCALE);
stubbed_printf("TEMPO G0 %d\n", gSequencePlayers[SEQ_PLAYER_LEVEL].tempo / TEMPO_SCALE);
stubbed_printf("TEMPO G1 %d\n", gSequencePlayers[SEQ_PLAYER_ENV].tempo / TEMPO_SCALE);
stubbed_printf("TEMPO G2 %d\n", gSequencePlayers[SEQ_PLAYER_SFX].tempo / TEMPO_SCALE);
stubbed_printf("DEBUGFLAG %8x\n", gAudioErrorFlags);
}
@ -1244,9 +1240,9 @@ u8 get_sound_reverb(UNUSED u8 bankIndex, UNUSED u8 item, u8 channelIndex) {
#ifndef VERSION_JP
}
#endif
reverb = (u8)((u8) gSequencePlayers[2].channels[channelIndex]->soundScriptIO[5]
reverb = (u8)((u8) gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[5]
+ gAreaEchoLevel[level][area]
+ (US_FLOAT(1.0) - gSequencePlayers[2].channels[channelIndex]->volume) * VAL);
+ (US_FLOAT(1.0) - gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume) * VAL);
if (reverb > 0x7f) {
reverb = 0x7f;
@ -1287,7 +1283,7 @@ void update_game_sound(void) {
process_all_sound_requests();
process_level_music_dynamics();
if (gSequencePlayers[2].channels[0] == &gSequenceChannelNone) {
if (gSequencePlayers[SEQ_PLAYER_SFX].channels[0] == &gSequenceChannelNone) {
return;
}
@ -1307,8 +1303,8 @@ void update_game_sound(void) {
gSoundBanks[bankIndex][index].soundBits++;
gSoundBanks[bankIndex][index].soundStatus = SOUND_STATUS_PLAYING;
gSequencePlayers[2].channels[channelIndex]->soundScriptIO[4] = soundId;
gSequencePlayers[2].channels[channelIndex]->soundScriptIO[0] = 1;
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[4] = soundId;
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 1;
switch (bankIndex) {
case 1:
@ -1319,7 +1315,7 @@ void update_game_sound(void) {
get_sound_dynamics(bankIndex, index, ARG2_VAL1));
#else
ret = get_sound_dynamics(bankIndex, index, ARG2_VAL1);
gSequencePlayers[2].channels[channelIndex]->volume = ret;
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = ret;
#endif
} else {
#ifdef VERSION_EU
@ -1328,7 +1324,7 @@ void update_game_sound(void) {
((D_80363808[bankIndex] + 8.0f) / 16));
#else
ret = get_sound_dynamics(bankIndex, index, ARG2_VAL1);
gSequencePlayers[2].channels[channelIndex]->volume =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
(D_80363808[bankIndex] + 8.0f) / 16 * ret;
#endif
}
@ -1337,7 +1333,7 @@ void update_game_sound(void) {
get_sound_pan(*gSoundBanks[bankIndex][index].x,
*gSoundBanks[bankIndex][index].z));
#else
gSequencePlayers[2].channels[channelIndex]->pan = get_sound_pan(
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan(
*gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z);
#endif
@ -1349,7 +1345,7 @@ void update_game_sound(void) {
((f32) D_80363808[bankIndex] / US_FLOAT(80.0)));
#else
ret = get_sound_freq_scale(bankIndex, index);
gSequencePlayers[2].channels[channelIndex]->freqScale =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
((f32) D_80363808[bankIndex] / US_FLOAT(80.0)) + ret;
#endif
} else {
@ -1359,7 +1355,7 @@ void update_game_sound(void) {
((f32) D_80363808[bankIndex] / US_FLOAT(400.0)));
#else
ret = get_sound_freq_scale(bankIndex, index);
gSequencePlayers[2].channels[channelIndex]->freqScale =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
((f32) D_80363808[bankIndex] / US_FLOAT(400.0)) + ret;
#endif
}
@ -1367,7 +1363,7 @@ void update_game_sound(void) {
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
get_sound_reverb(bankIndex, index, channelIndex));
#else
gSequencePlayers[2].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
get_sound_reverb(bankIndex, index, channelIndex);
#endif
@ -1381,9 +1377,9 @@ void update_game_sound(void) {
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
get_sound_freq_scale(bankIndex, index));
#else
gSequencePlayers[2].channels[channelIndex]->volume = 1.0f;
gSequencePlayers[2].channels[channelIndex]->pan = 0.5f;
gSequencePlayers[2].channels[channelIndex]->freqScale = 1.0f;
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:
@ -1399,13 +1395,13 @@ void update_game_sound(void) {
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
get_sound_freq_scale(bankIndex, index));
#else
gSequencePlayers[2].channels[channelIndex]->volume =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
get_sound_dynamics(bankIndex, index, ARG2_VAL1);
gSequencePlayers[2].channels[channelIndex]->pan = get_sound_pan(
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan(
*gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z);
gSequencePlayers[2].channels[channelIndex]->freqScale =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
get_sound_freq_scale(bankIndex, index);
gSequencePlayers[2].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
get_sound_reverb(bankIndex, index, channelIndex);
#endif
break;
@ -1426,13 +1422,13 @@ void update_game_sound(void) {
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
get_sound_freq_scale(bankIndex, index));
#else
gSequencePlayers[2].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
get_sound_reverb(bankIndex, index, channelIndex);
gSequencePlayers[2].channels[channelIndex]->volume =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
get_sound_dynamics(bankIndex, index, ARG2_VAL2);
gSequencePlayers[2].channels[channelIndex]->pan = get_sound_pan(
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan(
*gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z);
gSequencePlayers[2].channels[channelIndex]->freqScale =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
get_sound_freq_scale(bankIndex, index);
#endif
break;
@ -1441,23 +1437,23 @@ void update_game_sound(void) {
#ifdef VERSION_JP
else if (soundStatus == SOUND_STATUS_STOPPED) {
func_8031E0E4(bankIndex, index);
gSequencePlayers[2].channels[channelIndex]->soundScriptIO[0] = 0;
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 0;
func_8031DFE8(bankIndex, index);
}
#else
else if (gSequencePlayers[2].channels[channelIndex]->layers[0] == NULL) {
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);
} else if (soundStatus == SOUND_STATUS_STOPPED
&& gSequencePlayers[2].channels[channelIndex]->layers[0]->finished
&& gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->layers[0]->finished
== FALSE) {
func_8031E0E4(bankIndex, index);
gSequencePlayers[2].channels[channelIndex]->soundScriptIO[0] = 0;
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 0;
func_8031DFE8(bankIndex, index);
}
#endif
else if (gSequencePlayers[2].channels[channelIndex]->layers[0]->enabled == FALSE) {
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);
@ -1476,7 +1472,7 @@ void update_game_sound(void) {
get_sound_dynamics(bankIndex, index, ARG2_VAL1));
#else
ret = get_sound_dynamics(bankIndex, index, ARG2_VAL1);
gSequencePlayers[2].channels[channelIndex]->volume = ret;
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = ret;
#endif
} else {
#ifdef VERSION_EU
@ -1485,7 +1481,7 @@ void update_game_sound(void) {
((D_80363808[bankIndex] + 8.0f) / 16));
#else
ret = get_sound_dynamics(bankIndex, index, ARG2_VAL1);
gSequencePlayers[2].channels[channelIndex]->volume =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
(D_80363808[bankIndex] + 8.0f) / 16 * ret;
#endif
}
@ -1494,7 +1490,7 @@ void update_game_sound(void) {
get_sound_pan(*gSoundBanks[bankIndex][index].x,
*gSoundBanks[bankIndex][index].z));
#else
gSequencePlayers[2].channels[channelIndex]->pan = get_sound_pan(
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan(
*gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z);
#endif
@ -1506,7 +1502,7 @@ void update_game_sound(void) {
((f32) D_80363808[bankIndex] / US_FLOAT(80.0)));
#else
ret = get_sound_freq_scale(bankIndex, index);
gSequencePlayers[2].channels[channelIndex]->freqScale =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
((f32) D_80363808[bankIndex] / US_FLOAT(80.0)) + ret;
#endif
} else {
@ -1516,7 +1512,7 @@ void update_game_sound(void) {
((f32) D_80363808[bankIndex] / US_FLOAT(400.0)));
#else
ret = get_sound_freq_scale(bankIndex, index);
gSequencePlayers[2].channels[channelIndex]->freqScale =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
((f32) D_80363808[bankIndex] / US_FLOAT(400.0)) + ret;
#endif
}
@ -1524,7 +1520,7 @@ void update_game_sound(void) {
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
get_sound_reverb(bankIndex, index, channelIndex));
#else
gSequencePlayers[2].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
get_sound_reverb(bankIndex, index, channelIndex);
#endif
@ -1538,9 +1534,9 @@ void update_game_sound(void) {
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
get_sound_freq_scale(bankIndex, index));
#else
gSequencePlayers[2].channels[channelIndex]->volume = 1.0f;
gSequencePlayers[2].channels[channelIndex]->pan = 0.5f;
gSequencePlayers[2].channels[channelIndex]->freqScale = 1.0f;
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:
@ -1556,13 +1552,13 @@ void update_game_sound(void) {
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
get_sound_freq_scale(bankIndex, index));
#else
gSequencePlayers[2].channels[channelIndex]->volume =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
get_sound_dynamics(bankIndex, index, ARG2_VAL1);
gSequencePlayers[2].channels[channelIndex]->pan = get_sound_pan(
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan(
*gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z);
gSequencePlayers[2].channels[channelIndex]->freqScale =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
get_sound_freq_scale(bankIndex, index);
gSequencePlayers[2].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
get_sound_reverb(bankIndex, index, channelIndex);
#endif
break;
@ -1583,13 +1579,13 @@ void update_game_sound(void) {
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
get_sound_freq_scale(bankIndex, index));
#else
gSequencePlayers[2].channels[channelIndex]->reverb =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
get_sound_reverb(bankIndex, index, channelIndex);
gSequencePlayers[2].channels[channelIndex]->volume =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
get_sound_dynamics(bankIndex, index, ARG2_VAL2);
gSequencePlayers[2].channels[channelIndex]->pan = get_sound_pan(
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->pan = get_sound_pan(
*gSoundBanks[bankIndex][index].x, *gSoundBanks[bankIndex][index].z);
gSequencePlayers[2].channels[channelIndex]->freqScale =
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
get_sound_freq_scale(bankIndex, index);
#endif
break;
@ -1628,7 +1624,7 @@ void play_sequence(u8 player, u8 seqId, u16 fadeTimer) {
if (player == 0) {
temp_ret = func_803200E4(0);
if (temp_ret != 0xff) {
gSequencePlayers[0].fadeVolumeScale = (f32) temp_ret / US_FLOAT(127.0);
gSequencePlayers[SEQ_PLAYER_LEVEL].fadeVolumeScale = (f32) temp_ret / US_FLOAT(127.0);
}
}
#else
@ -1638,8 +1634,8 @@ void play_sequence(u8 player, u8 seqId, u16 fadeTimer) {
if (player == 0) {
temp_ret = func_803200E4(0);
if (temp_ret != 0xff) {
gSequencePlayers[0].state = SEQUENCE_PLAYER_STATE_4;
gSequencePlayers[0].fadeVolume = (f32) temp_ret / US_FLOAT(127.0);
gSequencePlayers[SEQ_PLAYER_LEVEL].state = SEQUENCE_PLAYER_STATE_4;
gSequencePlayers[SEQ_PLAYER_LEVEL].fadeVolume = (f32) temp_ret / US_FLOAT(127.0);
}
} else {
func_8031D690(player, fadeTimer);
@ -1713,16 +1709,17 @@ void func_8031F96C(u8 player) {
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
u8 i; // s1
u8 condIndex; // a0, v1
u32 tempBits; // v1
// room for 16 bits without affecting stack
func_8031F96C(0);
func_8031F96C(2);
@ -1737,65 +1734,65 @@ void process_level_music_dynamics(void) {
return;
}
conditionBits = sLevelDynamics[gCurrLevelNum][1] & 0xff00;
musicDynIndex = sLevelDynamics[gCurrLevelNum][1] & 0xff;
// 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;
i = 2;
while (conditionBits & 0xff00) {
for (j = 0, condIndex = 0, bit = 0x8000; j<8; j++, bit = bit>> 1) {
j = 0;
condIndex = 0;
bit = 0x8000;
while (j < 8) {
if (conditionBits & bit) {
conditionValues[condIndex] = sLevelDynamics[gCurrLevelNum][i++];
conditionTypes[condIndex] = j;
condIndex++;
}
j++;
bit = bit >> 1;
}
// condIndex uses a0 (the same register as 'bit') instead of v1
for (j = 0; j < condIndex; j++) {
// (having all 'temp' share a single variable affects regalloc)
switch (conditionTypes[j]) {
case MARIO_X_GE: {
s16 temp = gMarioStates[0].pos[0];
if (temp < conditionValues[j])
if (((s16) gMarioStates[0].pos[0]) < conditionValues[j])
j = condIndex + 1;
break;
}
case MARIO_Y_GE: {
s16 temp = gMarioStates[0].pos[1];
if (temp < conditionValues[j])
if (((s16) gMarioStates[0].pos[1]) < conditionValues[j])
j = condIndex + 1;
break;
}
case MARIO_Z_GE: {
s16 temp = gMarioStates[0].pos[2];
if (temp < conditionValues[j])
if (((s16) gMarioStates[0].pos[2]) < conditionValues[j])
j = condIndex + 1;
break;
}
case MARIO_X_LT: {
s16 temp = gMarioStates[0].pos[0];
if (temp >= conditionValues[j])
if (((s16) gMarioStates[0].pos[0]) >= conditionValues[j])
j = condIndex + 1;
break;
}
case MARIO_Y_LT: {
s16 temp = gMarioStates[0].pos[1];
if (temp >= conditionValues[j])
if (((s16) gMarioStates[0].pos[1]) >= conditionValues[j])
j = condIndex + 1;
break;
}
case MARIO_Z_LT: {
s16 temp = gMarioStates[0].pos[2];
if (temp >= conditionValues[j])
if (((s16) gMarioStates[0].pos[2]) >= conditionValues[j])
j = condIndex + 1;
break;
}
case MARIO_IS_IN_AREA: {
// s16 temp = gCurrAreaIndex;
if (gCurrAreaIndex != conditionValues[j])
j = condIndex + 1;
break;
}
case MARIO_IS_IN_ROOM: {
// s16 temp = gMarioCurrentRoom;
if (gMarioCurrentRoom != conditionValues[j])
j = condIndex + 1;
break;
@ -1807,15 +1804,18 @@ void process_level_music_dynamics(void) {
// The area matches. Break out of the loop.
tempBits = 0;
} else {
tempBits = sLevelDynamics[gCurrLevelNum][i];
// 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;
i++;
musicDynIndex = tempBits & 0xff, tempBits &= 0xff00;
}
conditionBits = tempBits;
}
if (musicDynIndex != sCurrentMusicDynamic) {
if (sCurrentMusicDynamic != musicDynIndex) {
// bit keeps using a0, should use v1
bit = 1;
if (sCurrentMusicDynamic == 0xff) {
dur1 = 1;
@ -1827,10 +1827,12 @@ void process_level_music_dynamics(void) {
for (i = 0; i < CHANNELS_MAX; i++) {
if (sMusicDynamics[musicDynIndex].bits1 & bit) {
fade_channel_volume_scale(0, i, sMusicDynamics[musicDynIndex].volScale1, dur1);
// 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);
}
if (sMusicDynamics[musicDynIndex].bits2 & bit) {
fade_channel_volume_scale(0, i, sMusicDynamics[musicDynIndex].volScale2, dur2);
fade_channel_volume_scale(SEQ_PLAYER_LEVEL, i, sMusicDynamics[musicDynIndex].volScale2, dur2);
}
bit <<= 1;
}
@ -1896,8 +1898,8 @@ u8 func_803200E4(u16 fadeTimer) {
return 0xff;
}
if (gSequencePlayers[0].volume == 0.0f && fadeTimer) {
gSequencePlayers[0].volume = gSequencePlayers[0].fadeVolume;
if (gSequencePlayers[SEQ_PLAYER_LEVEL].volume == 0.0f && fadeTimer) {
gSequencePlayers[SEQ_PLAYER_LEVEL].volume = gSequencePlayers[SEQ_PLAYER_LEVEL].fadeVolume;
}
if (D_80363812 != 0) {
@ -1919,14 +1921,14 @@ u8 func_803200E4(u16 fadeTimer) {
vol = 20;
}
if (gSequencePlayers[0].enabled == TRUE) {
if (gSequencePlayers[SEQ_PLAYER_LEVEL].enabled == TRUE) {
if (vol != 0xff) {
func_8031D838(0, fadeTimer, vol);
func_8031D838(SEQ_PLAYER_LEVEL, fadeTimer, vol);
} else {
#if defined(VERSION_JP) || defined(VERSION_US)
gSequencePlayers[0].volume = sBackgroundMusicDefaultVolume[sPlayer0CurSeqId] / 127.0f;
gSequencePlayers[SEQ_PLAYER_LEVEL].volume = sBackgroundMusicDefaultVolume[sPlayer0CurSeqId] / 127.0f;
#endif
func_8031D7B0(0, fadeTimer);
func_8031D7B0(SEQ_PLAYER_LEVEL, fadeTimer);
}
}
return vol;
@ -2130,7 +2132,7 @@ void play_dialog_sound(u8 dialogID) {
play_sound(sDialogSpeakerVoice[speaker], gDefaultSoundArgs);
if (speaker == 2) // SOUND_OBJ_BOWSER_INTRO_LAUGH
{
play_sequence(1, SEQ_EVENT_KOOPA_MESSAGE, 0);
play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_KOOPA_MESSAGE, 0);
}
}
@ -2166,8 +2168,8 @@ 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(0, seqId, fadeTimer);
} else if (!gSequencePlayers[0].enabled) {
play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer);
} else if (!gSequencePlayers[SEQ_PLAYER_LEVEL].enabled) {
stop_background_music(sBackgroundMusicQueue[0].seqId);
}
return;
@ -2185,7 +2187,7 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
// If the sequence ends up first in the queue, start it, and make space for
// more entries in the queue.
if (foundIndex == 0) {
play_sequence(0, seqId, fadeTimer);
play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer);
sBackgroundMusicQueueSize++;
}
@ -2221,9 +2223,9 @@ void stop_background_music(u16 seqId) {
sBackgroundMusicQueueSize--;
if (i == 0) {
if (sBackgroundMusicQueueSize != 0) {
play_sequence(0, sBackgroundMusicQueue[1].seqId, 0);
play_sequence(SEQ_PLAYER_LEVEL, sBackgroundMusicQueue[1].seqId, 0);
} else {
sequence_player_fade_out(0, 20);
sequence_player_fade_out(SEQ_PLAYER_LEVEL, 20);
}
}
foundIndex = i;
@ -2244,7 +2246,7 @@ void stop_background_music(u16 seqId) {
void fadeout_background_music(u16 seqId, u16 fadeOut) {
if (sBackgroundMusicQueueSize != 0 && sBackgroundMusicQueue[0].seqId == (u8)(seqId & 0xff)) {
sequence_player_fade_out(0, fadeOut);
sequence_player_fade_out(SEQ_PLAYER_LEVEL, fadeOut);
}
}
@ -2267,9 +2269,9 @@ void func_80320ED8(void) {
D_EU_80300558--;
}
if (gSequencePlayers[1].enabled || D_8033211C == 0 || D_EU_80300558 != 0) {
if (gSequencePlayers[SEQ_PLAYER_ENV].enabled || D_8033211C == 0 || D_EU_80300558 != 0) {
#else
if (gSequencePlayers[1].enabled || D_8033211C == 0) {
if (gSequencePlayers[SEQ_PLAYER_ENV].enabled || D_8033211C == 0) {
#endif
return;
}
@ -2279,9 +2281,9 @@ void func_80320ED8(void) {
if (D_80363812 != 0
&& (D_80332120 == SEQ_EVENT_MERRY_GO_ROUND || D_80332120 == SEQ_EVENT_PIRANHA_PLANT)) {
play_sequence(1, D_80332120, 1);
play_sequence(SEQ_PLAYER_ENV, D_80332120, 1);
if (D_80332124 != 0xff) {
func_8031D838(1, 1, D_80332124);
func_8031D838(SEQ_PLAYER_ENV, 1, D_80332124);
}
}
}
@ -2297,16 +2299,16 @@ void play_secondary_music(u8 seqId, u8 bgMusicVolume, u8 volume, u16 fadeTimer)
if (D_80363812 == 0) {
D_80363812 = bgMusicVolume + 0x80;
func_803200E4(fadeTimer);
play_sequence(1, seqId, fadeTimer >> 1);
play_sequence(SEQ_PLAYER_ENV, seqId, fadeTimer >> 1);
if (volume < 0x80) {
func_8031D838(1, fadeTimer, volume);
func_8031D838(SEQ_PLAYER_ENV, fadeTimer, volume);
}
D_80332124 = volume;
D_80332120 = seqId;
} else if (volume != 0xff) {
D_80363812 = bgMusicVolume + 0x80;
func_803200E4(fadeTimer);
func_8031D838(1, fadeTimer, volume);
func_8031D838(SEQ_PLAYER_ENV, fadeTimer, volume);
D_80332124 = volume;
}
}
@ -2317,7 +2319,7 @@ void func_80321080(u16 fadeTimer) {
D_80332120 = 0;
D_80332124 = 0;
func_803200E4(fadeTimer);
sequence_player_fade_out(1, fadeTimer);
sequence_player_fade_out(SEQ_PLAYER_ENV, fadeTimer);
}
}
@ -2328,31 +2330,31 @@ void func_803210D4(u16 fadeOutTime) {
return;
}
if (gSequencePlayers[0].enabled == TRUE) {
if (gSequencePlayers[SEQ_PLAYER_LEVEL].enabled == TRUE) {
#ifdef VERSION_EU
func_802ad74c(0x83000000, fadeOutTime);
#else
sequence_player_fade_out_internal(0, fadeOutTime);
sequence_player_fade_out_internal(SEQ_PLAYER_LEVEL, fadeOutTime);
#endif
}
if (gSequencePlayers[1].enabled == TRUE) {
if (gSequencePlayers[SEQ_PLAYER_ENV].enabled == TRUE) {
#ifdef VERSION_EU
func_802ad74c(0x83010000, fadeOutTime);
#else
sequence_player_fade_out_internal(1, fadeOutTime);
sequence_player_fade_out_internal(SEQ_PLAYER_ENV, fadeOutTime);
#endif
}
for (i = 0; i < SOUND_BANK_COUNT; i++) {
if (i != 7) {
fade_channel_volume_scale(2, i, 0, fadeOutTime / 16);
fade_channel_volume_scale(SEQ_PLAYER_SFX, i, 0, fadeOutTime / 16);
}
}
sHasStartedFadeOut = TRUE;
}
void play_course_clear(void) {
play_sequence(1, SEQ_EVENT_CUTSCENE_COLLECT_STAR, 0);
play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_CUTSCENE_COLLECT_STAR, 0);
D_8033211C = 0x80 | 0;
#ifdef VERSION_EU
D_EU_80300558 = 2;
@ -2361,7 +2363,7 @@ void play_course_clear(void) {
}
void play_peachs_jingle(void) {
play_sequence(1, SEQ_EVENT_PEACH_MESSAGE, 0);
play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_PEACH_MESSAGE, 0);
D_8033211C = 0x80 | 0;
#ifdef VERSION_EU
D_EU_80300558 = 2;
@ -2375,7 +2377,7 @@ void play_peachs_jingle(void) {
* yoshi, releasing chain chomp, opening the pyramid top, etc.
*/
void play_puzzle_jingle(void) {
play_sequence(1, SEQ_EVENT_SOLVE_PUZZLE, 0);
play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_SOLVE_PUZZLE, 0);
D_8033211C = 0x80 | 20;
#ifdef VERSION_EU
D_EU_80300558 = 2;
@ -2384,7 +2386,7 @@ void play_puzzle_jingle(void) {
}
void play_star_fanfare(void) {
play_sequence(1, SEQ_EVENT_HIGH_SCORE, 0);
play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_HIGH_SCORE, 0);
D_8033211C = 0x80 | 20;
#ifdef VERSION_EU
D_EU_80300558 = 2;
@ -2396,7 +2398,7 @@ void play_power_star_jingle(u8 arg0) {
if (!arg0) {
D_80363812 = 0;
}
play_sequence(1, SEQ_EVENT_CUTSCENE_STAR_SPAWN, 0);
play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_CUTSCENE_STAR_SPAWN, 0);
D_8033211C = 0x80 | 20;
#ifdef VERSION_EU
D_EU_80300558 = 2;
@ -2405,7 +2407,7 @@ void play_power_star_jingle(u8 arg0) {
}
void play_race_fanfare(void) {
play_sequence(1, SEQ_EVENT_RACE, 0);
play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_RACE, 0);
D_8033211C = 0x80 | 20;
#ifdef VERSION_EU
D_EU_80300558 = 2;
@ -2414,7 +2416,7 @@ void play_race_fanfare(void) {
}
void play_toads_jingle(void) {
play_sequence(1, SEQ_EVENT_TOAD_MESSAGE, 0);
play_sequence(SEQ_PLAYER_ENV, SEQ_EVENT_TOAD_MESSAGE, 0);
D_8033211C = 0x80 | 20;
#ifdef VERSION_EU
D_EU_80300558 = 2;
@ -2443,7 +2445,7 @@ 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(2, SEQ_SOUND_PLAYER, 0);
play_sequence(SEQ_PLAYER_SFX, SEQ_SOUND_PLAYER, 0);
D_80332108 = (D_80332108 & 0xf0) + presetId;
gSoundMode = D_80332108 >> 4;
sHasStartedFadeOut = FALSE;

View File

@ -12,6 +12,10 @@
#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
extern s32 gAudioErrorFlags;
extern f32 gDefaultSoundArgs[3];

View File

@ -527,6 +527,12 @@ struct Note
/* , 0xB0*/ struct NoteSubEu noteSubEu;
}; // size = 0xC0
#else
struct vNote
{
/* U/J, EU */
/*0x00*/ volatile u8 enabled : 1;
long long int force_structure_alignment;
}; // size = 0xC0
struct Note
{
/* U/J, EU */

View File

@ -24,15 +24,15 @@
#define aSetLoadBufferPair(pkt, c, off) \
aSetBuffer(pkt, 0, c + DMEM_ADDR_WET_LEFT_CH, 0, DEFAULT_LEN_1CH - c); \
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverb.ringBuffer.left[off])); \
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.left + (off))); \
aSetBuffer(pkt, 0, c + DMEM_ADDR_WET_RIGHT_CH, 0, DEFAULT_LEN_1CH - c); \
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverb.ringBuffer.right[off]));
aLoadBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.right + (off)))
#define aSetSaveBufferPair(pkt, c, d, off) \
aSetBuffer(pkt, 0, 0, c + DMEM_ADDR_WET_LEFT_CH, d); \
aSaveBuffer(pkt, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverb.ringBuffer.left[off])); \
aSaveBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.left + (off))); \
aSetBuffer(pkt, 0, 0, c + DMEM_ADDR_WET_RIGHT_CH, d); \
aSaveBuffer(pkt, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverb.ringBuffer.right[off]));
aSaveBuffer(pkt, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.ringBuffer.right + (off)));
#define ALIGN(val, amnt) (((val) + (1 << amnt) - 1) & ~((1 << amnt) - 1))
@ -48,7 +48,7 @@ u64 *synthesis_do_one_audio_update(u16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI
u64 *synthesis_process_note(struct Note *note, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, u16 *aiBuf, s32 bufLen, u64 *cmd);
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);
u64 *process_envelope(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, u32 flags);
u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight);
#else
u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd);
@ -166,17 +166,17 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex) {
}
item = &gSynthesisReverb.items[gSynthesisReverb.curFrame][updateIndex];
numSamplesAfterDownsampling = nSamples = chunkLen / gReverbDownsampleRate;
if (((nSamples + gSynthesisReverb.nextRingBufferPos) - gSynthesisReverb.bufSizePerChannel) < 0) {
numSamplesAfterDownsampling = chunkLen / gReverbDownsampleRate;
if (((numSamplesAfterDownsampling + gSynthesisReverb.nextRingBufferPos) - gSynthesisReverb.bufSizePerChannel) < 0) {
// There is space in the ring buffer before it wraps around
item->lengths[0] = nSamples * 2;
item->lengths[0] = numSamplesAfterDownsampling * 2;
item->lengths[1] = 0;
item->startPos = (s32) gSynthesisReverb.nextRingBufferPos;
gSynthesisReverb.nextRingBufferPos += nSamples;
gSynthesisReverb.nextRingBufferPos += numSamplesAfterDownsampling;
} else {
// Ring buffer wrapped around
excessiveSamples =
(nSamples + gSynthesisReverb.nextRingBufferPos) - gSynthesisReverb.bufSizePerChannel;
(numSamplesAfterDownsampling + gSynthesisReverb.nextRingBufferPos) - gSynthesisReverb.bufSizePerChannel;
nSamples = numSamplesAfterDownsampling - excessiveSamples;
item->lengths[0] = nSamples * 2;
item->lengths[1] = excessiveSamples * 2;
@ -309,19 +309,18 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen) {
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen) {
s32 chunkLen;
s32 i;
s32 remaining = bufLen;
u32 *aiBufPtr = (u32 *) aiBuf;
u64 *cmd = cmdBuf;
u64 *cmd = cmdBuf + 1;
s32 v0;
aSegment(cmd++, 0, 0);
aSegment(cmdBuf, 0, 0);
for (i = gAudioUpdatesPerFrame; i > 0; i--) {
if (i == 1) {
// 'remaining' will automatically be divisible by 8, no need to round
chunkLen = remaining;
// 'bufLen' will automatically be divisible by 8, no need to round
chunkLen = bufLen;
} else {
v0 = remaining / i;
v0 = bufLen / i;
// chunkLen = v0 rounded to nearest multiple of 8
chunkLen = v0 - (v0 & 7);
@ -334,7 +333,7 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen) {
prepare_reverb_ring_buffer(chunkLen, gAudioUpdatesPerFrame - i);
}
cmd = synthesis_do_one_audio_update((u16 *) aiBufPtr, chunkLen, cmd, gAudioUpdatesPerFrame - i);
remaining -= chunkLen;
bufLen -= chunkLen;
aiBufPtr += chunkLen;
}
if (gSynthesisReverb.framesLeftToIgnore != 0) {
@ -502,12 +501,12 @@ u64 *synthesis_do_one_audio_update(u16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI
s16 t4;
UNUSED s32 pad[2];
struct ReverbRingBufferItem *v1;
UNUSED s32 pad2[2];
UNUSED s32 pad2[1];
s16 temp;
v1 = &gSynthesisReverb.items[gSynthesisReverb.curFrame][updateIndex];
if (gSynthesisReverb.useReverb == 0) {
aClearBuffer(cmd++, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
cmd = synthesis_process_notes(aiBuf, bufLen, cmd);
} else {
@ -517,6 +516,7 @@ u64 *synthesis_do_one_audio_update(u16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI
if (v1->lengths[1] != 0) {
// Ring buffer wrapped
aSetLoadBufferPair(cmd++, v1->lengths[0], 0);
temp = 0;
}
// Use the reverb sound as initial sound for this audio update
@ -530,22 +530,25 @@ u64 *synthesis_do_one_audio_update(u16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI
/*out*/ DMEM_ADDR_WET_LEFT_CH);
} else {
// Same as above but upsample the previously downsampled samples used for reverb first
temp = 0; //! jesus christ
t4 = (v1->startPos & 7) * 2;
ra = ALIGN(v1->lengths[0] + t4, 4);
aSetLoadBufferPair(cmd++, 0, v1->startPos - t4 / 2);
if (v1->lengths[1] != 0) {
// Ring buffer wrapped
aSetLoadBufferPair(cmd++, ra, 0);
//! We need an empty statement (even an empty ';') here to make the function match (because IDO).
//! However, copt removes extraneous statements and dead code. So we need to trick copt
//! into thinking 'temp' could be undefined, and luckily the compiler optimizes out the
//! useless assignment.
ra = ra + temp;
}
aSetBuffer(cmd++, 0, t4 + DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, bufLen << 1);
aResample(cmd++, gSynthesisReverb.resampleFlags, (u16) gSynthesisReverb.resampleRate,
VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.resampleStateLeft));
aResample(cmd++, gSynthesisReverb.resampleFlags, (u16) gSynthesisReverb.resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.resampleStateLeft));
aSetBuffer(cmd++, 0, t4 + DMEM_ADDR_WET_RIGHT_CH, DMEM_ADDR_RIGHT_CH, bufLen << 1);
aResample(cmd++, gSynthesisReverb.resampleFlags, (u16) gSynthesisReverb.resampleRate,
VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.resampleStateRight));
aResample(cmd++, gSynthesisReverb.resampleFlags, (u16) gSynthesisReverb.resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.resampleStateRight));
aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH);
aMix(cmd++, 0, /*gain*/ 0x8000 + gSynthesisReverb.reverbGain, /*in*/ DMEM_ADDR_LEFT_CH,
/*out*/ DMEM_ADDR_LEFT_CH);
aMix(cmd++, 0, /*gain*/ 0x8000 + gSynthesisReverb.reverbGain, /*in*/ DMEM_ADDR_LEFT_CH, /*out*/ DMEM_ADDR_LEFT_CH);
aDMEMMove(cmd++, DMEM_ADDR_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
}
cmd = synthesis_process_notes(aiBuf, bufLen, cmd);
@ -559,10 +562,7 @@ u64 *synthesis_do_one_audio_update(u16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI
// 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(
gSynthesisReverb.items[gSynthesisReverb.curFrame][updateIndex].toDownsampleLeft));
aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(gSynthesisReverb.items[gSynthesisReverb.curFrame][updateIndex].toDownsampleLeft));
gSynthesisReverb.resampleFlags = 0;
}
}
@ -570,50 +570,75 @@ u64 *synthesis_do_one_audio_update(u16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateI
}
#endif
#ifdef NON_MATCHING
#ifdef VERSION_EU
// Processes just one note, not all
u64 *synthesis_process_note(struct Note *note, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, UNUSED u16 *aiBuf, s32 bufLen, u64 *cmd) {
UNUSED s32 pad0[3];
#else
u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
s32 noteIndex; // sp174
struct Note *note; // s7
UNUSED u8 pad0[0x08];
#endif
struct AudioBankSample *audioBookSample; // sp164
struct AdpcmLoop *loopInfo; // sp160
s16 *curLoadedBook; // sp15C
s32 noteFinished; // 150 t2
s32 restart; // 14c t3
s32 flags; // sp148
UNUSED u8 pad8[0x14];
s32 sp130;
UNUSED u8 pad7[0xC];
u8 *sampleAddr; // sp120
u32 samplesLenAdjusted; // 108, definitely unsigned, t5
// UNUSED u8 pad6[4];
s32 endPos; // sp110
s32 nSamplesToProcess; // 10c a0
// UNUSED u8 pad5[0x10c - 0xe8 - 4];
s32 nParts; // spE8
s32 curPart; // spE4
u32 nAdpcmSamplesProcessed; // probably unsigned, fp
struct AudioBankSample *audioBookSample; // sp164, sp138
struct AdpcmLoop *loopInfo; // sp160, sp134
s16 *curLoadedBook = NULL; // sp154, sp130
#ifdef VERSION_EU
UNUSED u8 padEU[0x04];
#endif
UNUSED u8 pad8[0x04];
#ifndef VERSION_EU
u16 resamplingRateFixedPoint; // sp5c, sp11A
#endif
s32 noteFinished; // 150 t2, sp124
s32 restart; // 14c t3, sp120
s32 flags; // sp148, sp11C
#ifdef VERSION_EU
u16 resamplingRateFixedPoint; // sp5c, sp11A
#endif
UNUSED u8 pad7[0x0c]; // sp100
UNUSED s32 tempBufLen;
#ifdef VERSION_EU
s32 sp130; //sp128, sp104
UNUSED u32 pad9;
#else
UNUSED u32 pad9;
s32 sp130; //sp128, sp104
#endif
s32 nAdpcmSamplesProcessed; // signed required for US
s32 t0;
s32 resampledTempLen; // spD8
u16 noteSamplesDmemAddrBeforeResampling; // spD6
#ifdef VERSION_EU
u8 *sampleAddr; // sp120, spF4
s32 s6;
#else
s32 s6;
u8 *sampleAddr; // sp120, spF4
#endif
// sp6c is a temporary!
u16 resamplingRateFixedPoint; // sp5c
s32 samplesLenInt; // sp58
s32 onePart; // sp54
s32 s6;
s32 s6_2;
#ifdef 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
UNUSED s32 samplesLenInt;
s32 endPos; // sp110, spE4
s32 nSamplesToProcess; // sp10c/a0, spE0
s32 s2;
#else
// 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 samplesLenAdjusted; // 108
s32 s2;
s32 endPos; // sp110, spE4
s32 nSamplesToProcess; // sp10c/a0, spE0
#endif
s32 s0;
s32 s3;
s32 s5;
// s32 v0;
s32 s5; //s4
u32 samplesLenFixedPoint; // v1_1
s32 nSamplesInThisIteration; // v1_2
u32 a3;
@ -621,30 +646,42 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
s32 t9;
#endif
u8 *v0_2;
s32 nParts; // spE8, spBC
s32 curPart; // spE4, spB8
#ifndef VERSION_EU
f32 resamplingRate; // f12
#endif
UNUSED s32 temp;
s32 temp;
#ifdef VERSION_EU
curLoadedBook = NULL;
s32 s5Aligned;
#endif
s32 resampledTempLen; // spD8, spAC
u16 noteSamplesDmemAddrBeforeResampling; // spD6, spAA
#ifndef VERSION_EU
for (noteIndex = 0, curLoadedBook = NULL; noteIndex < gMaxSimultaneousNotes; noteIndex++) {
for (noteIndex = 0; noteIndex < gMaxSimultaneousNotes; noteIndex++) {
note = &gNotes[noteIndex];
if (IS_BANK_LOAD_COMPLETE(note->bankId) == FALSE) {
gAudioErrorFlags = (note->bankId << 8) + noteIndex + 0x1000000;
} else if (note->enabled) {
#ifdef VERSION_US
//! This function requires note->enabled to be volatile, but it breaks other functions like note_enable.
//! Casting to a struct with just the volatile bitfield works, but there may be a better way to match.
if (((struct vNote *)note)->enabled && IS_BANK_LOAD_COMPLETE(note->bankId) == FALSE) {
#else
if (noteSubEu->enabled) {
if (IS_BANK_LOAD_COMPLETE(note->bankId) == FALSE) {
#endif
gAudioErrorFlags = (note->bankId << 8) + noteIndex + 0x1000000;
} else if (((struct vNote *)note)->enabled) {
#else
if (note->noteSubEu.enabled == FALSE) {
return cmd;
} else {
#endif
// This matches much much better if enabled is volatile... but that
// breaks other functions (e.g. note_enable). Can we achieve the
// volatile effect in some other way?
flags = 0;
#ifdef VERSION_EU
tempBufLen = bufLen;
#endif
#ifdef VERSION_EU
if (noteSubEu->needsInit == TRUE) {
@ -684,28 +721,26 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
resamplingRateFixedPoint = (u16)(s32)(resamplingRate * 32768.0f);
samplesLenFixedPoint = note->samplePosFrac + (resamplingRateFixedPoint * bufLen) * 2;
note->samplePosFrac = samplesLenFixedPoint; // 16-bit store, can't reuse
note->samplePosFrac = samplesLenFixedPoint & 0xFFFF; // 16-bit store, can't reuse
#else
resamplingRateFixedPoint = noteSubEu->resamplingRateFixedPoint;
nParts = noteSubEu->hasTwoAdpcmParts + 1;
samplesLenFixedPoint = synthesisState->samplePosFrac + (resamplingRateFixedPoint * bufLen) * 2;
synthesisState->samplePosFrac = samplesLenFixedPoint;
samplesLenFixedPoint = (resamplingRateFixedPoint * tempBufLen * 2) + synthesisState->samplePosFrac;
synthesisState->samplePosFrac = samplesLenFixedPoint & 0xFFFF;
#endif
#ifdef VERSION_EU
if (noteSubEu->isSyntheticWave) {
noteSamplesDmemAddrBeforeResampling =
DMEM_ADDR_UNCOMPRESSED_NOTE + synthesisState->samplePosInt * 2;
synthesisState->samplePosInt += (samplesLenFixedPoint >> 0x10);
cmd = load_wave_samples(cmd, noteSubEu, synthesisState, samplesLenFixedPoint >> 0x10);
noteSamplesDmemAddrBeforeResampling = (synthesisState->samplePosInt * 2) + DMEM_ADDR_UNCOMPRESSED_NOTE;
synthesisState->samplePosInt += samplesLenFixedPoint >> 0x10;
}
#else
if (note->sound == NULL) {
// A wave synthesis note (not ADPCM)
// samplesLenFixedPoint >> 0x10 stored in s0
cmd = load_wave_samples(cmd, note, samplesLenFixedPoint >> 0x10);
noteSamplesDmemAddrBeforeResampling =
DMEM_ADDR_UNCOMPRESSED_NOTE + note->samplePosInt * 2;
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_UNCOMPRESSED_NOTE + note->samplePosInt * 2;
note->samplePosInt += (samplesLenFixedPoint >> 0x10);
flags = 0;
}
@ -719,46 +754,31 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
audioBookSample = note->sound->sample;
#endif
// sp58 is a low-numbered register, so possibly a temporary.
// Should it be used for samplesLenFixedPoint >> 0x10 above as well? But then
// the asm matches worse. This variable seems to highly involved
// in causing this function not to match...
samplesLenInt = samplesLenFixedPoint >> 0x10; // v0 // sp58
loopInfo = audioBookSample->loop;
endPos = loopInfo->end;
sampleAddr = audioBookSample->sampleAddr;
onePart = (nParts == 1);
resampledTempLen = 0;
for (curPart = 0; curPart < nParts; curPart++) {
nAdpcmSamplesProcessed = 0;
s5 = 0;
nAdpcmSamplesProcessed = 0; // s8
s5 = 0; // s4
// This whole if-else if chain is weird. First it uses onePart
// instead of nParts == 1, and it needs a weird if to not
// induce non-matchings all over the rest of the function.
// Then it induces a bunch of stack-relative loads that
// shouldn't be there. Finally, it relates to sp58, which
// behaves very oddly...
if (onePart) { // nParts == 1
if (1) { // shouldn't be here, but it makes things line up better...
samplesLenAdjusted = samplesLenInt;
}
} else if (samplesLenInt & 1) {
samplesLenAdjusted = (samplesLenInt & ~1) + (curPart * 2);
} else {
samplesLenAdjusted = samplesLenInt;
if (nParts == 1) {
samplesLenAdjusted = samplesLenFixedPoint >> 0x10;
} else if ((samplesLenFixedPoint >> 0x10) & 1) {
samplesLenAdjusted = ((samplesLenFixedPoint >> 0x10) & ~1) + (curPart * 2);
}
else {
samplesLenAdjusted = (samplesLenFixedPoint >> 0x10);
}
if (curLoadedBook != audioBookSample->book->book) {
u32 nEntries; // v1
curLoadedBook = audioBookSample->book->book;
nEntries = audioBookSample->book->order * audioBookSample->book->npredictors;
#ifdef VERSION_EU
aLoadADPCM(cmd++, nEntries * 16, VIRTUAL_TO_PHYSICAL2(curLoadedBook + noteSubEu->bookOffset));
nEntries = 16 * audioBookSample->book->order * audioBookSample->book->npredictors;
aLoadADPCM(cmd++, nEntries, VIRTUAL_TO_PHYSICAL2(curLoadedBook + noteSubEu->bookOffset));
#else
nEntries = audioBookSample->book->order * audioBookSample->book->npredictors;
aLoadADPCM(cmd++, nEntries * 16, VIRTUAL_TO_PHYSICAL2(curLoadedBook));
#endif
}
@ -772,7 +792,7 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
while (nAdpcmSamplesProcessed != samplesLenAdjusted) {
s32 samplesRemaining; // v1
s32 s0;
// sp58 = sp58; here, doesn't happen
noteFinished = FALSE;
restart = FALSE;
nSamplesToProcess = samplesLenAdjusted - nAdpcmSamplesProcessed;
@ -785,11 +805,11 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
#endif
#ifdef VERSION_EU
if (s2 == 0 && !synthesisState->restart) {
if (s2 == 0 && synthesisState->restart == FALSE) {
s2 = 16;
}
#else
if (s2 == 0 && !note->restart) {
if (s2 == 0 && note->restart == FALSE) {
s2 = 16;
}
#endif
@ -800,7 +820,11 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
s0 = t0 * 16;
s3 = s6 + s0 - nSamplesToProcess;
} else {
#ifndef VERSION_EU
s0 = samplesRemaining + s2 - 0x10;
#else
s0 = samplesRemaining - s6;
#endif
s3 = 0;
if (s0 <= 0) {
s0 = 0;
@ -815,24 +839,20 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
}
}
// Improve regalloc for saved registers. Probably
// shouldn't be here, but it gives nicer diffs for now.
s6_2 = s6;
if (t0 != 0) {
// maybe keep a var for t0 * 9?
#ifdef VERSION_EU
temp = (synthesisState->samplePosInt - s2 + 0x10) / 16;
if (audioBookSample->loaded == 0x81) {
v0_2 = sampleAddr + (synthesisState->samplePosInt - s2 + 0x10) / 16 * 9;
v0_2 = sampleAddr + temp * 9;
} else {
v0_2 = dma_sample_data(
(uintptr_t) (sampleAddr + (synthesisState->samplePosInt - s2 + 0x10) / 16 * 9),
(uintptr_t) (sampleAddr + temp * 9),
t0 * 9, flags, &synthesisState->sampleDmaIndex);
a3 = (u32)((uintptr_t) v0_2 & 0xf);
}
#else
temp = (note->samplePosInt - s2 + 0x10) / 16;
v0_2 = dma_sample_data(
(uintptr_t) (sampleAddr + (note->samplePosInt - s2 + 0x10) / 16 * 9),
(uintptr_t) (sampleAddr + temp * 9),
t0 * 9, flags, &note->sampleDmaIndex);
#endif
a3 = (u32)((uintptr_t) v0_2 & 0xf);
@ -849,61 +869,60 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
flags = A_LOOP; // = 2
synthesisState->restart = FALSE;
}
if (nAdpcmSamplesProcessed == 0) {
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3,
DMEM_ADDR_UNCOMPRESSED_NOTE, s0 * 2);
aADPCMdec(cmd++, flags,
VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
sp130 = s2 * 2;
} else {
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3,
DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5), s0 * 2);
aADPCMdec(cmd++, flags,
VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5) + (s2 * 2),
DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (s0 + s6_2 - s3) * 2);
}
#else
if (note->restart != FALSE) {
aSetLoop(cmd++, VIRTUAL_TO_PHYSICAL2(audioBookSample->loop->state));
flags = A_LOOP; // = 2
note->restart = FALSE;
}
#endif
nSamplesInThisIteration = s0 + s6 - s3;
#ifdef VERSION_EU
if (nAdpcmSamplesProcessed == 0) {
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3,
DMEM_ADDR_UNCOMPRESSED_NOTE, s0 * 2);
aADPCMdec(cmd++, flags,
VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->adpcmdecState));
VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
sp130 = s2 * 2;
} else {
s5Aligned = ALIGN(s5, 5);
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3,
DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5), s0 * 2);
DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned, s0 * 2);
aADPCMdec(cmd++, flags,
VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->adpcmdecState));
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5) + (s2 * 2),
DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (s0 + s6_2 - s3) * 2);
VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->adpcmdecState));
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned + (s2 * 2),
DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2);
}
#else
if (nAdpcmSamplesProcessed == 0) {
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3, DMEM_ADDR_UNCOMPRESSED_NOTE, s0 * 2);
aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->adpcmdecState));
sp130 = s2 * 2;
} else {
aSetBuffer(cmd++, 0, DMEM_ADDR_COMPRESSED_ADPCM_DATA + a3, DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5), s0 * 2);
aADPCMdec(cmd++, flags, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->adpcmdecState));
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + ALIGN(s5, 5) + (s2 * 2), DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2);
}
#endif
nAdpcmSamplesProcessed = nAdpcmSamplesProcessed + s0 + s6_2 - s3;
nSamplesInThisIteration = s0 + s6_2 - s3;
nAdpcmSamplesProcessed += nSamplesInThisIteration;
switch (flags) {
case A_INIT: // = 1
sp130 = 0;
s5 += s0 * 2;
s5 = s0 * 2 + s5;
break;
case A_LOOP: // = 2
s5 += nSamplesInThisIteration * 2;
s5 = nSamplesInThisIteration * 2 + s5;
break;
default:
if (s5 != 0) {
s5 += nSamplesInThisIteration * 2;
s5 = nSamplesInThisIteration * 2 + s5;
} else {
s5 = (nSamplesInThisIteration + s2) * 2;
s5 = (s2 + nSamplesInThisIteration) * 2;
}
break;
}
@ -919,9 +938,9 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
#else
note->samplePosInt = 0;
note->finished = 1;
note->enabled = 0;
((struct vNote *)note)->enabled = 0;
#endif
break; // goto? doesn't matter, though
break;
}
#ifdef VERSION_EU
if (restart) {
@ -948,33 +967,27 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
case 2:
switch (curPart) {
case 0:
aSetBuffer(cmd++, 0, DMEM_ADDR_UNCOMPRESSED_NOTE + sp130,
DMEM_ADDR_ADPCM_RESAMPLED, samplesLenAdjusted + 4);
aSetBuffer(cmd++, 0, DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, DMEM_ADDR_ADPCM_RESAMPLED, samplesLenAdjusted + 4);
#ifdef VERSION_EU
aResample(cmd++, A_INIT, 0xff60,
VIRTUAL_TO_PHYSICAL2(
synthesisState->synthesisBuffers->dummyResampleState));
aResample(cmd++, A_INIT, 0xff60, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->dummyResampleState));
#else
aResample(cmd++, A_INIT, 0xff60,
VIRTUAL_TO_PHYSICAL2(
note->synthesisBuffers->dummyResampleState));
aResample(cmd++, A_INIT, 0xff60, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->dummyResampleState));
#endif
resampledTempLen = samplesLenAdjusted + 4;
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_ADPCM_RESAMPLED + 4;
#ifdef VERSION_EU
if (noteSubEu->finished != 0) {
if (noteSubEu->finished != FALSE) {
#else
if (note->finished != 0) {
if (note->finished != FALSE) {
#endif
aClearBuffer(cmd++,
DMEM_ADDR_ADPCM_RESAMPLED + resampledTempLen,
samplesLenAdjusted + 0x10);
aClearBuffer(cmd++, DMEM_ADDR_ADPCM_RESAMPLED + resampledTempLen, samplesLenAdjusted + 0x10);
}
break;
case 1:
aSetBuffer(cmd++, 0, DMEM_ADDR_UNCOMPRESSED_NOTE + sp130,
DMEM_ADDR_ADPCM_RESAMPLED2, samplesLenAdjusted + 8);
DMEM_ADDR_ADPCM_RESAMPLED2,
samplesLenAdjusted + 8);
#ifdef VERSION_EU
aResample(cmd++, A_INIT, 0xff60,
VIRTUAL_TO_PHYSICAL2(
@ -992,19 +1005,16 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
}
#ifdef VERSION_EU
if (noteSubEu->finished != 0) {
if (noteSubEu->finished != FALSE) {
#else
if (note->finished != 0) {
if (note->finished != FALSE) {
#endif
// ("break;" doesn't match)
flags = 0;
goto out;
break;
}
}
flags = 0;
}
out:
flags = 0;
#ifdef VERSION_EU
if (noteSubEu->needsInit == TRUE) {
@ -1030,9 +1040,9 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
} else if (note->headsetPanLeft != 0 || note->prevHeadsetPanLeft != 0) {
s0 = 2;
#else
if (note->noteSubEu.headsetPanRight != 0 || synthesisState->prevHeadsetPanRight != 0) {
if (noteSubEu->headsetPanRight != 0 || synthesisState->prevHeadsetPanRight != 0) {
s0 = 1;
} else if (note->noteSubEu.headsetPanLeft != 0 || synthesisState->prevHeadsetPanLeft != 0) {
} else if (noteSubEu->headsetPanLeft != 0 || synthesisState->prevHeadsetPanLeft != 0) {
s0 = 2;
#endif
} else {
@ -1040,7 +1050,7 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
}
#ifdef VERSION_EU
cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, 0, s0);
cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, 0, s0, flags);
#else
cmd = process_envelope(cmd, note, bufLen, 0, s0, flags);
#endif
@ -1068,13 +1078,6 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
return cmd;
}
#elif defined(VERSION_JP) || defined(VERSION_SH) // todo: extract this nonmatching if applicable.
GLOBAL_ASM("asm/non_matchings/synthesis_process_notes_jp.s")
#elif defined(VERSION_US)
GLOBAL_ASM("asm/non_matchings/synthesis_process_notes_us.s")
#elif defined(VERSION_EU)
GLOBAL_ASM("asm/non_matchings/eu/audio/synthesis_process_note.s")
#endif
#ifdef VERSION_EU
u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad) {
@ -1103,15 +1106,11 @@ u64 *load_wave_samples(u64 *cmd, struct Note *note, s32 nSamplesToLoad) {
aSetBuffer(cmd++, /*flags*/ 0, /*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE, /*dmemout*/ 0,
/*count*/ sizeof(note->synthesisBuffers->samples));
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->samples));
note->samplePosInt = (note->sampleCount - 1) & note->samplePosInt;
note->samplePosInt &= (note->sampleCount - 1);
a3 = 64 - note->samplePosInt;
if (a3 < nSamplesToLoad) {
for (i = 0; i <= (nSamplesToLoad - a3 + 63) / 64 - 1; i++) {
aDMEMMove(cmd++,
/*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE,
/*dmemout*/ DMEM_ADDR_UNCOMPRESSED_NOTE
+ (1 + i) * sizeof(note->synthesisBuffers->samples),
/*count*/ sizeof(note->synthesisBuffers->samples));
aDMEMMove(cmd++, /*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE, /*dmemout*/ DMEM_ADDR_UNCOMPRESSED_NOTE + (1 + i) * sizeof(note->synthesisBuffers->samples), /*count*/ sizeof(note->synthesisBuffers->samples));
}
}
return cmd;
@ -1153,7 +1152,7 @@ u64 *process_envelope_inner(u64 *cmd, struct Note *note, s32 nSamples, u16 inBuf
UNUSED u8 pad2[8];
s32 rampLeft, rampRight;
#else
u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings) {
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;
u16 sourceLeft;
@ -1225,7 +1224,7 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat
#ifdef VERSION_EU
if (targetLeft == sourceLeft && targetRight == sourceRight && !note->envMixerNeedsInit) {
#else
if (vol->sourceLeft == vol->targetLeft && vol->sourceRight == vol->targetRight
if (vol->targetLeft == vol->sourceLeft && vol->targetRight == vol->sourceRight
&& !note->envMixerNeedsInit) {
#endif
mixerFlags = A_CONTINUE;
@ -1308,7 +1307,6 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32
#ifndef VERSION_EU
u16 prevPanShift;
u16 panShift;
UNUSED s32 padding[11];
#else
u8 prevPanShift;
u8 panShift;
@ -1319,24 +1317,22 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32
case 1:
dest = DMEM_ADDR_LEFT_CH;
#ifndef VERSION_EU
note->prevHeadsetPanLeft = 0;
panShift = note->headsetPanRight;
#else
panShift = noteSubEu->headsetPanRight;
note->prevHeadsetPanLeft = 0;
#endif
note->prevHeadsetPanLeft = 0;
prevPanShift = note->prevHeadsetPanRight;
note->prevHeadsetPanRight = panShift;
break;
case 2:
dest = DMEM_ADDR_RIGHT_CH;
#ifndef VERSION_EU
note->prevHeadsetPanRight = 0;
panShift = note->headsetPanLeft;
#else
panShift = noteSubEu->headsetPanLeft;
note->prevHeadsetPanRight = 0;
#endif
note->prevHeadsetPanRight = 0;
prevPanShift = note->prevHeadsetPanLeft;
note->prevHeadsetPanLeft = panShift;
@ -1365,26 +1361,27 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32
#else
pitch = (bufLen << 0xf) / (panShift + bufLen - prevPanShift + 8);
#endif
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP + 8, DMEM_ADDR_TEMP,
panShift + bufLen - prevPanShift);
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP + 8, DMEM_ADDR_TEMP, panShift + bufLen - prevPanShift);
aResample(cmd++, 0, pitch, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panResampleState));
} else {
pitch = (panShift == 0) ? (bufLen << 0xf) / (bufLen - prevPanShift - 4)
: (bufLen << 0xf) / (bufLen + panShift - prevPanShift);
if (panShift == 0) {
pitch = (bufLen << 0xf) / (bufLen - prevPanShift - 4);
} else {
pitch = (bufLen << 0xf) / (bufLen + panShift - prevPanShift);
}
#if defined(VERSION_EU) && !defined(AVOID_UB)
if (unkDebug) { // UB
}
#endif
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP,
panShift + bufLen - prevPanShift);
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, panShift + bufLen - prevPanShift);
aResample(cmd++, 0, pitch, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panResampleState));
}
if (prevPanShift != 0) {
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP, 0, prevPanShift);
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer));
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + prevPanShift,
panShift + bufLen - prevPanShift);
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + prevPanShift, panShift + bufLen - prevPanShift);
} else {
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP, panShift + bufLen - prevPanShift);
}
@ -1432,7 +1429,12 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb
#endif
if (note->stereoHeadsetEffects && gSoundMode == SOUND_MODE_HEADSET) {
s8 smallPanIndex;
smallPanIndex = MIN((s8)(pan * 10.0f), 9);
s8 temp = (s8)(pan * 10.0f);
if (temp < 9) {
smallPanIndex = temp;
} else {
smallPanIndex = 9;
}
note->headsetPanLeft = gHeadsetPanQuantization[smallPanIndex];
note->headsetPanRight = gHeadsetPanQuantization[9 - smallPanIndex];
note->stereoStrongRight = FALSE;
@ -1441,8 +1443,10 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb
volLeft = gHeadsetPanVolume[panIndex];
volRight = gHeadsetPanVolume[127 - panIndex];
} else if (note->stereoHeadsetEffects && gSoundMode == SOUND_MODE_STEREO) {
u8 strongLeft = FALSE;
u8 strongRight = FALSE;
u8 strongLeft;
u8 strongRight;
strongLeft = FALSE;
strongRight = FALSE;
note->headsetPanLeft = 0;
note->headsetPanRight = 0;
note->usesHeadsetPanEffects = FALSE;
@ -1463,7 +1467,9 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb
volRight = gDefaultPanVolume[127 - panIndex];
}
velocity = MAX(velocity, 0);
if (velocity < 0) {
velocity = 0;
}
#ifdef VERSION_JP
note->targetVolLeft = (u16)(velocity * volLeft) & ~0x80FF; // 0x7F00, but that doesn't match
note->targetVolRight = (u16)(velocity * volRight) & ~0x80FF;

View File

@ -3,7 +3,7 @@
#include "buffers.h"
ALIGNED8 u8 gDecompressionHeap[0xD000];
#ifdef VERSION_EU
#if defined(VERSION_EU) || defined(VERSION_SH)
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200) - 0x3800];
#else
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200)];
@ -13,6 +13,9 @@ ALIGNED8 u8 gIdleThreadStack[0x800];
ALIGNED8 u8 gThread3Stack[0x2000];
ALIGNED8 u8 gThread4Stack[0x2000];
ALIGNED8 u8 gThread5Stack[0x2000];
#ifdef VERSION_SH
ALIGNED8 u8 gThread6Stack[0x2000];
#endif
// 0x400 bytes
ALIGNED8 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
// 0xc00 bytes for f3dex, 0x900 otherwise

View File

@ -3,7 +3,7 @@
#include "types.h"
#include "game/save_file.h"
#include "game/display.h"
#include "game/game_init.h"
extern u8 gDecompressionHeap[];
@ -17,6 +17,9 @@ extern u8 gIdleThreadStack[];
extern u8 gThread3Stack[];
extern u8 gThread4Stack[];
extern u8 gThread5Stack[];
#ifdef VERSION_SH
extern u8 gThread6Stack[];
#endif
extern u8 gGfxSPTaskYieldBuffer[];

File diff suppressed because it is too large Load Diff

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