ROM Hack Help with 3DS font format

onepiecefreak

Kuriimu 2 Developer
OP
Member
Joined
Aug 12, 2015
Messages
525
Trophies
0
XP
1,733
Country
Germany
Hey there,
I need help to further understand the bcfnt format of the 3DS.
I'm working on the spanish translation of Ace Attorney Trilogy but I'm not fully satisfied with the way I had to replace existing characters. I would like to replace japanese characters to not replace any "normal" symbol or letter that could be used.
But the peoblem is the socalled glyph width. For some reason I can't change it.

The glyph width is the value that decides how many space the character uses in the dialogue box.

If someone could help me figure out the problem I wiuld be glad.

Here you can get the files and tools I use:
https://mega.nz/#F!ZtJmXYzD!1XgA_iO4B6Tm2kef1kSUxQ
 

onepiecefreak

Kuriimu 2 Developer
OP
Member
Joined
Aug 12, 2015
Messages
525
Trophies
0
XP
1,733
Country
Germany
English and Japanese are in one game in the Trilogy. So the font contains both latin and japanese characters. But since we don't use japanese characters in english I though about replacing them with the needed accent characters.
But the glyph width of these japanese characters are hindering me. Therefore the request.
 

Jayro

MediCat USB Dev
Developer
Joined
Jul 23, 2012
Messages
12,962
Trophies
4
Location
WA State
Website
ko-fi.com
XP
16,964
Country
United States
English and Japanese are in one game in the Trilogy. So the font contains both latin and japanese characters. But since we don't use japanese characters in english I though about replacing them with the needed accent characters.
But the glyph width of these japanese characters are hindering me. Therefore the request.
ah, that's a bit more clear. People were facing similar glyph-width issues in another rom translation, and I think they just ended up re-phrasing things to make the words fit the text field.
 

Anton299

Well-Known Member
Member
Joined
Jan 18, 2012
Messages
126
Trophies
1
Age
50
Location
Kiev
Website
www.shedevr.org.ru
XP
359
Country
Ukraine
I guess the character's width table sits at 0x00102000 and starts with CWDH (Character WiDtH) header (in english font, here - font tools\english font\42.cfnt - just for example).
The width table itself seems to start at 0x00102010. The first 3 bytes - 09 00 09 - space, next three - 03 03 09 - seems to be exclamation sign (!) and so on, in the same order like the symbols placed in font.
The first byte in this three bytes means space before this glyph, second one means it's width, third one means space after that glyph, if I understand the things correct ).

You should check how many pixels are in your new character's width and replace the second (middle) byte (in the group of three bytes of "your" symbol).

In the example above exclamation sign takes 3 pixels of width.
If you want to change it by... say... the letter "W" and the width of your "W" is, in example, 13 pixels - convert (in any hex calculator) this 13 to Hex value (will be 0D) and replace 03 03 09 by 03 0D 09 in any hex editor.
 

onepiecefreak

Kuriimu 2 Developer
OP
Member
Joined
Aug 12, 2015
Messages
525
Trophies
0
XP
1,733
Country
Germany
Thx for that explanation.
Unfortunately I already knew that. I was the one who recreated the bffnt.py in this font tool folder and also know which values exactly are for the glyph width.

The problem is that after editing it and injecting it back to the game, it doesn't affect the character at all. Changing the other 2 values does have an effect.

Sry, if this was too unclear until now.

P.S: But this explanation can help other people to understand a bit more. Thx
 
Last edited by onepiecefreak,
  • Like
Reactions: Anton299

Anton299

Well-Known Member
Member
Joined
Jan 18, 2012
Messages
126
Trophies
1
Age
50
Location
Kiev
Website
www.shedevr.org.ru
XP
359
Country
Ukraine
The problem is that after editing it and injecting it back to the game, it doesn't affect the character at all. Changing the other 2 values does have an effect.

Strange.
Well, sorry, I can't help you more... /

PS. (not completely sure, but...)
Maybe there is some "protection" (or something) of editing in game engine itself, so it doesn't allow you to edit the font or something else. For example, if you change dialogue text in Zelda:MM 3D and recalculate text pointers - all dialogues become corrupted (instead of edited text you will see just an empty text field with "ERROR" text (v1.0 of the game) (or just empty text field in v1.1), where this edited text should appear).
 
Last edited by Anton299,

onepiecefreak

Kuriimu 2 Developer
OP
Member
Joined
Aug 12, 2015
Messages
525
Trophies
0
XP
1,733
Country
Germany
Beside the glyph widthin the font, the font and dialogues are completely editable without problems. Do you think they would add a protection just for the glyph width?
 

onepiecefreak

Kuriimu 2 Developer
OP
Member
Joined
Aug 12, 2015
Messages
525
Trophies
0
XP
1,733
Country
Germany
I have to apologize @Anton299. There really is a protection just for glyph width in the game. There is a width table inside the decompressed code.bin of AATri.

For everyone who wants to know:
At the offset 0x0015b630 there is the width table. For every character there is a 2 byte value for the width. The list is 0x22e long as far as I could find out.
 
  • Like
Reactions: Anton299

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=pnRVIC7kS4s