mirror of
https://github.com/hedge-dev/UnleashedRecomp
synced 2026-07-28 23:28:21 -04:00
Attempt to reduce Input leaking
To avoid "the Controller is leaking" situation, there's now a Gamepad stat management that should reset Controller state based on connected controller.
This commit is contained in:
@@ -82,6 +82,11 @@ public:
|
||||
return controller;
|
||||
}
|
||||
|
||||
void ClearState()
|
||||
{
|
||||
memset(&state, 0, sizeof(state));
|
||||
}
|
||||
|
||||
void PollAxis()
|
||||
{
|
||||
if (!CanPoll())
|
||||
@@ -184,6 +189,11 @@ inline Controller* FindController(int which)
|
||||
|
||||
static void SetControllerInputDevice(Controller* controller)
|
||||
{
|
||||
if (g_activeController && g_activeController != controller)
|
||||
{
|
||||
g_activeController->ClearState();
|
||||
}
|
||||
|
||||
g_activeController = controller;
|
||||
|
||||
if (App::s_isLoading)
|
||||
@@ -415,3 +425,4 @@ uint32_t hid::GetCapabilities(uint32_t dwUserIndex, XAMINPUT_CAPABILITIES* pCaps
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user