Using decompression bios functions (solved)
Posted: Tue Sep 08, 2009 8:44 pm
EDIT - Okay, I'm a moron... grit has a compression option. Sigh... I'm all set.
Hello everyone,
I'm testing out using lz77 compression and decompression to load a couple of screens where speed is not an issue. I'm not having much luck, though, I'm just getting garbage on screen. Here's what I've done so far:
I have a binary file (output from grit) in the filesystem. Loading into a buffer and then using DMA to copy that to VRAM currently works fine.
I've taken that binary file and ran it through a compression utility downloaded and compiled from here:
http://bcl.comli.eu/
I tried huffman, rle and lz77 and the best was lz77 compressing a 49152 byte binary file down to 1220 bytes.
I modified my code to just read this file into the buffer instead and instead of using DMA to copy to VRAM (BG_GFX_SUB in this case) I used decompress, basically like this:
It doesn't crash or anything, but I do get just garbage...
I was wondering if perhaps the tool I used just doesn't have the algorithm right... I really have no idea how to know. Does anyone use a simple tool that can compress to lz77, huffman or rle that is confirmed to create files that decompress correctly on the DS?
EDIT - After searching around a bit I'm reading the the GBA/NDS decompresses lzSS and not lz77... is this correct?
Hello everyone,
I'm testing out using lz77 compression and decompression to load a couple of screens where speed is not an issue. I'm not having much luck, though, I'm just getting garbage on screen. Here's what I've done so far:
I have a binary file (output from grit) in the filesystem. Loading into a buffer and then using DMA to copy that to VRAM currently works fine.
I've taken that binary file and ran it through a compression utility downloaded and compiled from here:
http://bcl.comli.eu/
I tried huffman, rle and lz77 and the best was lz77 compressing a 49152 byte binary file down to 1220 bytes.
I modified my code to just read this file into the buffer instead and instead of using DMA to copy to VRAM (BG_GFX_SUB in this case) I used decompress, basically like this:
Code: Select all
decompress(bg_buffer, BG_GFX_SUB, LZ77Vram);
I was wondering if perhaps the tool I used just doesn't have the algorithm right... I really have no idea how to know. Does anyone use a simple tool that can compress to lz77, huffman or rle that is confirmed to create files that decompress correctly on the DS?
EDIT - After searching around a bit I'm reading the the GBA/NDS decompresses lzSS and not lz77... is this correct?