You've already forked HackerSM64
mirror of
https://github.com/HackerN64/HackerSM64.git
synced 2026-01-21 10:35:32 -08:00
Compare commits
27 Commits
arthurtill
...
develop/2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8676898ae9 | ||
|
|
c4c18b3d0e | ||
|
|
7298e94a1f | ||
|
|
27d328f86a | ||
|
|
27372fe74a | ||
|
|
3f1f7f41be | ||
|
|
bf70500b4d | ||
|
|
27fedee76f | ||
|
|
a918785a92 | ||
|
|
10720ea056 | ||
|
|
8dc47095e2 | ||
|
|
e3472e05cf | ||
|
|
74cb8ce062 | ||
|
|
9ef945296b | ||
|
|
e1c00d4bef | ||
|
|
aacf2c5e6d | ||
|
|
4500ffb579 | ||
|
|
a6782e6912 | ||
|
|
750ba10cb1 | ||
|
|
500507509b | ||
|
|
7381e35db4 | ||
|
|
6a3e7e7a87 | ||
|
|
9adb8c6de8 | ||
|
|
03ba81b5e3 | ||
|
|
98b6231216 | ||
|
|
252a900b91 | ||
|
|
92822c6412 |
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
@@ -27,7 +27,8 @@
|
||||
"F3DEX_GBI_2=1",
|
||||
"F3DZEX_NON_GBI_2=1",
|
||||
"F3DEX_GBI_SHARED=1",
|
||||
"LIBPL=1"
|
||||
"LIBPL=1",
|
||||
"SDATA=1"
|
||||
],
|
||||
"compilerPath": "/usr/bin/mips-linux-gnu-gcc",
|
||||
"cStandard": "gnu17",
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
# Each line is a file pattern followed by one or more owners.
|
||||
|
||||
# These owners will be the default owners for everything in the repo.
|
||||
* @Reonu
|
||||
* @thecozies
|
||||
* @gheskett
|
||||
* @Reonu @gheskett @arthurtilly
|
||||
|
||||
# Order is important. The last matching pattern has the most precedence.
|
||||
# So if a pull request only touches javascript files, only these owners
|
||||
|
||||
87
Makefile
87
Makefile
@@ -265,6 +265,15 @@ ifeq ($(LIBPL),1)
|
||||
SRC_DIRS += $(LIBPL_DIR)
|
||||
endif
|
||||
|
||||
# SDATA - use 64kb sdata and sbss sections to enhance performance (requires some housekeeping; recommended for experienced hackers only)
|
||||
# 1 - includes sdata and sbss in ROM
|
||||
# 0 - does not
|
||||
SDATA ?= 0
|
||||
$(eval $(call validate-option,SDATA,0 1))
|
||||
ifeq ($(SDATA),1)
|
||||
DEFINES += SDATA=1
|
||||
endif
|
||||
|
||||
BUILD_DIR_BASE := build
|
||||
# BUILD_DIR is the location where all build artifacts are placed
|
||||
BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_$(CONSOLE)
|
||||
@@ -448,6 +457,8 @@ else ifneq ($(call find-command,mips64-none-elf-ld),)
|
||||
CROSS := mips64-none-elf-
|
||||
else ifneq ($(call find-command,mips-ld),)
|
||||
CROSS := mips-
|
||||
else ifneq ($(call find-command,mips-suse-linux-ld ),)
|
||||
CROSS := mips-suse-linux-
|
||||
else
|
||||
$(error Unable to detect a suitable MIPS toolchain installed)
|
||||
endif
|
||||
@@ -464,6 +475,10 @@ ifeq ($(COMPILER),gcc)
|
||||
CXX := $(CROSS)g++
|
||||
$(BUILD_DIR)/actors/%.o: OPT_FLAGS := -Ofast -mlong-calls
|
||||
$(BUILD_DIR)/levels/%.o: OPT_FLAGS := -Ofast -mlong-calls
|
||||
ifeq ($(SDATA),1)
|
||||
$(BUILD_DIR)/actors/%.o: CFLAGS += -G 0
|
||||
$(BUILD_DIR)/levels/%.o: CFLAGS += -G 0
|
||||
endif
|
||||
else ifeq ($(COMPILER),clang)
|
||||
CC := clang
|
||||
CXX := clang++
|
||||
@@ -504,17 +519,25 @@ C_DEFINES := $(foreach d,$(DEFINES),-D$(d))
|
||||
DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
|
||||
|
||||
# C compiler options
|
||||
CFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS)
|
||||
CFLAGS = $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS)
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CFLAGS += -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra
|
||||
CFLAGS += -Wno-missing-braces
|
||||
CFLAGS += -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra -Wno-missing-braces
|
||||
else ifeq ($(COMPILER),clang)
|
||||
CFLAGS += -mfpxx -target mips -mabi=32 -G 0 -mhard-float -fomit-frame-pointer -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
|
||||
CFLAGS += -Wno-missing-braces
|
||||
CFLAGS += -mfpxx -target mips -mabi=32 -mhard-float -fomit-frame-pointer -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 -Wno-missing-braces
|
||||
else
|
||||
CFLAGS += -non_shared -Wab,-r4300_mul -Xcpluscomm -Xfullwarn -signed -32
|
||||
endif
|
||||
ASMFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) -mips3 $(DEF_INC_CFLAGS) -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra
|
||||
ASMFLAGS = -G 3 $(OPT_FLAGS) $(TARGET_CFLAGS) -mips3 $(DEF_INC_CFLAGS) -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra
|
||||
|
||||
ifeq ($(SDATA),1)
|
||||
ASMFLAGS += -G 3
|
||||
else
|
||||
CFLAGS += -G 0
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CFLAGS += -fno-zero-initialized-in-bss
|
||||
endif
|
||||
ASMFLAGS += -G 0
|
||||
endif
|
||||
|
||||
ASFLAGS := -march=vr4300 -mabi=32 $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(foreach d,$(DEFINES),--defsym $(d))
|
||||
RSPASMFLAGS := $(foreach d,$(DEFINES),-definelabel $(subst =, ,$(d)))
|
||||
@@ -562,10 +585,19 @@ endif
|
||||
|
||||
EMU_FLAGS =
|
||||
|
||||
# Adding a txt file to this location will then reference a UNFLoader path specified in the file, instead of locally.
|
||||
# This is expecially important for WSL users because UNFLoader.exe is incredibly slow when run within WSL's filesystem, so this can be used to point to the C drive.
|
||||
# The file should only contain the directory path that contains UNFLoader[.exe] (do not specify the filename).
|
||||
LOADER_DIR_FILE_SPECIFICATION_PATH = ~/.local/share/HackerSM64/UNFLoader-dir.txt
|
||||
LOADER_DIR = ./$(TOOLS_DIR)
|
||||
|
||||
ifneq (,$(wildcard $(LOADER_DIR_FILE_SPECIFICATION_PATH)))
|
||||
LOADER_DIR = $(shell cat $(LOADER_DIR_FILE_SPECIFICATION_PATH))
|
||||
endif
|
||||
ifneq (,$(call find-command,wslview))
|
||||
LOADER = ./$(TOOLS_DIR)/UNFLoader.exe
|
||||
LOADER_EXEC = $(LOADER_DIR)/UNFLoader.exe
|
||||
else
|
||||
LOADER = ./$(TOOLS_DIR)/UNFLoader
|
||||
LOADER_EXEC = $(LOADER_DIR)/UNFLoader
|
||||
endif
|
||||
|
||||
SHA1SUM = sha1sum
|
||||
@@ -621,17 +653,17 @@ test-pj64: $(ROM)
|
||||
# someone2639
|
||||
|
||||
# download and extract most recent unfloader build if needed
|
||||
$(LOADER):
|
||||
ifeq (,$(wildcard $(LOADER)))
|
||||
$(LOADER_EXEC):
|
||||
ifeq (,$(wildcard $(LOADER_EXEC)))
|
||||
@$(PRINT) "Downloading latest UNFLoader...$(NO_COL)\n"
|
||||
$(PYTHON) $(TOOLS_DIR)/get_latest_unfloader.py $(TOOLS_DIR)
|
||||
$(PYTHON) $(TOOLS_DIR)/get_latest_unfloader.py $(LOADER_DIR)
|
||||
endif
|
||||
|
||||
load: $(ROM) $(LOADER)
|
||||
$(LOADER) -r $<
|
||||
load: $(ROM) $(LOADER_EXEC)
|
||||
$(LOADER_EXEC) -r $<
|
||||
|
||||
unf: $(ROM) $(LOADER)
|
||||
$(LOADER) -d -r $<
|
||||
unf: $(ROM) $(LOADER_EXEC)
|
||||
$(LOADER_EXEC) -d -r $<
|
||||
|
||||
libultra: $(BUILD_DIR)/libultra.a
|
||||
|
||||
@@ -685,8 +717,13 @@ $(BUILD_DIR)/src/usb/usb.o: CFLAGS += -Wno-unused-variable -Wno-sign-compare -Wn
|
||||
$(BUILD_DIR)/src/usb/debug.o: OPT_FLAGS := -O0
|
||||
$(BUILD_DIR)/src/usb/debug.o: CFLAGS += -Wno-unused-parameter -Wno-maybe-uninitialized
|
||||
# File specific opt flags
|
||||
$(BUILD_DIR)/src/audio/heap.o: OPT_FLAGS := -Os -fno-jump-tables
|
||||
$(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -Os -fno-jump-tables
|
||||
ifeq ($(SDATA),1)
|
||||
$(BUILD_DIR)/src/audio/heap.o: OPT_FLAGS := -Os -fno-jump-tables -ffunction-sections -fdata-sections
|
||||
$(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -Os -fno-jump-tables -ffunction-sections -fdata-sections
|
||||
else
|
||||
$(BUILD_DIR)/src/audio/heap.o: OPT_FLAGS := -Os -fno-jump-tables
|
||||
$(BUILD_DIR)/src/audio/synthesis.o: OPT_FLAGS := -Os -fno-jump-tables
|
||||
endif
|
||||
|
||||
$(BUILD_DIR)/src/engine/surface_collision.o: OPT_FLAGS := $(COLLISION_OPT_FLAGS)
|
||||
$(BUILD_DIR)/src/engine/math_util.o: OPT_FLAGS := $(MATH_UTIL_OPT_FLAGS)
|
||||
@@ -780,7 +817,7 @@ endif
|
||||
|
||||
$(BUILD_DIR)/%.table: %.aiff
|
||||
$(call print,Extracting codebook:,$<,$@)
|
||||
$(V)$(AIFF_EXTRACT_CODEBOOK) $< >$@
|
||||
$(V)$(AIFF_EXTRACT_CODEBOOK) $< $@
|
||||
|
||||
$(BUILD_DIR)/%.aifc: $(BUILD_DIR)/%.table %.aiff
|
||||
$(call print,Encoding ADPCM:,$(word 2,$^),$@)
|
||||
@@ -868,9 +905,23 @@ ifeq ($(FIXLIGHTS),1)
|
||||
DUMMY != $(PYTHON) $(FIXLIGHTS_PY) actors
|
||||
DUMMY != $(PYTHON) $(FIXLIGHTS_PY) levels
|
||||
endif
|
||||
|
||||
ifeq ($(SDATA),1)
|
||||
$(BUILD_DIR)/src/boot/%.o: src/boot/%.c
|
||||
$(call print,Compiling Boot:,$<,$@)
|
||||
$(V)$(CC) -c -G 0 $(CFLAGS) -MMD -MF $(BUILD_DIR)/src/boot/$*.d -o $@ $<
|
||||
$(BUILD_DIR)/src/%.o: src/%.c
|
||||
$(call print,Compiling:,$<,$@)
|
||||
$(V)$(CC) -c -G 64 $(CFLAGS) -MMD -MF $(BUILD_DIR)/src/$*.d -o $@ $<
|
||||
$(BUILD_DIR)/%.o: %.c
|
||||
$(call print,Compiling:,$<,$@)
|
||||
$(V)$(CC) -c -G 0 -fno-zero-initialized-in-bss $(CFLAGS) -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
|
||||
else
|
||||
$(BUILD_DIR)/%.o: %.c
|
||||
$(call print,Compiling:,$<,$@)
|
||||
$(V)$(CC) -c $(CFLAGS) -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
|
||||
endif
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp
|
||||
$(call print,Compiling (C++):,$<,$@)
|
||||
$(V)$(CXX) -c $(CFLAGS) -std=c++17 -Wno-register -MMD -MF $(BUILD_DIR)/$*.d -o $@ $<
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.2.0
|
||||
v2.3.0
|
||||
|
||||
18
asm/setgp.s
Normal file
18
asm/setgp.s
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifdef SDATA
|
||||
|
||||
// assembler directives
|
||||
.set noat // allow manual use of $at
|
||||
.set noreorder // don't insert nops after branches
|
||||
.set gp=64
|
||||
|
||||
#include "macros.inc"
|
||||
|
||||
|
||||
.section .text, "ax"
|
||||
|
||||
glabel setgp
|
||||
lui $gp, %hi(_gp)
|
||||
jr $ra
|
||||
addiu $gp, %lo(_gp)
|
||||
|
||||
#endif
|
||||
@@ -177,9 +177,15 @@ def main():
|
||||
# presence of the correct roms automatically
|
||||
|
||||
# Make sure tools exist
|
||||
subprocess.check_call(
|
||||
["make", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"]
|
||||
)
|
||||
tools = [ "n64graphics", "skyconv", "mio0", "aifc_decode" ]
|
||||
if os.name == 'nt':
|
||||
tools = [tool + ".exe" for tool in tools]
|
||||
make = "mingw32-make"
|
||||
else:
|
||||
make = "make"
|
||||
|
||||
cmd = [make, "-s", "-C", "tools/"] + tools
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
# Go through the assets in roughly alphabetical order (but assets in the same
|
||||
# mio0 file still go together).
|
||||
|
||||
28
fast64.json
Normal file
28
fast64.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"version": 1.0,
|
||||
"autoLoad": true,
|
||||
"microcode": "F3DEX2/LX2",
|
||||
"rdpDefaults": {
|
||||
"geometryMode": {
|
||||
"zBuffer": true,
|
||||
"shade": true,
|
||||
"cullBack": true,
|
||||
"lighting": true,
|
||||
"shadeSmooth": true
|
||||
},
|
||||
"otherModeH": {
|
||||
"textureConvert": "G_TC_FILT",
|
||||
"textureFilter": "G_TF_BILERP",
|
||||
"perspectiveCorrection": "G_TP_PERSP",
|
||||
"pipelineMode": "G_PM_1PRIMITIVE"
|
||||
},
|
||||
"otherModeL": {},
|
||||
"other": {}
|
||||
},
|
||||
"sm64": {
|
||||
"refresh_version": "HackerSM64 2.3.0",
|
||||
"compression_format": "yay0",
|
||||
"force_extended_ram": false,
|
||||
"matstack_fix": true
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,17 @@
|
||||
#define ALIGNED64
|
||||
#endif
|
||||
|
||||
// Assign to a section type.
|
||||
#if defined(SDATA) && defined(__GNUC__)
|
||||
#define SECTION(x) __attribute__((section(x)))
|
||||
#define SECTION_BSS SECTION(".bss")
|
||||
#define SECTION_DATA SECTION(".data")
|
||||
#else
|
||||
#define SECTION(x)
|
||||
#define SECTION_BSS
|
||||
#define SECTION_DATA
|
||||
#endif
|
||||
|
||||
#ifndef ALIGN
|
||||
#define ALIGN(VAL_, ALIGNMENT_) (((VAL_) + ((ALIGNMENT_) - 1)) & ~((ALIGNMENT_) - 1))
|
||||
#endif
|
||||
|
||||
@@ -81,6 +81,20 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(SDATA) && defined(__GNUC__)
|
||||
extern __attribute__((section(".data"))) s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */
|
||||
extern __attribute__((section(".data"))) void *osRomBase; /* Rom base address of the game image */
|
||||
extern __attribute__((section(".data"))) s32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */
|
||||
extern __attribute__((section(".data"))) s32 osResetType; /* 0 = cold reset, 1 = NMI */
|
||||
extern __attribute__((section(".data"))) s32 osCicId;
|
||||
extern __attribute__((section(".data"))) s32 osVersion;
|
||||
extern __attribute__((section(".data"))) u32 osMemSize; /* Memory Size */
|
||||
extern s32 osAppNMIBuffer[];
|
||||
|
||||
extern __attribute__((section(".data"))) u64 osClockRate;
|
||||
|
||||
extern __attribute__((section(".data"))) OSIntMask __OSGlobalIntMask; /* global interrupt mask */
|
||||
#else
|
||||
extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */
|
||||
extern void *osRomBase; /* Rom base address of the game image */
|
||||
extern s32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */
|
||||
@@ -93,6 +107,7 @@ extern s32 osAppNMIBuffer[];
|
||||
extern u64 osClockRate;
|
||||
|
||||
extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
@@ -53,10 +53,13 @@ DECLARE_SEGMENT(assets)
|
||||
extern u8 _goddardSegmentStart[];
|
||||
extern u8 _goddardSegmentEnd[];
|
||||
extern u8 _engineSegmentStart[];
|
||||
extern u8 _engineSegmentEnd[];
|
||||
extern u8 _engineSegmentBssStart[];
|
||||
extern u8 _engineSegmentBssEnd[];
|
||||
extern u8 _mainSegmentStart[];
|
||||
extern u8 _mainSegmentEnd[];
|
||||
extern u8 _engineSegmentEnd[];
|
||||
extern u8 _mainSegmentBssStart[];
|
||||
extern u8 _mainSegmentBssEnd[];
|
||||
extern u8 _framebuffersSegmentBssStart[];
|
||||
extern u8 _framebuffersSegmentBssEnd[];
|
||||
extern u8 _zbufferSegmentBssStart[];
|
||||
@@ -64,6 +67,16 @@ extern u8 _zbufferSegmentBssEnd[];
|
||||
extern u8 _buffersSegmentBssStart[];
|
||||
extern u8 _buffersSegmentBssEnd[];
|
||||
|
||||
#ifdef SDATA
|
||||
extern u8 _sbssSegmentBssStart[];
|
||||
extern u8 _sbssSegmentBssEnd[];
|
||||
extern u8 _sdataSegmentStart[];
|
||||
extern u8 _sdataSegmentEnd[];
|
||||
extern u8 _sdataSegmentRomStart[];
|
||||
extern u8 _sdataSegmentRomEnd[];
|
||||
extern u8 _gp[];
|
||||
#endif
|
||||
|
||||
DECLARE_LEVEL_SEGMENT(menu)
|
||||
DECLARE_LEVEL_SEGMENT(intro)
|
||||
DECLARE_LEVEL_SEGMENT(ending)
|
||||
|
||||
@@ -36,15 +36,27 @@ enum SoundBank {
|
||||
SOUND_BANK_MENU,
|
||||
SOUND_BANK_GENERAL2,
|
||||
SOUND_BANK_OBJ2,
|
||||
SOUND_BANK_CUSTOM_FOREGROUND_1,
|
||||
SOUND_BANK_CUSTOM_FOREGROUND_2,
|
||||
SOUND_BANK_CUSTOM_FOREGROUND_3,
|
||||
SOUND_BANK_CUSTOM_BACKGROUND_1,
|
||||
SOUND_BANK_CUSTOM_BACKGROUND_2,
|
||||
SOUND_BANK_CUSTOM_BACKGROUND_3,
|
||||
|
||||
SOUND_BANK_COUNT
|
||||
};
|
||||
|
||||
#define SOUND_BANKS_ALL_BITS 0xffff
|
||||
#define SOUND_BANKS_ALL ((1 << SOUND_BANK_COUNT) - 1)
|
||||
|
||||
#define SOUND_BANKS_FOREGROUND (\
|
||||
(1 << SOUND_BANK_ACTION) |\
|
||||
(1 << SOUND_BANK_VOICE) |\
|
||||
(1 << SOUND_BANK_MENU))
|
||||
(1 << SOUND_BANK_MENU) |\
|
||||
(1 << SOUND_BANK_CUSTOM_FOREGROUND_1) |\
|
||||
(1 << SOUND_BANK_CUSTOM_FOREGROUND_2) |\
|
||||
(1 << SOUND_BANK_CUSTOM_FOREGROUND_3))
|
||||
|
||||
#define SOUND_BANKS_BACKGROUND (SOUND_BANKS_ALL & ~SOUND_BANKS_FOREGROUND)
|
||||
#define SOUND_BANKS_DISABLED_DURING_INTRO_CUTSCENE (\
|
||||
(1 << SOUND_BANK_ENV) |\
|
||||
@@ -589,4 +601,6 @@ enum SoundBank {
|
||||
#define SOUND_OBJ2_BOSS_DIALOG_GRUNT /* 0x90694081 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x69, 0x40, SOUND_DISCRETE)
|
||||
#define SOUND_OBJ2_MRI_SPINNING /* 0x906B0081 */ SOUND_ARG_LOAD(SOUND_BANK_OBJ2, 0x6B, 0x00, SOUND_DISCRETE)
|
||||
|
||||
// Add defines for sounds using extra custom banks here!
|
||||
|
||||
#endif // SOUNDS_H
|
||||
|
||||
78
sm64.ld
78
sm64.ld
@@ -53,10 +53,10 @@ OUTPUT_ARCH (mips)
|
||||
END_SEG(name##_segment_7) \
|
||||
BEGIN_SEG(name, 0x0E000000) \
|
||||
{ \
|
||||
KEEP(BUILD_DIR/levels/name/script.o(.*data*)); \
|
||||
KEEP(BUILD_DIR/levels/name/script.o(.data*)); \
|
||||
KEEP(BUILD_DIR/levels/name/script.o(.text*)); \
|
||||
KEEP(BUILD_DIR/levels/name/script.o(.rodata*)); \
|
||||
KEEP(BUILD_DIR/levels/name/geo.o(.*data*)); \
|
||||
KEEP(BUILD_DIR/levels/name/geo.o(.data*)); \
|
||||
KEEP(BUILD_DIR/levels/name/geo.o(.text*)); \
|
||||
KEEP(BUILD_DIR/levels/name/geo.o(.rodata*)); \
|
||||
} \
|
||||
@@ -77,7 +77,7 @@ OUTPUT_ARCH (mips)
|
||||
END_SEG(name##_yay0) \
|
||||
BEGIN_SEG(name##_geo, geoAddr) \
|
||||
{ \
|
||||
KEEP(BUILD_DIR/actors/name##_geo.o(.*data*)); \
|
||||
KEEP(BUILD_DIR/actors/name##_geo.o(.data*)); \
|
||||
KEEP(BUILD_DIR/actors/name##_geo.o(.rodata*)); \
|
||||
KEEP(BUILD_DIR/actors/name##_geo.o(.text*)); \
|
||||
} \
|
||||
@@ -157,6 +157,7 @@ SECTIONS
|
||||
{
|
||||
KEEP(BUILD_DIR/asm/entry.o(.text*));
|
||||
KEEP(BUILD_DIR/asm/n64_assert.o(.text*));
|
||||
KEEP(BUILD_DIR/asm/setgp.o(.text*));
|
||||
#ifdef EEP
|
||||
KEEP(BUILD_DIR/asm/vc_bin.o(.text*));
|
||||
#endif
|
||||
@@ -175,9 +176,9 @@ SECTIONS
|
||||
#ifdef LIBPL
|
||||
BUILD_DIR/lib/libpl*.o(.text*);
|
||||
#endif
|
||||
*/ULTRALIB.a:*.o(.text*);
|
||||
*ULTRALIB.a:*.o(.text*);
|
||||
*/libnustd.a:*.o(.text*);
|
||||
*/libgcc.a:*.o(.text*);
|
||||
*libgcc.a:*.o(.text*);
|
||||
*/libz.a:*.o(.text*);
|
||||
*/libhvqm2.a:*.o(.text*);
|
||||
lib/rspboot.o(.text*);
|
||||
@@ -188,16 +189,16 @@ SECTIONS
|
||||
_mainSegmentTextEnd = .;
|
||||
|
||||
/* data */
|
||||
BUILD_DIR/asm/n64_assert.o(.*data*);
|
||||
BUILD_DIR/src/boot*.o(.*data*);
|
||||
BUILD_DIR/src/audio*.o(.*data*);
|
||||
BUILD_DIR/asm/n64_assert.o(.data*);
|
||||
BUILD_DIR/src/boot*.o(.data*);
|
||||
BUILD_DIR/src/audio*.o(.data*);
|
||||
#ifdef S2DEX_TEXT_ENGINE
|
||||
BUILD_DIR/src/s2d_engine*.o(.*data*);
|
||||
BUILD_DIR/src/s2d_engine*.o(.data*);
|
||||
#endif
|
||||
#ifdef LIBPL
|
||||
BUILD_DIR/lib/libpl*.o(.*data*);
|
||||
BUILD_DIR/lib/libpl*.o(.data*);
|
||||
#endif
|
||||
*/ULTRALIB.a:*.o(.data*);
|
||||
*ULTRALIB.a:*.o(.data*);
|
||||
*/libhvqm2.a:*.o(.data*);
|
||||
*/libz.a:*.o(.data*);
|
||||
#include "rspdata.inc.ld"
|
||||
@@ -215,8 +216,8 @@ SECTIONS
|
||||
#ifdef LIBPL
|
||||
BUILD_DIR/lib/libpl*.o(.rodata*);
|
||||
#endif
|
||||
*/ULTRALIB.a:*.o(.rodata*);
|
||||
*/libgcc.a:*.o(.rodata*);
|
||||
*ULTRALIB.a:*.o(.rodata*);
|
||||
*libgcc.a:*.o(.rodata*);
|
||||
*/libz.a:*.o(.rodata*);
|
||||
|
||||
lib/PR/hvqm/hvqm2sp1.o(.rodata*);
|
||||
@@ -224,19 +225,19 @@ SECTIONS
|
||||
END_SEG(main)
|
||||
BEGIN_NOLOAD(main)
|
||||
{
|
||||
BUILD_DIR/src/boot*.o(.*bss*);
|
||||
BUILD_DIR/src/hvqm*.o(.*bss*);
|
||||
BUILD_DIR/src/usb*.o(.*bss*);
|
||||
BUILD_DIR/src/audio*.o(.*bss*);
|
||||
BUILD_DIR/src/boot*.o(.bss*);
|
||||
BUILD_DIR/src/hvqm*.o(.bss*);
|
||||
BUILD_DIR/src/usb*.o(.bss*);
|
||||
BUILD_DIR/src/audio*.o(.bss*);
|
||||
#ifdef S2DEX_TEXT_ENGINE
|
||||
BUILD_DIR/src/s2d_engine*.o(.*bss*);
|
||||
BUILD_DIR/src/s2d_engine*.o(.bss*);
|
||||
#endif
|
||||
#ifdef LIBPL
|
||||
BUILD_DIR/lib/libpl*.o(.*bss*);
|
||||
BUILD_DIR/lib/libpl*.o(.bss*);
|
||||
#endif
|
||||
*/ULTRALIB.a:*.o(COMMON);
|
||||
*/ULTRALIB.a:*.o(.scommon);
|
||||
*/ULTRALIB.a:*.o(.*bss*);
|
||||
*ULTRALIB.a:*.o(COMMON);
|
||||
*ULTRALIB.a:*.o(.scommon);
|
||||
*ULTRALIB.a:*.o(.bss*);
|
||||
*/libhvqm2.a:*.o(.bss*);
|
||||
*/libz.a:*.o(.bss*);
|
||||
. = ALIGN(0x8);
|
||||
@@ -263,10 +264,6 @@ SECTIONS
|
||||
BUILD_DIR/src/game*.o(.data*);
|
||||
BUILD_DIR/src/engine*.o(.data*);
|
||||
BUILD_DIR/src/usb*.o(.data*);
|
||||
/* sdata */
|
||||
BUILD_DIR/src/game*.o(.sdata*);
|
||||
BUILD_DIR/src/engine*.o(.sdata*);
|
||||
BUILD_DIR/src/usb*.o(.data*);
|
||||
/* rodata */
|
||||
BUILD_DIR/src/game*.o(.rodata*);
|
||||
BUILD_DIR/src/engine*.o(.rodata*);
|
||||
@@ -276,13 +273,36 @@ SECTIONS
|
||||
END_SEG(engine)
|
||||
BEGIN_NOLOAD(engine)
|
||||
{
|
||||
BUILD_DIR/src/game*.o(.*bss*);
|
||||
BUILD_DIR/src/game*.o(.bss*);
|
||||
BUILD_DIR/src/engine*.o(.bss*);
|
||||
. = ALIGN(0x40);
|
||||
}
|
||||
END_NOLOAD(engine)
|
||||
|
||||
. = _engineSegmentBssEnd;
|
||||
#ifdef SDATA
|
||||
_gp = . + 0x8000;
|
||||
BEGIN_SEG(sdata, .)
|
||||
{
|
||||
BUILD_DIR/src/game*.o(.sdata*);
|
||||
BUILD_DIR/src/audio*.o(.sdata*);
|
||||
BUILD_DIR/src/engine*.o(.sdata*);
|
||||
BUILD_DIR/src/usb*.o(.sdata*);
|
||||
BUILD_DIR/src/menu*.o(.sdata*);
|
||||
. = ALIGN(0x10);
|
||||
}
|
||||
END_SEG(sdata)
|
||||
BEGIN_NOLOAD(sbss)
|
||||
{
|
||||
BUILD_DIR/src/game*.o(.sbss*);
|
||||
BUILD_DIR/src/audio*.o(.sbss*);
|
||||
BUILD_DIR/src/engine*.o(.sbss*);
|
||||
BUILD_DIR/src/usb*.o(.sbss*);
|
||||
BUILD_DIR/src/menu*.o(.sbss*);
|
||||
. = ALIGN(0x40);
|
||||
}
|
||||
END_NOLOAD(sbss)
|
||||
#endif
|
||||
|
||||
BEGIN_NOLOAD(framebuffers)
|
||||
{
|
||||
BUILD_DIR/src/buffers/framebuffers.o(.bss*);
|
||||
@@ -409,7 +429,7 @@ SECTIONS
|
||||
/* 0x268020 0x268020-0 [0] */
|
||||
BEGIN_SEG(intro, 0x14000000)
|
||||
{
|
||||
KEEP(BUILD_DIR/levels/intro/script.o(.*data));
|
||||
KEEP(BUILD_DIR/levels/intro/script.o(.data*));
|
||||
KEEP(BUILD_DIR/levels/intro/script.o(.rodata*));
|
||||
KEEP(BUILD_DIR/levels/intro/script.o(.text*));
|
||||
KEEP(BUILD_DIR/levels/intro/geo.o(.data*));
|
||||
|
||||
@@ -12,7 +12,7 @@ seq_setmutescale 0
|
||||
seq_setvol 127
|
||||
#endif
|
||||
seq_settempo 120
|
||||
seq_initchannels 0x3ff
|
||||
seq_initchannels 0xffff
|
||||
seq_startchannel 0, .channel0
|
||||
seq_startchannel 1, .channel1
|
||||
seq_startchannel 2, .channel2
|
||||
@@ -23,6 +23,12 @@ seq_startchannel 6, .channel6
|
||||
seq_startchannel 7, .channel7
|
||||
seq_startchannel 8, .channel38
|
||||
seq_startchannel 9, .channel59
|
||||
seq_startchannel 10, .channelA
|
||||
seq_startchannel 11, .channelB
|
||||
seq_startchannel 12, .channelC
|
||||
seq_startchannel 13, .channelD
|
||||
seq_startchannel 14, .channelE
|
||||
seq_startchannel 15, .channelF
|
||||
.seq_loop:
|
||||
seq_delay 20000
|
||||
seq_jump .seq_loop
|
||||
@@ -71,6 +77,72 @@ chan_stereoheadseteffects 1
|
||||
chan_setdyntable .channel59_table
|
||||
chan_jump .main_loop_023589
|
||||
|
||||
.channelA:
|
||||
chan_largenoteson
|
||||
chan_setinstr 0
|
||||
chan_setpanmix 127
|
||||
chan_setnotepriority 14
|
||||
chan_setval 0
|
||||
chan_iowriteval 5
|
||||
chan_stereoheadseteffects 1
|
||||
chan_setdyntable .channelA_table
|
||||
chan_jump .main_loop_023589
|
||||
|
||||
.channelB:
|
||||
chan_largenoteson
|
||||
chan_setinstr 0
|
||||
chan_setpanmix 127
|
||||
chan_setnotepriority 14
|
||||
chan_setval 0
|
||||
chan_iowriteval 5
|
||||
chan_stereoheadseteffects 1
|
||||
chan_setdyntable .channelB_table
|
||||
chan_jump .main_loop_023589
|
||||
|
||||
.channelC:
|
||||
chan_largenoteson
|
||||
chan_setinstr 0
|
||||
chan_setpanmix 127
|
||||
chan_setnotepriority 14
|
||||
chan_setval 0
|
||||
chan_iowriteval 5
|
||||
chan_stereoheadseteffects 1
|
||||
chan_setdyntable .channelC_table
|
||||
chan_jump .main_loop_023589
|
||||
|
||||
.channelD:
|
||||
chan_largenoteson
|
||||
chan_setinstr 0
|
||||
chan_setpanmix 127
|
||||
chan_setnotepriority 14
|
||||
chan_setval 0
|
||||
chan_iowriteval 5
|
||||
chan_stereoheadseteffects 1
|
||||
chan_setdyntable .channelD_table
|
||||
chan_jump .main_loop_023589
|
||||
|
||||
.channelE:
|
||||
chan_largenoteson
|
||||
chan_setinstr 0
|
||||
chan_setpanmix 127
|
||||
chan_setnotepriority 14
|
||||
chan_setval 0
|
||||
chan_iowriteval 5
|
||||
chan_stereoheadseteffects 1
|
||||
chan_setdyntable .channelE_table
|
||||
chan_jump .main_loop_023589
|
||||
|
||||
.channelF:
|
||||
chan_largenoteson
|
||||
chan_setinstr 0
|
||||
chan_setpanmix 127
|
||||
chan_setnotepriority 14
|
||||
chan_setval 0
|
||||
chan_iowriteval 5
|
||||
chan_stereoheadseteffects 1
|
||||
chan_setdyntable .channelF_table
|
||||
chan_jump .main_loop_023589
|
||||
|
||||
// Main loop for standard, non-continuous sound effects
|
||||
.main_loop_023589:
|
||||
chan_hang
|
||||
@@ -7903,6 +7975,31 @@ layer_note0 38, 0x3, 127, 127
|
||||
layer_delay 0x2a
|
||||
layer_jump .layer_32B7
|
||||
|
||||
|
||||
.channelA_table:
|
||||
// Add custom sounds for Channel A here!
|
||||
|
||||
|
||||
.channelB_table:
|
||||
// Add custom sounds for Channel B here!
|
||||
|
||||
|
||||
.channelC_table:
|
||||
// Add custom sounds for Channel C here!
|
||||
|
||||
|
||||
.channelD_table:
|
||||
// Add custom sounds for Channel D here!
|
||||
|
||||
|
||||
.channelE_table:
|
||||
// Add custom sounds for Channel E here!
|
||||
|
||||
|
||||
.channelF_table:
|
||||
// Add custom sounds for Channel F here!
|
||||
|
||||
|
||||
.align 2, 0
|
||||
.envelope_32C4:
|
||||
envelope_line 7 20000
|
||||
|
||||
@@ -313,10 +313,10 @@ STATIC_ASSERT(ARRAY_COUNT(sBackgroundMusicDefaultVolume) == SEQ_COUNT,
|
||||
|
||||
u8 sCurrentBackgroundMusicSeqId = SEQUENCE_NONE;
|
||||
u8 sMusicDynamicDelay = 0;
|
||||
u8 sSoundBankUsedListBack[SOUND_BANK_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
u8 sSoundBankFreeListFront[SOUND_BANK_COUNT] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||
u8 sNumSoundsInBank[SOUND_BANK_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // only used for debugging
|
||||
u8 sMaxChannelsForSoundBank[SOUND_BANK_COUNT] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||
u8 sSoundBankUsedListBack[SOUND_BANK_COUNT] = {[0 ... SOUND_BANK_COUNT-1] = 0};
|
||||
u8 sSoundBankFreeListFront[SOUND_BANK_COUNT] = {[0 ... SOUND_BANK_COUNT-1] = 1};
|
||||
u8 sNumSoundsInBank[SOUND_BANK_COUNT] = {[0 ... SOUND_BANK_COUNT-1] = 0}; // only used for debugging
|
||||
u8 sMaxChannelsForSoundBank[SOUND_BANK_COUNT] = {[0 ... SOUND_BANK_COUNT-1] = 1};
|
||||
|
||||
// sBackgroundMusicMaxTargetVolume and sBackgroundMusicTargetVolume use the 0x80
|
||||
// bit to indicate that they are set, and the rest of the bits for the actual value
|
||||
@@ -347,8 +347,7 @@ struct UnkStruct80343D00 D_SH_80343D00;
|
||||
#endif
|
||||
|
||||
struct Sound sSoundRequests[0x100];
|
||||
// Curiously, this has size 3, despite SEQUENCE_PLAYERS == 4 on EU
|
||||
struct ChannelVolumeScaleFade D_80360928[3][CHANNELS_MAX];
|
||||
struct ChannelVolumeScaleFade D_80360928[SEQUENCE_PLAYERS][CHANNELS_MAX];
|
||||
u8 sUsedChannelsForSoundBank[SOUND_BANK_COUNT];
|
||||
u8 sCurrentSound[SOUND_BANK_COUNT][MAX_CHANNELS_PER_SOUND_BANK]; // index into sSoundBanks
|
||||
|
||||
@@ -1341,12 +1340,7 @@ static void update_game_sound(void) {
|
||||
get_sound_reverb(bank, soundIndex, channelIndex);
|
||||
#endif
|
||||
break;
|
||||
case SOUND_BANK_GENERAL:
|
||||
case SOUND_BANK_ENV:
|
||||
case SOUND_BANK_OBJ:
|
||||
case SOUND_BANK_AIR:
|
||||
case SOUND_BANK_GENERAL2:
|
||||
case SOUND_BANK_OBJ2:
|
||||
default:
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
@@ -1507,12 +1501,7 @@ static void update_game_sound(void) {
|
||||
get_sound_reverb(bank, soundIndex, channelIndex);
|
||||
#endif
|
||||
break;
|
||||
case SOUND_BANK_GENERAL:
|
||||
case SOUND_BANK_ENV:
|
||||
case SOUND_BANK_OBJ:
|
||||
case SOUND_BANK_AIR:
|
||||
case SOUND_BANK_GENERAL2:
|
||||
case SOUND_BANK_OBJ2:
|
||||
default:
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
@@ -1952,7 +1941,7 @@ void sound_init(void) {
|
||||
|
||||
for (i = 0; i < SOUND_BANK_COUNT; i++) {
|
||||
// Set each sound in the bank to STOPPED
|
||||
for (j = 0; j < 40; j++) {
|
||||
for (j = 0; j < ARRAY_COUNT(sSoundBanks[0]); j++) {
|
||||
sSoundBanks[i][j].soundStatus = SOUND_STATUS_STOPPED;
|
||||
}
|
||||
|
||||
@@ -1972,7 +1961,7 @@ void sound_init(void) {
|
||||
sSoundBanks[i][0].next = 0xff;
|
||||
|
||||
// Set free list to contain every sound slot
|
||||
for (j = 1; j < 40 - 1; j++) {
|
||||
for (j = 1; j < ARRAY_COUNT(sSoundBanks[0]) - 1; j++) {
|
||||
sSoundBanks[i][j].prev = j - 1;
|
||||
sSoundBanks[i][j].next = j + 1;
|
||||
}
|
||||
@@ -1980,7 +1969,7 @@ void sound_init(void) {
|
||||
sSoundBanks[i][j].next = 0xff;
|
||||
}
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (j = 0; j < SEQUENCE_PLAYERS; j++) {
|
||||
for (i = 0; i < CHANNELS_MAX; i++) {
|
||||
D_80360928[j][i].remainingFrames = 0;
|
||||
}
|
||||
|
||||
@@ -342,11 +342,18 @@ void check_stack_validity(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SDATA
|
||||
extern void load_sdata(void);
|
||||
#else
|
||||
#define load_sdata()
|
||||
#endif
|
||||
extern void crash_screen_init(void);
|
||||
extern OSViMode VI;
|
||||
|
||||
void thread3_main(UNUSED void *arg) {
|
||||
setgp();
|
||||
setup_mesg_queues();
|
||||
load_sdata();
|
||||
alloc_pool();
|
||||
load_engine_code_segment();
|
||||
detect_emulator();
|
||||
@@ -504,6 +511,8 @@ void change_vi(OSViMode *mode, int width, int height) {
|
||||
}
|
||||
|
||||
void get_audio_frequency(void) {
|
||||
gConfig.audioFrequency = 1.0f;
|
||||
|
||||
switch (gConfig.tvType) {
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
case MODE_NTSC: gConfig.audioFrequency = 1.0f; break;
|
||||
@@ -521,6 +530,7 @@ void get_audio_frequency(void) {
|
||||
* Initialize hardware, start main thread, then idle.
|
||||
*/
|
||||
void thread1_idle(UNUSED void *arg) {
|
||||
setgp();
|
||||
osCreateViManager(OS_PRIORITY_VIMGR);
|
||||
switch (osTvType) {
|
||||
case OS_TV_NTSC:
|
||||
@@ -579,6 +589,7 @@ void osInitialize_fakeisv() {
|
||||
#endif
|
||||
|
||||
void main_func(void) {
|
||||
setgp();
|
||||
ClearRAM();
|
||||
__osInitialize_common();
|
||||
#ifdef ISVPRINT
|
||||
|
||||
@@ -421,6 +421,23 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
#ifdef SDATA
|
||||
extern u8 _gp[];
|
||||
extern u8 _sdataSegmentStart[];
|
||||
extern u8 _sdataSegmentEnd[];
|
||||
extern u8 _sdataSegmentRomStart[];
|
||||
extern u8 _sdataSegmentRomEnd[];
|
||||
void load_sdata(void) {
|
||||
void *startAddr = (void *) _sdataSegmentStart;
|
||||
u32 totalSize = _sdataSegmentEnd - _sdataSegmentStart;
|
||||
|
||||
bzero(startAddr, totalSize);
|
||||
osWritebackDCacheAll();
|
||||
dma_read(startAddr, _sdataSegmentRomStart, _sdataSegmentRomEnd);
|
||||
osInvalDCache(startAddr, totalSize);
|
||||
}
|
||||
#endif
|
||||
|
||||
void load_engine_code_segment(void) {
|
||||
void *startAddr = (void *) _engineSegmentStart;
|
||||
u32 totalSize = _engineSegmentEnd - _engineSegmentStart;
|
||||
|
||||
@@ -334,8 +334,8 @@ static void level_cmd_init_level(void) {
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
extern s32 gTlbEntries;
|
||||
extern u8 gTlbSegments[NUM_TLB_SEGMENTS];
|
||||
extern SECTION_DATA s32 gTlbEntries;
|
||||
extern SECTION_DATA u8 gTlbSegments[NUM_TLB_SEGMENTS];
|
||||
|
||||
// This clears all the temporary bank TLB maps. group0, common1 and behavourdata are always loaded,
|
||||
// and they're also loaded first, so that means we just leave the first 3 indexes mapped.
|
||||
|
||||
@@ -87,30 +87,6 @@ static struct Surface *alloc_surface(u32 dynamic) {
|
||||
return surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates through the entire partition, clearing the surfaces.
|
||||
*/
|
||||
static void clear_spatial_partition(SpatialPartitionCell *cells) {
|
||||
register s32 i = sqr(NUM_CELLS);
|
||||
|
||||
while (i--) {
|
||||
(*cells)[SPATIAL_PARTITION_FLOORS] = NULL;
|
||||
(*cells)[SPATIAL_PARTITION_CEILS] = NULL;
|
||||
(*cells)[SPATIAL_PARTITION_WALLS] = NULL;
|
||||
(*cells)[SPATIAL_PARTITION_WATER] = NULL;
|
||||
|
||||
cells++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the static (level) surface partitions for new use.
|
||||
*/
|
||||
static void clear_static_surfaces(void) {
|
||||
gTotalStaticSurfaceData = 0;
|
||||
clear_spatial_partition(&gStaticSurfacePartition[0][0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a surface to the correct cell list of surfaces.
|
||||
* @param dynamic Determines whether the surface is static or dynamic
|
||||
@@ -164,6 +140,14 @@ static void add_surface_to_cell(s32 dynamic, s32 cellX, s32 cellZ, struct Surfac
|
||||
|
||||
struct SurfaceNode *curNode = *list;
|
||||
|
||||
// Check if surface should be placed at the beginning of the list.
|
||||
priority = curNode->surface->upperY * sortDir;
|
||||
if (surfacePriority > priority) {
|
||||
*list = newNode;
|
||||
newNode->next = curNode;
|
||||
return;
|
||||
}
|
||||
|
||||
// Loop until we find the appropriate place for the surface in the list.
|
||||
while (curNode->next != NULL) {
|
||||
priority = curNode->next->surface->upperY * sortDir;
|
||||
@@ -504,7 +488,9 @@ void load_area_terrain(s32 index, TerrainData *data, RoomData *surfaceRooms, s16
|
||||
sNumCellsUsed = 0;
|
||||
sClearAllCells = TRUE;
|
||||
|
||||
clear_static_surfaces();
|
||||
// Clear the static (level) surface partitions for new use.
|
||||
bzero(gStaticSurfacePartition, sizeof(gStaticSurfacePartition));
|
||||
gTotalStaticSurfaceData = 0;
|
||||
|
||||
// Initialise a new surface pool for this block of static surface data
|
||||
gCurrStaticSurfacePool = main_pool_alloc(main_pool_available() - 0x10, MEMORY_POOL_LEFT);
|
||||
@@ -567,7 +553,7 @@ void clear_dynamic_surfaces(void) {
|
||||
gSurfaceNodesAllocated = gNumStaticSurfaceNodes;
|
||||
gDynamicSurfacePoolEnd = gDynamicSurfacePool;
|
||||
if (sClearAllCells) {
|
||||
clear_spatial_partition(&gDynamicSurfacePartition[0][0]);
|
||||
bzero(gDynamicSurfacePartition, sizeof(gDynamicSurfacePartition));
|
||||
} else {
|
||||
for (u32 i = 0; i < sNumCellsUsed; i++) {
|
||||
gDynamicSurfacePartition[sCellsUsed[i].z][sCellsUsed[i].x][sCellsUsed[i].partition] = NULL;
|
||||
|
||||
@@ -237,6 +237,10 @@ void load_area(s32 index) {
|
||||
|
||||
gMarioCurrentRoom = 0;
|
||||
|
||||
if (gCurrentArea->surfaceRooms != NULL) {
|
||||
bzero(gDoorAdjacentRooms, sizeof(gDoorAdjacentRooms));
|
||||
}
|
||||
|
||||
if (gCurrentArea->terrainData != NULL) {
|
||||
load_area_terrain(index, gCurrentArea->terrainData, gCurrentArea->surfaceRooms,
|
||||
gCurrentArea->macroObjects);
|
||||
|
||||
@@ -402,6 +402,7 @@ extern struct SequenceQueueItem sBackgroundMusicQueue[6];
|
||||
void thread2_crash_screen(UNUSED void *arg) {
|
||||
OSMesg mesg;
|
||||
OSThread *thread = NULL;
|
||||
setgp();
|
||||
|
||||
osSetEventMesg(OS_EVENT_CPU_BREAK, &gCrashScreen.mesgQueue, (OSMesg) 1);
|
||||
osSetEventMesg(OS_EVENT_FAULT, &gCrashScreen.mesgQueue, (OSMesg) 2);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user