The Four Seasons Cake nds lz77 compression

Read or post about compression. And decompression. Or ask questions how to decompress your files.
Post Reply
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 303 times

The Four Seasons Cake nds lz77 compression

Post by finale00 »

UPDATE: Now it works

Code: Select all

#Four Seasons Cake decompress

comtype LZ77WII
idstring "CMPR"
get SIZE asize
math SIZE -= 4
get NAME filename
clog NAME 4 SIZE SIZE
........................
OLD

viewtopic.php?f=16&t=8369

Can't seem to get this working.

Code: Select all

#Four Seasons Cake decompress

comtype lz77wii_raw10
idstring "CMPR"
get TYPE byte
get SIZE long
get ZSIZE asize
math ZSIZE -= 9
get NAME filename
savepos OFFSET
clog NAME OFFSET ZSIZE SIZE
Am I just using the wrong compression type?

Compressed and decompressed attached.
You do not have the required permissions to view the files attached to this post.
Last edited by finale00 on Wed Feb 22, 2012 6:54 pm, edited 1 time in total.
User avatar
aluigi
VVIP member
VVIP member
Posts: 1916
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 654 times
Contact:

Re: The Four Seasons Cake nds lz77 compression

Post by aluigi »

the error is in SIZE which is a threebyte number.

you can just use "comtype LZ77WII":

Code: Select all

comtype LZ77WII
get SIZE asize
math SIZE -= 4
clog "name.dat" 4 SIZE SIZE
the reason of the -4 is that the original code checks for the LZ77 signature while this one has CMPR

or use just comtype lz77wii_raw10 specifiying get SIZE threebyte
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 303 times

Re: The Four Seasons Cake nds lz77 compression

Post by finale00 »

Alright, it works :)
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 303 times

Re: The Four Seasons Cake nds lz77 compression

Post by finale00 »

Here's another game FF4 DS which uses lz77 compression also (well, the ones with 0x10 tag anyways)

It starts with 0x10, followed by the uncompressed size, followed by data.

So I try the same thing:

Code: Select all

comtype LZ77WII
get SIZE asize
get NAME filename
clog NAME 0 SIZE SIZE
But it doesn't decompress to the correct output size lol

This one works though:

Code: Select all

comtype LZ77WII_raw10
get type byte
get SIZE threebyte
get ZSIZE asize
math ZSIZE -= 4
get NAME filename
clog NAME 4 ZSIZE SIZE
What's wrong with the first one I wrote?
You do not have the required permissions to view the files attached to this post.
johnsonjeven
ultra-n00b
Posts: 1
Joined: Wed Oct 12, 2016 7:58 am

Re: The Four Seasons Cake nds lz77 compression

Post by johnsonjeven »

LZF is conceptually very similar to LZ77. Generally speaking most modern compression algorithms give roughly the same compression, and with regard to the number of cores that you can use at once, it is up to you to decide how many you want to use. Generally speaking (unless you are creating large archives) there is no reason to need more than one though. In addition, with multiple cores doing the compression, the bottleneck may become the hard drive. Legacy zip compression is akin to the Deflate method in 7-zip, and will offer the most compatibility between different compression software.

John
Post Reply