Help with Fire Emblem DS2 display/font issue

Discussion in 'NDS - ROM Hacking and Translations' started by Aveyn Knight, Oct 29, 2012.

Oct 29, 2012
  1. Aveyn Knight
    OP

    Newcomer Aveyn Knight Member

    Joined:
    Oct 20, 2011
    Messages:
    23
    Country:
    United Kingdom
    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.

    [​IMG]

    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.

    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.
     


  2. Arrow

    Newcomer Arrow Advanced Member

    Joined:
    Jul 27, 2012
    Messages:
    59
    Country:
    Sweden
    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?
     
  3. Aveyn Knight
    OP

    Newcomer Aveyn Knight Member

    Joined:
    Oct 20, 2011
    Messages:
    23
    Country:
    United Kingdom
    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.
     
  4. Skelletonike

    Member Skelletonike ♂ ♥ Gallant Pervert ♥ ♀

    Joined:
    Dec 26, 2008
    Messages:
    2,840
    Location:
    Steam City
    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
     
  5. Celice

    Member Celice GBAtemp Advanced Maniac

    Joined:
    Jan 1, 2008
    Messages:
    1,916
    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:
     
  6. someonewhodied

    Member someonewhodied Lazy Person

    Joined:
    Sep 21, 2008
    Messages:
    869
    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.
     

    Attached Files:

  7. Blazer

    Member Blazer GBAtemp Regular

    Joined:
    Aug 10, 2008
    Messages:
    280
    Country:
    United States
    Yeah sorry I pretty much looked into everything that's been said, sorry :|
     
  8. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    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.
     
  9. Aveyn Knight
    OP

    Newcomer Aveyn Knight Member

    Joined:
    Oct 20, 2011
    Messages:
    23
    Country:
    United Kingdom
    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.
     
  10. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    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.
     
  11. Aveyn Knight
    OP

    Newcomer Aveyn Knight Member

    Joined:
    Oct 20, 2011
    Messages:
    23
    Country:
    United Kingdom
    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?
     
  12. bwburke94

    Member bwburke94 Gotta hack 'em all!

    Joined:
    Feb 21, 2011
    Messages:
    101
    Location:
    Conway, Massachusetts
    Country:
    United States
    I think it would be easier to just hack the European ROM at this point.
     
  13. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    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...
     
  14. Aveyn Knight
    OP

    Newcomer Aveyn Knight Member

    Joined:
    Oct 20, 2011
    Messages:
    23
    Country:
    United Kingdom
    Aww, that's too bad.

    Thanks for the effort anyway, it was appreciated ^^
     
  15. Auryn

    Member Auryn GBAtemp Advanced Fan

    Joined:
    Jul 21, 2011
    Messages:
    529
    Country:
    Switzerland
    Do you have a table file with character code and actual letter?? Is it ASCII??
     
  16. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    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.
     
  17. Auryn

    Member Auryn GBAtemp Advanced Fan

    Joined:
    Jul 21, 2011
    Messages:
    529
    Country:
    Switzerland
    Well, work my magic :)
    Is this magic enough??
    [​IMG]
    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)
    [​IMG]

    and shorten it pixel by pixel till it's only 1 pixel long (first byte FE))
    [​IMG]

    problems start when i start to mix 1 and 0 bit wise to make 2 points in the same line (88 and 0F)
    [​IMG][​IMG]


    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:

    [​IMG]

    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.
     
  18. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    Country:
    Canada
    your sick too... same with me... oh man thanks for looking into this Auryn.
     
  19. Aveyn Knight
    OP

    Newcomer Aveyn Knight Member

    Joined:
    Oct 20, 2011
    Messages:
    23
    Country:
    United Kingdom
    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 ^^;;;
     
  20. Auryn

    Member Auryn GBAtemp Advanced Fan

    Joined:
    Jul 21, 2011
    Messages:
    529
    Country:
    Switzerland
    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!
     

Share This Page