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

jjjewel

Well-Known Member
OP
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
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.

4756tennisnooujisamamot.png


(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:
 

Auryn

Well-Known Member
Member
Joined
Jul 21, 2011
Messages
559
Trophies
1
Age
51
XP
706
Country
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
 

jjjewel

Well-Known Member
OP
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
United States
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

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)
hffh.png


kn6e.png

hmqp.png
 

Auryn

Well-Known Member
Member
Joined
Jul 21, 2011
Messages
559
Trophies
1
Age
51
XP
706
Country
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
 

jjjewel

Well-Known Member
OP
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
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.

pleonex said:
* Finally, about the font width table, sadly it doesn't exist. The game uses fixed width for each char. You can see it from these instructions:
Code:
RAM:020F50B8 MOV R6, #8 ; Start Y pos
RAM:020F50BC MOV R5, #0xC ; Char width
In the register R6, it stores the relative position from the left textbox border and in the register R5 it stores a value that uses to increment the Y pos variable (it's Y axe because of the rotation of the window) after each char has been written, that is, the char width.

As I know now where the y pos variable is incremented, I could write for you a variable width function :)
 

Auryn

Well-Known Member
Member
Joined
Jul 21, 2011
Messages
559
Trophies
1
Age
51
XP
706
Country
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.
 

jjjewel

Well-Known Member
OP
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
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.)
Original font x0C
9e8z.png


Original font x08 (I fixed the space before the last line.)
ev23.png


New font x08
ovcq.png


In game, font x08 ("Tezuka" used dual-tile font. So it doesn't count.)
wu76.png


New font x04
jm8y.png


The new game font with x04 looked exactly the same as new game font x08.

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.
 

StorMyu

"I'm way too old for this"
Member
Joined
Jan 2, 2010
Messages
943
Trophies
1
Age
97
XP
1,093
Country
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.
 

jjjewel

Well-Known Member
OP
Member
Joined
Dec 17, 2009
Messages
1,010
Trophies
0
XP
522
Country
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
 

hackotedelaplaqu

Well-Known Member
Member
Joined
Jan 10, 2009
Messages
606
Trophies
1
Website
wiibrew.org
XP
1,196
Country
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

tennis.png
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: https://a.co/d/8tRQnqT