Skip to content

Commit

Permalink
Merge pull request #3 from Dragorn421/compression
Browse files Browse the repository at this point in the history
Compression with crunch64
  • Loading branch information
AngheloAlf committed Jan 24, 2024
2 parents a6dc43b + 02be543 commit 0bce502
Show file tree
Hide file tree
Showing 85 changed files with 406 additions and 28,019 deletions.
17 changes: 7 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ AS := $(MIPS_BINUTILS_PREFIX)as
LD := $(MIPS_BINUTILS_PREFIX)ld
OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy
OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
NM := $(MIPS_BINUTILS_PREFIX)nm

N64_EMULATOR ?=

Expand Down Expand Up @@ -159,12 +160,6 @@ endif

OBJDUMP_FLAGS := -d -r -z -Mreg-names=32

# rom compression flags
COMPFLAGS := --threads $(N_THREADS)
ifneq ($(NON_MATCHING),1)
COMPFLAGS += --matching
endif

#### Files ####

# ROM image
Expand Down Expand Up @@ -314,8 +309,10 @@ all: rom compressed
$(ROM): $(ELF)
$(ELF2ROM) -cic 6105 $< $@

$(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/$(SPEC)
$(PYTHON) tools/z64compress_wrapper.py $(COMPFLAGS) $(ROM) $@ $(ELF) $(BUILD_DIR)/$(SPEC)
$(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/compress_ranges.txt
# note: $(BUILD_DIR)/compress_ranges.txt should only be used for nonmatching builds. it works by chance for matching builds too though
$(PYTHON) tools/compress.py --in $(ROM) --out $@ --dma-range `./tools/dmadata_range.sh $(NM) $(ELF)` --compress `cat $(BUILD_DIR)/compress_ranges.txt` --threads $(N_THREADS)
$(PYTHON) -m ipl3checksum sum --cic 6105 --update $@

$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(BUILD_DIR)/ldscript.txt $(BUILD_DIR)/undefined_syms.txt
$(LD) -T $(BUILD_DIR)/undefined_syms.txt -T $(BUILD_DIR)/ldscript.txt --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(BUILD_DIR)/z64.map -o $@
Expand Down Expand Up @@ -365,8 +362,8 @@ $(BUILD_DIR)/assets/%.o: assets/%.c
$(BUILD_DIR)/src/%.o: src/%.s
$(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@

$(BUILD_DIR)/dmadata_table_spec.h: $(BUILD_DIR)/$(SPEC)
$(MKDMADATA) $< $@
$(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR)/$(SPEC)
$(MKDMADATA) $< $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt

# Dependencies for files that may include the dmadata header automatically generated from the spec file
$(BUILD_DIR)/src/boot/z_std_dma.o: $(BUILD_DIR)/dmadata_table_spec.h
Expand Down
5 changes: 1 addition & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Setup
# Setup and compression
crunch64>=0.3.1,<1.0.0
ipl3checksum>=1.2.0,<2.0.0

# Compression
pyelftools>=0.26
2 changes: 0 additions & 2 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ endif
all: $(PROGRAMS)
$(MAKE) -C ZAPD
$(MAKE) -C fado
$(MAKE) -C z64compress

clean:
$(RM) $(PROGRAMS) $(addsuffix .exe,$(PROGRAMS))
$(MAKE) -C ZAPD clean
$(MAKE) -C fado clean
$(MAKE) -C z64compress clean

distclean: clean

Expand Down
Loading

0 comments on commit 0bce502

Please sign in to comment.