mirror of
https://github.com/MiSTer-devel/Retro-Controllers-USB-MiSTer.git
synced 2026-05-17 03:04:28 +00:00
Removed the need for the switch.
This commit is contained in:
@@ -104,6 +104,19 @@ word SegaController32U4::getStateMD()
|
||||
(bitRead(_inputReg2, DB9_PIN9_BIT) == LOW) ? _currentState |= SC_BTN_C : _currentState &= ~SC_BTN_C;
|
||||
}
|
||||
}
|
||||
else // No Mega Drive controller is connected, use SMS/Atari mode
|
||||
{
|
||||
// Clear current state
|
||||
_currentState = 0;
|
||||
|
||||
// Read input pins for Up, Down, Left, Right, Fire1, Fire2
|
||||
if (bitRead(_inputReg1, DB9_PIN1_BIT) == LOW) { _currentState |= SC_BTN_UP; }
|
||||
if (bitRead(_inputReg1, DB9_PIN2_BIT) == LOW) { _currentState |= SC_BTN_DOWN; }
|
||||
if (bitRead(_inputReg1, DB9_PIN3_BIT) == LOW) { _currentState |= SC_BTN_LEFT; }
|
||||
if (bitRead(_inputReg1, DB9_PIN4_BIT) == LOW) { _currentState |= SC_BTN_RIGHT; }
|
||||
if (bitRead(_inputReg2, DB9_PIN6_BIT) == LOW) { _currentState |= SC_BTN_A; }
|
||||
if (bitRead(_inputReg2, DB9_PIN9_BIT) == LOW) { _currentState |= SC_BTN_B; }
|
||||
}
|
||||
}
|
||||
else // Select pin is LOW
|
||||
{
|
||||
@@ -122,8 +135,6 @@ word SegaController32U4::getStateMD()
|
||||
(bitRead(_inputReg2, DB9_PIN9_BIT) == LOW) ? _currentState |= SC_BTN_START : _currentState &= ~SC_BTN_START;
|
||||
}
|
||||
}
|
||||
else
|
||||
_currentState = 0; // Reset buttons if no controller is connected
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -133,23 +144,3 @@ word SegaController32U4::getStateMD()
|
||||
|
||||
return _currentState;
|
||||
}
|
||||
|
||||
word SegaController32U4::getStateSMS()
|
||||
{
|
||||
// Clear current state
|
||||
_currentState = 0;
|
||||
|
||||
// Read input register(s)
|
||||
_inputReg1 = PINF;
|
||||
_inputReg2 = PINB;
|
||||
|
||||
// Read input pins for Up, Down, Left, Right, Fire1, Fire2
|
||||
if (bitRead(_inputReg1, DB9_PIN1_BIT) == LOW) { _currentState |= SC_BTN_UP; }
|
||||
if (bitRead(_inputReg1, DB9_PIN2_BIT) == LOW) { _currentState |= SC_BTN_DOWN; }
|
||||
if (bitRead(_inputReg1, DB9_PIN3_BIT) == LOW) { _currentState |= SC_BTN_LEFT; }
|
||||
if (bitRead(_inputReg1, DB9_PIN4_BIT) == LOW) { _currentState |= SC_BTN_RIGHT; }
|
||||
if (bitRead(_inputReg2, DB9_PIN6_BIT) == LOW) { _currentState |= SC_BTN_A; }
|
||||
if (bitRead(_inputReg2, DB9_PIN9_BIT) == LOW) { _currentState |= SC_BTN_B; }
|
||||
|
||||
return _currentState;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user