mixing simultaneous keyboard and gamepad hotkeys possible?
i am making a simplified, arcade style controller that emulates an 'atari 2600' controller. i would like to have a minimal number of buttons. is it possible to configure 'lr-stella' to respond to both 'fire' and 'reset' buttons on the controller while also responding to keyboard hotkeys for 'player 1 difficulty a,' 'player 1 difficulty b,' 'player 2 difficulty a,' 'player 2 difficulty b,' 'tv colour' and 'tv black & white?' ideally, i would also like to write a script or something to send the 'exit game' command by holding down the 'reset' button for several seconds.
There are several different ways to do what you want using xboxdrv. You could set up your own modifiers to double, triple... etc the amount of functions that one button has, or you could set up hold buttons to where a second function would occur after being pressed for a predetermined amount of time. I put together a guide here to get started in xboxdrv, but I don't think it covers these particular uses. I'll post examples below and here is a link to the full xboxdrv manual.
Modifier: This maps the designated 'A' controller button to the 'A' keyboard key, but when the designated 'Start' controller button is pressed along with it, the 'F1' keyboard key is sent instead.
Hold: This maps the designated 'A' controller button to the 'A' keyboard key, but when the button is pressed for 500 milliseconds, the 'F1' keyboard key is sent.
67120 last edited by
i read the manual but didn't see this mentioned- can i map an event to send two buttons? eg. --ui-buttonmap START+A=A+B
You can indeed.
67120 last edited by
what is joystick up/left/right/down called, when writing xboxdrv configs? the documentation refers to ABS_Y and ABS_Z etc, but how are the directions specified? might there be a list of the names for any possible controller/keyboard event?
When key-mapping, it would look like:
is it possible to do something like B=void:START:1500, B+A=START+SELECT, B+JoystickUp=Select, B+JoystickLeft=cycle-key:TL:LT, B+JoystickRight=cycle-key:TR:RT
to test, i started with --ui-buttonmap B+A=X+Y \ and on startup, it says 'unknown prefix X+Y' so maybe i have to declare those first, i dropped it for now and tried B+A=KEY_ENTER+KEY_RIGHTSHIFT instead which gives no errors but didn't seem to work either..
I'm afraid that getting this far into weeds is going to require some experimentation. I've mapped separate functions between X and Y axis' before, but I've never tried mapping a function to half an axis. However, I know for sure it would work with the DPad, due to the direction assignments being clearly delineated. That would look like:
As for your cycling example, I believe the cycle function is reserved only for
--ui-buttonmap. I've personally found that there's more that can be done this way, so I tend to use it almost exclusively. The same goes for your hold function example. It looks like you don't want the 'B' button to do anything for 1500ms, when it would then act as 'Select'. The problem is that 'void' will eliminate the button from the map altogether.
I really don't know if there's a way to do that with
--buttonmapand technically I don't think there's a way with
--ui-buttonmap, but there is a workaround I use. There's a few valid keyboard input codes that produce no actual input. The one I use currently is
KEY_RESERVED. So, assuming I want the 'B' button to output nothing for 1500ms and then send the 'Select' button, I would first figure out which JS button number the 'Select' button is by using
jstestfrom the command line. Let's say it's
JS_9. That would look like:
@mediamogul should i be adding this all to rc.local or is this supposed to go somewhere else? where is the config file for xboxdrv located when it's installed from retropie setup? i can't even get --ui-buttonmap A+B=KEY_RIGHTSHIFT working. just loaded up an atari 2600 game and tried it. right shift on the keyboard does work.
testing a simple --ui-buttonmap A=A \ line. and when i reboot i see "get_event_type(): unknown even type prefix A." what's up with that? using A=JS_[*] for some reason doesn't do that.
if i use --ui-buttonmap A=JS_0, or A=JS_2, retropie reads them both as button "0" regardless. weird. evtest reads them as 'trigger' and 'thumb2' respectively. on the otherhand, without that --ui-buttonmap line, evtest reads it as 'south,' while retropie reads it as-you guessed it- button '0' again. using --buttonmap to do the same, retropie does see different buttons, unfortunatly i get errors when i try A=A:A+X:1500 or A+B=A+X.
i can use keyboard events such as --ui-buttonmap A=KEY_F1 or A=KEY_ENTER to make retropie see a different button being pressed, but it's always button 10 no matter what i set it to. so that's useless.
i reset emulationstation's input configuration and mapped everything on the controller to a keyboard key.. i think am going to get somewhere with this approach, finally. edit: nope. retropie autoconfig reads the inputs and they work in the menu but then retroarch or in-game ignores any input from the controller.
been banging my head on this wall for a couple days. i stopped using JS_ events and instead now use only KEY_ events, but now retroarch doesn't recognize any of the KEY_ events.
should i be adding this all to rc.local or is this supposed to go somewhere else?
You should only add a command to rc.local if you need a map to work at startup for Emulation Station.
testing a simple
ui-buttonmap A=A \line. and when i reboot i see "get_event_type(): unknown even type prefix A." what's up with that? using A=JS_[*] for some reason doesn't do that.
If you're looking to remap the controller buttons
buttonmapshould be used rather than
ui-buttonmap. For key-mapping using
ui-buttonmap, where the correct syntax would be
ui-buttonmap A=KEY_A \
i get errors when i try
ui-buttonmap, here, it would be
i can use keyboard events such as
--ui-buttonmap A=KEY_F1 or
A=KEY_ENTERto make retropie see a different button being pressed, but it's always button 10 no matter what i set it to. so that's useless.
Using the key-map approach, would also require you map your emulator to expect keyboard input, rather than controller. I actually do this almost exclusively to avoid controller assignment issues. Most every emulator supports keyboard input.
then retroarch or in-game ignores any input from the controller.
Have you set the udev rule outlined at the very end of section 3a of the guide?