Editing Wikifang:Telefang 1 Translation Patch/NatsumeGB compression

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
'''NatsumeGB compression''' is the compression algorithm used in numerous Game Boy Natsume games, namely, at least Telefang and Medarot.  It is a modified implementation of the LZ77 algorithm, which works by referencing previously decompressed data using length-distance pairs.  [http://en.wikipedia.org/wiki/LZ77_and_LZ78_%28algorithms%29 Wikipedia] has a good description of the algorithm.
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.  [http://en.wikipedia.org/wiki/LZ77_and_LZ78_%28algorithms%29 Wikipedia] has a good description of the algorithm.


NatsumeGB was formerly called Malias compression after [http://s15.zetaboards.com/Tulunk_Village/topic/515644/ Malias], the person who wrote the first decompresser.
Malias compression is named after [http://s15.zetaboards.com/Tulunk_Village/topic/515644/ Malias], the person who wrote the first decompresser.


Implementation of the NatsumeGB compression in pseudocode:
Implementation of the Malias compression in pseudocode:


<pre>compressed = readbyte()
<pre>compressed = readbyte()
Line 10: Line 10:
     while bytes < total:            # bytes is number of bytes decompressed
     while bytes < total:            # bytes is number of bytes decompressed
         modes = readshort()        # Contains modes for the next 10 bytes
         modes = readshort()        # Contains modes for the next 10 bytes
         for mode in bits(modes):
         do 0x10 times:
             if mode == 0x1:         # Copy mode
            modes = modes / 2
             if carry:               # Copy mode
                 loc = -(readshort() & 0x7ff)
                 loc = -(readshort() & 0x7ff)
                 num = lastbyte >> 3 & 0x1f + 0x03
                 num = lastbyte >> 3 & 0x1f + 0x03
Line 20: Line 21:
             else:                  # Insert mode
             else:                  # Insert mode
                 data += readbyte()</pre>
                 data += readbyte()</pre>
== Games that use the compression ==
* Keitai Denjuu Telefang
* Medarot 1
* Medarot 2
* Medarot 3
* Medarot 4 (assumed)
* Medarot 5 (assumed)
* Croc 2
== Decompression tools ==
== Decompression tools ==
* [http://s15.zetaboards.com/Tulunk_Village/topic/515644/ Malias' Telefang Tools] can decompress and recompress the graphics with ease, provided locations.
* [http://s15.zetaboards.com/Tulunk_Village/topic/515644/ Malias' Telefang Tools] can decompress and recompress the graphics with ease, provided locations.
* [https://github.com/Sanky/romhacking/blob/master/telefang/punika.py punika] is a simple implementation in Python which decompresses all compressed graphics at once, working off tables in the ROM.
* [https://github.com/Sanky/romhacking/blob/master/telefang/punika.py punika] is a simple implementation in Python which decompresses all compressed graphics at once, working off tables in the ROM.
Please note that all contributions to Wikifang are considered to be released under the Attribution-NonCommercial-ShareAlike 3.0 Unported (see Wikifang:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)