Don't distinguish between left & right shift/alt/control!

This commit is contained in:
andres.delikat 2011-06-20 02:24:41 +00:00
parent e6af827d7c
commit 30296e4f5b
3 changed files with 29 additions and 6 deletions

View File

@ -37,6 +37,21 @@ namespace BizHawk.MultiClient
if (control.StartsWith("J2 ")) return GetGamePad(1, control.Substring(3));
if (control.StartsWith("J3 ")) return GetGamePad(2, control.Substring(3));
if (control.StartsWith("J4 ")) return GetGamePad(3, control.Substring(3));
if (control.Contains("RightShift"))
control = control.Replace("RightShift", "LeftShift");
if (control.Contains("RightControl"))
control = control.Replace("RightControl", "LeftControl");
if (control.Contains("RightAlt"))
control = control.Replace("RightAlt", "LeftAlt");
if (control.Contains("Shift") && control != "LeftShift")
control = control.Replace("Shift", "LeftShift");
if (control.Contains("Control") && control != "LeftControl")
control = control.Replace("Control", "LeftControl");
if (control.Contains("Alt") && control != "LeftAlt")
control = control.Replace("Alt", "LeftAlt");
Key k = (Key)Enum.Parse(typeof(Key), control, true);
return KeyInput.IsPressed(k);
}

View File

@ -53,6 +53,14 @@ namespace BizHawk.MultiClient
return false;
if (state.IsPressed(key))
return true;
if (key == Key.LeftShift && state.IsPressed(Key.RightShift))
return true;
if (key == Key.LeftControl && state.IsPressed(Key.RightControl))
return true;
if (key == Key.LeftAlt && state.IsPressed(Key.RightAlt))
return true;
return false;
}

View File

@ -167,11 +167,11 @@ namespace BizHawk.MultiClient
str += key.ToString();
if (str.Length == 10 && str == "ControlKey")
str = "LeftControl";
str = "Control";
if (str.Length == 4 && str == "Menu")
str = "LeftAlt";
str = "Alt";
if (str.Length == 8 && str == "ShiftKey")
str = "LeftShift";
str = "Shift";
if (str.Length == 2 && str == "Up")
str = "UpArrow";
if (str.Length == 4 && str == "Down")
@ -214,11 +214,11 @@ namespace BizHawk.MultiClient
str = "LeftBracket";
if ((modifiers & Keys.Shift) != 0)
str = str.Insert(0, "LeftShift + ");
str = str.Insert(0, "Shift + ");
if ((modifiers & Keys.Control) != 0)
str = str.Insert(0, "LeftControl + ");
str = str.Insert(0, "Control + ");
if ((modifiers & Keys.Alt) != 0)
str = str.Insert(0, "LeftAlt + ");
str = str.Insert(0, "Alt + ");
return str;
}