You are not logged in.
Pages: 1
Here's the m3 self extractor stub and (slow) compression tool.
Right now the compression tool is very slow, and not yet optimal. Because the compression is simple, it doesn't compress the file by that much. However, the algorithm was designed for maximizing decompression speed, it's only slightly slower than memcpy.
If you want to try out these programs, just use lztest to create a compressed file (it takes a long time, sorry), then append the generated file to the end of the m3decompress.gba stub file. When run on a GBA, the screen first turns red to indicate that it is doing a memcpy to transfer the file to the end of RAM, then turns blue to indicate that it is decompressing the file. I've tested it on an M3 microSD, and it works. It's supposed to support the M3, G6, and Supercard, but since the supercard already does decompression (if you enable that option :), it's kinda pointless for that card.
File format of compression:
All values are signed words.
Look at word:
If positive: Copy the next N words to the destination
If negative: Go back N words in the destination, then read the next word in the source to see how many words to transfer from earlier in the file. This only takes up 2 words in the compressed file, and is the LZ-like part of the decompression.
If zero: Finished
Or in other words:
u32 A,B;
do
{
A = *src;
src++;
if (A>0)
{
memcpy(dest,src,A*sizeof(u32));
dest+=A;
src+=A;
}
if (A<0)
{
u32* back = dest+A;
B = *src;
src++;
memcpy(dest,back,B*sizeof(u32)); //this will overlap
dest+=B;
}
if (A==0)
{
break;
}
} while(1);
"We are merely sprites that dance at the beck and call of our button pressing overlord."
Offline
Pages: 1