From 8db2c655c3009d4a6a7e1a042f8a98d03f4a4365 Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Wed, 20 Mar 2024 22:16:51 -0400 Subject: [PATCH] Modified how patch elf is linked to prevent address conflicts with vanilla symbols, update RT64 --- lib/rt64 | 2 +- patches/Makefile | 2 +- patches/patches.ld | 15 +++++++++++---- src/ui/ui_launcher.cpp | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/rt64 b/lib/rt64 index a14ada8..482b9c9 160000 --- a/lib/rt64 +++ b/lib/rt64 @@ -1 +1 @@ -Subproject commit a14ada8fd7c8a9c93c896ee594fbaca583c02d17 +Subproject commit 482b9c9e48e97627b374a997dc8e21116af712e7 diff --git a/patches/Makefile b/patches/Makefile index 4ebc2fe..f5b8e10 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -7,7 +7,7 @@ OBJCOPY := llvm-objcopy CFLAGS := -target mips -mips2 -mabi=32 -O2 -mno-abicalls -mno-odd-spreg -fomit-frame-pointer -ffast-math -fno-unsafe-math-optimizations -mno-check-zero-division -G0 -Wall -Wextra -Wno-incompatible-library-redeclaration -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-variable -Wno-missing-braces -Wno-unsupported-floating-point-opt CPPFLAGS := -nostdinc -D_LANGUAGE_C -DMIPS -I. -I ../lib/mm-decomp/include -I ../lib/mm-decomp/src -I ../lib/mm-decomp/assets -I../lib/rt64/include LDFLAGS := -nostdlib -T patches.ld -T syms.ld --just-symbols=../mm.us.rev1.elf --allow-multiple-definition -BINFLAGS := -O binary +BINFLAGS := -O binary --remove-section=.bss --remove-section=.pad --remove-section=.text C_SRCS := $(wildcard *.c) C_OBJS := $(C_SRCS:.c=.o) diff --git a/patches/patches.ld b/patches/patches.ld index 815af70..ce543b3 100644 --- a/patches/patches.ld +++ b/patches/patches.ld @@ -1,17 +1,24 @@ RAMBASE = 0x80800100; /* Used to hold any new symbols */ +EXTRA_RAM_SIZE = 0x01000000; /* Amount of extra ram allocated by recomp */ MEMORY { - extram : ORIGIN = RAMBASE, LENGTH = 8M - rom : ORIGIN = 0, LENGTH = 1M + extram : ORIGIN = RAMBASE, LENGTH = 64M + rom : ORIGIN = 0, LENGTH = 64M } SECTIONS { - .text : { *(.text*) } >extram AT >rom .ctors : { *(.ctors*) *(.init_array*) } >extram AT >rom .dtors : { *(.dtors*) } >extram AT >rom .rodata : { *(.rodata*) } >extram AT >rom .data : { *(.data*) } >extram AT >rom - .bss (NOLOAD) : { *(.bss*) *(COMMON) } >extram + + /* The following sections will be removed from the objcopy */ + /* bss isn't noload to make .text rom addresses valid for the recompiler */ + .bss : { *(.bss*) *(COMMON) } >extram AT >rom + ASSERT(. < RAMBASE + EXTRA_RAM_SIZE, "Maxed out recomp extra ram") + /* Padding to push .text to avoid conflicts with original function addresses */ + .pad : { . += 0x1000000; } >extram AT >rom + .text : { *(.text*) } >extram AT >rom .symtab 0 : { *(.symtab) } .strtab 0 : { *(.strtab) } diff --git a/src/ui/ui_launcher.cpp b/src/ui/ui_launcher.cpp index 41107a7..d5e5483 100644 --- a/src/ui/ui_launcher.cpp +++ b/src/ui/ui_launcher.cpp @@ -6,7 +6,7 @@ #include "nfd.h" #include -std::string version_number = "v0.9.0"; +std::string version_number = "v0.9.0-dirty"; Rml::DataModelHandle model_handle; bool mm_rom_valid = false;