ROM Hack Help with Fire Emblem DS2 display/font issue

Aveyn Knight

Active Member
OP
Newcomer
Joined
Oct 20, 2011
Messages
25
Trophies
0
XP
143
Country
Hi, I'm working on the Fire Emblem: Heroes of Light and Shadow (HoLaS) translation patch for the DS and I was wondering if any crafty hackers here could help me solve a niggling issue we've got?

The rest of the translation is going very smoothily and a public release might be ready soon (we're currently in beta). Unfortunately, we've never really had a dedicated DS hacker on the team (though we did have the awesome Nagato solve our biggest issues earlier on), so we're at a loss on how to solve the issue. We'd appreciate it if anybody could give us pointers or help us!

For reference, this topic was also posted on RHDN.

The issue: Whenever there's a dialogue scene, the game displays the name box of the character whose talking, but sadly part of the name gets cut off towards the bottom part of the box, if the name has any of the following "hanging" letters: g, j, p, q, y.

ch10bad.png


For instance, above, the character whose talking is "Jagen", but the g is cut off.

What I'd love to do, if possible, is to figure out a way to stop the letters getting cut off. The simplest way would be to shift the entire font up, but I'd rather not do that, since it's rather unwieldly. However, if push comes to shove, I don't mind editing the glyphs--if I knew how to (see EDIT further down my post) ^^;;;

In the official translation of Fire Emblem: Shadow Dragon (SD), it seems Nintendo changed it so that the name is lifted 2 pixels up in the name box, but the font itself is unchanged. Screenshot collage for reference. The collage shows Jagen's name in SD (left side) and HoLaS (right side) and the Japanese (above) and English (below) versions of both games. The bottom-right screenshot showcases the HoLaS translation, where the "g" in Jagen is cut off from the box.

My colleague on the translation team figured out part of the reason why the name is cut off, but sadly we don't currently have anyone on the team who's skilled enough to fix the issue.

Now at the bottom here we have the tile view. What's important is how the graphics are loaded, and it's evident if you look mid-way through the tile viewer that the name box graphics are there... with the letters already embedded onto them.

fe12letterprob5.png


It shows that the name box is split into 3 rows (each being one tile, or 8 pixels, high). Things start to make sense: The last 80x8 portion doesn't seem to be "written to", i.e. the bottom of the letter "g", which hypothetically SHOULD go onto that part, doesn't. Thus I think it's safe to assume (though I'm no expert so I could always be wrong) that the game manually writes the characters to each part of the name box graphic but doesn't do it for the 3rd. It DOES it do it for the first--if you look very carefully, there's one pixel from the top of the "J" in there, and thus the "J" doesn't get cut-off at the top, and naturally it does it for the middle 80x8 section where the bulk of the characters are, but essentially the allotted space for the character ends at the bottom of the middle 80x8 section, and everything else simply gets cut-off, and the game does NOT extend it to the 3rd 80x8 section, or the bottom of the name box.

Again, 80x8 + 80x8 + 80x8 going vertically is 80x24, the entire name box. This is MORE than enough space; however, we can only actually use the top 80x16 pixels, as everything that would hypothetically go on the bottom 80x8 portion does not go there.
If you're interested, here are some files that you'll need to make sense of the problem. These files translate the entire script of Prologue I, the very first chapter. You can compile these files with NDSTool/DSlazy and I've also included a no$gba battery save, which isn't needed for anything.

When you start a new game and begin Prologue I, you will encounter two characters early on with cut off names--Rody and Jagen.

EDIT

Whoops, I made a slight (or big) mistake.

It turns out I got the fonts mixed up and the problem font happens to be the one I can't edit the glyphs of. Does anybody know what format the glyphs might be? I've tried all the common DS/GBA formats, like 2bpp reversed/non-reversed (since the glyphs have around 4 colours, last I checked), but to no avail.

Font file

Glyphs start at 0xAD8. The first symbol should be `. For something a bit more tangile, A should be at 0x12C9.
 

Arrow

Well-Known Member
Newcomer
Joined
Jul 27, 2012
Messages
60
Trophies
0
XP
82
Country
Haha Aveyn, you came all the way here? XD You guys must be getting really desperate now.

Sorry to say I have no skills to help you out.

But I don't get it, why don't you simply do like SD did and lift the text up a notch?
 

Aveyn Knight

Active Member
OP
Newcomer
Joined
Oct 20, 2011
Messages
25
Trophies
0
XP
143
Country
Hey!

Um, I wouldn't be surprised if you missed it in my lengthy walls of text, but the localisation team as Shadow Dragon used some "magic" to lift up the text in the name boxes. For us, this will likely require ASM hacking (enough to know how and where they did it), which none of us on the team is familiar with.

We could physically lift the enitre font up, but I don't know how the font glyphs are encoded. Thus I can't edit the font.

It's kind of sad, because I know how pretty much every other image in the game is encoded, as well as the font the game uses for everything that isn't dialogue.
 

Skelletonike

♂ ♥ Gallant Pervert ♥ ♀
Member
GBAtemp Patron
Joined
Dec 26, 2008
Messages
3,433
Trophies
3
Age
32
Location
Steam City
XP
2,684
Country
Portugal
There's several DS rom hackers around here, perhaps ratsan or some others could look into it, since the temp was down for a while it might take some time for them to notice this topic though. =S
 

Celice

Well-Known Member
Member
Joined
Jan 1, 2008
Messages
1,920
Trophies
1
XP
628
Country
United States
FAST6191 has always seemed pretty knowledgeable too, and always helpful. Asking him couldn't hurt. If NO$GBA still had the nifty debugger feature you can always watch for where the game draws the letters and raise the height a couple pixels. It might not be a bad idea to reference the Shadow Dragon translation and see if this was the route the localization team took, too. If New Mystery really was built directly off the last game, you might even get lucky and be able to port over their write code once you find it.

EDIT: well at least you were aware of this option D:
 

someonewhodied

Lazy Person
Member
Joined
Sep 21, 2008
Messages
871
Trophies
1
Age
28
XP
1,061
Country
United States
I haven't even touched this rom for about a year but since text is usually in the game with each letter as an individual graphic, you could probably do one of the following:
Make the text smaller. (Scale image)
Pad a few rows along the bottom of each letter like this: (In attatchment) in order to push the entire image up.
Pink Signifies transparency. Gray signifies not part of image.


The only issue I'd see is that the game may not be able to handle 1 tile by 1.5 tile images or if you insert it, you may have to repoint all the pointers due to shifting the hex location of everything after the text tiles.

Of course I'm just pulling shit outta my ass at this point since I haven't bothered doing much rom hacking.
 

Attachments

  • Example.jpg
    Example.jpg
    4.3 KB · Views: 372

rastsan

8 baller, Death Wizard,
Member
Joined
May 28, 2008
Messages
1,002
Trophies
1
Location
toronto
Website
rastsan.wordpress.com
XP
413
Country
Canada
so you decided to use the font from the eu version and now things are getting cut off? I have the debug version of nogba and maybe sunday I'll take a look but as to whether I can find anything right now - no. talk eu- its got an interesting pointer structure but I must be missing what its pointing to. (pointer to a pointer to ?)
you can use other emulators that also have debug features - desmume.
out of curiosity are the ascii folder files the same as well? did you replace the entire font folder files or just select ones. Have you traced the font routine with an emulator yet? (there are guides to this - yes more than one). too lazy to link for you. from the screen shots you still need some images done, are they being worked on?

Sorry I can't put much time into this right now - I have been getting extra hours at work.
 

Aveyn Knight

Active Member
OP
Newcomer
Joined
Oct 20, 2011
Messages
25
Trophies
0
XP
143
Country
Hi, thanks for the interest!

We're using the Japanese font, but we've added the EU font at the very end of the file and repointed all the relevant characters to use the EU glyphs. So the hack is essentially using the EU font for English symbols, but retains the original Japanese font for the Japanese symbols.

The talk.bin structure is, from memory,

first 4 bytes: end of file
second 4 bytes: pointer to footer table
third 4 bytes: number of character banks (I think, it's a number of something)
padding until 0x20

pointers (4 bytes) to character banks until 0x394

character banks are
first 2 bytes: character code
second 2 bytes: width of glyph
third 4 bytes: pointer to, apparently, glyph graphics or something that determines the graphics
terminates with four 00's

0xAD8 is where the glyph graphics apparently begin--unfortunately I can't seem to figure out how the graphics are encoded or if they're even graphics. However, when importing the EU font, I've treated this segment as graphics and I successfully managed to display the EU font in the dialogue.

0x1A58 is the beginning of the footer table, which contains pointers to every pointer above this address

I've checked the ASCII file, but I'm not sure where those symbols are used. They don't look like the dialogue font at least. The files there are 32k.cg, 64k.cg, 128k.cg and cl.

I've replaced the system and talk files in the font folder. I've left the other files--alpha, bit and pal--alone.
 

rastsan

8 baller, Death Wizard,
Member
Joined
May 28, 2008
Messages
1,002
Trophies
1
Location
toronto
Website
rastsan.wordpress.com
XP
413
Country
Canada
then the rest is just basic math. which you already knew. you know where it starts how wide it is and where it ends (so the basic size). If not we will figure that out today. Fast6191 did a nice post on using file cutter and a hex editor. I know we don't really need to cut it up but it (we are not - maybe...) but to make things easier, we'll line everything up in a spreadsheet to make just a little more sense of it. which if you start from (space) you can see the graphic offsets are all over the place. (space) is at 1A1B but the letter that supposedly is after that ! is at 165C. If you were to do the math you would go "no that can't be right". so you take a look down the list and see that all the letters have the offsets all over the place. which makes doing the other size quotient we need more troublesome. also just a tiny bit more time consuming.

seriously all over the place. wow is this giving me a headache. anyways more later off to do laundry.

edit we need the size data wise of the letter to figure out other parts. if we can get the basic graphic size of the entire letter we can also figure out which bpp.
 

Aveyn Knight

Active Member
OP
Newcomer
Joined
Oct 20, 2011
Messages
25
Trophies
0
XP
143
Country
I've just had a long day, so I haven't had much time to think about this, sorry!

Apparently the largest symbol (as dictated by the font file) has a width of 13 pixels (for reference, it's a Japanese symbol not found in the EU version of the file), though that might not be the maximum size. The most height I've seen is 13 pixels. I'm not sure the number 13's a coincidence.

The other common font, "system" uses something close to 8 x 8 pixel tiles. Definitely 8 pixel width, height is more than 8 pixel, but less than 16, 12 pixel maybe?
 

rastsan

8 baller, Death Wizard,
Member
Joined
May 28, 2008
Messages
1,002
Trophies
1
Location
toronto
Website
rastsan.wordpress.com
XP
413
Country
Canada
after taking a look at the system font (vb2bpp)...I am kinda confused as it is real easy to find the graphics, as the pointer structure is dead on. where as finding { with the set width is proving very hard in talkeu.bin. I would disagree with you on system being a font. Its more of a general "system" stuff graphic pack file, with stuff easily seen throughout.

this is weird. Alpha which also follows the exact same format as talkeu is just as hard to "see" the letters. the letter G at 1231 with a width of 14. although a 90 degree rotation on nes2bpp seems to be promising (if i could keep ct2 from crashing when adjusting height)- nevermind it was nothing... sigh...

looks like I can't help you...

sorry I have to work early tomorrow and I also will be unavailable for the next 5 days...
 

rastsan

8 baller, Death Wizard,
Member
Joined
May 28, 2008
Messages
1,002
Trophies
1
Location
toronto
Website
rastsan.wordpress.com
XP
413
Country
Canada
It is actually in the file in question. you just have to follow the structure.
"first 4 bytes: end of file
second 4 bytes: pointer to footer table
third 4 bytes: number of character banks (I think, it's a number of something)
padding until 0x20

pointers (4 bytes) to character banks until 0x394

character banks are
first 2 bytes: character code
second 2 bytes: width of glyph
third 4 bytes: pointer to, apparently, glyph graphics or something that determines the graphics
terminates with four 00's"
its a quote from earlier. character code is what you are looking for. Still don't know what the footer table is. But then I didn't investigate this too deep.
work your magic Auryn.
 

Auryn

Well-Known Member
Member
Joined
Jul 21, 2011
Messages
559
Trophies
1
Age
51
XP
706
Country
Swaziland
Well, work my magic :)
Is this magic enough??
67028078.png

HEHE (no, not paintshop but real screenshot from Desmume)by setting some byte to FF

No, let's get serious, there is sure a way trace that text and move it up asm wise and i am surprised nobody here or in RHDN helped out.

Anyway, i am sick in bed and my laptop is at work far away so i could not work on AAI2 so i took a look at this.
I can not only make that K disappear but draw a white line as well (first byte to 00)
20459689.png


and shorten it pixel by pixel till it's only 1 pixel long (first byte FE))
24728301.png


problems start when i start to mix 1 and 0 bit wise to make 2 points in the same line (88 and 0F)
77879859.png
62610911.png



Before i go to sleep, it seems that there are some combinations of bits with different meaning one combination ôr flag let read the next bits as line, it seems that one is a "linebreak*, probably one is to tell that the next are a second bpp (yes, in one test i got half of the line in another color).
Meaning those byte where the glyphs are, need to be looked as a chain.

I believe that the width table is not used for building the tile itself, if you doubt me, check out the next pic where i just zeroed some bytes of the k:

0000000x.png


By the way, what I asked in my last post is not what answered.
I wanted a table with something like 20=!, 21= a, etc...

Anyway i don't need it anymore.

I was wondering, if the game accept single byte ascii if you insert the talk font of the euro version.
 

Aveyn Knight

Active Member
OP
Newcomer
Joined
Oct 20, 2011
Messages
25
Trophies
0
XP
143
Country
Same here, thanks for looking into it!

If you replace the original, Japanese Talk file with the European one (which IIRC is the same as the American one), no letters display.

What I think is happening is that the Japanese version doesn't recognise the character codes. For example, 61 00 is "a" in the European version, but the game expects something like 48 83 (SHIFT-JIS 8343).

So to use the symbols from the European Talk file, I have to rewrite all the ASCII character codes as SHIFT-JIS (so 61 00 becomes 81 82).

However, we do use single byte ASCII in the game script and the game recognises them. Though, I have a feeling the game translates the single byte ASCII into double byte SHIFT-JIS. I'm not sure though ^^;;;
 

Auryn

Well-Known Member
Member
Joined
Jul 21, 2011
Messages
559
Trophies
1
Age
51
XP
706
Country
Swaziland
OMG guys!
Sjis encoding contains single byte characters but they are not defined in the japanese font, that's why no characters appear when you insert the EU font.
So insert that EU font and write those problematic names in ASCII.
Maybe your problem is already solved and as bonus, you have double as much space as before for the text!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: https://i.imgur.com/T0X6JND.jpg