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

    js0 Being Ignored by Some Emulators

    Scheduled Pinned Locked Moved Help and Support
    17 Posts 4 Posters 4.7k 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.
    • mediamogulM
      mediamogul Global Moderator
      last edited by mediamogul

      I've been creating virtual joystick devices using xboxdrv that register in the js0 slot. I'm running into a problem outside of RetroArch where some emulators will grab js0 and others will ignore it. Can anyone think of a reason why js0 would be ignored at all?

      Two examples that grab js0 are Reicast & Mupen64plus. Two examples that don't are Daphne and ScummVM. What differences might exist in how these emulators handle input that would help troubleshoot this problem? Is it possible that the offending emulators are looking for some quality that they are not finding, whereas the others are not so particular?

      An example of an xboxdrv runtime command that exhibits this behavior is:

      sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --evdev /dev/input/event2 --force-feedback --trigger-as-button --deadzone-trigger 15% --deadzone 4000 --axismap -Y1=Y1,-Y2=Y2 --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RZ=x2,ABS_Z=y2,ABS_RX=LT,ABS_RY=RT,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y --evdev-keymap BTN_TOP=x,BTN_TRIGGER=y,BTN_THUMB2=a,BTN_THUMB=b,BTN_BASE2=back,BTN_BASE4=start,BTN_TOP2=lb,BTN_PINKIE=rb --device-name "Mayflash GameCube Port 1 (xboxdrv)" --silent
      

      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
        last edited by mediamogul

        Something else to consider is that the emulators ignoring js0 are heavily, if not totally, reliant on SDL input. Can anyone think of a reason why the SDL input driver would ignore a fully functional js0?

        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
          last edited by

          I never like to label anything faulty without having done everything I can think of to remove my own actions from the equation, but after seeing successful input in so many emulators I'm starting to come to the conclusion that the particular emulators mentioned above just have deeply flawed controller support. For example, I've been wrestling with Daphne on this issue since my introduction to RetroPie in 3.6, only to find the rare controller that "just works". I was sure, that remapping a controller so that the system would see it as a standard XBox 360 gamepad would work, but here we are.

          I can still achieve my goal by abandoning this effort and mapping keyboard and mouse events to a controller for these particular emulators, but before I do, I have to ask; has anyone managed to successfully use any XBox 360 controller with Daphne at all? The answer to this will at least tell me if this approach is at all possible and if I should continue down this road any longer.

          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
            last edited by mediamogul

            I'll take the silence to mean that no one has an XBox 360 controller working with Daphne. Well, I have to admit I'm surprised, but I guess it's one less thing to troubleshoot. I'll move forward from here mapping keyboard events to the gamepad for this emulator.

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

            RiverstormR 1 Reply Last reply Reply Quote 0
            • RiverstormR
              Riverstorm @mediamogul
              last edited by Riverstorm

              @mediamogul said in js0 Being Ignored by Some Emulators:

              I'll take the silence to mean that no one has an XBox 360 controller working with Daphne. Well, I have to admit I'm surprised, but I guess it's one less thing to troubleshoot. I'll move forward from here mapping keyboard events to the gamepad for this emulator.

              I had no issues getting a XBOX 360 controller working (wireless--I haven't tried wired but I think it should work fine) with Daphne. I don't think I would be much help as you have more technical experience but for what it's worth I did the standard controller Input config and tweaked the dapinput.ini to my controller settings and away it went. I didn't do anything special to make it work out of the box.

              EDIT: The one thing I couldn't get working on a controller is pause. It works fine via keyboard but no line entry in the dapinput.ini. I tried adding it manually but it was a no go for pause.

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

                @Riverstorm

                That information is a big help. I'm on my phone right now and I might have a quick question or two for you later, but for now, I just wanted to say thanks.

                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
                  last edited by mediamogul

                  Well, I finally have closure here, albeit without a true solution to the actual problem. After exhausting every avenue for information, I can now move on, knowing that I am not responsible for the shortcomings seen here. Joystick support is just too rudimentary to make proper use of in certain emulators past the most basic of setups. I found articles where the developers have said so themselves in both the cases of Daphne and ScummVM.

                  The joystick input is in fact ignored, leaving the software to grab the first controller event it can find with no intelligent discovery past list order. There are plenty of real world use case scenarios where this approach not only wouldn't work, but would also not be possible to correct either as event order cannot be changed in any acceptable way like joystick order can. While I was searching, I also discovered plenty of other reasons to prefer keyboard and mouse mapping to a gamepad for software of this kind anyway, so I will continue to move forward using those solutions.

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

                  1 Reply Last reply Reply Quote 0
                  • Meneer JansenM
                    Meneer Jansen
                    last edited by

                    I don't think js0 and how Linux works with it is your problem. The problem is that Playstation and Xbox controllers don't respect standards. They need their own little drivers and they were not meant to be used w/ anything else then a PS or an Xbox.

                    Avid Linux user.

                    herb_fargusH 1 Reply Last reply Reply Quote 0
                    • herb_fargusH
                      herb_fargus administrators @Meneer Jansen
                      last edited by

                      @Meneer-Jansen well and windows. There often is better support for windows as I odnt know of any controller that was actually designed for use with linux

                      If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                      Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                      Meneer JansenM 1 Reply Last reply Reply Quote 0
                      • Meneer JansenM
                        Meneer Jansen @herb_fargus
                        last edited by

                        @herb_fargus said in js0 Being Ignored by Some Emulators:

                        @Meneer-Jansen well and windows. There often is better support for windows as I odnt know of any controller that was actually designed for use with linux

                        You're right, but I do not know for sure if a Playstation controller works "out of the box" on Windows (I don't own a PS). Sony is Microsofts biggest concurrent. Maybe Sony has a Windows driver for download on its site. I'm surprised though that this MS and Sony equipment works at all on Linux/RetroPie.

                        Avid Linux user.

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

                          We are actually fortunate that the input received in Linux from just about any controller is a lot more standardized than we might imagine. Once you have a controller registering input to an event/joystick device entry, button presses are nothing more than a binary state of on/off and axis input simply increases or decreases incrementally from a resting location. Where you run into problems is when you deal with a controller that doesn't register this input into joystick device entry for Linux to make use of. This is where xboxdrv comes in. Once an XBox controller is properly registering itself as an HID-compliant controller, Linux makes no distinction that it be any different than any other controller. It is simply the sum of it's parts at this stage and all buttons, axis and hat switch input is read indiscriminately. The only truly unique properties that an XBox controller has is the order of the axis and button data and the device identification information, both of which can be artificially given to absolutely any controller using the --mimic-xpadargument in xboxdrv.

                          The issue I have been dealing with in this thread has to do with how certain emulators found in RetroPie identify and grab any controller. It just so happens that it also effects my particular use case of xboxdrv. These emulators try to find the first available joystick they can without any intelligent discovery or manual selection. This limitation adds insult to injury when compounded with a dependance on SDL2 which only makes use of event input, where it can become impossible to rearrange the order. At this point it is impossible for your chosen controller to ever be discovered by the software. There are quite a few forums discussing this issue with various software. In every case I've come across, controller input was simply not prioritized during the project's creation and each time this revelation came from the project leader. The good news is that this situation is isolated to only a few emulators found in RetroPie. Even then, if it ever becomes an issue, most setups can simply unplug and replug their controllers so that their desired gamepad will register as the first controller event. However, for those without this option, keyboard and mouse mapping to a controller is still a viable alternative.

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

                          1 Reply Last reply Reply Quote 0
                          • Meneer JansenM
                            Meneer Jansen
                            last edited by

                            Sorry. Read your top post again. Indeed, it is very, very strange that Daphne (Dragons Lair) and ScummVM do not accept js0for input. That would mean that they can not be played by somebody who has only one controller. Is that true?

                            Avid Linux user.

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

                              @Meneer-Jansen

                              It is odd, but the jsX device designation is apparently only used to obtain the input codes through jstest. When launched, the software actually grabs hold of the first controller event through evdev. So, any circumstance where it becomes impossible for your desired controller to fill that first event slot will prohibit the use of that controller.

                              Edit: I guess I really shouldn't say that it's odd at all. Starting with SDL2, it turns out that the jsX slots are universally ignored by all software that rely on SDL for input. It's just that other software seems to have made the transition more or less seamlessly by either allowing manual selection of controller events or at least utilize a more intelligent auto selection of some kind.

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

                              Meneer JansenM 1 Reply Last reply Reply Quote 0
                              • Meneer JansenM
                                Meneer Jansen @mediamogul
                                last edited by

                                @mediamogul said in js0 Being Ignored by Some Emulators:

                                @Meneer-Jansen

                                It is odd, but the jsX device designation is apparently only used to obtain the input codes through jstest. When launched, the software actually grabs hold of the first controller event through evdev. So, any circumstance where it becomes impossible for your desired controller to fill that first event slot will prohibit the use of that controller.

                                Edit: I guess I really shouldn't say that it's odd at all. Starting with SDL2, it turns out that the jsX slots are universally ignored by all software that rely on SDL for input. It's just that other software seems to have made the transition more or less seamlessly by either allowing manual selection of controller events or at least utilize a more intelligent auto selection of some kind.

                                Thanks for the explanation. Have you any idea how evdev determines which is controller number one? I have problems using my favorite controller too sometimes...

                                Avid Linux user.

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

                                  @Meneer-Jansen

                                  It's based on the order that the device is discovered. I believe this is determined by the order in which the system checks the USB slots. Supposedly the order can still vary sometimes, but in most situations you can just unplug all controllers and make sure to plug the desired controller in first. It is then listed numerically as the earliest joystick event. If you have a look at the config file for Muppen64Plus, you'll see a great example of how to better handle controller preference, whereas the specific emulators I've had issue with here won't bother to look past the first viable joystick event.

                                  Edit: It should be noted that whatever frustration I have here takes no enjoyment away from using these amazing emulators and the distribution as a whole. With all the combined man hours from so many sources, it truly is an amazing achievement and a lot of fun.

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

                                  1 Reply Last reply Reply Quote 0
                                  • RiverstormR
                                    Riverstorm
                                    last edited by

                                    Is another device interfering with ScummVM or taking js0? I always have to change ScummVM when using an I-PAC as it's always treated as js0. It's always been consistent on how it works but unfortunately not dynamic. I can also just unplug the I-PAC and the XBOX controller works fine as js0 with no issues.

                                    1. Modify /home/pi/RetroPie/roms/scummvm/+Start ScummVM.sh
                                    2. Change "--joystick=0" to "--joystick=1" or whatever one you're using
                                    mediamogulM 1 Reply Last reply Reply Quote 1
                                    • mediamogulM
                                      mediamogul Global Moderator @Riverstorm
                                      last edited by mediamogul

                                      @Riverstorm

                                      Sorry, your post got by me somehow. That is very helpful information it's great to have it documented here. I've found that a few of these type quirks regarding specific js numbers are indeed configurable, but in the case ScummVM, the method has escaped me until your post. Since my last comments here, I've taken to mapping a virtual mouse to my controller's left analog thumbstick and have found that it operates more smoothly than if ScummVM tries to utilize the joystick itself. I've also since keymapped my controller with ColecoVision & Intellivision in mind and put the same technique to good use in working around the event order issue with Daphne. In doing so, I can even invert the controls if necessary, which is another known limitation with Daphne's native joystick support.

                                      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.