Add uncompressed (lol)

This commit is contained in:
CrashOveride95
2021-04-18 13:37:52 -04:00
parent 69c5d0cbb1
commit 51c34079b3
4 changed files with 25 additions and 2 deletions

View File

@@ -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
#==============================================================================#

View File

@@ -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

View File

@@ -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

4
uncomprules.mk Normal file
View File

@@ -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 $@