Dealing with A Rose in the Twilight (JP) fonts for possible translation

Discussion in 'PS Vita - Hacking & Homebrew' started by Androu1, Jun 1, 2017.

  1. Androu1
    OP

    Androu1 Member

    Newcomer
    20
    24
    Oct 28, 2016
    Venezuela
    So, I got interested in trying my hand at "translating" the Japanese vita version of A Rose in the Twilight on the Vita, since the JP version is the only one playable on 3.60. This was simply because I thought it would be fun to do and I'd rather play on Vita than on PC.

    The text themselves were super simple to "translate", the PC string files work perfectly on Vita. The fonts however, have been a great deal of trouble, as the Vita version's font lack necessary characters and the PC fonts are too huge to use directly on the Vita version. So I'm putting this out there, just in case someone who's more skilled decides to take a crack at it.\

    First off, you can download the font files (just the font files) here: DOWNLOAD
    This ZIP contains all of the font files for both versions of the game.

    Below, I'll go into detail on the issues I've had and what little I've figured out regarding these fonts.


    What little I found

    0) Font0 is the font used when viewing the notes in the collection. Font1 is mostly used for texts like the tutorial at the start of the game, or like that "boulder is blocking the path" one early on. Font2 is used for the name of things, such as the name of notes in your collection or the name of areas in your map.

    1) The first byte (0x0 to 0x3) seems to be related to resolution or maybe some sort of typing? I couldn't really tell, but seemed to be related to resolution. Very different between the Vita fonts (which are usually 0004 0004 hex) and the PC fonts.

    2) The second byte (0x4 to 0x7) seems to be also related resolution, like the previous, but more directly. For example, Vita fonts seem to mostly have 3000 3000 hex. Decreasing this (for example, 3000 to 1800) without editing the font texture proper makes the font show up garbled (as if it were showing the font texture directly, if that makes sense).

    2.5) Whenever I downsized a PC font texture, I would copy over the first two bytes of the Vita's bin file to the PC's bin file. This mostly worked for font0, worked-but-not-really on font2 and didn't work on font1 at all (garbled data.)

    3) I have no idea what anything between 0x08 to 0x19 does, but touching most of it causes the game to crash on both the PC and Vita versions.

    4) The definitions for characters for the font seem to start at 0x20 and ranges until 0x33 for the first character. Each character is defined in 4 bytes, with the 4th byte being the character itself. I managed to swap characters around inside a single font, but I wasn't able to add my own characters (to circumvent the need to convert the PC version fonts and just edit the Vita font directly). I don't fully understand how this works.

    5) After the characters are defined, which varies greatly by font, the font texture appears. It starts with 0001 0100 hex. For example, the texture for the PC font0.bin files starts at offset 0x50a8. The texture's information continues until the very end of the file in every font, so it's the last thing.

    5.5) The font texture can be manually extracted by copying everything from the 0001 0100 to the bottom of the file and saving it as a new file with a TGA extension. I could open these up in Irfanview and Photoshop CC 2015. I was able to resize them to half the size, save them as RGB TGAs with an alpha channel (instead of indexed TGAs) and manually reintroduced them into the .bin files with a hex editor. This worked just fine as long as I did everything else right, for the most part. Editing the textures themselves is no problem.


    The issues I had

    1) Directly copying the PC font files over to the Vita version works just fine, technically. But the fonts are so massive that texts go off screen. That's the main issue.

    2) Font.bin is the same for both PC and Vita. It allows latin characters by default on Vita but it's ugly, too big for a font0 replacement and shows up completely messed up as a font1 or font2 replacement. It seems to be the only .bin file that has a TGA signature though, so it helped me figure out the textures.

    3) Font0's PC version font texture is exactly twice the size of the Vita's. Font2's is almost twice. Both of those can be resized just fine. However, the PC Font2 is longer vertically than it should be, compared to the Vita Font2, by about 140 pixels (after being already resized to half size for Vita). Removing the extra pixels would remove certain lines or possibly even cause crashes or other uncompatibilities with the font files. Putting it as is causes garbled fonts. It's probably not possible to properly convert it without proper understanding of these font .bin files.

    4) After I had properly edited font2, the texts for that font seemed to "collapse" on themselves. As in, there was barely any space between the letters, so it looked completely awful and unreadable. Using the PC font2 directly on Vita doesn't have that issue, but the text is massive enough to go off screen almost every time. It shows that the spacing issue should be fixable by just messing with the font2.bin file, though.

    4.5) Font0 and Font2 behaved differently on PC than on Vita when tested unless the game was set to Japanese (for Font2, at least), so using the PC version to test is only really good as a way to measure if the Vita will crash or not.

    5) Font0 has much more limited display space on Vita than on PC, so almost every letter is cut off somewhat. Probably completely unimportant though, since I kinda fixed it by just narrowing every character to fit the limitation. Would be nice if that could be avoided, though, but unimportant in the end.
     
    k7ra and DarkDragonLord like this.