News: 11 March 2016 - Forum Rules

Author Topic: Medarot 1 GB Translation  (Read 12705 times)

Variant

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Medarot 1 GB Translation
« on: September 19, 2013, 05:35:35 am »
So I started up a translation project for the original Medarot GB game (because it's a prequel that we never got here in the States), and after asking Danke for some help I was led here!

By searching around and finding random tutorials, I managed to replace all the tiles with English ones and make an English table. Then my problem was that I didn't know the story or the dialogue anyway, so having it in gibberish was even worse than having it in Japanese (which I also don't speak).

So my new plan was to:

1. Create a Japanese character table
2. Use said table + a Python script I wrote to extract any text in the ROM (lots of gibberish, but I got all the dialogue text too, from at least looking at the intro and playing picture matching) along with the addresses and size of the text
3. Get it translated (somehow, one of my friends said he'd help)
4. Use the English table I made to shove all the new text back in the game according to the addresses and sizes

So I haven't gotten it translated completely or anything, but I definitely noticed huge issues with the amount of space I have for text. My understanding is that all dialogue is called from somewhere through a pointer, so I found the start of the intro text and looked for references to it (doing the whole address/0x4000 -> bank number, then searched for <Bank Number><Last 2 bytes in little-endian>, making sure to add 80 or subtract 40 for the last byte), but I've had no luck so far with that.

Then I decided that maybe I'd be able to use BGB to setup access breakpoints to the location I wanted, but no luck (does BGB's debugger just show me dynamic memory? I'm assuming so).

For reference, the start of the introductory text I searched for was 0x5A849 (dec 370761), and the first text is:
76 4F 00 C0 E2 CC C7 D0 00 4B 23 C9 4C
こんにちは (NAME)

4B23C9 is (NAME) and 00 is space. 76 4F seems to indicate the start of dialogue, and 4C seems to indicate the end of the current chatbox (as in, hit A to continue).

The address I searched for was: 164968

And 2 bytes before and after it (164B68, 164868, etc...).

So, I was hoping maybe someone could give me some pointers (heh) so I can possibly figure out where to look, maybe even the structure. If there's a clear structure to dialogue text, then it might be possible for me to write a translator-helper program with a pretty GUI.

Edit: the 76 is actually probably just coincidence, I decided to do some other comparisons and I found a couple that didn't have the 7F 4B (just 7F), so ignore that! Also, 4F is probably actually representing the end of dialogue. That'd make more sense, given what I've found.

Edit2:

Huh, so I guess posting here magically solved my issue. I did a little more searching and realized that at least the intro text pointer was a 2 byte pointer (Searched starting from the C0). So now I guess my issue is... is there any way to somehow get this to be a 3 byte pointer so I can point it to the huge amount of spare data at the end address of the ROM?
« Last Edit: September 19, 2013, 06:45:42 am by Variant »

Sanky

  • Jr. Member
  • **
  • Posts: 5
  • Also known as Sanqui
    • View Profile
    • https://sanqui.net
Re: Medarot 1 GB Translation
« Reply #1 on: September 19, 2013, 06:59:08 am »
Hi!  Me and Kimbles have been working on a Medarot 1 translation patch for a bit.  It's currently hosted over at Bitbucket, together with a very partial disassembly:
https://bitbucket.org/Sanky/medarot
See "english" branch for the translation patch:
https://bitbucket.org/Sanky/medarot/src?at=english
You can also compare them to see what changes were done in the patch.
https://bitbucket.org/Sanky/medarot/compare/english..master#diff (warning, large)

You can also see all current English translations at the Medapedia wiki:
http://medarot.meowcorp.us/wiki/User:Kimbles/Medarot_1_Hacking_Notes/Text
Unfortunately, the game's texts seem to be ordered in a pretty wild fashion, but at least the battle texts are together:
http://medarot.meowcorp.us/wiki/User:Kimbles/Medarot_1_Hacking_Notes/Text/Battles

Anyway, there isn't much to show, but a framework for a translation is being built.  I wrote a VWF for the game, so more text can fit onscreen and Medarot names won't have to be shortened.
Here are some pretty dumb screenshots of the last build:


Text codes are broken, oh well.

Untranslated overworld dialogue still uses Japanese instead of gibberish.


Alas, yeah, that's all we have to show for now.  I should look into it more soonish.

Anyway, to answer some of your questions:
Quote
By searching around and finding random tutorials, I managed to replace all the tiles with English ones and make an English table.
Guess you know the game uses Malias compression then.  I didn't really work with is in my patch-since there's plenty of space, I just replaced the compressed graphics with full 1bpp and 2bpp gfx.  I did write a decompressor a while back, though.
Quote
4B23C9 is (NAME) and 00 is space. 76 4F seems to indicate the start of dialogue, and 4C seems to indicate the end of the current chatbox (as in, hit A to continue).
Actually, 4F indicates the /end/ of a dialogue, in your case of the previous string.  It's followed by varying end codes, 00 is the most common one which just closes the box.

Anyway, there are pointer tables at the start of the text banks linking to each text in the bank.

Quote
is there any way to somehow get this to be a 3 byte pointer so I can point it to the huge amount of spare data at the end address of the ROM?
Theoretically.  It'd be easier to just introduce a new text code to jump to another bank, like I did in the Telefang patch.
« Last Edit: September 19, 2013, 07:21:15 am by Sanky »

Variant

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: Medarot 1 GB Translation
« Reply #2 on: September 19, 2013, 07:19:32 am »
Oh cool, I didn't realize you were still working on this. Yeah, it was by googling and looking at the stuff you had done that I was able to get as far as I did. And I edited my post with 4F being the end a little late I guess. I realized it after searching a bit more.

From what it looks like, you're working with a ROM that already has the English tileset in? I was going with the approach that I outlined earlier (dump from JP rom, translate, then put back into JP using EN table, then convert tileset).

My next step after figuring out the space issue was to make translation easier and edit in real time, and it looks like you guys are working towards a similar end.

The legend you wrote up is really helpful. Clarifies a lot of the unknowns I was trying to figure out (4A, 4D, 4B).

This is my first ROM hacking project and I've only been at it 2 days, so sorry if it sounds stupid but... what's a VFW? I can make a guess from context, but I'd rather not confuse myself further.

Also, from looking at your Telefang patch, it looks like I should find where the text is referenced, and rewrite the ASM at that point to JMP to an empty bank? I'm a little unfamiliar with how the GB arch works, but my assumption is that I'd jump down to an empty bank (probably changing some register that keeps track of the current bank), and then it'd read from there, and then would I just change back to B16 immediately afterwards?

E.g.

<ASM that was here before>
Jump to bank 17 (currently in 16)
<ASM that was here before>
Jump to bank 16

Edit: Oh! Just noticed that you have both japanese and english still in there (overworld text and the other screenshots)

Also, I'm working with Kuwagata version, which shouldn't make toooooo big a difference really...
« Last Edit: September 19, 2013, 07:27:32 am by Variant »

Sanky

  • Jr. Member
  • **
  • Posts: 5
  • Also known as Sanqui
    • View Profile
    • https://sanqui.net
Re: Medarot 1 GB Translation
« Reply #3 on: September 19, 2013, 07:32:28 am »
Quote
Oh cool, I didn't realize you were still working on this.
Oh, right, you saw that.  Well, I'm a bit more experienced than back then, so I just started over.
Quote
From what it looks like, you're working with a ROM that already has the English tileset in?
Yeah.  For dialogue, it uses the Japanese font by default, but switches to english with a new special code ($49).  For all menus it uses an English tileset though, so they're gibberish until translated.  They have priority anyway over dialogue, anyway.
Quote
The legend you wrote up is really helpful. Clarifies a lot of the unknowns I was trying to figure out (4A, 4D, 4B).
Actually, Kimbles wrote that ;)  She figured out and wrote down a lot and is the one doing the translating.
Quote
This is my first ROM hacking project and I've only been at it 2 days, so sorry if it sounds stupid but... what's a VFW? I can make a guess from context, but I'd rather not confuse myself further.
Oh, right, sorry.  VWF stands for variable width font.  Essentially it means you aren't limited to 8 pixel wide characters when printing text.  I think it looks more professional and also allows more text to fit in menus etc, so programmed it in.  The way Medarot is written means that some static menu text is going to stay fixed-width, but most dialogue and variables (Medarot, item, part names etc) can be variable width which means they don't have to be shortened as much.
Quote
Also, from looking at your Telefang patch, it looks like I should find where the text is referenced, and rewrite the ASM at that point to JMP to an empty bank? I'm a little unfamiliar with how the GB arch works, but my assumption is that I'd jump down to an empty bank (probably changing some register that keeps track of the current bank), and then it'd read from there, but then would I change back immediately afterwards?
Essentially, I guess.  When the game is reading text, it reads byte after byte and checks if it's one of the control codes, like newline, speed change, variabe etc.  If it's one of these, it does stuff, otherwise, it just prints the equivalent character on-screen.  What I did in Telefang was adding a new control code it checks for (EC) followed by two bytes, which makes it change the bank and place it's reading text from.
« Last Edit: September 19, 2013, 07:38:36 am by Sanky »

