1. sunnoki

    OP sunnoki Newbie
    Newcomer

    Joined:
    Jul 16, 2020
    Messages:
    2
    Country:
    Poland
    Hi there, for a while I've been looking for romhacks of MKDS, that let you change the button layout (for example Y=accelerate instead of A), but I couldn't find any, is it easy enough to do by yourself via some rom opening software? If it's not, is there anyone that could do it for me? Thanks a lot
     
  2. FAST6191

    FAST6191 Techromancer
    Reporter

    Joined:
    Nov 21, 2005
    Messages:
    31,516
    Country:
    United Kingdom
    It is easy enough once you start getting into the higher end skills of ROM hacking, however I don't know if I would suggest it for someone completely new to hacking to have as a first project. I could see it happening and said person getting somewhere quickly, especially if they have some programming ability, but compared to editing text, graphics, music, levels or messing with compression or something it is a few steps harder. For someone versed in it then few hours if it is the usual level of difficulty, shorter if one of the easier ones still, someone not probably a longer affair but it is still operating within what the game and system already does without any radical changes.

    The DS is probably the last of the consoles to treat the code running as the whole of the system. Newer things kick handling of system functions over to the console itself which is why you tend to see newer things attack this at firmware level, however that is not an option here. Each and every game then needs its own not trivial software modification. You can mod the hardware; buttons are just physical switches so all the sorts of things done for rapid fire mods, auto input mods, macros, external/disabled player mods and the like are in play and you just take the output of one button and feed it into the other one you care about, possibly slicing a trace to stop the other from working and taking that and feeding it back the other way to in effect swap things around. For some things this is a bit extreme, for instance I would sooner fix hardware than do a mod like this for all the games I care about, however if you want it for a single game or the person you are doing the mod for really needs it (had plenty of people looking to work around disabilities or something) then do what you will.

    Anyway. Usually once a frame, though might be other timings, during a vblank (vblank = vertical blank, a thing that happens 60 times a second on most consoles and is when things like screen updates happen) the controls will be read from the part of the DS memory that tells you what buttons are pressed.
    http://problemkaputt.de/gbatek.htm#dskeypad
    Y is technically in a different setup to A (A was on the original GBA, which the DS built on, but Y is not) but nothing drastic there.
    Anyway in code made by devs doing good stuff this state will be copied to another area of memory first and the game operates from there. This is called debouncing and helps prevent problems with the button being pressed one millisecond and not the next and a program doing something odd as a result.
    Not all code will do this, indeed if you ever see a press button to activate cheat type cheat there will usually be one of the cheats looking at what is in that area of memory ("if this then that" type setups usually) from the link above.

    You then have various options.
    If there is some form of control remapping or selectable control schemes (even if none are exactly what you want) then there are some more options available to you as there will be something mapping controls to something else and you get to then attack this.
    If you don't have such luxuries then two main approaches

    1) The code being copied thing mentioned above means you attack this. Find where it is copied. It is literally a single bit for each button somewhere in a value. Make something that says if this value is high set it low and set another one high. Now you have a remapped button. This will likely be game wide so be aware of that.

    2) If the code does not copy the data and operates solely from RAM, or you only want a single action within the game mapped but all the menus, minigames and whatever else left alone then you edit where the game looks at to do what it wants. Acceleration (or speed) is easy to find with a basic cheat which is nice (editing things for menus without easy to look at aspects of the game can be more tricky). Find where in RAM your speed is located (find a long straight, stay still, search, do a search for things that stay the same, stay still, do another search, start moving, things that changed, move faster, again....) and then set a break on write to that with the debug version of http://problemkaputt.de/gba.htm .
    https://www.romhacking.net/documents/361/ is for the GBA and a different emulator but serves as a reasonable crash course in what assembly debugging involves. If you can't adapt what you see there for the same ROM on the no$gba emulator (it also does GBA) then you are probably not ready for this.
    Anyway with said break on write anything that changes it will cause the emulator to stop, say this thing changed the value here. Now what changed it will be the end result of a long line of actions by the CPU, one of those will involve either a read to the location where control data is stored or the area we covered earlier where the hardware itself stores things. You want to change the location of the read of A to the location where Y is. It is a different section of memory (though right next door really -- 4000136h handles the Y button where 4000130h handles the A, B, L, R, Start, Select...) and I don't know what it will do as far as reading a single bit (holding X and Y will presumably be value 3, where just X will be 1 and just Y will be 2 and you can't then just say look for exactly 2 if 3 and several other values are also indicating it is pressed), or doing some kind of mask (don't know what your general programming skills are like but a mask here would be roughly equivalent to ignoring everything else/blanking everything else to 0 what does the hundreds column say in this bank balance -- might be done with some kind of Boolean logic as ANDing it with a relevant value and just 1 in the bit you want will tell you quickly) for what it wants. Either way you tell it to look at the Y button instead but whatever means you care to use (many are the options when playing assembly hacker).
    Hopefully it is just acceleration you want here as again everything else will possibly have its own check on buttons being pressed and according interaction, so the above will have to be repeated for everything you want here. Not so bad if it is a personal control preference courtesy of too much play on another system/entry in the franchise that does it differently/other game you normally play, but harder if you are working around a broken key (so many times in the past we have seen this when a R or L button fails) or for someone that can't necessarily press certain buttons.

    If you need extra space in memory to jump to and do something then I usually find the wifi error messages are stored in RAM at all points and mostly useless these days, and even if you are on one of the wifi replacement services then you are probably not going to get the exotic error messages, or care if the game crashes/shows garbled error messages when the wifi replacement service is down, broken or unreachable. Quite a bit of space is available in such things and more than enough to house a the 10 or so instructions that "don't read here, read here instead" will occupy, assuming you need extra at all.
     
    DanTheManMS likes this.
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - layout, button, change