From f3251128e800b31ed8fb7fbe61589d56c86a06c3 Mon Sep 17 00:00:00 2001 From: ergo720 <45463469+ergo720@users.noreply.github.com> Date: Mon, 24 May 2021 12:02:11 +0200 Subject: [PATCH] Fixed an issue where xinput devices were bound to the wrong xbox port under some circumstances after hotplug removal events --- src/common/input/SdlJoystick.cpp | 1 - src/core/hle/D3D8/Direct3D9/Direct3D9.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/input/SdlJoystick.cpp b/src/common/input/SdlJoystick.cpp index cd57228af..530686f5f 100644 --- a/src/common/input/SdlJoystick.cpp +++ b/src/common/input/SdlJoystick.cpp @@ -108,7 +108,6 @@ namespace Sdl } else if (Event.type == SDL_JOYDEVICEREMOVED) { CloseSdlDevice(Event.jdevice.which); - g_InputDeviceManager.HotplugHandler(true); } else if (Event.type == SDL_JOYAXISMOTION || Event.type == SDL_JOYHATMOTION || diff --git a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp index 2289e9301..c704d7342 100644 --- a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp +++ b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp @@ -1928,7 +1928,9 @@ static LRESULT WINAPI EmuMsgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar { // sent by rawinput when it detects changes for the registered device types - g_InputDeviceManager.HotplugHandler(false); + if (wParam == GIDC_ARRIVAL) { + g_InputDeviceManager.HotplugHandler(false); + } return DefWindowProc(hWnd, msg, wParam, lParam); } break;