Variant

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: Medarot 1 GB Translation
« Reply #4 on: September 19, 2013, 07:45:58 am »
Oh, right, sorry.  VWF stands for variable width font.  Essentially it means you aren't limited to 8 pixel wide characters when printing text.  I think it looks more professional and also allows more text to fit in menus etc, so programmed it in.  The way Medarot is written means that some static menu text is going to stay fixed-width, but most dialogue and variables (Medarot, item, part names etc) can be variable width which means they don't have to be shortened as much.

Oh, glad I didn't guess. Is there a document out there somewhere I can look at to learn about this? I found a library called TrueText after googling, but I'm still a little confused since my understanding was that the 8x8 tile thing was a result of the Gameboy only being able to 'draw' 8x8 tiles at a time. Or is it just more of a 'Place Images next to each other' sorta deal?

Quote
Essentially, I guess.  When the game is reading text, it reads byte after byte and checks if it's one of the control codes, like newline, speed change, variabe etc.  If it's one of these, it does stuff, otherwise, it just prints the equivalent character on-screen.  What I did in Telefang was adding a new control code it checks for (EC) followed by two bytes, which makes it change the bank and place it's reading text from.

Oh. So there's just a function defined somewhere in the ROM that handles all the control codes, and you just added a new case in for EC?

Anyway, thanks for answering all these questions. I really appreciate the information, I'm learning a lot here from this little project.

