From ddaac3cd8ff4b38faa0fc1c70e5085ad0dbabe38 Mon Sep 17 00:00:00 2001 From: Mr-Wiseguy Date: Mon, 27 Nov 2023 23:39:18 -0500 Subject: [PATCH] Pull in symbols from the decomp elf automatically when building the patches elf --- patches/Makefile | 8 ++++---- patches/syms.ld | 12 ------------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/patches/Makefile b/patches/Makefile index 4cd2ae9..bc1fc38 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -4,9 +4,9 @@ CC := clang LD := ld.lld OBJCOPY := llvm-objcopy -CFLAGS := -target mips -mips2 -mabi=32 -O2 -mno-odd-spreg -fomit-frame-pointer -G0 -Wall -Wextra -Wno-incompatible-library-redeclaration -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-variable -CPPFLAGS := -nostdinc -D_LANGUAGE_C -DMIPS -I ../../mm/include -I ../../mm/src -I ../../mm/build -I ../../mm/assets -LDFLAGS := -nostdlib -T patches.ld -T syms.ld +CFLAGS := -target mips -mips2 -mabi=32 -O2 -mno-abicalls -mno-odd-spreg -fomit-frame-pointer -mno-check-zero-division -G0 -Wall -Wextra -Wno-incompatible-library-redeclaration -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-variable -Wno-missing-braces +CPPFLAGS := -nostdinc -D_LANGUAGE_C -DMIPS -I ../../mm/include -I ../../mm/src -I ../../mm/build -I ../../mm/assets -I../../mupen_rt64/mupen64plus-video-rt64/include +LDFLAGS := -nostdlib -T patches.ld -T syms.ld --just-symbols=../mm.us.rev1.elf --allow-multiple-definition BINFLAGS := -O binary C_SRCS := $(wildcard *.c) @@ -19,7 +19,7 @@ $(DATABIN): $(TARGET) $(OBJCOPY) $(BINFLAGS) $(TARGET) $@ $(TARGET): $(C_OBJS) patches.ld syms.ld - $(LD) $(LDFLAGS) $(C_OBJS) -o $@ + $(LD) $(C_OBJS) $(LDFLAGS) -o $@ $(C_OBJS): %.o : %.c $(CC) $(CFLAGS) $(CPPFLAGS) $< -MMD -MF $(@:.o=.d) -c -o $@ diff --git a/patches/syms.ld b/patches/syms.ld index a4eceae..0a354d5 100644 --- a/patches/syms.ld +++ b/patches/syms.ld @@ -3,15 +3,3 @@ __start = 0x80000000; /* Dummy addresses that get recompiled into function calls */ recomp_get_item_inputs = 0x81000000; recomp_puts = 0x81000004; - -/* TODO pull these symbols from the elf file directly */ -Player_PostLimbDrawGameplay = 0x80128BD0; -Player_DrawImpl = 0x801246F4; -gRegEditor = 0x801f3f60; -Audio_PlaySfx = 0x8019f0c8; -gSaveContext = 0x801ef670; -Interface_SetHudVisibility = 0x8010ef68; -PadMgr_GetInput = 0x80175f98; -Inventory_GetBtnBItem = 0x8012ec80; -gItemSlots = 0x801c2078; -_Printf = 0x8008e050;