mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-12-20 15:02:20 +00: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:
parent
a96fc60dcd
commit
458938c2ae
1 changed files with 11 additions and 0 deletions
|
|
@ -82,6 +82,11 @@ public:
|
||||||
return controller;
|
return controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearState()
|
||||||
|
{
|
||||||
|
memset(&state, 0, sizeof(state));
|
||||||
|
}
|
||||||
|
|
||||||
void PollAxis()
|
void PollAxis()
|
||||||
{
|
{
|
||||||
if (!CanPoll())
|
if (!CanPoll())
|
||||||
|
|
@ -184,6 +189,11 @@ inline Controller* FindController(int which)
|
||||||
|
|
||||||
static void SetControllerInputDevice(Controller* controller)
|
static void SetControllerInputDevice(Controller* controller)
|
||||||
{
|
{
|
||||||
|
if (g_activeController && g_activeController != controller)
|
||||||
|
{
|
||||||
|
g_activeController->ClearState();
|
||||||
|
}
|
||||||
|
|
||||||
g_activeController = controller;
|
g_activeController = controller;
|
||||||
|
|
||||||
if (App::s_isLoading)
|
if (App::s_isLoading)
|
||||||
|
|
@ -415,3 +425,4 @@ uint32_t hid::GetCapabilities(uint32_t dwUserIndex, XAMINPUT_CAPABILITIES* pCaps
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue