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

Author Topic: [GB] Need help with debugger and ASM hacking  (Read 915 times)

zeroecos

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
[GB] Need help with debugger and ASM hacking
« on: February 06, 2021, 02:38:32 am »
Well I've been trying my hand at translating Oni 2 Innin Densetsu and eventually found out the dialogue text and it's pointers. The problem is that the bank barely have any unused space and the pointers are 2-byte. Although I recently learned the basics on debuggers with Pennywise guide, I still feel lost when trying to find the pointer and code that point to these text pointers. As I have found some unused space in other banks I think it's better to try and repoint the text pointers to 3 byte, but I still don't know how to do that. Is there any documentation on that for the game boy or can someone point me to an example I can follow up? By the way I experimented with BGB.

FAST6191

  • Hero Member
  • *****
  • Posts: 3079
    • View Profile
Re: [GB] Need help with debugger and ASM hacking
« Reply #1 on: February 06, 2021, 10:23:22 am »
For others that might find this searching one day. The Gameboy/Gameboy color are somewhat like the NES but rather than mappers it is memory bank controllers aka MBCs that allow the cartridges to exceed the limits of a basic 8 bit system and sometimes add a bit more hardware to it. Swapping in and out sections of the cartridge such that it is not all visible/accessible at once tending to be how that goes down. https://bgb.bircd.org/pandocs.htm#memorybankcontrollers for a basic breakdown of known ones (though there are some more exotic options, rare examples and user made ones these days that you probably will not care about). You can change the MBC type a game uses but it is also not necessarily a trivial hack like expanding a GBA or DS game might be.

Anyway the pointers might be 2 byte but what is the encoding? Might it be suitable for an 8 bit text encoding change? (16bit is rare on the GB/GBC but not unheard of).


The code handling the text pointers will generally want to read said pointers and the GB/GBC does not have enough RAM to be stashing a pointer list in RAM and leaving it there (though it is a possibility).

To that end if you know where the pointers are then it should be a matter of setting a break on read to that location (as in the where the pointer is at, not where it is pointing to) and going back before that text is ever likely to have been loaded/generated. It will then pop up saying something read this and you should then
If it is one of the strange for GB/GBC games that grabs the pointer table to languish in RAM then you do the same but set your break on read to that RAM location (if it is not a copy of the pointer table as it was in the ROM then you can work backwards from it grabbing the text data from ROM) and then watching it do its maths and thinking through how you might subvert it to read another bank or something.

zeroecos

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: [GB] Need help with debugger and ASM hacking
« Reply #2 on: February 06, 2021, 05:26:24 pm »
Well first of all thanks for the help and for the info on MBCs and BGB. It will be useful.

The code handling the text pointers will generally want to read said pointers and the GB/GBC does not have enough RAM to be stashing a pointer list in RAM and leaving it there (though it is a possibility).

This made me unsure if it is the best approach now. The other option I was thinking of was to try and expand the rom though I still not sure if there is any problems related to it. What would be your recommendation in this case?

To that end if you know where the pointers are then it should be a matter of setting a break on read to that location (as in the where the pointer is at, not where it is pointing to) and going back before that text is ever likely to have been loaded/generated. It will then pop up saying something read this and you should then
If it is one of the strange for GB/GBC games that grabs the pointer table to languish in RAM then you do the same but set your break on read to that RAM location (if it is not a copy of the pointer table as it was in the ROM then you can work backwards from it grabbing the text data from ROM) and then watching it do its maths and thinking through how you might subvert it to read another bank or something.

That is really useful info. It is a strange rom in the way of formatting text (half of bytes used to form a new one or to act as specific characters) but i'm not sure if it is the same with the pointer table. Anyway if you want to check the dialogue pointer table starts at 0x30000 and text follows up after it.
« Last Edit: February 07, 2021, 05:53:16 am by zeroecos »

Pennywise

  • Hero Member
  • *****
  • Posts: 2357
  • I'm curious
    • View Profile
    • Yojimbo's Translations
Re: [GB] Need help with debugger and ASM hacking
« Reply #3 on: February 07, 2021, 06:19:56 pm »
I have a mostly complete translation of this game. It's mostly a matter of hacking all the misc text and menus before I could consider it finished.

zeroecos

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: [GB] Need help with debugger and ASM hacking
« Reply #4 on: February 07, 2021, 11:02:54 pm »
I have a mostly complete translation of this game. It's mostly a matter of hacking all the misc text and menus before I could consider it finished.

Oh, I didn't know there was someone working on it already. By the way, I found some info that I need on your nes rom expansion document. Do you know where I can keep track of what people are translating?

cccmar

  • Sr. Member
  • ****
  • Posts: 295
    • View Profile
    • Nebulous Translations site
Re: [GB] Need help with debugger and ASM hacking
« Reply #5 on: February 08, 2021, 07:49:39 am »
Oh, I didn't know there was someone working on it already. By the way, I found some info that I need on your nes rom expansion document. Do you know where I can keep track of what people are translating?

There is sadly no way to know. Most translators don't really talk much about these, so you have to ask around. Depends on the system, too. Most interesting 8-bit/16-bit games are arguably done, but not that many for CD-based systems (longer games/scripts, tougher technical challenges etc.) On the other hand, newer systems like NDS/3DS/Wii are actually covered very well.

Pennywise

  • Hero Member
  • *****
  • Posts: 2357
  • I'm curious
    • View Profile
    • Yojimbo's Translations
Re: [GB] Need help with debugger and ASM hacking
« Reply #6 on: February 08, 2021, 10:21:11 pm »
You're still welcome to continuing working on the game, but I thought I'd let you know I was working on it and have it in an almost complete state. The game really is a pain to work on, but it'll probably be finished this year.

Btw, I solved all the space issues in the game by expanding the ROM and relocating all the text between different banks. That's generally the easiest/best approach to take when translating these old ROMs.

zeroecos

  • Jr. Member
  • **
  • Posts: 7
    • View Profile
Re: [GB] Need help with debugger and ASM hacking
« Reply #7 on: February 10, 2021, 02:12:37 am »
There is sadly no way to know. Most translators don't really talk much about these, so you have to ask around. Depends on the system, too. Most interesting 8-bit/16-bit games are arguably done, but not that many for CD-based systems (longer games/scripts, tougher technical challenges etc.) On the other hand, newer systems like NDS/3DS/Wii are actually covered very well.

Well that's a bit problematic but still it is interesting to know that CD-based still have some games untranslated. Maybe I'll try messing with them someday.

You're still welcome to continuing working on the game, but I thought I'd let you know I was working on it and have it in an almost complete state. The game really is a pain to work on, but it'll probably be finished this year.

Btw, I solved all the space issues in the game by expanding the ROM and relocating all the text between different banks. That's generally the easiest/best approach to take when translating these old ROMs.

Well I was just starting anyway. xD Maybe it is better to wait for your translation and learn from it. Anyway I searched around and saw no info about translation of another game I am interested, Atelier Marie gbc version. Last post of someone asking about it was in 2019 so I decided to try it. Looks like it have a lot of space to work. Btw, do you have any more guides or know of some interesting ones that I can look into?