-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for mapping multiple controllers to a single input device #12534
Conversation
Oh that's f***ing awesome! Thank you so much for this! And for the "device type" and "analog to digital type" fix too! ❤️ |
This is, simply put, yet another huge improvement that I was looking forward to seeing in RA! Amazing work as always. |
Perhaps this could be made more explicit: "retroarch side/core side" with sub-labels or something like that. |
Thanks guys! @Tatsuya79 That's a good point. These input menu entries are non-standard, and tricky to deal with, but let me see about adding a sublabel.... |
0e95e5c
to
4467fbe
Compare
@Tatsuya79 There we go - I have added a sublabel: |
0d11daa
to
ad4e491
Compare
Not sure if intended with this PR or not: edit: OK probably a bug, because if you have |
@bslenul Thanks for reporting this! It is indeed a bug. But oh boy - what a nightmare it will be to fix it... (turns out that RA does some very stupid things at a fundamental level; I can't really change how it functions, so will need a creative workaround...) Will push a fix as soon as I can find one :) (BTW - I agree that setting |
ad4e491
to
973f5cd
Compare
@bslenul I just updated the PR with a fix: now it should only restore cached settings if content has actually been launched, and the cache will be cleared on core deinit to prevent spurious overwrites when quitting RA (i.e. changes made while a core is not running should be preserved) |
Nice, thank you! :) |
@jdgleaver Great feature! I would really have loved to be able to change this setting in the global Input menu (I have a device with multiple devices that I always need to use together). Any particular reason that it is only provided as a remap? |
@RobinTD The input code is very bad, and difficult to work with. I implemented the feature like this because it was the easiest/sanest method. I will try to think about a global setting, but I have some other work I need to do first. |
For context, if I push a button on one device now right after RetroArch is started, the others will of course not be available. Which is unfortunate if they are the ones who provide the directional keys etc. So then I have to just quit and restart. |
Oof...! Yes, I see the problem. That's actually a completely different ballgame though - the current implementation is just for core inputs, but for RetroArch itself it's an entirely different codepath. Very, very tricky... |
This is phenomenal! Bravo and well done. By the way, can I help contribute making this work in global settings? (I'm a software developer, but haven't contributed to libretro yet. Might be a great way to get started.) My use-case is a home arcade system with two USB arcade joysticks (port 1 and port 2), plus two Bluetooth game pads (port 3 mapped to port 1 and port 4 mapped to port 2). I want every core to behave the same, but I currently have to set up the port mapping individually for every core. |
@bhamiltoncx Not to discourage you, but I'd probably recommend attempting almost anything other than this as a first foray into libretro development! There is a great deal of ugly (horrible) legacy code here, and some tricky menu work involved. Starting with this area of the codebase is likely to turn you off libretro development for good... One of the more significant issues here is on the UX side. These port maps are set relative to the core - but for global settings via the regular Input menu, everything would have to be done in reverse (which is more involved than you might think). Alternatively, we'd a new global 'core port mapping' menu - but then that's awkward because we don't know how many core ports should be set until after a particular core is loaded. If you're feeling brave, however, then by all means have a dig through the code :) |
OK, OK. :) It wasn't too hard to copy the behavior for each core I care about, it just took a while. I'll still try to find another way to contribute — I've had to struggle a lot to get AutoHotKey to provide a consistent way to exit Retroarch by holding a button (the existing Retroarch feature to open the menu by holding a button is too complex for my kiddos, and my home arcade doesn't have a dedicated "exit" button I can map otherwise). I might contribute that to libretro instead.. |
Ah, that sounds like a fine idea :) Starting with something smallish is always good - the codebase can be quite intimidating at first ;) |
Unfortunately this feature do not cover different device type scenarios.
Then I go to |
I'm trying to set up the Atari 2600 Raiders of the Lost Ark game with just one controller. Back in the day, you had to play Raiders with both joysticks -- one controlled Indy while the other allowed you to choose from your inventory. But I have an Xbox controller with two sticks, a D-pad, etc. I thought that using Mapped Port I'd be able to map the inventory selection to, say, the shoulder buttons... Then my left analog stick would control Indy, B would fire/use, L and R would cycle through the inventory, and X would drop. But I can't seem to get that to work. I'm sure I'm missing something incredibly basic! Right now, I've set Port 2 (which has a standard gamepad plugged in) to Mapped Port -> 1. I then set the shoulder buttons on Port 2 to "left" and "right." But I'm not sure what I need to do under Port 1 in order to get the Xbox's shoulder buttons to "see" the mapping. Is what I'm attempting possible, or am I tilting at windmills? |
@barryl93 The What you need to do is go to |
Ah, I see now! That seems to work! (The D-pad on Player 1 now acts like it's getting input from the D-pad on Player 2. It also, weirdly, still acts as the D-pad on P1 -- it moves the inventory selection AND moves Indy -- but that's not a big deal.) Thank you so much for you guiding this noob! |
Description
This PR adds support for the remapping of individual controllers to arbitrary core input devices. This allows multiple controllers to be assigned to one input. To configure this, a new
Mapped Port
option has been added to theQuick Menu > Controls > Port N Controls
menu:Here, the
Port 2 Controls
refers to the physical controller;Mapped Port
refers to the core port that will receive input from this controller.For example, to map physical controllers 1 and 2 to the player 1 input of a core, set the following:
Port 1 Controls > Mapped Port > 1
Port 2 Controls > Mapped Port > 1
There are various use cases for this remapping:
Note that these configuration settings are independent from the main RetroArch config file. To make any changes persistent, a
Core
,Content Directory
orGame
remap file must be saved.This PR also cleans up a long standing issue when configuring remaps (#10622): at present, changes to
Device Type
andAnalog to Digital Type
via the Quick Menu while a core is running will 'bleed through' to the main config file. This is harmful and unintuitive behaviour. With this PR, the global settings for these values are cached when initialising a core, and restored when the core is unloaded. (This essentially became a necessity for using the port remapping functionality, since it is rather easy to create complex configs that should in no way touch the main config file...)Related Issues
Addresses half of #7830
Closes #10622