This is a patch that displays UTF-8 in FE8U or FE7U.
This patch can theoretically support up to UTF-32.
So you should be able to display all languages on the Earth.
However, since FEBuilderGBA is written in C#, C# has UTF-16 restrictions, it has not been fully tested for UTF-32 yet.
Please use the latest version of FEBuilderGBA (ver 20180731.23 , or later).
Since it is a new patch, if you have a bug please contact me.
How to use.
Adapt the DrawUTF 8 Patch.
Edit your favorite character string.
Let's change the "Load" of the class name this time.
Let's change "Load" to the Japanese name "ロード".
Please apply Anti-Huffman Patch. (It will be displayed only once for the first time)
Well, for now let's start the game by pressing the F5 key.
Wow, they are buggy.
This is because fonts do not exist.
Let's install fonts before posting this image to Amusing ROMhacking Glitches Thread.
There are two ways to install fonts. (There are three practical methods)
Method 1. The easiest way
Menu -> Tool -> ROM translation tool
Please press the button on the bottom screen (Import Font) without changing anything.
Automatically creates missing fonts using OS fonts.
Let's restart the game with F5 key, again.
This time it will be displayed correctly.
If you do not have Japanese fonts installed, please download the font from google's notofu project etc.
Method 2. How to define each one manually
From the detail menu, select Font.
Here you can change the font one by one.
This time, it is a three character string "ロード", so you need to import it three times.
There are two kinds of fonts, item font and serif font used for dialogue.
The status screen is drawn with item font.
Please search by "ロ".
We get an error saying there is no font.
Here, you can draw your own font and import it, but since it is troublesome, let's create it automatically.
By pressing the Automatic Generation button, fonts are automatically created using OS fonts.
If you do not like the automatically created font, press the Export button and it will be saved as png.
Fonts are treated as 4 color PNG data.
You can now create a font in the "ロ" portion of "ロード".
Please install fonts for the remaining "ー" and "ド" as well.
Let's restart the game with F5 key.
It will be displayed correctly.
万歳! Banzai ＼((＾0^)／
Now you can now display all languages on the planet in the game.
For FE8J, FE7J, FE6, it is quite difficult to convert to UTF-8 because data has already been created with SJIS character code.
Also, FE8EU and FE7EU are probably difficult because they are made with LAT1.
This is possible because FE8U and FE7U are alphabets that do not conflict with UTF-8.
Below this is contents for fe hackers who are interested in character codes.
The UTF-8 encoding method is not described in this document.
Please see other document or wikipedia etc.
Well, this patch breaks one UTF-8 rule.
In UTF-8, 0x80 must be represented as a character in the middle of multi-byte.
However, 0x80 is used in large quantities in the existing ROM.
For example, @0080@000A [MoveFarLeft]
Therefore, with this patch, only 0x80 ignores UTF-8 rules.
If the beginning of the character code is 0x80, it is evaluated as one letter of the escape sequence.
About the Text data structure.
Character data is stored using UTF-8 text as it is, using Anti-Huffman.
However, as explained above, only 0x80 is used as an exception.
The character string "ロード" is stored as follows.
E3 83 AD E3 83 BC E3 83 89 00 00
This is as follows.
E3 83 AD //ロ
E3 83 BC //ー
E3 83 89 //ド
00 00 //null term.
About the Font data structure.
FE's font data is hash + list structure for Japanese SJIS.
However, in English-speaking countries and LAT 1, since only a single byte is used, it actually becomes hash.
void* next_pointer; //+0x0 Japanese ROM only. Otherwise it is null.
byte sjis2byte; //+0x4 Japanese ROM only. Otherwise it is 0.
byte width; //+0x5 The width of the font.
byte unk1; //+0x6 Fixed 00.
byte unk2; //+0x7 Fixed 00.
byte bitmap4color; //+0x8 Bitmap 4 colors.
}; sizeof() == 72(0x48)
Therefore, I restored the structure of Japanese hash + list and extended it to UTF - 8.
Also, because there was a vacant byte, I used it to express UTF-32.
uint utf32 = 0xbeefbeef;
byte moji1 = (utf32 & 0xff);
byte moji2 = ((utf32>> 8) & 0xff);
byte moji3 = ((utf32>>16) & 0xff);
byte moji4 = ((utf32>>24) & 0xff);
struct font* font = FontTable[moji1];
while(font != null)
if ( font->sjis2byte == moji2
&& font->unk1 == moji3
&& font->unk2 == moji4
font = font->next_pointer;