diff --git a/Makefile b/Makefile index 397260a3..05d9afc2 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ endif DEFINES += NO_ERRNO_H=1 NO_GZIP=1 COMPRESS ?= yay0 -$(eval $(call validate-option,COMPRESS,mio0 yay0 gzip rnc1 rnc2)) +$(eval $(call validate-option,COMPRESS,mio0 yay0 gzip rnc1 rnc2 uncomp)) ifeq ($(COMPRESS),gzip) DEFINES += GZIP=1 else ifeq ($(COMPRESS),rnc1) @@ -70,6 +70,8 @@ else ifeq ($(COMPRESS),yay0) DEFINES += YAY0=1 else ifeq ($(COMPRESS),mio0) DEFINES += MIO0=1 +else ifeq ($(COMPRESS),uncomp) + DEFINES += UNCOMPRESSED=1 endif GZIPVER ?= std @@ -600,6 +602,8 @@ else ifeq ($(COMPRESS),yay0) include yay0rules.mk else ifeq ($(COMPRESS),mio0) include mio0rules.mk +else ifeq ($(COMPRESS),uncomp) +include uncomprules.mk endif #==============================================================================# diff --git a/README.md b/README.md index f2be7c6d..7c000493 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,12 @@ Both methods are fast. Method 1 has better compression than 2, so I suggest usin To switch to RNC, run make with either ``COMPRESS=rnc1`` or ``COMPRESS=rnc2``, depending on preferred method. +The repo also supports building a ROM with no compression. + +This is not recommended as it increases ROM size significantly, with little point other than load times decreased to almost nothing. + +To switch to no compression, run make with the ``COMPRESS=uncomp`` argument. + ## FAQ diff --git a/src/game/memory.c b/src/game/memory.c index 2dd33eb6..c2d63b4e 100644 --- a/src/game/memory.c +++ b/src/game/memory.c @@ -343,12 +343,17 @@ void *load_segment_decompress(s32 segment, u8 *srcStart, u8 *srcEnd) { // Decompressed size from end of gzip u32 *size = (u32 *) (compressed + compSize); #else - // Decompressed size from mio0 header + // Decompressed size from header (This works for non-mio0 because they also have the size in same place) u32 *size = (u32 *) (compressed + 4); #endif if (compressed != NULL) { +#ifdef UNCOMPRESSED + dest = main_pool_alloc(compSize, MEMORY_POOL_LEFT); + dma_read(dest, srcStart, srcEnd); +#else dma_read(compressed, srcStart, srcEnd); dest = main_pool_alloc(*size, MEMORY_POOL_LEFT); +#endif if (dest != NULL) { osSyncPrintf("start decompress\n"); #ifdef GZIP @@ -386,7 +391,11 @@ void *load_segment_decompress_heap(u32 segment, u8 *srcStart, u8 *srcEnd) { u32 *size = (u32 *) (compressed + compSize); #endif if (compressed != NULL) { +#ifdef UNCOMPRESSED + dma_read(gDecompressionHeap, srcStart, srcEnd); +#else dma_read(compressed, srcStart, srcEnd); +#endif #ifdef GZIP expand_gzip(compressed, gDecompressionHeap, compSize, (u32)size); #elif RNC1 diff --git a/uncomprules.mk b/uncomprules.mk new file mode 100644 index 00000000..6c13f5fa --- /dev/null +++ b/uncomprules.mk @@ -0,0 +1,4 @@ +# convert binary to object file +$(BUILD_DIR)/%.szp.o: $(BUILD_DIR)/%.bin + $(call print,Converting BIN to ELF:,$<,$@) + $(V)printf ".section .data\n\n.incbin \"$<\"\n" | $(AS) $(ASFLAGS) -o $@ \ No newline at end of file