Input: Prevent Steam from causing keybinding issues when Steam maps gamepad buttons to keyboard keys (prioritize gamepad buttons over keyboard buttons)

This commit is contained in:
Sour 2018-05-26 12:18:04 -04:00
parent 483fd3f128
commit 8fc489a08d

View file

@ -1634,6 +1634,13 @@ namespace Mesen.GUI
public KeyCombination(List<UInt32> scanCodes = null)
{
if(scanCodes != null) {
if(scanCodes.Any(code => code > 0xFFFF)) {
//If both keyboard & gamepad codes exist, only use the gamepad codes
//This fixes an issue with Steam where Steam can remap gamepad buttons to send keyboard keys
//See: Settings -> Controller Settings -> General Controller Settings -> Checking the Xbox/PS4/Generic/etc controller checkboxes will cause this
scanCodes = scanCodes.Where(code => code > 0xFFFF).ToList();
}
Key1 = scanCodes.Count > 0 ? scanCodes[0] : 0;
Key2 = scanCodes.Count > 1 ? scanCodes[1] : 0;
Key3 = scanCodes.Count > 2 ? scanCodes[2] : 0;