News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Poll

What's your favorite flavor of ice cream?

Strawberry
1 (14.3%)
Chocolate
1 (14.3%)
Vanilla
2 (28.6%)
Mint Chocolate Chip
2 (28.6%)
I like cake better
1 (14.3%)

Total Members Voted: 6

Voting closed: January 18, 2011, 07:02:58 pm

Author Topic: Expanding the script  (Read 11175 times)

Arcadia453

  • Guest
Expanding the script
« on: January 17, 2011, 02:39:11 am »
I'm trying to translate the game Magi Nation for the GBA from Japanese to English. I was very disappointed that it never came out in English, so I'm definitely dedicated to this one.

There's two ways I think I might be able to do it...
In hex I can actually see the English script, but I can't figure out how to switch from the Japanese one to the English one. How could I do that?
I've managed to make the Japanese script show English characters, but the problem is that it's too short for what I want to replace it with. I try to push everything back, but the text always starts in the same place, and I can't figure out where it's coming from. How can I fix that?

Thanks

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Expanding the script
« Reply #1 on: January 17, 2011, 05:05:00 am »
In hex I can actually see the English script, but I can't figure out how to switch from the Japanese one to the English one. How could I do that?
I've managed to make the Japanese script show English characters, but the problem is that it's too short for what I want to replace it with. I try to push everything back, but the text always starts in the same place, and I can't figure out where it's coming from. How can I fix that?

The answers to both your questions are in the same place.

This is first-timer stuff: what you're asking about is pointers. Usually, they're all gathered up together in one big table. Each pointer is a hex address indicating the start of a different string in the game's script. For a GBA game, finding them should be a simple matter of hex searching the address where one of the strings starts. GBA ROM addresses are offset by $08000000; i.e., if you're looking for a pointer to $158BA, it'll actually be $080158BA - and little-endian to boot (so it'll be stored as BA 58 01 08).

You can change 'em manually, but that's a one-way ticket to the crazy bin. Instead, you'll use a tool like Cartographer to dump the ROM, then format it so you can use a tool like Atlas to reinsert the script and modify the pointers as necessary. Do it right and the only hard part will be translation. :3
In the event of a firestorm, the salad bar will remain open.

Normmatt

  • Full Member
  • ***
  • Posts: 139
    • View Profile
Re: Expanding the script
« Reply #2 on: January 17, 2011, 06:35:52 am »
In hex I can actually see the English script, but I can't figure out how to switch from the Japanese one to the English one. How could I do that?
I've managed to make the Japanese script show English characters, but the problem is that it's too short for what I want to replace it with. I try to push everything back, but the text always starts in the same place, and I can't figure out where it's coming from. How can I fix that?

The answers to both your questions are in the same place.

This is first-timer stuff: what you're asking about is pointers. Usually, they're all gathered up together in one big table. Each pointer is a hex address indicating the start of a different string in the game's script. For a GBA game, finding them should be a simple matter of hex searching the address where one of the strings starts. GBA ROM addresses are offset by $08000000; i.e., if you're looking for a pointer to $158BA, it'll actually be $080158BA - and little-endian to boot (so it'll be stored as BA 58 01 08).

You can change 'em manually, but that's a one-way ticket to the crazy bin. Instead, you'll use a tool like Cartographer to dump the ROM, then format it so you can use a tool like Atlas to reinsert the script and modify the pointers as necessary. Do it right and the only hard part will be translation. :3

The translation is already in the game so the only hard part is dumping the japanese and english and replacing the japanese. Or better yet change the pointer to the japanese pointer table to the pointer to the english pointer table.

syntax error

  • Full Member
  • ***
  • Posts: 227
    • View Profile
Re: Expanding the script
« Reply #3 on: January 17, 2011, 02:57:43 pm »
"I'm trying to translate the game Magi Nation for the GBA from Japanese to English. I was very disappointed that it never came out in English"

Magi-Nation is available on GBC in English

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Expanding the script
« Reply #4 on: January 17, 2011, 03:21:52 pm »
We're talking the GBA version, though.

