Skip to content

Commit 9b7ca05

Browse files
committed
only write to the array once
1 parent 89ed7b9 commit 9b7ca05

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

platforms/input/xinput/GameControllerHandler_xinput.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ GameControllerHandler_xinput::GameControllerHandler_xinput()
2424
if (module)
2525
getState = (DWORD (*)(DWORD, XINPUT_STATE *))GetProcAddress(module, "XInputGetState");
2626
if (!getState)
27+
{
2728
LOG_W("Could not find xinput driver, xinput controllers will be disabled.");
29+
for (DWORD i = 0; i < XUSER_MAX_COUNT; ++i)
30+
m_connectionStates[i] = GameController::STATE_DISCONNECTED;
31+
}
2832
#endif
2933

3034
_initButtonMap();
@@ -96,11 +100,8 @@ void GameControllerHandler_xinput::_processMotion(GameController::ID controllerI
96100
void GameControllerHandler_xinput::refresh()
97101
{
98102
if (!getState)
99-
{
100-
for (DWORD i = 0; i < XUSER_MAX_COUNT; ++i)
101-
m_connectionStates[i] = GameController::STATE_DISCONNECTED;
102103
return;
103-
}
104+
104105
// Ingest our input "queue"
105106
for (DWORD i = 0; i < XUSER_MAX_COUNT; ++i)
106107
{

0 commit comments

Comments
 (0)