From 22d5c2e7b552c4d16fa1f2553c0115a49bb4d1a2 Mon Sep 17 00:00:00 2001 From: mika-n Date: Fri, 3 Jan 2020 21:44:40 +0200 Subject: [PATCH 1/2] 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) --- DS4Windows/DS4Forms/RecordBox.xaml.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/DS4Windows/DS4Forms/RecordBox.xaml.cs b/DS4Windows/DS4Forms/RecordBox.xaml.cs index ac2c07e..1e28a7f 100644 --- a/DS4Windows/DS4Forms/RecordBox.xaml.cs +++ b/DS4Windows/DS4Forms/RecordBox.xaml.cs @@ -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); From 29bd7c869c2a574db610c9e14df978235555ed60 Mon Sep 17 00:00:00 2001 From: mika-n Date: Sat, 4 Jan 2020 22:36:19 +0200 Subject: [PATCH 2/2] Macro recorder screen has now separate CLEAR steps button and by default RECORD btn appends new steps instead of inserting new steps in front (before) of the first item. It is more logical to have separate CLEAR btn to avoid accidentally loosing the whole macro sequence. --- DS4Windows/DS4Forms/RecordBox.xaml | 4 ++++ DS4Windows/DS4Forms/RecordBox.xaml.cs | 13 ++++++++++++- .../DS4Forms/ViewModels/RecordBoxViewModel.cs | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/DS4Windows/DS4Forms/RecordBox.xaml b/DS4Windows/DS4Forms/RecordBox.xaml index 6fcc38e..055473a 100644 --- a/DS4Windows/DS4Forms/RecordBox.xaml +++ b/DS4Windows/DS4Forms/RecordBox.xaml @@ -39,6 +39,10 @@