About button layout swapping

Discussion in 'NDS - ROM Hacking and Translations' started by ivang23, Apr 26, 2013.

Apr 26, 2013
  1. ivang23
    OP

    Newcomer ivang23 Newbie

    Joined:
    Apr 26, 2013
    Messages:
    1
    Country:
    Italy
    Hello everyone, I'm new on the board and I have a very noobish question for you. I have a simple issue on my DSlite, the R button gets stuck every now and then.
    Now, since R itself is a primary button in Sonic games, and they DO NOT give the options of changing button configuration, is there any way I could remap this R button to L/X/Y using a code or a hack? Maybe it is an easy one? could someone post or point me to a guide? (cause I already gave a brief look to graphics/music hack guides and read the guide to unstuck L/R trigger buttons but I am not very confident to open the ds lite and not cause damage)
     
  2. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,736
    Country:
    United Kingdom
    Fixing it is traditionally the better option.

    Still the general idea with controls is the positions are read from the controls memory mapping every vblank or so and everything operates off this copy (it saves issues with switch bounce which is where switches fail to work properly and can randomly appear as on or off and sorts a few other potential problems as well).
    From here you have two options

    Change how the game stores the copy.
    Change how the game interprets buttons.


    Both can be done with a code actually though how easy each one is varies a bit. The "Change how the game stores the copy" is traditionally easier ( http://nocash.emubase.de/gbatek.htm#dskeypad ) as you just have to change a few bits so when say L is pressed it also copies that value and the game thinks R is pressed. Depending upon the person you find yourself speaking it is not considered quite as clean a hack (I can go either way there depending upon the game, the method and a few other things) though it can happen in several ways and if it works in a reasonable timeframe then who cares.
    a) You use the basic cheat method of add a hook into the code and change it outside the copy. Can be troublesome as you have to hope your cheat engine gets right in there early on.
    b) You hook into the controls memory copy and add your codes to change it there. (Have it blank the R value in case it is sticking and then copy the L value into the R's copied location after which the game operates as usual.
    c) You do a cheat activator code/conditional code and have it write the value as a result. The short version is you make it so the cheat engine detects the L button being pressed and writes the value to the "IS BUTTON_R pressed" location.


    "Change how the game interprets buttons."
    In the vblank or whatever else interprets the buttons you find the thing that ultimately says "IF BUTTON_R PRESSED THEN PRIMARY_ACTION" and change that to "IF BUTTON_L PRESSED THEN PRIMARY_ACTION".
    There could be any number of these for different parts of the game but there could also be one or just one that you really care about. Bonus is you might even be able to fix this with a single instruction tweak and thus a one line 0x00 or 0x01 ARDS code, though it would take some effort to get to that point. You also have a few options as to the tweaked instruction but theory assembly coding will help nobody at this point.

    It can be tweaked slightly as doing a lot of IF commands or even setting interrupts can still be considered bad coding so there might be a lookup table (in which case the devs really should have provided remapping but hey game coders are people too).

    Again though it is typically easier to just fix your DS, I tend to reserve these sorts of hacks for games with really bad control choices, games that I could theoretically play one handed but can not for no good reason, games without a left handed control option to a game breaking degree or for those that can not use a hand thanks to injury or whatever.
     

Share This Page