summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/MenuScreensCustom.cpp7
-rw-r--r--src/core/re3.cpp8
2 files changed, 10 insertions, 5 deletions
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index a5dbd0d5..cdfb3c85 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -351,11 +351,8 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
}
}
if (found != -1 && CPad::XInputJoy1 != found) {
- if (CPad::XInputJoy1 != -1 && CPad::XInputJoy1 != found)
- CPad::XInputJoy2 = CPad::XInputJoy1;
- else
- CPad::XInputJoy2 = -1;
-
+ // We should never leave pads -1, so we can process them when they're connected and kinda support hotplug.
+ CPad::XInputJoy2 = (CPad::XInputJoy1 == -1 ? (found + 1) % 4 : CPad::XInputJoy1);
CPad::XInputJoy1 = found;
cachedButtonNum = 0; // fake too, because xinput bypass CControllerConfig
}
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 06789e4a..bd9a46df 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -279,6 +279,14 @@ void LoadINIControllerSettings()
CPad::XInputJoy2 = i;
}
}
+
+ // There is no plug event on XInput, so let's leave XInputJoy1/2 as 0/1 respectively, and hotplug will be possible.
+ if (CPad::XInputJoy1 == -1) {
+ CPad::XInputJoy1 = 0;
+ CPad::XInputJoy2 = 1;
+ } else if (CPad::XInputJoy2 == -1) {
+ CPad::XInputJoy2 = (CPad::XInputJoy1 + 1) % 4;
+ }
}
#else
ReadIniIfExists("Controller", "JoystickName", gSelectedJoystickName, 128);