lzss0 compression library for external tool

Programming related discussions related to game research
Garo
Posts: 20
Joined: Wed Nov 18, 2020 5:54 pm

lzss0 compression library for external tool

Post by Garo »

hello, id like to know where the c library for the lzss0 compression scheme is
i want to also know how to calculate the size of the compressed file
i will need to lzss0 compression library for a third-party tool developed by yours truly called nmr2l

oh just for reference the game files ill be working with are from Namco Museum Remix
i just need a c header file or something that will let me compress and decompress raw lzss0 data

thanks
atom0s
Posts: 250
Joined: Sat Dec 27, 2014 8:49 pm

Re: lzss0 compression library for external tool

Post by atom0s »

You can download and use the source of quickbms which has support for lzss/lzssx files:
http://aluigi.altervista.org/papers/qui ... 0.11.0.zip

File you'd want to check is:
\included\lzss.c
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: lzss0 compression library for external tool

Post by aluigi »

lzss0 is just the normal LZSS with the only difference that initialize the window buffer with a NUL byte instead of a space.
Any implementation is ok as long as it has the default settings: EI = 12, EJ = 4, P = 2.
The one in quickbms is big because it covers all the settings, probably you want something much simpler and easy.

For example this one is from Okumura (who wrote one of the oldest public domain implementations, the following seems a short uncommented rewrite):
https://oku.edu.mie-u.ac.jp/~okumura/compression/lzss.c
As you can see EI and P are different so you must set as I said before.
And obviously you must change the two occurrencies of the "space" ' ' to 0.

Super easy ;)