quickbms src included/lzss.c questions

Programming related discussions related to game research
garan
Posts: 4
Joined: Thu Mar 10, 2022 1:10 pm

quickbms src included/lzss.c questions

Post by garan »

can i supply parameters with a 0 if i dont want to use any parameters? and how will i get outsz? also im dealing with namco museum remix lzss files, should i change init_chr to '\0'? (line 300 of included/lzss.c)

Code: Select all

int lzss_compress(u8 *in, int insz, u8 *out, int outsz, u8 *parameters)
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: quickbms src included/lzss.c questions

Post by rabatini »

garan wrote:can i supply parameters with a 0 if i dont want to use any parameters? and how will i get outsz? also im dealing with namco museum remix lzss files, should i change init_chr to '\0'? (line 300 of included/lzss.c)

Code: Select all

int lzss_compress(u8 *in, int insz, u8 *out, int outsz, u8 *parameters)


http://aluigi.org/bms/namco_museum.bms
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: quickbms src included/lzss.c questions

Post by aluigi »

@garan
As far as I understand you want to make a tool for decompressing the SSLZ/LZSS files of that format.

Since it's just a simple lzss with init_chr set to 0 you don't need quickbms or the lzss.c in quickbms, you can use any of the many lzss source code available for any language (as long as the settings are the same) and write your own tool in few lines.

Anyway if you want to use lzss.c from quickbms you can remove any reference/operation to "parameters" and then replacing ' ' in the two init_chr (static and lzss_init) with 0.
garan
Posts: 4
Joined: Thu Mar 10, 2022 1:10 pm

Re: quickbms src included/lzss.c questions

Post by garan »

.

how should i use lzss.c?
i changed the parameters, messed with init_chr and removed references to `parameters` but i dont know how i should go about compressing memory.
how will i obtain `outsz` mentioned in the lzss_compress function declaration?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: quickbms src included/lzss.c questions

Post by aluigi »

out is the output buffer, outsz is its size.
Usually out/outsz must have the same size of the input buffer, better if slighly bigger in case the input can't be compressed.
Example:

outsz = insz;
out = malloc(outsz);
outsz = lzss_compress(in, insz, out, outsz);