Both ways are possible, but the process I designed it for is closer to your second idea. Your first idea is closer to the "text hooker" stuff already found in emulators like FCEUX.
My default translation plugins that come with the Wanderbar basically work like this:
- Find when the game decides which line ID is about to be displayed
- Take the line ID and display the equivalent desired line in the sidebar
Part 1 isn't too hard if you use a nice debugger like bsnes-plus. Part 2 is simple, and you can see how it works using some of the default plugins. It takes only a few lines of code.
Since you're wanting to display translated text, you'll of course need to dump the game's text beforehand in some way. This is pretty much the same process as any ROM translation. The idea is that you'll put each translated line into the sidebar's HTML, with each line getting its own <div>. So when the emulator loads a line of text, let's say Line 378 for example, your plugin will take that 378 and then display your line 378 <div>.
I realize I still need to write documentation and such, but if you need help with a specific game I can offer some help.
Thanks a lot, FCandChill and Tomato for your replies. I feel really honored that one of the replies is from Wanderbar's own author
First of all, the games I had in mind for translating are Jungle Wars 2 (JW2) and Idea no Hi. I don't know about the latter, but I don't recall of anyone working in JW2 at the moment (I think Kingmike was fiddling with the prequel, JW for the gameboy).
I can't assure I'll go very far in any of these games, though, as I ignore whether these games are considered hard to mess with or not. I simply wanted to test my Japanese skills a little after 3 years of taking lessons and wanted to be games that nobody is engaged in right now and games that I like as well.
My first thing I wanted to do before tackling more complicated things, was guessing if Wanderbar had a way of "noticing" when the game is about to show text (let's assume the game activates some kind of flag or signal when doing so), so it can automatically capture it, extract that line of text and copy it to the browser window. Because my ASM knowledge to do it manually is 0, although I know a little about coding (mostly develop CRUD applications using frameworks, nothing relevant to fantranslations).
Nevertheless, I've already peeked a little at some of the plugins' lua code, and I'll try to do a more in deep examination and see if I can grasp a general understanding of how it works before trying to do the next step. Perhaps I can start fiddling with the plugins' scripts and see what changes.
I'll try to go slow and steady and see if I'm up to it or not. Thanks a lot for your reply and for creating such neat tool for romhacking, Tomato.