• Rise from your gwave!

Translating Grandia

Discussion in 'Saturn Dev' started by TrekkiesUnite118, Sep 9, 2018.

  1. TrekkiesUnite118

    TrekkiesUnite118 New Member

    So I am still working on this. The main focus right now is on the menus. I'm starting with the Save menu and I've found out the following:

    • The SVLD.BIN file is what controls the Save and Load Screen. It appears to be uncompressed.
    • Save File names are not Stored in SVLD.BIN. They instead come from the Script in the MDT files.
    • There is a hard limit on the size of Save File names of 14 characters. This is the exact amount that will fit in the space available when using the 16x16 font.
    • The 8x16 font can still be enabled with the control code 0x03.
    • Using the 8x16 font will let the SVLD screen have more than 14 characters for a save file name, but even if you use it in the MDT file and extend the sizes accordingly, the game will crash when it loads an area with a Save Point that has a Save File name larger than 14 characters.
    • If the Script Header portion of the MDT files has a value of 0xE001, that code corresponds to the Save File Name.
    • The SVLD.BIN file is loaded into HWRAM at the offset 0x060B2000
    • The the pointers in the SVLD.BIN file for the text values are the HWRAM offsets, not the file offsets.
    • The text for the menu is drawn on VDP2 layer NGB3.
    • The text is written to VRAM bank A0.
    So with this info there the following issues and concerns:

    1. The 14 character limit is going to be a problem as some of the English scripts names for these files go beyond 14 characters.
    2. If we go the route of using the 0x03 control code size expansion is going to be a must. I've looked into this and I think it's possible but it's going to be a bit painful as it's most likely going to involve scanning SVLD.BIN for all pointers to each specific text value for the screen and updating them all as we expand the size. Not hard, but it needs to be perfect to work.
    3. Another route is changing the Save Load screen to use the 8x16 font by default. I've looked into this as well and it does give us enough space that size expansion may not be necessary outside of character names and one or two odd messages. However there is a snag here. While I can change the font, this screen seems to handle spacing a bit differently. If I just change the value to use the 8x16 font, I get this:
      [​IMG]
    4. With additional changes that control the spacing I can get it down to this at least:
      [​IMG]
    As you can see, there's still graphical garbage at the end of every bit of text. I've tracked it down and it looks like the game isn't blanking out as much of the buffer it uses to write each line, so garbage is getting into VRAM. When you use the 0x03 code this doesn't happen. You can also see that the highlighting bar isn't going the full width it should be.

    So I need to figure out how to fix these issues. If anyone wants to try messing with this, here's the values you need to change to enable the 8x16 font. Values are the offset in HWRAM, values for the SVLD.BIN file are in parentheses.:

    0xB4DC9 (0x2DC9) = Change the 02 to a 01.
    0xB37F7 (0x17F7) = Change the 02 to a 01.
    0xB3E94 (0x2E94) = Change the 00 to a 01.
     
    Last edited: Dec 5, 2018
    Ponut and vbt like this.
  2. klarth

    klarth New Member

    I think my thought on this right now is it might be best to make a text lookup table of all possible save locations in an unused RAM location. (Expand some standard file thats always in memory). The mdt filenames are modified to contain the 0x3 code followed by the indexes to these locations. Then the code that handles printing the names will, after seeing 0x3, start reading the text from the mdt file’s offset to write to the screen. Spacing should be fine, no corruption, and no crashing.

    This means the save data will not be expanded, which gets rid of the issue of having to remap all of those pointers. Also helps in making the save data format remain mostly compatible with grandia digital museum (when/if that gets translated)
     
  3. TrekkiesUnite118

    TrekkiesUnite118 New Member

    So that could work for the save file names. Though something like that is probably beyond my skillset to be honest.

    Though for some parts that are stored in the SVLD.BIN file we might still want to look into changing the font as there might not be enough space to have it point to an offset with the 0x03 code. For example Save and Load both only have 4 bytes available which might not be enough for a memory pointer and the 0x03 code depending on where it ends up at.
     
  4. Ms. Tea

    Ms. Tea New Member

    This is all really cool stuff! It looks like you've made amazing progress.

    In case it's any help, I did a little research on the FMV format last year and wrote up my notes here. It's stored in a Quicktime container, but some of the metadata in that container is misleading. The video is an unknown codec, but by appearance possibly an MPEG-1 variant decoded in software. The audio is CRI ADX, and is standard; if you extract that from the video you can play it back with anything else that supports ADX.
     
  5. TrekkiesUnite118

    TrekkiesUnite118 New Member

    So I figured I'd post an update. I've still been working on this and I've now successfully translated the following:

    All Menus (Save/Load, Config Options, Items/Equip/Magic/Moves/Status, Shops, Item Get, etc.)
    All Items
    All Monsters and their attacks.

    These have been done by pulling the data out of the Playstation version and injecting it into where it needs to go into the Saturn version. For the items this wasn't too hard as I just needed to put the English data into the file and adjust the pointers. For the monsters it was a bit more painstaking as there was no consistent pattern and all 200+ monsters had to be manually changed.

    Menus I was able to somewhat automate it with a tool that looked for pointers/offsets in the BIN files for those screens, and then updated those values based on the new data I wanted to put in to replace the Japanese text. This worked successfully for the most part, with only a few files needing hand adjustments afterwards. I'll be committing these tools to github after I take some time to clean the code up a bit.

    Here's some screenshots to show the progress:

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]


    However I have hit a snag. It seems that the English PS1 version created additional MDT files for some areas where the text was too big to fit into RAM. Basically the created a duplicate file from a parent MDT file, and put the overflow text into that one. This new file then takes the place of the original after certain story events have happened.

    I've looked into the possibility of recombining these files but I'm not sure if it will work as we may hit the same problem. So I'm curious if it's possible to do the same thing the PS1 version did and create these clone files and find a way to make the game use them. However that's probably going to take some time to figure out.
     
    Ponut likes this.
  6. TrekkiesUnite118

    TrekkiesUnite118 New Member

    EDIT:

    I realized I forgot to post some battle screenshots:

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    So I did some more digging and I have at least found what the game uses to know which MDT file to load when you change areas. At offset 0x06029A00 there's a table that lists all the files on the CD, with a value for what sector it's at, and how many bytes it is. The game references this when it wants to load a new file. How it knows which file to get out of this list though I don't know yet.

    However, I have been able to play around and have the game load different areas for me by changing the values for one MDT file to be that of another. So by doing this I was able to go from the Port of Parm to New Parm and test out the magic shop screen:

    [​IMG]

    Unfortunately this screen got modified in the English PS1 version, so some of those translations either wont fit or don't make sense, so I've had to improvise a bit here. I also tested out the buy screen and found I missed a word in the trade screen:

    [​IMG]

    Finally, just for fun I took Sue on a date to the Pirate Island. The game went a bit bonkers, I can only imagine because characters that should be in the party weren't there, and characters that shouldn't be in the party were there. The game eventually crashed when invisible Feena tried to speak after Justin spoke on behalf of a mermaid:

    [​IMG]
     
    Last edited: Feb 9, 2019
    Fandu, cafe-alpha, vergil2012 and 2 others like this.
  7. TrekkiesUnite118

    TrekkiesUnite118 New Member

    So I may have a work around for the issue of the PS1 version having more files due to a bigger script. I found out where the game determines what map to load next. It reads a value from a table in the MDT file, which is at the offset found at 0x30 in the MDT Header. That value tells it which map to load. However instead of updating every MDT file, I decided to take a stab at adding some code to the game, as it looks like this is what the PS1 version did as it's MDT files are unaltered at those offsets.

    For the time being I've added code that will check what file the game is loading. If it's loading any of the files that have clones for more script, it's going to check the scenario table which lives at 0x06021DC0. If the value is greater than or equal to the bare minimum for the overflow file, the code will change the file name to the new file. Otherwise it will continue loading as normal.

    So far I've tested this with success on the first new MDT file, 2001.MDT. This file should be used in Parm starting the day after you get back from the Sult Ruins. Using Debug mode to change the flags, I've able to confirm that this code works correctly, and so far no unexpected bugs have arisen from it. I have the code ready to go for the other files, I just need to find out what Scenario flags need set and what values they need set to and it should be good to go.

    Next, the remaining battle text that needs translated is not actually stored as text at all. It's actually graphics that need edited. However it looks like the data for those tiles is compressed. I've tracked the data down to MGDAT.BIN file in the BATLE directory, but I'm not experienced enough to really identify if it's a common compression format or not. This data encompasses the text for the icons in the circular battle menu, the text for the headers in the Items, Magic, and Skills windows, as well as the AI windows. If someone wants to take a shot at looking into this feel free to do so, I've attached a RAM dump and disasembly of where I think the decompression is happening. However, I have done some work on translating the post battle screens which had their tile data stored uncompressed in the ENDW.DAT file:

    [​IMG]

    [​IMG]

    [​IMG]

    Some of the tiles I didn't touch yet though as I didn't feel skilled enough to make something that looked good, nor could I find a font I found acceptable. So if someone wants to take a shot at that feel free to do so. I was a bit limited in space though, hence why it says EXP Points Won instead of Earned. The way the tiles are stored I couldn't get the lower case e to turn out right as the game is hardcoded to read the tiles in a specific way, and I haven't had the time to look into modifying that.

    Finally, I've also looked at editing the text in the Map screen. This is also graphics instead of text, and it's stored in the AMAP#.ADD files in the FIELD directory. However I think I'll need a graphics artist to deal with this. This text is drawn as VDP1 scaled sprites. I tried using a 32x32 font I found from Pokemon Stadium on ROMHacking.net, but no matter what I tried it turned out looking like crap when VDP1 scaled it. It looked fine in the tile editor though. You can see how it looked here:

    [​IMG]

    I think though that once I get the other scenario flags sorted out, I should be close to at least having a beta version patch for Disc 1 ready for people to play test.
     

    Attached Files:

    razor85 and Ponut like this.

Share This Page