News:

11 March 2016 - Forum Rules

Main Menu

Locating the VWF Width Table?

Started by Almagest, November 29, 2014, 10:44:17 AM

Previous topic - Next topic

Almagest

How do you find it with a hex editor? I'm hacking the US version of Castlevania: Aria of Sorrow, and I'd like to adjust the width of the special characters I've added (like "á", "ï", "ò", "û"...). Are they usually near the font, or they can be found anywhere?

FAST6191

Unlike pointers I do not really have any easy tricks that are remotely reliable for finding VFW tables, if indeed you do have a table and it is not wound into the encoding, the font itself or something similar.
You can try searching for known widths in font or encoding (if different) order, however even there you tend to have absolute width and off baseline options (if the character is 8 pixels wide but most are 4 then the game might have a value of 4 to indicate an increase of 4 pixels).

To that end your only real option, if you do not get lucky and find it some other way, are to trace through the font handling for the game. Here you will want to first find whether the text is OAM/sprite or BG (it should be BG for most games as it is the better option but assuming devs, much less Konami handheld devs, follow best practice is not a good bet) and watch it get from memory into VRAM. Once you have found the text handling engine, and it is not hard to get most games to display some text on command, it should just be a matter of finding out how it gets the value to space the next character.

henke37

Just note that there may also be kerning tables.

FAST6191

Have you seen one in a GBA/DS game? The most I ever tend to see is the font handling will add two (or some small number of) pixels between each character and leave it up to the font/devs to make sure it works, a mighty annoying situation if I am trying to use a skinny font but have the wide characters encoded over a couple of tiles.
Mind you I have certainly not pulled apart enough font engines to even make a proper "in my experience" comment.

VicVergil

Quote from: Almagest on November 29, 2014, 10:44:17 AM
How do you find it with a hex editor? I'm hacking the US version of Castlevania: Aria of Sorrow, and I'd like to adjust the width of the special characters I've added (like "á", "ï", "ò", "û"...). Are they usually near the font, or they can be found anywhere?

Do you mind sharing where did you find the font in that game? (and how other graphics/the text are compressed too) Thanks a million :)

That aside, I was once working on Sword of Mana (but gave up due to how scary the dictionnary encoding was) and did manage to change the width for characters with a very dumb method.

Taking a certain letter's glyph and drawing a wide horizontal line covering all of the available tile(s), doing the same for another letter but with the horizontal line placed at a different height, and then changing a text string to have a succession of those letters (usually "fghijklmn" yields the most interesting results) and take a screenshot at native resolution of how that string appears in-game. I count the pixels manually and then try searching for the values in hexadecimal with a hex search in the rom. Sometimes adding/substracting 1 from the values. I've had a degree of success with this ....
Except for two cases - that is Landstalker (MD) and the English translation of Treasure Hunter G. Those just look at the tiles and draw them covering only the width covered by the tile, and then leaving one pixel. So no width tables here. But this isn't a very good method since ligatures, and words written with multiple tiles to save text space, are no longer possible this way.

Almagest

#5
@GHANMI: Sure. It was easy to find, the fonts aren't really compressed.

You can find them with either Tile Molester or YY-CHR, but you must set it to 1bpp (it doesn't matter if it's linear or planar, it works both ways, as long as you don't choose "reverse order"), then choose 1-Dimensional. They're near the end of the ROM, around the offset $509680. The letters will still look messed up and in diagonals, so you'll have to adjust the size of the blocks. I don't know the exact numbers to make it look perfect, sorry. But with 1 column and 7 rows I was able to add the characters without problems.

Quote from: FAST6191 on November 29, 2014, 10:55:10 AM
To that end your only real option, if you do not get lucky and find it some other way, are to trace through the font handling for the game. Here you will want to first find whether the text is OAM/sprite or BG (it should be BG for most games as it is the better option but assuming devs, much less Konami handheld devs, follow best practice is not a good bet) and watch it get from memory into VRAM. Once you have found the text handling engine, and it is not hard to get most games to display some text on command, it should just be a matter of finding out how it gets the value to space the next character.
I disabled the first BG with an emulator and the text vanished.

I can't understand a thing from the Memory Viewer though.