RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    mixing simultaneous keyboard and gamepad hotkeys possible?

    Scheduled Pinned Locked Moved Help and Support
    atari 2600lr-stellahotkeys
    11 Posts 2 Posters 2.4k 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.
    • 6
      67120
      last edited by 67120

      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.

      mediamogulM 1 Reply Last reply Reply Quote 0
      • mediamogulM
        mediamogul Global Moderator @67120
        last edited by mediamogul

        @67120

        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.

        --ui-buttonmap A=KEY_A,START+A=KEY_F1
        

        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.

        --ui-buttonmap A=KEY_A:KEY_F1:500
        

        RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

        1 Reply Last reply Reply Quote 0
        • 6
          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

          mediamogulM 1 Reply Last reply Reply Quote 0
          • mediamogulM
            mediamogul Global Moderator @67120
            last edited by

            @67120

            You can indeed.

            RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

            1 Reply Last reply Reply Quote 0
            • 6
              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?

              mediamogulM 1 Reply Last reply Reply Quote 0
              • mediamogulM
                mediamogul Global Moderator @67120
                last edited by

                @67120

                When key-mapping, it would look like:

                --ui-axismap X1=KEY_LEFT:KEY_RIGHT,Y1=KEY_UP:KEY_DOWN
                

                RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                1 Reply Last reply Reply Quote 0
                • 6
                  67120
                  last edited by 67120

                  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..

                  mediamogulM 1 Reply Last reply Reply Quote 0
                  • mediamogulM
                    mediamogul Global Moderator @67120
                    last edited by mediamogul

                    @67120

                    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:

                    --buttonmap SELECT=B+DPAD_UP
                    

                    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 --buttonmap and 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 jstest from the command line. Let's say it's JS_9. That would look like:

                    --ui-buttonmap B=KEY_RESERVED:JS_9:1500
                    

                    RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                    6 1 Reply Last reply Reply Quote 0
                    • 6
                      67120 @mediamogul
                      last edited by 67120

                      @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.

                      mediamogulM 1 Reply Last reply Reply Quote 0
                      • 6
                        67120
                        last edited by 67120

                        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.

                        1 Reply Last reply Reply Quote 0
                        • mediamogulM
                          mediamogul Global Moderator @67120
                          last edited by

                          @67120 said in mixing simultaneous keyboard and gamepad hotkeys possible?:

                          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 buttonmap should 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 A=A:A+X:1500 or A+B=A+X.

                          Using ui-buttonmap, here, it would be A=KEY_A:KEY_A+KEYX:1500 or A+B=KEY_A+KEY_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.

                          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?

                          RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                          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.