Compare commits

...

13 Commits

Author SHA1 Message Date
Gregory Heskett
8676898ae9 Implement sdata 2024-11-02 22:59:04 -04:00
Lila
c4c18b3d0e Check for opensuse's cross mips gcc package (#842)
Makes it possible to rely on the official repo.
Ideally the following instructions would also be added to the wiki for opensuse:
```
sudo zypper install cross-mips-binutils git capstone pkgconf python311 cross-mips-gcc14
# install packages under devel_basis, equivalent to build-essential in deb
sudo zypper install --type pattern devel_basis
```
2024-10-31 14:08:08 -04:00
thecozies
7298e94a1f reset adjacent rooms when loading a new area (#704) 2024-09-05 01:48:26 -04:00
Gregory Heskett
27d328f86a Dialogs in dialogs.h no longer have to be in order (#832) 2024-09-05 01:13:05 -04:00
Gregory Heskett
27372fe74a Merge pull request #795 from gheskett/develop/2.3.0_update-unf
Update to newest UNF (d5f2ad100b76e372036453f8d25f9b6fbbbd2d1a) (November 22, 2023)
2024-09-05 01:07:23 -04:00
Reonu
3f1f7f41be Add Arthurtilly to the CODEOWNERS file (#821)
* Add Arthurtilly to the CODEOWNERS file

* Update CODEOWNERS file to list each global owner on the same line

This should (allegedly) fix the issues of only the last entry being treated as an owner for reviews.

* Remove thecozies from CODEOWNERS file :(

---------

Co-authored-by: Gregory Heskett <gheskett@gmail.com>
2024-09-04 23:24:02 -04:00
Denis Kopyrin
bf70500b4d Merge pull request #825 from Lilaa3/fast64-repo-settings
Add Fast64 repo settings file (fast64.json)
2024-09-05 07:51:25 +08:00
Lila
27fedee76f Update fast64.json 2024-09-04 10:38:21 +01:00
Lila
a918785a92 Aglab requested change 2024-08-25 19:26:57 +01:00
Lila
10720ea056 Fall back on fast64 default draw layers 2024-08-24 13:05:36 +01:00
Lila
8dc47095e2 Add repo settings file
Allows fast64 to know a repo's ideal settings as soon as decomp path is picked.
Settings are the default except for:
Matstack is on
Microcode is set to EX2
Force Extended RAM is off because hackersm64 already has it enabled by default
Refresh is set to Refresh 13
2024-08-19 15:44:53 +01:00
Gregory Heskett
e3472e05cf Add option for .local/share/HackerSM64/UNFLoader-dir.txt
This allows referencing a custom UNFLoader path to be used, ideally for placing on the C drive for WSL instances. UNFLoader tends to hang for an unbearably long time when saved somewhere within the WSL directory structure, and simply using the Linux build isn't an option because it can't access Windows USB devices trivially.
2024-08-03 19:57:50 -04:00
Gregory Heskett
74cb8ce062 Update to newest UNF (d5f2ad100b76e372036453f8d25f9b6fbbbd2d1a) (November 22 2023) 2024-08-03 19:33:09 -04:00
37 changed files with 1667 additions and 365 deletions

View File

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

View File

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

View File

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

18
asm/setgp.s Normal file
View 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

28
fast64.json Normal file
View 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
}
}

View File

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

View File

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

View File

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

64
sm64.ld
View File

@@ -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
@@ -188,14 +189,14 @@ 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*);
*/libhvqm2.a:*.o(.data*);
@@ -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(.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*));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -40,9 +40,9 @@ void try_print_debug_mario_level_info(void);
#define try_print_debug_mario_level_info()
#endif
extern char *__n64Assert_Filename;
extern u32 __n64Assert_LineNum;
extern char *__n64Assert_Message;
extern SECTION_DATA char *__n64Assert_Filename;
extern SECTION_DATA u32 __n64Assert_LineNum;
extern SECTION_DATA char *__n64Assert_Message;
extern void __n64Assert(char *fileName, u32 lineNum, char *message);
/**

View File

@@ -14,9 +14,9 @@
#include "lib/libpl/libpl-emu.h"
#endif
extern OSMesgQueue gSIEventMesgQueue;
extern u8 __osContPifRam[];
extern u8 __osContLastCmd;
extern SECTION_DATA OSMesgQueue gSIEventMesgQueue;
extern SECTION_DATA u8 __osContPifRam[];
extern SECTION_DATA u8 __osContLastCmd;
extern void __osSiGetAccess(void);
extern void __osSiRelAccess(void);
extern void __osPiGetAccess(void);

View File

@@ -51,9 +51,9 @@ struct SnowFlakeVertex gSnowFlakeVertex1 = { -5, 5, 0 };
struct SnowFlakeVertex gSnowFlakeVertex2 = { -5, -5, 0 };
struct SnowFlakeVertex gSnowFlakeVertex3 = { 5, 5, 0 };
extern void *tiny_bubble_dl_0B006AB0;
extern void *tiny_bubble_dl_0B006A50;
extern void *tiny_bubble_dl_0B006CD8;
extern SECTION_DATA void *tiny_bubble_dl_0B006AB0;
extern SECTION_DATA void *tiny_bubble_dl_0B006A50;
extern SECTION_DATA void *tiny_bubble_dl_0B006CD8;
/**
* Initialize snow particles by allocating a buffer for storing their state

View File

@@ -762,6 +762,7 @@ void setup_game_memory(void) {
* Main game loop thread. Runs forever as long as the game continues.
*/
void thread5_game_loop(UNUSED void *arg) {
setgp();
setup_game_memory();
#if ENABLE_RUMBLE
init_rumble_pak_scheduler_queue();

View File

@@ -165,7 +165,7 @@ typedef struct
/* 0xC */ u8 l_trig;
/* 0xD */ u8 r_trig;
} __OSContGCNShortPollFormat;
extern u8 __osContLastCmd;
extern SECTION_DATA u8 __osContLastCmd;
u8 __osGamecubeRumbleEnabled[MAXCONTROLLERS];
typedef struct
@@ -370,9 +370,9 @@ static u16 __osTranslateGCNButtons(u16 input, s32 c_stick_x, s32 c_stick_y) {
extern s32 __osContinitialized;
extern OSPifRam __osContPifRam;
extern u8 __osContLastCmd;
extern u8 __osMaxControllers;
extern SECTION_DATA OSPifRam __osContPifRam;
extern SECTION_DATA u8 __osContLastCmd;
extern SECTION_DATA u8 __osMaxControllers;
extern u8 __osGamecubeRumbleEnabled[MAXCONTROLLERS];
extern OSTimer __osEepromTimer;

View File

@@ -28,7 +28,7 @@
*/
#define NUM_FLYING_CARPET_VERTICES 21
extern const s16 flying_carpet_static_vertex_data[NUM_FLYING_CARPET_VERTICES];
extern SECTION_DATA const s16 flying_carpet_static_vertex_data[NUM_FLYING_CARPET_VERTICES];
static s16 sCurAreaTimer = 1;
static s16 sPrevAreaTimer = 0;

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