Where to start creating a classic controller hack code?

Discussion in 'Wii - Emulation and Homebrew' started by lisreal2401, Nov 17, 2016.

  1. lisreal2401
    OP

    lisreal2401 GBAtemp Advanced Fan

    Member
    513
    213
    Jun 4, 2013
    United States
    I know there are hack codes for DKC and Kirby's Return to Dreamland, and I want to know if anyone still around the Wii section would have input on how to begin coding such a hack. Specifically I want one for Metal Slug Anthology and since the games inputs are 7 buttons (d-pad, 1, 2, A) and no motion control I don't think it's entirely out of the realm of possibility. I just don't know where to begin looking for what values to look for and patch for it.
     
    almmiron likes this.
  2. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,865
    9,776
    Nov 21, 2005
    United Kingdom
    I don't actually know the answer to the question of whether the classic controller, if inserted but otherwise ignored by the game, has anything shoved into memory anywhere or whether you would have to do some initialisation and then reach out and grab it. Wiibrew is usually a good start for stuff like this and http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Classic_Controller would appear to say it is there.

    Step one though would be make a button remap hack of the classical variety* (find where it reads the controller values from, typically it would not be a port but instead an area of memory it copied aka debounced a state to at the start of the vblank or something, and then change that as you will need to know it anyway). With that in place you can then tackle what goes when you want to take it from an entirely different source.

    *if a game is either fully remappable or has a selection of prebaked control schemes then it changes how many would approach this, the classical approach still works though.
     
  3. lisreal2401
    OP

    lisreal2401 GBAtemp Advanced Fan

    Member
    513
    213
    Jun 4, 2013
    United States
    My biggest hurdle is finding where button mappings are stored in RAM, when I was looking for PSP mode exploits for the Vita I used PPSSPP and it had a debugger that was super helpful in finding where things were going on. I know Dolphin has a debugger but I'm not sure to the extent to where I can read values in realtime. And no, USBgecko is out of the question :D though I would love to own one. But yes, CC is active in every Wii game to some extent - the Home button in game menu always supports input from it with the virtual pointer so it's safe to assume every game will acknowledge it being present.
     
  4. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,865
    9,776
    Nov 21, 2005
    United Kingdom
    I do like all the crazy realtime and fallback/branching type options for debugging which some, typically older, systems have but button reads or actions done upon the results should be in basically every vblank -- it is not like some random chance thing in a battle that might be calculated at any point from menu shows up to just after you select the command. To that end it should not take much stepping through one from normal gameplay to find at least a thread to pull on.
     
  5. almmiron

    almmiron GBAtemp Regular

    Member
    123
    11
    Jan 9, 2012
    Brazil
    Following.

    Enviado de meu LG-D855 usando Tapatalk
     
  6. lisreal2401
    OP

    lisreal2401 GBAtemp Advanced Fan

    Member
    513
    213
    Jun 4, 2013
    United States
    I'm going to start poking around with Dolphin tonight. Will update when I find something notable.
     
  7. lisreal2401
    OP

    lisreal2401 GBAtemp Advanced Fan

    Member
    513
    213
    Jun 4, 2013
    United States
    Alright - I hate to admit defeat already, but in my research it seems classic controller hacks are out of the scope of what I could possibly code. It wasn't as simple as I initially thought and I apologize for getting anyones hopes up. My biggest misconception was all Wii games were aware of the presence of the CC as this is actually false. It requires some raw ASM level rewriting to implement such a hack and I simply am not smart enough yet to pull that off sadly.
     
  8. RCJayce

    RCJayce The Defender Of Tomorrow

    Member
    618
    166
    Aug 11, 2014
    United States
    New York
    Kudos for trying! I was researching this topic a while ago and I got the same conclussion as yours