Wikifang:Telefang 1 Translation Patch/NatsumeGB compression: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Malias compression is the compression used in multiple Smilesoft games, namely, at least Telefang and Medarot 1. It is a modified implementation of the LZ77 algorithm, which wor...") |
(No difference)
|
Revision as of 03:30, 17 July 2011
Malias compression is the compression used in multiple Smilesoft games, namely, at least Telefang and Medarot 1. It is a modified implementation of the LZ77 algorithm, which works by referencing previously decompressed data using length-distance pairs. Wikipedia has a good description of the algorithm.
Malias compression is named after Malias, the person who wrote the first decompresser.
Implementation of the Malias compression in pseudocode:
compressed = readbyte() if compressed != 0x00: total = readshort() # Total length of the graphics while bytes < total: # bytes is number of bytes decompressed modes = readshort() # Contains modes for the next 10 bytes do 0x10 times: modes = modes / 2 if carry: # Copy mode loc = -(readshort() & 0x7ff) num = lastbyte >> 3 & 0x1f + 0x03 loc += bytes-1 do num times: data += data[loc] loc += 1 else: # Insert mode data += readbyte()
Decompression tools
- Malias' Telefang Tools can decompress and recompress the graphics with ease, provided locations.
- punika is a simple implementation in Python which decompresses all compressed graphics at once, working off tables in the ROM.