Important information: this site is currently scheduled to go offline indefinitely by end of the year.

LZSS Compression?

Post questions about game models here, or help out others!
Post Reply
Cyndaquil
n00b
Posts: 19
Joined: Mon Jun 04, 2012 11:12 am
Has thanked: 3 times

LZSS Compression?

Post by Cyndaquil »

I'm looking into making a program that opens and allows editing of the .FSYS files from Pokémon Colosseum. The compression, LZSS, is confusing and I can't make heads or tails of it. Any help would be awesome.
Acewell
VIP member
VIP member
Posts: 1330
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2710 times
Been thanked: 884 times

Re: LZSS Compression?

Post by Acewell »

I found this on the wiki
http://wiki.xentax.com/index.php/LZSS
Cyndaquil
n00b
Posts: 19
Joined: Mon Jun 04, 2012 11:12 am
Has thanked: 3 times

Re: LZSS Compression?

Post by Cyndaquil »

Well, that's extremely useful, thank you, but I don't know any of the parameters. I'll have to look through the files again and look for similarities.
Edit: The second link on the wiki doesn't work.
Cyndaquil
n00b
Posts: 19
Joined: Mon Jun 04, 2012 11:12 am
Has thanked: 3 times

Re: LZSS Compression?

Post by Cyndaquil »

A question, what programming language is this?

while InputPos < InputSize do
begin
FlagByte := Input[InputPos++]
for i := 1 to 8 do
begin
if (FlagByte and 1) = 0 then
begin
OfsLen := Input[InputPos] + Input[InputPos + 1] shl 8
InputPos += 2
if OfsLen = 0 then
Exit;
Length := OfsLen and LengthMask + Threshold
Offset := (BufPos - (OfsLen shr LengthBits)) and (N - 1)
{ copy Length bytes from Buffer[Offset] onwards while increasing BufPos }
end
else
begin
{ copy 1 byte from Input[InputPos] }
InputPos += 1
end
FlagByte := FlagByte shr 1
end
end
Acewell
VIP member
VIP member
Posts: 1330
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2710 times
Been thanked: 884 times

Re: LZSS Compression?

Post by Acewell »

that is a general outline of what has to be translated into whatever language you program with. :D
Last edited by Acewell on Mon Apr 30, 2018 5:03 am, edited 2 times in total.
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: 307 times

Re: LZSS Compression?

Post by finale00 »

Quickbms has a couple lz77 variants if you're not interested in figuring out how lz77 works (eg: doing it yourself) and just throwing a bunch of different algorithms at it.
Cyndaquil
n00b
Posts: 19
Joined: Mon Jun 04, 2012 11:12 am
Has thanked: 3 times

Re: LZSS Compression?

Post by Cyndaquil »

finale00 wrote:Quickbms has a couple lz77 variants if you're not interested in figuring out how lz77 works (eg: doing it yourself) and just throwing a bunch of different algorithms at it.
Quickbms? I haven't heard of that program...
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: 307 times

Re: LZSS Compression?

Post by finale00 »

Ekey
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1823
Joined: Wed Mar 31, 2010 6:54 am
Has thanked: 92 times
Been thanked: 1058 times

Re: LZSS Compression?

Post by Ekey »

Cyndaquil wrote:A question, what programming language is this?

while InputPos < InputSize do
begin
FlagByte := Input[InputPos++]
for i := 1 to 8 do
begin
if (FlagByte and 1) = 0 then
begin
OfsLen := Input[InputPos] + Input[InputPos + 1] shl 8
InputPos += 2
if OfsLen = 0 then
Exit;
Length := OfsLen and LengthMask + Threshold
Offset := (BufPos - (OfsLen shr LengthBits)) and (N - 1)
{ copy Length bytes from Buffer[Offset] onwards while increasing BufPos }
end
else
begin
{ copy 1 byte from Input[InputPos] }
InputPos += 1
end
FlagByte := FlagByte shr 1
end
end
Delphi
Post Reply