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

    Weird Controller Problems (yes, again)

    Scheduled Pinned Locked Moved Help and Support
    controllersxbox360nesraphnet
    53 Posts 5 Posters 17.9k 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.
    • edmaul69E
      edmaul69 @mediamogul
      last edited by

      @mediamogul when you say keymap what are you using to do this?

      mediamogulM 2 Replies Last reply Reply Quote 0
      • hansolo77H
        hansolo77
        last edited by

        I just did a search in WinSCP on the Root file system. "joy2key.py" is found in 2 locations:

        • /home/pi/RetroPie-Setup/scriptmodules/supplementary/runcommand/joy2key.py
        • /opt/retropie/supplementary/runcommand/joy2key.py

        I edited both files to see their contents, and there is no mention of receiving inputs from __joy2key_dev. Is it possible this file has been updated and no longer seeks for input from that dev location first? All I know, I added the line to the correct file, and it doesn't work. It makes absolute sense as to what it's supposed to do, it just doesn't do that.

        Who's Scruffy Looking?

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

          @edmaul69

          I'm using xboxdrv. I've found it to be a big help for that game in particular. For example, strafing left normally requires that you input two buttons. To simplify this I mapped 'alt+left' to the left shoulder button. I do the same thing to strafe right for the right shoulder and it really makes maneuvering through the game a lot easier. I also have the exit command mapped to 'select+start' and the menu command mapped to 'select+x' to match up with the familiar RetroArch control scheme.

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

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

            @edmaul69

            Something else worth mentioning that I'm pretty proud of with my setup for Wolf3D is my mapping for weapon selection. Since the game relies on keys 1-4 for weapon selection, rather than having an option for progressive selection like 'DOOM' or the Quake games, I mapped my own to the 'x' button of my controller using:

            --ui-buttonmap x=cycle-key:KEY_1:KEY_2:KEY_3:KEY_4
            

            Now I can cycle through my available weapons with one controller button, rather than having to map four dedicated ones.

            I could geek out about this stuff all day. Part of the fun for me is finding a better, more efficient way to control a game.

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

            edmaul69E 1 Reply Last reply Reply Quote 0
            • edmaul69E
              edmaul69 @mediamogul
              last edited by

              @mediamogul so can i use xboxdrv just for this? I just dont want all my controllers seen as an xbox controller. I have adaptors that use multiple controllers but dont share all the same button numbers. Could make a real mess for me.

              mediamogulM 1 Reply Last reply Reply Quote 0
              • meleuM
                meleu @hansolo77
                last edited by

                @hansolo77
                The __joy2key_dev is used only by the scripts which call joy2key.py. If you are curious, here are links to the exact line in each file:

                • runcommand.sh
                • helpers.sh (used by retropie_setup.sh)
                • jsfuncs.sh (used by RetroPie-joystick-selection tool)

                I'm away from my raspi now, but I'll try to find a solution when I get home. And the first thing I'll try is to put that export line at the end of /etc/profile. :-)

                • Useful topics
                • joystick-selection tool
                • rpie-art tool
                • achievements I made
                hansolo77H 2 Replies Last reply Reply Quote 0
                • mediamogulM
                  mediamogul Global Moderator @edmaul69
                  last edited by mediamogul

                  @edmaul69 said in Weird Controller Problems (yes, again):

                  so can i use xboxdrv just for this?

                  Sure, you can use either one of two methods mentioned in the guide for selective launching of xboxdrv. I don't use it for everything myself.

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

                  edmaul69E 1 Reply Last reply Reply Quote 0
                  • edmaul69E
                    edmaul69 @mediamogul
                    last edited by

                    @mediamogul sweet. I will look into that. I should get my replacement apple iie keyboard adaptor tomorrow. (Not sure why it is taking usps 5 days to ship something two hours away) The keyboard overrides the other two as the first joystick (even though it has no joystick functionality) in jstest and stuff. Doesnt bother me to use the keyboard for that stuff anyway. I also wanna play around with using the apple IIe mouse and keyboard and see how well fps' work on that archaic hardware. 😄

                    mediamogulM 1 Reply Last reply Reply Quote 1
                    • hansolo77H
                      hansolo77 @meleu
                      last edited by

                      @meleu said in Weird Controller Problems (yes, again):

                      @hansolo77
                      The __joy2key_dev is used only by the scripts which call joy2key.py. If you are curious, here are links to the exact line in each file:

                      • runcommand.sh
                      • helpers.sh (used by retropie_setup.sh)
                      • jsfuncs.sh (used by RetroPie-joystick-selection tool)

                      I'm away from my raspi now, but I'll try to find a solution when I get home. And the first thing I'll try is to put that export line at the end of /etc/profile. :-)

                      Thanks @meleu I'll be waiting for your solution. :) Looks like a couple of guys hijacked my thread though lol.

                      Who's Scruffy Looking?

                      edmaul69E mediamogulM 2 Replies Last reply Reply Quote 1
                      • mediamogulM
                        mediamogul Global Moderator @edmaul69
                        last edited by mediamogul

                        @edmaul69 said in Weird Controller Problems (yes, again):

                        The keyboard overrides the other two as the first joystick (even though it has no joystick functionality)

                        I actually believe you can fix that with a udev rule, but I may be mistaken.

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

                        1 Reply Last reply Reply Quote 0
                        • edmaul69E
                          edmaul69 @hansolo77
                          last edited by

                          @hansolo77 i apologize. I didnt mean to hijack it. We are both in the same situation and its possible the same northwest fix we both did caused this. I was hoping we both could get the answer we needed without trying to do it in two seperate threads. If meleu finds a way around it i am all for it. If you get it working please do share your steps and i will do the same if i get it working.

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

                            @hansolo77 said in Weird Controller Problems (yes, again):

                            Looks like a couple of guys hijacked my thread though

                            I'm sorry I took the money!

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

                            1 Reply Last reply Reply Quote 0
                            • hansolo77H
                              hansolo77
                              last edited by

                              LOL I was just kidding. No worries. We're all in this thing together. I'm spending my time soldering a blue LED to my NES, and learning about resistors because I want to have it wired on the GPIO rather than the Mausberry Circuit because the circuit cuts the LED before the system is fully off. Lots of good learning stuff. Have it working now. So my time is being well spent. :)

                              I just wish I knew more about Linux and programming so I could figure this stuff out on my own without having to ask for somebody to just do it for me.

                              Who's Scruffy Looking?

                              edmaul69E 1 Reply Last reply Reply Quote 2
                              • edmaul69E
                                edmaul69 @hansolo77
                                last edited by

                                @hansolo77 yeah a 220ohm resistor is good. If your blue led is a clear plastic and not blue if you use some wet 2000 grit sandpaper you can dissapate the led so it doesnt blind you when you look at it. But a colored led will always look better.

                                1 Reply Last reply Reply Quote 0
                                • hansolo77H
                                  hansolo77
                                  last edited by

                                  @meleu and Anybody Else...

                                  Did you come up with anything I can try? This is still an unanswered issue. I'm game for anything (lol pun unintended). I tried to do some figuring out on my own.. these are some things I tried that didn't work:

                                  • Change from " (double quotes) to ' (single quote) in the export command (I saw some scripts other people had written on other sites for other projects that said they had to be single quotes)
                                  • Change the location of the export command to a totally different file (ie; crontrab by using @reboot, or a different autostart.sh file)

                                  Something I've not tried to do is just manually edit those files you have listed that are calling on __joy2key_dev and just replace the input it's looking for from js0 and make it js2. That would probably be a harsh way to make it work but it probably would. The problem with that is if I ever get some kind of other controller issue, I might need to change them again. Changing 1 file is ideally easier than 3.

                                  Is __joy2key_dev being implemented as a variable, or does this create a file somewhere that those other scripts are looking for? It looks like it's just creating a declaration for a variable. If that's the case, how do the other scripts find it? In my limited experience and examination of other scripts, variables are exclusive to the script it's running in. Is that what the export command does - make it a system-wide variable? I'm just trying to wrap my head around what's actually happening, in the hopes I'll be able to fix it on my own, or at least understand how the eventual fix actually works. :)

                                  Who's Scruffy Looking?

                                  meleuM 1 Reply Last reply Reply Quote 0
                                  • meleuM
                                    meleu @hansolo77
                                    last edited by

                                    @hansolo77 said in Weird Controller Problems (yes, again):

                                    variables are exclusive to the script it's running in. Is that what the export command does - make it a system-wide variable?

                                    Not exactly system-wide. The exportmakes every child shell of the current shell "inherit" the variable.

                                    I made more tests and realized that problem is that when you sudo a script, it doesn't inherit that variable.

                                    Setting the device in a file was what I tried with this non-merged PR but it would work runcommand.sh only (what I now agree that isn't the best approach).

                                    I can use different controllers setting this variable when the scripts are not launched with sudo, but it doesn't solve your issue...

                                    Unfortunately your issue remains unsolved... I'll keep trying.

                                    • Useful topics
                                    • joystick-selection tool
                                    • rpie-art tool
                                    • achievements I made
                                    1 Reply Last reply Reply Quote 0
                                    • hansolo77H
                                      hansolo77
                                      last edited by

                                      At least it's a step in the right direction, and identified a possible cause as to why your original proposed fix didn't work. :) I'll keep my fingers crossed you'll figure something out.

                                      Who's Scruffy Looking?

                                      meleuM 1 Reply Last reply Reply Quote 0
                                      • hansolo77H
                                        hansolo77
                                        last edited by

                                        I had a thought.. is there a way to maybe incorporate the Joystick-Selection addon into this? Since it goes in and configures default controllers on a per-emulator basis, could you simply add another "emulator" option called "EmulationStation", that would essentially set a default controller for everything outside RetroArch? Or is this something more deep-rooted into the OS, that a simple script to alter configs wouldn't work?

                                        Still hoping a solution is found.

                                        Who's Scruffy Looking?

                                        1 Reply Last reply Reply Quote 0
                                        • meleuM
                                          meleu @hansolo77
                                          last edited by

                                          @hansolo77 I've found a way to make the sudo environment inherit __joy2key_dev. You have to add the following line to your /etc/sudoers

                                          Defaults	env_keep += "__joy2key_dev"
                                          

                                          After the Defaults string there is a <TAB>. Note that using the sudo visudo command is the recommended way to update /etc/sudoers content, since it protects against many failure modes.

                                          My /etc/sudoers looks like this:

                                          # This file MUST be edited with the 'visudo' command as root.
                                          #
                                          # Please consider adding local content in /etc/sudoers.d/ instead of
                                          # directly modifying this file.
                                          #
                                          # See the man page for details on how to write a sudoers file.
                                          #
                                          Defaults	env_reset
                                          Defaults	mail_badpass
                                          Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
                                          
                                          # added to export __joy2key_dev to sudo environments
                                          Defaults	env_keep += "__joy2key_dev"
                                          
                                          # Host alias specification
                                          
                                          # User alias specification
                                          
                                          # Cmnd alias specification
                                          
                                          # User privilege specification
                                          root	ALL=(ALL:ALL) ALL
                                          
                                          # Allow members of group sudo to execute any command
                                          %sudo	ALL=(ALL:ALL) ALL
                                          
                                          # See sudoers(5) for more information on "#include" directives:
                                          
                                          #includedir /etc/sudoers.d
                                          

                                          @hansolo77 said in Weird Controller Problems (yes, again):

                                          is there a way to maybe incorporate the Joystick-Selection addon into this?

                                          Well, I was thinking on implement such functionality, but the main dev said that will do some more work on this subject, then I prefer to leave it to him.

                                          • Useful topics
                                          • joystick-selection tool
                                          • rpie-art tool
                                          • achievements I made
                                          1 Reply Last reply Reply Quote 0
                                          • hansolo77H
                                            hansolo77
                                            last edited by

                                            Awesome work. I will give this a try later today (after Thanksgiving lunch is over and company has started leaving). I'm excited to find out if this is the fix I needed. So just to make sure, I still need to make sure I have the export __joy2key_dev="/dev/input/js2" inside the autostart.sh file correct?

                                            Who's Scruffy Looking?

                                            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.