Need help locating font width table (Probably need ASM hacking)

Discussion in 'NDS - ROM Hacking and Translations' started by jjjewel, Dec 2, 2013.

  1. jjjewel
    OP

    jjjewel GBAtemp Maniac

    Member
    1,009
    293
    Dec 17, 2009
    United States
    I wonder if anyone could help me locate font width table for a Prince of Tennis game called "Tennis no Ouji-sama - Motto Gakuensai no Ouji-sama - More Sweet Edition".

    From how the text appears, I'm pretty sure the game uses variable width font and I guess it's in arm9.bin. But no matter how I tried, I couldn't find anything that looks like a width table. I'm not sure if I just simply missed it or if it's stored in a complicated format.

    This is some test I did with random text. The game accepts ASCII input but it'll convert that to full-width font output.

    [​IMG]

    (The name Kikumaru is done by dual-tile font but the line below is ASCII input which is output as full-width font. The spaces between alphabets seem like their widths are different.)

    Here's a video if you need translation of how to input your name. I asked pleonex for help some time earlier and he confirmed that the early part (where you input your name) used fixed width. So I think somewhere around 1:37 min in the video is where the game starts to use variable width.


    So, if anyone could help me find the table, I'll be really thankful.

    Tinke program from rev. 152 can extract filedata.bin that stores font and text. Let me know if you need any more info to figure out the width table. (The game uses custom encoding but it accepts ASCII input.)

    Thank you very much.:wub:
     
  2. Auryn

    Auryn GBAtemp Advanced Fan

    Member
    537
    347
    Jul 21, 2011
    Swaziland
    Well, taking a look at the ram, you can see that there are "blocs" of font separated by the allocation table.
    Probably the WT is in blocks as well. Where are the font in the game??

    By the way, why i have the feeling this game is the remake of a PS2 game??
    http://imageshack.com/a/img542/4246/xkvb.jpg
     
  3. jjjewel
    OP

    jjjewel GBAtemp Maniac

    Member
    1,009
    293
    Dec 17, 2009
    United States
    Because it is a remake of PS2 game. :D

    I'll edit this post and write some more info about the font in a moment later. (The font files only has graphics and encoding table, but not the width table, though.)

    P.S. You'll need Tinke rev. 152 or 153 to extract the file.

    Edited: Okay, here's how to get to the font.

    - Use Tinke 152 or 153 and open the game rom. Then click on filedata.bin and click "Unpack" button.
    - The font encoding table and graphics are in Folder 12. Each sub-file is compressed. Click any file. (File 0.bin is where English alphabets are.) and click Unpack again.
    - Then extract the sub-file and open it in CT2. (Pic below).
    - Note: Text is stored in Folder 14 with custom encoding based on font in Folder 12.

    The font files have encoding table, color palette (I guess) and font graphic, but no width table.

    (Pics under spoiler)
    Warning: Spoilers inside!
     
  4. Auryn

    Auryn GBAtemp Advanced Fan

    Member
    537
    347
    Jul 21, 2011
    Swaziland
    Funny offset in your CT2 pic hehe.
    Yeap, that's look like what i was seeing on the ram.
    I wonder how come there is no Folder 13 (and naturally the other missing folders).
    Does Pleonex have an explaination for that??
    I will maybe take a look later when i am at home ...if i not fall asleep like i just did at my office :P
     
  5. jjjewel
    OP

    jjjewel GBAtemp Maniac

    Member
    1,009
    293
    Dec 17, 2009
    United States
    Thanks for your help, Auryn. (Oh, yeah. 404. Width table not found. Orz...)

    This is what pleonex said when he checked the font. But then he didn't have time to check the rest of it where I doubted it started using variable width. (He seemed very busy. I couldn't get a hold of him since May.)

    P.S. I don't understand how ASM works, so please don't ask me about what he said.

     
  6. Auryn

    Auryn GBAtemp Advanced Fan

    Member
    537
    347
    Jul 21, 2011
    Swaziland
    Well, Pleonex answer is clear.
    Position on screen for each letter (R6) = R6 + R5
    and if you look at the code, when printing the first letter, R6 will be 8 and R5 set to x0C (12). So the first pixel will be at 8 pixel from the left, the second 8+12= 20,3rd 20+12=32, etc....
    I just tried to change that x0C to 8 and the very first screen actually did what i expected but the next ones no.

    Open your rom with CT2, click the nds icon, select the arm9, right click it, extract (not export) the arm9, open it with an hex editor, jump at xF20BC, you will find a x0C there, change it to example x08, save the arm9, go to CT2 again in the nds file list, right click the arm9, compress and select the modified arm9, save it and try it out.
    As you see in the first screen when you start the rom, all letters will be more near to each others and probably cut on the right side. You will need to adjust that in the font image. Or wait for Pleonex to write that routine he said.
    As temporary solution i think it can be acceptable but i don't know where else that value is used.
    Check it out.
     
  7. jjjewel
    OP

    jjjewel GBAtemp Maniac

    Member
    1,009
    293
    Dec 17, 2009
    United States
    Thank you very much, Auryn. That value seemed to work only for the early part of the text, but not for the script text, though.

    This is what that number changing did when I changed from x0C to x08 and then x04 on the first screen. (Pics under spoiler tag.)
    Warning: Spoilers inside!

    No matter what value it is, the space and width for in-game font doesn't change. The change only applied to the warning screen.
    So, I think when it reaches the main dialogs, the game uses a new set of rules for how it output text.
     
  8. StorMyu

    StorMyu "I'm too old for this"

    Member
    896
    437
    Jan 2, 2010
    France
    completly not uncommon, just need to find the other one.
     
  9. jjjewel
    OP

    jjjewel GBAtemp Maniac

    Member
    1,009
    293
    Dec 17, 2009
    United States
    And that's why I started this thread asking for help with ASM hacking. ^_^
     
  10. StorMyu

    StorMyu "I'm too old for this"

    Member
    896
    437
    Jan 2, 2010
    France
    I still need to get back on NDS stuff to fix Shining Force Feather first sorry >_<
    maybe if Pleonex is available again... since he already find it once it's usually not hard to find duplicates.
     
  11. jjjewel
    OP

    jjjewel GBAtemp Maniac

    Member
    1,009
    293
    Dec 17, 2009
    United States
    Thanks anyway. I just asked in case someone might be able to help. (I totally have no idea what people do for ASM hacking so I don't know how hard or time-consuming it'll be. ^_^)

    The translation can go on without solving this, though. It's just that we don't have enough characters to apply dual tiles for the whole ASCII combinations so the translation is very restricted. Thought I could let my friend take over this project if I could make it a simple ASCII input, but probably not... T_T
     
  12. hackotedelaplaqu

    hackotedelaplaqu GBAtemp Advanced Fan

    Member
    543
    161
    Jan 10, 2009
    France
    Hi jjjewel,

    Playing with ASM I might I found what you're looking for.
    I messed with all the values in the red square to move and align the font. I forgot wich one moved the width but you'll find it easily now.
    In ram :
    0x02103AB0
    In uncompressed arm9 : 0x103AB0
    Left screen : the messed values
    Right screen : arm9 original values

    [​IMG]
     
  13. jjjewel
    OP

    jjjewel GBAtemp Maniac

    Member
    1,009
    293
    Dec 17, 2009
    United States
    hackotedelaplaqu, thank you very much. :wub:
    I'll try to see if I can do something with it from your information.