diff --git a/.gitignore b/.gitignore index 3f539c05..c35abb3e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ expected __pycache__ .splat/ starfox64.ld +starfox64.uncompressed.ld starfox64.us.yaml *.d *_auto.ld diff --git a/Makefile b/Makefile index ec4bc315..f7104902 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,8 @@ TARGET := starfox64 ### Output ### BUILD_DIR := build -ROM := $(BUILD_DIR)/$(TARGET).$(VERSION).z64 +ROM := $(BUILD_DIR)/$(TARGET).$(VERSION).uncompressed.z64 +ROMC := $(BUILD_DIR)/$(TARGET).$(VERSION).z64 ELF := $(BUILD_DIR)/$(TARGET).$(VERSION).elf LD_MAP := $(BUILD_DIR)/$(TARGET).$(VERSION).map LD_SCRIPT := linker_scripts/$(VERSION)/$(TARGET).ld @@ -93,7 +94,9 @@ ASM_PROC_FLAGS := --input-enc=utf-8 --output-enc=euc-jp --convert-statics=globa SPLAT ?= tools/splat/split.py SPLAT_YAML ?= $(TARGET).$(VERSION).yaml +COMPTOOL := tools/comptool.py +PYTHON := python3 IINC := -Iinclude -Ibin/$(VERSION) -I. IINC += -Ilib/ultralib/include -Ilib/ultralib/include/PR -Ilib/ultralib/include/ido @@ -188,23 +191,34 @@ build/src/libultra/2D300.o: OPTFLAGS := -O1 -g0 # cc & asm-processor build/src/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- -all: uncompressed +all: uncompressed compressed init: $(MAKE) clean + $(MAKE) decompress $(MAKE) extract -j $(nproc) $(MAKE) all -j $(nproc) +# $(MAKE) compress +# TODO: COMPRESS resulting rom. uncompressed: $(ROM) ifneq ($(COMPARE),0) @md5sum $(ROM) + @md5sum -c $(TARGET).$(VERSION).uncompressed.md5 +endif + +compressed: $(ROMC) +ifeq ($(COMPARE),1) + @md5sum $(ROMC) @md5sum -c $(TARGET).$(VERSION).md5 endif - - #### Main Targets ### +decompress: baserom.us.z64 + @echo "Decompressing ROM..." + @$(PYTHON) $(COMPTOOL) -d $(BASEROM) ./baserom.us.uncompressed.z64 + extract: $(RM) -r asm/$(VERSION) bin/$(VERSION) $(CAT) yamls/$(VERSION)/header.yaml yamls/$(VERSION)/makerom.yaml yamls/$(VERSION)/main.yaml > $(SPLAT_YAML) @@ -233,6 +247,11 @@ expected: $(ROM): $(ELF) $(OBJCOPY) -O binary $< $@ + +$(ROMC): baserom.us.uncompressed.z64 + @echo "Compressing ROM..." + @$(PYTHON) $(COMPTOOL) -c ./baserom.us.uncompressed.z64 ./build/starfox64.us.z64 + # TODO: update rom header checksum # TODO: avoid using auto/undefined diff --git a/starfox64.us.md5 b/starfox64.us.md5 index ec4f9c18..e4f33584 100644 --- a/starfox64.us.md5 +++ b/starfox64.us.md5 @@ -1 +1 @@ -23e24fb0f090c6c0b3793a96169dce51 ./build/starfox64.us.z64 \ No newline at end of file +741a94eee093c4c8684e66b89f8685e8 ./build/starfox64.us.z64 \ No newline at end of file diff --git a/starfox64.us.uncompressed.md5 b/starfox64.us.uncompressed.md5 new file mode 100644 index 00000000..2746c21b --- /dev/null +++ b/starfox64.us.uncompressed.md5 @@ -0,0 +1 @@ +23e24fb0f090c6c0b3793a96169dce51 ./build/starfox64.us.uncompressed.z64 \ No newline at end of file diff --git a/tools/comptool.py b/tools/comptool.py index e8ce9ce5..688f8ea7 100644 --- a/tools/comptool.py +++ b/tools/comptool.py @@ -154,7 +154,7 @@ def decompress(baserom, decomprom, mio0, extract_dest=None): p_file_size = p_file_end - p_file_begin - # print(v_file_begin, p_file_begin, p_file_end, comp_flag) + #print(v_file_begin, p_file_begin, p_file_end, comp_flag) if(v_file_begin == 0 and p_file_end == 0): break diff --git a/yamls/us/header.yaml b/yamls/us/header.yaml index 01ee18b4..6d37eb99 100644 --- a/yamls/us/header.yaml +++ b/yamls/us/header.yaml @@ -1,13 +1,10 @@ name: Starfox64 (North America) -# baserom compressed -# sha1: 09f0d105f476b00efa5303a3ebc42e60a7753b7a -# baserom uncompressed -sha1: f7475fb11e7e6830f82883412638e8390791ab87 +sha1: f7475fb11e7e6830f82883412638e8390791ab87 # baserom uncompressed options: basename: starfox64 target_path: baserom.us.uncompressed.z64 - elf_path: build/starfox64.elf - ld_script_path: linker_scripts/us/starfox64.ld + elf_path: build/starfox64.uncompressed.elf + ld_script_path: linker_scripts/us/starfox64.uncompressed.ld base_path: . compiler: IDO find_file_boundaries: True diff --git a/yamls/us/starfox64.us.yaml.old b/yamls/us/starfox64.us.yaml.old deleted file mode 100755 index 3bcafa56..00000000 --- a/yamls/us/starfox64.us.yaml.old +++ /dev/null @@ -1,102 +0,0 @@ -name: Starfox64 (North America) -sha1: 09f0d105f476b00efa5303a3ebc42e60a7753b7a -options: - basename: starfox64 - target_path: baserom.us.z64 - elf_path: build/starfox64.elf - ld_script_path: linker_scripts/us/starfox64.ld - base_path: . - compiler: IDO - find_file_boundaries: True - header_encoding: ASCII - platform: n64 - undefined_funcs_auto_path: linker_scripts/us/auto/undefined_funcs_auto.ld - undefined_syms_auto_path: linker_scripts/us/auto/undefined_syms_auto.ld - - symbol_addrs_path: - - linker_scripts/us/symbol_addrs.txt - - linker_scripts/us/symbol_addrs_libultra.txt - - linker_scripts/us/ignored_addresses.txt - reloc_addrs_path: - - relocs/reloc_addrs.us.txt - - asm_path: asm/us - src_path: src - asset_path: bin/us - - build_path: build - - extensions_path: tools/splat_ext - mips_abi_float_regs: o32 - create_asm_dependencies: True - do_c_func_detection: True - o_as_suffix: True - gfx_ucode: f3dex - mnemonic_ljust: 12 - rom_address_padding: True - dump_symbols: True - include_macro_inc: False - libultra_symbols: True - hardware_regs: True - - ld_dependencies: True - - - use_legacy_include_asm: False - - asm_function_macro: glabel - asm_jtbl_label_macro: jlabel - asm_data_macro: dlabel - - # section_order: [".text", ".data", ".rodata", ".bss"] - # auto_all_sections: [".data", ".rodata", ".bss"] - - - - - - - - disasm_unknown: True - # string_encoding: ASCII - # data_string_encoding: ASCII - rodata_string_guesser_level: 2 - data_string_guesser_level: 2 - # libultra_symbols: True - # hardware_regs: True - # gfx_ucode: # one of [f3d, f3db, f3dex, f3dexb, f3dex2] -segments: - - name: header - type: header - start: 0x0 - - - name: boot - type: bin - start: 0x40 - - - name: entry - type: code - start: 0x1000 - vram: 0x80000400 - subsegments: - - [0x1000, asm] - - - name: main - type: code - start: 0x1050 - vram: 0x80000450 - follows_vram: entry - bss_size: 0x9B1F0 - subsegments: - - [0x1050, bin] - - [0x1270, bin] - - [0x3440, asm] #func_80002840 - - [0x35A8, asm] - - [0xC3EE0, data] - - [0xC8E40, rodata] - - { start: 0xDE480, type: bss, vram: 0x800DD880 } - - - type: bin - start: 0xDE480 - follows_vram: main - - [0xC00000]