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

    Multiple controller drivers (one per system/core) ?? [SOLVED]

    Scheduled Pinned Locked Moved Help and Support
    9 Posts 2 Posters 4.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.
    • DanikD
      Danik
      last edited by Danik

      Hello there, this is my first post.
      Congratulations to everyone for this amazing community and of course to petrockblog for Retropie!

      I'm building a game console that is going to use the original controller for each system.
      It has lots of physical ports:

      2x NES
      2x SNES
      2x DSUB-9 (use for Atari / Master System - 2 Button driver or Genesis - 3 Buttons + Start)
      2x USB (for keyboard dongles, PS3 controller pairing etc)

      I'm, currently using:

      1. db9-driver for Atari/Master System and Genesis 3 Button controllers (switchable)
      2. gamecon-driver for NES/SNES controllers (switchable)
      3. bluetooth ps3 controllers (for PSX emulation - not really the original controller, but I save up a lot of space, it is wireless and, to be fair, the controller hasn't changed that much, so I went with that)

      The front panel of the console contains (among other things) some momentary pushbuttons. I use these in conjuction with a python script I wrote that switches modes for the db9 and the gamecon driver by disabling previous driver with modprobe, then enabling the next one. That means that at any given moment there are at least 2 controllers connected, depending on the user selection. And if there are any PS3 controllers connected, the connected controllers for the system become 4.

      This system works fine in EmulationStation, I can switch drivers on the fly and all controllers work.

      But when I try to play a game in retroarch I have to open up rgui and change the input to the controller I want...
      It doesn't get saved on exit even though I have enabled the appropriate option. The only way to make retroarch save a configuration is to save global configuration by launching it via the Retropie tab in ES.

      To summarize:
      I need to make Retroarch use different controller drivers per core (if they don't exist, it would be nice to fall back, but I don't really care, the user is supposed to switch the controller mode and connect the appropriate controller prior to game launching)

      EG:
      pcsx-rearmed should only use PS3 Controller
      picodrive, stella and prosystem should only use db9-gpio-rpi "Multisystem 2-Button Controller"
      GenesisPlus_GX should only use db9-gpio-rpi "Genesis 3-Button Controller"

      I hope the description of what I want to do is understandable... excuse my poor english!

      Looking forward to finish my project and present it to you...
      Here are a couple of pics of my project (just for laughs)

      undefined
      undefined

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

        @Danik Very cool project man!!

        If you are able to do this, you are able to do what you want after read this:

        https://github.com/retropie/retropie-setup/wiki/retroarch-configuration

        https://github.com/retropie/retropie-setup/wiki/Configuration-Editor

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

          @meleu Thanks man! Looking forward to completing it and documenting it!

          I have already read the documentation. The problem is, it covers only how to change mappings of controllers, but I want to use different controllers altogether... am I missing something??

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

            @Danik You can do it using the input_playerN_joypad_index variable in retroarch.cfg.

            For system specific configuration: /opt/retropie/configs/{SYSTEM}/retroarch.cfg.

            If you wanna try something more user-friendly: http://github.com/meleu/RetroPie-joystick-selection

            • Useful topics
            • joystick-selection tool
            • rpie-art tool
            • achievements I made
            DanikD 1 Reply Last reply Reply Quote 0
            • DanikD
              Danik @meleu
              last edited by Danik

              @meleu
              The device index doesn't depend on # of controllers currently connected?
              What I mean is:

              with db9 driver in master system mode (modprobe db9_gpio_rpi map=2,2) i get:
              device index: multisystem joystick (2 fire) (#1)
              device index: multisystem joystick (2 fire) (#2)

              when i switch from master system to genesis controller (that is modprobe -r db9_gpio_rpi and then modprobe db9_gpio_rpi map=4,4)
              device index: genesis pad (#1)
              device index: genesis pad (#2)

              I played around a little with your tool (great work btw!!), then discovered jslist, so I started playing around with that. My conclusions are that the PS3 controllers in bluetooth connection always take up the last place. That means that my (whatever_gpio) controller is always going to be joysticks 0 and 1 since I remove the last one before I load the next one in my script, and PS3 controller will always be joysticks 2 and 3 (except that split second inbetween the modprobe commands in which I guess they'll become 0 and 1)

              hopefully I'll only need to change the playstation configuration and leave all else at default. fingers crossed!
              btw, thanks a lot for your time, guys!

              EDIT: now that I think about it, since I don't intend to mix & match controllers, and I just want each system to listen to a certain "controller" maybe all I have to do is somehow make it so that each time the ps3 controller is connected, all other gpio drivers should be unloaded. that way onle two controllers are available at any given time, 0 and 1. Then I would have to play with remap setting around, but it should do the trick.

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

                @Danik said in Multiple controller drivers (one per system/core) ??:

                @meleu
                The device index doesn't depend on # of controllers currently connected?

                No.
                The device index depends on the order that the controllers were connected.
                [EDIT: maybe it's simpler for native raspi USB ports, as we can see here:

                ]

                While the controller is connected, its index won't change.

                PS3 controllers in bluetooth connection always take up the last place

                Usually wired connections take their indexes at boot. Bluetooth connections come later.

                If I understand right what you wanna do, there's no need to unplug/replug your controllers. Just keep all plugged and use their indexes to configure retroarch.cfg.

                I'm currently working on a way to let the users configure the player1-4 joysticks based on the js name. If I do it successfully, you don't need to keep all controllers plugged.

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

                  @meleu

                  by "connected controller" I mean that I have enabled the gpio driver. I can't modprobe the db9 driver with map=2,2 AND map=4,4 at the same time without modprobing -r the previous driver first.
                  Plus, if I could, it would work wonderfully in-game, but in ES every d-pad press on the mastersystem/atari controller would also register a press on the megadrive controller (since they share the same physical DSUB9 port), so that wouldn't work.

                  1 Reply Last reply Reply Quote 1
                  • DanikD
                    Danik
                    last edited by Danik

                    Thanks a lot @meleu !
                    I got around to configuring retroarch and ES from scratch and it worked perfectly!
                    I even added a hardware pause button on the front panel of the console itself for the master system games (the original controller doesn't have one)!
                    Now I need to drill some final holes in the case and put a MOSFET to shut the hdd off when the pi powers down, then it's painting time!! Almost done!

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

                      @Danik Good to know it!

                      Just for curiosity: what are the names showed by the jslist tool when your various controllers are connected? Are the names differents?

                      • Useful topics
                      • joystick-selection tool
                      • rpie-art tool
                      • achievements I made
                      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.