Anonymous

Changes

From Final Fantasy Inside

FF7/LZSS format

2 bytes added, 01:00, 15 July 2019
m
11 revisions imported
(O = Offset, L = Length)
The 1st byte it the least significant byte of the offset. The second byte has the remaining 4 bits of the offset as it's **'''high** ''' nibble, so some shifting is required to extract it properly. The remaining 4 bits is the length minus 3.
So you get a 12-bit offset and a 4-bit length, but both of these values need modifying to work on directly. The length is easy to work with: just add 3 to it. This is because if a piece of repeated data was less than 3 bytes long, you wouldn't bother repeating it - it'd take up no more space to actually just put literal data in. So all references are at least 3 in length. So a length of 0 means 3 bytes repeated, 1 means 4 bytes repeated, so on.