ROM Hack Remapping Buttons in a GBA Rom

macro8

New Member
OP
Newbie
Joined
Oct 16, 2019
Messages
2
Trophies
0
Age
36
XP
58
Country
United States
I'm trying to remap a couple buttons in a Medal of Honor - Infiltrator. I want to swap the A and R buttons.

I know where the button state is stored (4000130) and I can see which register is affected by relevant button presses (R12), but I'm having trouble locating the instructions that read button state and update that register. Stepping through the code in VBA has been pretty tedious and largely unhelpful so far, and there doesn't appear to be any way to break when a register is modified.

Are there any free disassembly tools allow me to perform text and regex searches on the assembly code or export the assembly code to a more competent text editor for browsing? It doesn't seem to be possible in VBA, Crystaltile2, or GbAsmEdit unless I'm missing something. Or are there any GBA debuggers that can break when a particular register is modified?
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,795
Trophies
3
XP
28,427
Country
United Kingdom
Many games will not read the button state directly but debounce the state to normal memory every vblank or something and operate from that for the next frame or so (as well as latency it saves one part of a frame reading one thing and another action reading something different and causing problems). Might want to see if this does that.

When you say register I assume you mean the memory locations as opposed to the CPU memory sections (there are enough registers on the GBA and DS that we occasionally see variables live in a CPU register or the stack)

Surprised crystaltile2 does not have the option but I never really considered it, and most of what I do would not benefit from long assembly text files filled with junk. There is an old tool called goldroad but it will probably be different in syntax in subtle ways, not to mention I think was more about creation/insertion than disassembly/debugging. Not sure what no$gba has these days but should dump it in both CPU modes -- if nothing else no$gba debug is free these days and far nicer than vba-sdl-h or whatever you find yourself playing with there.
Depending upon how much you want to hold its hand then the various ARM-EABI stuff used in homebrew and a lot of other things based upon it (I use it as my main assembler once I have more than about 4 instructions, not sure if xkas uses it these days and lots of other hackers use it) has nice disassemblers somewhere in the package. For the GBA you should be fairly clear of compression or dynamically generated code (occasionally GBA games stuff some code into WRAM and run from that).
 
  • Like
Reactions: Mythical

macro8

New Member
OP
Newbie
Joined
Oct 16, 2019
Messages
2
Trophies
0
Age
36
XP
58
Country
United States
Appreciate the help! I just started playing around with the no$gba debugger and it's definitely much better than VBA. It looks like it does basically everything I was looking for. I think I can hopefully figure it out from here. Thank you!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Veho @ Veho: While shaving him.