From e91ae0e732b1737a2829a06448ef958db37b73f2 Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 29 Dec 2022 13:23:16 -0500 Subject: [PATCH 1/9] add asm-processor submodule --- .gitmodules | 3 +++ tools/asmproc | 1 + 2 files changed, 4 insertions(+) create mode 160000 tools/asmproc diff --git a/.gitmodules b/.gitmodules index 4a33b83..f77ca51 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "tools/n64splat"] path = tools/n64splat url = https://github.com/ethteck/n64splat.git +[submodule "tools/asmproc"] + path = tools/asmproc + url = https://github.com/simonlindholm/asm-processor.git diff --git a/tools/asmproc b/tools/asmproc new file mode 160000 index 0000000..742406e --- /dev/null +++ b/tools/asmproc @@ -0,0 +1 @@ +Subproject commit 742406e7dc2a5883b521f4de8b0d4e0744e839aa From 0665b3b3930898882b12070bec0d90fd0e328c96 Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 29 Dec 2022 13:23:34 -0500 Subject: [PATCH 2/9] add asm processor for manual c files --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 8d59a79..bfe7539 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,8 @@ endif CC = tools/ido_recomp/$(HOST_OS)/7.1/cc CC_OLD = tools/ido_recomp/$(HOST_OS)/5.3/cc +ASMPROC = python3 tools/asmproc/build.py +ASMPROC_FLAGS := MIPS_VERSION := -mips2 @@ -214,6 +216,10 @@ CFLAGS = -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -Iinclude/PR -Iinclu LDFLAGS = -T undefined_syms.txt -T undefined_syms_auto.txt -T undefined_funcs_auto.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/$(TARGET).map --no-check-sections + +# run ASM-processor on non-libultra source files +build/src/%.c.o: CC := $(ASMPROC) $(ASMPROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- + ######################## Build ############################# default: all From 8e69ad192ac840a50988b29a28a3d45298cfa151 Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 29 Dec 2022 20:19:37 -0500 Subject: [PATCH 3/9] add make dep generation and compiler syntax check --- Makefile | 64 +++++++++++++++++++++++++++++++++------------ include/functions.h | 50 ++++++++++++++++++++++++++++++++++- src/controller.c | 1 + src/crash_screen.c | 4 +++ src/dma.c | 1 + src/dp_intro.c | 3 +++ src/dp_intro.h | 9 +++++++ src/gb_tower.h | 8 ++++++ src/hal_libc.c | 1 + src/main.c | 6 ++++- 10 files changed, 129 insertions(+), 18 deletions(-) create mode 100644 src/dp_intro.h create mode 100644 src/gb_tower.h diff --git a/Makefile b/Makefile index bfe7539..c0fb857 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ BASEROM = baserom.z64 TARGET = pokestadium -NON_MATCHING = 0 +NON_MATCHING := 0 +RUN_CC_CHECK := 1 # Fail early if baserom does not exist ifeq ($(wildcard $(BASEROM)),) @@ -13,7 +14,7 @@ ifeq ($(UNAME_S),Linux) else ifeq ($(UNAME_S),Darwin) HOST_OS := macos else - $(error Unsupported buiding OS <$(UNAME_S)>) + $(error Unsupported host/building OS <$(UNAME_S)>) endif BUILD_DIR := build @@ -34,6 +35,8 @@ O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.c.o)) \ $(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.s.o)) \ $(foreach file,$(DATA_FILES),$(BUILD_DIR)/$(file:.bin=.bin.o)) \ +DEP_FILES := $(O_FILES:.o=.d) + SPLAT_YAML := splat.yaml SPLAT = $(PYTHON) tools/n64splat/split.py $(SPLAT_YAML) @@ -72,6 +75,35 @@ OPTFLAGS := -O2 OBJDUMP_FLAGS := -d -r -z -Mreg-names=32 +# include locations +INC_DIRS := include include/PR include/audio . +IINCS := $(foreach d,$(INC_DIRS),-I$d) +# defines for SGI IDO +CDEFS := -D_LANGUAGE_C -DF3DEX_GBI_2 -DNDEBUG + +ifneq ($(RUN_CC_CHECK),0) + CHECK_WARNINGS := -Wall -Wextra + CHECK_DEFS := -D_MIPS_SZLONG=32 -DNON_MATCHING + CHECK_FLAGS := -fno-builtin -funsigned-char -fdiagnostics-color -std=gnu89 $(CDEFS) $(CHECK_DEFS) $(IINCS) -nostdinc + CC_CHECK := gcc -fsyntax-only + + ifeq ($(HOST_OS),linux) + CC_CHECK += -m32 + endif +else + CC_CHECK := @: +endif + +######################## Flags ############################# + +ASFLAGS = -EB -mtune=vr4300 -march=vr4300 $(IINCS) -32 + +# we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff. +CFLAGS = -G 0 -non_shared -Xfullwarn -Xcpluscomm $(IINCS) -Wab,-r4300_mul $(CDEFS) -woff 649,838,712,807 $(MIPS_VERSION) + +LDFLAGS = -T undefined_syms.txt -T undefined_syms_auto.txt -T undefined_funcs_auto.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/$(TARGET).map --no-check-sections + + ######################## Targets ############################# $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(DATA_DIRS) $(COMPRESSED_DIRS) $(MAP_DIRS) $(BGM_DIRS),$(shell mkdir -p build/$(dir))) @@ -207,18 +239,15 @@ build/src/libultra/io/gbpakreadid.c.o: CC := $(CC_OLD) build/src/libultra/io/gbpakreadwrite.c.o: CC := $(CC_OLD) build/src/libultra/io/gbpakselectbank.c.o: CC := $(CC_OLD) -######################## Flags ############################# - -ASFLAGS = -EB -mtune=vr4300 -march=vr4300 -Iinclude -Iinclude/PR -Iinclude/audio -32 - -# we support Microsoft extensions such as anonymous structs, which the compiler does support but warns for their usage. Surpress the warnings with -woff. -CFLAGS = -G 0 -non_shared -Xfullwarn -Xcpluscomm -Iinclude -Iinclude/PR -Iinclude/audio -Wab,-r4300_mul -D_LANGUAGE_C -DF3DEX_GBI_2 -DNDEBUG -woff 649,838,712,807 $(MIPS_VERSION) - -LDFLAGS = -T undefined_syms.txt -T undefined_syms_auto.txt -T undefined_funcs_auto.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(BUILD_DIR)/$(TARGET).map --no-check-sections - - # run ASM-processor on non-libultra source files -build/src/%.c.o: CC := $(ASMPROC) $(ASMPROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- +$(filter-out src/libultra%,$(C_FILES)): CC := $(ASMPROC) $(ASMPROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- + +# turn off syntax checking errors for libultra +build/src/libultra/al/%.c.o: CHECK_WARNINGS := -w +build/src/libultra/gu/%.c.o: CHECK_WARNINGS := -w +build/src/libultra/io/%.c.o: CHECK_WARNINGS := -w +build/src/libultra/libc/%.c.o: CHECK_WARNINGS := -w +build/src/libultra/os/%.c.o: CHECK_WARNINGS := -w ######################## Build ############################# @@ -254,15 +283,16 @@ $(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) @$(LD) $(LDFLAGS) -o $@ $(BUILD_DIR)/%.c.o: %.c - $(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $^ + $(CC_CHECK) $(CHECK_FLAGS) $(CHECK_WARNINGS) -MMD -MP -MT $@ -MF $(@:.o=.d) $< + $(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $< $(BUILD_DIR)/src/libultra/libc/ll.c.o: src/libultra/libc/ll.c - $(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $^ + $(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $< python3 tools/set_o32abi_bit.py $@ @$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s) $(BUILD_DIR)/src/libultra/libc/llcvt.c.o: src/libultra/libc/llcvt.c - $(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $^ + $(CC) -c $(CFLAGS) $(OPTFLAGS) -o $@ $< python3 tools/set_o32abi_bit.py $@ @$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s) @@ -282,3 +312,5 @@ verify: $(BUILD_DIR)/$(ROM) .PHONY: all clean default split setup print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true + +-include $(DEP_FILES) diff --git a/include/functions.h b/include/functions.h index 022c38e..852532f 100644 --- a/include/functions.h +++ b/include/functions.h @@ -4,6 +4,54 @@ #include "ultra64.h" extern void func_80057FD0(void *, int); -extern s32 func_8005A990(OSPiHandle*); +extern s32 func_8005A990(OSPiHandle *); + +// 3A80.s +extern void func_80002F58(void); +extern void *func_80002FDC(s32); +extern void func_80003004(void *); // type unknown + +// 3FB0.s +extern void func_80003B30(void *, s32, s32, s32); // types unknown + +// 5580.s +extern void func_80004CC0(void *, s32, s32); // types unknown +extern void func_80004CF4(void *); // types unknown +extern void func_80004D20(void *); // types unknown +extern void func_800052B4(void); +extern void func_800053B4(void *, s32); // types unknown +extern void func_80005328(void *); // types unknown + +// 60A0.s +extern void func_800057C0(void); + +// 6BC0.s +extern u32 func_80006314(s32, s32, s32, s32, s32); // types unknown + +// 9D20.s +extern void func_80009120(s32); + +// C030.s +extern s32 func_8000B4C4(void); + +// D470.s +extern void func_8000C8F8(void); +extern void func_8000CEE4(s32, s32, void *, OSMesgQueue *); +extern void func_8000D0B4(s32, s32, s32, void *, s32, OSMesgQueue *); + +// DDC0.s +extern void func_8000D564(void); + +// E570.s +extern void func_8000D970(OSPfs *); + +// 29BA0.s +extern void func_8002B274(s32, s32); + +// exception_set.s +extern void set_watch_lohi(s32); + +// readwrite.s +extern void func_80050FC0(void *, s32, s32, void *, s32, OSMesgQueue *); #endif diff --git a/src/controller.c b/src/controller.c index 9888e16..f79a13e 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1,5 +1,6 @@ #include #include "controller.h" +#include "gb_tower.h" // TODO: Identify/move to header extern s16 func_8000A360(float, float); diff --git a/src/crash_screen.c b/src/crash_screen.c index fd1a405..f60b5fe 100644 --- a/src/crash_screen.c +++ b/src/crash_screen.c @@ -1,7 +1,11 @@ #include +#include +#include +#include #include "stdarg.h" #include "crash_screen.h" #include "memmap.h" +#include "controller.h" extern u32 D_80068BA0[]; diff --git a/src/dma.c b/src/dma.c index fd3618c..c8bf7ff 100644 --- a/src/dma.c +++ b/src/dma.c @@ -1,6 +1,7 @@ #include #include "common.h" #include "dma.h" +#include "rsp.h" extern u32 D_800818E0; extern s16 D_80083C1C; diff --git a/src/dp_intro.c b/src/dp_intro.c index 221e25b..36a6b7b 100644 --- a/src/dp_intro.c +++ b/src/dp_intro.c @@ -1,5 +1,8 @@ #include +#include #include "common.h" +#include "dp_intro.h" +#include "crash_screen.h" // dp_intro.c diff --git a/src/dp_intro.h b/src/dp_intro.h new file mode 100644 index 0000000..846d7ac --- /dev/null +++ b/src/dp_intro.h @@ -0,0 +1,9 @@ +#ifndef _SRC_DP_INTRO_H_ +#define _SRC_DP_INTRO_H_ + +#include + +void func_80001474(s8, s8); +void func_800019C8(void); + +#endif /* _SRC_DP_INTRO_H_ */ diff --git a/src/gb_tower.h b/src/gb_tower.h new file mode 100644 index 0000000..24b1079 --- /dev/null +++ b/src/gb_tower.h @@ -0,0 +1,8 @@ +#ifndef _SRC_GB_TOWER_H_ +#define _SRC_GB_TOWER_H_ + +#include + +void func_8000B330(void); + +#endif /* _SRC_GB_TOWER_H_ */ diff --git a/src/hal_libc.c b/src/hal_libc.c index 1615a66..d96a9ea 100644 --- a/src/hal_libc.c +++ b/src/hal_libc.c @@ -1,4 +1,5 @@ #include +#include #include "hal_libc.h" /* diff --git a/src/main.c b/src/main.c index d4692b5..18af0ea 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,10 @@ #include -extern void thread1_idle(); // thread 1 function +#include "common.h" +#include "dp_intro.h" +#include "crash_screen.h" +#include "rsp.h" + extern void func_8002B330(); // thread 6 function // entry .bss From 7ee988466a04b9cf8826698d68af44054899ec95 Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 29 Dec 2022 21:30:35 -0500 Subject: [PATCH 4/9] add werror makefile toggle to clean out warnings --- Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c0fb857..761eddf 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ BASEROM = baserom.z64 TARGET = pokestadium -NON_MATCHING := 0 -RUN_CC_CHECK := 1 +NON_MATCHING ?= 0 +RUN_CC_CHECK ?= 1 +WERROR ?= 0 # Fail early if baserom does not exist ifeq ($(wildcard $(BASEROM)),) @@ -90,6 +91,10 @@ ifneq ($(RUN_CC_CHECK),0) ifeq ($(HOST_OS),linux) CC_CHECK += -m32 endif + + ifneq ($(WERROR),0) + CHECK_WARNINGS += -Werror + endif else CC_CHECK := @: endif @@ -240,7 +245,8 @@ build/src/libultra/io/gbpakreadwrite.c.o: CC := $(CC_OLD) build/src/libultra/io/gbpakselectbank.c.o: CC := $(CC_OLD) # run ASM-processor on non-libultra source files -$(filter-out src/libultra%,$(C_FILES)): CC := $(ASMPROC) $(ASMPROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- +DECOMP_C_OBJS := $(filter %.c.o,$(filter-out build/src/libultra%,$(O_FILES))) +$(DECOMP_C_OBJS): CC := $(ASMPROC) $(ASMPROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- # turn off syntax checking errors for libultra build/src/libultra/al/%.c.o: CHECK_WARNINGS := -w From eaf2aaf216958b43cc185c32390bd0fa5303eed9 Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 29 Dec 2022 21:30:45 -0500 Subject: [PATCH 5/9] add UNUSED macro --- include/macros.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/macros.h b/include/macros.h index 919c14c..8bd69ca 100644 --- a/include/macros.h +++ b/include/macros.h @@ -4,6 +4,13 @@ #define true 1 #define false 0 +// Avoid compiler warnings for unused variables +#ifdef __GNUC__ +#define UNUSED __attribute__((unused)) +#else +#define UNUSED +#endif + #ifndef __sgi #define GLOBAL_ASM(...) #endif From e9a53e84c863788a2cf98bcc2e78915b85bf1c06 Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 29 Dec 2022 21:30:56 -0500 Subject: [PATCH 6/9] correct warnings --- src/crash_screen.c | 12 ++++++------ src/dma.c | 4 ++-- src/dp_intro.c | 24 ++++++++++++------------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/crash_screen.c b/src/crash_screen.c index f60b5fe..f950e66 100644 --- a/src/crash_screen.c +++ b/src/crash_screen.c @@ -7,7 +7,7 @@ #include "memmap.h" #include "controller.h" -extern u32 D_80068BA0[]; +extern void *D_80068BA0[]; CrashScreen gCrashScreen; @@ -186,7 +186,7 @@ void crash_screen_printf(s32 x, s32 y, const char *fmt, ...) { va_list args; va_start(args, fmt); - size = _Printf(crash_screen_copy_to_buf, buf, fmt, args); + size = _Printf(crash_screen_copy_to_buf, (char *)buf, fmt, args); if (size > 0) { ptr = buf; @@ -315,7 +315,7 @@ void crash_screen_draw(OSThread* faultedThread) { // all of these null terminators needed to pad the rodata section for this file // can potentially fix this problem in another way? - crash_screen_printf(210, 140, "MM:%08XH", *(u32*)ctx->pc); + crash_screen_printf(210, 140, "MM:%08XH", *(u32 *)(uintptr_t)ctx->pc); } OSThread* crash_screen_get_faulted_thread(void) { @@ -332,7 +332,7 @@ OSThread* crash_screen_get_faulted_thread(void) { return NULL; } -void crash_screen_thread_entry(void* unused) { +void crash_screen_thread_entry(UNUSED void* unused) { OSMesg mesg; OSThread* faultedThread; @@ -358,7 +358,7 @@ void crash_screen_set_draw_info(u16* frameBufPtr, u16 width, u16 height) { } void crash_screen_init(void) { - gCrashScreen.frameBuf = (u16*)((osMemSize | 0xA0000000) - ((SCREEN_WIDTH * SCREEN_HEIGHT) * 2)); + gCrashScreen.frameBuf = (u16*)(uintptr_t)((osMemSize | 0xA0000000) - ((SCREEN_WIDTH * SCREEN_HEIGHT) * 2)); gCrashScreen.width = SCREEN_WIDTH; gCrashScreen.height = 16; osCreateMesgQueue(&gCrashScreen.queue, &gCrashScreen.mesg, 1); @@ -376,7 +376,7 @@ void crash_screen_printf_with_bg(s16 x, s16 y, const char* fmt, ...) { va_start(args, fmt); - size = _Printf(crash_screen_copy_to_buf, buf, fmt, args); + size = _Printf(crash_screen_copy_to_buf, (char *)buf, fmt, args); if (size > 0) { crash_screen_draw_rect(x - 6, y - 6, (size + 2) * 6, 19); diff --git a/src/dma.c b/src/dma.c index c8bf7ff..682b59d 100644 --- a/src/dma.c +++ b/src/dma.c @@ -31,9 +31,9 @@ s32 func_80000F0C(s32 arg0, void *arg1, s32 arg2, s32 arg3, s32 arg4) { temp_v0 = func_80002FDC(0x2C); if (temp_v0 != NULL) { temp_v0->unk0 = 0xF4; - temp_v0->unk1C = arg1; + temp_v0->unk1C = (uintptr_t)arg1; temp_v0->unk24 = arg2; - temp_v0->unk20 = arg0; + temp_v0->unk20 = (void *)(uintptr_t)arg0; temp_v0->unk28 = arg3; func_80000E2C(temp_v0, arg4); } diff --git a/src/dp_intro.c b/src/dp_intro.c index 36a6b7b..52e111b 100644 --- a/src/dp_intro.c +++ b/src/dp_intro.c @@ -118,9 +118,9 @@ void func_80001380(struct UnkStruct80001380* arg0) { arg0->task.t.ucode_data = F3DEX2_data_bin; arg0->task.t.ucode_size = 0x1000; arg0->task.t.ucode_data_size = 0x800; - arg0->task.t.dram_stack = ALIGN16((u32)D_80084860); + arg0->task.t.dram_stack = (void *)ALIGN16((uintptr_t)D_80084860); arg0->task.t.dram_stack_size = 0x400; - arg0->task.t.yield_data_ptr = ALIGN16((u32)D_80084C68); + arg0->task.t.yield_data_ptr = (void *)ALIGN16((uintptr_t)D_80084C68); arg0->task.t.yield_data_size = 0xC00; arg0->task.t.output_buff = (D_80085870); arg0->task.t.output_buff_size = (D_80085870 + (0x20000/sizeof(u64))); @@ -128,7 +128,7 @@ void func_80001380(struct UnkStruct80001380* arg0) { } void func_80001444(struct UnkStruct80001380* arg0, struct UnkArray4* arg1, s32 arg2) { - arg0->task.t.data_ptr = arg1->unk4; + arg0->task.t.data_ptr = (void *)(uintptr_t)arg1->unk4; arg0->task.t.data_size = arg1->unk8; func_800053B4(arg0, arg2); } @@ -142,7 +142,7 @@ void func_80001474(s8 arg0, s8 arg1) { var_v0 = (arg0 * 2) + arg1 + 4; } - osViSetMode(&D_800796E0[D_80068B74[var_v0]]); + osViSetMode(&D_800796E0[(s32)D_80068B74[var_v0]]); osViSetSpecialFeatures(0x40U); osViSetSpecialFeatures(2U); osViSetSpecialFeatures(0x10U); @@ -194,7 +194,7 @@ void func_800015A8(void) { } while (D_80083CA0.unk1C8 > 0); } if (D_80083CA0.unkAA8 != NULL) { - osViSwapBuffer(D_80083CA0.unkAA8->unk8); + osViSwapBuffer((void *)(uintptr_t)D_80083CA0.unkAA8->unk8); osViRepeatLine(0); if ((D_80083CA0.unkA9D != D_80083CA0.unkAAD) || (D_80083CA0.unkA9E != D_80083CA0.unkAAE)) { func_80001474((s8) D_80083CA0.unkA9D, (s8) D_80083CA0.unkA9E); @@ -204,10 +204,10 @@ void func_800015A8(void) { } else { osViBlack(0U); } - crash_screen_set_draw_info(D_80083CA0.unkAA8->unk8, *(u16 *)&D_80083CA0.unkAA8->unk4, 0x10); + crash_screen_set_draw_info((void *)(uintptr_t)D_80083CA0.unkAA8->unk8, *(u16 *)&D_80083CA0.unkAA8->unk4, 0x10); } else { osViRepeatLine(1); - osViSwapBuffer(D_80083CA0.unk9E0->unk8); + osViSwapBuffer((void *)(uintptr_t)D_80083CA0.unk9E0->unk8); if ((D_80083CA0.unkA9D != D_80083CA0.unkAAD) || (D_80083CA0.unkA9E != D_80083CA0.unkAAE)) { func_80001474((s8) D_80083CA0.unkA9D, (s8) D_80083CA0.unkA9E); } @@ -231,7 +231,7 @@ void func_800017E4(void) { func_80004CF4(&D_80083CA0); } -void func_8000183C(void* arg) { +void func_8000183C(UNUSED void *arg) { __osSetFpcCsr(0x01000C01); func_80001C1C(&D_8008474C, 0, 1, 2, 0xFF, 0, 0, 0); func_80001C1C(&D_8008473C, 0, 1, 2, 0xFF, 0, 0, 0); @@ -276,25 +276,25 @@ void func_800019C8(void) { void func_80001AD4(u16 arg0) { s32 i = 0x280; - u16 *arr = D_80083CA0.unk9E0->unk8; + u16 *arr = (void *)(uintptr_t)D_80083CA0.unk9E0->unk8; while(i --> 0) { *(arr)++ = arg0; } - osWritebackDCache(D_80083CA0.unk9E0->unk8, 0x500); + osWritebackDCache((void *)(uintptr_t)D_80083CA0.unk9E0->unk8, 0x500); } u16 func_80001B2C(void) { // YIKES. What is this typing?!? - u16 *ptr = (u16*)((u32*)D_80084680[0])[2]; + u16 *ptr = (u16*)(uintptr_t)((u32 *)(uintptr_t)D_80084680[0])[2]; return *ptr; } s32 func_80001B40(void) { s32 result = 0; - if (osViGetCurrentFramebuffer() == (void*)((u32*)D_80084680[0])[2]) + if (osViGetCurrentFramebuffer() == ((void **)(uintptr_t)D_80084680[0])[2]) result = 1; return result; From c46072c585af76e2bb2cf9d8a7c810bc8e3fa160 Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 29 Dec 2022 22:25:52 -0500 Subject: [PATCH 7/9] correct more warnings --- include/macros.h | 2 + include/rsp.h | 12 +---- src/gb_tower.c | 28 +++++----- src/hal_libc.c | 4 +- src/main.c | 2 +- src/memmap.c | 12 ++--- src/rsp.c | 134 +++++++++++++++++++++++++---------------------- src/unk_bss.c | 3 +- src/unk_bss_2.c | 3 +- src/unk_bss_3.c | 3 +- 10 files changed, 102 insertions(+), 101 deletions(-) diff --git a/include/macros.h b/include/macros.h index 8bd69ca..b1558f1 100644 --- a/include/macros.h +++ b/include/macros.h @@ -29,6 +29,8 @@ // global typings typedef unsigned long uintptr_t; +#define INT2VOID(i) ((void *)(uintptr_t)(i)) + #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 diff --git a/include/rsp.h b/include/rsp.h index a72b0ff..777a5e9 100644 --- a/include/rsp.h +++ b/include/rsp.h @@ -10,16 +10,6 @@ struct UnkStruct800006C4_2 { s32 unk28; }; -struct UnkStruct800006C4_1 { - s16 sp20; - s8 sp22; - OSMesgQueue* sp24; - void* sp28; - s32 sp2C; - s32 sp30; - s32 unk34; -}; - struct UnkStruct80000A80 { LEOCmd cmd; union { @@ -53,7 +43,7 @@ void *func_80000A3C(struct UnkStruct800006C4_2* arg0); void *func_80000A80(struct UnkStruct80000A80* arg0); void *func_80000AB0(struct UnkStruct80000A80* arg0); void *func_80000AE0(struct UnkStruct80000A80* arg0); -s32 func_80000B10(struct UnkStruct80000A80* arg0); +void *func_80000B10(struct UnkStruct80000A80* arg0); void *func_80000B74(struct UnkStruct80000A80* arg0); void thread20_rsp(void *arg); void rsp_init(void); diff --git a/src/gb_tower.c b/src/gb_tower.c index 5cf9436..eb86c5a 100644 --- a/src/gb_tower.c +++ b/src/gb_tower.c @@ -28,10 +28,10 @@ s32 func_8000A630(s32 arg0, void* arg1) { u8 sp47; u8 sp24[0x20]; s32 sp20 = 0; - u8 padding[8]; + UNUSED u8 padding[8]; if ((func_8000AF40(arg0, arg1, 0, 0x20) == 0) - && (func_8000AEBC(arg0, &sp24, 0, 0x20) == 0) + && (func_8000AEBC(arg0, (uintptr_t)&sp24, 0, 0x20) == 0) && (bcmp(&sp24, arg1, 0x20) == 0) && (osGbpakGetStatus(&D_800A8100[arg0], &sp47) == 0)) { @@ -47,12 +47,12 @@ s32 func_8000A6D8(s32 arg0, u8* arg1) { if (arg1 == NULL) { arg1 = sp34; } - HAL_Memset(arg1, 0x55, 0x20); + HAL_Memset((char *)arg1, 0x55, 0x20); if (func_8000A630(arg0, arg1) != 0) { - HAL_Memset(arg1, 0xAA, 0x20); + HAL_Memset((char *)arg1, 0xAA, 0x20); if (func_8000A630(arg0, arg1) != 0) { s32 i; - for (i = 0; i < sizeof(sp34); i++) { + for (i = 0; i < ARRAY_COUNT(sp34); i++) { arg1[i] = osGetCount(); } var_s0 = func_8000A630(arg0, arg1); @@ -61,7 +61,7 @@ s32 func_8000A6D8(s32 arg0, u8* arg1) { return var_s0; } -s32 func_8000A798(s32 arg0, u8* arg1, s32 arg2) { +s32 func_8000A798(s32 arg0, u8 *arg1, u8 *arg2) { u8 status; OSGbpakId gbpakId; s32 sp28 = 0; @@ -119,16 +119,16 @@ s32 func_8000A9D0(OSGbpakId* header) { // is the cartridge non-Japanese? if (header->country_code == 1) { // Which supported POKeMON version is this? - if (HAL_Strcmp(header->game_title, "POKEMON RED") == 0) { + if (HAL_Strcmp((char *)header->game_title, "POKEMON RED") == 0) { return 1; } - if (HAL_Strcmp(header->game_title, "POKEMON GREEN") == 0) { + if (HAL_Strcmp((char *)header->game_title, "POKEMON GREEN") == 0) { return 1; } - if (HAL_Strcmp(header->game_title, "POKEMON BLUE") == 0) { + if (HAL_Strcmp((char *)header->game_title, "POKEMON BLUE") == 0) { return 1; } - if (HAL_Strcmp(header->game_title, "POKEMON YELLOW") == 0) { + if (HAL_Strcmp((char *)header->game_title, "POKEMON YELLOW") == 0) { return 1; } } @@ -187,7 +187,7 @@ s32 func_8000AA7C(void) { s32 func_8000AC7C(s32 arg0) { u8 status; s32 ret = osGbpakGetStatus(&D_800A8100[arg0], &status); - u8 filler; + UNUSED u8 filler; // check the error code returned (if applicable) by the osGbpakGetStatus // call. @@ -212,7 +212,7 @@ s32 func_8000ACF4(s32 arg0) { } s32 func_8000AD68(s32 arg0) { - u8 filler[4]; + UNUSED u8 filler[4]; u8 status; OSGbpakId sp28; @@ -235,7 +235,7 @@ s32 func_8000AE28(s32 arg0, void* arg1) { s32 sp18; sp18 = 0; - if ((func_8000AEBC(arg0, &sp1C, 0, 0x20) == 0) && (bcmp(&sp1C, arg1, 0x20) == 0) + if ((func_8000AEBC(arg0, (uintptr_t)&sp1C, 0, 0x20) == 0) && (bcmp(&sp1C, arg1, 0x20) == 0) && (osGbpakGetStatus(&D_800A8100[arg0], &status) == 0) && !(status & OS_GBPAK_RSTB_DETECTION)) { sp18 = 1; @@ -258,7 +258,7 @@ s32 func_8000AF40(s32 arg0, void* arg1, u16 arg2, u16 arg3) { var_v1 = 1; if (D_800A82A5 & (1 << arg0)) { - var_v1 = func_8000DAFC(&D_800A8100[arg0], 1, arg2, arg1, arg3); + var_v1 = func_8000DAFC(&D_800A8100[arg0], 1, arg2, (uintptr_t)arg1, arg3); } return var_v1; } diff --git a/src/hal_libc.c b/src/hal_libc.c index d96a9ea..fd421c0 100644 --- a/src/hal_libc.c +++ b/src/hal_libc.c @@ -17,8 +17,8 @@ char* HAL_Strcpy(char* dest, char* src) { * Alternate strcpy implementation; return the post-increment altered dest pointer. */ char* HAL_Strcpy2(char *dest, char* src) { - size_t c = strlen(dest); // this is completely pointless. the strlen func called - // doesnt alter the pointer. + UNUSED size_t c = strlen(dest); // this is completely pointless. the strlen func called + // doesnt alter the pointer. while ((*(dest++) = *(src++)) != '\0') { } return dest; diff --git a/src/main.c b/src/main.c index 18af0ea..04ecf97 100644 --- a/src/main.c +++ b/src/main.c @@ -20,7 +20,7 @@ u8 D_800818F8[0x8]; /** * Initialize hardware, start main thread, then idle. */ -void thread1_idle(void *arg0) { +void thread1_idle(UNUSED void *arg0) { osCreateViManager(OS_PRIORITY_VIMGR); func_80001474(0, 1); osViBlack(TRUE); diff --git a/src/memmap.c b/src/memmap.c index 58dbc0c..608b5c4 100644 --- a/src/memmap.c +++ b/src/memmap.c @@ -67,7 +67,7 @@ void Memmap_SetSegments(Gfx** gfxDl) { Gfx* gfx = *gfxDl; for(i = 0; i < 16; i++) { - gSPSegment(gfx++, i, osVirtualToPhysical(gSegments[i].vaddr)); + gSPSegment(gfx++, i, osVirtualToPhysical((void *)gSegments[i].vaddr)); } *gfxDl = gfx; } @@ -83,12 +83,12 @@ void Memmap_RelocateFragment(u32 id, struct Fragment* fragment) { u32 *relocDataP; u32 relocSize; struct RelocTable* relocInfo; - u32 relocOffset; + UNUSED u32 relocOffset; u32 reloc; u32 temp_v0_5; u32 i; u32 *regValP; - s32 pad; + UNUSED s32 pad; relocOffset = fragment->relocOffset; relocSize = fragment->sizeInRam - fragment->relocOffset; @@ -96,7 +96,7 @@ void Memmap_RelocateFragment(u32 id, struct Fragment* fragment) { osInvalICache(fragment, fragment->sizeInRam); osInvalDCache(fragment, fragment->sizeInRam); - Memmap_SetFragmentMap(id, fragment, fragment->sizeInRam); + Memmap_SetFragmentMap(id, (uintptr_t)fragment, fragment->sizeInRam); for(i = 0; i < relocInfo->nRelocations; i++) { reloc = relocInfo->relocations[i]; @@ -138,7 +138,7 @@ void Memmap_RelocateFragment(u32 id, struct Fragment* fragment) { } } if (relocSize != 0) { - bzero(((uintptr_t)fragment->relocOffset + (uintptr_t)fragment), relocSize); + bzero((void *)((uintptr_t)fragment->relocOffset + (uintptr_t)fragment), relocSize); } osWritebackDCache(fragment, fragment->sizeInRam); } @@ -207,7 +207,7 @@ void Memmap_ClearFragmentMemmap(u32 id) { */ uintptr_t Memmap_GetLoadedFragmentVaddr(uintptr_t addr) { struct MemoryMap* fraglist = gFragments; - int i, j; + int i, UNUSED j; for(i = 0, fraglist = gFragments; i < 0xF0; i++, fraglist++) { if (addr >= fraglist->vaddr) { diff --git a/src/rsp.c b/src/rsp.c index d7e6ca9..33771c2 100644 --- a/src/rsp.c +++ b/src/rsp.c @@ -22,8 +22,8 @@ struct UnkStruct80083BD0 D_80083BD0; s16 D_80083C1C; s32 func_800005C0(void) { - s32 unused; - s32 unused2[6]; + UNUSED s32 unused; + UNUSED s32 unused2[6]; s32 result; result = LeoCJCreateLeoManager(0x95, 0x96, &D_80083B4C, 0x10); @@ -40,9 +40,9 @@ OSPiHandle* func_80000628(void) { static OSPiHandle sramHandle; void* baseAddr = OS_PHYSICAL_TO_K1(SRAM_START_ADDR); - if (baseAddr != (void*)sramHandle.baseAddress) { + if (baseAddr != (void *)(uintptr_t)sramHandle.baseAddress) { sramHandle.type = DEVICE_TYPE_SRAM; - sramHandle.baseAddress = baseAddr; + sramHandle.baseAddress = (uintptr_t)baseAddr; sramHandle.latency = SRAM_latency; sramHandle.pulse = SRAM_pulse; sramHandle.pageSize = SRAM_pageSize; @@ -57,87 +57,93 @@ OSPiHandle* func_80000628(void) { } s32 func_800006C4(struct UnkStruct800006C4_2* arg0) { - struct UnkStruct800006C4_1 unkStruct; - s32 unk1C = func_80000628(); + OSIoMesg msg; + OSPiHandle *handle = func_80000628(); + + msg.hdr.pri = 0; + msg.hdr.retQueue = &D_80083BD0.queue2; + msg.dramAddr = arg0->vaddr; + msg.devAddr = arg0->unk1C; + msg.size = arg0->size; - unkStruct.sp22 = 0; - unkStruct.sp24 = &D_80083BD0.queue2; - unkStruct.sp28 = arg0->vaddr; - unkStruct.sp2C = arg0->unk1C; - unkStruct.sp30 = arg0->size; osInvalDCache(arg0->vaddr, arg0->size); - osEPiStartDma(unk1C, &unkStruct.sp20, 0); + osEPiStartDma(handle, &msg, 0); osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, 1); return 0; } s32 func_8000074C(struct UnkStruct800006C4_2* arg0) { - struct UnkStruct800006C4_1 unkStruct; - s32 unk1C = func_80000628(); + OSIoMesg msg; + OSPiHandle *handle = func_80000628(); + + msg.hdr.pri = 0; + msg.hdr.retQueue = &D_80083BD0.queue2; + msg.dramAddr = arg0->vaddr; + msg.devAddr = arg0->unk1C; + msg.size = arg0->size; - unkStruct.sp22 = 0; - unkStruct.sp24 = &D_80083BD0.queue2; - unkStruct.sp28 = arg0->vaddr; - unkStruct.sp2C = arg0->unk1C; - unkStruct.sp30 = arg0->size; osWritebackDCache(arg0->vaddr, arg0->size); - osEPiStartDma(unk1C, &unkStruct.sp20, 1); + osEPiStartDma(handle, &msg, 1); osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK); return 0; } s32 func_800007D4(struct UnkStruct800006C4_2* arg0, s32 arg1) { - struct UnkStruct800006C4_1 unkStruct; - OSPiHandle* handle; - if(arg1 == 0) { + OSIoMesg msg; + OSPiHandle *handle; + + if (arg1 == 0) { handle = osCartRomInit(); } else { handle = osDriveRomInit(); } - unkStruct.sp22 = 0; - unkStruct.sp24 = &D_80083BD0.queue2; - unkStruct.sp28 = arg0->vaddr; - unkStruct.sp2C = arg0->unk1C; - unkStruct.sp30 = arg0->size; + msg.hdr.pri = 0; + msg.hdr.retQueue = &D_80083BD0.queue2; + msg.dramAddr = arg0->vaddr; + msg.devAddr = arg0->unk1C; + msg.size = arg0->size; + osInvalDCache(arg0->vaddr, arg0->size); - osEPiStartDma(handle, &unkStruct.sp20, 0); + osEPiStartDma(handle, &msg, 0); osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK); return 0; } s32 func_8000087C(struct UnkStruct800006C4_2* arg0) { - struct UnkStruct800006C4_1 unkStruct; - OSPiHandle* handle; + OSIoMesg msg; + OSPiHandle *handle; handle = osCartRomInit(); - unkStruct.sp22 = 0; - unkStruct.sp24 = &D_80083BD0.queue2; - unkStruct.sp28 = arg0->vaddr; - unkStruct.sp2C = arg0->unk1C; - unkStruct.sp30 = arg0->size; + + msg.hdr.pri = 0; + msg.hdr.retQueue = &D_80083BD0.queue2; + msg.dramAddr = arg0->vaddr; + msg.devAddr = arg0->unk1C; + msg.size = arg0->size; + osWritebackDCache(arg0->vaddr, arg0->size); - osEPiStartDma(handle, &unkStruct.sp20, 1); + osEPiStartDma(handle, &msg, 1); osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK); return 0; } s32 func_80000904(struct UnkStruct800006C4_2* arg0) { - s32 arr[5]; + UNUSED s32 arr[5]; s32 sp20; osInvalDCache(arg0->vaddr, 0x80); - func_8000D0B4(&sp20, 0, arg0->unk1C, arg0->vaddr, 1, &D_80083BD0.queue2); + func_8000D0B4((uintptr_t)&sp20, 0, arg0->unk1C, arg0->vaddr, 1, &D_80083BD0.queue2); osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK); return 0; } s32 func_80000974(struct UnkStruct800006C4_2* arg0) { - s32 arr[5]; + UNUSED s32 arr[5]; s32 sp20_4; - s32 sp20_5; + UNUSED s32 sp20_5; - func_8000CEE4(&sp20_4, 0, arg0->vaddr, &D_80083BD0.queue2); + func_8000CEE4((uintptr_t)&sp20_4, 0, arg0->vaddr, &D_80083BD0.queue2); osRecvMesg(&D_80083BD0.queue2, &D_80083BD0.unk0, OS_MESG_BLOCK); return 0; } @@ -174,12 +180,12 @@ void *func_80000AE0(struct UnkStruct80000A80* arg0) { return func_800009C8(); } -s32 func_80000B10(struct UnkStruct80000A80* arg0) { - s32 temp_v0; +void *func_80000B10(struct UnkStruct80000A80* arg0) { + void *temp_v0; LeoReadRTC(&arg0->cmd, &D_80083BD0.queue2); temp_v0 = func_800009C8(); - if (temp_v0 == 0) { + if (temp_v0 == NULL) { *(LEODiskTime*)arg0->addr = arg0->cmd.data.time; } return temp_v0; @@ -190,9 +196,9 @@ void *func_80000B74(struct UnkStruct80000A80* arg0) { return func_800009C8(); } -void thread20_rsp(void *arg) { +void thread20_rsp(UNUSED void *arg) { struct UnkStruct800006C4_2* sp2C; - void* var_v0; + OSMesg var_v0; func_800005C0(); func_8000C8F8(); @@ -200,31 +206,31 @@ void thread20_rsp(void *arg) { osRecvMesg(&D_80083BD0.queue1, (void*)&sp2C, OS_MESG_BLOCK); switch (sp2C->unk0) { case 0xF0: - var_v0 = func_800007D4(sp2C, 0); + var_v0 = (OSMesg)INT2VOID(func_800007D4(sp2C, 0)); break; case 0xF1: - var_v0 = func_800007D4(sp2C, 1); + var_v0 = (OSMesg)INT2VOID(func_800007D4(sp2C, 1)); break; case 0xF2: - var_v0 = func_800006C4(sp2C); + var_v0 = (OSMesg)INT2VOID(func_800006C4(sp2C)); break; case 0xF3: - var_v0 = func_8000074C(sp2C); + var_v0 = (OSMesg)INT2VOID(func_8000074C(sp2C)); break; case 0xF4: - var_v0 = func_8000087C(sp2C); + var_v0 = (OSMesg)INT2VOID(func_8000087C(sp2C)); break; case 0xF5: - var_v0 = func_80000904(sp2C); + var_v0 = (OSMesg)INT2VOID(func_80000904(sp2C)); break; case 0xF6: - var_v0 = func_80000974(sp2C); + var_v0 = (OSMesg)INT2VOID(func_80000974(sp2C)); break; case 0x5: - var_v0 = func_800009F8(sp2C); + var_v0 = (OSMesg)func_800009F8(sp2C); break; case 0x6: - var_v0 = func_80000A3C(sp2C); + var_v0 = (OSMesg)func_80000A3C(sp2C); break; case 0xC: /* @@ -232,23 +238,23 @@ void thread20_rsp(void *arg) { * there is very tenuous aliasing going on due to s16 and u8 overlap where * there should be word loads. What is going on here? */ - var_v0 = func_80000A80((struct UnkStruct80000A80 *)sp2C); + var_v0 = (OSMesg)func_80000A80((struct UnkStruct80000A80 *)sp2C); break; case 0x7: - var_v0 = func_80000AB0((struct UnkStruct80000A80 *)sp2C); + var_v0 = (OSMesg)func_80000AB0((struct UnkStruct80000A80 *)sp2C); break; case 0x8: - var_v0 = func_80000AE0((struct UnkStruct80000A80 *)sp2C); + var_v0 = (OSMesg)func_80000AE0((struct UnkStruct80000A80 *)sp2C); break; case 0xD: - var_v0 = func_80000B10((struct UnkStruct80000A80 *)sp2C); + var_v0 = (OSMesg)func_80000B10((struct UnkStruct80000A80 *)sp2C); break; case 0xE: - var_v0 = func_80000B74((struct UnkStruct80000A80 *)sp2C); + var_v0 = (OSMesg)func_80000B74((struct UnkStruct80000A80 *)sp2C); break; } - if ((OSMesgQueue*)sp2C->unk28 != NULL) { - osSendMesg(sp2C->unk28, var_v0, 0); + if ((OSMesgQueue *)INT2VOID(sp2C->unk28) != NULL) { + osSendMesg(INT2VOID(sp2C->unk28), var_v0, 0); } func_80003004(sp2C); } @@ -257,7 +263,7 @@ void thread20_rsp(void *arg) { void rsp_init(void) { osCreateMesgQueue(&D_80083BD0.queue2, &D_80083BCC, 1); osCreateMesgQueue(&D_80083BD0.queue1, &D_80083B8C, 16); - osCreatePiManager(0x96, &D_80083BD0.unk4, &gRspThreadStack[0x1C], 0x20); + osCreatePiManager(0x96, (void *)&D_80083BD0.unk4, (OSMesg)&gRspThreadStack[0x1C], 0x20); osCreateThread(&gRspThread, 20, thread20_rsp, NULL, gRspThreadStack, 90); osStartThread(&gRspThread); } diff --git a/src/unk_bss.c b/src/unk_bss.c index bdf95e6..554ccff 100644 --- a/src/unk_bss.c +++ b/src/unk_bss.c @@ -1,4 +1,5 @@ #include +#include // used for padding. Splat cant auto gen these I guess -static u8 unk_bss[0x800A7320-0x80083CA0]; +UNUSED static u8 unk_bss[0x800A7320-0x80083CA0]; diff --git a/src/unk_bss_2.c b/src/unk_bss_2.c index f8a94a7..150d414 100644 --- a/src/unk_bss_2.c +++ b/src/unk_bss_2.c @@ -1,3 +1,4 @@ #include +#include -static u8 unk_bss[0x80103880-0x800A7EA0]; +UNUSED static u8 unk_bss[0x80103880-0x800A7EA0]; diff --git a/src/unk_bss_3.c b/src/unk_bss_3.c index 31ed8e2..dad0a80 100644 --- a/src/unk_bss_3.c +++ b/src/unk_bss_3.c @@ -1,4 +1,5 @@ #include +#include // used for padding. Splat cant auto gen these I guess -static u8 unk_bss[0x800A74C0-0x800A7420]; +UNUSED static u8 unk_bss[0x800A74C0-0x800A7420]; From 443530f84aba762ec3230b79040069d5c723116f Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 29 Dec 2022 22:28:01 -0500 Subject: [PATCH 8/9] add distclean make target --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 761eddf..fd5eb6d 100644 --- a/Makefile +++ b/Makefile @@ -263,16 +263,19 @@ LD_SCRIPT = $(TARGET).ld all: $(BUILD_DIR) $(BUILD_DIR)/$(ROM) verify -clean: +distclean: rm -rf asm bin assets $(BUILD_DIR) undefined_syms_auto.txt undefined_funcs_auto.txt +clean: + rm -rf $(BUILD_DIR) + submodules: git submodule update --init --recursive split: rm -rf $(DATA_DIRS) $(ASM_DIRS) && ./tools/n64splat/split.py $(SPLAT_YAML) -setup: clean submodules split +setup: distclean submodules split $(BUILD_DIR): echo $(C_FILES) @@ -315,7 +318,7 @@ $(BUILD_DIR)/$(ROM): $(BUILD_DIR)/$(TARGET).bin verify: $(BUILD_DIR)/$(ROM) md5sum -c checksum.md5 -.PHONY: all clean default split setup +.PHONY: all clean distclean default split setup print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true From edf3877f4dd12f7e046800aeabd2dd07e04051af Mon Sep 17 00:00:00 2001 From: tehzz Date: Thu, 29 Dec 2022 22:32:08 -0500 Subject: [PATCH 9/9] use builddir variable --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fd5eb6d..d6510c5 100644 --- a/Makefile +++ b/Makefile @@ -245,7 +245,7 @@ build/src/libultra/io/gbpakreadwrite.c.o: CC := $(CC_OLD) build/src/libultra/io/gbpakselectbank.c.o: CC := $(CC_OLD) # run ASM-processor on non-libultra source files -DECOMP_C_OBJS := $(filter %.c.o,$(filter-out build/src/libultra%,$(O_FILES))) +DECOMP_C_OBJS := $(filter %.c.o,$(filter-out $(BUILD_DIR)/src/libultra%,$(O_FILES))) $(DECOMP_C_OBJS): CC := $(ASMPROC) $(ASMPROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- # turn off syntax checking errors for libultra