Phantasy Star Generation 2:Notes
Jump to navigation Jump to search
Revision as of 17:25, 12 April 2013 by Tryphon (Created page with "==Compression== CUE found out the coding algorithm. It's a Lempel-Ziv related one, called Lempel-Ziv Renau. Structure of files : * Bytes $0000 to $000a : header ** 2 bytes ...")
CUE found out the coding algorithm. It's a Lempel-Ziv related one, called Lempel-Ziv Renau.
Structure of files :
- Bytes $0000 to $000a : header
- 2 bytes : signature, always "CM"
- 4 bytes: decoded data length, low endian
- 4 bytes: encoded data length, low endian
- From $000a : ENCODED_DATA
- Then FLAGS. Flags are read bit per bit :
- if bit = 0, then put one byte from ENCODED_DATA and put into DECODED_STREAM
- if bit = 1, then the corresponding half-word in ENCODED_DATA is of the form lllloooooooooooo, where l = length and o = offset. Copy then 'length + 3' bytes from DECODED_STREAM[current_position - offset + 1] to DECODED_STREAM[curent_position].
- Fill the file with $00, up to have a file size dividible by $800.