gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Interrupts: Shutdown GBA?

#5609 - Rattus - Sat May 03, 2003 3:38 am

How common is the use of hardware interrupts over polling to detect the key states? If the majority of games DIDN'T use REG_KEYCNT, would it be possible to do something like the following?

1. Load your custom GBA shutdown (or a trainer, or whatever) code into memory

2. Stick a jump instruction at 0x03007FFC (the address branched to when a hardware interrupt occurs) to point to your custom code

3. Set the key control register to generate a hardware interrupt when a set of keys (eg start & select & L & R)

4. Load a game ROM and transfer control to it


So that (assuming the ROM didn't overwrite your function loaded into ram at step 1) during any game, you could hold down the buttons and have a suspend-mode for any game? Hmm, thinking about it, this would only work for a game that didn't hook the 0x03007FFC hardware interrupt vector at all, wouldn't it? :( Can anyone else think of a creative way of making a software gameshark/universal suspend-the-GBA system that could be loaded around existing ROMs on a flash cart?

#5624 - tepples - Sat May 03, 2003 11:51 pm

Rattus wrote:
Can anyone else think of a creative way of making a software gameshark/universal suspend-the-GBA system that could be loaded around existing ROMs on a flash cart?

You'd have to hack the game such that any read from the joypad port is replaced with a call to your subroutine. Though you probably wouldn't be able to automate it 100 percent, running the game in a debugging emulator and placing a trap on READ 0x04000130 would let you find the addresses where each game reads the controller during its pause menu.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.