mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-25 18:46:58 +01:00
Fixed macroRecorder to properly handle LeftAlt key events. Previously LeftAlt key was not recorded at all (it was set as System key value which doesn't do anything as virtualKey code value)
This commit is contained in:
parent
7c3b4668d1
commit
22d5c2e7b5
@ -279,10 +279,15 @@ namespace DS4WinWPF.DS4Forms
|
||||
if (recordBoxVM.Recording)
|
||||
{
|
||||
int value = KeyInterop.VirtualKeyFromKey(e.Key);
|
||||
|
||||
// If the key is System key (ie. e.Key doesnt have a real key code) then map the system key to Win32 virtualKey value (in some keyboard layouts LeftAlt is one of those problematic keys)
|
||||
if (value == 0 && e.Key == Key.System && e.SystemKey == Key.LeftAlt)
|
||||
value = 164; // Win32 keycode VK_LMENU (=LeftAlt)
|
||||
|
||||
recordBoxVM.KeysdownMap.TryGetValue(value, out bool isdown);
|
||||
if (!isdown)
|
||||
{
|
||||
DS4Windows.MacroStep step = new DS4Windows.MacroStep(KeyInterop.VirtualKeyFromKey(e.Key), e.Key.ToString(),
|
||||
DS4Windows.MacroStep step = new DS4Windows.MacroStep(value, ( (e.Key != Key.System || value == 0) ? e.Key.ToString() : e.SystemKey.ToString() ),
|
||||
DS4Windows.MacroStep.StepType.ActDown, DS4Windows.MacroStep.StepOutput.Key);
|
||||
recordBoxVM.AddMacroStep(step);
|
||||
recordBoxVM.KeysdownMap.Add(value, true);
|
||||
@ -304,10 +309,14 @@ namespace DS4WinWPF.DS4Forms
|
||||
if (recordBoxVM.Recording)
|
||||
{
|
||||
int value = KeyInterop.VirtualKeyFromKey(e.Key);
|
||||
|
||||
if (value == 0 && e.Key == Key.System && e.SystemKey == Key.LeftAlt)
|
||||
value = 164; // Win32 keycode VK_LMENU (=LeftAlt)
|
||||
|
||||
recordBoxVM.KeysdownMap.TryGetValue(value, out bool isdown);
|
||||
if (isdown)
|
||||
{
|
||||
DS4Windows.MacroStep step = new DS4Windows.MacroStep(KeyInterop.VirtualKeyFromKey(e.Key), e.Key.ToString(),
|
||||
DS4Windows.MacroStep step = new DS4Windows.MacroStep(value, ( (e.Key != Key.System || value == 0) ? e.Key.ToString() : e.SystemKey.ToString() ),
|
||||
DS4Windows.MacroStep.StepType.ActUp, DS4Windows.MacroStep.StepOutput.Key);
|
||||
recordBoxVM.AddMacroStep(step);
|
||||
recordBoxVM.KeysdownMap.Remove(value);
|
||||
|
Loading…
Reference in New Issue
Block a user