Multiple F3DEX3 versions (#112)

* Working on it

* Loading ucode from ROM working

* Menu implemented

* Fixed ifdefs in debug

* Fixed crashing

* Cleanup

* Suppressed make auto generated messages

* Reorganized RSP wrapper assembly files

* Fixed merge bug
This commit is contained in:
Sauraen
2024-05-17 06:35:01 -07:00
committed by GitHub
parent b696dfffcd
commit cd5eb31dc8
33 changed files with 423 additions and 162 deletions

BIN
F3DEX3/F3DEX3_BrW.code.bps Normal file

Binary file not shown.

BIN
F3DEX3/F3DEX3_BrW.data.bps Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +1,4 @@
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-rules --no-print-directory
# Ensure the build fails if a piped command fails
SHELL = /bin/bash
@@ -122,9 +122,6 @@ ifeq ($(origin PACKAGE_VERSION), undefined)
endif
endif
F3DEX3 := F3DEX3
F3DEX3_BUILD := F3DEX3_BrW
ifeq ($(VERSION),hackeroot-mq)
CFLAGS += -DENABLE_HACKEROOT=1
CPPFLAGS += -DENABLE_HACKEROOT=1
@@ -298,6 +295,9 @@ S_FILES := $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(wildcard
O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \
$(foreach f,$(C_FILES:.c=.o),$(BUILD_DIR)/$f) \
$(foreach f,$(BASEROM_BIN_FILES),$(BUILD_DIR)/baserom/$(notdir $f).o)
UCODE_PATCHES := $(wildcard F3DEX3/*.bps)
UCODE_FILES := $(foreach f,$(UCODE_PATCHES:.bps=),$f)
UCODE_O_FILES := $(foreach f,$(UCODE_FILES),$(BUILD_DIR)/$f.o)
OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | grep -o '[^"]*_reloc.o' )
@@ -412,7 +412,7 @@ distclean: assetclean
$(V)$(RM) -r extracted/
$(V)$(RM) -r build/
$(V)$(MAKE) -C tools distclean
$(V)$(RM) -r F3DEX3/F3DEX3_BrW.code F3DEX3/F3DEX3_BrW.data
$(V)$(RM) -r F3DEX3/*.code F3DEX3/*.data
$(call print,Success!)
venv:
@@ -437,8 +437,6 @@ ifneq ($(VERSION),gc-eu-mq)
$(V)$(PYTHON) extract_assets.py -j$(N_THREADS) -v $(VERSION)
endif
$(call print,Extracting files: Done!)
$(MAKE) f3dex3
$(call print,Success!)
ifeq ($(VERSION),hackeroot-mq)
# TODO: proper fix (for .s files)
cp baseroms/hackeroot-mq/baserom-decompressed.z64 baseroms/gc-eu-mq-dbg/baserom-decompressed.z64
@@ -455,35 +453,33 @@ patch:
$(V)$(FLIPS) --create --bps $(BASEROM_PATCH) $(ROM) $(BPS)
$(call print,Success!)
f3dex3_extract:
$(V)$(PYTHON) tools/data_extractor.py --start 0xBCD0F0 --size 0x1630 --input $(BASEROM_DIR)/baserom-decompressed.z64 --output F3DEX3/f3dzex2.code
$(V)$(PYTHON) tools/data_extractor.py --start 0xBCE720 --size 0x420 --input $(BASEROM_DIR)/baserom-decompressed.z64 --output F3DEX3/f3dzex2.data
f3dex3_clean:
$(V)$(RM) -r F3DEX3/f3dzex2.code F3DEX3/f3dzex2.data
f3dex3:
$(call print,Patching the microcode...)
$(V)$(MAKE) f3dex3_extract
$(V)$(FLIPS) --apply F3DEX3/Patch/$(F3DEX3_BUILD).code.bps F3DEX3/f3dzex2.code $(F3DEX3)/$(F3DEX3_BUILD).code
$(V)$(FLIPS) --apply F3DEX3/Patch/$(F3DEX3_BUILD).data.bps F3DEX3/f3dzex2.data $(F3DEX3)/$(F3DEX3_BUILD).data
$(V)$(MAKE) f3dex3_clean
create_f3dex3_patches: F3DEX3/f3dzex2.code F3DEX3/f3dzex2.data
$(call print,Creating F3DEX3 patches...)
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW.code F3DEX3/F3DEX3_BrW.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW.data F3DEX3/F3DEX3_BrW.data.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_PA.code F3DEX3/F3DEX3_BrW_PA.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_PA.data F3DEX3/F3DEX3_BrW_PA.data.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_PB.code F3DEX3/F3DEX3_BrW_PB.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_PB.data F3DEX3/F3DEX3_BrW_PB.data.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_PC.code F3DEX3/F3DEX3_BrW_PC.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_PC.data F3DEX3/F3DEX3_BrW_PC.data.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_NOC.code F3DEX3/F3DEX3_BrW_NOC.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC.data F3DEX3/F3DEX3_BrW_NOC.data.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_NOC_PA.code F3DEX3/F3DEX3_BrW_NOC_PA.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC_PA.data F3DEX3/F3DEX3_BrW_NOC_PA.data.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_NOC_PB.code F3DEX3/F3DEX3_BrW_NOC_PB.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC_PB.data F3DEX3/F3DEX3_BrW_NOC_PB.data.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3_BrW_NOC_PC.code F3DEX3/F3DEX3_BrW_NOC_PC.code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3_BrW_NOC_PC.data F3DEX3/F3DEX3_BrW_NOC_PC.data.bps
$(call print,Success!)
f3dex3_patch:
$(V)$(MAKE) f3dex3_extract
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.code $(F3DEX3)/$(F3DEX3_BUILD).code F3DEX3/Patch/$(F3DEX3_BUILD).code.bps
$(V)$(FLIPS) --create --bps F3DEX3/f3dzex2.data $(F3DEX3)/$(F3DEX3_BUILD).data F3DEX3/Patch/$(F3DEX3_BUILD).data.bps
$(V)$(MAKE) f3dex3_clean
.PHONY: all rom compress clean assetclean distclean venv setup run wad patch f3dex3 f3dex3_patch f3dex3_extract f3dex3_clean verify
verify:
$(V)$(MAKE) clean
$(V)$(MAKE) rom
@md5sum $(ROM)
.PHONY: all rom compress clean assetclean distclean venv setup run wad iso patch f3dex3 verify
.PHONY: all rom compress clean assetclean distclean venv setup run wad iso patch create_f3dex3_patches verify
.DEFAULT_GOAL := rom
#### Various Recipes ####
@@ -503,7 +499,7 @@ else
endif
$(V)$(PYTHON) -m ipl3checksum sum --cic 6105 --update $@
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/undefined_syms.txt
$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(UCODE_O_FILES) $(LDSCRIPT) $(BUILD_DIR)/undefined_syms.txt
$(V)$(LD) -T $(LDSCRIPT) -T $(BUILD_DIR)/undefined_syms.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(MAP) -o $@
## Order-only prerequisites
@@ -519,28 +515,32 @@ $(O_FILES): | asset_files
.PHONY: o_files asset_files
$(BUILD_DIR)/$(SPEC): $(SPEC)
$(call print,Compiling:,$<,$@)
$(call print,Preprocessing:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) $< | $(SPEC_REPLACE_VARS) > $@
$(LDSCRIPT): $(BUILD_DIR)/$(SPEC)
$(call print,Linking:,$<,$@)
$(call print,Creating linker script:,$<,$@)
$(V)$(MKLDSCRIPT) $< $@
$(BUILD_DIR)/undefined_syms.txt: undefined_syms.txt
$(call print,Compiling:,$<,$@)
$(call print,Preprocessing:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) $< > $@
$(BUILD_DIR)/baserom/%.o: $(EXTRACTED_DIR)/baserom/%
$(call print,Wrapping binary to ELF:,$<,$@)
$(V)$(OBJCOPY) -I binary -O elf32-big $< $@
$(BUILD_DIR)/F3DEX3/%.o: F3DEX3/%
$(call print,Wrapping binary to ELF:,$<,$@)
$(V)mkdir -p $(BUILD_DIR)/F3DEX3
$(V)$(OBJCOPY) -I binary -O elf32-big $< $@
$(BUILD_DIR)/data/%.o: data/%.s
$(call print,Relocating:,$<,$@)
$(call print,Assembling:,$<,$@)
$(V)$(AS) $(ASFLAGS) $< -o $@
$(BUILD_DIR)/data/rsp.rodata.f3dex3.o: F3DEX3/F3DEX3_BrW.code F3DEX3/F3DEX3_BrW.data
$(BUILD_DIR)/assets/text/%.enc.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.txt
$(call print,Compiling:,$<,$@)
$(call print,Encoding:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py - --output $@ --charmap assets/text/charmap.txt
# Dependencies for files including message data headers
@@ -617,6 +617,20 @@ $(BUILD_DIR)/assets/%.bin.inc.c: assets/%.bin
$(BUILD_DIR)/assets/%.jpg.inc.c: assets/%.jpg
$(V)$(ZAPD) bren -eh -i $< -o $@
F3DEX3/f3dzex2.code:
$(V)$(PYTHON) tools/data_extractor.py --start 0xBCD0F0 --size 0x1630 --input $(BASEROM_DIR)/baserom-decompressed.z64 --output $@
F3DEX3/f3dzex2.data:
$(V)$(PYTHON) tools/data_extractor.py --start 0xBCE720 --size 0x420 --input $(BASEROM_DIR)/baserom-decompressed.z64 --output $@
F3DEX3/F3DEX3%.code: F3DEX3/F3DEX3%.code.bps F3DEX3/f3dzex2.code
$(V)$(FLIPS) --apply F3DEX3/F3DEX3$*.code.bps F3DEX3/f3dzex2.code $@
F3DEX3/F3DEX3%.data: F3DEX3/F3DEX3%.data.bps F3DEX3/f3dzex2.data
$(V)$(FLIPS) --apply F3DEX3/F3DEX3$*.data.bps F3DEX3/f3dzex2.data $@
.PRECIOUS: $(UCODE_FILES)
-include $(DEP_FILES)
# Print target for debugging

View File

@@ -9,24 +9,10 @@
.balign 16
glabel aspMainDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCCE10, 0x2E0
glabel aspMainDataEnd
glabel gspF3DZEX2_NoN_PosLight_fifoTextStart
.incbin "F3DEX3/F3DEX3_BrW.code"
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCD0F0, 0x1630
glabel gspF3DZEX2_NoN_PosLight_fifoTextEnd
.balign 16
glabel gspF3DZEX2_NoN_PosLight_fifoDataStart
.incbin "F3DEX3/F3DEX3_BrW.data"
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCE720, 0x420
glabel gspF3DZEX2_NoN_PosLight_fifoDataEnd
.balign 16
glabel gspS2DEX2d_fifoDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCEB40, 0x390
glabel gspS2DEX2d_fifoDataEnd
glabel njpgdspMainDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCEED0, 0x60
glabel njpgdspMainDataEnd

View File

@@ -9,22 +9,30 @@
.balign 16
glabel rspbootTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0x9F20, 0xD0
glabel rspbootTextEnd
glabel aspMainTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xB89260, 0xFB0
glabel aspMainTextEnd
glabel aspMainDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCCE10, 0x2E0
glabel aspMainDataEnd
glabel gspF3DZEX2_NoN_PosLight_fifoTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCD0F0, 0x1630
glabel gspF3DZEX2_NoN_PosLight_fifoTextEnd
glabel gspF3DZEX2_NoN_PosLight_fifoDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCE720, 0x420
glabel gspF3DZEX2_NoN_PosLight_fifoDataEnd
glabel gspS2DEX2d_fifoTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xB8A210, 0x18C0
glabel gspS2DEX2d_fifoTextEnd
glabel gspS2DEX2d_fifoDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCEB40, 0x390
glabel gspS2DEX2d_fifoDataEnd
glabel njpgdspMainTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xB8BAD0, 0xAF0
glabel njpgdspMainTextEnd
glabel njpgdspMainDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCEED0, 0x60
glabel njpgdspMainDataEnd

View File

@@ -1,22 +0,0 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
.section .text
.balign 16
glabel aspMainTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xB89260, 0xFB0
glabel aspMainTextEnd
glabel gspS2DEX2d_fifoTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xB8A210, 0x18C0
glabel gspS2DEX2d_fifoTextEnd
glabel njpgdspMainTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xB8BAD0, 0xAF0
glabel njpgdspMainTextEnd

Some files were not shown because too many files have changed in this diff Show More