Sanky

  • Jr. Member
  • **
  • Posts: 5
  • Also known as Sanqui
    • View Profile
    • https://sanqui.net
Re: Medarot 1 GB Translation
« Reply #5 on: September 19, 2013, 07:59:39 am »
Quote
Oh, glad I didn't guess. Is there a document out there somewhere I can look at to learn about this? I found a library called TrueText after googling, but I'm still a little confused since my understanding was that the 8x8 tile thing was a result of the Gameboy only being able to 'draw' 8x8 tiles at a time. Or is it just more of a 'Place Images next to each other' sorta deal?
The tilemap on screen consists of 8x8 tiles.  (Japanese) games usually keep the whole font loaded in memory at once and just set the tilemap to use one of the tiles when printing text.  As you probably know, Japanese characters are all square, so it works out quite well.

The Latin writing system's a bit different, though.  Letters are supposed to have different widths, and if you don't do that, things look ugly.  To implement that on a Gameboy, you have to draw the tiles by combining the letters manually, and then set these on the screen.

If you don't do that, you end up with ugly looking fixed width text like in Pokémon, and you can only fit very little dialogue on screen at once.

Of course, it's possible to add a VWF to Pokémon, too.


Quote
Oh. So there's just a function defined somewhere in the ROM that handles all the control codes, and you just added a new case in for EC?
Yeah.

Quote
Anyway, thanks for answering all these questions. I really appreciate the information, I'm learning a lot here from this little project.
No problem.  You can also catch me on IRC, me and Kimbles hang out in #telefang on irc.badnik.net and I recently joined #romhacking too.