Difference between revisions of "FF7/Text encoding"
my_wiki>NFITC1 m |
my_wiki>NFITC1 (Added some stuff about KERNEL.BIN texts) |
||
Line 333: | Line 333: | ||
More info can be found in [[FF7/Field/DialogWindow#Special_Letters|Dialog Window]] section of the wiki. | 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=== | ===Useful downloads=== |
Revision as of 19:56, 22 November 2008
FF Text is a format that Squaresoft used to encrypt strings in Final Fantasy VII. Below you can find a table that will help you decrypt strings in game.
Note: to get letters, numbers and some special chars you only need to shift all character ASCII values by +20h
00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 0A | 0B | 0C | 0D | 0E | 0F | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
00 | {SPACE} | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / |
10 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? |
20 | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O |
30 | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ |
40 | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o |
50 | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | |
60 | Ä | à | Ç | É | Ñ | Ö | Ü | á | à | â | ä | ã | å | ç | é | è |
70 | ê | ë | à | ì | î | ï | ñ | ó | ò | ô | ö | õ | ú | ù | û | ü |
80 | ⌘ | ° | ¢ | £ | Ù | Û | ¶ | ß | ® | © | ™ | ´ | ¨ | ≠| Æ | Ø |
90 | ∞ | ± | ≤ | ≥ | ¥ | µ | ∂ | Σ | Π| π | ⌡ | ª | º | Ω | æ | ø |
A0 | ¿ | ¡ | ¬ | √ | ƒ | ≈ | ∆ | « | » | … | À | à | Õ | Œ | œ | {NOTHING} |
B0 | – | — | “ | †| ‘ | ’ | ÷ | â—Š | ÿ | Ÿ | â„ | ¤ | ‹ | › | ï¬ | fl |
C0 | ■| ▪ | ‚ | „ | ‰ | Â | Ê | à | Ë | È | à | î | ï | ì | Ó | Ô |
D0 | {SPACE} | Ò | Ù | Û | ||||||||||||
E0 | {Choice} | {Tab} | , | ." | ..." | {EOL} | {New Scr} | {New Scr?} | {Cloud} | {Barret} | {Tifa} | {Aerith} | {Red XIII} | {Yuffie} | ||
F0 | {Cait Sith} | {Vincent} | {Cid} | {Party #1} | {Party #2} | {Party #3} | 〇 | △ | ☠| ✕ | {FUNC} | {END} |
There is no equivalent character to 80h in most font families.
Characters D4h - DFh appear to produce odd graphical errors.
{FUNC} Character
This character is in fact an opcode, that takes one or more arguments. For the most time it's used to indicate colours, which are as follows:
FE D2: Gray colour FE D3: Blue colour FE D4: Red colour FE D5: Purple colour FE D6: Green colour FE D7: Cyan colour FE D8: Yellow colour FE D9: White colour FE DA: Flash colour* FE DB: Rainbow colour*
* these colours are global for a window, you can't reset them with other modifiers.
More info can be found in Dialog Window section of the wiki.
Battle Text within the KERNEL.BIN
Sections 10-17 and 26 of the 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.
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.