mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 03:10:07 +00:00
Fix XInput hotplug
This commit is contained in:
parent
80e4b3db55
commit
0ec16a5b0e
|
@ -351,11 +351,8 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (found != -1 && CPad::XInputJoy1 != found) {
|
if (found != -1 && CPad::XInputJoy1 != found) {
|
||||||
if (CPad::XInputJoy1 != -1 && CPad::XInputJoy1 != found)
|
// We should never leave pads -1, so we can process them when they're connected and kinda support hotplug.
|
||||||
CPad::XInputJoy2 = CPad::XInputJoy1;
|
CPad::XInputJoy2 = (CPad::XInputJoy1 == -1 ? (found + 1) % 4 : CPad::XInputJoy1);
|
||||||
else
|
|
||||||
CPad::XInputJoy2 = -1;
|
|
||||||
|
|
||||||
CPad::XInputJoy1 = found;
|
CPad::XInputJoy1 = found;
|
||||||
cachedButtonNum = 0; // fake too, because xinput bypass CControllerConfig
|
cachedButtonNum = 0; // fake too, because xinput bypass CControllerConfig
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,6 +279,14 @@ void LoadINIControllerSettings()
|
||||||
CPad::XInputJoy2 = i;
|
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
|
#else
|
||||||
ReadIniIfExists("Controller", "JoystickName", gSelectedJoystickName, 128);
|
ReadIniIfExists("Controller", "JoystickName", gSelectedJoystickName, 128);
|
||||||
|
|
Loading…
Reference in a new issue