Lumines II/LIVE!/Puzzle Fusion PC .dat files

Textures, recreate headers, conversions, algorithms and parsing of image files
HIKARUfw
Posts: 13
Joined: Sat Apr 13, 2019 5:53 pm

Lumines II/LIVE!/Puzzle Fusion PC .dat files

Post by HIKARUfw »

New member here.
I've been wanting to examine Lumines II (PSP), but i realized the files are compressed.
I'm not sure what the compression method is, but its most prominent feature is the presence of a "repeating byte" that acts as a "flag" of some sorts.
Lumines LIVE! (XBOX360) and Lumines Puzzle Fusion (PC) also seem to use this compression method.
Please note that the flag can be of a different value, most of the times being FE, but can also be FA, 5C, 9B...

Thanks in advance. Hopefully i'm doing this right and not missing things.
HIKARUfw
Posts: 13
Joined: Sat Apr 13, 2019 5:53 pm

Re: Lumines II/LIVE!/Puzzle Fusion PC .dat files

Post by HIKARUfw »

Some updates. I think i figured out how the compression works. At the beginning of the files inside the .dat, there's three headers, all of them taking 4 bytes. One is the uncompressed size. Immediately after is the compressed size. And finally, the "flag" value used in the compressed data.
How the "flag" works is this: when the "flag" byte is inserted into the data, immediately after there is a byte with "how many bytes should be rewinded" to reach an "aim", then followed by a value that shows how much the "aim" byte is repeated.
Last edited by HIKARUfw on Mon Apr 29, 2019 7:47 pm, edited 1 time in total.
HIKARUfw
Posts: 13
Joined: Sat Apr 13, 2019 5:53 pm

Re: Lumines II/LIVE!/Puzzle Fusion PC .dat files

Post by HIKARUfw »

UPDATE 2: The "second flag byte" does not actually aim for a specific byte, it aims for a section of bytes, which is then repeated. If the third byte's value (repeat) is lower than the second byte, only the segment determined by the former repeats, starting from the first byte of the segment. If the third byte's value is higher than the second byte, the section determined by the latter repeats, completely or partially.
Here's a crudely drawn picture crudely explaining how the thing works.
Image

I've tried to manually decompress one of the files (not the one linked in the first post), only to obtain partial success.
Image

On another note, if the "flag" value is mentioned twice in a row, both don't function as flags; the code stays as it is.
Oh, and can someone please move this to the Game Archive category? Thanks