RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Controlblock MAME keyboard emulation remapping

    Scheduled Pinned Locked Moved ControlBlock, PowerBlock & Co.
    controlblockmameretroarch
    2 Posts 2 Posters 446 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gmilner
      last edited by

      I'm using a Controlblock set to "MAME" in order to enable the switches on an old Atari 2600 case to act as keypresses in Retropie (to trigger events such as "game reset", "quit retroarch", "next shader" etc.). The hardware part is great - I've wired the switches to z,x,c,v,1 and the Raspberry Pi4 is receiving the keystrokes properly.

      I'm able to edit the retroarch.cfg files to change the hotkey mapping to match the keystrokes generated by the Controlblock - so everything works kinda fine...

      ...except that the Retropie build I'm using has different retroarch.cfg files for each emulator that already mess with the hotkey bindings, so I can't just change the bindings in the all/retroarch.cfg file. If I want to change what each switch does I have to manually change the different retroarch.cfg files for each emulator - a real grind.

      Is there a way that I can change the keys that are sent to the Pi from the ControlBlock under the Controlblock MAME layout to match the default hotkeys in Retroarch? Or are the keys used hardwired into the Controlblock firmware?

      Many thanks for any thoughts!

      1 Reply Last reply Reply Quote 0
      • ethelingE
        etheling
        last edited by etheling

        I did a similar project not too long a go. E.g. built RetroPie into Atari 2600 case. Anyways - yes, key presses that ControlBlock sends when using MAME layout are hardcoded into it's driver:

        URL: https://github.com/petrockblog/ControlBlockService2/blob/master/src/controlblock/gamepads/MAMEGamepad.cpp#L41-L141

        To change e.g. switch 'z' to send something else than z, say a, you would modify lines below and replace KEY_Z with KEY_A. And recompile and re-install the driver (instructions here https://github.com/petrockblog/ControlBlockService2).

        URL: https://github.com/petrockblog/ControlBlockService2/blob/master/src/controlblock/gamepads/MAMEGamepad.cpp#L68-L70 to

        Available KEY_* events (that you could replace KEY_Z above) are found from here: https://github.com/petrockblog/ControlBlockService2/blob/master/src/controlblock/uinput/UInputEventCodes.h

        I hope this helps you forward. I did a slight re-write for the driver myself as I wanted all the Atari 2600 switches to provide their original functionality. Which isn't straightforward since official ControlBlock driver doesn't support switch where both on and off indicate certain state (e.g. on -> colorTV, off B&W). I suppose I could clean up my code a bit and put it up to github sometime.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

        Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.