Move most of the 'game' to engine segment to avoid 1MB limit

This commit is contained in:
aglab2
2021-08-24 21:28:30 +08:00
committed by CrashOveride95
parent 43e7eeb869
commit 46f64263ea
5 changed files with 28 additions and 24 deletions

View File

@@ -312,7 +312,7 @@ ACTOR_DIR := actors
LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h)))
# Directories containing source files
SRC_DIRS += src src/game src/engine src/audio src/menu src/buffers actors levels bin data assets asm lib sound
SRC_DIRS += src src/boot src/game src/engine src/audio src/menu src/buffers actors levels bin data assets asm lib sound
LIBZ_SRC_DIRS := src/libz
GODDARD_SRC_DIRS := src/goddard src/goddard/dynlists
BIN_DIRS := bin bin/$(VERSION)

View File

@@ -6,7 +6,7 @@ index f50b7622..124c7ec6 100644
$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h
+$(BUILD_DIR)/src/game/mem_error_screen.o: $(BUILD_DIR)/include/text_strings.h
+$(BUILD_DIR)/src/boot/mem_error_screen.o: $(BUILD_DIR)/include/text_strings.h
#==============================================================================#
@@ -137,14 +137,14 @@ index d41a91c8..7d047236 100644
struct LevelCommand *level_script_execute(struct LevelCommand *cmd);
diff --git a/src/game/main.c b/src/game/main.c
diff --git a/src/boot/main.c b/src/boot/main.c
index 1a9d9e7e..f4f7a9e5 100644
--- a/src/game/main.c
+++ b/src/game/main.c
--- a/src/boot/main.c
+++ b/src/boot/main.c
@@ -11,6 +11,7 @@
#include "segments.h"
#include "main.h"
#include "rumble_init.h"
#include "game/main.h"
#include "game/rumble_init.h"
+#include "mem_error_screen.h"
// Message IDs
@@ -172,11 +172,11 @@ index 1a9d9e7e..f4f7a9e5 100644
osStartThread(&gGameLoopThread);
while (TRUE) {
diff --git a/src/game/mem_error_screen.c b/src/game/mem_error_screen.c
diff --git a/src/boot/mem_error_screen.c b/src/boot/mem_error_screen.c
new file mode 100644
index 00000000..f432927c
--- /dev/null
+++ b/src/game/mem_error_screen.c
+++ b/src/boot/mem_error_screen.c
@@ -0,0 +1,104 @@
+/* clang-format off */
+/*

12
sm64.ld
View File

@@ -130,7 +130,7 @@ SECTIONS
{
KEEP(BUILD_DIR/asm/entry.o(.text));
BUILD_DIR/src/game*.o(.text);
BUILD_DIR/src/boot*.o(.text);
BUILD_DIR/src/hvqm*.o(.text);
BUILD_DIR/src/gdb*.o(.text);
BUILD_DIR/src/usb*.o(.text);
@@ -148,7 +148,7 @@ SECTIONS
lib/PR/hvqm/hvqm2sp1.o(.text);
/* data */
BUILD_DIR/src/game*.o(.*data*);
BUILD_DIR/src/boot*.o(.*data*);
BUILD_DIR/src/gdb*.o(.*data*);
BUILD_DIR/src/usb*.o(.*data*);
BUILD_DIR/src/audio*.o(.*data*);
@@ -164,7 +164,7 @@ SECTIONS
lib/PR/hvqm/hvqm2sp1.o(.data*);
/* rodata */
BUILD_DIR/src/game*.o(.rodata*);
BUILD_DIR/src/boot*.o(.rodata*);
BUILD_DIR/src/gdb*.o(.*rodata*);
BUILD_DIR/src/usb*.o(.rodata*);
BUILD_DIR/src/audio*.o(.rodata*);
@@ -182,7 +182,7 @@ SECTIONS
END_SEG(main)
BEGIN_NOLOAD(main)
{
BUILD_DIR/src/game*.o(.*bss*);
BUILD_DIR/src/boot*.o(.*bss*);
BUILD_DIR/src/hvqm*.o(.*bss*);
BUILD_DIR/src/gdb*.o(.*bss*);
BUILD_DIR/src/usb*.o(.*bss*);
@@ -208,16 +208,20 @@ SECTIONS
BEGIN_SEG(engine, .)
{
BUILD_DIR/src/game*.o(.text);
BUILD_DIR/src/engine*.o(.text);
/* data */
BUILD_DIR/src/game*.o(.*data*);
BUILD_DIR/src/engine*.o(.data*);
BUILD_DIR/src/engine*.o(.sdata*);
/* rodata */
BUILD_DIR/src/game*.o(.rodata*);
BUILD_DIR/src/engine*.o(.rodata*);
}
END_SEG(engine)
BEGIN_NOLOAD(engine)
{
BUILD_DIR/src/game*.o(.*bss*);
BUILD_DIR/src/engine*.o(.bss*);
. = ALIGN(0x40);
}

View File

@@ -5,15 +5,15 @@
#include "sm64.h"
#include "audio/external.h"
#include "game_init.h"
#include "memory.h"
#include "sound_init.h"
#include "profiler.h"
#include "game/game_init.h"
#include "game/memory.h"
#include "game/sound_init.h"
#include "game/profiler.h"
#include "buffers/buffers.h"
#include "segments.h"
#include "main.h"
#include "rumble_init.h"
#include "version.h"
#include "game/main.h"
#include "game/rumble_init.h"
#include "game/version.h"
#ifdef UNF
#include "usb/usb.h"
#include "usb/debug.h"

View File

@@ -5,10 +5,10 @@
#define INCLUDED_FROM_MEMORY_C
#include "buffers/buffers.h"
#include "slidec.h"
#include "game_init.h"
#include "main.h"
#include "memory.h"
#include "game/slidec.h"
#include "game/game_init.h"
#include "game/main.h"
#include "game/memory.h"
#include "segment_symbols.h"
#include "segments.h"
#ifdef GZIP