If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Data:Lumines II

From The Cutting Room Floor
Jump to navigation Jump to search

This page contains info on data for the game Lumines II.

The Compression Method (Lumines-RLE)

Most graphic and text files in this game are compressed with a seemingly unique method to several Lumines games, which include Lumines II, Lumines LIVE!, Lumines: Puzzle Fusion (Windows), and Lumines: Touch Fusion. Here is an explanation on how it works and how to decompress it.

Beginning of the File

At the beginning of a compressed file, there are three headers, taking 4 bytes each. In most cases they are in little endian, though in Lumines LIVE!, they are in big endian. The examples below are on little endian for consistency.
The first header is the uncompressed size. The second header is the compressed size, excluding the headers. The third header is a flag, widely used in the compressed data.
Example: 20 5A 02 00 4A D7 00 00 FE 00 00 00

Red: Uncompressed Size
Green: Compressed Size
Yellow: Flag

The flag header seen here will be used as an example in the next sections.

Compressed Data

After the headers, the "key" byte can be seen multiple times. Most of the time, it is followed by parameters which determine how many bytes must be rewinded (Byte 2) and how much of it must be copied (Byte 3), replacing the flag and these parameters.

Case 1: Byte 3 of a smaller value than Byte 2

Example: 00 01 02 03 04 FE 05 04

Yellow: Flag
Blue: Bytes to rewind (Byte 2)
Pink: Bytes in the "rewinded" area to copy (Byte 3)
Dark purple area: Bytes to be copied

Output: 00 01 02 03 04 00 01 02 03

Case 2: Byte 3 of an equal value than Byte 2

Example: 05 04 03 02 FE 04 04

Yellow: Flag
Blue: Bytes to rewind (Byte 2)
Pink: Bytes in the "rewinded" area to copy (Byte 3)
Dark purple area: Bytes to be copied

Output: 05 04 03 02 05 04 03 02

Case 3: Byte 3 of a higher value than Byte 2

Example: 74 63 72 66 FE 04 0B

Yellow: Flag
Blue: Bytes to rewind (Byte 2)
Pink: Bytes in the "rewinded" area to copy (Byte 3)
Dark purple area: Bytes to be copied

Output: 74 63 72 66 74 63 72 66 74 63 72 66 74 63 72

Observations

Flag Value

The flag byte's value can be any, though it tends to be a value that does not appear many times in the uncompressed file.

Maximum Bytes 2 and 3 Values

The maximum values for Bytes 2 and 3 is FF, which means it is possible to "rewind" and "copy" up to 255 bytes.

Two Flag Bytes in a Row

If the flag byte appears twice in a row, these bytes don't act as flags. One of them can be removed, but the determination of whether it should or not be removed is not clear.

Example: EF FE FE EF

Red: Not flag

Flag Byte in Byte 3

If Byte 3 has the same value as the flag, it should not be counted as one.

Example: FE 01 FE 10 0C

Yellow: Flag
Blue: Bytes to rewind (Byte 2)
Red: Bytes in the "rewinded" area to copy (Byte 3); Not flag

Tool

Below is a Python script which is able to decompress contents from these files, courtesy of Coda:

Download.png Download Lumines-RLE Script
File: luminesII-luminesdec.zip (1,91 KB) (info)