mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-26 22:40:33 +00:00
45bfe61037
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (i686, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (i686, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-macos (Debug, custom) (push) Blocked by required conditions
Build C code / build-macos (Debug, lle) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, lle) (push) Blocked by required conditions
Build C code / build-windows (Debug, custom) (push) Blocked by required conditions
Build C code / build-windows (Debug, lle) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, lle) (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
Mostly an inconsequential function, but we can learn a whole lot from this one. 1. Lots more symbols added to PSP. This function touches a lot of previously-unseen things in PSP. 2. This is the first PSP function to print a string. Importantly, PSP puts strings in `data`, not `rodata`! Luckily, the process of pulling them in is simple and easy, as demonstrated here. 3. I modified the Makefile for the -O4 stuff. At this point I think DRA is `O4` and all the overlays are `O0`. We can always make the logic more complicated later if we need to. 4. We discovered a discrepancy in the size of DR_ENV on PSP. I suspect we will have more SDK differences, but we will find them function by function. I decided to set the size in a variable so that we can put all the version differences at the top of the file, instead of them being more scattered. I think that's it!
97 lines
3.6 KiB
Makefile
97 lines
3.6 KiB
Makefile
# Configuration
|
|
BUILD_DIR := build/pspeu
|
|
PSP_EU_TARGETS := dra stwrp tt_000
|
|
|
|
# Flags
|
|
AS_FLAGS += -EL -I include/ -G0 -march=allegrex -mabi=eabi
|
|
MWCCPSP_FLAGS := -gccinc -Iinclude -D_internal_version_$(VERSION) -c -lang c -sdatathreshold 0 -char unsigned
|
|
MWLDPSP_FLAGS := -partial -nostdlib -msgstyle gcc -sym full,elf -g
|
|
|
|
# Tools
|
|
ALLEGREX_AS := $(BIN_DIR)/allegrex-as
|
|
AS := $(ALLEGREX_AS)
|
|
WIBO := $(BIN_DIR)/wibo
|
|
MWCCPSP := $(BIN_DIR)/mwccpsp.exe
|
|
CCPSP := MWCIncludes=$(BIN_DIR) $(WIBO) $(MWCCPSP)
|
|
|
|
MWASPSP := $(WIBO) $(BIN_DIR)/asm_psp_elf.exe -gnu
|
|
MWLDPSP := $(WIBO) $(BIN_DIR)/mwldpsp.exe
|
|
|
|
MWCCGAP_DIR := $(TOOLS_DIR)/mwccgap
|
|
MWCCGAP_APP := $(MWCCGAP_DIR)/mwccgap.py
|
|
MWCCGAP := $(PYTHON) $(MWCCGAP_APP)
|
|
|
|
SPLAT_PIP := splat split
|
|
|
|
# Helper Functions
|
|
define list_src_files_psp
|
|
$(foreach dir,$(ASM_DIR)/$(1),$(wildcard $(dir)/**.s))
|
|
$(foreach dir,$(ASM_DIR)/$(1)/data,$(wildcard $(dir)/**.s))
|
|
$(foreach dir,$(SRC_DIR)/$(1),$(wildcard $(dir)/**.c))
|
|
$(foreach dir,$(ASSETS_DIR)/$(1),$(wildcard $(dir)/**))
|
|
endef
|
|
|
|
define list_o_files_psp
|
|
$(foreach file,$(call list_src_files_psp,$(1)),$(BUILD_DIR)/$(file).o)
|
|
endef
|
|
|
|
# Targets
|
|
build_pspeu: $(addsuffix _psp,$(PSP_EU_TARGETS))
|
|
|
|
extract_pspeu: $(addprefix $(BUILD_DIR)/,$(addsuffix .ld,$(PSP_EU_TARGETS)))
|
|
|
|
$(WIBO):
|
|
wget -O $@ https://github.com/decompals/wibo/releases/download/0.6.13/wibo
|
|
sha256sum --check $(WIBO).sha256
|
|
chmod +x $(WIBO)
|
|
$(MWCCPSP): $(WIBO) $(BIN_DIR)/mwccpsp_219
|
|
|
|
$(MWCCGAP_APP):
|
|
git submodule init $(MWCCGAP_DIR)
|
|
git submodule update $(MWCCGAP_DIR)
|
|
|
|
dra_psp: $(BUILD_DIR)/dra.bin
|
|
tt_000_psp: $(BUILD_DIR)/tt_000.bin
|
|
stwrp_psp: $(BUILD_DIR)/wrp.bin
|
|
|
|
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf
|
|
$(OBJCOPY) -O binary $< $@
|
|
$(BUILD_DIR)/wrp.bin: $(BUILD_DIR)/stwrp.elf
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
$(BUILD_DIR)/dra.ld: $(CONFIG_DIR)/splat.pspeu.dra.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.pspeu.dra.txt
|
|
$(SPLAT_PIP) $<
|
|
$(BUILD_DIR)/st%.ld: $(CONFIG_DIR)/splat.pspeu.st%.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.pspeu.st%.txt
|
|
$(SPLAT_PIP) $<
|
|
$(BUILD_DIR)/tt_%.ld: $(CONFIG_DIR)/splat.pspeu.tt_%.yaml $(PSX_BASE_SYMS) $(CONFIG_DIR)/symbols.pspeu.tt_%.txt
|
|
$(SPLAT_PIP) $<
|
|
|
|
ST_DRA_MERGE = 624DC
|
|
$(BUILD_DIR)/dra.elf: $(BUILD_DIR)/dra.ld $(addprefix $(BUILD_DIR)/src/dra/,$(addsuffix .c.o,$(ST_DRA_MERGE))) $$(call list_o_files_psp,dra_psp)
|
|
$(call link,dra,$@)
|
|
$(BUILD_DIR)/tt_%.elf: $(BUILD_DIR)/tt_%.ld $$(call list_o_files_psp,servant/tt_$$*) $(BUILD_DIR)/assets/servant/tt_%/mwo_header.bin.o
|
|
$(call link,tt_$*,$@)
|
|
|
|
ST_WRP_MERGE = st_update e_particles e_room_fg st_common st_debug e_breakable popup warp e_red_door
|
|
$(BUILD_DIR)/stwrp.elf: $(BUILD_DIR)/stwrp.ld $(addprefix $(BUILD_DIR)/src/st/wrp/,$(addsuffix .c.o,$(ST_WRP_MERGE))) $$(call list_o_files_psp,st/wrp_psp) $(BUILD_DIR)/assets/st/wrp/mwo_header.bin.o
|
|
$(call link,stwrp,$@)
|
|
|
|
# Recipes
|
|
$(BUILD_DIR)/%.s.o: %.s
|
|
@mkdir -p $(dir $@)
|
|
$(AS) $(AS_FLAGS) -o $@ $<
|
|
|
|
# DRA appears to be compiled with -O4,p. This will control that flag.
|
|
# May need to modify if other -O4,p functions are found in other overlays.
|
|
# Works for now. Look in git history for a different approach which filters by individual .o file.
|
|
OPT_HIGH = -O4,p #need this because otherwise the comma breaks the if-statement
|
|
OPTIMIZATION = $(if $(findstring dra, $@), $(OPT_HIGH), -Op)
|
|
|
|
$(BUILD_DIR)/%.c.o: %.c $(MWCCPSP) $(MWCCGAP_APP)
|
|
@mkdir -p $(dir $@)
|
|
$(MWCCGAP) $< $@ --mwcc-path $(MWCCPSP) --use-wibo --wibo-path $(WIBO) --as-path $(AS) --asm-dir-prefix asm/pspeu $(MWCCPSP_FLAGS) $(OPTIMIZATION)
|
|
|
|
$(BUILD_DIR)/assets/%/mwo_header.bin.o: assets/%/mwo_header.bin
|
|
@mkdir -p $(dir $@)
|
|
$(LD) -r -b binary -o $@ $<
|