Browse Source

Refresh 8

master
n64 2 years ago
parent
commit
c45aa301bb
  1. 42
      CHANGES
  2. 48
      Makefile
  3. 2
      README.md
  4. 450
      asm/boot.s
  5. 46
      asm/decompress.s
  6. 657
      asm/non_matchings/eu/audio/synthesis_process_note.s
  7. 738
      asm/non_matchings/synthesis_process_notes_jp.s
  8. 733
      asm/non_matchings/synthesis_process_notes_us.s
  9. 7
      asm/rom_header.s
  10. 2970
      assets.json
  11. 449
      data/behavior_data.c
  12. 2
      diff.py
  13. 2
      diff_settings.py
  14. 7
      enhancements/debug_box.patch
  15. 18
      enhancements/fps.patch
  16. 30
      enhancements/mem_error_screen.patch
  17. 20
      enhancements/record_demo.patch
  18. 2
      extract_assets.py
  19. 6
      first-diff.py
  20. 30
      include/behavior_data.h
  21. 8
      include/config.h
  22. 1
      include/geo_commands.h
  23. 2
      include/macro_presets.h
  24. 4
      include/macros.h
  25. 5
      include/make_const_nonconst.h
  26. 32
      include/object_constants.h
  27. 4
      include/object_fields.h
  28. 34
      include/sm64.h
  29. 11
      include/types.h
  30. 2
      levels/bbh/geo.c
  31. 2
      levels/bitdw/geo.c
  32. 2
      levels/bitdw/script.c
  33. 2
      levels/bitfs/geo.c
  34. 2
      levels/bitfs/script.c
  35. 2
      levels/bits/geo.c
  36. 2
      levels/bits/script.c
  37. 2
      levels/bob/geo.c
  38. 2
      levels/bowser_1/geo.c
  39. 2
      levels/bowser_2/geo.c
  40. 2
      levels/bowser_3/geo.c
  41. 2
      levels/castle_courtyard/geo.c
  42. 2
      levels/castle_grounds/geo.c
  43. 2
      levels/castle_grounds/script.c
  44. 2
      levels/castle_inside/geo.c
  45. 30
      levels/castle_inside/script.c
  46. 2
      levels/ccm/geo.c
  47. 2
      levels/cotmc/geo.c
  48. 2
      levels/ddd/geo.c
  49. 2
      levels/ending/geo.c
  50. 2
      levels/hmc/geo.c
  51. 12
      levels/intro/geo.c
  52. 8
      levels/intro/script.c
  53. 2
      levels/jrb/geo.c
  54. 2
      levels/lll/geo.c
  55. 2
      levels/menu/geo.c
  56. 2
      levels/pss/geo.c
  57. 2
      levels/rr/geo.c
  58. 2
      levels/sa/geo.c
  59. 2
      levels/scripts.c
  60. 2
      levels/sl/geo.c
  61. 2
      levels/ssl/geo.c
  62. 2
      levels/thi/geo.c
  63. 2
      levels/totwc/geo.c
  64. 2
      levels/ttc/geo.c
  65. 2
      levels/ttm/geo.c
  66. 2
      levels/vcutm/geo.c
  67. 2
      levels/wdw/geo.c
  68. 2
      levels/wf/geo.c
  69. 2
      levels/wmotr/geo.c
  70. 152
      lib/asm/__osExceptionPreamble.s
  71. 100
      lib/asm/llmuldiv_gcc.s
  72. 6
      lib/src/__osDequeueThread.c
  73. 2
      lib/src/__osGetCurrFaultedThread.c
  74. 21
      lib/src/func_802F4A20.c
  75. 8
      lib/src/func_802F71A0.c
  76. 2
      lib/src/func_802F71F0.c
  77. 44
      lib/src/libultra_internal.h
  78. 1
      lib/src/osContInit.c
  79. 10
      lib/src/osContInternal.h
  80. 6
      lib/src/osContStartReadData.c
  81. 2
      lib/src/osCreateMesgQueue.c
  82. 1
      lib/src/osCreateThread.c
  83. 3
      lib/src/osDestroyThread.c
  84. 2
      lib/src/osEepromRead.c
  85. 8
      lib/src/osEepromWrite.c
  86. 2
      lib/src/osGetThreadPri.c
  87. 2
      lib/src/osJamMesg.c
  88. 2
      lib/src/osRecvMesg.c
  89. 2
      lib/src/osSendMesg.c
  90. 3
      lib/src/osSetThreadPri.c
  91. 3
      lib/src/osStartThread.c
  92. 21
      sm64.ld
  93. 6
      sound/sequences/00_sound_player.s
  94. 230
      src/audio/external.c
  95. 4
      src/audio/external.h
  96. 6
      src/audio/internal.h
  97. 402
      src/audio/synthesis.c
  98. 5
      src/buffers/buffers.c
  99. 5
      src/buffers/buffers.h
  100. 1077
      src/engine/behavior_script.c

42
CHANGES

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

48
Makefile

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

2
README.md

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

450
asm/boot.s

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

46
asm/decompress.s

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

657
asm/non_matchings/eu/audio/synthesis_process_note.s

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