Important information: this site is currently scheduled to go offline indefinitely by end of the year.
LZSS Compression?
LZSS Compression?
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.
-
- VIP member
- Posts: 1330
- Joined: Wed Nov 05, 2008 12:16 pm
- Has thanked: 2710 times
- Been thanked: 884 times
Re: LZSS Compression?
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.
Edit: The second link on the wiki doesn't work.
Re: LZSS Compression?
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
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
-
- VIP member
- Posts: 1330
- Joined: Wed Nov 05, 2008 12:16 pm
- Has thanked: 2710 times
- Been thanked: 884 times
Re: LZSS Compression?
that is a general outline of what has to be translated into whatever language you program with.
Last edited by Acewell on Mon Apr 30, 2018 5:03 am, edited 2 times in total.
-
- 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?
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.
Re: LZSS Compression?
Quickbms? I haven't heard of that program...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.
-
- 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?
DelphiCyndaquil 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
My Github repo