Refresh 10

This commit is contained in:
n64 2020-06-02 12:44:34 -04:00
parent e58669b4b3
commit d43d9b7f20
444 changed files with 30163 additions and 7628 deletions

55
CHANGES
View File

@ -1,3 +1,58 @@
Refresh #10
1.) GCC 9 noreturn UB fixes (#961)
2.) List supported binutils variants in README.md (#960)
3.) fix fly guy's possible values for target roll
4.) clarify that 1 is an exclusive bound in random_float (#962)
5.) replace unkB8 with prevNumStarsForDialog (#963)
6.) Replace "BulletBillUnkF8" with "BulletBillInitialMoveYaw" (#966)
7.) Renamed more warp behaviors and spawn types (#949)
8.) EU bss cleanups (#965)
9.) Add -fno-zero-initialized-in-bss to GCC CFLAGS (#968)
10.) Use empty .SECONDARY target instead of .PRECIOUS (#964)
11.) Match EU seq_channel_layer_process_script (#969)
12.) Fix version variable overwriting bug for non-matching compilations (#974)
13.) small bhv_collect_star_init labeling (#972)
14.) Align SI DMA command buffers, add more names to osCont code (#973)
15.) Minor for loop fix in playback.c (#976)
16.) Add Docker config (Public #36)
17.) Fix usage output crash for skyconv (#977)
18.) Cleanup tools and their build flags (#978)
19.) Print more detailed file reading error messages in extract_assets (#982)
20.) Remove asmdiff (#983)
21.) Fixed tabledesign makefile bug (#985)
22.) Improve first-diff.py (#987)
23.) Bring in some enhancements such as widescreen enhancements (#981)
24.) Fix background shadow border if widescreen in shade_screen (#988)
25.) Merge common EU sections in osExceptionPreamble (#990)
26.) Introduce the NO_SEGMENTED_MEMORY define (#989)
27.) NO_SEGMENTED_MEMORY comments (#992)
28.) Introduce f3dex2e and a GBI_FLOATS setting (#993)
29.) Audio uses signed 16-bit integers as samples, not unsigned (#995)
30.) Assemble RSP ucode with armips (#970)
31.) Label Mr. Blizzard, Yoshi, Whomp, Wiggler, Wood Piece oFields. (#996)
32.) update crash enhancement (#1003)
33.) Update README.md to use new public Discord server invite
34.) Label variables in act_idle. (#1005)
35.) Fix a typo in camera.h (#1009)
36.) Fixed up profiler.c (#1010)
37.) Add -d to first-diff.py (#1012)
38.) Fix typo in first-diff.py (#1013)
39.) Remove binutils 2.27 dependency check (#1015)
40.) Update armips to v0.11.0 tag and add generator script (#1004)
41.) Extract IPL3 font from ROM (#1011)
42.) Documented audio playback flags (#1021)
43.) Change RSP register notation to dollar-prefixed numbers (#1022)
44.) Only check for QEMU_IRIX in Makefile when compiling with IDO (#1023)
45.) Clean up header files and update function prototypes (#1000)
46.) Named local variables in geo_update_layer_transparency (#1019)
47.) Extract crash screen font textures from EU and SH ROMs (#1025)
48.) Use ACTIVE_FLAG defines where appropriate (#1026)
49.) Changed type of actor collision from s16 to Collision (#1024)
50.) Implement sqrtf in assembly file (#1028)
51.) Rename Struct8032FCE8 as OpenableGrill and identify data members (#1029)
52.) Fix some mistakes in the abi doc (#1031)
53.) The README.md PR (#979)
Refresh #8
1.) Use INT_STATUS_ macros for oInteractStatus (#911)
2.) Update bullet_bill.inc.c (#912)

View File

@ -6,10 +6,8 @@ RUN apt-get update && \
bsdmainutils \
build-essential \
libaudiofile-dev \
pkg-config \
python3 \
wget \
zlib1g-dev
wget
RUN wget \
https://github.com/n64decomp/qemu-irix/releases/download/v2.11-deb/qemu-irix-2.11.0-2169-g32ab296eef_amd64.deb \

135
Makefile
View File

@ -29,33 +29,21 @@ endif
# Release
ifeq ($(VERSION),jp)
VERSION_CFLAGS := -DVERSION_JP
VERSION_ASFLAGS := --defsym VERSION_JP=1
GRUCODE_CFLAGS := -DF3D_OLD
GRUCODE_ASFLAGS := --defsym F3D_OLD=1
TARGET := sm64.jp
VERSION_DEF := VERSION_JP
GRUCODE_DEF := F3D_OLD
else
ifeq ($(VERSION),us)
VERSION_CFLAGS := -DVERSION_US
VERSION_ASFLAGS := --defsym VERSION_US=1
GRUCODE_CFLAGS := -DF3D_OLD
GRUCODE_ASFLAGS := --defsym F3D_OLD=1
TARGET := sm64.us
VERSION_DEF := VERSION_US
GRUCODE_DEF := F3D_OLD
else
ifeq ($(VERSION),eu)
VERSION_CFLAGS := -DVERSION_EU
VERSION_ASFLAGS := --defsym VERSION_EU=1
GRUCODE_CFLAGS := -DF3D_NEW
GRUCODE_ASFLAGS := --defsym F3D_NEW=1
TARGET := sm64.eu
VERSION_DEF := VERSION_EU
GRUCODE_DEF := F3D_NEW
else
ifeq ($(VERSION),sh)
$(warning Building SH is experimental and is prone to breaking. Try at your own risk.)
VERSION_CFLAGS := -DVERSION_SH
VERSION_ASFLAGS := --defsym VERSION_SH=1
GRUCODE_CFLAGS := -DF3D_NEW
GRUCODE_ASFLAGS := --defsym F3D_NEW=1
TARGET := sm64.sh
VERSION_DEF := VERSION_SH
GRUCODE_DEF := F3D_NEW
# 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
else
@ -65,30 +53,33 @@ endif
endif
endif
TARGET := sm64.$(VERSION)
VERSION_CFLAGS := -D$(VERSION_DEF)
VERSION_ASFLAGS := --defsym $(VERSION_DEF)=1
# Microcode
ifeq ($(GRUCODE),f3dex) # Fast3DEX
GRUCODE_CFLAGS := -DF3DEX_GBI
GRUCODE_ASFLAGS := --defsym F3DEX_GBI_SHARED=1 --defsym F3DEX_GBI=1
GRUCODE_DEF := F3DEX_GBI
GRUCODE_ASFLAGS := --defsym F3DEX_GBI_SHARED=1
TARGET := $(TARGET).f3dex
COMPARE := 0
else
ifeq ($(GRUCODE), f3dex2) # Fast3DEX2
GRUCODE_CFLAGS := -DF3DEX_GBI_2
GRUCODE_ASFLAGS := --defsym F3DEX_GBI_SHARED=1 --defsym F3DEX_GBI_2=1
GRUCODE_DEF := F3DEX_GBI_2
GRUCODE_ASFLAGS := --defsym F3DEX_GBI_SHARED=1
TARGET := $(TARGET).f3dex2
COMPARE := 0
else
ifeq ($(GRUCODE),f3d_new) # Fast3D 2.0H (Shindou)
GRUCODE_CFLAGS := -DF3D_NEW
GRUCODE_ASFLAGS := --defsym F3D_NEW=1
GRUCODE_DEF := F3D_NEW
TARGET := $(TARGET).f3d_new
COMPARE := 0
else
ifeq ($(GRUCODE),f3dzex) # Fast3DZEX (2.0J / Animal Forest - Dōbutsu no Mori)
$(warning Fast3DZEX is experimental. Try at your own risk.)
GRUCODE_CFLAGS := -DF3DEX_GBI_2
GRUCODE_ASFLAGS := --defsym F3DEX_GBI_SHARED=1 --defsym F3DZEX_GBI=1
GRUCODE_DEF := F3DEX_GBI_2
GRUCODE_ASFLAGS := --defsym F3DEX_GBI_SHARED=1
TARGET := $(TARGET).f3dzex
COMPARE := 0
endif
@ -96,13 +87,16 @@ endif
endif
endif
GRUCODE_CFLAGS := -D$(GRUCODE_DEF)
GRUCODE_ASFLAGS := $(GRUCODE_ASFLAGS) --defsym $(GRUCODE_DEF)=1
ifeq ($(TARGET_N64),0)
NON_MATCHING := 1
endif
ifeq ($(NON_MATCHING),1)
VERSION_CFLAGS := $(VERSION_CFLAGS) -DNON_MATCHING -DAVOID_UB
VERSION_ASFLAGS := --defsym AVOID_UB=1
MATCH_CFLAGS := -DNON_MATCHING -DAVOID_UB
MATCH_ASFLAGS := --defsym AVOID_UB=1
COMPARE := 0
endif
@ -212,10 +206,7 @@ SOUND_SAMPLE_DIRS := $(wildcard sound/samples/*)
SOUND_SAMPLE_AIFFS := $(foreach dir,$(SOUND_SAMPLE_DIRS),$(wildcard $(dir)/*.aiff))
SOUND_SAMPLE_TABLES := $(foreach file,$(SOUND_SAMPLE_AIFFS),$(BUILD_DIR)/$(file:.aiff=.table))
SOUND_SAMPLE_AIFCS := $(foreach file,$(SOUND_SAMPLE_AIFFS),$(BUILD_DIR)/$(file:.aiff=.aifc))
SOUND_OBJ_FILES := $(SOUND_BIN_DIR)/sound_data.ctl.o \
$(SOUND_BIN_DIR)/sound_data.tbl.o \
$(SOUND_BIN_DIR)/sequences.bin.o \
$(SOUND_BIN_DIR)/bank_sets.o
SOUND_OBJ_FILES := $(SOUND_BIN_DIR)/sound_data.o
# Object files
@ -232,9 +223,11 @@ GODDARD_O_FILES := $(foreach file,$(GODDARD_C_FILES),$(BUILD_DIR)/$(file:.c=.o))
DEP_FILES := $(O_FILES:.o=.d) $(ULTRA_O_FILES:.o=.d) $(GODDARD_O_FILES:.o=.d) $(BUILD_DIR)/$(LD_SCRIPT).d
# Files with GLOBAL_ASM blocks
ifeq ($(NON_MATCHING),0)
GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/**/*.c)
GLOBAL_ASM_O_FILES = $(foreach file,$(GLOBAL_ASM_C_FILES),$(BUILD_DIR)/$(file:.c=.o))
GLOBAL_ASM_DEP = $(BUILD_DIR)/src/audio/non_matching_dep
endif
# Segment elf files
SEG_FILES := $(SEGMENT_ELF_FILES) $(ACTOR_ELF_FILES) $(LEVEL_ELF_FILES)
@ -251,10 +244,12 @@ else
endif
# check that either QEMU_IRIX is set or qemu-irix package installed
ifndef QEMU_IRIX
QEMU_IRIX := $(shell which qemu-irix)
ifeq (, $(QEMU_IRIX))
$(error Please install qemu-irix package or set QEMU_IRIX env var to the full qemu-irix binary path)
ifeq ($(COMPILER),ido)
ifndef QEMU_IRIX
QEMU_IRIX := $(shell which qemu-irix 2>/dev/null)
ifeq (, $(QEMU_IRIX))
$(error Please install qemu-irix package or set QEMU_IRIX env var to the full qemu-irix binary path)
endif
endif
endif
@ -273,18 +268,19 @@ ifeq ($(COMPILER),gcc)
endif
ifeq ($(TARGET_N64),1)
TARGET_CFLAGS := -nostdinc -I include/libc -DTARGET_N64
TARGET_CFLAGS := -nostdinc -I include/libc -DTARGET_N64 -D_LANGUAGE_C
CC_CFLAGS := -fno-builtin
endif
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)
CC_CHECK := gcc
CC_CHECK_CFLAGS := -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)
COMMON_CFLAGS = $(OPT_FLAGS) $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(MATCH_CFLAGS) $(MIPSISET) $(GRUCODE_CFLAGS)
ASFLAGS := -march=vr4300 -mabi=32 -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS) $(GRUCODE_ASFLAGS)
ASFLAGS := -march=vr4300 -mabi=32 -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS) $(MATCH_ASFLAGS) $(GRUCODE_ASFLAGS)
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))
@ -292,7 +288,7 @@ LDFLAGS := -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/
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)
CFLAGS := -march=vr4300 -mfix4300 -mabi=32 -mno-shared -G 0 -mhard-float -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -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)
@ -300,7 +296,7 @@ ifeq ($(shell getconf LONG_BIT), 32)
export QEMU_GUEST_BASE := 1
else
# Ensure that gcc treats the code as 32-bit
CC_CHECK += -m32
CC_CHECK_CFLAGS += -m32
endif
# Prevent a crash with -sopt
@ -315,7 +311,6 @@ N64CKSUM = $(TOOLS_DIR)/n64cksum
N64GRAPHICS = $(TOOLS_DIR)/n64graphics
N64GRAPHICS_CI = $(TOOLS_DIR)/n64graphics_ci
TEXTCONV = $(TOOLS_DIR)/textconv
IPLFONTUTIL = $(TOOLS_DIR)/iplfontutil
AIFF_EXTRACT_CODEBOOK = $(TOOLS_DIR)/aiff_extract_codebook
VADPCM_ENC = $(TOOLS_DIR)/vadpcm_enc
EXTRACT_DATA_FOR_MIO = $(TOOLS_DIR)/extract_data_for_mio
@ -326,20 +321,17 @@ LOADER = loader64
LOADER_FLAGS = -vwf
SHA1SUM = sha1sum
ifeq (, $(shell which armips 2>/dev/null))
RSPASM := $(TOOLS_DIR)/armips
else
RSPASM = armips
endif
# 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')
BINUTILS_VER_MINOR := $(shell $(LD) --version | grep ^GNU | sed 's/^[^.]*\.//; s/\..*//g')
BINUTILS_DEPEND := $(shell expr $(BINUTILS_VER_MAJOR) \>= 2 \& $(BINUTILS_VER_MINOR) \>= 27)
ifeq ($(BINUTILS_DEPEND),0)
$(error binutils version 2.27 required, version $(BINUTILS_VER_MAJOR).$(BINUTILS_VER_MINOR) detected)
endif
######################## Targets #############################
all: $(ROM)
@ -362,10 +354,10 @@ load: $(ROM)
libultra: $(BUILD_DIR)/libultra.a
asm/boot.s: $(BUILD_DIR)/lib/bin/ipl3_font.bin
$(BUILD_DIR)/asm/boot.o: $(IPL3_RAW_FILES)
$(BUILD_DIR)/src/game/crash_screen.o: $(CRASH_TEXTURE_C_FILES)
$(BUILD_DIR)/lib/bin/ipl3_font.bin: lib/ipl3_font.png
$(IPLFONTUTIL) e $< $@
$(BUILD_DIR)/lib/rsp.o: $(BUILD_DIR)/rsp/rspboot.bin $(BUILD_DIR)/rsp/fast3d.bin $(BUILD_DIR)/rsp/audio.bin
$(BUILD_DIR)/include/text_strings.h: include/text_strings.h.in
$(TEXTCONV) charmap.txt $< $@
@ -410,7 +402,8 @@ $(BUILD_DIR)/text/%/define_text.inc.c: text/define_text.inc.c text/%/courses.h t
$(CPP) $(VERSION_CFLAGS) $< -o $@ -I text/$*/
$(TEXTCONV) charmap.txt $@ $@
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(GODDARD_SRC_DIRS) $(ULTRA_SRC_DIRS) $(ULTRA_ASM_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) include) $(MIO0_DIR) $(addprefix $(MIO0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION)
RSP_DIRS := $(BUILD_DIR)/rsp
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS) $(GODDARD_SRC_DIRS) $(ULTRA_SRC_DIRS) $(ULTRA_ASM_DIRS) $(ULTRA_BIN_DIRS) $(BIN_DIRS) $(TEXTURE_DIRS) $(TEXT_DIRS) $(SOUND_SAMPLE_DIRS) $(addprefix levels/,$(LEVEL_DIRS)) include) $(MIO0_DIR) $(addprefix $(MIO0_DIR)/,$(VERSION)) $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/sequences/$(VERSION) $(RSP_DIRS)
# Make sure build directory exists before compiling anything
DUMMY != mkdir -p $(ALL_DIRS)
@ -480,6 +473,9 @@ $(BUILD_DIR)/%.table: %.aiff
$(BUILD_DIR)/%.aifc: $(BUILD_DIR)/%.table %.aiff
$(VADPCM_ENC) -c $^ $@
$(BUILD_DIR)/rsp/%.bin $(BUILD_DIR)/rsp/%_data.bin: rsp/%.s
$(RSPASM) -sym $@.sym -definelabel $(VERSION_DEF) 1 -definelabel $(GRUCODE_DEF) 1 -strequ CODE_FILE $(BUILD_DIR)/rsp/$*.bin -strequ DATA_FILE $(BUILD_DIR)/rsp/$*_data.bin $<
$(ENDIAN_BITWIDTH): tools/determine-endian-bitwidth.c
$(CC) -c $(CFLAGS) -o $@.dummy2 $< 2>$@.dummy1; true
grep -o 'msgbegin --endian .* --bitwidth .* msgend' $@.dummy1 > $@.dummy2
@ -510,8 +506,11 @@ $(SOUND_BIN_DIR)/%.m64: $(SOUND_BIN_DIR)/%.o
$(SOUND_BIN_DIR)/%.o: $(SOUND_BIN_DIR)/%.s
$(AS) $(ASFLAGS) -o $@ $<
$(SOUND_BIN_DIR)/%.s: $(SOUND_BIN_DIR)/%
printf ".section .data\n\n.incbin \"$<\"\n" > $@
$(SOUND_BIN_DIR)/%.inc.c: $(SOUND_BIN_DIR)/%
hexdump -v -e '1/1 "0x%X,"' $< > $@
echo >> $@
$(SOUND_BIN_DIR)/sound_data.o: $(SOUND_BIN_DIR)/sound_data.ctl.inc.c $(SOUND_BIN_DIR)/sound_data.tbl.inc.c $(SOUND_BIN_DIR)/sequences.bin.inc.c $(SOUND_BIN_DIR)/bank_sets.inc.c
$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h
@ -559,12 +558,18 @@ else
# 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,-+
#$(BUILD_DIR)/src/audio/seqplayer.o: OPT_FLAGS := -O2 -sopt,-inline_manual,-scalaroptimize=1 -Wp,-+ #-Wo,-v,-bb,-l,seqplayer_list.txt
# Add a target for build/eu/src/audio/*.copt to make it easier to see debug
$(BUILD_DIR)/src/audio/%.acpp: src/audio/%.c
$(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/acpp $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(GRUCODE_CFLAGS) -D__sgi -+ $< > $@
$(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/acpp $(TARGET_CFLAGS) $(INCLUDE_CFLAGS) $(VERSION_CFLAGS) $(MATCH_CFLAGS) $(GRUCODE_CFLAGS) -D__sgi -+ $< > $@
$(BUILD_DIR)/src/audio/seqplayer.copt: $(BUILD_DIR)/src/audio/seqplayer.acpp
$(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/copt -signed -I=$< -CMP=$@ -cp=i -scalaroptimize=1 -inline_manual
$(BUILD_DIR)/src/audio/%.copt: $(BUILD_DIR)/src/audio/%.acpp
$(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/lib/copt -signed -I=$< -CMP=$@ -cp=i -scalaroptimize=1
endif
endif
@ -579,12 +584,12 @@ $(GLOBAL_ASM_DEP).$(NON_MATCHING):
touch $@
$(BUILD_DIR)/%.o: %.c
@$(CC_CHECK) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
@$(CC_CHECK) $(CC_CHECK_CFLAGS) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
$(CC) -c $(CFLAGS) -o $@ $<
$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c
@$(CC_CHECK) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
@$(CC_CHECK) $(CC_CHECK_CFLAGS) -MMD -MP -MT $@ -MF $(BUILD_DIR)/$*.d $<
$(CC) -c $(CFLAGS) -o $@ $<
$(BUILD_DIR)/%.o: %.s
@ -613,8 +618,8 @@ $(BUILD_DIR)/$(TARGET).objdump: $(ELF)
.PHONY: all clean distclean default diff test load libultra
.PRECIOUS: $(BUILD_DIR)/bin/%.elf $(SOUND_BIN_DIR)/%.ctl $(SOUND_BIN_DIR)/%.tbl $(SOUND_SAMPLE_TABLES) $(SOUND_BIN_DIR)/%.s $(BUILD_DIR)/%
.DELETE_ON_ERROR:
# with no prerequisites, .SECONDARY causes no intermediate target to be removed
.SECONDARY:
# Remove built-in rules, to improve performance
MAKEFLAGS += --no-builtin-rules

View File

@ -5,7 +5,7 @@
# obtain a list of segments from the *.c files in bin directory
SEGMENTS := $(notdir $(basename $(wildcard bin/*.c))) $(addprefix $(VERSION)/,$(notdir $(basename $(wildcard bin/$(VERSION)/*.c)))) $(addsuffix _skybox,$(notdir $(basename $(wildcard textures/skyboxes/*.png))))
ACTORS := $(filter %/,$(wildcard actors/*/))
TEXTURE_DIRS := $(addprefix textures/,$(SEGMENTS)) $(ACTORS) textures/intro_raw
TEXTURE_DIRS := $(addprefix textures/,$(SEGMENTS)) $(ACTORS) textures/crash_screen textures/intro_raw textures/ipl3_raw
# NOTE: textures assume naming convention "texture.<encoding>.png" generates "texture.<encoding>"
@ -243,6 +243,12 @@ $(BUILD_DIR)/bin/%_skybox.elf: SEGMENT_ADDRESS := 0x0A000000
# Misc Rules
# --------------------------------------
# intro_raw textures are not compressed
# intro and ipl3 textures are not compressed
INTRO_RAW_FILES := $(wildcard $(TEXTURE_DIR)/intro_raw/*.png)
$(BUILD_DIR)/src/goddard/renderer.o: $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%.inc.c,$(INTRO_RAW_FILES)))
IPL3_TEXTURE_FILES := $(wildcard $(TEXTURE_DIR)/ipl3_raw/*.png)
IPL3_RAW_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%,$(IPL3_TEXTURE_FILES)))
CRASH_TEXTURE_FILES := $(wildcard $(TEXTURE_DIR)/crash_screen/*.png)
CRASH_TEXTURE_C_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%.inc.c,$(CRASH_TEXTURE_FILES)))

166
README.md
View File

@ -1,9 +1,8 @@
# Super Mario 64
This repo contains a full decompilation of Super Mario 64 (J), (U), and (E).
The source and data have been decompiled but complete naming and documentation
all of the code and data is still a work in progress. Decompiling the Shindou ROM
is also an ongoing effort.
- This repo contains a full decompilation of Super Mario 64 (J), (U), and (E) with minor exceptions in the audio subsystem.
- Naming and documentation of the source code and data structures are in progress.
- Efforts to decompile the Shindou ROM steadily advance toward a matching build.
It builds the following ROMs:
@ -12,65 +11,60 @@ It builds the following ROMs:
* sm64.eu.z64 `sha1: 4ac5721683d0e0b6bbb561b58a71740845dceea9`
This repo does not include all assets necessary for compiling the ROMs.
A prior copy of the game is required to extract the required assets.
A prior copy of the game is required to extract the assets.
## Quick Start (for Ubuntu)
1. Install prerequisites: `sudo apt install -y build-essential git binutils-mips-linux-gnu python3 libaudiofile-dev`
2. Clone the repo from within Linux: `git clone https://github.com/n64decomp/sm64.git`
3. Place a Super Mario 64 ROM called `baserom.<VERSION>.z64` into the project folder for asset extraction, where `VERSION` can be `us`, `jp`, or `eu`.
4. Run `make` to build. Qualify the version through `make VERSION=<VERSION>`. Add `-j4` to improve build speed (hardware dependent).
Ensure the repo path length does not exceed 255 characters. Long path names result in build errors.
## Installation
### Docker
### Windows
#### 1. Copy baserom(s) for asset extraction
Install WSL and a distro of your choice following
[Windows Subsystem for Linux Installation Guide for Windows 10.](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
We recommend either Debian or Ubuntu 18.04 Linux distributions under WSL.
Note: WSL1 does not currently support Ubuntu 20.04.
For each version (jp/us/eu) that you want to build a ROM for, put an existing ROM at
`./baserom.<version>.z64` for asset extraction.
Next, clone the SM64 repo from within the Linux shell:
`git clone https://github.com/n64decomp/sm64.git`
#### 2. Create docker image
```bash
docker build -t sm64 .
```
#### 3. Build
To build we simply have to mount our local filesystem into the docker container and build.
```bash
# for example if you have baserom.us.z64 in the project root
docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 sm64 make VERSION=us -j4
# if your host system is linux you need to tell docker what user should own the output files
docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 --user $UID:$UID sm64 make VERSION=us -j4
```
Resulting artifacts can be found in the `build` directory.
Then continue following the directions in the [Linux](#linux) installation section below.
### Linux
#### 1. Copy baserom(s) for asset extraction
There are 3 steps to set up a working build.
For each version (jp/us/eu) that you want to build a ROM for, put an existing ROM at
`./baserom.<version>.z64` for asset extraction.
#### 2. Install build dependencies
#### Step 1: Install dependencies
The build system has the following package requirements:
* binutils-mips >= 2.27
* binutils-mips
* python3 >= 3.6
* libaudiofile
* qemu-irix
__Debian / Ubuntu__
Dependency installation instructions for common Linux distros are provided below:
##### Debian / Ubuntu
To install build dependencies:
```
sudo apt install build-essential pkg-config git binutils-mips-linux-gnu python3 zlib1g-dev libaudiofile-dev
sudo apt install -y build-essential git binutils-mips-linux-gnu python3 libaudiofile-dev
```
Download latest package from [qemu-irix Releases](https://github.com/n64decomp/qemu-irix/releases)
Download latest package from [qemu-irix Releases.](https://github.com/n64decomp/qemu-irix/releases)
Install this package with:
```
sudo dpkg -i qemu-irix-2.11.0-2169-g32ab296eef_amd64.deb
```
(Optional) Clone https://github.com/n64decomp/qemu-irix and follow the install instructions in the README.
__Arch Linux__
##### Arch Linux
To install build dependencies:
```
sudo pacman -S base-devel python audiofile
```
@ -78,29 +72,70 @@ Install the following AUR packages:
* [mips64-elf-binutils](https://aur.archlinux.org/packages/mips64-elf-binutils) (AUR)
* [qemu-irix-git](https://aur.archlinux.org/packages/qemu-irix-git) (AUR)
#### 3. Build ROM
Run `make` to build the ROM (defaults to `VERSION=us`). Make sure your path to the repo
is not too long or else this process will error, as the emulated IDO compiler cannot
handle paths longer than 255 characters.
Examples:
##### Other Linux distributions
Most modern Linux distributions should have equivalent packages to the other two listed above.
You may have to use a different version of GNU binutils. Listed below are fully compatible binutils
distributions with support in the makefile, and examples of distros that offer them:
* `mips64-elf-` (Arch AUR)
* `mips-linux-gnu-` (Ubuntu and other Debian-based distros)
* `mips64-linux-gnu-` (RHEL/CentOS/Fedora)
You may also use [Docker](#docker-installation) to handle installing an image with minimal dependencies.
#### Step 2: Copy baserom(s) for asset extraction
For each version (jp/us/eu) for which you want to build a ROM, put an existing ROM at
`./baserom.<VERSION>.z64` for asset extraction.
##### Step 3: Build the ROM
Run `make` to build the ROM (defaults to `VERSION=us`).
Other examples:
```
make VERSION=jp -j4 # build (J) version instead with 4 jobs
make VERSION=eu COMPARE=0 # non-matching EU version still WIP
make VERSION=eu COMPARE=0 # build (EU) version but do not compare ROM hashes
```
## Windows
Resulting artifacts can be found in the `build` directory.
For Windows, install WSL and a distro of your choice following
[Windows Subsystem for Linux Installation Guide for Windows 10](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
We recommend either Debian or Ubuntu 18.04 Linux distributions under WSL.
The full list of configurable variables are listed below, with the default being the first listed:
Then follow the directions in the [Linux](#linux) installation section above.
* ``VERSION``: ``us``, ``jp``, ``eu``, ``sh`` (WIP)
* ``GRUCODE``: ``f3d_old``, ``f3d_new``, ``f3dex``, ``f3dex2``, ``f3dzex``
* ``COMPARE``: ``1`` (compare ROM hash), ``0`` (do not compare ROM hash)
* ``NON_MATCHING``: Use functionally equivalent C implementations for non-matchings. Also will avoid instances of undefined behavior.
* ``CROSS``: Cross-compiler tool prefix (Example: ``mips64-elf-``).
* ``QEMU_IRIX``: Path to a ``qemu-irix`` binary.
## macOS
### macOS
macOS is currently unsupported as qemu-irix is unable to be built for macOS host.
The recommended path is installing a Linux distribution under a VM.
Installing Docker is the recommended avenue for macOS users. This project does not support macOS natively due to lack of macOS host support.
### Docker Installation
#### Create Docker image
Create the docker image with `docker build -t sm64`.
#### Build
To build, mount the local filesystem into the Docker container and build the ROM with `docker run`.
##### macOS example for (U):
```
docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 sm64 make VERSION=us -j4
```
##### Linux example for (U):
For a Linux host, Docker needs to be instructed which user should own the output files:
```
docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 --user $UID:$UID sm64 make VERSION=us -j4
```
Resulting artifacts can be found in the `build` directory.
## Project Structure
@ -108,11 +143,11 @@ The recommended path is installing a Linux distribution under a VM.
sm64
├── actors: object behaviors, geo layout, and display lists
├── asm: handwritten assembly code, rom header
   └── non_matchings: asm for non-matching sections
└── non_matchings: asm for non-matching sections
├── assets: animation and demo data
   ├── anims: animation data
   └── demos: demo data
├── bin: asm files for ordering display lists and textures
├── anims: animation data
└── demos: demo data
├── bin: C files for ordering display lists and textures
├── build: output directory
├── data: behavior scripts, misc. data
├── doxygen: documentation infrastructure
@ -120,14 +155,15 @@ sm64
├── include: header files
├── levels: level scripts, geo layout, and display lists
├── lib: SDK library code
├── rsp: audio and Fast3D RSP assembly code
├── sound: sequences, sound samples, and sound banks
├── src: C source code for game
   ├── audio: audio code
   ├── buffers: stacks, heaps, and task buffers
   ├── engine: script processing engines and utils
   ├── game: behaviors and rest of game source
   ├── goddard: Mario intro screen
   └── menu: title screen and file, act, and debug level selection menus
├── audio: audio code
├── buffers: stacks, heaps, and task buffers
├── engine: script processing engines and utils
├── game: behaviors and rest of game source
├── goddard: Mario intro screen
└── menu: title screen and file, act, and debug level selection menus
├── text: dialog, level names, act names
├── textures: skybox and generic texture data
└── tools: build tools
@ -138,6 +174,6 @@ sm64
Pull requests are welcome. For major changes, please open an issue first to
discuss what you would like to change.
Run clang-format on your code to ensure it meets the project's coding standards.
Run `clang-format` on your code to ensure it meets the project's coding standards.
Official Discord: https://discord.gg/DuYH3Fh

View File

@ -1,7 +1,7 @@
// Blue Coin Switch
// 0x08000E98 - 0x08000F10
const s16 blue_coin_switch_seg8_collision_08000E98[] = {
const Collision blue_coin_switch_seg8_collision_08000E98[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(26, 0, 26),

View File

@ -1,7 +1,7 @@
// Breakable Box
// 0x08012D70 - 0x08012DF4
const s16 breakable_box_seg8_collision_08012D70[] = {
const Collision breakable_box_seg8_collision_08012D70[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(-100, 0, -100),

View File

@ -1,7 +1,7 @@
// Cannon Lid
// 0x08004950 - 0x08004980
const s16 cannon_lid_seg8_collision_08004950[] = {
const Collision cannon_lid_seg8_collision_08004950[] = {
COL_INIT(),
COL_VERTEX_INIT(0x4),
COL_VERTEX(112, 0, -111),

View File

@ -1,6 +1,6 @@
// Capswitch
const s16 capswitch_collision_050033D0[] = {
const Collision capswitch_collision_050033D0[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(292, 0, 254),
@ -27,7 +27,7 @@ const s16 capswitch_collision_050033D0[] = {
COL_END(),
};
const s16 capswitch_collision_05003448[] = {
const Collision capswitch_collision_05003448[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(292, 0, 254),

View File

@ -1,7 +1,7 @@
// Checkerboard Platform
// 0x0800D710 - 0x0800D794
const s16 checkerboard_platform_seg8_collision_0800D710[] = {
const Collision checkerboard_platform_seg8_collision_0800D710[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(256, -25, -153),

View File

@ -28,7 +28,7 @@ extern const GeoLayout blue_coin_switch_geo[];
extern const Gfx blue_coin_switch_seg8_dl_08000D58[];
extern const Gfx blue_coin_switch_seg8_dl_08000DD0[];
extern const Gfx blue_coin_switch_seg8_dl_08000E08[];
extern const s16 blue_coin_switch_seg8_collision_08000E98[];
extern const Collision blue_coin_switch_seg8_collision_08000E98[];
// bobomb
extern const GeoLayout black_bobomb_geo[];
@ -57,7 +57,7 @@ extern const Gfx breakable_box_seg8_dl_08012C30[];
extern const Gfx breakable_box_seg8_dl_08012CD8[];
extern const Gfx breakable_box_seg8_dl_08012D20[];
extern const Gfx breakable_box_seg8_dl_08012D48[];
extern const s16 breakable_box_seg8_collision_08012D70[];
extern const Collision breakable_box_seg8_collision_08012D70[];
// cannon_barrel
extern const GeoLayout cannon_barrel_geo[];
@ -74,14 +74,14 @@ extern const Gfx cannon_base_seg8_dl_080057F8[];
// cannon_lid
extern const Gfx cannon_lid_seg8_dl_08004898[];
extern const Gfx cannon_lid_seg8_dl_080048E0[];
extern const s16 cannon_lid_seg8_collision_08004950[];
extern const Collision cannon_lid_seg8_collision_08004950[];
// checkerboard_platform
extern const GeoLayout checkerboard_platform_geo[];
extern const Gfx checkerboard_platform_seg8_dl_0800D5C0[];
extern const Gfx checkerboard_platform_seg8_dl_0800D618[];
extern const Gfx checkerboard_platform_seg8_dl_0800D680[];
extern const s16 checkerboard_platform_seg8_collision_0800D710[];
extern const Collision checkerboard_platform_seg8_collision_0800D710[];
// chuckya
extern const GeoLayout chuckya_geo[];
@ -136,7 +136,7 @@ extern const Gfx exclamation_box_outline_seg8_dl_08025968[];
extern const Gfx exclamation_box_outline_seg8_dl_080259F8[];
extern const Gfx exclamation_box_outline_seg8_dl_08025EC0[];
extern const Gfx exclamation_box_outline_seg8_dl_08025F08[];
extern const s16 exclamation_box_outline_seg8_collision_08025F78[];
extern const Collision exclamation_box_outline_seg8_collision_08025F78[];
// flyguy
extern const GeoLayout flyguy_geo[];
@ -189,18 +189,18 @@ extern const Gfx koopa_shell_seg8_dl_08028B78[];
extern const GeoLayout metal_box_geo[];
extern const Gfx metal_box_seg8_dl_08024B18[];
extern const Gfx metal_box_dl[];
extern const s16 metal_box_seg8_collision_08024C28[];
extern const Collision metal_box_seg8_collision_08024C28[];
// purple_switch
extern const GeoLayout purple_switch_geo[];
extern const Gfx purple_switch_seg8_dl_0800C668[];
extern const Gfx purple_switch_seg8_dl_0800C6E0[];
extern const Gfx purple_switch_seg8_dl_0800C718[];
extern const s16 purple_switch_seg8_collision_0800C7A8[];
extern const Collision purple_switch_seg8_collision_0800C7A8[];
// test_platform
extern const GeoLayout test_platform_geo[];
extern const Gfx unknown_seg8_dl_08026260[];
extern const s16 unknown_seg8_collision_080262F8[];
extern const Collision unknown_seg8_collision_080262F8[];
#endif

View File

@ -225,8 +225,8 @@ extern const Gfx tree_seg3_dl_03032170[];
extern const Gfx tree_seg3_dl_03033258[];
// warp_collision
extern const s16 door_seg3_collision_0301CE78[];
extern const s16 lll_hexagonal_mesh_seg3_collision_0301CECC[];
extern const Collision door_seg3_collision_0301CE78[];
extern const Collision lll_hexagonal_mesh_seg3_collision_0301CECC[];
// warp_pipe
extern const GeoLayout warp_pipe_geo[];
@ -235,7 +235,7 @@ extern const Gfx warp_pipe_seg3_dl_03008F98[];
extern const Gfx warp_pipe_seg3_dl_03009968[];
extern const Gfx warp_pipe_seg3_dl_03009A20[];
extern const Gfx warp_pipe_seg3_dl_03009A50[];
extern const s16 warp_pipe_seg3_collision_03009AC8[];
extern const Collision warp_pipe_seg3_collision_03009AC8[];
// white_particle
extern const GeoLayout white_particle_geo[];
@ -248,6 +248,6 @@ extern const Gfx wooden_signpost_seg3_dl_0302DA48[];
extern const Gfx wooden_signpost_seg3_dl_0302DC40[];
extern const Gfx wooden_signpost_seg3_dl_0302DCD0[];
extern const Gfx wooden_signpost_seg3_dl_0302DD08[];
extern const s16 wooden_signpost_seg3_collision_0302DD80[];
extern const Collision wooden_signpost_seg3_collision_0302DD80[];
#endif

View File

@ -1,7 +1,7 @@
// Dorrie
// 0x0600F644 - 0x0600FBB8
const s16 dorrie_seg6_collision_0600F644[] = {
const Collision dorrie_seg6_collision_0600F644[] = {
COL_INIT(),
COL_VERTEX_INIT(0x4E),
COL_VERTEX(-104, 657, 512),
@ -243,7 +243,7 @@ const s16 dorrie_seg6_collision_0600F644[] = {
};
// 0x0600FBB8 - 0x060100CE
const s16 dorrie_seg6_collision_0600FBB8[] = {
const Collision dorrie_seg6_collision_0600FBB8[] = {
COL_INIT(),
COL_VERTEX_INIT(0x49),
COL_VERTEX(-301, -141, -152),

View File

@ -1,7 +1,7 @@
// Exclamation Box Outline
// 0x08025F78 - 0x08025FFC
const s16 exclamation_box_outline_seg8_collision_08025F78[] = {
const Collision exclamation_box_outline_seg8_collision_08025F78[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(-26, 30, -26),

View File

@ -70,8 +70,8 @@ extern const GeoLayout thwomp_geo[];
extern const Gfx thwomp_seg5_dl_0500B570[];
extern const Gfx thwomp_seg5_dl_0500B718[];
extern const Gfx thwomp_seg5_dl_0500B750[];
extern const s16 thwomp_seg5_collision_0500B7D0[];
extern const s16 thwomp_seg5_collision_0500B92C[];
extern const Collision thwomp_seg5_collision_0500B7D0[];
extern const Collision thwomp_seg5_collision_0500B92C[];
// yellow_sphere_small
extern const GeoLayout yellow_sphere_geo[];

View File

@ -110,7 +110,7 @@ extern const GeoLayout wooden_post_geo[];
extern const Gfx poundable_pole_seg6_dl_060022F0[];
extern const Gfx poundable_pole_seg6_dl_06002358[];
extern const Gfx poundable_pole_seg6_dl_06002410[];
extern const s16 poundable_pole_collision_06002490[];
extern const Collision poundable_pole_collision_06002490[];
// whomp
extern const GeoLayout whomp_geo[];
@ -131,6 +131,6 @@ extern const Gfx whomp_seg6_dl_0601FEA8[];
extern const Gfx whomp_seg6_dl_0601FFA0[];
extern const Gfx whomp_seg6_dl_06020038[];
extern const struct Animation *const whomp_seg6_anims_06020A04[];
extern const s16 whomp_seg6_collision_06020A0C[];
extern const Collision whomp_seg6_collision_06020A0C[];
#endif

View File

@ -32,8 +32,8 @@ extern const Gfx dorrie_seg6_dl_0600DE38[];
extern const Gfx dorrie_seg6_dl_0600DF60[];
extern const Gfx dorrie_seg6_dl_0600DFA8[];
extern const struct Animation *const dorrie_seg6_anims_0600F638[];
extern const s16 dorrie_seg6_collision_0600F644[];
extern const s16 dorrie_seg6_collision_0600FBB8[];
extern const Collision dorrie_seg6_collision_0600F644[];
extern const Collision dorrie_seg6_collision_0600FBB8[];
// mr_i_eyeball
extern const GeoLayout mr_i_geo[];

View File

@ -22,7 +22,7 @@ extern const Gfx penguin_seg5_dl_050072C8[];
extern const Gfx penguin_seg5_dl_05007358[];
extern const Gfx penguin_seg5_dl_05007540[];
extern const struct Animation *const penguin_seg5_anims_05008B74[];
extern const s16 penguin_seg5_collision_05008B88[];
extern const Collision penguin_seg5_collision_05008B88[];
// snowman
extern const GeoLayout mr_blizzard_hidden_geo[];

View File

@ -14,8 +14,8 @@ extern const Gfx capswitch_seg5_dl_05003350[];
extern const Gfx capswitch_seg5_dl_05003370[];
extern const Gfx capswitch_seg5_dl_05003390[];
extern const Gfx capswitch_seg5_dl_050033B0[];
extern const s16 capswitch_collision_050033D0[];
extern const s16 capswitch_collision_05003448[];
extern const Collision capswitch_collision_050033D0[];
extern const Collision capswitch_collision_05003448[];
// springboard
extern const GeoLayout springboard_top_geo[];
@ -24,6 +24,6 @@ extern const GeoLayout springboard_bottom_geo[];
extern const Gfx springboard_checkerboard_seg5_dl_050016B8[];
extern const Gfx springboard_spring_seg5_dl_05001800[];
extern const Gfx springboard_checkerboard_seg5_dl_05001900[];
extern const s16 springboard_collision_05001A28[];
extern const Collision springboard_collision_05001A28[];
#endif

View File

@ -1,7 +1,7 @@
// Metal Box
// 0x08024C28 - 0x08024CAC
const s16 metal_box_seg8_collision_08024C28[] = {
const Collision metal_box_seg8_collision_08024C28[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(154, 307, -153),

View File

@ -1,7 +1,7 @@
// Penguin
// 0x05008B88 - 0x05008C00
const s16 penguin_seg5_collision_05008B88[] = {
const Collision penguin_seg5_collision_05008B88[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(12, 66, -12),

View File

@ -1,7 +1,7 @@
// Poundable Pole
// 0x06002490 - 0x06002580
const s16 poundable_pole_collision_06002490[] = {
const Collision poundable_pole_collision_06002490[] = {
COL_INIT(),
COL_VERTEX_INIT(0x10),
COL_VERTEX(-39, -19, -96),

View File

@ -1,7 +1,7 @@
// Purple Switch
// 0x0800C7A8 - 0x0800C820
const s16 purple_switch_seg8_collision_0800C7A8[] = {
const Collision purple_switch_seg8_collision_0800C7A8[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(61, 36, -60),

View File

@ -1,7 +1,7 @@
// Springboard
// 0x05001A28 - 0x05001B48
const s16 springboard_collision_05001A28[] = {
const Collision springboard_collision_05001A28[] = {
COL_INIT(),
COL_VERTEX_INIT(0xC),
COL_VERTEX(205, 0, 0),

View File

@ -1,7 +1,7 @@
// Test Platform (small tiny platform 1/4th the size of a box. Probably used in early modeling tests?)
// 0x080262F8 - 0x0802637C
const s16 unknown_seg8_collision_080262F8[] = {
const Collision unknown_seg8_collision_080262F8[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(200, 0, -200),

View File

@ -1,7 +1,7 @@
// Thwomp
// 0x0500B7D0 - 0x0500B92C
const s16 thwomp_seg5_collision_0500B7D0[] = {
const Collision thwomp_seg5_collision_0500B7D0[] = {
COL_INIT(),
COL_VERTEX_INIT(0x14),
COL_VERTEX(-156, 3, 73),
@ -67,7 +67,7 @@ const s16 thwomp_seg5_collision_0500B7D0[] = {
};
// 0x0500B92C - 0x0500BA88
const s16 thwomp_seg5_collision_0500B92C[] = {
const Collision thwomp_seg5_collision_0500B92C[] = {
COL_INIT(),
COL_VERTEX_INIT(0x14),
COL_VERTEX(-156, 3, 73),

View File

@ -1,7 +1,7 @@
// Warp Collision (seems strange to put these collision in another file. Only instance of this seperation thus far. Not sure what this is doing as a file.)
// 0x0301CE78 - 0x0301CECC
const s16 door_seg3_collision_0301CE78[] = {
const Collision door_seg3_collision_0301CE78[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(-80, 240, 30),
@ -23,7 +23,7 @@ const s16 door_seg3_collision_0301CE78[] = {
};
// 0x0301CECC - 0x0301CEFC
const s16 lll_hexagonal_mesh_seg3_collision_0301CECC[] = {
const Collision lll_hexagonal_mesh_seg3_collision_0301CECC[] = {
COL_INIT(),
COL_VERTEX_INIT(0x4),
COL_VERTEX(-200, 0, -200),

View File

@ -1,7 +1,7 @@
// Warp Pipe
// 0x03009AC8 - 0x03009CD8
const s16 warp_pipe_seg3_collision_03009AC8[] = {
const Collision warp_pipe_seg3_collision_03009AC8[] = {
COL_INIT(),
COL_VERTEX_INIT(0x24),
COL_VERTEX(-101, 0, 102),

View File

@ -1,7 +1,7 @@
// Whomp
// 0x06020A0C - 0x06020A90
const s16 whomp_seg6_collision_06020A0C[] = {
const Collision whomp_seg6_collision_06020A0C[] = {
#ifdef VERSION_JP
COL_INIT(),
COL_VERTEX_INIT(0x8),

View File

@ -1,7 +1,7 @@
// Wooden Signpost
// 0x0302DD80 - 0x0302DE04
const s16 wooden_signpost_seg3_collision_0302DD80[] = {
const Collision wooden_signpost_seg3_collision_0302DD80[] = {
COL_INIT(),
COL_VERTEX_INIT(0x8),
COL_VERTEX(-44, -9, -12),

View File

@ -799,4 +799,54 @@ func_A4000AD0:
# 0xA4000B70-0xA4000FFF: IPL3 Font
glabel ipl3_font
.incbin "lib/bin/ipl3_font.bin"
.incbin "textures/ipl3_raw/ipl3_font_00.ia1"
.incbin "textures/ipl3_raw/ipl3_font_01.ia1"
.incbin "textures/ipl3_raw/ipl3_font_02.ia1"
.incbin "textures/ipl3_raw/ipl3_font_03.ia1"
.incbin "textures/ipl3_raw/ipl3_font_04.ia1"
.incbin "textures/ipl3_raw/ipl3_font_05.ia1"
.incbin "textures/ipl3_raw/ipl3_font_06.ia1"
.incbin "textures/ipl3_raw/ipl3_font_07.ia1"
.incbin "textures/ipl3_raw/ipl3_font_08.ia1"
.incbin "textures/ipl3_raw/ipl3_font_09.ia1"
.incbin "textures/ipl3_raw/ipl3_font_10.ia1"
.incbin "textures/ipl3_raw/ipl3_font_11.ia1"
.incbin "textures/ipl3_raw/ipl3_font_12.ia1"
.incbin "textures/ipl3_raw/ipl3_font_13.ia1"
.incbin "textures/ipl3_raw/ipl3_font_14.ia1"
.incbin "textures/ipl3_raw/ipl3_font_15.ia1"
.incbin "textures/ipl3_raw/ipl3_font_16.ia1"
.incbin "textures/ipl3_raw/ipl3_font_17.ia1"
.incbin "textures/ipl3_raw/ipl3_font_18.ia1"
.incbin "textures/ipl3_raw/ipl3_font_19.ia1"
.incbin "textures/ipl3_raw/ipl3_font_20.ia1"
.incbin "textures/ipl3_raw/ipl3_font_21.ia1"
.incbin "textures/ipl3_raw/ipl3_font_22.ia1"
.incbin "textures/ipl3_raw/ipl3_font_23.ia1"
.incbin "textures/ipl3_raw/ipl3_font_24.ia1"
.incbin "textures/ipl3_raw/ipl3_font_25.ia1"
.incbin "textures/ipl3_raw/ipl3_font_26.ia1"
.incbin "textures/ipl3_raw/ipl3_font_27.ia1"
.incbin "textures/ipl3_raw/ipl3_font_28.ia1"
.incbin "textures/ipl3_raw/ipl3_font_29.ia1"
.incbin "textures/ipl3_raw/ipl3_font_30.ia1"
.incbin "textures/ipl3_raw/ipl3_font_31.ia1"
.incbin "textures/ipl3_raw/ipl3_font_32.ia1"
.incbin "textures/ipl3_raw/ipl3_font_33.ia1"
.incbin "textures/ipl3_raw/ipl3_font_34.ia1"
.incbin "textures/ipl3_raw/ipl3_font_35.ia1"
.incbin "textures/ipl3_raw/ipl3_font_36.ia1"
.incbin "textures/ipl3_raw/ipl3_font_37.ia1"
.incbin "textures/ipl3_raw/ipl3_font_38.ia1"
.incbin "textures/ipl3_raw/ipl3_font_39.ia1"
.incbin "textures/ipl3_raw/ipl3_font_40.ia1"
.incbin "textures/ipl3_raw/ipl3_font_41.ia1"
.incbin "textures/ipl3_raw/ipl3_font_42.ia1"
.incbin "textures/ipl3_raw/ipl3_font_43.ia1"
.incbin "textures/ipl3_raw/ipl3_font_44.ia1"
.incbin "textures/ipl3_raw/ipl3_font_45.ia1"
.incbin "textures/ipl3_raw/ipl3_font_46.ia1"
.incbin "textures/ipl3_raw/ipl3_font_47.ia1"
.incbin "textures/ipl3_raw/ipl3_font_48.ia1"
.incbin "textures/ipl3_raw/ipl3_font_49.ia1"
.fill 0x12

View File

@ -1,781 +0,0 @@
.late_rodata
glabel jtbl_EU_803066A0
.word L_EU_802E7960, L_EU_802E7B6C
.word L_EU_802E7B6C, L_EU_802E78F8
.word L_EU_802E78C0, L_EU_802E7B6C
.word L_EU_802E7B6C, L_EU_802E7940
.word L_EU_802E7880, L_EU_802E7B6C
.word L_EU_802E7B6C, L_EU_802E7848
glabel jtbl_EU_803066D0
.word L_EU_802E7980, L_EU_802E79BC
.word L_EU_802E7A1C, L_EU_802E79E4
.word L_EU_802E79E4, L_EU_802E7A30
.word L_EU_802E7AA0, L_EU_802E7B28
.word L_EU_802E79BC, L_EU_802E7980
.word L_EU_802E7B30, L_EU_802E7B5C
glabel jtbl_EU_80306700
.word L_EU_802E7F48, L_EU_802E7F50
.word L_EU_802E7F48, L_EU_802E7F50
.word L_EU_802E7F48
.text
glabel seq_channel_layer_process_script
/* 0A6F08 802E7708 27BDFF90 */ addiu $sp, $sp, -0x70
/* 0A6F0C 802E770C 240E0001 */ li $t6, 1
/* 0A6F10 802E7710 AFBF002C */ sw $ra, 0x2c($sp)
/* 0A6F14 802E7714 AFB40028 */ sw $s4, 0x28($sp)
/* 0A6F18 802E7718 AFB30024 */ sw $s3, 0x24($sp)
/* 0A6F1C 802E771C AFB20020 */ sw $s2, 0x20($sp)
/* 0A6F20 802E7720 AFB1001C */ sw $s1, 0x1c($sp)
/* 0A6F24 802E7724 AFB00018 */ sw $s0, 0x18($sp)
/* 0A6F28 802E7728 AFAE0044 */ sw $t6, 0x44($sp)
/* 0A6F2C 802E772C 8C820000 */ lw $v0, ($a0)
/* 0A6F30 802E7730 00808825 */ move $s1, $a0
/* 0A6F34 802E7734 00027FC2 */ srl $t7, $v0, 0x1f
/* 0A6F38 802E7738 51E0028E */ beql $t7, $zero, .L80202184
/* 0A6F3C 802E773C 8FBF002C */ lw $ra, 0x2c($sp)
/* 0A6F40 802E7740 84830038 */ lh $v1, 0x38($a0)
/* 0A6F44 802E7744 00024080 */ sll $t0, $v0, 2
/* 0A6F48 802E7748 000278C0 */ sll $t7, $v0, 3
/* 0A6F4C 802E774C 28610002 */ slti $at, $v1, 2
/* 0A6F50 802E7750 1420000E */ bnez $at, .L8020179C
/* 0A6F54 802E7754 2478FFFF */ addiu $t8, $v1, -1
/* 0A6F58 802E7758 05000285 */ bltz $t0, .L80202180
/* 0A6F5C 802E775C A4980038 */ sh $t8, 0x38($a0)
/* 0A6F60 802E7760 8489003A */ lh $t1, 0x3a($a0)
/* 0A6F64 802E7764 848A0038 */ lh $t2, 0x38($a0)
/* 0A6F68 802E7768 012A082A */ slt $at, $t1, $t2
/* 0A6F6C 802E776C 54200281 */ bnezl $at, .L80202184
/* 0A6F70 802E7770 8FBF002C */ lw $ra, 0x2c($sp)
/* 0A6F74 802E7774 0C0B95B3 */ jal seq_channel_layer_note_decay
/* 0A6F78 802E7778 00000000 */ nop
/* 0A6F7C 802E777C 922C0000 */ lbu $t4, ($s1)
/* 0A6F80 802E7780 358D0020 */ ori $t5, $t4, 0x20
/* 0A6F84 802E7784 1000027A */ b .L80202180
/* 0A6F88 802E7788 A22D0000 */ sb $t5, ($s1)
.L8020179C:
/* 0A6F8C 802E778C 05E20004 */ bltzl $t7, .L802017B0
/* 0A6F90 802E7790 92220008 */ lbu $v0, 8($s1)
/* 0A6F94 802E7794 0C0B95B3 */ jal seq_channel_layer_note_decay
/* 0A6F98 802E7798 02202025 */ move $a0, $s1
/* 0A6F9C 802E779C 92220008 */ lbu $v0, 8($s1)
.L802017B0:
/* 0A6FA0 802E77A0 2401FF7F */ li $at, -129
/* 0A6FA4 802E77A4 0041C024 */ and $t8, $v0, $at
/* 0A6FA8 802E77A8 24010001 */ li $at, 1
/* 0A6FAC 802E77AC 13010003 */ beq $t8, $at, .L802017CC
/* 0A6FB0 802E77B0 24010002 */ li $at, 2
/* 0A6FB4 802E77B4 57010003 */ bnel $t8, $at, .L802017D4
/* 0A6FB8 802E77B8 8E22004C */ lw $v0, 0x4c($s1)
.L802017CC:
/* 0A6FBC 802E77BC A2200008 */ sb $zero, 8($s1)
/* 0A6FC0 802E77C0 8E22004C */ lw $v0, 0x4c($s1)
.L802017D4:
/* 0A6FC4 802E77C4 92280000 */ lbu $t0, ($s1)
/* 0A6FC8 802E77C8 26300050 */ addiu $s0, $s1, 0x50
/* 0A6FCC 802E77CC 8C540044 */ lw $s4, 0x44($v0)
/* 0A6FD0 802E77D0 35090004 */ ori $t1, $t0, 4
/* 0A6FD4 802E77D4 A2290000 */ sb $t1, ($s1)
/* 0A6FD8 802E77D8 97B3004A */ lhu $s3, 0x4a($sp)
/* 0A6FDC 802E77DC AFA20068 */ sw $v0, 0x68($sp)
.L802017F0:
/* 0A6FE0 802E77E0 0C0B9DA0 */ jal m64_read_u8
/* 0A6FE4 802E77E4 02002025 */ move $a0, $s0
/* 0A6FE8 802E77E8 284100C1 */ slti $at, $v0, 0xc1
/* 0A6FEC 802E77EC 305200FF */ andi $s2, $v0, 0xff
/* 0A6FF0 802E77F0 142000F7 */ bnez $at, .L80201BE0
/* 0A6FF4 802E77F4 00402825 */ move $a1, $v0
/* 0A6FF8 802E77F8 284100CD */ slti $at, $v0, 0xcd
/* 0A6FFC 802E77FC 1420000A */ bnez $at, .L80201838
/* 0A7000 802E7800 24ABFF3F */ addiu $t3, $a1, -0xc1
/* 0A7004 802E7804 244AFF0C */ addiu $t2, $v0, -0xf4
/* 0A7008 802E7808 2D41000C */ sltiu $at, $t2, 0xc
/* 0A700C 802E780C 102000D7 */ beqz $at, .L_EU_802E7B6C
/* 0A7010 802E7810 000A5080 */ sll $t2, $t2, 2
/* 0A7014 802E7814 3C018030 */ lui $at, %hi(jtbl_EU_803066A0)
/* 0A7018 802E7818 002A0821 */ addu $at, $at, $t2
/* 0A701C 802E781C 8C2A66A0 */ lw $t2, %lo(jtbl_EU_803066A0)($at)
/* 0A7020 802E7820 01400008 */ jr $t2
/* 0A7024 802E7824 00000000 */ nop
.L80201838:
/* 0A7028 802E7828 2D61000C */ sltiu $at, $t3, 0xc
/* 0A702C 802E782C 102000CF */ beqz $at, .L_EU_802E7B6C
/* 0A7030 802E7830 000B5880 */ sll $t3, $t3, 2
/* 0A7034 802E7834 3C018030 */ lui $at, %hi(jtbl_EU_803066D0)
/* 0A7038 802E7838 002B0821 */ addu $at, $at, $t3
/* 0A703C 802E783C 8C2B66D0 */ lw $t3, %lo(jtbl_EU_803066D0)($at)
/* 0A7040 802E7840 01600008 */ jr $t3
/* 0A7044 802E7844 00000000 */ nop
glabel L_EU_802E7848
/* 0A7048 802E7848 92030018 */ lbu $v1, 0x18($s0)
/* 0A704C 802E784C 14600005 */ bnez $v1, .L80201874
/* 0A7050 802E7850 2462FFFF */ addiu $v0, $v1, -1
/* 0A7054 802E7854 0C0B9C1E */ jal seq_channel_layer_disable
/* 0A7058 802E7858 02202025 */ move $a0, $s1
/* 0A705C 802E785C 10000245 */ b .L80202184
/* 0A7060 802E7860 8FBF002C */ lw $ra, 0x2c($sp)
.L80201874:
/* 0A7064 802E7864 304C00FF */ andi $t4, $v0, 0xff
/* 0A7068 802E7868 000C6880 */ sll $t5, $t4, 2
/* 0A706C 802E786C 020D7021 */ addu $t6, $s0, $t5
/* 0A7070 802E7870 A20C0018 */ sb $t4, 0x18($s0)
/* 0A7074 802E7874 8DCF0004 */ lw $t7, 4($t6)
/* 0A7078 802E7878 1000FFD9 */ b .L802017F0
/* 0A707C 802E787C AE0F0000 */ sw $t7, ($s0)
glabel L_EU_802E7880
/* 0A7080 802E7880 0C0B9DA5 */ jal m64_read_s16
/* 0A7084 802E7884 02002025 */ move $a0, $s0
/* 0A7088 802E7888 92190018 */ lbu $t9, 0x18($s0)
/* 0A708C 802E788C 8E180000 */ lw $t8, ($s0)
/* 0A7090 802E7890 304DFFFF */ andi $t5, $v0, 0xffff
/* 0A7094 802E7894 00194080 */ sll $t0, $t9, 2
/* 0A7098 802E7898 02084821 */ addu $t1, $s0, $t0
/* 0A709C 802E789C AD380004 */ sw $t8, 4($t1)
/* 0A70A0 802E78A0 920A0018 */ lbu $t2, 0x18($s0)
/* 0A70A4 802E78A4 3053FFFF */ andi $s3, $v0, 0xffff
/* 0A70A8 802E78A8 254B0001 */ addiu $t3, $t2, 1
/* 0A70AC 802E78AC A20B0018 */ sb $t3, 0x18($s0)
/* 0A70B0 802E78B0 8E8C0014 */ lw $t4, 0x14($s4)
/* 0A70B4 802E78B4 018D7021 */ addu $t6, $t4, $t5
/* 0A70B8 802E78B8 1000FFC9 */ b .L802017F0
/* 0A70BC 802E78BC AE0E0000 */ sw $t6, ($s0)
glabel L_EU_802E78C0
/* 0A70C0 802E78C0 0C0B9DA0 */ jal m64_read_u8
/* 0A70C4 802E78C4 02002025 */ move $a0, $s0
/* 0A70C8 802E78C8 920F0018 */ lbu $t7, 0x18($s0)
/* 0A70CC 802E78CC 020FC821 */ addu $t9, $s0, $t7
/* 0A70D0 802E78D0 A3220014 */ sb $v0, 0x14($t9)
/* 0A70D4 802E78D4 92180018 */ lbu $t8, 0x18($s0)
/* 0A70D8 802E78D8 8E080000 */ lw $t0, ($s0)
/* 0A70DC 802E78DC 00184880 */ sll $t1, $t8, 2
/* 0A70E0 802E78E0 02095021 */ addu $t2, $s0, $t1
/* 0A70E4 802E78E4 AD480004 */ sw $t0, 4($t2)
/* 0A70E8 802E78E8 920B0018 */ lbu $t3, 0x18($s0)
/* 0A70EC 802E78EC 256C0001 */ addiu $t4, $t3, 1
/* 0A70F0 802E78F0 1000FFBB */ b .L802017F0
/* 0A70F4 802E78F4 A20C0018 */ sb $t4, 0x18($s0)
glabel L_EU_802E78F8
/* 0A70F8 802E78F8 920D0018 */ lbu $t5, 0x18($s0)
/* 0A70FC 802E78FC 020D1021 */ addu $v0, $s0, $t5
/* 0A7100 802E7900 904E0013 */ lbu $t6, 0x13($v0)
/* 0A7104 802E7904 25CFFFFF */ addiu $t7, $t6, -1
/* 0A7108 802E7908 A04F0013 */ sb $t7, 0x13($v0)
/* 0A710C 802E790C 92030018 */ lbu $v1, 0x18($s0)
/* 0A7110 802E7910 0203C821 */ addu $t9, $s0, $v1
/* 0A7114 802E7914 93380013 */ lbu $t8, 0x13($t9)
/* 0A7118 802E7918 00602025 */ move $a0, $v1
/* 0A711C 802E791C 00044880 */ sll $t1, $a0, 2
/* 0A7120 802E7920 13000005 */ beqz $t8, .L80201948
/* 0A7124 802E7924 246BFFFF */ addiu $t3, $v1, -1
/* 0A7128 802E7928 02094021 */ addu $t0, $s0, $t1
/* 0A712C 802E792C 8D0A0000 */ lw $t2, ($t0)
/* 0A7130 802E7930 1000FFAB */ b .L802017F0
/* 0A7134 802E7934 AE0A0000 */ sw $t2, ($s0)
.L80201948:
/* 0A7138 802E7938 1000FFA9 */ b .L802017F0
/* 0A713C 802E793C A20B0018 */ sb $t3, 0x18($s0)
glabel L_EU_802E7940
/* 0A7140 802E7940 0C0B9DA5 */ jal m64_read_s16
/* 0A7144 802E7944 02002025 */ move $a0, $s0
/* 0A7148 802E7948 8E8C0014 */ lw $t4, 0x14($s4)
/* 0A714C 802E794C 304DFFFF */ andi $t5, $v0, 0xffff
/* 0A7150 802E7950 3053FFFF */ andi $s3, $v0, 0xffff
/* 0A7154 802E7954 018D7021 */ addu $t6, $t4, $t5
/* 0A7158 802E7958 1000FFA1 */ b .L802017F0
/* 0A715C 802E795C AE0E0000 */ sw $t6, ($s0)
glabel L_EU_802E7960
/* 0A7160 802E7960 0C0B9DA0 */ jal m64_read_u8
/* 0A7164 802E7964 02002025 */ move $a0, $s0
/* 0A7168 802E7968 8E0F0000 */ lw $t7, ($s0)
/* 0A716C 802E796C 0002CE00 */ sll $t9, $v0, 0x18
/* 0A7170 802E7970 0019C603 */ sra $t8, $t9, 0x18
/* 0A7174 802E7974 01F84821 */ addu $t1, $t7, $t8
/* 0A7178 802E7978 1000FF99 */ b .L802017F0
/* 0A717C 802E797C AE090000 */ sw $t1, ($s0)
glabel L_EU_802E7980
/* 0A7180 802E7980 8E030000 */ lw $v1, ($s0)
/* 0A7184 802E7984 240100C1 */ li $at, 193
/* 0A7188 802E7988 90640000 */ lbu $a0, ($v1)
/* 0A718C 802E798C 24680001 */ addiu $t0, $v1, 1
/* 0A7190 802E7990 14A10008 */ bne $a1, $at, .L802019C4
/* 0A7194 802E7994 AE080000 */ sw $t0, ($s0)
/* 0A7198 802E7998 00840019 */ multu $a0, $a0
/* 0A719C 802E799C 00005012 */ mflo $t2
/* 0A71A0 802E79A0 448A2000 */ mtc1 $t2, $f4
/* 0A71A4 802E79A4 00000000 */ nop
/* 0A71A8 802E79A8 468021A0 */ cvt.s.w $f6, $f4
/* 0A71AC 802E79AC 1000FF8C */ b .L802017F0
/* 0A71B0 802E79B0 E6260028 */ swc1 $f6, 0x28($s1)
.L802019C4:
/* 0A71B4 802E79B4 1000FF8A */ b .L802017F0
/* 0A71B8 802E79B8 A2240005 */ sb $a0, 5($s1)
glabel L_EU_802E79BC
/* 0A71BC 802E79BC 8E030000 */ lw $v1, ($s0)
/* 0A71C0 802E79C0 240100C9 */ li $at, 201
/* 0A71C4 802E79C4 90640000 */ lbu $a0, ($v1)
/* 0A71C8 802E79C8 246B0001 */ addiu $t3, $v1, 1
/* 0A71CC 802E79CC 14A10003 */ bne $a1, $at, .L802019EC
/* 0A71D0 802E79D0 AE0B0000 */ sw $t3, ($s0)
/* 0A71D4 802E79D4 1000FF82 */ b .L802017F0
/* 0A71D8 802E79D8 A2240003 */ sb $a0, 3($s1)
.L802019EC:
/* 0A71DC 802E79DC 1000FF80 */ b .L802017F0
/* 0A71E0 802E79E0 A6240022 */ sh $a0, 0x22($s1)
glabel L_EU_802E79E4
/* 0A71E4 802E79E4 240100C4 */ li $at, 196
/* 0A71E8 802E79E8 54A10006 */ bnel $a1, $at, .L80201A14
/* 0A71EC 802E79EC 92390000 */ lbu $t9, ($s1)
/* 0A71F0 802E79F0 922D0000 */ lbu $t5, ($s1)
/* 0A71F4 802E79F4 35AE0010 */ ori $t6, $t5, 0x10
/* 0A71F8 802E79F8 10000004 */ b .L80201A1C
/* 0A71FC 802E79FC A22E0000 */ sb $t6, ($s1)
/* 0A7200 802E7A00 92390000 */ lbu $t9, ($s1)
.L80201A14:
/* 0A7204 802E7A04 332FFFEF */ andi $t7, $t9, 0xffef
/* 0A7208 802E7A08 A22F0000 */ sb $t7, ($s1)
.L80201A1C:
/* 0A720C 802E7A0C 0C0B95B3 */ jal seq_channel_layer_note_decay
/* 0A7210 802E7A10 02202025 */ move $a0, $s1
/* 0A7214 802E7A14 1000FF72 */ b .L802017F0
/* 0A7218 802E7A18 00000000 */ nop
glabel L_EU_802E7A1C
/* 0A721C 802E7A1C 0C0B9DB1 */ jal m64_read_compressed_u16
/* 0A7220 802E7A20 02002025 */ move $a0, $s0
/* 0A7224 802E7A24 3053FFFF */ andi $s3, $v0, 0xffff
/* 0A7228 802E7A28 1000FF6D */ b .L802017F0
/* 0A722C 802E7A2C A6220034 */ sh $v0, 0x34($s1)
glabel L_EU_802E7A30
/* 0A7230 802E7A30 0C0B9DA0 */ jal m64_read_u8
/* 0A7234 802E7A34 02002025 */ move $a0, $s0
/* 0A7238 802E7A38 2841007F */ slti $at, $v0, 0x7f
/* 0A723C 802E7A3C 305200FF */ andi $s2, $v0, 0xff
/* 0A7240 802E7A40 1420000D */ bnez $at, .L80201A88
/* 0A7244 802E7A44 00402825 */ move $a1, $v0
/* 0A7248 802E7A48 2401007F */ li $at, 127
/* 0A724C 802E7A4C 54410004 */ bnel $v0, $at, .L80201A70
/* 0A7250 802E7A50 A2220001 */ sb $v0, 1($s1)
/* 0A7254 802E7A54 10000003 */ b .L80201A74
/* 0A7258 802E7A58 A2200001 */ sb $zero, 1($s1)
/* 0A725C 802E7A5C A2220001 */ sb $v0, 1($s1)
.L80201A70:
/* 0A7260 802E7A60 AE200044 */ sw $zero, 0x44($s1)
.L80201A74:
/* 0A7264 802E7A64 240100FF */ li $at, 255
/* 0A7268 802E7A68 14A1FF5D */ bne $a1, $at, .L802017F0
/* 0A726C 802E7A6C 00000000 */ nop
/* 0A7270 802E7A70 1000FF5B */ b .L802017F0
/* 0A7274 802E7A74 A2200018 */ sb $zero, 0x18($s1)
.L80201A88:
/* 0A7278 802E7A78 8FA40068 */ lw $a0, 0x68($sp)
/* 0A727C 802E7A7C 324500FF */ andi $a1, $s2, 0xff
/* 0A7280 802E7A80 26260044 */ addiu $a2, $s1, 0x44
/* 0A7284 802E7A84 0C0BA064 */ jal get_instrument
/* 0A7288 802E7A88 26270018 */ addiu $a3, $s1, 0x18
/* 0A728C 802E7A8C 1440FF54 */ bnez $v0, .L802017F0
/* 0A7290 802E7A90 A2220001 */ sb $v0, 1($s1)
/* 0A7294 802E7A94 241800FF */ li $t8, 255
/* 0A7298 802E7A98 1000FF51 */ b .L802017F0
/* 0A729C 802E7A9C A2380001 */ sb $t8, 1($s1)
glabel L_EU_802E7AA0
/* 0A72A0 802E7AA0 0C0B9DA0 */ jal m64_read_u8
/* 0A72A4 802E7AA4 02002025 */ move $a0, $s0
/* 0A72A8 802E7AA8 A2220008 */ sb $v0, 8($s1)
/* 0A72AC 802E7AAC 0C0B9DA0 */ jal m64_read_u8
/* 0A72B0 802E7AB0 02002025 */ move $a0, $s0
/* 0A72B4 802E7AB4 8FA90068 */ lw $t1, 0x68($sp)
/* 0A72B8 802E7AB8 862B0022 */ lh $t3, 0x22($s1)
/* 0A72BC 802E7ABC 868D000C */ lh $t5, 0xc($s4)
/* 0A72C0 802E7AC0 8528001E */ lh $t0, 0x1e($t1)
/* 0A72C4 802E7AC4 00485021 */ addu $t2, $v0, $t0
/* 0A72C8 802E7AC8 014B6021 */ addu $t4, $t2, $t3
/* 0A72CC 802E7ACC 018D9021 */ addu $s2, $t4, $t5
/* 0A72D0 802E7AD0 324E00FF */ andi $t6, $s2, 0xff
/* 0A72D4 802E7AD4 29C10080 */ slti $at, $t6, 0x80
/* 0A72D8 802E7AD8 14200002 */ bnez $at, .L80201AF4
/* 0A72DC 802E7ADC 01C09025 */ move $s2, $t6
/* 0A72E0 802E7AE0 00009025 */ move $s2, $zero
.L80201AF4:
/* 0A72E4 802E7AE4 92390008 */ lbu $t9, 8($s1)
/* 0A72E8 802E7AE8 A2320004 */ sb $s2, 4($s1)
/* 0A72EC 802E7AEC 332F0080 */ andi $t7, $t9, 0x80
/* 0A72F0 802E7AF0 11E00008 */ beqz $t7, .L80201B24
/* 0A72F4 802E7AF4 00000000 */ nop
/* 0A72F8 802E7AF8 8E180000 */ lw $t8, ($s0)
/* 0A72FC 802E7AFC 93090000 */ lbu $t1, ($t8)
/* 0A7300 802E7B00 A6290020 */ sh $t1, 0x20($s1)
/* 0A7304 802E7B04 8E080000 */ lw $t0, ($s0)
/* 0A7308 802E7B08 250A0001 */ addiu $t2, $t0, 1
/* 0A730C 802E7B0C 1000FF34 */ b .L802017F0
/* 0A7310 802E7B10 AE0A0000 */ sw $t2, ($s0)
.L80201B24:
/* 0A7314 802E7B14 0C0B9DB1 */ jal m64_read_compressed_u16
/* 0A7318 802E7B18 02002025 */ move $a0, $s0
/* 0A731C 802E7B1C 3053FFFF */ andi $s3, $v0, 0xffff
/* 0A7320 802E7B20 1000FF2F */ b .L802017F0
/* 0A7324 802E7B24 A6220020 */ sh $v0, 0x20($s1)
glabel L_EU_802E7B28
/* 0A7328 802E7B28 1000FF2D */ b .L802017F0
/* 0A732C 802E7B2C A2200008 */ sb $zero, 8($s1)
glabel L_EU_802E7B30
/* 0A7330 802E7B30 0C0B9DA5 */ jal m64_read_s16
/* 0A7334 802E7B34 02002025 */ move $a0, $s0
/* 0A7338 802E7B38 8E8B0014 */ lw $t3, 0x14($s4)
/* 0A733C 802E7B3C 304CFFFF */ andi $t4, $v0, 0xffff
/* 0A7340 802E7B40 3053FFFF */ andi $s3, $v0, 0xffff
/* 0A7344 802E7B44 016C6821 */ addu $t5, $t3, $t4
/* 0A7348 802E7B48 AE2D001C */ sw $t5, 0x1c($s1)
/* 0A734C 802E7B4C 0C0B9DA0 */ jal m64_read_u8
/* 0A7350 802E7B50 02002025 */ move $a0, $s0
/* 0A7354 802E7B54 1000FF22 */ b .L802017F0
/* 0A7358 802E7B58 A2220018 */ sb $v0, 0x18($s1)
glabel L_EU_802E7B5C
/* 0A735C 802E7B5C 92390000 */ lbu $t9, ($s1)
/* 0A7360 802E7B60 372F0002 */ ori $t7, $t9, 2
/* 0A7364 802E7B64 1000FF1E */ b .L802017F0
/* 0A7368 802E7B68 A22F0000 */ sb $t7, ($s1)
glabel L_EU_802E7B6C
.L_EU_802E7B6C:
/* 0A736C 802E7B6C 30A300F0 */ andi $v1, $a1, 0xf0
/* 0A7370 802E7B70 240100D0 */ li $at, 208
/* 0A7374 802E7B74 10610005 */ beq $v1, $at, .L80201B9C
/* 0A7378 802E7B78 240100E0 */ li $at, 224
/* 0A737C 802E7B7C 5061000F */ beql $v1, $at, .L80201BCC
/* 0A7380 802E7B80 8E8B0090 */ lw $t3, 0x90($s4)
/* 0A7384 802E7B84 1000FF16 */ b .L802017F0
/* 0A7388 802E7B88 00000000 */ nop
.L80201B9C:
/* 0A738C 802E7B8C 8E98008C */ lw $t8, 0x8c($s4)
/* 0A7390 802E7B90 30A9000F */ andi $t1, $a1, 0xf
/* 0A7394 802E7B94 03094021 */ addu $t0, $t8, $t1
/* 0A7398 802E7B98 91130000 */ lbu $s3, ($t0)
/* 0A739C 802E7B9C 02730019 */ multu $s3, $s3
/* 0A73A0 802E7BA0 00005012 */ mflo $t2
/* 0A73A4 802E7BA4 448A4000 */ mtc1 $t2, $f8
/* 0A73A8 802E7BA8 00000000 */ nop
/* 0A73AC 802E7BAC 468042A0 */ cvt.s.w $f10, $f8
/* 0A73B0 802E7BB0 1000FF0B */ b .L802017F0
/* 0A73B4 802E7BB4 E62A0028 */ swc1 $f10, 0x28($s1)
/* 0A73B8 802E7BB8 8E8B0090 */ lw $t3, 0x90($s4)
.L80201BCC:
/* 0A73BC 802E7BBC 30AC000F */ andi $t4, $a1, 0xf
/* 0A73C0 802E7BC0 016C6821 */ addu $t5, $t3, $t4
/* 0A73C4 802E7BC4 91AE0000 */ lbu $t6, ($t5)
/* 0A73C8 802E7BC8 1000FF05 */ b .L802017F0
/* 0A73CC 802E7BCC A22E0003 */ sb $t6, 3($s1)
.L80201BE0:
/* 0A73D0 802E7BD0 240100C0 */ li $at, 192
/* 0A73D4 802E7BD4 14A10008 */ bne $a1, $at, .L80201C08
/* 0A73D8 802E7BD8 30A300C0 */ andi $v1, $a1, 0xc0
/* 0A73DC 802E7BDC 0C0B9DB1 */ jal m64_read_compressed_u16
/* 0A73E0 802E7BE0 02002025 */ move $a0, $s0
/* 0A73E4 802E7BE4 922F0000 */ lbu $t7, ($s1)
/* 0A73E8 802E7BE8 A6220038 */ sh $v0, 0x38($s1)
/* 0A73EC 802E7BEC 35F80020 */ ori $t8, $t7, 0x20
/* 0A73F0 802E7BF0 10000125 */ b .L80202098
/* 0A73F4 802E7BF4 A2380000 */ sb $t8, ($s1)
.L80201C08:
/* 0A73F8 802E7BF8 92290000 */ lbu $t1, ($s1)
/* 0A73FC 802E7BFC 24010001 */ li $at, 1
/* 0A7400 802E7C00 3128FFDF */ andi $t0, $t1, 0xffdf
/* 0A7404 802E7C04 A2280000 */ sb $t0, ($s1)
/* 0A7408 802E7C08 8FAA0068 */ lw $t2, 0x68($sp)
/* 0A740C 802E7C0C 8D4B0000 */ lw $t3, ($t2)
/* 0A7410 802E7C10 000B6180 */ sll $t4, $t3, 6
/* 0A7414 802E7C14 000C6FC2 */ srl $t5, $t4, 0x1f
/* 0A7418 802E7C18 15A10038 */ bne $t5, $at, .L80201D0C
/* 0A741C 802E7C1C 00000000 */ nop
/* 0A7420 802E7C20 30A300C0 */ andi $v1, $a1, 0xc0
/* 0A7424 802E7C24 10600007 */ beqz $v1, .L80201C54
/* 0A7428 802E7C28 24010040 */ li $at, 64
/* 0A742C 802E7C2C 10610014 */ beq $v1, $at, .L80201C90
/* 0A7430 802E7C30 24010080 */ li $at, 128
/* 0A7434 802E7C34 1061001D */ beq $v1, $at, .L80201CBC
/* 0A7438 802E7C38 02602025 */ move $a0, $s3
/* 0A743C 802E7C3C 10000026 */ b .L80201CE8
/* 0A7440 802E7C40 8FA60034 */ lw $a2, 0x34($sp)
.L80201C54:
/* 0A7444 802E7C44 0C0B9DB1 */ jal m64_read_compressed_u16
/* 0A7448 802E7C48 02002025 */ move $a0, $s0
/* 0A744C 802E7C4C 8E030000 */ lw $v1, ($s0)
/* 0A7450 802E7C50 3053FFFF */ andi $s3, $v0, 0xffff
/* 0A7454 802E7C54 02602025 */ move $a0, $s3
/* 0A7458 802E7C58 90660000 */ lbu $a2, ($v1)
/* 0A745C 802E7C5C 246E0001 */ addiu $t6, $v1, 1
/* 0A7460 802E7C60 AE0E0000 */ sw $t6, ($s0)
/* 0A7464 802E7C64 91CF0000 */ lbu $t7, ($t6)
/* 0A7468 802E7C68 A22F0003 */ sb $t7, 3($s1)
/* 0A746C 802E7C6C 8E180000 */ lw $t8, ($s0)
/* 0A7470 802E7C70 27090001 */ addiu $t1, $t8, 1
/* 0A7474 802E7C74 AE090000 */ sw $t1, ($s0)
/* 0A7478 802E7C78 10000017 */ b .L80201CE8
/* 0A747C 802E7C7C A6220036 */ sh $v0, 0x36($s1)
.L80201C90:
/* 0A7480 802E7C80 0C0B9DB1 */ jal m64_read_compressed_u16
/* 0A7484 802E7C84 02002025 */ move $a0, $s0
/* 0A7488 802E7C88 8E030000 */ lw $v1, ($s0)
/* 0A748C 802E7C8C 3053FFFF */ andi $s3, $v0, 0xffff
/* 0A7490 802E7C90 02602025 */ move $a0, $s3
/* 0A7494 802E7C94 90660000 */ lbu $a2, ($v1)
/* 0A7498 802E7C98 24680001 */ addiu $t0, $v1, 1
/* 0A749C 802E7C9C AE080000 */ sw $t0, ($s0)
/* 0A74A0 802E7CA0 A2200003 */ sb $zero, 3($s1)
/* 0A74A4 802E7CA4 1000000C */ b .L80201CE8
/* 0A74A8 802E7CA8 A6220036 */ sh $v0, 0x36($s1)
.L80201CBC:
/* 0A74AC 802E7CAC 8E030000 */ lw $v1, ($s0)
/* 0A74B0 802E7CB0 96330036 */ lhu $s3, 0x36($s1)
/* 0A74B4 802E7CB4 90660000 */ lbu $a2, ($v1)
/* 0A74B8 802E7CB8 246A0001 */ addiu $t2, $v1, 1
/* 0A74BC 802E7CBC AE0A0000 */ sw $t2, ($s0)
/* 0A74C0 802E7CC0 914C0000 */ lbu $t4, ($t2)
/* 0A74C4 802E7CC4 02602025 */ move $a0, $s3
/* 0A74C8 802E7CC8 A22C0003 */ sb $t4, 3($s1)
/* 0A74CC 802E7CCC 8E0D0000 */ lw $t5, ($s0)
/* 0A74D0 802E7CD0 25AE0001 */ addiu $t6, $t5, 1
/* 0A74D4 802E7CD4 AE0E0000 */ sw $t6, ($s0)
.L80201CE8:
/* 0A74D8 802E7CD8 44868000 */ mtc1 $a2, $f16
/* 0A74DC 802E7CDC 325900C0 */ andi $t9, $s2, 0xc0
/* 0A74E0 802E7CE0 02599023 */ subu $s2, $s2, $t9
/* 0A74E4 802E7CE4 46808020 */ cvt.s.w $f0, $f16
/* 0A74E8 802E7CE8 324F00FF */ andi $t7, $s2, 0xff
/* 0A74EC 802E7CEC 01E09025 */ move $s2, $t7
/* 0A74F0 802E7CF0 46000482 */ mul.s $f18, $f0, $f0
/* 0A74F4 802E7CF4 10000018 */ b .L80201D68
/* 0A74F8 802E7CF8 E6320028 */ swc1 $f18, 0x28($s1)
.L80201D0C:
/* 0A74FC 802E7CFC 10600007 */ beqz $v1, .L80201D2C
/* 0A7500 802E7D00 24010040 */ li $at, 64
/* 0A7504 802E7D04 1061000B */ beq $v1, $at, .L80201D44
/* 0A7508 802E7D08 24010080 */ li $at, 128
/* 0A750C 802E7D0C 5061000D */ beql $v1, $at, .L80201D54
/* 0A7510 802E7D10 96330036 */ lhu $s3, 0x36($s1)
/* 0A7514 802E7D14 1000000C */ b .L80201D58
/* 0A7518 802E7D18 02602025 */ move $a0, $s3
.L80201D2C:
/* 0A751C 802E7D1C 0C0B9DB1 */ jal m64_read_compressed_u16
/* 0A7520 802E7D20 02002025 */ move $a0, $s0
/* 0A7524 802E7D24 3053FFFF */ andi $s3, $v0, 0xffff
/* 0A7528 802E7D28 A6220036 */ sh $v0, 0x36($s1)
/* 0A752C 802E7D2C 10000006 */ b .L80201D58
/* 0A7530 802E7D30 02602025 */ move $a0, $s3
.L80201D44:
/* 0A7534 802E7D34 96330034 */ lhu $s3, 0x34($s1)
/* 0A7538 802E7D38 10000003 */ b .L80201D58
/* 0A753C 802E7D3C 02602025 */ move $a0, $s3
/* 0A7540 802E7D40 96330036 */ lhu $s3, 0x36($s1)
.L80201D54:
/* 0A7544 802E7D44 02602025 */ move $a0, $s3
.L80201D58:
/* 0A7548 802E7D48 325800C0 */ andi $t8, $s2, 0xc0
/* 0A754C 802E7D4C 02589023 */ subu $s2, $s2, $t8
/* 0A7550 802E7D50 324900FF */ andi $t1, $s2, 0xff
/* 0A7554 802E7D54 01209025 */ move $s2, $t1
.L80201D68:
/* 0A7558 802E7D58 92280003 */ lbu $t0, 3($s1)
/* 0A755C 802E7D5C A6240038 */ sh $a0, 0x38($s1)
/* 0A7560 802E7D60 01040019 */ multu $t0, $a0
/* 0A7564 802E7D64 00005012 */ mflo $t2
/* 0A7568 802E7D68 000A5A03 */ sra $t3, $t2, 8
/* 0A756C 802E7D6C A62B003A */ sh $t3, 0x3a($s1)
/* 0A7570 802E7D70 8E8C0000 */ lw $t4, ($s4)
/* 0A7574 802E7D74 8FB90068 */ lw $t9, 0x68($sp)
/* 0A7578 802E7D78 8FA90068 */ lw $t1, 0x68($sp)
/* 0A757C 802E7D7C 000C7080 */ sll $t6, $t4, 2
/* 0A7580 802E7D80 05C10005 */ bgez $t6, .L80201DA8
/* 0A7584 802E7D84 8FAC0068 */ lw $t4, 0x68($sp)
/* 0A7588 802E7D88 932F0003 */ lbu $t7, 3($t9)
/* 0A758C 802E7D8C 31F80040 */ andi $t8, $t7, 0x40
/* 0A7590 802E7D90 57000007 */ bnezl $t8, .L80201DC0
/* 0A7594 802E7D94 922D0000 */ lbu $t5, ($s1)
.L80201DA8:
/* 0A7598 802E7D98 8D280000 */ lw $t0, ($t1)
/* 0A759C 802E7D9C 8FB90068 */ lw $t9, 0x68($sp)
/* 0A75A0 802E7DA0 000858C0 */ sll $t3, $t0, 3
/* 0A75A4 802E7DA4 05630006 */ bgezl $t3, .L80201DD0
/* 0A75A8 802E7DA8 92230001 */ lbu $v1, 1($s1)
/* 0A75AC 802E7DAC 922D0000 */ lbu $t5, ($s1)
.L80201DC0:
/* 0A75B0 802E7DB0 35AE0020 */ ori $t6, $t5, 0x20
/* 0A75B4 802E7DB4 100000B4 */ b .L80202098
/* 0A75B8 802E7DB8 A22E0000 */ sb $t6, ($s1)
/* 0A75BC 802E7DBC 92230001 */ lbu $v1, 1($s1)
.L80201DD0:
/* 0A75C0 802E7DC0 240100FF */ li $at, 255
/* 0A75C4 802E7DC4 14610002 */ bne $v1, $at, .L80201DE0
/* 0A75C8 802E7DC8 00601025 */ move $v0, $v1
/* 0A75CC 802E7DCC 8722001C */ lh $v0, 0x1c($t9)
.L80201DE0:
/* 0A75D0 802E7DD0 5440001D */ bnezl $v0, .L80201E58
/* 0A75D4 802E7DD4 868F000C */ lh $t7, 0xc($s4)
/* 0A75D8 802E7DD8 8FAF0068 */ lw $t7, 0x68($sp)
/* 0A75DC 802E7DDC 86280022 */ lh $t0, 0x22($s1)
/* 0A75E0 802E7DE0 85F8001E */ lh $t8, 0x1e($t7)
/* 0A75E4 802E7DE4 91E40006 */ lbu $a0, 6($t7)
/* 0A75E8 802E7DE8 02584821 */ addu $t1, $s2, $t8
/* 0A75EC 802E7DEC 01289021 */ addu $s2, $t1, $t0
/* 0A75F0 802E7DF0 0C0B93EE */ jal get_drum
/* 0A75F4 802E7DF4 324500FF */ andi $a1, $s2, 0xff
/* 0A75F8 802E7DF8 14400005 */ bnez $v0, .L80201E20
/* 0A75FC 802E7DFC 24430004 */ addiu $v1, $v0, 4
/* 0A7600 802E7E00 922C0000 */ lbu $t4, ($s1)
/* 0A7604 802E7E04 358D0020 */ ori $t5, $t4, 0x20
/* 0A7608 802E7E08 1000009D */ b .L80202090
/* 0A760C 802E7E0C A22D0000 */ sb $t5, ($s1)
.L80201E20:
/* 0A7610 802E7E10 8C4E000C */ lw $t6, 0xc($v0)
/* 0A7614 802E7E14 8E380000 */ lw $t8, ($s1)
/* 0A7618 802E7E18 AE2E001C */ sw $t6, 0x1c($s1)
/* 0A761C 802E7E1C 90590000 */ lbu $t9, ($v0)
/* 0A7620 802E7E20 00184180 */ sll $t0, $t8, 6
/* 0A7624 802E7E24 05000003 */ bltz $t0, .L80201E44
/* 0A7628 802E7E28 A2390018 */ sb $t9, 0x18($s1)
/* 0A762C 802E7E2C 904A0001 */ lbu $t2, 1($v0)
/* 0A7630 802E7E30 A22A0005 */ sb $t2, 5($s1)
.L80201E44:
/* 0A7634 802E7E34 AE230048 */ sw $v1, 0x48($s1) # AudioBankSound
/* 0A7638 802E7E38 C4640004 */ lwc1 $f4, 4($v1) # AudioBankSound.tuning
/* 0A763C 802E7E3C 10000090 */ b .L80202090
/* 0A7640 802E7E40 E6240024 */ swc1 $f4, 0x24($s1)
/* 0A7644 802E7E44 868F000C */ lh $t7, 0xc($s4)
.L80201E58:
/* 0A7648 802E7E48 858D001E */ lh $t5, 0x1e($t4)
/* 0A764C 802E7E4C 86390022 */ lh $t9, 0x22($s1)
/* 0A7650 802E7E50 024F5821 */ addu $t3, $s2, $t7
/* 0A7654 802E7E54 016D7021 */ addu $t6, $t3, $t5
/* 0A7658 802E7E58 01D99021 */ addu $s2, $t6, $t9
/* 0A765C 802E7E5C 324500FF */ andi $a1, $s2, 0xff # a1 = s2 & 0xff
/* 0A7660 802E7E60 28A10080 */ slti $at, $a1, 0x80
/* 0A7664 802E7E64 14200005 */ bnez $at, .L80201E8C
/* 0A7668 802E7E68 00A09025 */ move $s2, $a1
/* 0A766C 802E7E6C 92280000 */ lbu $t0, ($s1)
/* 0A7670 802E7E70 350A0020 */ ori $t2, $t0, 0x20
/* 0A7674 802E7E74 10000082 */ b .L80202090
/* 0A7678 802E7E78 A22A0000 */ sb $t2, ($s1)
.L80201E8C:
/* 0A767C 802E7E7C 240100FF */ li $at, 255
/* 0A7680 802E7E80 14610003 */ bne $v1, $at, .L80201EA0
/* 0A7684 802E7E84 8FAF0068 */ lw $t7, 0x68($sp)
/* 0A7688 802E7E88 10000002 */ b .L80201EA4
/* 0A768C 802E7E8C 8DE40040 */ lw $a0, 0x40($t7) # SequenceChannel.Instrument
.L80201EA0:
/* 0A7690 802E7E90 8E240044 */ lw $a0, 0x44($s1) # SequenceChannelLayer.Instrument
.L80201EA4:
/* 0A7694 802E7E94 922C0008 */ lbu $t4, 8($s1) # SequenceChannelLayer.portamento
/* 0A7698 802E7E98 11800061 */ beqz $t4, .L80202030
/* 0A769C 802E7E9C 00000000 */ nop
/* 0A76A0 802E7EA0 92220004 */ lbu $v0, 4($s1) # SequenceChannelLayer.portamentoTargetNote
/* 0A76A4 802E7EA4 0045082A */ slt $at, $v0, $a1
/* 0A76A8 802E7EA8 10200003 */ beqz $at, .L80201EC8
/* 0A76AC 802E7EAC 00403025 */ move $a2, $v0 # arg1 = min(portamentoTargetNote, a1)
/* 0A76B0 802E7EB0 10000001 */ b .L80201EC8
/* 0A76B4 802E7EB4 00A03025 */ move $a2, $a1
.L80201EC8:
/* 0A76B8 802E7EB8 1080000A */ beqz $a0, .L80201EF4
/* 0A76BC 802E7EBC 3C013F80 */ li $at, 0x3F800000 # 1.000000
/* 0A76C0 802E7EC0 0C0B9397 */ jal instrument_get_audio_bank_sound
/* 0A76C4 802E7EC4 00C02825 */ move $a1, $a2
/* 0A76C8 802E7EC8 8E2B0048 */ lw $t3, 0x48($s1)
/* 0A76CC 802E7ECC 004B6826 */ xor $t5, $v0, $t3
/* 0A76D0 802E7ED0 2DAD0001 */ sltiu $t5, $t5, 1
/* 0A76D4 802E7ED4 AFAD0044 */ sw $t5, 0x44($sp)
/* 0A76D8 802E7ED8 AE220048 */ sw $v0, 0x48($s1)
/* 0A76DC 802E7EDC 10000003 */ b .L80201EFC
/* 0A76E0 802E7EE0 C4400004 */ lwc1 $f0, 4($v0)
.L80201EF4:
/* 0A76E4 802E7EE4 44810000 */ mtc1 $at, $f0
/* 0A76E8 802E7EE8 AE200048 */ sw $zero, 0x48($s1)
.L80201EFC:
/* 0A76EC 802E7EEC 3C038030 */ lui $v1, %hi(gNoteFrequencies) # $v1, 0x8030
/* 0A76F0 802E7EF0 92380004 */ lbu $t8, 4($s1)
/* 0A76F4 802E7EF4 24630AE8 */ addiu $v1, %lo(gNoteFrequencies) # addiu $v1, $v1, 0xae8
/* 0A76F8 802E7EF8 00127080 */ sll $t6, $s2, 2
/* 0A76FC 802E7EFC 006EC821 */ addu $t9, $v1, $t6
/* 0A7700 802E7F00 C7260000 */ lwc1 $f6, ($t9)
/* 0A7704 802E7F04 922A0008 */ lbu $t2, 8($s1)
/* 0A7708 802E7F08 00184880 */ sll $t1, $t8, 2
/* 0A770C 802E7F0C 00694021 */ addu $t0, $v1, $t1
/* 0A7710 802E7F10 C5080000 */ lwc1 $f8, ($t0)
/* 0A7714 802E7F14 46003082 */ mul.s $f2, $f6, $f0
/* 0A7718 802E7F18 2401FF7F */ li $at, -129
/* 0A771C 802E7F1C 01417824 */ and $t7, $t2, $at
/* 0A7720 802E7F20 25ECFFFF */ addiu $t4, $t7, -1
/* 0A7724 802E7F24 2D810005 */ sltiu $at, $t4, 5
/* 0A7728 802E7F28 46004302 */ mul.s $f12, $f8, $f0
/* 0A772C 802E7F2C 10200008 */ beqz $at, .L_EU_802E7F50
/* 0A7730 802E7F30 000C6080 */ sll $t4, $t4, 2
/* 0A7734 802E7F34 3C018030 */ lui $at, %hi(jtbl_EU_80306700)
/* 0A7738 802E7F38 002C0821 */ addu $at, $at, $t4
/* 0A773C 802E7F3C 8C2C6700 */ lw $t4, %lo(jtbl_EU_80306700)($at)
/* 0A7740 802E7F40 01800008 */ jr $t4
/* 0A7744 802E7F44 00000000 */ nop
glabel L_EU_802E7F48
/* 0A7748 802E7F48 10000002 */ b .L80201F64
/* 0A774C 802E7F4C 46006006 */ mov.s $f0, $f12
glabel L_EU_802E7F50
.L_EU_802E7F50:
/* 0A7750 802E7F50 46001006 */ mov.s $f0, $f2
.L80201F64:
/* 0A7754 802E7F54 46001283 */ div.s $f10, $f2, $f0
/* 0A7758 802E7F58 3C013F80 */ li $at, 0x3F800000 # 1.000000
/* 0A775C 802E7F5C 44818000 */ mtc1 $at, $f16
/* 0A7760 802E7F60 26220008 */ addiu $v0, $s1, 8
/* 0A7764 802E7F64 3C0146FE */ li $at, 0x46FE0000 # 32512.000000
/* 0A7768 802E7F68 46105481 */ sub.s $f18, $f10, $f16
/* 0A776C 802E7F6C E452000C */ swc1 $f18, 0xc($v0)
/* 0A7770 802E7F70 922B0008 */ lbu $t3, 8($s1)
/* 0A7774 802E7F74 316D0080 */ andi $t5, $t3, 0x80
/* 0A7778 802E7F78 51A00017 */ beql $t5, $zero, .L80201FE8
/* 0A777C 802E7F7C 96280020 */ lhu $t0, 0x20($s1)
/* 0A7780 802E7F80 968E0008 */ lhu $t6, 8($s4)
/* 0A7784 802E7F84 3C188023 */ lui $t8, %hi(gTempoInternalToExternal) # $t8, 0x8023
/* 0A7788 802E7F88 8718980C */ lh $t8, %lo(gTempoInternalToExternal)($t8)
/* 0A778C 802E7F8C 448E2000 */ mtc1 $t6, $f4
/* 0A7790 802E7F90 86390038 */ lh $t9, 0x38($s1)
/* 0A7794 802E7F94 44814000 */ mtc1 $at, $f8
/* 0A7798 802E7F98 468021A0 */ cvt.s.w $f6, $f4
/* 0A779C 802E7F9C 44982000 */ mtc1 $t8, $f4
/* 0A77A0 802E7FA0 44998000 */ mtc1 $t9, $f16
/* 0A77A4 802E7FA4 96290020 */ lhu $t1, 0x20($s1)
/* 0A77A8 802E7FA8 468084A0 */ cvt.s.w $f18, $f16
/* 0A77AC 802E7FAC 46083282 */ mul.s $f10, $f6, $f8
/* 0A77B0 802E7FB0 44898000 */ mtc1 $t1, $f16
/* 0A77B4 802E7FB4 468021A0 */ cvt.s.w $f6, $f4
/* 0A77B8 802E7FB8 46808120 */ cvt.s.w $f4, $f16
/* 0A77BC 802E7FBC 46069202 */ mul.s $f8, $f18, $f6
/* 0A77C0 802E7FC0 00000000 */ nop
/* 0A77C4 802E7FC4 46044482 */ mul.s $f18, $f8, $f4
/* 0A77C8 802E7FC8 46125183 */ div.s $f6, $f10, $f18
/* 0A77CC 802E7FCC 10000009 */ b .L80202004
/* 0A77D0 802E7FD0 E4460008 */ swc1 $f6, 8($v0)
/* 0A77D4 802E7FD4 96280020 */ lhu $t0, 0x20($s1)
.L80201FE8:
/* 0A77D8 802E7FD8 3C0142FE */ li $at, 0x42FE0000 # 127.000000
/* 0A77DC 802E7FDC 44818000 */ mtc1 $at, $f16
/* 0A77E0 802E7FE0 44884000 */ mtc1 $t0, $f8
/* 0A77E4 802E7FE4 00000000 */ nop
/* 0A77E8 802E7FE8 46804120 */ cvt.s.w $f4, $f8
/* 0A77EC 802E7FEC 46048283 */ div.s $f10, $f16, $f4
/* 0A77F0 802E7FF0 E44A0008 */ swc1 $f10, 8($v0)
.L80202004:
/* 0A77F4 802E7FF4 44809000 */ mtc1 $zero, $f18
/* 0A77F8 802E7FF8 2401FF7F */ li $at, -129
/* 0A77FC 802E7FFC E4520004 */ swc1 $f18, 4($v0)
/* 0A7800 802E8000 922A0008 */ lbu $t2, 8($s1)
/* 0A7804 802E8004 E6200024 */ swc1 $f0, 0x24($s1)
/* 0A7808 802E8008 01417824 */ and $t7, $t2, $at
/* 0A780C 802E800C 24010005 */ li $at, 5
/* 0A7810 802E8010 55E1001C */ bnel $t7, $at, .L80202094
/* 0A7814 802E8014 86290038 */ lh $t1, 0x38($s1)
/* 0A7818 802E8018 10000019 */ b .L80202090
/* 0A781C 802E801C A2320004 */ sb $s2, 4($s1)
.L80202030:
/* 0A7820 802E8020 10800011 */ beqz $a0, .L80202078
/* 0A7824 802E8024 3C038030 */ lui $v1, %hi(gNoteFrequencies)
/* 0A7828 802E8028 0C0B9397 */ jal instrument_get_audio_bank_sound
/* 0A782C 802E802C 00000000 */ nop
/* 0A7830 802E8030 8E2C0048 */ lw $t4, 0x48($s1)
/* 0A7834 802E8034 3C038030 */ lui $v1, %hi(gNoteFrequencies) # $v1, 0x8030
/* 0A7838 802E8038 24630AE8 */ addiu $v1, %lo(gNoteFrequencies) # addiu $v1, $v1, 0xae8
/* 0A783C 802E803C 004C5826 */ xor $t3, $v0, $t4
/* 0A7840 802E8040 2D6B0001 */ sltiu $t3, $t3, 1
/* 0A7844 802E8044 AFAB0044 */ sw $t3, 0x44($sp)
/* 0A7848 802E8048 AE220048 */ sw $v0, 0x48($s1)
/* 0A784C 802E804C 00126880 */ sll $t5, $s2, 2
/* 0A7850 802E8050 006D7021 */ addu $t6, $v1, $t5
/* 0A7854 802E8054 C5C60000 */ lwc1 $f6, ($t6)
/* 0A7858 802E8058 C4480004 */ lwc1 $f8, 4($v0)
/* 0A785C 802E805C 46083402 */ mul.s $f16, $f6, $f8
/* 0A7860 802E8060 10000007 */ b .L80202090
/* 0A7864 802E8064 E6300024 */ swc1 $f16, 0x24($s1)
.L80202078:
/* 0A7868 802E8068 24630AE8 */ addiu $v1, $v1, 0xae8
/* 0A786C 802E806C 0012C880 */ sll $t9, $s2, 2
/* 0A7870 802E8070 AE200048 */ sw $zero, 0x48($s1)
/* 0A7874 802E8074 0079C021 */ addu $t8, $v1, $t9
/* 0A7878 802E8078 C7040000 */ lwc1 $f4, ($t8)
/* 0A787C 802E807C E6240024 */ swc1 $f4, 0x24($s1)
.L80202090:
/* 0A7880 802E8080 86290038 */ lh $t1, 0x38($s1)
.L80202094:
/* 0A7884 802E8084 A629003C */ sh $t1, 0x3c($s1)
.L80202098:
/* 0A7888 802E8088 8E220000 */ lw $v0, ($s1)
/* 0A788C 802E808C 24010001 */ li $at, 1
/* 0A7890 802E8090 00024080 */ sll $t0, $v0, 2
/* 0A7894 802E8094 000857C2 */ srl $t2, $t0, 0x1f
/* 0A7898 802E8098 1541000B */ bne $t2, $at, .L802020D8
/* 0A789C 802E809C 000270C0 */ sll $t6, $v0, 3
/* 0A78A0 802E80A0 8E2F0040 */ lw $t7, 0x40($s1)
/* 0A78A4 802E80A4 000258C0 */ sll $t3, $v0, 3
/* 0A78A8 802E80A8 15E00003 */ bnez $t7, .L802020C8
/* 0A78AC 802E80AC 00000000 */ nop
/* 0A78B0 802E80B0 05630030 */ bgezl $t3, .L80202184
/* 0A78B4 802E80B4 8FBF002C */ lw $ra, 0x2c($sp)
.L802020C8:
/* 0A78B8 802E80B8 0C0B95B3 */ jal seq_channel_layer_note_decay
/* 0A78BC 802E80BC 02202025 */ move $a0, $s1
/* 0A78C0 802E80C0 1000002C */ b .L80202184
/* 0A78C4 802E80C4 8FBF002C */ lw $ra, 0x2c($sp)
.L802020D8:
/* 0A78C8 802E80C8 05C00003 */ bltz $t6, .L802020E8
/* 0A78CC 802E80CC 00009025 */ move $s2, $zero
/* 0A78D0 802E80D0 1000001A */ b .L8020214C
/* 0A78D4 802E80D4 24120001 */ li $s2, 1
.L802020E8:
/* 0A78D8 802E80D8 8E240040 */ lw $a0, 0x40($s1)
/* 0A78DC 802E80DC 10800005 */ beqz $a0, .L80202104
/* 0A78E0 802E80E0 00000000 */ nop
/* 0A78E4 802E80E4 92390002 */ lbu $t9, 2($s1)
/* 0A78E8 802E80E8 8FB80044 */ lw $t8, 0x44($sp)
/* 0A78EC 802E80EC 17200003 */ bnez $t9, .L8020210C
/* 0A78F0 802E80F0 00000000 */ nop
.L80202104:
/* 0A78F4 802E80F4 10000011 */ b .L8020214C
/* 0A78F8 802E80F8 24120001 */ li $s2, 1
.L8020210C:
/* 0A78FC 802E80FC 57000006 */ bnezl $t8, .L80202128
/* 0A7900 802E8100 8C890044 */ lw $t1, 0x44($a0)
/* 0A7904 802E8104 0C0B95B3 */ jal seq_channel_layer_note_decay
/* 0A7908 802E8108 02202025 */ move $a0, $s1
/* 0A790C 802E810C 1000000B */ b .L8020214C
/* 0A7910 802E8110 24120001 */ li $s2, 1
/* 0A7914 802E8114 8C890044 */ lw $t1, 0x44($a0)
.L80202128:
/* 0A7918 802E8118 52290004 */ beql $s1, $t1, .L8020213C
/* 0A791C 802E811C 8E280048 */ lw $t0, 0x48($s1)
/* 0A7920 802E8120 10000006 */ b .L8020214C
/* 0A7924 802E8124 24120001 */ li $s2, 1
/* 0A7928 802E8128 8E280048 */ lw $t0, 0x48($s1)
.L8020213C:
/* 0A792C 802E812C 15000003 */ bnez $t0, .L8020214C
/* 0A7930 802E8130 00000000 */ nop
/* 0A7934 802E8134 0C0B9604 */ jal init_synthetic_wave
/* 0A7938 802E8138 02202825 */ move $a1, $s1
.L8020214C:
/* 0A793C 802E813C 52400005 */ beql $s2, $zero, .L80202164
/* 0A7940 802E8140 8E240040 */ lw $a0, 0x40($s1)
/* 0A7944 802E8144 0C0B97FC */ jal alloc_note
/* 0A7948 802E8148 02202025 */ move $a0, $s1
/* 0A794C 802E814C AE220040 */ sw $v0, 0x40($s1)
/* 0A7950 802E8150 8E240040 */ lw $a0, 0x40($s1)
.L80202164:
/* 0A7954 802E8154 50800007 */ beql $a0, $zero, .L80202184
/* 0A7958 802E8158 8FBF002C */ lw $ra, 0x2c($sp)
/* 0A795C 802E815C 8C8A0044 */ lw $t2, 0x44($a0)
/* 0A7960 802E8160 562A0004 */ bnel $s1, $t2, .L80202184
/* 0A7964 802E8164 8FBF002C */ lw $ra, 0x2c($sp)
/* 0A7968 802E8168 0C0B9AA0 */ jal note_vibrato_init
/* 0A796C 802E816C 00000000 */ nop
.L80202180:
/* 0A7970 802E8170 8FBF002C */ lw $ra, 0x2c($sp)
.L80202184:
/* 0A7974 802E8174 8FB00018 */ lw $s0, 0x18($sp)
/* 0A7978 802E8178 8FB1001C */ lw $s1, 0x1c($sp)
/* 0A797C 802E817C 8FB20020 */ lw $s2, 0x20($sp)
/* 0A7980 802E8180 8FB30024 */ lw $s3, 0x24($sp)
/* 0A7984 802E8184 8FB40028 */ lw $s4, 0x28($sp)
/* 0A7988 802E8188 03E00008 */ jr $ra
/* 0A798C 802E818C 27BD0070 */ addiu $sp, $sp, 0x70

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,33 @@
.late_rodata
glabel jtbl_80337C90
.word L_U_8031C2DC
.word L_U_8031C298
.word L_U_8031C6A0
.word L_U_8031C6A0
.word L_U_8031C328
.word L_U_8031C23C
.word L_U_8031C6A0
.word L_U_8031C6A0
.word L_U_8031C200
.word L8031C2DC
.word L8031C298
.word L8031C6A0
.word L8031C6A0
.word L8031C328
.word L8031C23C
.word L8031C6A0
.word L8031C6A0
.word L8031C200
glabel jtbl_80337CB4
.word L_U_8031C36C
.word L_U_8031C3BC
.word L_U_8031C454
.word L_U_8031C3E8
.word L_U_8031C3E8
.word L_U_8031C4A4
.word L_U_8031C5C8
.word L_U_8031C698
.word L_U_8031C3BC
.word L_U_8031C36C
.word L8031C36C
.word L8031C3BC
.word L8031C454
.word L8031C3E8
.word L8031C3E8
.word L8031C4A4
.word L8031C5C8
.word L8031C698
.word L8031C3BC
.word L8031C36C
glabel jtbl_80337CDC
.word L_U_8031CBE0
.word L_U_8031CBEC
.word L_U_8031CBE0
.word L_U_8031CBEC
.word L_U_8031CBE0
.word L8031CBE0
.word L8031CBEC
.word L8031CBE0
.word L8031CBEC
.word L8031CBE0
.text
glabel seq_channel_layer_process_script
@ -117,7 +117,7 @@ glabel seq_channel_layer_process_script
/* 0D71F4 8031C1F4 8C398E84 */ lw $t9, %lo(jtbl_80337CB4)($at)
/* 0D71F8 8031C1F8 03200008 */ jr $t9
/* 0D71FC 8031C1FC 00000000 */ nop
glabel L_U_8031C200
glabel L8031C200
/* 0D7200 8031C200 26020054 */ addiu $v0, $s0, 0x54
/* 0D7204 8031C204 90430018 */ lbu $v1, 0x18($v0)
/* 0D7208 8031C208 14600005 */ bnez $v1, .L8031C220
@ -134,7 +134,7 @@ glabel L_U_8031C200
/* 0D7230 8031C230 8F2E0004 */ lw $t6, 4($t9)
/* 0D7234 8031C234 1000FFD7 */ b .L8031C194
/* 0D7238 8031C238 AC4E0000 */ sw $t6, ($v0)
glabel L_U_8031C23C
glabel L8031C23C
/* 0D723C 8031C23C 26020054 */ addiu $v0, $s0, 0x54
/* 0D7240 8031C240 8C430000 */ lw $v1, ($v0)
/* 0D7244 8031C244 90640000 */ lbu $a0, ($v1)
@ -158,7 +158,7 @@ glabel L_U_8031C23C
/* 0D728C 8031C28C 01CFC821 */ addu $t9, $t6, $t7
/* 0D7290 8031C290 1000FFC0 */ b .L8031C194
/* 0D7294 8031C294 AC590000 */ sw $t9, ($v0)
glabel L_U_8031C298
glabel L8031C298
/* 0D7298 8031C298 26020054 */ addiu $v0, $s0, 0x54
/* 0D729C 8031C29C 8C430000 */ lw $v1, ($v0)
/* 0D72A0 8031C2A0 904E0018 */ lbu $t6, 0x18($v0)
@ -176,7 +176,7 @@ glabel L_U_8031C298
/* 0D72D0 8031C2D0 0059C021 */ addu $t8, $v0, $t9
/* 0D72D4 8031C2D4 1000FFAF */ b .L8031C194
/* 0D72D8 8031C2D8 AF0E0000 */ sw $t6, ($t8)
glabel L_U_8031C2DC
glabel L8031C2DC
/* 0D72DC 8031C2DC 26020054 */ addiu $v0, $s0, 0x54
/* 0D72E0 8031C2E0 904F0018 */ lbu $t7, 0x18($v0)
/* 0D72E4 8031C2E4 004F2021 */ addu $a0, $v0, $t7
@ -197,7 +197,7 @@ glabel L_U_8031C2DC
/* 0D731C 8031C31C 246FFFFF */ addiu $t7, $v1, -1
/* 0D7320 8031C320 1000FF9C */ b .L8031C194
/* 0D7324 8031C324 A04F0018 */ sb $t7, 0x18($v0)
glabel L_U_8031C328
glabel L8031C328
/* 0D7328 8031C328 26020054 */ addiu $v0, $s0, 0x54
/* 0D732C 8031C32C 8C430000 */ lw $v1, ($v0)
/* 0D7330 8031C330 90640000 */ lbu $a0, ($v1)
@ -215,7 +215,7 @@ glabel L_U_8031C328
/* 0D7360 8031C360 032EC021 */ addu $t8, $t9, $t6
/* 0D7364 8031C364 1000FF8B */ b .L8031C194
/* 0D7368 8031C368 AC580000 */ sw $t8, ($v0)
glabel L_U_8031C36C
glabel L8031C36C
/* 0D736C 8031C36C 26020054 */ addiu $v0, $s0, 0x54
/* 0D7370 8031C370 8C430000 */ lw $v1, ($v0)
/* 0D7374 8031C374 240100C1 */ li $at, 193
@ -237,7 +237,7 @@ glabel L_U_8031C36C
/* 0D73B0 8031C3B0 46005402 */ mul.s $f16, $f10, $f0
/* 0D73B4 8031C3B4 1000FF77 */ b .L8031C194
/* 0D73B8 8031C3B8 E6100028 */ swc1 $f16, 0x28($s0)
glabel L_U_8031C3BC
glabel L8031C3BC
/* 0D73BC 8031C3BC 26020054 */ addiu $v0, $s0, 0x54
/* 0D73C0 8031C3C0 8C430000 */ lw $v1, ($v0)
/* 0D73C4 8031C3C4 240100C9 */ li $at, 201
@ -250,7 +250,7 @@ glabel L_U_8031C3BC
.L8031C3E0:
/* 0D73E0 8031C3E0 1000FF6C */ b .L8031C194
/* 0D73E4 8031C3E4 A604001E */ sh $a0, 0x1e($s0)
glabel L_U_8031C3E8
glabel L8031C3E8
/* 0D73E8 8031C3E8 240100C4 */ li $at, 196
/* 0D73EC 8031C3EC 14A10003 */ bne $a1, $at, .L8031C3FC
/* 0D73F0 8031C3F0 02002025 */ move $a0, $s0
@ -280,7 +280,7 @@ glabel L_U_8031C3E8
/* 0D7448 8031C448 8FAC005C */ lw $t4, 0x5c($sp)
/* 0D744C 8031C44C 1000FF51 */ b .L8031C194
/* 0D7450 8031C450 8FAD0058 */ lw $t5, 0x58($sp)
glabel L_U_8031C454
glabel L8031C454
/* 0D7454 8031C454 26020054 */ addiu $v0, $s0, 0x54
/* 0D7458 8031C458 8C430000 */ lw $v1, ($v0)
/* 0D745C 8031C45C 90640000 */ lbu $a0, ($v1)
@ -302,7 +302,7 @@ glabel L_U_8031C454
/* 0D7498 8031C498 308AFFFF */ andi $t2, $a0, 0xffff
/* 0D749C 8031C49C 1000FF3D */ b .L8031C194
/* 0D74A0 8031C4A0 A6050038 */ sh $a1, 0x38($s0)
glabel L_U_8031C4A4
glabel L8031C4A4
/* 0D74A4 8031C4A4 26020054 */ addiu $v0, $s0, 0x54
/* 0D74A8 8031C4A8 8C430000 */ lw $v1, ($v0)
/* 0D74AC 8031C4AC 246F0001 */ addiu $t7, $v1, 1
@ -383,7 +383,7 @@ glabel L_U_8031C4A4
/* 0D75BC 8031C5BC AC2F2E50 */ sw $t7, %lo(gAudioErrorFlags)($at)
/* 0D75C0 8031C5C0 1000FEF4 */ b .L8031C194
/* 0D75C4 8031C5C4 ACA00000 */ sw $zero, ($a1)
glabel L_U_8031C5C8
glabel L8031C5C8
/* 0D75C8 8031C5C8 26020054 */ addiu $v0, $s0, 0x54
/* 0D75CC 8031C5CC 8C430000 */ lw $v1, ($v0)
/* 0D75D0 8031C5D0 24790001 */ addiu $t9, $v1, 1
@ -439,10 +439,10 @@ glabel L_U_8031C5C8
/* 0D768C 8031C68C 308AFFFF */ andi $t2, $a0, 0xffff
/* 0D7690 8031C690 1000FEC0 */ b .L8031C194
/* 0D7694 8031C694 A604001C */ sh $a0, 0x1c($s0)
glabel L_U_8031C698
glabel L8031C698
/* 0D7698 8031C698 1000FEBE */ b .L8031C194
/* 0D769C 8031C69C A2000004 */ sb $zero, 4($s0)
glabel L_U_8031C6A0
glabel L8031C6A0
.L8031C6A0:
/* 0D76A0 8031C6A0 30A200F0 */ andi $v0, $a1, 0xf0
/* 0D76A4 8031C6A4 240100D0 */ li $at, 208
@ -816,11 +816,11 @@ glabel L_U_8031C6A0
/* 0D7BD4 8031CBD4 8C398EAC */ lw $t9, %lo(jtbl_80337CDC)($at)
/* 0D7BD8 8031CBD8 03200008 */ jr $t9
/* 0D7BDC 8031CBDC 00000000 */ nop
glabel L_U_8031CBE0
glabel L8031CBE0
/* 0D7BE0 8031CBE0 E7A20024 */ swc1 $f2, 0x24($sp)
/* 0D7BE4 8031CBE4 10000005 */ b .L8031CBFC
/* 0D7BE8 8031CBE8 46006006 */ mov.s $f0, $f12
glabel L_U_8031CBEC
glabel L8031CBEC
/* 0D7BEC 8031CBEC 46001006 */ mov.s $f0, $f2
/* 0D7BF0 8031CBF0 10000002 */ b .L8031CBFC
/* 0D7BF4 8031CBF4 E7AC0024 */ swc1 $f12, 0x24($sp)

View File

@ -1,7 +0,0 @@
#!/bin/bash
OBJDUMP="mips-linux-gnu-objdump -D -z -bbinary -mmips -EB"
OPTIONS="--start-address=$(($1)) --stop-address=$(($2))"
$OBJDUMP $OPTIONS baserom.jp.z64 > baserom.jp.dump
$OBJDUMP $OPTIONS build/jp/sm64.jp.z64 > sm64.jp.dump
diff baserom.jp.dump sm64.jp.dump | colordiff

View File

@ -1,8 +0,0 @@
#!/bin/bash
OBJDUMP="mips-linux-gnu-objdump -D -z -bbinary -mmips -EB"
OPTIONS="--start-address=$(($1)) --stop-address=$(($2))"
$OBJDUMP $OPTIONS baserom.us.z64 > baserom.us.dump
$OBJDUMP $OPTIONS build/us/sm64.us.z64 > sm64.us.dump
diff baserom.us.dump sm64.us.dump | colordiff

View File

@ -7,6 +7,65 @@
"@sound tbl eu": [2216704,{"us":[5846368],"eu":[5723888]}],
"@sound tbl jp": [1793408,{"jp":[5833216]}],
"@sound tbl us": [2216704,{"us":[5846368],"eu":[5723888]}],
"textures/ipl3_raw/ipl3_font_00.ia1.png": [13,14,23,{"jp":[2928],"us":[2928],"eu":[2928],"sh":[2928]}],
"textures/ipl3_raw/ipl3_font_01.ia1.png": [13,14,23,{"jp":[2951],"us":[2951],"eu":[2951],"sh":[2951]}],
"textures/ipl3_raw/ipl3_font_02.ia1.png": [13,14,23,{"jp":[2974],"us":[2974],"eu":[2974],"sh":[2974]}],
"textures/ipl3_raw/ipl3_font_03.ia1.png": [13,14,23,{"jp":[2997],"us":[2997],"eu":[2997],"sh":[2997]}],
"textures/ipl3_raw/ipl3_font_04.ia1.png": [13,14,23,{"jp":[3020],"us":[3020],"eu":[3020],"sh":[3020]}],
"textures/ipl3_raw/ipl3_font_05.ia1.png": [13,14,23,{"jp":[3043],"us":[3043],"eu":[3043],"sh":[3043]}],
"textures/ipl3_raw/ipl3_font_06.ia1.png": [13,14,23,{"jp":[3066],"us":[3066],"eu":[3066],"sh":[3066]}],
"textures/ipl3_raw/ipl3_font_07.ia1.png": [13,14,23,{"jp":[3089],"us":[3089],"eu":[3089],"sh":[3089]}],
"textures/ipl3_raw/ipl3_font_08.ia1.png": [13,14,23,{"jp":[3112],"us":[3112],"eu":[3112],"sh":[3112]}],
"textures/ipl3_raw/ipl3_font_09.ia1.png": [13,14,23,{"jp":[3135],"us":[3135],"eu":[3135],"sh":[3135]}],
"textures/ipl3_raw/ipl3_font_10.ia1.png": [13,14,23,{"jp":[3158],"us":[3158],"eu":[3158],"sh":[3158]}],
"textures/ipl3_raw/ipl3_font_11.ia1.png": [13,14,23,{"jp":[3181],"us":[3181],"eu":[3181],"sh":[3181]}],
"textures/ipl3_raw/ipl3_font_12.ia1.png": [13,14,23,{"jp":[3204],"us":[3204],"eu":[3204],"sh":[3204]}],
"textures/ipl3_raw/ipl3_font_13.ia1.png": [13,14,23,{"jp":[3227],"us":[3227],"eu":[3227],"sh":[3227]}],
"textures/ipl3_raw/ipl3_font_14.ia1.png": [13,14,23,{"jp":[3250],"us":[3250],"eu":[3250],"sh":[3250]}],
"textures/ipl3_raw/ipl3_font_15.ia1.png": [13,14,23,{"jp":[3273],"us":[3273],"eu":[3273],"sh":[3273]}],
"textures/ipl3_raw/ipl3_font_16.ia1.png": [13,14,23,{"jp":[3296],"us":[3296],"eu":[3296],"sh":[3296]}],
"textures/ipl3_raw/ipl3_font_17.ia1.png": [13,14,23,{"jp":[3319],"us":[3319],"eu":[3319],"sh":[3319]}],
"textures/ipl3_raw/ipl3_font_18.ia1.png": [13,14,23,{"jp":[3342],"us":[3342],"eu":[3342],"sh":[3342]}],
"textures/ipl3_raw/ipl3_font_19.ia1.png": [13,14,23,{"jp":[3365],"us":[3365],"eu":[3365],"sh":[3365]}],
"textures/ipl3_raw/ipl3_font_20.ia1.png": [13,14,23,{"jp":[3388],"us":[3388],"eu":[3388],"sh":[3388]}],
"textures/ipl3_raw/ipl3_font_21.ia1.png": [13,14,23,{"jp":[3411],"us":[3411],"eu":[3411],"sh":[3411]}],
"textures/ipl3_raw/ipl3_font_22.ia1.png": [13,14,23,{"jp":[3434],"us":[3434],"eu":[3434],"sh":[3434]}],
"textures/ipl3_raw/ipl3_font_23.ia1.png": [13,14,23,{"jp":[3457],"us":[3457],"eu":[3457],"sh":[3457]}],
"textures/ipl3_raw/ipl3_font_24.ia1.png": [13,14,23,{"jp":[3480],"us":[3480],"eu":[3480],"sh":[3480]}],
"textures/ipl3_raw/ipl3_font_25.ia1.png": [13,14,23,{"jp":[3503],"us":[3503],"eu":[3503],"sh":[3503]}],
"textures/ipl3_raw/ipl3_font_26.ia1.png": [13,14,23,{"jp":[3526],"us":[3526],"eu":[3526],"sh":[3526]}],
"textures/ipl3_raw/ipl3_font_27.ia1.png": [13,14,23,{"jp":[3549],"us":[3549],"eu":[3549],"sh":[3549]}],
"textures/ipl3_raw/ipl3_font_28.ia1.png": [13,14,23,{"jp":[3572],"us":[3572],"eu":[3572],"sh":[3572]}],
"textures/ipl3_raw/ipl3_font_29.ia1.png": [13,14,23,{"jp":[3595],"us":[3595],"eu":[3595],"sh":[3595]}],
"textures/ipl3_raw/ipl3_font_30.ia1.png": [13,14,23,{"jp":[3618],"us":[3618],"eu":[3618],"sh":[3618]}],
"textures/ipl3_raw/ipl3_font_31.ia1.png": [13,14,23,{"jp":[3641],"us":[3641],"eu":[3641],"sh":[3641]}],
"textures/ipl3_raw/ipl3_font_32.ia1.png": [13,14,23,{"jp":[3664],"us":[3664],"eu":[3664],"sh":[3664]}],
"textures/ipl3_raw/ipl3_font_33.ia1.png": [13,14,23,{"jp":[3687],"us":[3687],"eu":[3687],"sh":[3687]}],
"textures/ipl3_raw/ipl3_font_34.ia1.png": [13,14,23,{"jp":[3710],"us":[3710],"eu":[3710],"sh":[3710]}],
"textures/ipl3_raw/ipl3_font_35.ia1.png": [13,14,23,{"jp":[3733],"us":[3733],"eu":[3733],"sh":[3733]}],
"textures/ipl3_raw/ipl3_font_36.ia1.png": [13,14,23,{"jp":[3756],"us":[3756],"eu":[3756],"sh":[3756]}],
"textures/ipl3_raw/ipl3_font_37.ia1.png": [13,14,23,{"jp":[3779],"us":[3779],"eu":[3779],"sh":[3779]}],
"textures/ipl3_raw/ipl3_font_38.ia1.png": [13,14,23,{"jp":[3802],"us":[3802],"eu":[3802],"sh":[3802]}],
"textures/ipl3_raw/ipl3_font_39.ia1.png": [13,14,23,{"jp":[3825],"us":[3825],"eu":[3825],"sh":[3825]}],
"textures/ipl3_raw/ipl3_font_40.ia1.png": [13,14,23,{"jp":[3848],"us":[3848],"eu":[3848],"sh":[3848]}],
"textures/ipl3_raw/ipl3_font_41.ia1.png": [13,14,23,{"jp":[3871],"us":[3871],"eu":[3871],"sh":[3871]}],
"textures/ipl3_raw/ipl3_font_42.ia1.png": [13,14,23,{"jp":[3894],"us":[3894],"eu":[3894],"sh":[3894]}],
"textures/ipl3_raw/ipl3_font_43.ia1.png": [13,14,23,{"jp":[3917],"us":[3917],"eu":[3917],"sh":[3917]}],
"textures/ipl3_raw/ipl3_font_44.ia1.png": [13,14,23,{"jp":[3940],"us":[3940],"eu":[3940],"sh":[3940]}],
"textures/ipl3_raw/ipl3_font_45.ia1.png": [13,14,23,{"jp":[3963],"us":[3963],"eu":[3963],"sh":[3963]}],
"textures/ipl3_raw/ipl3_font_46.ia1.png": [13,14,23,{"jp":[3986],"us":[3986],"eu":[3986],"sh":[3986]}],
"textures/ipl3_raw/ipl3_font_47.ia1.png": [13,14,23,{"jp":[4009],"us":[4009],"eu":[4009],"sh":[4009]}],
"textures/ipl3_raw/ipl3_font_48.ia1.png": [13,14,23,{"jp":[4032],"us":[4032],"eu":[4032],"sh":[4032]}],
"textures/ipl3_raw/ipl3_font_49.ia1.png": [13,14,23,{"jp":[4055],"us":[4055],"eu":[4055],"sh":[4055]}],
"textures/crash_screen/crash_font_01234.ia1.png": [32,7,28,{"eu":[757168],"sh":[805680]}],
"textures/crash_screen/crash_font_56789.ia1.png": [32,7,28,{"eu":[757196],"sh":[805708]}],
"textures/crash_screen/crash_font_ABCDE.ia1.png": [32,7,28,{"eu":[757224],"sh":[805736]}],
"textures/crash_screen/crash_font_FGHIJ.ia1.png": [32,7,28,{"eu":[757252],"sh":[805764]}],
"textures/crash_screen/crash_font_KLMNO.ia1.png": [32,7,28,{"eu":[757280],"sh":[805792]}],
"textures/crash_screen/crash_font_PQRST.ia1.png": [32,7,28,{"eu":[757308],"sh":[805820]}],
"textures/crash_screen/crash_font_UVWXY.ia1.png": [32,7,28,{"eu":[757336],"sh":[805848]}],
"textures/crash_screen/crash_font_Zsym1.ia1.png": [32,7,28,{"eu":[757364],"sh":[805876]}],
"textures/crash_screen/crash_font_sym2.ia1.png": [32,7,28,{"eu":[757392],"sh":[805904]}],
"actors/amp/amp_body.rgba16.png": [32,32,2048,{"jp":[2032944,6936],"us":[2040320,6936],"eu":[1912288,6936],"sh":[1888800,6936]}],
"actors/amp/amp_electricity.rgba16.png": [16,32,1024,{"jp":[2032944,3864],"us":[2040320,3864],"eu":[1912288,3864],"sh":[1888800,3864]}],
"actors/amp/amp_eyes.rgba16.png": [32,32,2048,{"jp":[2032944,4888],"us":[2040320,4888],"eu":[1912288,4888],"sh":[1888800,4888]}],

View File

@ -1,5 +1,7 @@
// SM64 (EU) Segment 19 - Deutsch
#include "macros.h"
#include "game/ingame_menu.h"
#include "make_const_nonconst.h"

View File

@ -1,5 +1,7 @@
// SM64 (EU) Segment 19 - English
#include "macros.h"
#include "game/ingame_menu.h"
#include "make_const_nonconst.h"

View File

@ -1,5 +1,7 @@
// SM64 (EU) Segment 19 - Français
#include "macros.h"
#include "game/ingame_menu.h"
#include "make_const_nonconst.h"

View File

@ -2499,6 +2499,7 @@ static const Lights1 segment2_lights_unused = gdSPDefLights1(
// 0x02014470 - 0x020144B0
static const Mtx matrix_identity = {
#ifndef GBI_FLOATS
{{0x00010000, 0x00000000,
0x00000001, 0x00000000},
{0x00000000, 0x00010000,
@ -2507,19 +2508,32 @@ static const Mtx matrix_identity = {
0x00000000, 0x00000000},
{0x00000000, 0x00000000,
0x00000000, 0x00000000}}
#else
{{1.0f, 0.0f, 0.0f, 0.0f},
{0.0f, 1.0f, 0.0f, 0.0f},
{0.0f, 0.0f, 1.0f, 0.0f},
{0.0f, 0.0f, 0.0f, 1.0f}}
#endif
};
// 0x020144B0 - 0x020144F0
static const Mtx matrix_fullscreen = {
#ifndef GBI_FLOATS
{{0x00000000, 0x00000000,
0x00000000, 0x00000000},
{0x00000000, 0xffff0000,
0xffffffff, 0xffff0001},
{0x01990000, 0x00000000,
0x00000222, 0x00000000},
{((65536 * 2 / SCREEN_WIDTH) << 16) | 0, 0x00000000,
(0 << 16) | (65536 * 2 / SCREEN_HEIGHT), 0x00000000},
{0x00000000, 0x00000000,
0x00000000, 0x00000000}}
#else
{{2.0f / SCREEN_WIDTH, 0.0f, 0.0f, 0.0f},
{0.0f, 2.0f / SCREEN_HEIGHT, 0.0f, 0.0f},
{0.0f, 0.0f, -1.0f, 0.0f},
{-1.0f, -1.0f, -1.0f, 1.0f}}
#endif
};

View File

@ -3396,7 +3396,7 @@ const BehaviorScript bhvShallowWaterWave[] = {
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE),
DISABLE_RENDERING(),
BEGIN_REPEAT(5),
SPAWN_WATER_DROPLET(&sShallowWaterWaveDropletParams),
SPAWN_WATER_DROPLET(&gShallowWaterWaveDropletParams),
END_REPEAT_CONTINUE(),
DELAY(1),
PARENT_BIT_CLEAR(oActiveParticleFlags, ACTIVE_PARTICLE_SHALLOW_WATER_WAVE),
@ -3411,7 +3411,7 @@ const BehaviorScript bhvShallowWaterSplash[] = {
OR_INT(oFlags, OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE),
DISABLE_RENDERING(),
BEGIN_REPEAT(18),
SPAWN_WATER_DROPLET(&sShallowWaterSplashDropletParams),
SPAWN_WATER_DROPLET(&gShallowWaterSplashDropletParams),
END_REPEAT_CONTINUE(),
CALL_NATIVE(bhv_shallow_water_splash_init),
DELAY(1),
@ -3539,19 +3539,19 @@ const BehaviorScript bhvUnlockDoorStar[] = {
END_LOOP(),
};
const BehaviorScript bhvWarps60[] = {
const BehaviorScript bhvInstantActiveWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps64[] = {
const BehaviorScript bhvAirborneWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps68[] = {
const BehaviorScript bhvHardAirKnockBackWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps6C[] = {
const BehaviorScript bhvSpinAirborneCircleWarp[] = {
BREAK(),
};
@ -3559,15 +3559,15 @@ const BehaviorScript bhvDeathWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps74[] = {
const BehaviorScript bhvSpinAirborneWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps78[] = {
const BehaviorScript bhvFlyingWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps7C[] = {
const BehaviorScript bhvPaintingStarCollectWarp[] = {
BREAK(),
};
@ -3575,23 +3575,23 @@ const BehaviorScript bhvPaintingDeathWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps84[] = {
const BehaviorScript bhvAirborneDeathWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps88[] = {
const BehaviorScript bhvAirborneStarCollectWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps8C[] = {
const BehaviorScript bhvLaunchStarCollectWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps90[] = {
const BehaviorScript bhvLaunchDeathWarp[] = {
BREAK(),
};
const BehaviorScript bhvWarps94[] = {
const BehaviorScript bhvSwimmingWarp[] = {
BREAK(),
};
@ -5563,7 +5563,7 @@ const BehaviorScript bhvMrBlizzard[] = {
SET_HOME(),
SET_OBJ_PHYSICS(/*Wall hitbox radius*/ 30, /*Gravity*/ -400, /*Bounciness*/ 0, /*Drag strength*/ 1000, /*Friction*/ 1000, /*Buoyancy*/ 200, /*Unused*/ 0, 0),
CALL_NATIVE(bhv_mr_blizzard_init),
SET_FLOAT(oMrBlizzardUnkF4, 1),
SET_FLOAT(oMrBlizzardScale, 1),
BEGIN_LOOP(),
CALL_NATIVE(bhv_mr_blizzard_update),
END_LOOP(),

457
diff.py
View File

@ -12,21 +12,25 @@ import threading
import queue
import time
def fail(msg):
print(msg, file=sys.stderr)
sys.exit(1)
try:
import attr
from colorama import Fore, Style, Back
import ansiwrap
import watchdog
except ModuleNotFoundError as e:
fail(f"Missing prerequisite python module {e.name}. "
"Run `python3 -m pip install --user colorama ansiwrap attrs watchdog` to install prerequisites.")
fail(
f"Missing prerequisite python module {e.name}. "
"Run `python3 -m pip install --user colorama ansiwrap attrs watchdog` to install prerequisites."
)
# Prefer to use diff_settings.py from the current working directory
sys.path.insert(0, '.')
sys.path.insert(0, ".")
try:
import diff_settings
except ModuleNotFoundError:
@ -34,38 +38,89 @@ except ModuleNotFoundError:
# ==== CONFIG ====
parser = argparse.ArgumentParser(
description="Diff MIPS assembly.")
parser.add_argument('start',
help="Function name or address to start diffing from.")
parser.add_argument('end', nargs='?',
help="Address to end diff at.")
parser.add_argument('-o', dest='diff_obj', action='store_true',
help="Diff .o files rather than a whole binary. This makes it possible to see symbol names. (Recommended)")
parser.add_argument('--base-asm', dest='base_asm', metavar='FILE',
help="Read assembly from given file instead of configured base img.")
parser.add_argument('--write-asm', dest='write_asm', metavar='FILE',
help="Write the current assembly output to file, e.g. for use with --base-asm.")
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('-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.")
parser.add_argument('-B', '--no-show-branches', dest='show_branches', action='store_false',
help="Don't visualize branches/branch targets.")
parser.add_argument('-S', '--base-shift', dest='base_shift', type=str, default='0',
help="Diff position X in our img against position X + shift in the base img. "
"Arithmetic is allowed, so e.g. |-S \"0x1234 - 0x4321\"| is a reasonable "
"flag to pass if it is known that position 0x1234 in the base img syncs "
"up with position 0x4321 in our img. Not supported together with -o.")
parser.add_argument('-w', '--watch', dest='watch', action='store_true',
help="Automatically update when source/object files change. "
"Recommended in combination with -m.")
parser.add_argument('--width', dest='column_width', type=int, default=50,
help="Sets the width of the left and right view column.")
parser = argparse.ArgumentParser(description="Diff MIPS assembly.")
parser.add_argument("start", help="Function name or address to start diffing from.")
parser.add_argument("end", nargs="?", help="Address to end diff at.")
parser.add_argument(
"-o",
dest="diff_obj",
action="store_true",
help="Diff .o files rather than a whole binary. This makes it possible to see symbol names. (Recommended)",
)
parser.add_argument(
"--base-asm",
dest="base_asm",
metavar="FILE",
help="Read assembly from given file instead of configured base img.",
)
parser.add_argument(
"--write-asm",
dest="write_asm",
metavar="FILE",
help="Write the current assembly output to file, e.g. for use with --base-asm.",
)
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(
"-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.",
)
parser.add_argument(
"-B",
"--no-show-branches",
dest="show_branches",
action="store_false",
help="Don't visualize branches/branch targets.",
)
parser.add_argument(
"-S",
"--base-shift",
dest="base_shift",
type=str,
default="0",
help="Diff position X in our img against position X + shift in the base img. "
'Arithmetic is allowed, so e.g. |-S "0x1234 - 0x4321"| is a reasonable '
"flag to pass if it is known that position 0x1234 in the base img syncs "
"up with position 0x4321 in our img. Not supported together with -o.",
)
parser.add_argument(
"-w",
"--watch",
dest="watch",
action="store_true",
help="Automatically update when source/object files change. "
"Recommended in combination with -m.",
)
parser.add_argument(
"--width",
dest="column_width",
type=int,
default=50,
help="Sets the width of the left and right view column.",
)
# Project-specific flags, e.g. different versions/make arguments.
if hasattr(diff_settings, "add_custom_arguments"):
@ -77,11 +132,11 @@ args = parser.parse_args()
config = {}
diff_settings.apply(config, args)
baseimg = config.get('baseimg', None)
myimg = config.get('myimg', None)
mapfile = config.get('mapfile', None)
makeflags = config.get('makeflags', [])
source_directories = config.get('source_directories', None)
baseimg = config.get("baseimg", None)
myimg = config.get("myimg", None)
mapfile = config.get("mapfile", None)
makeflags = config.get("makeflags", [])
source_directories = config.get("source_directories", None)
MAX_FUNCTION_SIZE_LINES = 1024
MAX_FUNCTION_SIZE_BYTES = 1024 * 4
@ -98,19 +153,23 @@ COLOR_ROTATION = [
Fore.LIGHTBLACK_EX,
]
BUFFER_CMD = ["tail", "-c", str(10**9)]
BUFFER_CMD = ["tail", "-c", str(10 ** 9)]
LESS_CMD = ["less", "-Ric"]
DEBOUNCE_DELAY = 0.1
FS_WATCH_EXTENSIONS = ['.c', '.h']
FS_WATCH_EXTENSIONS = [".c", ".h"]
# ==== LOGIC ====
binutils_prefix = None
for binutils_cand in ['mips-linux-gnu-', 'mips64-elf-']:
for binutils_cand in ["mips-linux-gnu-", "mips64-elf-"]:
try:
subprocess.check_call([binutils_cand + "objdump", "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.check_call(
[binutils_cand + "objdump", "--version"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
binutils_prefix = binutils_cand
break
except subprocess.CalledProcessError:
@ -119,7 +178,10 @@ for binutils_cand in ['mips-linux-gnu-', 'mips64-elf-']:
pass
if not binutils_prefix:
fail("Missing binutils; please ensure mips-linux-gnu-objdump or mips64-elf-objdump exist.")
fail(
"Missing binutils; please ensure mips-linux-gnu-objdump or mips64-elf-objdump exist."
)
def eval_int(expr, emsg=None):
try:
@ -132,33 +194,46 @@ def eval_int(expr, emsg=None):
fail(emsg)
return None
def run_make(target, capture_output=False):
if capture_output:
return subprocess.run(["make"] + makeflags + [target], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
return subprocess.run(
["make"] + makeflags + [target],
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
)
else:
subprocess.check_call(["make"] + makeflags + [target])
def restrict_to_function(dump, fn_name):
out = []
search = f'<{fn_name}>:'
search = f"<{fn_name}>:"
found = False
for line in dump.split('\n'):
for line in dump.split("\n"):
if found:
if len(out) >= MAX_FUNCTION_SIZE_LINES:
break
out.append(line)
elif search in line:
found = True
return '\n'.join(out)
return "\n".join(out)
def run_objdump(cmd):
flags, target, restrict = cmd
out = subprocess.check_output([binutils_prefix + "objdump"] + flags + [target], universal_newlines=True)
out = subprocess.check_output(
[binutils_prefix + "objdump"] + flags + [target], universal_newlines=True
)
if restrict is not None:
return restrict_to_function(out, restrict)
return out
base_shift = eval_int(args.base_shift, "Failed to parse --base-shift (-S) argument as an integer.")
base_shift = eval_int(
args.base_shift, "Failed to parse --base-shift (-S) argument as an integer."
)
def search_map_file(fn_name):
if not mapfile:
@ -166,7 +241,7 @@ def search_map_file(fn_name):
try:
with open(mapfile) as f:
lines = f.read().split('\n')
lines = f.read().split("\n")
except Exception:
fail(f"Failed to open map file {mapfile} for reading.")
@ -174,22 +249,23 @@ def search_map_file(fn_name):
cur_objfile = None
ram_to_rom = None
cands = []
last_line = ''
last_line = ""
for line in lines:
if line.startswith(' .text'):
if line.startswith(" .text"):
cur_objfile = line.split()[3]
if 'load address' in line:
if "load address" in line:
tokens = last_line.split() + line.split()
ram = int(tokens[1], 0)
rom = int(tokens[5], 0)
ram_to_rom = rom - ram
if line.endswith(' ' + fn_name):
if line.endswith(" " + fn_name):
ram = int(line.split()[0], 0)
if cur_objfile is not None and ram_to_rom is not None:
cands.append((cur_objfile, ram + ram_to_rom))
last_line = line
except Exception as e:
import traceback
traceback.print_exc()
fail(f"Internal error while parsing map file")
@ -199,12 +275,13 @@ def search_map_file(fn_name):
return cands[0]
return None, None
def dump_objfile():
if base_shift:
fail("--base-shift not compatible with -o")
if args.end is not None:
fail("end address not supported together with -o")
if args.start.startswith('0'):
if args.start.startswith("0"):
fail("numerical start address not supported with -o; pass a function name")
objfile, _ = search_map_file(args.start)
@ -225,9 +302,10 @@ def dump_objfile():
return (
objfile,
(objdump_flags, refobjfile, args.start),
(objdump_flags, objfile, args.start)
(objdump_flags, objfile, args.start),
)
def dump_binary():
if not baseimg or not myimg:
fail("Missing myimg/baseimg in config.")
@ -242,37 +320,53 @@ def dump_binary():
end_addr = eval_int(args.end, "End address must be an integer expression.")
else:
end_addr = start_addr + MAX_FUNCTION_SIZE_BYTES
objdump_flags = ['-Dz', '-bbinary', '-mmips', '-EB']
flags1 = [f"--start-address={start_addr + base_shift}", f"--stop-address={end_addr + base_shift}"]
objdump_flags = ["-Dz", "-bbinary", "-mmips", "-EB"]
flags1 = [
f"--start-address={start_addr + base_shift}",
f"--stop-address={end_addr + base_shift}",
]
flags2 = [f"--start-address={start_addr}", f"--stop-address={end_addr}"]
return (
myimg,
(objdump_flags + flags1, baseimg, None),
(objdump_flags + flags2, myimg, None)
(objdump_flags + flags2, myimg, None),
)
# Alignment with ANSI colors is broken, let's fix it.
def ansi_ljust(s, width):
needed = width - ansiwrap.ansilen(s)
if needed > 0:
return s + ' ' * needed
return s + " " * needed
else:
return s
re_int = re.compile(r'[0-9]+')
re_comments = re.compile(r'<.*?>')
re_regs = re.compile(r'\b(a[0-3]|t[0-9]|s[0-7]|at|v[01]|f[12]?[0-9]|f3[01]|fp)\b')
re_sprel = re.compile(r',([1-9][0-9]*|0x[1-9a-f][0-9a-f]*)\(sp\)')
re_large_imm = re.compile(r'-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}')
forbidden = set(string.ascii_letters + '_')
branch_likely_instructions = set([
'beql', 'bnel', 'beqzl', 'bnezl', 'bgezl', 'bgtzl', 'blezl', 'bltzl',
'bc1tl', 'bc1fl'
])
branch_instructions = set([
'b', 'beq', 'bne', 'beqz', 'bnez', 'bgez', 'bgtz', 'blez', 'bltz',
'bc1t', 'bc1f'
] + list(branch_likely_instructions))
re_int = re.compile(r"[0-9]+")
re_comments = re.compile(r"<.*?>")
re_regs = re.compile(r"\b(a[0-3]|t[0-9]|s[0-7]|at|v[01]|f[12]?[0-9]|f3[01]|fp)\b")
re_sprel = re.compile(r",([1-9][0-9]*|0x[1-9a-f][0-9a-f]*)\(sp\)")
re_large_imm = re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}")
forbidden = set(string.ascii_letters + "_")
branch_likely_instructions = set(
[
"beql",
"bnel",
"beqzl",
"bnezl",
"bgezl",
"bgtzl",
"blezl",
"bltzl",
"bc1tl",
"bc1fl",
]
)
branch_instructions = set(
["b", "beq", "bne", "beqz", "bnez", "bgez", "bgtz", "blez", "bltz", "bc1t", "bc1f"]
+ list(branch_likely_instructions)
)
def hexify_int(row, pat):
full = pat.group(0)
@ -286,40 +380,43 @@ def hexify_int(row, pat):
return full
return hex(int(full))
def parse_relocated_line(line):
try:
ind2 = line.rindex(',')
ind2 = line.rindex(",")
except ValueError:
ind2 = line.rindex('\t')
before = line[:ind2+1]
after = line[ind2+1:]
ind2 = after.find('(')
ind2 = line.rindex("\t")
before = line[: ind2 + 1]
after = line[ind2 + 1 :]
ind2 = after.find("(")
if ind2 == -1:
imm, after = after, ''
imm, after = after, ""
else:
imm, after = after[:ind2], after[ind2:]
if imm == '0x0':
imm = '0'
if imm == "0x0":
imm = "0"
return before, imm, after
def process_reloc(row, prev):
before, imm, after = parse_relocated_line(prev)
repl = row.split()[-1]
if imm != '0':
if before.strip() == 'jal' and not imm.startswith('0x'):
imm = '0x' + imm
repl += '+' + imm if int(imm,0) > 0 else imm
if 'R_MIPS_LO16' in row:
repl = f'%lo({repl})'
elif 'R_MIPS_HI16' in row:
if imm != "0":
if before.strip() == "jal" and not imm.startswith("0x"):
imm = "0x" + imm
repl += "+" + imm if int(imm, 0) > 0 else imm
if "R_MIPS_LO16" in row:
repl = f"%lo({repl})"
elif "R_MIPS_HI16" in row:
# Ideally we'd pair up R_MIPS_LO16 and R_MIPS_HI16 to generate a
# correct addend for each, but objdump doesn't give us the order of
# the relocations, so we can't find the right LO16. :(
repl = f'%hi({repl})'
repl = f"%hi({repl})"
else:
assert 'R_MIPS_26' in row, f"unknown relocation type '{row}'"
assert "R_MIPS_26" in row, f"unknown relocation type '{row}'"
return before + repl + after
def process(lines):
mnemonics = []
diff_rows = []
@ -333,35 +430,35 @@ def process(lines):
lines.pop()
for row in lines:
if args.diff_obj and ('>:' in row or not row):
if args.diff_obj and (">:" in row or not row):
continue
if 'R_MIPS_' in row:
if diff_rows[-1] != '<delay-slot>':
if "R_MIPS_" in row:
if diff_rows[-1] != "<delay-slot>":
diff_rows[-1] = process_reloc(row, diff_rows[-1])
originals[-1] = process_reloc(row, originals[-1])
continue
row = re.sub(re_comments, '', row)
row = re.sub(re_comments, "", row)
row = row.rstrip()
tabs = row.split('\t')
row = '\t'.join(tabs[2:])
tabs = row.split("\t")
row = "\t".join(tabs[2:])
line_num = tabs[0].strip()
row_parts = row.split('\t', 1)
row_parts = row.split("\t", 1)
mnemonic = row_parts[0].strip()
if mnemonic not in branch_instructions:
row = re.sub(re_int, lambda s: hexify_int(row, s), row)
original = row
if skip_next:
skip_next = False
row = '<delay-slot>'
mnemonic = '<delay-slot>'
row = "<delay-slot>"
mnemonic = "<delay-slot>"
if mnemonic in branch_likely_instructions:
skip_next = True
row = re.sub(re_regs, '<reg>', row)
row = re.sub(re_sprel, ',addr(sp)', row)
row = re.sub(re_regs, "<reg>", row)
row = re.sub(re_sprel, ",addr(sp)", row)
if args.ignore_large_imms:
row = re.sub(re_large_imm, '<imm>', row)
row = re.sub(re_large_imm, "<imm>", row)
# Replace tabs with spaces
mnemonics.append(mnemonic)
@ -369,24 +466,28 @@ def process(lines):
originals.append(original)
line_nums.append(line_num)
if mnemonic in branch_instructions:
target = row_parts[1].strip().split(',')[-1]
target = row_parts[1].strip().split(",")[-1]
if mnemonic in branch_likely_instructions:
target = hex(int(target, 16) - 4)[2:]
branch_targets.append(target)
else:
branch_targets.append(None)
if args.stop_jrra and mnemonic == 'jr' and row_parts[1].strip() == 'ra':
if args.stop_jrra and mnemonic == "jr" and row_parts[1].strip() == "ra":
break
# Cleanup whitespace
originals = [original.strip() for original in originals]
originals = [''.join(f'{o:<8s}' for o in original.split('\t')) for original in originals]
originals = [
"".join(f"{o:<8s}" for o in original.split("\t")) for original in originals
]
# return diff_rows, diff_rows, line_nums
return mnemonics, diff_rows, originals, line_nums, branch_targets
def format_single_line_diff(line1, line2, column_width):
return f"{ansi_ljust(line1,column_width)}{ansi_ljust(line2,column_width)}"
class SymbolColorer:
def __init__(self, base_index):
self.color_index = base_index
@ -400,24 +501,30 @@ class SymbolColorer:
self.color_index += 1
self.symbol_colors[s] = color
t = t or s
return f'{color}{t}{Fore.RESET}'
return f"{color}{t}{Fore.RESET}"
def normalize_large_imms(row):
if args.ignore_large_imms:
row = re.sub(re_large_imm, '<imm>', row)
row = re.sub(re_large_imm, "<imm>", row)
return row
def do_diff(basedump, mydump):
asm_lines1 = basedump.split('\n')
asm_lines2 = mydump.split('\n')
asm_lines1 = basedump.split("\n")
asm_lines2 = mydump.split("\n")
output = []
# TODO: status line?
# output.append(sha1sum(mydump))
mnemonics1, asm_lines1, originals1, line_nums1, branch_targets1 = process(asm_lines1)
mnemonics2, asm_lines2, originals2, line_nums2, branch_targets2 = process(asm_lines2)
mnemonics1, asm_lines1, originals1, line_nums1, branch_targets1 = process(
asm_lines1
)
mnemonics2, asm_lines2, originals2, line_nums2, branch_targets2 = process(
asm_lines2
)
sc1 = SymbolColorer(0)
sc2 = SymbolColorer(0)
@ -429,94 +536,103 @@ def do_diff(basedump, mydump):
bts2 = set()
if args.show_branches:
for (bts, btset, sc) in [(branch_targets1, bts1, sc5), (branch_targets2, bts2, sc6)]:
for (bts, btset, sc) in [
(branch_targets1, bts1, sc5),
(branch_targets2, bts2, sc6),
]:
for bt in bts:
if bt is not None:
btset.add(bt + ":")
sc.color_symbol(bt + ":")
differ: difflib.SequenceMatcher = difflib.SequenceMatcher(a=mnemonics1, b=mnemonics2, autojunk=False)
differ: difflib.SequenceMatcher = difflib.SequenceMatcher(
a=mnemonics1, b=mnemonics2, autojunk=False
)
for (tag, i1, i2, j1, j2) in differ.get_opcodes():
lines1 = asm_lines1[i1:i2]
lines2 = asm_lines2[j1:j2]
for k, (line1, line2) in enumerate(itertools.zip_longest(lines1, lines2)):
if tag == 'replace':
if tag == "replace":
if line1 is None:
tag = 'insert'
tag = "insert"
elif line2 is None:
tag = 'delete'
tag = "delete"
try:
original1 = originals1[i1+k]
line_num1 = line_nums1[i1+k]
original1 = originals1[i1 + k]
line_num1 = line_nums1[i1 + k]
except:
original1 = ''
line_num1 = ''
original1 = ""
line_num1 = ""
try:
original2 = originals2[j1+k]
line_num2 = line_nums2[j1+k]
original2 = originals2[j1 + k]
line_num2 = line_nums2[j1 + k]
except:
original2 = ''
line_num2 = ''
original2 = ""
line_num2 = ""
line_color = Fore.RESET
line_prefix = ' '
line_prefix = " "
if line1 == line2:
if normalize_large_imms(original1) == normalize_large_imms(original2):
out1 = f'{original1}'
out2 = f'{original2}'
elif line1 == '<delay-slot>':
out1 = f'{Style.DIM}{original1}'
out2 = f'{Style.DIM}{original2}'
out1 = f"{original1}"
out2 = f"{original2}"
elif line1 == "<delay-slot>":
out1 = f"{Style.DIM}{original1}"
out2 = f"{Style.DIM}{original2}"
else:
line_color = Fore.YELLOW
line_prefix = 'r'
out1 = f'{Fore.YELLOW}{original1}{Style.RESET_ALL}'
out2 = f'{Fore.YELLOW}{original2}{Style.RESET_ALL}'
line_prefix = "r"
out1 = f"{Fore.YELLOW}{original1}{Style.RESET_ALL}"
out2 = f"{Fore.YELLOW}{original2}{Style.RESET_ALL}"
out1 = re.sub(re_regs, lambda s: sc1.color_symbol(s.group()), out1)
out2 = re.sub(re_regs, lambda s: sc2.color_symbol(s.group()), out2)
out1 = re.sub(re_sprel, lambda s: sc3.color_symbol(s.group()), out1)
out2 = re.sub(re_sprel, lambda s: sc4.color_symbol(s.group()), out2)
elif tag in ['replace', 'equal']:
line_prefix = '|'
elif tag in ["replace", "equal"]:
line_prefix = "|"
line_color = Fore.BLUE
out1 = f"{Fore.BLUE}{original1}{Style.RESET_ALL}"
out2 = f"{Fore.BLUE}{original2}{Style.RESET_ALL}"
elif tag == 'delete':
line_prefix = '<'
elif tag == "delete":
line_prefix = "<"
line_color = Fore.RED
out1 = f"{Fore.RED}{original1}{Style.RESET_ALL}"
out2 = ''
elif tag == 'insert':
line_prefix = '>'
out2 = ""
elif tag == "insert":
line_prefix = ">"
line_color = Fore.GREEN
out1 = ''
out1 = ""
out2 = f"{Fore.GREEN}{original2}{Style.RESET_ALL}"
in_arrow1 = ' '
in_arrow2 = ' '
out_arrow1 = ''
out_arrow2 = ''
line_num1 = line_num1 if out1 else ''
line_num2 = line_num2 if out2 else ''
in_arrow1 = " "
in_arrow2 = " "
out_arrow1 = ""
out_arrow2 = ""
line_num1 = line_num1 if out1 else ""
line_num2 = line_num2 if out2 else ""
if args.show_branches and out1:
if line_num1 in bts1:
in_arrow1 = sc5.color_symbol(line_num1, '~>')
if branch_targets1[i1+k] is not None:
out_arrow1 = ' ' + sc5.color_symbol(branch_targets1[i1+k] + ":", '~>')
in_arrow1 = sc5.color_symbol(line_num1, "~>")
if branch_targets1[i1 + k] is not None:
out_arrow1 = " " + sc5.color_symbol(
branch_targets1[i1 + k] + ":", "~>"
)
if args.show_branches and out2:
if line_num2 in bts2:
in_arrow2 = sc6.color_symbol(line_num2, '~>')
if branch_targets2[j1+k] is not None:
out_arrow2 = ' ' + sc6.color_symbol(branch_targets2[j1+k] + ":", '~>')
in_arrow2 = sc6.color_symbol(line_num2, "~>")
if branch_targets2[j1 + k] is not None:
out_arrow2 = " " + sc6.color_symbol(
branch_targets2[j1 + k] + ":", "~>"
)
out1 = f"{line_color}{line_num1} {in_arrow1} {out1}{Style.RESET_ALL}{out_arrow1}"
out1 = f"{line_color}{line_num1} {in_arrow1} {out1}{Style.RESET_ALL}{out_arrow1}"
out2 = f"{line_color}{line_prefix} {line_num2} {in_arrow2} {out2}{Style.RESET_ALL}{out_arrow2}"
output.append(format_single_line_diff(out1, out2, args.column_width))
return output[args.skip_lines:]
return output[args.skip_lines :]
def debounced_fs_watch(targets, outq, debounce_delay):
@ -540,7 +656,9 @@ def debounced_fs_watch(targets, outq, debounce_delay):
for target in self.file_targets:
if path == target:
return True
if args.make and any(path.endswith(suffix) for suffix in FS_WATCH_EXTENSIONS):
if args.make and any(
path.endswith(suffix) for suffix in FS_WATCH_EXTENSIONS
):
return True
return False
@ -580,11 +698,12 @@ def debounced_fs_watch(targets, outq, debounce_delay):
except queue.Empty:
pass
outq.put(t)
th = threading.Thread(target=debounce_thread, daemon=True)
th.start()
class Display():
class Display:
def __init__(self, basedump, mydump):
self.basedump = basedump
self.mydump = mydump
@ -594,14 +713,15 @@ class Display():
if self.emsg is not None:
output = self.emsg
else:
output = '\n'.join(do_diff(self.basedump, self.mydump))
output = "\n".join(do_diff(self.basedump, self.mydump))
# Pipe the output through 'tail' and only then to less, to ensure the
# write call doesn't block. ('tail' has to buffer all its input before
# it starts writing.) This also means we don't have to deal with pipe
# closure errors.
buffer_proc = subprocess.Popen(BUFFER_CMD, stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
buffer_proc = subprocess.Popen(
BUFFER_CMD, stdin=subprocess.PIPE, stdout=subprocess.PIPE
)
less_proc = subprocess.Popen(LESS_CMD, stdin=buffer_proc.stdout)
buffer_proc.stdin.write(output.encode())
buffer_proc.stdin.close()
@ -699,8 +819,10 @@ def main():
display.run_sync()
else:
if not args.make:
yn = input("Warning: watch-mode (-w) enabled without auto-make (-m). You will have to run make manually. Ok? (Y/n) ")
if yn.lower() == 'n':
yn = input(
"Warning: watch-mode (-w) enabled without auto-make (-m). You will have to run make manually. Ok? (Y/n) "
)
if yn.lower() == "n":
return
if args.make:
watch_sources = None
@ -727,11 +849,14 @@ def main():
display.progress("Building...")
ret = run_make(make_target, capture_output=True)
if ret.returncode != 0:
display.update(ret.stderr.decode() or ret.stdout.decode(), error=True)
display.update(
ret.stderr.decode() or ret.stdout.decode(), error=True
)
continue
mydump = run_objdump(mycmd)
display.update(mydump, error=False)
except KeyboardInterrupt:
display.terminate()
main()

View File

@ -1,42 +1,36 @@
diff --git a/asm/crash.s b/asm/crash.s
new file mode 100644
index 00000000..870b7e2c
index 00000000..7c272050
--- /dev/null
+++ b/asm/crash.s
@@ -0,0 +1,160 @@
@@ -0,0 +1,153 @@
+# SM64 Crash Handler
+# See Readme below.
+
+.include "macros.inc"
+
+.set COP0_CAUSE, 13
+.set COP0_EPC, 14
+.set COP0_BADVADDR, 8
+
+/* ---------------------------------------------------------------
+ * IMPORTANT README:
+ * ---------------------------------------------------------------
+ * To use this crash screen, in lib/__osExceptionPreamble.s, change
+ * the function to use the following assembly:
+ * Frame buffer emulation is required. To enable it in GlideN64,
+ * check "Emulate frame buffer" and "Render frame buffer to output"
+ * in the "Frame buffer" tab.
+ *
+ * lui $k0, %hi(__crash_handler_entry)
+ * addiu $k0, $k0, %lo(__crash_handler_entry)
+ * jr $k0
+ * nop
+ *
+ * Doing just a jal __crash_handler_entry will cause mupen recompiler
+ * errors, so be sure to use the original exception style assembly
+ * above!
+ *
+ * Be sure to add #include "../../enhancements/crash.inc.c" to
+ * the top of game.c. Add .include "../enhancements/crash.inc.s" to
+ * the bottom of asm/decompress.s. Add "../enhancements/crash.h" to
+ * the top of sm64.h, above the CRASH_SCREEN_INCLUDED condition.
+ * Your emulator's CPU core style should be set to interpreter for best results.
+ *
+ * See the DEBUG_ASSERT macro on how to call the crash screen for
+ * detected exceptions.
+ *
+ */
+
+.set noat
+.set noreorder
+.set gp=64
+
+.set COP0_CAUSE, $13
+.set COP0_EPC, $14
+.set COP0_BADVADDR, $8
+
+glabel crashFont
+ .incbin "enhancements/crash_font.bin"
+ .align 4
@ -63,23 +57,23 @@ index 00000000..870b7e2c
+ lui $at, %hi(nAssertStopProgram)
+ sw $a3, %lo(nAssertStopProgram)($at)
+ beqz $a3, .end_2
+ nop
+ nop
+ syscall # trigger crash screen
+.end_2:
+ jr $ra
+ nop
+ nop
+
+glabel cop0_get_cause
+ jr $ra
+ mfc0 $v0, $13 # COP0_CAUSE
+ mfc0 $v0, COP0_CAUSE
+
+glabel cop0_get_epc
+ jr $ra
+ mfc0 $v0, $14 # COP0_EPC
+ mfc0 $v0, COP0_EPC
+
+glabel cop0_get_badvaddr
+ jr $ra
+ mfc0 $v0, $8 # COP0_BADVADDR
+ mfc0 $v0, COP0_BADVADDR
+
+# If the error code field of cop0's cause register is non-zero,
+# draw crash details to the screen and hang
@ -87,6 +81,10 @@ index 00000000..870b7e2c
+# If there wasn't an error, continue to the original handler
+
+glabel __crash_handler_entry
+ mfc0 $k1, COP0_CAUSE
+ andi $k1, $k1, (0x1F << 2)
+ beqzl $k1, .end2 # exit if ExCode is 0
+ lui $k0, %hi(__osException)
+ la $k0, exceptionRegContext
+ sd $zero, 0x018 ($k0)
+ sd $at, 0x020 ($k0)
@ -116,21 +114,15 @@ index 00000000..870b7e2c
+ sd $t9, 0x0E0 ($k0)
+ sd $gp, 0x0E8 ($k0)
+ sd $sp, 0x0F0 ($k0)
+ sd $s8, 0x0F8 ($k0)
+ sd $fp, 0x0F8 ($k0)
+ sd $ra, 0x100 ($k0)
+ mfc0 $t0, $13 # COP0_CAUSE
+ srl $t0, $t0, 2
+ andi $t0, $t0, 0x1F
+ beqz $t0, .end
+ nop
+ # cop unusable exception fired twice on startup so we'll ignore it for now
+ li $at, 0x0B
+ beq $t0, $at, .end
+ nop
+ li $t0, (0x0B << 2)
+ beq $k1, $t0, .end
+ nop
+ jal show_crash_screen_and_hang
+ nop
+ nop
+ .end:
+ ld $zero, 0x018 ($k0)
+ ld $at, 0x020 ($k0)
+ ld $v0, 0x028 ($k0)
+ ld $v1, 0x030 ($k0)
@ -158,36 +150,33 @@ index 00000000..870b7e2c
+ ld $t9, 0x0E0 ($k0)
+ ld $gp, 0x0E8 ($k0)
+ ld $sp, 0x0F0 ($k0)
+ ld $s8, 0x0F8 ($k0)
+ ld $fp, 0x0F8 ($k0)
+ ld $ra, 0x100 ($k0)
+ lui $k0, %hi(__osException)
+ .end2:
+ addiu $k0, $k0, %lo(__osException)
+ jr $k0 # run the original handler
+ nop
+ nop
diff --git a/lib/asm/__osExceptionPreamble.s b/lib/asm/__osExceptionPreamble.s
index fdc36c8b..ccbf4ecc 100644
index 865273d9..f9ce7596 100644
--- a/lib/asm/__osExceptionPreamble.s
+++ b/lib/asm/__osExceptionPreamble.s
@@ -8,12 +8,11 @@
.section .text, "ax"
@@ -15,8 +15,8 @@
.endif
glabel __osExceptionPreamble
- lui $k0, %hi(__osException) # $k0, 0x8032
- addiu $k0, %lo(__osException) # addiu $k0, $k0, 0x66d0
+ lui $k0, %hi(__crash_handler_entry) # $k0, 0x8032
+ addiu $k0, %lo(__crash_handler_entry) # addiu $k0, $k0, 0x66d0
- lui $k0, %hi(__osException)
- addiu $k0, %lo(__osException)
+ lui $k0, %hi(__crash_handler_entry)
+ addiu $k0, %lo(__crash_handler_entry)
jr $k0
nop
-
glabel __osException
lui $k0, %hi(gInterruptedThread) # $k0, 0x8036
addiu $k0, %lo(gInterruptedThread) # addiu $k0, $k0, 0x5f40
diff --git a/sm64.ld b/sm64.ld
index dea5c8bd..22fff2d8 100755
index e6f5c942..c0feb343
--- a/sm64.ld
+++ b/sm64.ld
@@ -112,6 +112,7 @@ SECTIONS
@@ -116,6 +116,7 @@ SECTIONS
BUILD_DIR/src/game/rendering_graph_node.o(.text);
BUILD_DIR/src/game/profiler.o(.text);
BUILD_DIR/asm/decompress.o(.text);
@ -197,10 +186,10 @@ index dea5c8bd..22fff2d8 100755
BUILD_DIR/src/game/object_list_processor.o(.text);
diff --git a/src/game/crash.c b/src/game/crash.c
new file mode 100644
index 00000000..587ac86d
index 00000000..716adfbd
--- /dev/null
+++ b/src/game/crash.c
@@ -0,0 +1,291 @@
@@ -0,0 +1,260 @@
+/* SM64 Crash Handler */
+
+#include <sm64.h>
@ -246,37 +235,6 @@ index 00000000..587ac86d
+ "S5", "S6", "S7", "T8", "T9", /*"K0", "K1",*/
+ "GP", "SP", "FP", "RA", NULL };
+
+/*
+ Generates new preamble code at the exception vectors (0x000, 0x180)
+
+ eg: generate_exception_preambles(crash_handler_entry);
+
+ 000: lui k0, hi(crash_handler_entry)
+ 004: addiu k0, k0, lo(crash_handler_entry)
+ 008: jr k0
+ 00C: nop
+*/
+void generate_exception_preambles(void *entryPoint) {
+ u8 *mem = (u8 *) 0xA0000000;
+ int offs = 0;
+ int i;
+
+ u16 hi = (u32) entryPoint >> 16;
+ u16 lo = (u32) entryPoint & 0xFFFF;
+
+ if (lo & 0x8000) {
+ hi++;
+ }
+
+ for (i = 0; i < 2; i++) {
+ *(u32 *) &mem[offs + 0x00] = 0x3C1A0000 | hi;
+ *(u32 *) &mem[offs + 0x04] = 0x275A0000 | lo;
+ *(u32 *) &mem[offs + 0x08] = 0x03400008;
+ *(u32 *) &mem[offs + 0x0C] = 0x00000000;
+ offs += 0x180;
+ }
+}
+
+int crash_strlen(char *str) {
+ int len = 0;
+ while (*str++) {
@ -303,7 +261,7 @@ index 00000000..587ac86d
+
+ fb_print_str(80, 20, "AN ERROR HAS OCCURRED!");
+ fb_print_int_hex(80, 30, errno, 8);
+ fb_print_str(107, 30, szErrCodes[errno]);
+ fb_print_str(95, 30, szErrCodes[errno]);
+
+ if (errno >= 2 && errno <= 5) {
+ /*
@ -314,8 +272,8 @@ index 00000000..587ac86d
+ */
+ u32 badvaddr = cop0_get_badvaddr();
+
+ fb_print_str(188, 50, "VA");
+ fb_print_int_hex(215, 50, badvaddr, 32);
+ fb_print_str(145, 50, "VA");
+ fb_print_int_hex(160, 50, badvaddr, 32);
+ }
+ } else {
+ int afterFileX;
@ -385,7 +343,7 @@ index 00000000..587ac86d
+ u8 curbyte = in[nbyte];
+ for (nrow = 0; nrow < 2; nrow++) {
+ for (ncol = 0; ncol < 4; ncol++) {
+ u8 px = curbyte & (1 << 7 - (nrow * 4 + ncol));
+ u8 px = curbyte & (1 << (7 - (nrow * 4 + ncol)));
+ if (px != 0) {
+ out[ncol] = fbFillColor;
+ }
@ -494,10 +452,10 @@ index 00000000..587ac86d
+}
diff --git a/src/game/crash.h b/src/game/crash.h
new file mode 100644
index 00000000..da4e011e
index 00000000..1386930d
--- /dev/null
+++ b/src/game/crash.h
@@ -0,0 +1,29 @@
@@ -0,0 +1,28 @@
+#ifndef _CRASH_H_
+#define _CRASH_H_
+
@ -513,7 +471,6 @@ index 00000000..da4e011e
+
+extern u8 __crash_handler_entry[];
+
+void generate_exception_preambles(void *entryPoint);
+void show_crash_screen_and_hang(void);
+u8 ascii_to_idx(char c);
+void fb_set_address(void *address);

View File

@ -108,16 +108,16 @@ index d550b846..bbaf2bcc 100644
__osSiRelAccess();
return status;
diff --git a/lib/src/osEepromRead.c b/lib/src/osEepromRead.c
index 905eff74..23f34dd5 100644
index ea784b2c..116dae2d 100644
--- a/lib/src/osEepromRead.c
+++ b/lib/src/osEepromRead.c
@@ -1,4 +1,5 @@
#include "libultra_internal.h"
+#include <PR/console_type.h>
extern u32 D_80365E00[15];
extern u32 D_80365E3C;
@@ -44,33 +45,44 @@ s32 osEepromRead(OSMesgQueue *mq, u8 address, u8 *buffer) {
extern u8 _osLastSentSiCmd;
@@ -42,33 +43,44 @@ s32 osEepromRead(OSMesgQueue *mq, u8 address, u8 *buffer) {
return -1;
}
__osSiGetAccess();
@ -140,7 +140,7 @@ index 905eff74..23f34dd5 100644
- }
- D_80365E3C = 0;
- sp34 = __osSiRawStartDma(OS_READ, D_80365E00);
- D_80365D20 = 4;
- _osLastSentSiCmd = 4;
- osRecvMesg(mq, NULL, OS_MESG_BLOCK);
- for (sp30 = 0; sp30 < 4; sp30++) {
- sp2c++;
@ -163,7 +163,7 @@ index 905eff74..23f34dd5 100644
}
+ D_80365E3C = 0;
+ sp34 = __osSiRawStartDma(OS_READ, D_80365E00);
+ D_80365D20 = 4;
+ _osLastSentSiCmd = 4;
+ osRecvMesg(mq, NULL, OS_MESG_BLOCK);
+ for (sp30 = 0; sp30 < 4; sp30++) {
+ sp2c++;
@ -188,7 +188,7 @@ index 905eff74..23f34dd5 100644
__osSiRelAccess();
return sp34;
diff --git a/lib/src/osEepromWrite.c b/lib/src/osEepromWrite.c
index 71d0b7d6..c855cc20 100644
index 1a86477b..52a23e5e 100644
--- a/lib/src/osEepromWrite.c
+++ b/lib/src/osEepromWrite.c
@@ -1,5 +1,6 @@
@ -196,9 +196,9 @@ index 71d0b7d6..c855cc20 100644
#include "osContInternal.h"
+#include <PR/console_type.h>
u32 D_80365E00[0x3c >> 2];
u32 D_80365E3C;
@@ -46,36 +47,47 @@ s32 osEepromWrite(OSMesgQueue *mq, u8 address, u8 *buffer) {
#ifndef AVOID_UB
ALIGNED8 u32 D_80365E00[15];
@@ -52,36 +53,47 @@ s32 osEepromWrite(OSMesgQueue *mq, u8 address, u8 *buffer) {
}
__osSiGetAccess();
@ -237,11 +237,11 @@ index 71d0b7d6..c855cc20 100644
- D_80365E3C = 0;
- sp34 = __osSiRawStartDma(OS_READ, D_80365E00);
- D_80365D20 = 5;
- _osLastSentSiCmd = 5;
- osRecvMesg(mq, NULL, OS_MESG_BLOCK);
+ D_80365E3C = 0;
+ sp34 = __osSiRawStartDma(OS_READ, D_80365E00);
+ D_80365D20 = 5;
+ _osLastSentSiCmd = 5;
+ osRecvMesg(mq, NULL, OS_MESG_BLOCK);
- for (sp30 = 0; sp30 < 4; sp30++) {
@ -269,7 +269,7 @@ index 71d0b7d6..c855cc20 100644
return sp34;
}
diff --git a/lib/src/osInitialize.c b/lib/src/osInitialize.c
index 0b9f7128..660d1991 100644
index 3cbca8ea..20723b2f 100644
--- a/lib/src/osInitialize.c
+++ b/lib/src/osInitialize.c
@@ -1,6 +1,7 @@
@ -289,19 +289,19 @@ index 0b9f7128..660d1991 100644
__osSetSR(__osGetSR() | 0x20000000);
__osSetFpcCsr(0x01000800);
diff --git a/sm64.ld b/sm64.ld
index 59a5a2a6..c8976649 100755
index 3275819f..6f97698f 100755
--- a/sm64.ld
+++ b/sm64.ld
@@ -256,6 +256,8 @@ SECTIONS
@@ -261,6 +261,8 @@ SECTIONS
BUILD_DIR/libultra.a:func_802F7140.o(.text)
BUILD_DIR/libultra.a:func_802F71A0.o(.text)
BUILD_DIR/libultra.a:func_802F71F0.o(.text)
+ BUILD_DIR/libultra.a:consoleType.o(.text)
+ BUILD_DIR/libultra.a:skGetId.o(.text)
BUILD_DIR/lib/rsp.o(.text);
@@ -369,6 +371,8 @@ SECTIONS
#else
BUILD_DIR/src/game*.o(.text);
@@ -371,6 +373,8 @@ SECTIONS
BUILD_DIR/libultra.a:__osGetCause.o(.text);
BUILD_DIR/libultra.a:__osAtomicDec.o(.text);
BUILD_DIR/libultra.a:guLookAtRef.o(.text); /* Fast3DEX2 only */

View File

@ -1,8 +1,16 @@
diff --git a/src/game/game_init.c b/src/game/game_init.c
index 0852a141..004941d8 100644
index a4302124..5ffbf3ed 100644
--- a/src/game/game_init.c
+++ b/src/game/game_init.c
@@ -332,6 +332,45 @@ void display_and_vsync(void) {
@@ -11,6 +11,7 @@
#include "game_init.h"
#include "main.h"
#include "memory.h"
+#include "object_list_processor.h"
#include "profiler.h"
#include "save_file.h"
#include "seq_ids.h"
@@ -335,6 +336,45 @@ void display_and_vsync(void) {
gGlobalTimer++;
}
@ -48,7 +56,7 @@ index 0852a141..004941d8 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) {
@@ -365,6 +404,118 @@ static void record_demo(void) {
@@ -368,6 +408,118 @@ static void record_demo(void) {
gRecordedDemoInput.timer++;
}
@ -167,7 +175,7 @@ index 0852a141..004941d8 100644
// take the updated controller struct and calculate
// the new x, y, and distance floats.
void adjust_analog_stick(struct Controller *controller) {
@@ -605,6 +756,7 @@ void thread5_game_loop(UNUSED void *arg) {
@@ -623,6 +775,7 @@ void thread5_game_loop(UNUSED void *arg) {
audio_game_loop_tick();
config_gfx_pool();
read_controller_inputs();

View File

@ -136,8 +136,8 @@ def main():
try:
with open(fname, "rb") as f:
roms[lang] = f.read()
except:
print("Failed to open " + fname + ". Please ensure it exists!")
except Exception as e:
print("Failed to open " + fname + "! " + str(e))
sys.exit(1)
sha1 = hashlib.sha1(roms[lang]).hexdigest()
with open("sm64." + lang + ".sha1", "r") as f:
@ -215,9 +215,11 @@ def main():
input = image[pos : pos + size]
os.makedirs(os.path.dirname(asset), exist_ok=True)
if asset.endswith(".png"):
with tempfile.NamedTemporaryFile(prefix="asset") as png_file:
png_file = tempfile.NamedTemporaryFile(prefix="asset", delete=False)
try:
png_file.write(input)
png_file.flush()
png_file.close()
if asset.startswith("textures/skyboxes/") or asset.startswith("levels/ending/cake"):
if asset.startswith("textures/skyboxes/"):
imagetype = "sky"
@ -253,6 +255,9 @@ def main():
],
check=True,
)
finally:
png_file.close()
remove_file(png_file.name)
else:
with open(asset, "wb") as f:
f.write(input)

View File

@ -1,52 +1,107 @@
#!/usr/bin/env python3
import sys
import os.path
lang = None
import argparse
from subprocess import check_call
# TODO: -S argument for shifted ROMs
args = []
for arg in sys.argv[1:]:
if arg == '-j':
lang = 'jp'
elif arg == '-u':
lang = 'us'
elif arg == '-e':
lang = 'eu'
elif arg == '-s':
lang = 'sh'
else:
args.append(arg)
if lang is None:
lang = 'us'
parser = argparse.ArgumentParser(
description="find the first difference(s) between the compiled ROM and the baserom"
)
versionGroup = parser.add_mutually_exclusive_group()
versionGroup.add_argument(
"-j",
"--jp",
help="use original Japanese version",
action="store_const",
const="jp",
dest="version",
)
versionGroup.add_argument(
"-u",
"--us",
help="use United States version",
action="store_const",
const="us",
dest="version",
)
versionGroup.add_argument(
"-e",
"--eu",
help="use European (PAL) version",
action="store_const",
const="eu",
dest="version",
)
versionGroup.add_argument(
"-s",
"--sh",
help="use Shindou (Rumble) version",
action="store_const",
const="sh",
dest="version",
)
parser.add_argument(
"-m", "--make", help="run make before finding difference(s)", action="store_true"
)
parser.add_argument(
"-c",
"--count",
type=int,
default=1,
help="find up to this many instruction difference(s)",
)
parser.add_argument(
"-n", "--by-name", type=str, default="", help="perform a symbol or address lookup"
)
parser.add_argument(
"-d", "--diff", action="store_true", help="run ./diff.py on the result"
)
args = parser.parse_args()
diff_count = args.count
version = args.version
if version is None:
version = "us"
best = 0
for path in ['build/us/sm64.us.z64', 'build/jp/sm64.jp.z64', 'build/eu/sm64.eu.z64', 'build/sh/sm64.sh.z64']:
for ver in ["us", "jp", "eu", "sh"]:
try:
mtime = os.path.getmtime(path)
mtime = os.path.getmtime(f"build/{ver}/sm64.{ver}.z64")
if mtime > best:
best = mtime
lang = path.split('/')[1]
version = ver
except Exception:
pass
print("Assuming language " + lang)
print("Assuming version " + version)
baseimg = 'baserom.' + lang + '.z64'
basemap = 'sm64.' + lang + '.map'
if args.make:
check_call(["make", "-j4", "VERSION=" + version, "COMPARE=0"])
myimg = 'build/' + lang + '/sm64.' + lang + '.z64'
mymap = 'build/' + lang + '/sm64.' + lang + '.map'
baseimg = f"baserom.{version}.z64"
basemap = f"sm64.{version}.map"
if os.path.isfile('expected/' + mymap):
basemap = 'expected/' + mymap
myimg = f"build/{version}/sm64.{version}.z64"
mymap = f"build/{version}/{basemap}"
if os.path.isfile("expected/" + mymap):
basemap = "expected/" + mymap
required_files = [baseimg, myimg, mymap]
if any(not os.path.isfile(path) for path in required_files):
print(', '.join(required_files[:-1]) + " and " + required_files[-1] + " must exist.")
if not os.path.isfile(baseimg):
print(baseimg + " must exist.")
exit(1)
if not os.path.isfile(myimg) or not os.path.isfile(mymap):
print(
myimg
+ " and "
+ mymap
+ " must exist. Try rerunning with --make to build them."
)
exit(1)
mybin = open(myimg, 'rb').read()
basebin = open(baseimg, 'rb').read()
mybin = open(myimg, "rb").read()
basebin = open(baseimg, "rb").read()
if len(mybin) != len(basebin):
print("Modified ROM has different size...")
@ -56,75 +111,88 @@ if mybin == basebin:
print("No differences!")
exit(0)
def search_map(rom_addr):
ram_offset = None
last_ram = 0
last_rom = 0
last_fn = '<start of rom>'
last_file = '<no file>'
prev_line = ''
last_fn = "<start of rom>"
last_file = "<no file>"
prev_line = ""
with open(mymap) as f:
for line in f:
if 'load address' in line:
if "load address" in line:
# Example: ".boot 0x0000000004000000 0x1000 load address 0x0000000000000000"
if 'noload' in line or 'noload' in prev_line:
if "noload" in line or "noload" in prev_line:
ram_offset = None
continue
ram = int(line[16:16+18], 0)
rom = int(line[59:59+18], 0)
ram = int(line[16 : 16 + 18], 0)
rom = int(line[59 : 59 + 18], 0)
ram_offset = ram - rom
continue
prev_line = line
if ram_offset is None or '=' in line or '*fill*' in line or ' 0x' not in line:
if (
ram_offset is None
or "=" in line
or "*fill*" in line
or " 0x" not in line
):
continue
ram = int(line[16:16+18], 0)
ram = int(line[16 : 16 + 18], 0)
rom = ram - ram_offset
fn = line.split()[-1]
if '0x' in fn:
if "0x" in fn:
ram_offset = None
continue
if rom > rom_addr or (rom_addr & 0x80000000 and ram > rom_addr):
return 'in {} (ram 0x{:08x}, rom 0x{:x}, {})'.format(last_fn, last_ram, last_rom, last_file)
return f"in {last_fn} (ram 0x{last_ram:08x}, rom 0x{last_rom:06x}, {last_file})"
last_ram = ram
last_rom = rom
last_fn = fn
if '/' in fn:
if "/" in fn:
last_file = fn
return 'at end of rom?'
return "at end of rom?"
def parse_map(fname):
ram_offset = None
cur_file = '<no file>'
cur_file = "<no file>"
syms = {}
prev_sym = None
prev_line = ''
prev_line = ""
with open(fname) as f:
for line in f:
if 'load address' in line:
if 'noload' in line or 'noload' in prev_line:
if "load address" in line:
if "noload" in line or "noload" in prev_line:
ram_offset = None
continue
ram = int(line[16:16+18], 0)
rom = int(line[59:59+18], 0)
ram = int(line[16 : 16 + 18], 0)
rom = int(line[59 : 59 + 18], 0)
ram_offset = ram - rom
continue
prev_line = line
if ram_offset is None or '=' in line or '*fill*' in line or ' 0x' not in line:
if (
ram_offset is None
or "=" in line
or "*fill*" in line
or " 0x" not in line
):
continue
ram = int(line[16:16+18], 0)
ram = int(line[16 : 16 + 18], 0)
rom = ram - ram_offset
fn = line.split()[-1]
if '0x' in fn:
if "0x" in fn:
ram_offset = None
elif '/' in fn:
elif "/" in fn:
cur_file = fn
else:
syms[fn] = (rom, cur_file, prev_sym, ram)
prev_sym = fn
return syms
def map_diff():
map1 = parse_map(mymap)
map2 = parse_map(basemap)
@ -141,62 +209,110 @@ def map_diff():
return False
else:
print()
print("Map appears to have shifted just before {} ({}) -- in {}?".format(found[0], found[1], found[2]))
print(
f"Map appears to have shifted just before {found[0]} ({found[1]}) -- in {found[2]}?"
)
if found[2] is not None and found[2] not in map2:
print()
print("(Base map file {} out of date due to renamed symbols, so result may be imprecise.)".format(basemap))
print(
f"(Base map file {basemap} out of date due to renamed symbols, so result may be imprecise.)"
)
return True
def hexbytes(bs):
return ":".join("{:02x}".format(c) for c in bs)
# For convenience, allow `./first-diff.py <ROM addr | RAM addr | function name>`
# to do a symbol <-> address lookup. This should really be split out into a
# separate script...
if args:
if args.by_name:
try:
addr = int(args[0], 0)
print(args[0], "is", search_map(addr))
addr = int(args.by_name, 0)
print(args.by_name, "is", search_map(addr))
except ValueError:
m = parse_map(mymap)
try:
print(args[0], "is at position", hex(m[args[0]][0]), "in ROM,", hex(m[args[0]][3]), "in RAM")
print(
args.by_name,
"is at position",
hex(m[args.by_name][0]),
"in ROM,",
hex(m[args.by_name][3]),
"in RAM",
)
except KeyError:
print("function", args[0], "not found")
print("function", args.by_name, "not found")
exit()
found_instr_diff = None
found_instr_diff = []
map_search_diff = []
diffs = 0
shift_cap = 1000
for i in range(24, len(mybin), 4):
# (mybin[i:i+4] != basebin[i:i+4], but that's slightly slower in CPython...)
if diffs <= shift_cap and (mybin[i] != basebin[i] or mybin[i+1] != basebin[i+1] or mybin[i+2] != basebin[i+2] or mybin[i+3] != basebin[i+3]):
if diffs <= shift_cap and (
mybin[i] != basebin[i]
or mybin[i + 1] != basebin[i + 1]
or mybin[i + 2] != basebin[i + 2]
or mybin[i + 3] != basebin[i + 3]
):
if diffs == 0:
print("First difference at ROM addr " + hex(i) + ", " + search_map(i))
print("Bytes:", hexbytes(mybin[i:i+4]), 'vs', hexbytes(basebin[i:i+4]))
print(f"First difference at ROM addr {hex(i)}, {search_map(i)}")
print(
f"Bytes: {hexbytes(mybin[i : i + 4])} vs {hexbytes(basebin[i : i + 4])}"
)
diffs += 1
if found_instr_diff is None and mybin[i] >> 2 != basebin[i] >> 2:
found_instr_diff = i
if (
len(found_instr_diff) < diff_count
and mybin[i] >> 2 != basebin[i] >> 2
and not search_map(i) in map_search_diff
):
found_instr_diff.append(i)
map_search_diff.append(search_map(i))
if diffs == 0:
print("No differences!")
exit()
definite_shift = (diffs > shift_cap)
definite_shift = diffs > shift_cap
if not definite_shift:
print(str(diffs) + " differing word(s).")
if diffs > 100:
if found_instr_diff is not None:
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 == 'sh':
if len(found_instr_diff) > 0:
for i in found_instr_diff:
print(f"Instruction difference at ROM addr {hex(i)}, {search_map(i)}")
print(
f"Bytes: {hexbytes(mybin[i : i + 4])} vs {hexbytes(basebin[i : i + 4])}"
)
if version == "sh":
print("Shifted ROM, as expected.")
else:
if not os.path.isfile(basemap):
if definite_shift:
print("Tons of differences, must be a shifted ROM.")
print("To find ROM shifts, copy a clean .map file to " + basemap + " and rerun this script.")
print(
"To find ROM shifts, copy a clean .map file to "
+ basemap
+ " and rerun this script."
)
exit()
if not map_diff():
print("No ROM shift{}.".format(" (!?)" if definite_shift else ""))
print(f"No ROM shift{' (!?)' if definite_shift else ''}")
if args.diff:
diff_args = input("Call ./diff.py with which arguments? ") or "--"
if diff_args[0] != "-":
diff_args = "-" + diff_args
if "w" in diff_args and args.make:
diff_args += "m" # To avoid warnings when passing -w, also pass -m as long as -m was passed to first-diff itself
check_call(
[
"python3",
"diff.py",
f"-{version[0]}",
diff_args,
search_map(found_instr_diff[0]).split()[1],
]
)

View File

@ -391,7 +391,7 @@ typedef short ENVMIX_STATE[40];
* First call:
* aSetBuffer(cmd++, 0, 0, output, count)
*
* The count refers to the size of the output.
* The count refers to the size of each input. Hence 2 * count bytes will be written out.
* A left sample will be placed before the right sample.
*
* Note: count will be rounded up to the nearest multiple of 16 bytes.
@ -472,7 +472,7 @@ typedef short ENVMIX_STATE[40];
* For 1 octave up or downsampling to (roughly) half number of samples, use pitch 0xffff.
* For 1 octave down or upsampling to double as many samples, use pitch 0x4000.
*
* Note: count represents the number of output samples and is rounded up to
* Note: count represents the number of output sample bytes and is rounded up to
* the nearest multiple of 16 bytes.
*
* The state consists of the four following source samples when the algorithm stopped as
@ -484,7 +484,7 @@ typedef short ENVMIX_STATE[40];
* the four next source samples and then moving the source position zero or more
* samples forward. The first output sample (when A_INIT is given) is always 0.
*
* When "count" samples have been written, the following four source samples
* When "count" bytes have been written, the following four source samples
* are written to the state in DRAM as well as a fractional position.
*/
#define aResample(pkt, f, p, s) \

View File

@ -87,6 +87,13 @@
*
*/
#ifdef F3DEX_GBI_2E
# ifndef F3DEX_GBI_2
# define F3DEX_GBI_2
# endif
# define GBI_FLOATS
#endif
#ifdef F3DEX_GBI_2
# ifndef F3DEX_GBI
# define F3DEX_GBI
@ -1103,7 +1110,11 @@
* Vertex (set up for use with colors)
*/
typedef struct {
#ifndef GBI_FLOATS
short ob[3]; /* x, y, z */
#else
float ob[3]; /* x, y, z */
#endif
unsigned short flag;
short tc[2]; /* texture coord */
unsigned char cn[4]; /* color & alpha */
@ -1113,7 +1124,11 @@ typedef struct {
* Vertex (set up for use with normals)
*/
typedef struct {
#ifndef GBI_FLOATS
short ob[3]; /* x, y, z */
#else
float ob[3]; /* x, y, z */
#endif
unsigned short flag;
short tc[2]; /* texture coord */
signed char n[3]; /* normal */
@ -1162,6 +1177,7 @@ typedef struct {
unsigned char v[3];
} Tri;
#ifndef GBI_FLOATS
/*
* 4x4 matrix, fixed point s15.16 format.
* First 8 words are integer portion of the 4x4 matrix
@ -1173,6 +1189,11 @@ typedef union {
Mtx_t m;
long long int force_structure_alignment;
} Mtx;
#else
typedef struct {
float m[4][4];
} Mtx;
#endif
/*
* Viewport
@ -4396,6 +4417,26 @@ typedef union {
}}
/* Fraction never used in fill */
#ifdef F3DEX_GBI_2E
#define gDPFillRectangle(pkt, ulx, uly, lrx, lry) \
{ \
Gfx *_g0 = (Gfx *)(pkt), *_g1 = (Gfx *)(pkt); \
_g0->words.w0 = _SHIFTL(G_FILLRECT, 24, 8) | \
_SHIFTL((lrx), 2, 22); \
_g0->words.w1 = _SHIFTL((lry), 2, 22); \
_g1->words.w0 = _SHIFTL((ulx), 2, 22); \
_g1->words.w1 = _SHIFTL((uly), 2, 22); \
}
#define gsDPFillRectangle(ulx, uly, lrx, lry) \
{{ \
(_SHIFTL(G_FILLRECT, 24, 8) | _SHIFTL((lrx), 2, 22)), \
_SHIFTL((lry), 2, 22), \
}}, \
{{ \
_SHIFTL((ulx), 2, 22), \
_SHIFTL((uly), 2, 22), \
}}
#else
#define gDPFillRectangle(pkt, ulx, uly, lrx, lry) \
{ \
Gfx *_g = (Gfx *)(pkt); \
@ -4404,15 +4445,16 @@ typedef union {
_SHIFTL((lrx), 14, 10) | _SHIFTL((lry), 2, 10));\
_g->words.w1 = (_SHIFTL((ulx), 14, 10) | _SHIFTL((uly), 2, 10));\
}
#define gsDPFillRectangle(ulx, uly, lrx, lry) \
{{ \
(_SHIFTL(G_FILLRECT, 24, 8) | _SHIFTL((lrx), 14, 10) | \
_SHIFTL((lry), 2, 10)), \
(_SHIFTL((ulx), 14, 10) | _SHIFTL((uly), 2, 10)) \
}}
#endif
/* like gDPFillRectangle but accepts negative arguments */
#ifndef F3DEX_GBI_2E
#define gDPScisFillRectangle(pkt, ulx, uly, lrx, lry) \
{ \
Gfx *_g = (Gfx *)(pkt); \
@ -4423,6 +4465,7 @@ typedef union {
_g->words.w1 = (_SHIFTL(MAX((ulx),0), 14, 10) | \
_SHIFTL(MAX((uly),0), 2, 10)); \
}
#endif
#define gDPSetConvert(pkt, k0, k1, k2, k3, k4, k5) \
{ \
@ -4620,6 +4663,46 @@ typedef union {
gImmp1(pkt, G_RDPHALF_2, (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16))); \
gImmp1(pkt, G_RDPHALF_CONT, (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16))); \
}
#elif defined(F3DEX_GBI_2E)
# define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\
{ \
Gfx *_g0 = (Gfx *)(pkt), *_g1 = (Gfx *)(pkt), *_g2 = (Gfx *)(pkt); \
\
_g0->words.w0 = _SHIFTL(G_TEXRECT, 24, 8) | \
_SHIFTL((xh), 0, 24); \
_g0->words.w1 = _SHIFTL((yh), 0, 24); \
_g1->words.w0 = (_SHIFTL(tile, 24, 3) | _SHIFTL((xl), 0, 24)); \
_g1->words.w1 = _SHIFTL((yl), 0, 24); \
_g2->words.w0 = (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16)); \
_g2->words.w1 = (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)); \
}
# define gsSPTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
{{ \
(_SHIFTL(G_TEXRECT, 24, 8) | _SHIFTL((xh), 0, 24)), \
_SHIFTL((yh), 0, 24), \
}}, \
{{ \
(_SHIFTL((tile), 24, 3) | _SHIFTL((xl), 0, 24)), \
_SHIFTL((yl), 0, 24), \
}}, \
{{ \
_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16), \
_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16) \
}}
# define gSPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
{ \
Gfx *_g0 = (Gfx *)(pkt), *_g1 = (Gfx *)(pkt), *_g2 = (Gfx *)(pkt); \
\
_g0->words.w0 = _SHIFTL(G_TEXRECTFLIP, 24, 8) | \
_SHIFTL((xh), 0, 24); \
_g0->words.w1 = _SHIFTL((yh), 0, 24); \
_g1->words.w0 = (_SHIFTL(tile, 24, 3) | _SHIFTL((xl), 0, 24)); \
_g1->words.w1 = _SHIFTL((yl), 0, 24); \
_g2->words.w0 = (_SHIFTL(s, 16, 16) | _SHIFTL(t, 0, 16)); \
_g2->words.w1 = (_SHIFTL(dsdx, 16, 16) | _SHIFTL(dtdy, 0, 16)); \
}
#else
# define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy)\
{ \

View File

@ -53,14 +53,14 @@ extern "C" {
typedef struct {
u16 type; /* Controller Type */
u8 status; /* Controller status */
u8 errno;
u8 errnum;
}OSContStatus;
typedef struct {
u16 button;
s8 stick_x; /* -80 <= stick_x <= 80 */
s8 stick_y; /* -80 <= stick_y <= 80 */
u8 errno;
u8 errnum;
} OSContPad;
typedef struct {
@ -68,7 +68,7 @@ typedef struct {
u8 databuffer[32]; /* address of the data buffer */
u8 addressCrc; /* CRC code for address */
u8 dataCrc; /* CRC code for data */
u8 errno;
u8 errnum;
} OSContRamIo;

View File

@ -37,6 +37,8 @@ typedef s32 intptr_t;
typedef s32 ptrdiff_t;
#else
#include <stddef.h>
#include <stdint.h>
typedef ptrdiff_t ssize_t;
#endif
#endif

View File

@ -31,11 +31,11 @@
#define SOUND_NO_ECHO 0x20 // not in JP
#define SOUND_LO_BITFLAG_UNK8 0x80 // restart playing on each play_sound call?
/* Audio playback bitflags. TODO: Figure out what these mean and use them below. */
#define SOUND_PL_BITFLAG_UNK1 0x1000000
#define SOUND_PL_BITFLAG_UNK2 0x2000000
#define SOUND_PL_BITFLAG_UNK4 0x4000000
#define SOUND_PL_BITFLAG_UNK8 0x8000000
/* Audio playback bitflags. */
#define SOUND_NO_VOLUME_LOSS 0x1000000 // No volume loss with distance
#define SOUND_VIBRATO 0x2000000 // Randomly alter frequency each audio frame
#define SOUND_NO_PRIORITY_LOSS 0x4000000 // Do not prioritize closer sounds
#define SOUND_NO_FREQUENCY_LOSS 0x8000000 // Frequency scale does not change with distance
// silence
#define NO_SOUND 0
@ -558,4 +558,4 @@
#define SOUND_OBJ2_BOSS_DIALOG_GRUNT SOUND_ARG_LOAD(9, 0, 0x69, 0x40, 8)
#define SOUND_OBJ2_MRI_SPINNING SOUND_ARG_LOAD(9, 0, 0x6B, 0x00, 8)
#endif /* AUDIO_DEFINES_H */
#endif // AUDIO_DEFINES_H

View File

@ -1,5 +1,5 @@
#ifndef _BEHAVIOR_DATA_H
#define _BEHAVIOR_DATA_H
#ifndef BEHAVIOR_DATA_H
#define BEHAVIOR_DATA_H
#include "types.h"
@ -302,20 +302,20 @@ extern const BehaviorScript bhvYellowBall[];
extern const BehaviorScript bhvMario[];
extern const BehaviorScript bhvToadMessage[];
extern const BehaviorScript bhvUnlockDoorStar[];
extern const BehaviorScript bhvWarps60[];
extern const BehaviorScript bhvWarps64[];
extern const BehaviorScript bhvWarps68[];
extern const BehaviorScript bhvWarps6C[];
extern const BehaviorScript bhvInstantActiveWarp[];
extern const BehaviorScript bhvAirborneWarp[];
extern const BehaviorScript bhvHardAirKnockBackWarp[];
extern const BehaviorScript bhvSpinAirborneCircleWarp[];
extern const BehaviorScript bhvDeathWarp[];
extern const BehaviorScript bhvWarps74[];
extern const BehaviorScript bhvWarps78[];
extern const BehaviorScript bhvWarps7C[];
extern const BehaviorScript bhvSpinAirborneWarp[];
extern const BehaviorScript bhvFlyingWarp[];
extern const BehaviorScript bhvPaintingStarCollectWarp[];
extern const BehaviorScript bhvPaintingDeathWarp[];
extern const BehaviorScript bhvWarps84[];
extern const BehaviorScript bhvWarps88[];
extern const BehaviorScript bhvWarps8C[];
extern const BehaviorScript bhvWarps90[];
extern const BehaviorScript bhvWarps94[];
extern const BehaviorScript bhvAirborneDeathWarp[];
extern const BehaviorScript bhvAirborneStarCollectWarp[];
extern const BehaviorScript bhvLaunchStarCollectWarp[];
extern const BehaviorScript bhvLaunchDeathWarp[];
extern const BehaviorScript bhvSwimmingWarp[];
extern const BehaviorScript bhvRandomAnimatedTexture[];
extern const BehaviorScript bhvYellowBackgroundInMenu[];
extern const BehaviorScript bhvMenuButton[];
@ -543,4 +543,4 @@ extern const BehaviorScript bhvEndBirds2[];
extern const BehaviorScript bhvIntroScene[];
extern const BehaviorScript bhvUnusedFakeStar[];
#endif /* _BEHAVIOR_DATA_H */
#endif // BEHAVIOR_DATA_H

View File

@ -25,4 +25,4 @@
#define CMD_HHHHHH(a, b, c, d, e, f) CMD_HH(a, b), CMD_HH(c, d), CMD_HH(e, f)
#endif
#endif // COMMAND_MACROS_BASE_H

View File

@ -28,10 +28,15 @@
#define SCREEN_HEIGHT 240
// Border Height Define for NTSC Versions
#ifdef TARGET_N64
#ifndef VERSION_EU
#define BORDER_HEIGHT 8
#else
#define BORDER_HEIGHT 1
#endif
#else
// What's the point of having a border?
#define BORDER_HEIGHT 0
#endif
#endif // CONFIG_H

View File

@ -1,5 +1,5 @@
#ifndef _COURSE_TABLE_H
#define _COURSE_TABLE_H
#ifndef COURSE_TABLE_H
#define COURSE_TABLE_H
// Start of the 3 cap courses in a row.
#define COURSE_CAP_COURSES COURSE_COTMC
@ -15,8 +15,8 @@
enum CourseNum
{
#include "levels/course_defines.h"
COURSE_END, // To mark end + 1 for marking max and count.
// Todo: clean this up. This is still bad. Which
COURSE_END, // To mark end + 1 for marking max and count.
// TODO: clean this up. This is still bad. Which
// one is clearer? Need to get rid of one of these.
COURSE_MAX = COURSE_END - 1,
COURSE_COUNT = COURSE_MAX,
@ -29,4 +29,4 @@ enum CourseNum
#define COURSE_IS_MAIN_COURSE(cmd) (cmd >= COURSE_MIN && cmd <= COURSE_STAGES_MAX)
#endif // _COURSE_TABLE_H
#endif // COURSE_TABLE_H

View File

@ -1,5 +1,5 @@
#ifndef DIALOG_IDS
#define DIALOG_IDS
#ifndef DIALOG_IDS_H
#define DIALOG_IDS_H
enum DialogId {
DIALOG_000,
@ -175,4 +175,4 @@ enum DialogId {
DIALOG_COUNT
};
#endif
#endif // DIALOG_IDS_H

View File

@ -1,8 +1,6 @@
#ifndef EU_TRANSLATION_H
#define EU_TRANSLATION_H
#include "types.h"
// PAL changes most text to arrays for each language. This define allows these
// differences to be combined.
#ifdef VERSION_EU
@ -11,14 +9,6 @@
#define LANGUAGE_ARRAY(cmd) cmd
#endif
// EU translations are contained in three segment 0x19 compressed data blocks
extern u8 _translation_en_mio0SegmentRomStart[];
extern u8 _translation_en_mio0SegmentRomEnd[];
extern u8 _translation_fr_mio0SegmentRomStart[];
extern u8 _translation_fr_mio0SegmentRomEnd[];
extern u8 _translation_de_mio0SegmentRomStart[];
extern u8 _translation_de_mio0SegmentRomEnd[];
extern void *dialog_table_eu_en[];
extern void *course_name_table_eu_en[];
extern void *act_name_table_eu_en[];
@ -31,4 +21,4 @@ extern void *dialog_table_eu_de[];
extern void *course_name_table_eu_de[];
extern void *act_name_table_eu_de[];
#endif /* EU_TRANSLATION_H */
#endif // EU_TRANSLATION_H

View File

@ -429,4 +429,4 @@
#define GEO_CULLING_RADIUS(cullingRadius) \
CMD_BBH(0x20, 0x00, cullingRadius)
#endif
#endif // GEO_COMMANDS_H

41
include/gfx_dimensions.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef GFX_DIMENSIONS_H
#define GFX_DIMENSIONS_H
/*
This file is for ports that want to enable widescreen.
Change the definitions to the following:
#include <math.h>
#define GFX_DIMENSIONS_FROM_LEFT_EDGE(v) (SCREEN_WIDTH / 2 - SCREEN_HEIGHT / 2 * [current_aspect_ratio] + (v))
#define GFX_DIMENSIONS_FROM_RIGHT_EDGE(v) (SCREEN_WIDTH / 2 + SCREEN_HEIGHT / 2 * [current_aspect_ratio] - (v))
#define GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v) ((int)floorf(GFX_DIMENSIONS_FROM_LEFT_EDGE(v)))
#define GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v) ((int)ceilf(GFX_DIMENSIONS_FROM_RIGHT_EDGE(v)))
#define GFX_DIMENSIONS_ASPECT_RATIO [current_aspect_ratio]
The idea is that SCREEN_WIDTH and SCREEN_HEIGHT are still hardcoded to 320 and 240, and that
x=0 lies at where a 4:3 left edge would be. On 16:9 widescreen, the left edge is hence at -53.33.
To get better accuracy, consider using floats instead of shorts for coordinates in Vertex and Matrix structures.
The conversion to integers above is for RECT commands which naturally only accept integer values.
Note that RECT commands must be enhanced to support negative coordinates with this modification.
*/
#ifdef WIDESCREEN
#error "widescreen not implemented"
#else
#define GFX_DIMENSIONS_FROM_LEFT_EDGE(v) (v)
#define GFX_DIMENSIONS_FROM_RIGHT_EDGE(v) (SCREEN_WIDTH - (v))
#define GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v) (v)
#define GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v) (SCREEN_WIDTH - (v))
#define GFX_DIMENSIONS_ASPECT_RATIO (4.0f / 3.0f)
#endif
// If screen is taller than it is wide, radius should be equal to SCREEN_HEIGHT since we scale horizontally
#define GFX_DIMENSIONS_FULL_RADIUS (SCREEN_HEIGHT * (GFX_DIMENSIONS_ASPECT_RATIO > 1 ? GFX_DIMENSIONS_ASPECT_RATIO : 1))
#endif // GFX_DIMENSIONS_H

View File

@ -1,6 +1,6 @@
#ifndef _HELPER_MACROS_H
#define _HELPER_MACROS_H
#ifndef HELPER_MACROS_H
#define HELPER_MACROS_H
#define LIST_NEXT_ITEM(curItem, type) ((type *)((s32)curItem + sizeof(type)))
#endif
#endif // HELPER_MACROS_H

View File

@ -34,6 +34,19 @@
#define REGULAR_FACE 0x0002
#define DIZZY_FACE 0x0003
#ifdef NO_SEGMENTED_MEMORY
#define EXECUTE(seg, script, scriptEnd, entry) \
CMD_BBH(0x00, 0x10, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL), \
CMD_PTR(entry)
#define EXIT_AND_EXECUTE(seg, script, scriptEnd, entry) \
CMD_BBH(0x01, 0x10, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL), \
CMD_PTR(entry)
#else
#define EXECUTE(seg, script, scriptEnd, entry) \
CMD_BBH(0x00, 0x10, seg), \
CMD_PTR(script), \
@ -45,6 +58,7 @@
CMD_PTR(script), \
CMD_PTR(scriptEnd), \
CMD_PTR(entry)
#endif
#define EXIT() \
CMD_BBH(0x02, 0x04, 0x0000)
@ -117,6 +131,23 @@
#define POP_POOL() \
CMD_BBH(0x15, 0x04, 0x0000)
#ifdef NO_SEGMENTED_MEMORY
#define FIXED_LOAD(loadAddr, romStart, romEnd) \
CMD_BBH(0x16, 0x10, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL), \
CMD_PTR(NULL)
#define LOAD_RAW(seg, romStart, romEnd) \
CMD_BBH(0x17, 0x0C, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL)
#define LOAD_MIO0(seg, romStart, romEnd) \
CMD_BBH(0x18, 0x0C, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL)
#else
#define FIXED_LOAD(loadAddr, romStart, romEnd) \
CMD_BBH(0x16, 0x10, 0x0000), \
CMD_PTR(loadAddr), \
@ -132,14 +163,22 @@
CMD_BBH(0x18, 0x0C, seg), \
CMD_PTR(romStart), \
CMD_PTR(romEnd)
#endif
#define LOAD_MARIO_HEAD(sethead) \
CMD_BBH(0x19, 0x04, sethead)
#ifdef NO_SEGMENTED_MEMORY
#define LOAD_MIO0_TEXTURE(seg, romStart, romEnd) \
CMD_BBH(0x1A, 0x0C, 0x0000), \
CMD_PTR(NULL), \
CMD_PTR(NULL)
#else
#define LOAD_MIO0_TEXTURE(seg, romStart, romEnd) \
CMD_BBH(0x1A, 0x0C, seg), \
CMD_PTR(romStart), \
CMD_PTR(romEnd)
#endif
#define INIT_LEVEL() \
CMD_BBH(0x1B, 0x04, 0x0000)
@ -275,4 +314,4 @@
#define GET_OR_SET(op, var) \
CMD_BBBB(0x3C, 0x04, op, var)
#endif
#endif // LEVEL_COMMANDS_H

View File

@ -2,7 +2,7 @@
#define LEVEL_MISC_MACROS_H
#define MACRO_OBJECT_WITH_BEH_PARAM(preset, yaw, posX, posY, posZ, behParam) \
(((yaw * 0x10 / 45) << 9) | (preset + 0x1F)), posX, posY, posZ, behParam
((s16)((yaw * 0x10 / 45) << 9) | (preset + 0x1F)), posX, posY, posZ, behParam
#define MACRO_OBJECT(preset, yaw, posX, posY, posZ) \
MACRO_OBJECT_WITH_BEH_PARAM(preset, yaw, posX, posY, posZ, 0)
@ -25,4 +25,4 @@
#define TRAJECTORY_END() \
-1
#endif
#endif // LEVEL_MISC_MACROS_H

View File

@ -1,5 +1,5 @@
#ifndef _LEVEL_TABLE_H
#define _LEVEL_TABLE_H
#ifndef LEVEL_TABLE_H
#define LEVEL_TABLE_H
// For LEVEL_NAME defines, see level_defines.h.
// Please include this file if you want to use them.
@ -19,4 +19,4 @@ enum LevelNum
#undef STUB_LEVEL
#undef DEFINE_LEVEL
#endif // _LEVEL_TABLE_H
#endif // LEVEL_TABLE_H

View File

@ -1,5 +1,5 @@
#ifndef _MACRO_PRESET_NAMES_H
#define _MACRO_PRESET_NAMES_H
#ifndef MACRO_PRESET_NAMES_H
#define MACRO_PRESET_NAMES_H
enum MacroPresets {
macro_yellow_coin,
@ -370,4 +370,4 @@ enum MacroPresets {
macro_empty_365
};
#endif // _MACRO_PRESET_NAMES_H
#endif // MACRO_PRESET_NAMES_H

View File

@ -1,5 +1,5 @@
#ifndef _MACRO_PRESETS_H
#define _MACRO_PRESETS_H
#ifndef MACRO_PRESETS_H
#define MACRO_PRESETS_H
#include "macro_preset_names.h"
#include "behavior_data.h"
@ -381,4 +381,4 @@ struct MacroPreset MacroObjectPresets[] = {
{bhvYellowCoin, MODEL_YELLOW_COIN, 0}
};
#endif // _MACRO_PRESETS_H
#endif // MACRO_PRESETS_H

View File

@ -1,5 +1,5 @@
#ifndef _MACROS_H_
#define _MACROS_H_
#ifndef MACROS_H
#define MACROS_H
#include "platform_info.h"
@ -25,6 +25,13 @@
#define UNUSED
#endif
// Avoid undefined behaviour for non-returning functions
#ifdef __GNUC__
#define NORETURN __attribute__((noreturn))
#else
#define NORETURN
#endif
// Static assertions
#ifdef __GNUC__
#define STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
@ -46,6 +53,7 @@
#define ALIGNED16
#endif
#ifndef NO_SEGMENTED_MEMORY
// convert a virtual address to physical.
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr) & 0x1FFFFFFF)
@ -54,5 +62,11 @@
// another way of converting virtual to physical
#define VIRTUAL_TO_PHYSICAL2(addr) ((u8 *)(addr) - 0x80000000U)
#else
// no conversion needed other than cast
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr))
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr))
#define VIRTUAL_TO_PHYSICAL2(addr) ((void *)(addr))
#endif
#endif // MACROS_H

View File

@ -8,4 +8,4 @@
#define const
#endif
#endif
#endif // MAKE_CONST_NONCONST_H

View File

@ -1,5 +1,5 @@
#ifndef _MARIO_ANIMATION_IDS_H
#define _MARIO_ANIMATION_IDS_H
#ifndef MARIO_ANIMATION_IDS_H
#define MARIO_ANIMATION_IDS_H
/* Mario Animation IDs */
@ -208,7 +208,7 @@ enum MarioAnimID
/* 0xC8 */ MARIO_ANIM_WAKE_FROM_SLEEP,
/* 0xC9 */ MARIO_ANIM_WAKE_FROM_LYING,
/* 0xCA */ MARIO_ANIM_START_TIPTOE,
/* 0xCB */ MARIO_ANIM_SLIDEJUMP, // pole jump and wall kick
/* 0xCB */ MARIO_ANIM_SLIDEJUMP, // pole jump and wall kick
/* 0xCC */ MARIO_ANIM_START_WALLKICK,
/* 0xCD */ MARIO_ANIM_STAR_DANCE,
/* 0xCE */ MARIO_ANIM_RETURN_FROM_STAR_DANCE,
@ -216,4 +216,4 @@ enum MarioAnimID
/* 0xD0 */ MARIO_ANIM_TRIPLE_JUMP_FLY
};
#endif /* _MARIO_ANIMATION_IDS_H */
#endif // MARIO_ANIMATION_IDS_H

View File

@ -1,5 +1,5 @@
#ifndef _MARIO_GEO_SWITCH_CASE_IDS_H
#define _MARIO_GEO_SWITCH_CASE_IDS_H
#ifndef MARIO_GEO_SWITCH_CASE_IDS_H
#define MARIO_GEO_SWITCH_CASE_IDS_H
/* Mario Geo-Switch-Case IDs */
@ -42,5 +42,4 @@ enum MarioGrabPosGSCId
/*0x03*/ GRAB_POS_BOWSER
};
#endif /* _MARIO_GEO_SWITCH_CASE_IDS_H */
#endif // MARIO_GEO_SWITCH_CASE_IDS_H

View File

@ -1,5 +1,6 @@
#ifndef _MODEL_IDS_H
#define _MODEL_IDS_H
#ifndef MODEL_IDS_H
#define MODEL_IDS_H
#define ACT_1 (1 << 0)
#define ACT_2 (1 << 1)
#define ACT_3 (1 << 2)
@ -585,4 +586,4 @@
#define MODEL_VCUTM_WARP_PIPE MODEL_LEVEL_GEOMETRY_16 // warp_pipe_geo
#define MODEL_CASTLE_GROUNDS_WARP_PIPE MODEL_LEVEL_GEOMETRY_16 // warp_pipe_geo
#endif
#endif // MODEL_IDS_H

View File

@ -69,4 +69,4 @@
#define MOV_TEX_ROT_END() \
0, 0
#endif
#endif // MOVING_TEXTURE_MACROS_H

View File

@ -1,10 +1,11 @@
#ifndef _OBJECT_CONSTANTS_H
#define _OBJECT_CONSTANTS_H
#ifndef OBJECT_CONSTANTS_H
#define OBJECT_CONSTANTS_H
// This file contains macros that provide descriptive names for
// field-specific and object-specific constants, e.g. actions.
/* activeFlags */
#define ACTIVE_FLAG_DEACTIVATED 0 // 0x0000
#define ACTIVE_FLAG_ACTIVE (1 << 0) // 0x0001
#define ACTIVE_FLAG_FAR_AWAY (1 << 1) // 0x0002
#define ACTIVE_FLAG_UNK2 (1 << 2) // 0x0004
@ -12,12 +13,11 @@
#define ACTIVE_FLAG_UNIMPORTANT (1 << 4) // 0x0010
#define ACTIVE_FLAG_INITIATED_TIME_STOP (1 << 5) // 0x0020
#define ACTIVE_FLAG_MOVE_THROUGH_GRATE (1 << 6) // 0x0040
#define ACTIVE_FLAG_UNK7 (1 << 7) // 0x0080
#define ACTIVE_FLAG_DITHERED_ALPHA (1 << 7) // 0x0080
#define ACTIVE_FLAG_UNK8 (1 << 8) // 0x0100
#define ACTIVE_FLAG_UNK9 (1 << 9) // 0x0200
#define ACTIVE_FLAG_UNK10 (1 << 10) // 0x0400
#define ACTIVE_FLAGS_DEACTIVATED 0
/* respawnInfoType */
#define RESPAWN_INFO_TYPE_NULL 0
@ -211,7 +211,7 @@
#define BLUE_FISH_ACT_TURN 1
#define BLUE_FISH_ACT_ASCEND 2
#define BLUE_FISH_ACT_TURN_BACK 3
/* oAction: bhv_blue_fish_spawn_loop */
#define BLUE_FISH_ACT_SPAWN 0
#define BLUE_FISH_ACT_ROOM 1
@ -757,11 +757,11 @@
/* Walking sounds */
#define PENGUIN_WALK_BABY 0
#define PENGUIN_WALK_BIG 1
/* Animations */
#define PENGUIN_ANIM_WALK 0
#define PENGUIN_ANIM_IDLE 3
/* Racing penguin */
/* oAction */
#define RACING_PENGUIN_ACT_WAIT_FOR_MARIO 0
@ -770,14 +770,14 @@
#define RACING_PENGUIN_ACT_RACE 3
#define RACING_PENGUIN_ACT_FINISH_RACE 4
#define RACING_PENGUIN_ACT_SHOW_FINAL_TEXT 5
/* SL walking penguin */
/* oAction */
#define SL_WALKING_PENGUIN_ACT_MOVING_FORWARDS 0
#define SL_WALKING_PENGUIN_ACT_TURNING_BACK 1
#define SL_WALKING_PENGUIN_ACT_RETURNING 2
#define SL_WALKING_PENGUIN_ACT_TURNING_FORWARDS 3
/* Snowman wind */
/* oSubAction */
#define SL_SNOWMAN_WIND_ACT_IDLE 0
@ -971,4 +971,4 @@
#define BOWSER_PUZZLE_ACT_WAIT_FOR_COMPLETE 1
#define BOWSER_PUZZLE_ACT_DONE 2
#endif
#endif // OBJECT_CONSTANTS_H

View File

@ -1,6 +1,5 @@
#ifndef _OBJECT_FIELDS_H
#define _OBJECT_FIELDS_H
#ifndef OBJECT_FIELDS_H
#define OBJECT_FIELDS_H
/**
* The array [0x88, 0x1C8) in struct Object consists of fields that can vary by
@ -327,7 +326,7 @@
#define /*0x1B2*/ oBubbaUnk1B2 OBJECT_FIELD_S16(0x4A, + 1)
/* Bullet Bill */
#define /*0x0F8*/ oBulletBillUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x0F8*/ oBulletBillInitialMoveYaw OBJECT_FIELD_S32(0x1C)
/* Bully (all variants) */
#define /*0x0F4*/ oBullySubtype OBJECT_FIELD_S32(0x1B)
@ -703,15 +702,15 @@
#define /*0x0F4*/ oMontyMoleHoleCooldown OBJECT_FIELD_S32(0x1B)
/* Mr. Blizzard */
#define /*0x0F4*/ oMrBlizzardUnkF4 OBJECT_FIELD_F32(0x1B)
#define /*0x0F8*/ oMrBlizzardUnkF8 OBJECT_FIELD_OBJ(0x1C)
#define /*0x0FC*/ oMrBlizzardUnkFC OBJECT_FIELD_F32(0x1D)
#define /*0x100*/ oMrBlizzardUnk100 OBJECT_FIELD_S32(0x1E)
#define /*0x104*/ oMrBlizzardUnk104 OBJECT_FIELD_F32(0x1F)
#define /*0x108*/ oMrBlizzardUnk108 OBJECT_FIELD_F32(0x20)
#define /*0x10C*/ oMrBlizzardUnk10C OBJECT_FIELD_F32(0x21)
#define /*0x110*/ oMrBlizzardUnk110 OBJECT_FIELD_S32(0x22)
#define /*0x1AC*/ oMrBlizzardUnk1AC OBJECT_FIELD_S32(0x49)
#define /*0x0F4*/ oMrBlizzardScale OBJECT_FIELD_F32(0x1B)
#define /*0x0F8*/ oMrBlizzardHeldObj OBJECT_FIELD_OBJ(0x1C)
#define /*0x0FC*/ oMrBlizzardGraphYVel OBJECT_FIELD_F32(0x1D)
#define /*0x100*/ oMrBlizzardTimer OBJECT_FIELD_S32(0x1E)
#define /*0x104*/ oMrBlizzardDizziness OBJECT_FIELD_F32(0x1F)
#define /*0x108*/ oMrBlizzardChangeInDizziness OBJECT_FIELD_F32(0x20)
#define /*0x10C*/ oMrBlizzardGraphYOffset OBJECT_FIELD_F32(0x21)
#define /*0x110*/ oMrBlizzardDistFromHome OBJECT_FIELD_S32(0x22)
#define /*0x1AC*/ oMrBlizzardTargetMoveYaw OBJECT_FIELD_S32(0x49)
/* Mr. I */
#define /*0x0F4*/ oMrIUnkF4 OBJECT_FIELD_S32(0x1B)
@ -953,7 +952,7 @@
#define /*0x0FC*/ oSwoopTargetYaw OBJECT_FIELD_S32(0x1D)
/* Thwomp */
#define /*0x0F4*/ oThwompUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F4*/ oThwompRandomTimer OBJECT_FIELD_S32(0x1B)
/* Tilting Platform */
#define /*0x0F4*/ oTiltingPyramidNormalX OBJECT_FIELD_F32(0x1B)
@ -1133,7 +1132,7 @@
#define /*0x0F4*/ oStrongWindParticlePenguinObj OBJECT_FIELD_OBJ(0x1B)
/* Whomp */
#define /*0x0F8*/ oWhompUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x0F8*/ oWhompShakeVal OBJECT_FIELD_S32(0x1C)
/* Wiggler */
#define /*0x0F4*/ oWigglerFallThroughFloorsHeight OBJECT_FIELD_F32(0x1B)
@ -1143,11 +1142,11 @@
#define /*0x108*/ oWigglerTimeUntilRandomTurn OBJECT_FIELD_S32(0x20)
#define /*0x10C*/ oWigglerTargetYaw OBJECT_FIELD_S32(0x21)
#define /*0x110*/ oWigglerWalkAwayFromWallTimer OBJECT_FIELD_S32(0x22)
#define /*0x1AC*/ oWigglerUnk1AC OBJECT_FIELD_S16(0x49, 0)
#define /*0x1AC*/ oWigglerUnused OBJECT_FIELD_S16(0x49, 0)
#define /*0x1AE*/ oWigglerTextStatus OBJECT_FIELD_S16(0x49, + 1)
/* Lll Wood Piece */
#define /*0x0F4*/ oLllWoodPieceUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F4*/ oLllWoodPieceOscillationTimer OBJECT_FIELD_S32(0x1B)
/* Wooden Post */
#define /*0x0F4*/ oWoodenPostTotalMarioAngle OBJECT_FIELD_S32(0x1B)
@ -1157,8 +1156,8 @@
#define /*0x104*/ oWoodenPostOffsetY OBJECT_FIELD_F32(0x1F)
/* Yoshi */
#define /*0x0F4*/ oYoshiUnkF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F4*/ oYoshiBlinkTimer OBJECT_FIELD_S32(0x1B)
#define /*0x0FC*/ oYoshiChosenHome OBJECT_FIELD_S32(0x1D)
#define /*0x100*/ oYoshiTargetYaw OBJECT_FIELD_S32(0x1E)
#endif
#endif // OBJECT_FIELDS_H

View File

@ -12,4 +12,4 @@
#define DOUBLE_SIZE_ON_64_BIT(size) ((size) * (sizeof(void *) / 4))
#endif
#endif // PLATFORM_INFO_H

View File

@ -1,5 +1,5 @@
#ifndef _PREVENT_BSS_REORDERING_H
#define _PREVENT_BSS_REORDERING_H
#ifndef PREVENT_BSS_REORDERING_H
#define PREVENT_BSS_REORDERING_H
/**
* To determine variable order for .bss, the compiler sorts variables by their
@ -80,4 +80,4 @@ struct Dummy61 { int x; };
struct Dummy62 { int x; };
typedef int Dummy63;
#endif
#endif // PREVENT_BSS_REORDERING_H

View File

@ -1,6 +1,7 @@
#ifndef SEGMENT_SYMBOLS_H
#define SEGMENT_SYMBOLS_H
#ifndef NO_SEGMENTED_MEMORY
#define DECLARE_SEGMENT(name) \
extern u8 _##name##SegmentRomStart[]; \
extern u8 _##name##SegmentRomEnd[];
@ -34,6 +35,8 @@ DECLARE_ACTOR_SEGMENT(group15)
DECLARE_ACTOR_SEGMENT(group16)
DECLARE_ACTOR_SEGMENT(group17)
DECLARE_SEGMENT(entry)
DECLARE_SEGMENT(engine)
DECLARE_SEGMENT(behavior)
DECLARE_SEGMENT(scripts)
DECLARE_SEGMENT(goddard)
@ -51,6 +54,8 @@ DECLARE_LEVEL_SEGMENT(ending)
#undef STUB_LEVEL
#undef DEFINE_LEVEL
DECLARE_SEGMENT(segment2_mio0)
DECLARE_SEGMENT(water_skybox_mio0)
DECLARE_SEGMENT(ccm_skybox_mio0)
DECLARE_SEGMENT(clouds_skybox_mio0)
@ -79,4 +84,12 @@ DECLARE_SEGMENT(title_screen_bg_mio0)
DECLARE_SEGMENT(debug_level_select_mio0)
#ifdef VERSION_EU
DECLARE_SEGMENT(translation_de_mio0)
DECLARE_SEGMENT(translation_en_mio0)
DECLARE_SEGMENT(translation_fr_mio0)
#endif
#endif
#endif // SEGMENT_SYMBOLS_H

View File

@ -1,5 +1,5 @@
#ifndef _SEGMENTS_H
#define _SEGMENTS_H
#ifndef SEGMENTS_H
#define SEGMENTS_H
/*
* Memory addresses for segments. Ideally, this header file would not be
@ -53,4 +53,4 @@
#define SEG_GODDARD SEG_POOL_START + 0x113000
#endif
#endif // _SEGMENTS_H
#endif // SEGMENTS_H

View File

@ -42,4 +42,4 @@ enum SeqId {
SEQ_COUNT
};
#endif
#endif // SEQ_IDS_H

View File

@ -1,5 +1,5 @@
#ifndef _SM64_H_
#define _SM64_H_
#ifndef SM64_H
#define SM64_H
// Global header for Super Mario 64
@ -430,4 +430,4 @@
#define C_BUTTONS (U_CBUTTONS | D_CBUTTONS | L_CBUTTONS | R_CBUTTONS )
#endif
#endif // SM64_H

View File

@ -1,5 +1,5 @@
#ifndef _SPECIAL_PRESET_NAMES_H
#define _SPECIAL_PRESET_NAMES_H
#ifndef SPECIAL_PRESET_NAMES_H
#define SPECIAL_PRESET_NAMES_H
enum SpecialPresets {
special_null_start,
@ -43,7 +43,7 @@ enum SpecialPresets {
special_rotating_counter_clockwise,
special_wf_tumbling_bridge,
special_large_bomp,
special_level_geo_03 = 0x65,
special_level_geo_04,
special_level_geo_05,
@ -86,9 +86,8 @@ enum SpecialPresets {
special_1star_door,
special_3star_door,
special_key_door,
special_null_end = 0xFF
};
#endif // _SPECIAL_PRESET_NAMES_H
#endif // SPECIAL_PRESET_NAMES_H

View File

@ -1,5 +1,5 @@
#ifndef _SPECIAL_PRESETS_H
#define _SPECIAL_PRESETS_H
#ifndef SPECIAL_PRESETS_H
#define SPECIAL_PRESETS_H
#include "special_preset_names.h"
#include "behavior_data.h"
@ -17,13 +17,13 @@ struct SpecialPreset
/*00*/ u8 preset_id;
/*01*/ u8 type; // Determines whether object is 8, 10, 12 or 14 bytes long.
/*02*/ u8 defParam; // Default parameter, only used when type is SPTYPE_DEF_PARAM_AND_YROT
/*03*/ u8 model;
/*03*/ u8 model;
/*04*/ const BehaviorScript *behavior;
};
// Some Models ID's are missing their names because they are probably unused
static struct SpecialPreset SpecialObjectPresets[] =
static struct SpecialPreset SpecialObjectPresets[] =
{
{0x00, SPTYPE_YROT_NO_PARAMS , 0x00, MODEL_NONE, NULL},
{0x01, SPTYPE_NO_YROT_OR_PARAMS , 0x00, MODEL_YELLOW_COIN, bhvYellowCoin},
@ -110,4 +110,4 @@ static struct SpecialPreset SpecialObjectPresets[] =
{0xFF, SPTYPE_NO_YROT_OR_PARAMS , 0x00, MODEL_NONE, NULL}
};
#endif // _SPECIAL_PRESETS_H
#endif // SPECIAL_PRESETS_H

View File

@ -220,4 +220,4 @@
// Water Box
#define COL_WATER_BOX(id, x1, z1, x2, z2, y) id, x1, z1, x2, z2, y
#endif
#endif // SURFACE_TERRAINS_H

View File

@ -15,4 +15,4 @@
#define TEXT_JPHUD_ERASE_FILE _("ファイルけす")
#define TEXT_JPHUD_SOUND_SELECT _("サウンドセレクト")
#endif
#endif // TEXT_MENU_STRINGS_H

View File

@ -470,6 +470,6 @@
#define TEXT_MENU_SA_DE _(" VERSTECKTES AQUARIUM")
#define TEXT_MENU_NONE_DE _("")
#define TEXT_MENU_STARS_DE _(" GEHEIME STERNE")
#endif
#endif // VERSION_EU
#endif
#endif // TEXT_STRINGS_H

View File

@ -1,7 +1,8 @@
#ifndef TEXTURES_H
#define TEXTURES_H
#include <ultra64.h>
#include <PR/ultratypes.h>
#include <PR/gbi.h>
// cave
extern const u8 cave_09000000[];
@ -277,4 +278,4 @@ extern const Gfx title_screen_bg_dl_0A000190[];
extern const u8 *const mario_title_texture_table[];
extern const u8 *const game_over_texture_table[];
#endif
#endif // TEXTURES_H

View File

@ -1,5 +1,5 @@
#ifndef _TYPES_H_
#define _TYPES_H_
#ifndef TYPES_H
#define TYPES_H
// This file contains various data types used in Super Mario 64 that don't yet
// have an appropriate header.
@ -340,10 +340,10 @@ struct MarioState
/*0xB4*/ u8 squishTimer;
/*0xB5*/ u8 fadeWarpOpacity;
/*0xB6*/ u16 capTimer;
/*0xB8*/ s16 unkB8;
/*0xB8*/ s16 prevNumStarsForDialog;
/*0xBC*/ f32 peakHeight;
/*0xC0*/ f32 quicksandDepth;
/*0xC4*/ f32 unkC4;
};
#endif
#endif // TYPES_H

View File

@ -107,7 +107,7 @@ const LevelScript level_bbh_entry[] = {
JUMP_LINK(script_func_local_2),
JUMP_LINK(script_func_local_3),
JUMP_LINK(script_func_local_4),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 666, 796, 5350, /*angle*/ 0, 180, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps74),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 666, 796, 5350, /*angle*/ 0, 180, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvSpinAirborneWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BBH, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0xF0, /*destLevel*/ LEVEL_CASTLE_COURTYARD, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0xF1, /*destLevel*/ LEVEL_CASTLE_COURTYARD, /*destArea*/ 0x01, /*destNode*/ 0x0B, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -87,7 +87,7 @@ const LevelScript level_bitdw_entry[] = {
LOAD_MODEL_FROM_GEO(MODEL_BITDW_STAIRCASE, geo_bitdw_000600),
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_NONE, /*pos*/ -7443, -2153, 3886, /*angle*/ 0, 90, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvAirborneWarp),
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*/ bhvDeathWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BITDW, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -100,7 +100,7 @@ const LevelScript level_bitfs_entry[] = {
LOAD_MODEL_FROM_GEO(MODEL_BITFS_TUMBLING_PLATFORM, bitfs_geo_0006F0),
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*/ -7577, -1764, 0, /*angle*/ 0, 90, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvAirborneWarp),
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*/ bhvDeathWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BITFS, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -90,7 +90,7 @@ const LevelScript level_bits_entry[] = {
LOAD_MODEL_FROM_GEO(MODEL_BITS_WARP_PIPE, warp_pipe_geo),
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_NONE, /*pos*/ -7039, -3812, 4, /*angle*/ 0, 90, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvAirborneWarp),
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*/ bhvDeathWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BITS, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -78,7 +78,7 @@ const LevelScript level_bob_entry[] = {
JUMP_LINK(script_func_local_1),
JUMP_LINK(script_func_local_2),
JUMP_LINK(script_func_local_3),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -6558, 1000, 6464, /*angle*/ 0, 135, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps74),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -6558, 1000, 6464, /*angle*/ 0, 135, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvSpinAirborneWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 583, 2683, -5387, /*angle*/ 0, -154, 0, /*behParam*/ 0x000B0000, /*beh*/ bhvFadingWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 1680, 3835, -5523, /*angle*/ 0, -153, 0, /*behParam*/ 0x000C0000, /*beh*/ bhvFadingWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -6612, 1024, -3351, /*angle*/ 0, 107, 0, /*behParam*/ 0x000D0000, /*beh*/ bhvFadingWarp),

View File

@ -28,7 +28,7 @@ const LevelScript level_bowser_1_entry[] = {
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_03, bowser_1_yellow_sphere_geo),
AREA(/*index*/ 1, bowser_1_geo_0000D0),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 1307, 0, /*angle*/ 0, 180, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps6C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 1307, 0, /*angle*/ 0, 180, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvSpinAirborneCircleWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BOWSER_1, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0xF0, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x24, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0xF1, /*destLevel*/ LEVEL_BITDW, /*destArea*/ 0x01, /*destNode*/ 0x0C, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -38,7 +38,7 @@ const LevelScript level_bowser_2_entry[] = {
LOAD_MODEL_FROM_GEO(MODEL_BOWSER_2_TILTING_ARENA, bowser_2_geo_000170),
AREA(/*index*/ 1, bowser_2_geo_000188),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 2229, 0, /*angle*/ 0, 180, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps6C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 2229, 0, /*angle*/ 0, 180, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvSpinAirborneCircleWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BOWSER_2, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0xF0, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x36, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0xF1, /*destLevel*/ LEVEL_BITFS, /*destArea*/ 0x01, /*destNode*/ 0x0C, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -56,7 +56,7 @@ const LevelScript level_bowser_3_entry[] = {
LOAD_MODEL_FROM_GEO(MODEL_LEVEL_GEOMETRY_03, bowser_3_geo_000380),
AREA(/*index*/ 1, bowser_3_geo_000398),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 1307, 0, /*angle*/ 0, 183, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps6C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 1307, 0, /*angle*/ 0, 183, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvSpinAirborneCircleWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_BOWSER_3, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
JUMP_LINK(script_func_local_1),
WARP_NODE(/*id*/ 0xF1, /*destLevel*/ LEVEL_BITS, /*destArea*/ 0x01, /*destNode*/ 0x0C, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -48,8 +48,8 @@ const LevelScript level_castle_courtyard_entry[] = {
AREA(/*index*/ 1, castle_courtyard_geo_000218),
OBJECT(/*model*/ MODEL_BOO, /*pos*/ -2360, -100, -2712, /*angle*/ 0, 0, 0, /*behParam*/ 0x01050000, /*beh*/ bhvBooWithCage),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 51, -1000, /*angle*/ 0, 180, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps8C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 51, -1000, /*angle*/ 0, 180, 0, /*behParam*/ 0x000B0000, /*beh*/ bhvWarps90),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 51, -1000, /*angle*/ 0, 180, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvLaunchStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 51, -1000, /*angle*/ 0, 180, 0, /*behParam*/ 0x000B0000, /*beh*/ bhvLaunchDeathWarp),
WARP_NODE(/*id*/ 0x05, /*destLevel*/ LEVEL_BBH, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_CASTLE_COURTYARD, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x0B, /*destLevel*/ LEVEL_CASTLE_COURTYARD, /*destArea*/ 0x01, /*destNode*/ 0x0B, /*flags*/ WARP_NO_CHECKPOINT),

View File

@ -21,21 +21,21 @@ static const LevelScript script_func_local_1[] = {
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*/ 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),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1328, 260, 4664, /*angle*/ 0, 180, 0, /*behParam*/ 0x00040000, /*beh*/ bhvSpinAirborneCircleWarp),
WARP_NODE(/*id*/ 0x04, /*destLevel*/ LEVEL_CASTLE_GROUNDS, /*destArea*/ 0x01, /*destNode*/ 0x04, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3379, -815, -2025, /*angle*/ 0, 0, 0, /*behParam*/ 0x3C050000, /*beh*/ bhvWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3379, -500, -2025, /*angle*/ 0, 180, 0, /*behParam*/ 0x00060000, /*beh*/ bhvWarps90),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3799, -1199, -5816, /*angle*/ 0, 0, 0, /*behParam*/ 0x00070000, /*beh*/ bhvWarps94),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3379, -500, -2025, /*angle*/ 0, 180, 0, /*behParam*/ 0x00080000, /*beh*/ bhvWarps8C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3379, -500, -2025, /*angle*/ 0, 180, 0, /*behParam*/ 0x00060000, /*beh*/ bhvLaunchDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3799, -1199, -5816, /*angle*/ 0, 0, 0, /*behParam*/ 0x00070000, /*beh*/ bhvSwimmingWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3379, -500, -2025, /*angle*/ 0, 180, 0, /*behParam*/ 0x00080000, /*beh*/ bhvLaunchStarCollectWarp),
WARP_NODE(/*id*/ 0x05, /*destLevel*/ LEVEL_VCUTM, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x06, /*destLevel*/ LEVEL_CASTLE_GROUNDS, /*destArea*/ 0x01, /*destNode*/ 0x06, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x07, /*destLevel*/ LEVEL_CASTLE_GROUNDS, /*destArea*/ 0x01, /*destNode*/ 0x07, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x08, /*destLevel*/ LEVEL_CASTLE_GROUNDS, /*destArea*/ 0x01, /*destNode*/ 0x08, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5408, 4500, 3637, /*angle*/ 0, 225, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvWarps64),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 5408, 4500, 3637, /*angle*/ 0, 225, 0, /*behParam*/ 0x000A0000, /*beh*/ bhvAirborneWarp),
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_CASTLE_GROUNDS, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -6901, 2376, -6509, /*angle*/ 0, 230, 0, /*behParam*/ 0x00140000, /*beh*/ bhvWarps64),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -6901, 2376, -6509, /*angle*/ 0, 230, 0, /*behParam*/ 0x00140000, /*beh*/ bhvAirborneWarp),
WARP_NODE(/*id*/ 0x14, /*destLevel*/ LEVEL_CASTLE_GROUNDS, /*destArea*/ 0x01, /*destNode*/ 0x14, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4997, -1250, 2258, /*angle*/ 0, 210, 0, /*behParam*/ 0x001E0000, /*beh*/ bhvWarps94),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4997, -1250, 2258, /*angle*/ 0, 210, 0, /*behParam*/ 0x001E0000, /*beh*/ bhvSwimmingWarp),
WARP_NODE(/*id*/ 0x1E, /*destLevel*/ LEVEL_CASTLE_GROUNDS, /*destArea*/ 0x01, /*destNode*/ 0x1E, /*flags*/ WARP_NO_CHECKPOINT),
RETURN(),
};

View File

@ -2,6 +2,7 @@
#define CASTLE_INSIDE_HEADER_H
#include "types.h"
#include "game/paintings.h"
#include "game/moving_texture.h"
// geo

View File

@ -49,16 +49,16 @@ static const LevelScript script_func_local_1[] = {
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 1963, 819, 1280, /*angle*/ 0, 0, 0, /*behParam*/ 0x050C0000, /*beh*/ bhvWarp),
WARP_NODE(/*id*/ 0x0C, /*destLevel*/ LEVEL_SA, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0xF2, /*destLevel*/ LEVEL_TOTWC, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 512, -650, /*angle*/ 0, 0, 0, /*behParam*/ 0x001E0000, /*beh*/ bhvWarps60),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, -50, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x001F0000, /*beh*/ bhvWarps60),
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, 512, -650, /*angle*/ 0, 0, 0, /*behParam*/ 0x001E0000, /*beh*/ bhvInstantActiveWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, -50, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x001F0000, /*beh*/ bhvInstantActiveWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x00200000, /*beh*/ bhvAirborneWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x00210000, /*beh*/ bhvAirborneDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 180, 0, /*behParam*/ 0x00220000, /*beh*/ bhvHardAirKnockBackWarp),
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*/ -5513, 512, -4324, /*angle*/ 0, -135, 0, /*behParam*/ 0x00240000, /*beh*/ bhvLaunchStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -5513, 512, -4324, /*angle*/ 0, -135, 0, /*behParam*/ 0x00250000, /*beh*/ bhvLaunchDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1024, 900, 717, /*angle*/ 0, 0, 0, /*behParam*/ 0x00260000, /*beh*/ bhvAirborneStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2816, 1200, -256, /*angle*/ 0, 90, 0, /*behParam*/ 0x00270000, /*beh*/ bhvAirborneStarCollectWarp),
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),
@ -71,10 +71,10 @@ static const LevelScript script_func_local_1[] = {
WARP_NODE(/*id*/ 0x26, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x26, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x27, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x27, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x28, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x28, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -5422, 717, -461, /*angle*/ 0, 270, 0, /*behParam*/ 0x00320000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -2304, 0, -4552, /*angle*/ 0, 180, 0, /*behParam*/ 0x00330000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 256, 102, -4706, /*angle*/ 0, 180, 0, /*behParam*/ 0x00340000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4501, 717, -230, /*angle*/ 0, 90, 0, /*behParam*/ 0x00350000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -5422, 717, -461, /*angle*/ 0, 270, 0, /*behParam*/ 0x00320000, /*beh*/ bhvPaintingStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -2304, 0, -4552, /*angle*/ 0, 180, 0, /*behParam*/ 0x00330000, /*beh*/ bhvPaintingStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 256, 102, -4706, /*angle*/ 0, 180, 0, /*behParam*/ 0x00340000, /*beh*/ bhvPaintingStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4501, 717, -230, /*angle*/ 0, 90, 0, /*behParam*/ 0x00350000, /*beh*/ bhvPaintingStarCollectWarp),
WARP_NODE(/*id*/ 0x32, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x01, /*destNode*/ 0x32, /*flags*/ WARP_NO_CHECKPOINT),
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),
@ -122,14 +122,14 @@ static const LevelScript script_func_local_2[] = {
WARP_NODE(/*id*/ 0x0A, /*destLevel*/ LEVEL_WMOTR, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -230, 4813, -3352, /*angle*/ 0, 0, 0, /*behParam*/ 0x0F0B0000, /*beh*/ bhvWarp),
WARP_NODE(/*id*/ 0x0B, /*destLevel*/ LEVEL_BITS, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -659, 1613, -350, /*angle*/ 0, 180, 0, /*behParam*/ 0x00320000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -4693, 2157, 1828, /*angle*/ 0, 270, 0, /*behParam*/ 0x00330000, /*beh*/ bhvWarps88),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -675, 1400, 3870, /*angle*/ 0, 0, 0, /*behParam*/ 0x00340000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -205, 2918, 7300, /*angle*/ 0, 0, 0, /*behParam*/ 0x00350000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 3538, 1766, -400, /*angle*/ 0, 180, 0, /*behParam*/ 0x00360000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -4693, 2157, 1828, /*angle*/ 0, 270, 0, /*behParam*/ 0x00370000, /*beh*/ bhvWarps88),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 3002, 2816, 5886, /*angle*/ 0, 90, 0, /*behParam*/ 0x00380000, /*beh*/ bhvWarps8C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3412, 2816, 5886, /*angle*/ 0, 270, 0, /*behParam*/ 0x003A0000, /*beh*/ bhvWarps8C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -659, 1613, -350, /*angle*/ 0, 180, 0, /*behParam*/ 0x00320000, /*beh*/ bhvPaintingStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -4693, 2157, 1828, /*angle*/ 0, 270, 0, /*behParam*/ 0x00330000, /*beh*/ bhvAirborneStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -675, 1400, 3870, /*angle*/ 0, 0, 0, /*behParam*/ 0x00340000, /*beh*/ bhvPaintingStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -205, 2918, 7300, /*angle*/ 0, 0, 0, /*behParam*/ 0x00350000, /*beh*/ bhvPaintingStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 3538, 1766, -400, /*angle*/ 0, 180, 0, /*behParam*/ 0x00360000, /*beh*/ bhvPaintingStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -4693, 2157, 1828, /*angle*/ 0, 270, 0, /*behParam*/ 0x00370000, /*beh*/ bhvAirborneStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 3002, 2816, 5886, /*angle*/ 0, 90, 0, /*behParam*/ 0x00380000, /*beh*/ bhvLaunchStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3412, 2816, 5886, /*angle*/ 0, 270, 0, /*behParam*/ 0x003A0000, /*beh*/ bhvLaunchStarCollectWarp),
WARP_NODE(/*id*/ 0x32, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x32, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x33, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x33, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x34, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x34, /*flags*/ WARP_NO_CHECKPOINT),
@ -144,9 +144,9 @@ static const LevelScript script_func_local_2[] = {
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),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -230, 4813, -3352, /*angle*/ 0, 180, 0, /*behParam*/ 0x006B0000, /*beh*/ bhvLaunchDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -3412, 2816, 5886, /*angle*/ 0, 270, 0, /*behParam*/ 0x006C0000, /*beh*/ bhvLaunchDeathWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 3002, 2816, 5886, /*angle*/ 0, 90, 0, /*behParam*/ 0x006D0000, /*beh*/ bhvLaunchDeathWarp),
WARP_NODE(/*id*/ 0x64, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x64, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x65, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x65, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x66, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x02, /*destNode*/ 0x66, /*flags*/ WARP_NO_CHECKPOINT),
@ -179,11 +179,11 @@ static const LevelScript script_func_local_3[] = {
PAINTING_WARP_NODE(/*id*/ 0x17, /*destLevel*/ LEVEL_DDD, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4147, -1280, 1997, /*angle*/ 0, 0, 0, /*behParam*/ 0x0F180000, /*beh*/ bhvWarp),
WARP_NODE(/*id*/ 0x18, /*destLevel*/ LEVEL_BITFS, /*destArea*/ 0x01, /*destNode*/ 0x0A, /*flags*/ WARP_NO_CHECKPOINT),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1382, -819, -4150, /*angle*/ 0, 180, 0, /*behParam*/ 0x00320000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -2918, -870, -875, /*angle*/ 0, 0, 0, /*behParam*/ 0x00330000, /*beh*/ bhvWarps7C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2483, -1688, -2662, /*angle*/ 0, 270, 0, /*behParam*/ 0x00340000, /*beh*/ bhvWarps8C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2381, -500, 2011, /*angle*/ 0, 90, 0, /*behParam*/ 0x00350000, /*beh*/ bhvWarps88),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4147, -1100, 1997, /*angle*/ 0, 90, 0, /*behParam*/ 0x00360000, /*beh*/ bhvWarps8C),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -1382, -819, -4150, /*angle*/ 0, 180, 0, /*behParam*/ 0x00320000, /*beh*/ bhvPaintingStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ -2918, -870, -875, /*angle*/ 0, 0, 0, /*behParam*/ 0x00330000, /*beh*/ bhvPaintingStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2483, -1688, -2662, /*angle*/ 0, 270, 0, /*behParam*/ 0x00340000, /*beh*/ bhvLaunchStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 2381, -500, 2011, /*angle*/ 0, 90, 0, /*behParam*/ 0x00350000, /*beh*/ bhvAirborneStarCollectWarp),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4147, -1100, 1997, /*angle*/ 0, 90, 0, /*behParam*/ 0x00360000, /*beh*/ bhvLaunchStarCollectWarp),
WARP_NODE(/*id*/ 0x32, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x32, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x33, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x33, /*flags*/ WARP_NO_CHECKPOINT),
WARP_NODE(/*id*/ 0x34, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x34, /*flags*/ WARP_NO_CHECKPOINT),
@ -191,9 +191,9 @@ static const LevelScript script_func_local_3[] = {
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*/ 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*/ 2483, -1688, -2662, /*angle*/ 0, 270, 0, /*behParam*/ 0x00660000, /*beh*/ bhvLaunchDeathWarp),
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),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 4147, -1100, 1997, /*angle*/ 0, 90, 0, /*behParam*/ 0x00680000, /*beh*/ bhvLaunchDeathWarp),
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),
WARP_NODE(/*id*/ 0x66, /*destLevel*/ LEVEL_CASTLE, /*destArea*/ 0x03, /*destNode*/ 0x66, /*flags*/ WARP_NO_CHECKPOINT),

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