Author Topic: Getting started with .lzs  (Read 2865 times)

Sharkie

  • Guest
Getting started with .lzs
« on: 2005-11-16 07:47:31 »
Good morning! I spent a little time in the wiki, and tried to work along with a random file off of disc 1, Cloud.lzs, in order to figure out how exactly the compression works.

Step 1: Starts with 4 byte unsigned int that says how long the file is.

Raw: 82 04 01 00
which i think translates into this

00010482

which is decimal for 66000.

Windows says that the file is 66kb long. which means either

1. the whole thing is already decomressed, in which case i'm overcomplicating things and can get to understanding raw data.

2. the difference between KB= 1000 (natural thinking) and KB=1024 means it's compressed a whole 24*66 (1576 bytes) with the compression algorithm. I need to learn more about how to decompress them.

3. I'm too far seperated from my Computer Org class and forgot how to read hex. >_<

Since all of the data is, to my meager understanding, compressed, I'd like to learn to decompress them myself, creating a simple .c program to do so for my own study. Then I can play with the raw data and learn more about the inner workings.

So, can anyone help point me in the right direction, please?

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
Getting started with .lzs
« Reply #1 on: 2005-11-16 12:47:31 »
Read more about compression here http://www.sylphds.net/f2k3/docs/lzs.txt in ficedula's document. This should help you understand it. If it won't come back and ask more, but only after trying.

Cyberman

  • *
  • Posts: 1572
    • View Profile
Re: Getting started with .lzs
« Reply #2 on: 2005-11-16 19:25:04 »
Quote from: Sharkie
Good morning! I spent a little time in the wiki, and tried to work along with a random file off of disc 1, Cloud.lzs, in order to figure out how exactly the compression works.

Step 1: Starts with 4 byte unsigned int that says how long the file is.

Raw: 82 04 01 00
which i think translates into this

00010482

which is decimal for 66000.

Windows says that the file is 66kb long. which means either

1. the whole thing is already decomressed, in which case i'm overcomplicating things and can get to understanding raw data.

2. the difference between KB= 1000 (natural thinking) and KB=1024 means it's compressed a whole 24*66 (1576 bytes) with the compression algorithm. I need to learn more about how to decompress them.

3. I'm too far seperated from my Computer Org class and forgot how to read hex. >_<

Since all of the data is, to my meager understanding, compressed, I'd like to learn to decompress them myself, creating a simple .c program to do so for my own study. Then I can play with the raw data and learn more about the inner workings.

So, can anyone help point me in the right direction, please?

1) Heck no it's not already decompressed. That is there because of how square handles the FS in FF7. IE it has tags pointing to sectors in a directory. It tells how big the LZS file actually is :D
2) Actual size of cloud.lzs decompressed is about 230K
3) Look up LZS decompress algo it SHOULD be in the wiki. Last I checked it was at least.


Cyb