So yeah. If there's already an English script in there, and it corresponds exactly with the Japanese script, all you have to do is dig up the pointer table and make it point to the English strings instead of the Japanese ones. Fun times.
In the event of a firestorm, the salad bar will remain open.

Arcadia453

  • Guest
Re: Expanding the script
« Reply #5 on: January 17, 2011, 08:30:04 pm »
I tried looking for pointers, but I had trouble finding specific ones. Maybe I was doing it wrong. Is there usually one pointer at the beginning of the script, or are there several throughout?

Thanks again

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Expanding the script
« Reply #6 on: January 17, 2011, 08:42:35 pm »
Pointers will usually be in one big block - that is, there will be a "pointer table" somewhere in the ROM consisting of pointers to all the game's strings in sequence. It may be near the script, but it doesn't have to be.
In the event of a firestorm, the salad bar will remain open.

DeGamer

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • My vids & stuff
Re: Expanding the script
« Reply #7 on: January 17, 2011, 11:44:40 pm »
Wow, you are so lucky. The game you want to translate not only has an English version out on another system, but the version you want to hack has an English script in it already! Damn boy, I need your favorite numbers so I can go play the lottery.  :P

They obviously planned an English release but it got canned. I feel your pain Arcadia453. So many games this has happened to, including mine.  :(

I wonder though....perhaps your game has a pointer to a region (or script pointer)? Region, meaning country. If it does, all you have to do is find that single pointer and mess with the values until it changes the script to English. Resident Evil 2 for the PS1 was like this where it had both Japanese and English scripts. All I did was change 2 bytes and bam! I could switch from Japanese to English and vice versa without having to modify the script or its dialog pointers. This type of pointer can be a bitch to find though (at least for me it was). The only other game I found one like it was in X-men vs Street Fighter for the Saturn.


Ryusui:
Do you know if Cartographer has a command like #BASE POINTER to subtract a value instead of adding? I need to do that for the game I'm working on and if it doesn't, it looks like I'll be on my way to the crazy bin. I don't see such a command in the readme, which tells me there isn't one but I wanted ask to make sure.

It may be near the script, but it doesn't have to be.

You can say that again. the game I'm working one has pointers scattered in various ways. Some are underneath the text block (easy), some can be found by comparing the location of the text in the game and a save state and finding the difference in memory (not too hard), and some have pointers nowhere near the dialog or text block and are stored in a different format and require a different calculation (pain in the ass).
Yo were can I git dem roms at??!!11!
Oh shit you can hack games now???????
Translate my game pleeze!!!11!!1 It only haz a small exabyte block of text.
Can my avatar size be over 9000? Ppleeze! Me love you forevr longtime!!!111!1

Normmatt

  • Full Member
  • ***
  • Posts: 139
    • View Profile
Re: Expanding the script
« Reply #8 on: January 18, 2011, 12:57:52 am »
Wow, you are so lucky. The game you want to translate not only has an English version out on another system, but the version you want to hack has an English script in it already! Damn boy, I need your favorite numbers so I can go play the lottery.  :P

They obviously planned an English release but it got canned. I feel your pain Arcadia453. So many games this has happened to, including mine.  :(

I wonder though....perhaps your game has a pointer to a region (or script pointer)? Region, meaning country. If it does, all you have to do is find that single pointer and mess with the values until it changes the script to English. Resident Evil 2 for the PS1 was like this where it had both Japanese and English scripts. All I did was change 2 bytes and bam! I could switch from Japanese to English and vice versa without having to modify the script or its dialog pointers. This type of pointer can be a bitch to find though (at least for me it was). The only other game I found one like it was in X-men vs Street Fighter for the Saturn.


Ryusui:
Do you know if Cartographer has a command like #BASE POINTER to subtract a value instead of adding? I need to do that for the game I'm working on and if it doesn't, it looks like I'll be on my way to the crazy bin. I don't see such a command in the readme, which tells me there isn't one but I wanted ask to make sure.

It may be near the script, but it doesn't have to be.

You can say that again. the game I'm working one has pointers scattered in various ways. Some are underneath the text block (easy), some can be found by comparing the location of the text in the game and a save state and finding the difference in memory (not too hard), and some have pointers nowhere near the dialog or text block and are stored in a different format and require a different calculation (pain in the ass).

Too work with GBA pointers in Cartographer i used "#BASE POINTER:      $F8000000" as a minus 0x08000000

DeGamer

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • My vids & stuff
Re: Expanding the script
« Reply #9 on: January 18, 2011, 02:34:32 pm »
So you're saying, for example, if I want to subtract 4000h, I put in $F0004000 and this works for you?
Yo were can I git dem roms at??!!11!
Oh shit you can hack games now???????
Translate my game pleeze!!!11!!1 It only haz a small exabyte block of text.
Can my avatar size be over 9000? Ppleeze! Me love you forevr longtime!!!111!1

RedComet

  • Hero Member
  • *****
  • Posts: 3163
    • View Profile
    • Twilight Translations
Re: Expanding the script
« Reply #10 on: January 18, 2011, 03:23:53 pm »
Just put -$4000. The sample command files demonstrate this ability. ::)
Twilight Translations - More than just Dragonball Z. :P

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Expanding the script
« Reply #11 on: January 18, 2011, 03:37:39 pm »
Yeah, I've never had trouble just putting down a minus sign.
In the event of a firestorm, the salad bar will remain open.

DeGamer

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • My vids & stuff
Re: Expanding the script
« Reply #12 on: January 18, 2011, 04:24:04 pm »
Just put -$4000. The sample command files demonstrate this ability. ::)
&
Yeah, I've never had trouble just putting down a minus sign.

I'll have to try that out now. Thank you for saving me going to the bin. ;)

Hmm.... I looked at the sample commands and that's not included with what I have. It's not mentioned in the read me either. It mentions the #BASE POINTER command with adding a value and nothing else. :huh:

Did you release a newer version or something with some added examples? I have PR3. I triple checked the files with the Cartographer I have and I don't see this ability demonstrated anywhere. I read them entirely. I didn't want to thrown in extras in the commands that were not mentioned, thus messing up the output.

« Last Edit: January 18, 2011, 04:43:59 pm by DeGamer »
Yo were can I git dem roms at??!!11!
Oh shit you can hack games now???????
Translate my game pleeze!!!11!!1 It only haz a small exabyte block of text.
Can my avatar size be over 9000? Ppleeze! Me love you forevr longtime!!!111!1

Ryusui

  • Hero Member
  • *****
  • Posts: 4989
  • It's the greatest day.
    • View Profile
    • Tumblr
Re: Expanding the script
« Reply #13 on: January 18, 2011, 09:07:35 pm »
Just make a copy of the ROM and test to see if negative offsets work properly.
In the event of a firestorm, the salad bar will remain open.

Normmatt

  • Full Member
  • ***
  • Posts: 139
    • View Profile
Re: Expanding the script
« Reply #14 on: January 19, 2011, 01:38:24 am »
Just put -$4000. The sample command files demonstrate this ability. ::)

Not in the current build in the Utilities section its not. Using minus in that version didn't work for me either hence my ugly work around.

RedComet

  • Hero Member
  • *****
  • Posts: 3163
    • View Profile
    • Twilight Translations
Re: Expanding the script
« Reply #15 on: January 19, 2011, 08:57:20 am »
Just put -$4000. The sample command files demonstrate this ability. ::)

Not in the current build in the Utilities section its not. Using minus in that version didn't work for me either hence my ugly work around.

That's weird. Maybe the build I released was older than the one I'm using. :S I'm gonna hopefully look into fixing the bugs I know about in Cartographer soon. In the mean time, here's an example:

Code: [Select]
#BLOCK NAME: Card Descriptions
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER ENDIAN: LITTLE
#POINTER TABLE START: $6DB2 //Bank 01
#POINTER TABLE STOP: $6DF4
#POINTER SIZE: $02
#POINTER SPACE: $00
#ATLAS PTRS: Yes
#BASE POINTER: -$3FF0 //Script begins before $8000
#TABLE: dbz2.tbl
#COMMENTS: Yes
#END BLOCK
Twilight Translations - More than just Dragonball Z. :P

Normmatt

  • Full Member
  • ***
  • Posts: 139
    • View Profile
