+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Fire Emblem Font Problem-Feidian Solution?
Pages: [1]
Author Topic: Fire Emblem Font Problem-Feidian Solution?  (Read 2 times)
aznanimefreak1
Guest
« on: August 18, 2008, 04:56:18 pm »

Well some of you may know me or not. But I am aznanimefreak1 and I am one of the creators of the Fire Emblem DS Translation Patch. We are currently trying to release a 2.0 demo patch but we are having a issue editing fonts. Our rom hacker had absolutely 00% success with fixing the problem. But recently he heard about a program called Feidian. But even he doesn't know how to use it. Is there someone that can help?
Ryusui
Guest
« Reply #1 on: August 18, 2008, 06:36:23 pm »

FEIDIAN is a tricky little bastard that's good for some purposes but not-so-good for others. It allowed me to dump the non-standard 1bpp fonts for Death Note: The Kira Game (also a DS title) but sucked at reinserting them.

See, in Death Note - and I assume Fire Emblem as well - each character is 11x11, 1bpp (bit per pixel - i.e., pure monochrome in this case), with each character taking up $10 (16) bytes. Now, if you're familiar at all with the way bitplanes work, it sounds like something seriously weird is going on with the math, as if we were dealing with a normal, well-adjusted font with the common sense to fit into a multiple of 8, each character would take up 16x16 pixels' worth of data, or (in 1bpp format) $20 (32) bytes, twice the size they're supposed to take up. Is it compression? Some trick of quantum computing? Nothing quite so grandiose, I'm afraid. Each of those 11 lines of 11 pixels is bitpacked, i.e. they're simply all jammed together in one continuous string of bits, with no regard for byte boundaries. Thankfully, each individual character is neatly wrapped up into its own little $10-byte chunk, with no bleeding or spilling over into adjacent characters, so we can find any character we want with a little math.

As for converting them into something we can edit, that takes a little more work, but it can be done without the aid of a custom tool.

Let's look at the sixteen-byte character beginning at $4AC in Death Note's font.nftr file (the address isn't a multiple of $10 because it's offset by the file's header):

00 00 00 00 3C 08 81 10 22 03 C0 08 11 01 C0 00

Doesn't look like much yet, does it? Let's convert each number into its binary representation and stack 'em on top of each other:

00000000
00000000
00000000
00000000
00111100
00001000
10000001
00010000
00100010
00000011
11000000
00001000
00010001
00000001
11000000
00000000

Still rather perplexing, isn't it? Let's split up these bytes so that we have 11 bits per line instead of 8. *whips out his chainsaw*

00000000000
00000000000
00000000000
01111000000
10001000000
10001000000
10001000000
01111000000
00001000000
10001000000
01110000000
0000000

Whaddaya know, Haddi-Man? I'm not gonna lie to ya...that's a healthy piece of real estate! :3

If we know the ASCII (or Shift-JIS) code for a character, we can find it in the font by subtracting $20, multiplying by $10 and adding $3C (the header size). If this method proves to work for Fire Emblem, you can work this kludgy decoding method in reverse to change characters in the font to whatever you want.
Pages: [1]  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC