+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  How advanced at ASM would one need to be to do this?
Pages: [1]
Author Topic: How advanced at ASM would one need to be to do this?  (Read 2 times)
Rai
Guest
« on: May 23, 2008, 03:49:26 am »

Alright so there's a Gameboy Advance. Currently hex for English characters is two bytes, so 8260=A, but ofcourse, I don't want that. I want A to equal the one byte value of 41. First off, can someone explain how I would probably do this in ASM? Thanks. Second off, would one have to be mega experienced in ASM to pull something like this off?

Note, I don't actually want to change the width of the letter A, just make it so that A equals a different, one byte value. Right now, trying to put one byte English characters in the game brings up glitchy kanji.

Basically, way I see it there's something in the game's code that tells it to not print 1 byte characters. Even if the 2 byte character isn't valid [in which case you get glitchy kanji] there's something in the code that tells it to only print 2 byte characters.
« Last Edit: May 23, 2008, 04:15:31 am by Rai »
RedComet
Guest
« Reply #1 on: May 23, 2008, 04:20:55 am »

Theoretically, you'd only have to find the instruction that reads the text and change the instructions to load a byte instead of two bytes. If the smallest amount of data that can be loaded (I can't remember on the ARM) is 2 bytes, just us an AND instruction to drop the other byte.

What game are you looking at?
Karatorian
Guest
« Reply #2 on: May 23, 2008, 04:23:06 am »

It proabably wouldn't be too hard, provided you at least know a little ASM. Due to the nature of the change you want to make, the new text loading routine should be shorter than the original, so space shouldn't be an issue. (Provided you only care about the Latin characters. If you want Latin characters to be one byte, but still have dual byte encoded Kanji, it'll be more complicated.)

Open up the game in an emulator with debugging support and go to an area where you can call up a fairly unique text string. Trigger the dialog and then open the memory viewer. You should be able to find the text in the memory. Set a write breakpoint on the address of the first character of the string. Then resume the game and trigger the text again. With luck, your breakpoint should trigger and you'll be looking at the main loop of the character decoding routine.

Move backwards through the code until you find the top of the routine. Chances are it'll be preceeded by a return instruction (for the previous routine) or some non-executable data. Once you've found the top of the routine, follow the possible paths of execution until you find the end of the routine. That will give you an idea of what sort of space you have to work with and how the routine functions.

It's hard to say for sure how the routine works (every game does it own thing), but odds are, it is passed a pointer to the text (and possibly a length). There may be other arguments passed in, such as a location to write the graphics tiles to or related stuff. Chances are that the first byte of the character selects one of a number of blocks of characters and that the second byte selects a specific character within that block. If thats the case (and the Latin letters are all in one block), you should be able to alter the routine to only read one byte and hardcode the block it selects it from.

However, chances are you'll also have to deal with some sort of control codes. If those use multiple bytes, then things will be more complicated as you'll have to make sure they're still handled correctly with some judicious condition evaluation. On the other tentacle, if the control codes are single byte, you may have an issue if thier range overlaps that of what the Latin letters would be after your hack.

In that case, I'd recommend that you leave the control codes as is and in the case that a control code isn't found, add or subtract a fixed value to get the offset in the character block that'll corrispond to the character you want.
Rai
Guest
« Reply #3 on: May 23, 2008, 01:01:40 pm »

Quote from: RedComet on May 23, 2008, 04:20:55 am
Theoretically, you'd only have to find the instruction that reads the text and change the instructions to load a byte instead of two bytes. If the smallest amount of data that can be loaded (I can't remember on the ARM) is 2 bytes, just us an AND instruction to drop the other byte.

What game are you looking at?
Summon Night Craft Sword Monogatari: Hajimari no Ishi for the GBA, only GBA Summon Night that hasn't had an official release.
KaioShin
Guest
« Reply #4 on: May 23, 2008, 01:11:04 pm »

Don't bother that game has a custom file system and all the script is embedded in event code.

There is also another active project for this, there is a topic about it somewhere.
Ryusui
Guest
« Reply #5 on: May 24, 2008, 02:39:46 am »

You want to know how much ASM hacking it'll take, do you? Try zero.

8260 is S-JIS for a full-width monospace A. S-JIS also includes the ASCII character set, so try inserting some text using plain ASCII and see if it displays properly. If it does, you're golden. If not, then it's time to brush up on some ASM. It shouldn't take much effort to change a two-byte system to a one-byte system, though...
Kajitani-Eizan
Guest
« Reply #6 on: May 24, 2008, 09:11:32 am »

Quote from: Ryusui on May 24, 2008, 02:39:46 am
You want to know how much ASM hacking it'll take, do you? Try zero.

8260 is S-JIS for a full-width monospace A. S-JIS also includes the ASCII character set, so try inserting some text using plain ASCII and see if it displays properly. If it does, you're golden. If not, then it's time to brush up on some ASM. It shouldn't take much effort to change a two-byte system to a one-byte system, though...

Quote from: Rai on May 23, 2008, 03:49:26 am
Right now, trying to put one byte English characters in the game brings up glitchy kanji.

unless he's doing it wrong, unfortunately, this doesn't look like a viable solution :/
Pages: [1]  


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