Re: Expanding the script
« Reply #16 on: January 19, 2011, 08:02:52 pm »
I just had a look into the game and it uses relative pointers for the main dialogue not standard GBA type pointers. The pointer table starts at 08051070 and by the looks of the text at 08756A08

It calculates it by doing this:
Code: [Select]
//R3 is string id?
LDR     R1, =unk_8051070
LSLS    R0, R3, #2
ADDS    R0, R0, R1
LDR     R0, [R0]
LDR     R1, =unk_8756A08
ADDS    R0, R0, R1

Which basically means read 32bits from (stringID*2 + 08051070) then add that to 08756A08 to get the final string location.

I haven't found any way of switching between the english and japanese text yet and it doesnt look like it was ever programmed in so you'll probably need to extract the english dialogue and replace the japanese dialogue.

DeGamer

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • My vids & stuff
Re: Expanding the script
« Reply #17 on: January 20, 2011, 03:09:05 pm »
I haven't found any way of switching between the english and japanese text yet and it doesnt look like it was ever programmed in so you'll probably need to extract the english dialogue and replace the japanese dialogue.

That would be a shame if the game wasn't programmed for both languages despite the script being there.  However, even if Arcadia453 changed each pointer from the Japanese dialogs to the English counterparts (which is probably what he'll have to do), this wouldn't necessarily change how the font's width of the Japanese characters are displayed to how the English font width should be displayed would it? Meaning, the game also may not be programmed to display a VWF, right?


Just put -$4000. The sample command files demonstrate this ability. ::)

Not in the current build in the Utilities section its not. Using minus in that version didn't work for me either hence my ugly work around.


So it's not just me.  :huh:


Just make a copy of the ROM and test to see if negative offsets work properly.

No dice. It just outputs other non-text data which is not part of the script or crashes the program. Unless I'm doing this wrong, which I think I am (and I've never used Cartographer before but I think I understand all the commands as I can get a script dump of my game, just not with the POINTER_RELATIVE method).

Here's what I'm doing:

Code: [Select]
#BLOCK NAME: Navi Hints 1 (POINTER_RELATIVE)
#TYPE: NORMAL
#METHOD: POINTER_RELATIVE
#POINTER TABLE START: $1AC830
#POINTER TABLE STOP: $1AC859
#POINTER SIZE: $04
#POINTER SPACE: $04
#POINTER ENDIAN: LITTLE
#ATLAS PTRS: YES
#BASE POINTER: -$3FE7F080 //subtract $3FE7F080 to each pointer to get
#TABLE: Navi Hints.tbl //the string address
#COMMENTS: YES
#END BLOCK

This is just a small section of the table I was using as a test to see if I could get a dump of what I need this way. The pointers are 32bit (which is probably the part confusing me) and there are 4 bytes of code between each pointer. The first pointer located at address 001AC830 has a value of 4C D5 06 80 which points to a string at address 0016ED0C.

If I take the string address' last two bytes ED 0C and reverse them, 0C ED and add 3FE8 it gives me the first two bytes of the pointer 4C D5. If I take the string address' first two bytes 00 16, and reverse them, 16 00 and add F080 it gives me the last two bytes of the pointer 06 80.

Now if I take the whole string address (00 16 ED 0C)  and reverse it (0C ED 16 00) and add 3F E7 F0 80, it gives me the whole pointer value of 4C D5 06 80 (which is the correct pointer but in the amount I was adding, I had to subtract 1 from the second byte based on what I wrote above). This is what I understand based on all the documents I've read here which did help me find these type of pointers.

So wouldn't that mean that taking the pointer value 4C D5 06 80 and subtracting 3F E7 F0 80 give me the string address of 0016ED0C (but reversed)?  In my scenario, shouldn't -$3FE7F080 be my BASE POINTER? I also tried -$F0803FE7 but both of those crashes the program (out of range?). Maybe I'm not understanding this right or I'm looking at it wrong.   :-\
Yo were can I git dem roms at??!!11!
Oh shit you can hack games now???????
Translate my game pleeze!!!11!!1 It only haz a small exabyte block of text.
Can my avatar size be over 9000? Ppleeze! Me love you forevr longtime!!!111!1