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

    Using 2 controllers with xboxdrv, P1 and P2 controls swap almost every time I launch RetroArch 1.7.1

    Scheduled Pinned Locked Moved Help and Support
    retroarchxboxdrv2 playersbug
    3 Posts 3 Posters 1.1k 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.
    • M
      msheehan79
      last edited by

      Pi Model or other hardware: 3B
      Power Supply used: Official Pi Supply
      RetroPie Version Used: 4.1
      Built From: Premade SD image
      USB Devices connected: 2 x iBuffalo SNES type controllers
      Controller used: see above
      Error messages received: None
      Log found in /dev/shm/runcommand.log (if relevant):
      Guide used: https://github.com/RetroPie/RetroPie-Setup/wiki/Universal-Controller-Calibration-&-Mapping-Using-xboxdrv
      Emulator: RetroArch 1.7.1
      How to replicate the problem:

      It seems a commit to RetroArch in December has raised a bit of an issue when using xboxdrv to remap controls. https://github.com/libretro/RetroArch/commit/b14598657c4b813c555b6cc6c6e81ec0830621c4#diff-e24ecc035fba173802aca096d7675071 (full disclosure, I have not yet built past this commit to 100% verify it is this one, but looking at what it changes it makes sense)

      I've been using a variation of the "Universal Controller Calibration & Mapping using xboxdrv" on my system for about 6 months and it has worked quite well with RetroArch 1.6.9 and earlier builds.

      When launching more than one instance of xboxdrv for 2 player modes, there is no guarantee of the order in which they run, or the joystick index that is assigned to these xboxdrv controllers. So for 2-player scenarios I dynamically updated the retroarch.cfg file with the proper joystick IDs in the runcommand-onstart.sh script (below), so that if the "Player 1" controller was assigned to event3 while "Player 2" happened to get event2, it would all still work.

      input_player1_joypad_index = "3"
      input_player2_joypad_index = "2"

      When I updated to 1.7.1 recently I noticed that for some reason about every other time I launched a new game with a RetroArch emulator that the controllers were swapped, so the controller that just a moment ago was P1 is now P2 and vice versa. I am assuming the commit referenced above is essentially reordering the joystick IDs and overriding the joypad index setting in the config file.

      I am not sure how best to proceed with a fix that would honor the original intent of the pull request but also restore the functionality that seems to have been broken by it. Going to take a closer look at the code but wanted to post this here as an FYI should any other users who use xboxdrv encounter this after updating RetroArch.

      1 Reply Last reply Reply Quote 0
      • C
        ChuckyP
        last edited by

        Clearly you have done your research, and I won’t claim to be as knowledgeable as most here. But could you hard code the HID (Hardware ID) of your controllers?

        1 Reply Last reply Reply Quote 0
        • thelostsoulT
          thelostsoul
          last edited by

          I am using 2 iBuffalo SNES controllers plus an arcade stick too, which are connected all the time through usb. And I don't have this problem, just saying it. What I don't understand, why do you use xboxdrv? These gamepads are working out of the box.

          I also use RetroPie joystick-selection script, which lets you set the gamepads as player 1, 2, 3, 4 in what order you want. After restart, this selection remains. Now, when I think back, I installed this because I had the problem after restart the order wasn't fixed without this script. It was randomly changed. This script gives fixed order, either system wide or even different settings for each emulator.

          Not sure if I did understand your problem and if you already use this script.

          πŸ“œ RE/SET: 100 SNES Games for your RetroPie, 🎁 Share your hidden gems and insider tips

          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.