Page 1 of 1

Is it possible to map keyboard to controller?

Posted: Fri Jan 21, 2022 12:10 pm
by msimplay
I was wondering if its possible to map keyboard keys to the controller?

Many games use a combination of both keyboard and joystick in computer games.

Re: Is it possible to map keyboard to controller?

Posted: Fri Jan 21, 2022 12:28 pm
by Bunker
Im not 100% sure but you may be able to do that with this device, its usually for converting Controller to Mouse and keyboard so may be worth looking if you can do the opposite:

https://www.amazon.co.uk/dp/B078J2HQ9D

Re: Is it possible to map keyboard to controller?

Posted: Fri Jan 21, 2022 1:12 pm
by aberu
Yes, just go to Define Gamepad in the main MiSTer menu (the menu you get when you first power-on your MiSTer), and press keyboard buttons instead of gamepad buttons. It should work.

Some keyboards occasionally use multiple keycodes per key, so you may have to do this over a few times if you see two buttons press instantly in a row.

Re: Is it possible to map keyboard to controller?

Posted: Fri Jan 21, 2022 1:30 pm
by Spuddle
f12 for menu..f12 again, then you'll see menu with define jostick buttons....pressing space on keyboard to skip options you dont need...
I think that's right..for each controller, seperately

Re: Is it possible to map keyboard to controller?

Posted: Fri Jan 21, 2022 1:45 pm
by akeley
Define Joystick Buttons is a global choice, so I suppose different keybinds could not work on different cores? The button number is also rather limited, even on more advanced gamepads.

There's a in-core "Button/Key remap for game" option which is quite great, and allows to make changes in particular games. The big downside though is that it is not permanent (and also core-wide). So you need to re-do your keybinds with every cold reboot, and also during game changes.

I've been actually just thinking about making a request for this, so it'd work on permanent basis - most likely with saving individual game configs. It'd be a massive functionality boon for microcomputer games.

Re: Is it possible to map keyboard to controller?

Posted: Fri Jan 21, 2022 1:59 pm
by neogeo81
akeley wrote: Fri Jan 21, 2022 1:45 pm Define Joystick Buttons is a global choice, so I suppose different keybinds could not work on different cores? The button number is also rather limited, even on more advanced gamepads.

There's a in-core "Button/Key remap for game" option which is quite great, and allows to make changes in particular games. The big downside though is that it is not permanent (and also core-wide). So you need to re-do your keybinds with every cold reboot, and also during game changes.

I've been actually just thinking about making a request for this, so it'd work on permanent basis - most likely with saving individual game configs. It'd be a massive functionality boon for microcomputer games.
joystick buttons is a global choice?

You can and have to define the buttons for each core because the autobind doesn't work super well. And those settings stay.

You are refering to the Button/Key remap function. That does not save.

Re: Is it possible to map keyboard to controller?

Posted: Fri Jan 21, 2022 4:35 pm
by msimplay
Will test this out on Arabian Nights you have 3 buttons that are troublesome.

Up is jump mapped to controller button
Menu is spacebar mapped to a controller button.
Lastly leave attack as a joystick same as normal mapping.

Will get on with this tonight and see how I get on thanks

Re: Is it possible to map keyboard to controller?

Posted: Fri Jan 21, 2022 6:26 pm
by akeley
neogeo81 wrote: Fri Jan 21, 2022 1:59 pm joystick buttons is a global choice?

You can and have to define the buttons for each core because the autobind doesn't work super well. And those settings stay.
This is irrelevant because you can't really map keyboard keys in this menu. If you try it's very hit and miss, and even if it has worked well it'd still have the aforementioned limitations. It's really meant for console and computer controllers, not keyboards.

And that's why permanent per-game configs would be awesome. You could then define the needed keys once with "Button key/remap for game" and it'd always work. Case in point: yesterday I was playing Alone in the Dark on ao486 with Dualshock4. Mapped cursor keys to the analog stick, Enter to Circle, Space to Cross, Esc to Square - works a treat. But now when I reboot the core it's all gone and has to be redone everytime. And even without reboot, I later went on to play Shadow Of The Comet, which requires a different set of keys to operate and I had to remap again.

Another solution is something like Mode buttons in the C64 core - but that's a bit more cumbersome and requires a good memory to remember all the combos.

Re: Is it possible to map keyboard to controller?

Posted: Fri Jan 21, 2022 7:19 pm
by msimplay
I tried to MAP spacebar to Y button on an 8bitdo SN30Pro so that I could use the screen clearing bomb from the controller in "Turrican 2" but was unable to
The MegaAGS Whdload game already maps jump to a button rather than directional pad

Re: Is it possible to map keyboard to controller?

Posted: Wed Nov 20, 2024 10:39 pm
by ulrikbrick

Amazing, thanks for the help. I needed this for 'Thrust' on the C64. So simple to do. First the target button on the controller followed by the key. And then next controller button until they are all done.