Converts a .tmx file to and from a .bin file for/from Fire Emblem: Gaiden.
All formats start with height - 1 then width - 1. Formats 0 and 1 have 2 NULL bytes. Then the encoded data. Formats 0 and 1 end with 0xFF.
It's RLE. The first byte is count - 1 and the second byte is the raw byte.
If the second byte is greater than 0x2D and count is 0, then count is optional. (e.g. 0x00 0x2F is equivalent to 0x2F)
To encode more than 0x2D count of a byte, it needs to be broken down (e.g. 0x2D 0x55 0x2D 0x55 0x02 0x55)
Alternates between raw data and RLE (no 0x2D limit, and no optional count) with the byte 0xFE. Starts in "raw data" mode.
Contains raw data.