Wikifang:Telefang 1 Translation Patch/NatsumeGB compression: Difference between revisions

From Wikifang, a definitive guide to Telefang, Dino Device and Bugsite
Jump to navigation Jump to search
(I actually have no idea whose job it was.)
(rename to NatsumeGB compression)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
Malias compression is the compression used in multiple {Smilesoft|Natsume|Imagineer} 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 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 named after [http://s15.zetaboards.com/Tulunk_Village/topic/515644/ Malias], the person who wrote the first decompresser.
NatsumeGB was formerly called Malias compression after [http://s15.zetaboards.com/Tulunk_Village/topic/515644/ Malias], the person who wrote the first decompresser.


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


<pre>compressed = readbyte()
<pre>compressed = readbyte()
Line 20: Line 20:
             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.

Latest revision as of 09:11, 16 November 2020

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. Wikipedia has a good description of the algorithm.

NatsumeGB was formerly called Malias compression after Malias, the person who wrote the first decompresser.

Implementation of the NatsumeGB 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
        for mode in bits(modes):
            if mode == 0x1:         # 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()

Games that use the compression[edit]

  • Keitai Denjuu Telefang
  • Medarot 1
  • Medarot 2
  • Medarot 3
  • Medarot 4 (assumed)
  • Medarot 5 (assumed)
  • Croc 2

Decompression tools[edit]

  • 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.