Change JS search loop to be more efficient on game pad config window.

This commit is contained in:
mjbudd77 2021-06-13 12:35:01 -04:00
parent 5f96a20385
commit 2b0e4a8876
1 changed files with 5 additions and 9 deletions

View File

@ -1266,6 +1266,9 @@ void GamePadConfDialog_t::delKeyBindingCallback(void)
//----------------------------------------------------
void GamePadConfDialog_t::updatePeriodic(void)
{
char jsFound[ MAX_JOYSTICKS ];
memset( jsFound, 0, sizeof(jsFound) );
for (int i = 0; i < devSel->count(); i++)
{
@ -1290,6 +1293,7 @@ void GamePadConfDialog_t::updatePeriodic(void)
devSel->removeItem(i);
deviceSelect( devSel->currentIndex() );
}
jsFound[ devIdx ] = 1;
}
}
@ -1301,15 +1305,7 @@ void GamePadConfDialog_t::updatePeriodic(void)
{
if (js->isConnected())
{
char jsFound = 0;
for (int j = 0; j < devSel->count(); j++)
{
if ( devSel->itemData(j).toInt() == i )
{
jsFound = 1; break;
}
}
if ( !jsFound )
if ( !jsFound[i] )
{
char stmp[256];
//printf("Adding Newly Connected JS\n");