diff --git a/Makefile b/Makefile index d30016a4..8bb28927 100755 --- a/Makefile +++ b/Makefile @@ -133,15 +133,15 @@ FIXCHECKSUMS = python3 $(TOOLS_DIR)/python/calc_func_checksums.py $(VERSION) TEXBUILDER = $(TOOLS_DIR)/dkr_texbuilder COMPRESS = $(TOOLS_DIR)/dkr_decompressor -c -LIB_DIRS := lib -ASM_DIRS := asm asm/boot asm/assets data lib/asm -SRC_DIRS := src lib/src lib/src/al lib/src/os +LIB_DIRS := lib/ +ASM_DIRS := asm/ asm/boot/ asm/assets/ lib/asm/ +SRC_DIRS := $(sort $(dir $(wildcard src/*/ src/**/*/))) $(sort $(dir $(wildcard lib/src/*/ lib/src/**/*/))) -GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(wildcard src/*.c lib/src/*.c) +GLOBAL_ASM_C_FILES != grep -rl 'GLOBAL_ASM(' $(SRC_DIRS) GLOBAL_ASM_O_FILES = $(foreach file,$(GLOBAL_ASM_C_FILES),$(BUILD_DIR)/$(file:.c=.o)) -S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s)) -C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) +S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)*.s)) +C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)*.c)) # Object files O_FILES := $(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o)) \ @@ -260,6 +260,7 @@ $(BUILD_DIR)/lib/%.o: OPT_FLAGS := -O2 $(BUILD_DIR)/lib/%.o: MIPSISET := -mips2 $(BUILD_DIR)/lib/src/al/%.o: OPT_FLAGS := -O3 $(BUILD_DIR)/lib/src/os/%.o: OPT_FLAGS := -O1 +$(BUILD_DIR)/lib/src/os/osViMgr.o: OPT_FLAGS := -O2 $(BUILD_DIR)/lib/src/unknown_0C91A0.o : OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0D29F0.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/unknown_0CDE90.o: OPT_FLAGS := -O1 @@ -270,8 +271,9 @@ $(BUILD_DIR)/lib/src/unknown_0C9C90.o: OPT_FLAGS := -O2 -Wo,-loopunroll,0 $(BUILD_DIR)/lib/src/osEepromWrite.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osEepromRead.o: OPT_FLAGS := -O1 $(BUILD_DIR)/lib/src/osSetTimer.o: OPT_FLAGS := -O1 -$(BUILD_DIR)/lib/src/osTimer.o: OPT_FLAGS := -O1 -$(BUILD_DIR)/lib/src/osViMgr.o: OPT_FLAGS := -O2 + +# asm-processor currently does not support -O3, so this is my workaround. +$(BUILD_DIR)/lib/src/al/global_asm/%.o: OPT_FLAGS := -O2 ######################## Targets ############################# diff --git a/asm/non_matchings/unknown_0C81A0/_bnkfPatchBank.s b/lib/asm/non_matchings/alBnkfNew/_bnkfPatchBank.s similarity index 100% rename from asm/non_matchings/unknown_0C81A0/_bnkfPatchBank.s rename to lib/asm/non_matchings/alBnkfNew/_bnkfPatchBank.s diff --git a/asm/non_matchings/unknown_0C81A0/alBnkfNew.s b/lib/asm/non_matchings/alBnkfNew/alBnkfNew.s similarity index 100% rename from asm/non_matchings/unknown_0C81A0/alBnkfNew.s rename to lib/asm/non_matchings/alBnkfNew/alBnkfNew.s diff --git a/asm/non_matchings/unknown_0C81A0/alSeqFileNew.s b/lib/asm/non_matchings/alBnkfNew/alSeqFileNew.s similarity index 100% rename from asm/non_matchings/unknown_0C81A0/alSeqFileNew.s rename to lib/asm/non_matchings/alBnkfNew/alSeqFileNew.s diff --git a/lib/src/al/global_asm/README.txt b/lib/src/al/global_asm/README.txt new file mode 100644 index 00000000..178962d5 --- /dev/null +++ b/lib/src/al/global_asm/README.txt @@ -0,0 +1 @@ +This folder contains source files that still have GLOBAL_ASM() in them. This is necessary because asm-processor currently does not yet support -O3. \ No newline at end of file diff --git a/src/unknown_0C81A0.c b/lib/src/al/global_asm/alBnkfNew.c similarity index 52% rename from src/unknown_0C81A0.c rename to lib/src/al/global_asm/alBnkfNew.c index 0b30edd0..8396dbf6 100644 --- a/src/unknown_0C81A0.c +++ b/lib/src/al/global_asm/alBnkfNew.c @@ -7,6 +7,6 @@ void dummy_800C75A0(void) {} void dummy_800C75A8(void) {} -GLOBAL_ASM("asm/non_matchings/unknown_0C81A0/_bnkfPatchBank.s") -GLOBAL_ASM("asm/non_matchings/unknown_0C81A0/alBnkfNew.s") -GLOBAL_ASM("asm/non_matchings/unknown_0C81A0/alSeqFileNew.s") +GLOBAL_ASM("lib/asm/non_matchings/alBnkfNew/_bnkfPatchBank.s") +GLOBAL_ASM("lib/asm/non_matchings/alBnkfNew/alBnkfNew.s") +GLOBAL_ASM("lib/asm/non_matchings/alBnkfNew/alSeqFileNew.s") diff --git a/lib/src/guMtxUtil.c b/lib/src/gu/guMtxUtil.c similarity index 100% rename from lib/src/guMtxUtil.c rename to lib/src/gu/guMtxUtil.c diff --git a/lib/src/osEepromRead.c b/lib/src/os/osEepromRead.c similarity index 100% rename from lib/src/osEepromRead.c rename to lib/src/os/osEepromRead.c diff --git a/lib/src/osEepromWrite.c b/lib/src/os/osEepromWrite.c similarity index 100% rename from lib/src/osEepromWrite.c rename to lib/src/os/osEepromWrite.c diff --git a/lib/src/osSetTimer.c b/lib/src/os/osSetTimer.c similarity index 100% rename from lib/src/osSetTimer.c rename to lib/src/os/osSetTimer.c diff --git a/lib/src/osTimer.c b/lib/src/os/osTimer.c similarity index 100% rename from lib/src/osTimer.c rename to lib/src/os/osTimer.c diff --git a/lib/src/osViMgr.c b/lib/src/os/osViMgr.c similarity index 100% rename from lib/src/osViMgr.c rename to lib/src/os/osViMgr.c diff --git a/lib/src/osViSetEventMsg.c b/lib/src/os/osViSetEventMsg.c similarity index 100% rename from lib/src/osViSetEventMsg.c rename to lib/src/os/osViSetEventMsg.c diff --git a/tools/python/generate_ld.py b/tools/python/generate_ld.py index 83adfc4a..9d36482d 100644 --- a/tools/python/generate_ld.py +++ b/tools/python/generate_ld.py @@ -22,12 +22,12 @@ BUILD_DIR = 'build/' + VERSION LATE_DATA_FILES = [ BUILD_DIR + '/lib/src/unknown_0D43F0.o', - BUILD_DIR + '/lib/src/osTimer.o', + BUILD_DIR + '/lib/src/os/osTimer.o', BUILD_DIR + '/lib/src/unknown_0D3020.o' ] BSS_LIB_ORDER_FILES = [ - BUILD_DIR + '/lib/src/osViMgr.o', + BUILD_DIR + '/lib/src/os/osViMgr.o', BUILD_DIR + '/lib/src/os/osSetEventMesg.o', BUILD_DIR + '/lib/src/unknown_0CD820.o', BUILD_DIR + '/lib/src/unknown_0CE200.o'