+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  SNES/GBA emulators with text hooking utility?
Pages: [1] 2
Author Topic: SNES/GBA emulators with text hooking utility?  (Read 1 times)
mario.g@email.it
Guest
« on: April 15, 2010, 06:31:39 am »

Since I don't know Japanese and I'd still be interested in playing lots and lots of untranslated games, are there emulators for either GBA or SNES with a text hooking feature? Recently I saw FCEUXD SP edition for NES which this so maybe there may be something similar for other consoles as well.
Tauwasser
Guest
« Reply #1 on: April 15, 2010, 07:59:38 am »

It seems the whole system is less of a hook and more of a manual selection mode that will tell you what values the tiles use. You then have to make a table file for it to make sense of it to become useful and be translated via an internet engine...

It seems the author, UglyJoe, didn't know too much about encodings before and still doesn't. I wonder why he didn't ask here... Oh well. Anyway, it seems entirely redundant from a rom hacking perspective. Hals his screenshots even feature mistakes he either did in his table file or went unnoticed while testing or something.

cYa,

Tauwasser
UglyJoe
Guest
« Reply #2 on: April 18, 2010, 12:38:01 am »

Sorry, OP, there's no magic bullet.  Learning kana well enough to be able to type up menu options and items into a dictionary or machine translator really doesn't take too long, so I'd recommend going with that option.

Quote from: Tauwasser on April 15, 2010, 07:59:38 am
It seems the author, UglyJoe, didn't know too much about encodings before and still doesn't. I wonder why he didn't ask here... Oh well.

With such pleasant personalities like yourself on RHDN, you really wonder why?  Where is this "and still doesn't" insult coming from?  How do you know what I have and haven't learned in the last couple of years?  If you want to trash my software go right ahead, but there's no reason to trash the coder.

This was a personal project that I never widely distributed.  It worked on my then-current XP installation and that was good enough for me.  Somebody added it to RHDN and then someone else pulled it into FCEUX (which they really shouldn't have).  It is naturally not a useful rom hacking tool since it has nothing to do with rom hacking.
mario.g@email.it
Guest
« Reply #3 on: April 18, 2010, 05:35:27 pm »

Quote from: UglyJoe on April 18, 2010, 12:38:01 am
Sorry, OP, there's no magic bullet.  Learning kana well enough to be able to type up menu options and items into a dictionary or machine translator really doesn't take too long, so I'd recommend going with that option.

But, does your tool do it for the NES roms? Because i'd be interested in playing some NES games as well..
Tauwasser
Guest
« Reply #4 on: April 18, 2010, 05:57:47 pm »

Quote from: UglyJoe on April 18, 2010, 12:38:01 am
With such pleasant personalities like yourself on RHDN, you really wonder why?  Where is this "and still doesn't" insult coming from?  How do you know what I have and haven't learned in the last couple of years?  If you want to trash my software go right ahead, but there's no reason to trash the coder.

There was no insult intended. I was simply going by the news posts. What you can and cannot do is entirely your business.

cYa,

Tauwasser
UglyJoe
Guest
« Reply #5 on: April 18, 2010, 06:26:01 pm »

Quote from: mario.g@email.it on April 18, 2010, 05:35:27 pm
But, does your tool do it for the NES roms? Because i'd be interested in playing some NES games as well..

With some effort you can get it to work (although the excite.co.jp auto-translate feature doesn't work anymore).  You have to run the emulator through AppLocale and set it to the Japanese locale or else all you'll see is gibberish in the Hooked Text display.  You also need to know how to build table files for each game or else it won't work at all (and if the game uses multiple tables you're pretty much SOL).  If you can get it up and running, the docs folder explains how to use it.

Even if you do all that, though, it's still not terribly helpful.  It won't translate the game for you.  It turns Japanese text in a game that you can't read into Japanese text on your clipboard that you can't read.  Feeding hooked dialog into machine translators won't work since it's all kana.  It works okay for menus (and sometimes items), but, again, there's probably less effort involved in learning how to type those up into some dictionary software manually.

Quote from: Tauwasser on April 18, 2010, 05:57:47 pm
There was no insult intended. I was simply going by the news posts. What you can and cannot do is entirely your business.

Sorry I snapped at you, then.
Dwedit
Guest
« Reply #6 on: April 18, 2010, 07:14:31 pm »

I'm sure you can ASM hack a GBA game to do text hooking in VisualBoyAdvance with an unmodified emulator.  Just use the VBA_PRINT SWI call that only exists on VBA.  Find where the game reads its characters, turn them into Shift-JIS, run VBA with applocale, and hook away!

The reason Text Hooking works so well on a NES is that games have a read only font that's actually made up of tiles.  GBA games tend to draw text into tile data.
mario.g@email.it
Guest
« Reply #7 on: April 19, 2010, 02:29:51 am »

Quote from: Dwedit on April 18, 2010, 07:14:31 pm
I'm sure you can ASM hack a GBA game to do text hooking in VisualBoyAdvance with an unmodified emulator.  Just use the VBA_PRINT SWI call that only exists on VBA.  Find where the game reads its characters, turn them into Shift-JIS, run VBA with applocale, and hook away!

The reason Text Hooking works so well on a NES is that games have a read only font that's actually made up of tiles.  GBA games tend to draw text into tile data.

Huh, that's pretty great, but can it done with minimal hacking knowledge? May you give some little more detailed steps on how to do that?
« Last Edit: April 19, 2010, 02:44:00 am by mario.g@email.it »
Spikeman
Guest
« Reply #8 on: April 19, 2010, 04:16:16 pm »

The hardest part would be converting to SJIS. Assuming a little ASM knowledge the easiest way to accomplish that would be a simple lookup table.

For the game Tomato Adventure , I went ahead and found the text routine. At 806DF10, there is the instruction ldrb r1,[r0]. This loads the next character to display into r1.

To make a text hooking routine I would replace this instruction with a call to my own routine. Use a bl your_address if the location you intend to put your routine is in range, if not use ldr r1,=your_address, push r14, bx r1 (note: I chose r1 because it will be overwritten, it's not a value we need to save).

The text hooking routine would probably look something like this:

Code:
ldrb r1, [r0] ; get character

push r0-r2
ldr r2,=lookup_table
lsl r1, r1,1 ; multiply by 2 because SJIS values are 2 bytes
ldrh r0, [r2, r1] ; load SJIS value from table into r0
swi 0xff ; prints r0 to VBA (I've never used this so can't guarantee this is the correct swi)
pop r0-r2

; be sure to include whatever instructions you overwrote with the call here
pop r15 ; return from call

lookup_table:
@dcw 0x82A0, 0x82A2 ; etc, etc. (this follows table values so this is starting at 00=あ, 01=い, etc)

For the lookup table you can use this chart to see what values you should use. http://www.rikai.com/library/kanjitables/kanji_codes.sjis.shtml

That code is completely untested but should give you a general idea of what you want to do. I know it probably looks like gibberish to someone uninitiated in ASM, but it's really not that difficult of a hack.

If you give an example of a game you'd like to hook I'd be willing to write a simple patch for you (I'm curious to see how well this would work myself).
Dwedit
Guest
« Reply #9 on: April 19, 2010, 04:32:57 pm »

Vbaprint takes in the address of a null-terminated string, not a character.
Spikeman
Guest
« Reply #10 on: April 19, 2010, 10:22:22 pm »

Proof of concept text logger hack. Smiley



I haven't got AppLocale setup yet, but if I save the output I can read it in JWPCE perfectly. Note that is two boxes of dialog. You could play through a cutscene, dump the output and read it in JWPCE (which has a built-in dictionary, so if you can figure out basic grammar you can get a much better idea of what's going on than if you use Google Translate).

Source Code: here
IPS patch: here

This doesn't support Kanji, but that'd be as simple as adding a second lookup table.
Dwedit
Guest
« Reply #11 on: April 19, 2010, 11:10:55 pm »

It's kind of weird.
On normal VBA, applocale shows the wrong characters, and text appears forwards.
On VBA-M, applocale works perfectly, but the text appears backwards.  I think VBA-M just reverses all logged output intentionally.

Edit:


(sorry for the >1000px wide image, people with narrow screens)

I'm using VBA Rerecording 20 here.  Looks like AGTH finds the part where the text is prepared to be sent to the textbox, but I had to use the /X switch.  AGTH only sees text if the logging window is open.
VBA's logging viewer shows garbage characters when they are being displayed.  But if you exit the dialog then reopen it, the characters that are already in the buffer appear fine.
Obviously the Kanji is incorrect here.
« Last Edit: April 19, 2010, 11:24:44 pm by Dwedit »
Spikeman
Guest
« Reply #12 on: April 20, 2010, 02:42:38 am »

Do you think it's an endian issue?

I can't get AppLocal to work, well I can't figure out how to install Japanese locale, so it's hard to test. Yeah, I didn't code the part for Kanji, but I will if you guys would like to use it.

You know, I bet it wouldn't be too difficult to make an app that automates the ASM hack. I think the hook routine could be generalized pretty easily.
Dwedit
Guest
« Reply #13 on: April 20, 2010, 02:55:49 am »

An endian issue wouldn't account for the text coming up correctly when you reload the messages window, or AGTH displaying the characters correctly.
Tauwasser
Guest
« Reply #14 on: April 20, 2010, 03:09:01 am »

Seems like a typical double conversion issue. Why not use Unicode in the first place?

cYa,

Tauwasser
Pages: [1] 2  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC