Using decompression bios functions (solved)

Post Reply
Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Using decompression bios functions (solved)

Post by Sylus101 » 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:

Code: Select all

decompress(bg_buffer, BG_GFX_SUB, LZ77Vram);
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?
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

User avatar
vuurrobin
Posts: 219
Joined: Fri Jul 11, 2008 8:49 pm
Location: The Netherlands
Contact:

Re: Using decompression bios functions (solved)

Post by vuurrobin » Fri Sep 11, 2009 9:51 am

grit has options to compress the output itself.

the Graphics\Backgrounds\16bit_color_bmp example uses LZ77 (de)compression, so you might want to check that out.

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Using decompression bios functions (solved)

Post by WinterMute » Fri Sep 11, 2009 10:08 am

There's also gbalzss, included with devkitARM for compressing other files.

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: Using decompression bios functions (solved)

Post by Sylus101 » Fri Sep 11, 2009 7:03 pm

@vurrobin, yup... I did end up seeing that but edited and didn't want to totally dump the rest of the post.

@Wintermute, thanks much, I'm using it primarily for compression of binary background bmp files but I'll keep this in mind. Thanks!
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests