Anonymous

Changes

From Final Fantasy Inside

FF7/Text encoding

1,953 bytes added, 19:56, 22 November 2008
Added some stuff about KERNEL.BIN texts
More info can be found in [[FF7/Field/DialogWindow#Special_Letters|Dialog Window]] section of the wiki.
 
=== Battle Text within the KERNEL.BIN ===
 
Sections 10-17 and 26 of the [[FF7/Kernel/Kernel.bin|KERNEL.BIN]] are encoded differently than the rest of the text data. An additional byte serves as a function:
 
F9: This is an encoding technique designed to make the raw data smaller. It is based on the LZS compression method, but optimized for smaller files with fewer large similar blocks. A byte following this value will tell the game's memory the location of, and how much, text to read. The byte is set up like this:
In binary:
YYXXXXXX
Where YY is the number of bytes to read and XXXXXX is how far back from the F9 byte to look.
The number of bytes to read uses the formula:
no_of_bytes = (YY) * 2 + 4 [Where YY is binary]
The location starts at the position that the data read the byte F9 and proceeds backwards XXXXXX + 1 times.<br/>
Ex:
This is the description of the Poison Ring stored in section 15 of the kernel, both raw data and decoded text.
24 52 41 49 4E 53 00 3B 30 4F 49 53 4F 4E 3D 00 41 54 54 41 43 4B 53 0C 00 50 52 4F 54 45 43 54 53 00 41 47 F9 21 54 F9 A0 3D
D r a i n s [ P o i s o n ] a t t a c k s , p r o t e c t s a g ** ?? t ** ?? ]
 
At the end we have two F9 functions located at the end. The first one references the "ains" in the word "Drains" earlier in the description and the second one references the " [Poison" shortly after. The bytes following the F9 describe how to get to those texts:
21
00 100001 - go back 34 bytes and display four characters
A0
10 100000 - go back 33 bytes and display eight characters
This is an absolute position so it does not matter if there are other encrypted segments between it and the text it is trying to read.
 
NOTE: This may even request that a NULL terminator (0xFF) be output as well, but the data will then be terminated after the last piece of encoded text. This encoding can span back to previous descriptions as well.
===Useful downloads===
Anonymous user