Joystick combo boxes logic correction fixes #426 (#427)

* Joystick combo boxes logic correction fixes #426
This commit is contained in:
Nick Westgate 2017-06-05 10:09:36 +12:00 committed by GitHub
parent d81cb0d533
commit 2dabab907b

View File

@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
CPageInput* CPageInput::ms_this = 0; // reinit'd in ctor CPageInput* CPageInput::ms_this = 0; // reinit'd in ctor
// Joystick option choices - NOTE maximum text length is MaxMenuChoiceLen = 40
const TCHAR CPageInput::m_szJoyChoice0[] = TEXT("Disabled\0"); const TCHAR CPageInput::m_szJoyChoice0[] = TEXT("Disabled\0");
const TCHAR CPageInput::m_szJoyChoice1[] = TEXT("PC Joystick #1\0"); const TCHAR CPageInput::m_szJoyChoice1[] = TEXT("PC Joystick #1\0");
const TCHAR CPageInput::m_szJoyChoice2[] = TEXT("PC Joystick #2\0"); const TCHAR CPageInput::m_szJoyChoice2[] = TEXT("PC Joystick #2\0");
@ -302,17 +303,24 @@ void CPageInput::InitJoystickChoices(HWND hWnd, int nJoyNum, int nIdcValue)
// Now exclude: // Now exclude:
// . the other Joystick type (if it exists) from this new list // . the other Joystick type (if it exists) from this new list
// . the mouse if the mousecard is plugged in // . the mouse if the mousecard is plugged in
int removedItemCompensation = 0;
for(UINT i=nJC_KEYBD_CURSORS; i<nJC_MAX; i++) for(UINT i=nJC_KEYBD_CURSORS; i<nJC_MAX; i++)
{ {
if( ( (i == nJC_KEYBD_CURSORS) || (i == nJC_KEYBD_NUMPAD) ) && if( ( (i == nJC_KEYBD_CURSORS) || (i == nJC_KEYBD_NUMPAD) ) &&
( (JoyGetJoyType(nOtherJoyNum) == nJC_KEYBD_CURSORS) || (JoyGetJoyType(nOtherJoyNum) == nJC_KEYBD_NUMPAD) ) ( (JoyGetJoyType(nOtherJoyNum) == nJC_KEYBD_CURSORS) || (JoyGetJoyType(nOtherJoyNum) == nJC_KEYBD_NUMPAD) )
) )
{ {
if (i <= JoyGetJoyType(nJoyNum))
removedItemCompensation++;
continue; continue;
} }
if (i == nJC_MOUSE && bIsSlot4Mouse) if (i == nJC_MOUSE && bIsSlot4Mouse)
{
if (i <= JoyGetJoyType(nJoyNum))
removedItemCompensation++;
continue; continue;
}
if (JoyGetJoyType(nOtherJoyNum) != i) if (JoyGetJoyType(nOtherJoyNum) != i)
{ {
@ -324,7 +332,7 @@ void CPageInput::InitJoystickChoices(HWND hWnd, int nJoyNum, int nIdcValue)
*pszMem = 0x00; // Doubly null terminated *pszMem = 0x00; // Doubly null terminated
m_PropertySheetHelper.FillComboBox(hWnd, nIdcValue, pnzJoystickChoices, JoyGetJoyType(nJoyNum)); m_PropertySheetHelper.FillComboBox(hWnd, nIdcValue, pnzJoystickChoices, JoyGetJoyType(nJoyNum) - removedItemCompensation);
} }
void CPageInput::InitSlotOptions(HWND hWnd) void CPageInput::InitSlotOptions(HWND hWnd)