diff --git a/Artemis/Artemis/DeviceProviders/CoolerMaster/MasterkeysProL.cs b/Artemis/Artemis/DeviceProviders/CoolerMaster/MasterkeysProL.cs index 6b83f28e8..c84f7d4d4 100644 --- a/Artemis/Artemis/DeviceProviders/CoolerMaster/MasterkeysProL.cs +++ b/Artemis/Artemis/DeviceProviders/CoolerMaster/MasterkeysProL.cs @@ -1,4 +1,5 @@ -using System.Drawing; +using System; +using System.Drawing; using System.Linq; using System.Threading; using System.Windows; @@ -67,6 +68,8 @@ namespace Artemis.DeviceProviders.CoolerMaster for (var y = 0; y < Height; y++) { var c = b.GetPixel(x, y); + if (c.R != 0) + Console.WriteLine(); matrix.KeyColor[y, x] = new KEY_COLOR(c.R, c.G, c.B); } } diff --git a/Artemis/Artemis/DeviceProviders/Corsair/CorsairKeyboard.cs b/Artemis/Artemis/DeviceProviders/Corsair/CorsairKeyboard.cs index 3be6500e2..ef5adc1ab 100644 --- a/Artemis/Artemis/DeviceProviders/Corsair/CorsairKeyboard.cs +++ b/Artemis/Artemis/DeviceProviders/Corsair/CorsairKeyboard.cs @@ -81,13 +81,18 @@ namespace Artemis.DeviceProviders.Corsair PreviewSettings = new PreviewSettings(new Rect(15, 30, 751, 284), Resources.k65); break; case "STRAFE RGB": - Height = 7; + Height = 8; Width = 22; Slug = "corsair-strafe-rgb"; - PreviewSettings = new PreviewSettings(new Rect(23, 30, 940, 303), Resources.strafe); + PreviewSettings = new PreviewSettings(new Rect(23, 12, 937, 324), Resources.strafe); break; } + Height = 8; + Width = 22; + Slug = "corsair-strafe-rgb"; + PreviewSettings = new PreviewSettings(new Rect(23, 12, 937, 324), Resources.strafe); + Logger.Debug("Corsair SDK reported device as: {0}", _keyboard.DeviceInfo.Model); _keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush()); } @@ -114,29 +119,8 @@ namespace Artemis.DeviceProviders.Corsair /// public override void DrawBitmap(Bitmap bitmap) { - - // For STRAFE, stretch the image on row 2. - if (_keyboard.DeviceInfo.Model == "STRAFE RGB") - { - using (var strafeBitmap = new Bitmap(22, 8)) - { - using (var g = Graphics.FromImage(strafeBitmap)) - { - g.DrawImage(bitmap, new Point(0, 0)); - g.DrawImage(bitmap, new Rectangle(0, 3, 22, 7), new Rectangle(0, 2, 22, 7), - GraphicsUnit.Pixel); - - _keyboardBrush.Image = strafeBitmap; - _keyboard.Update(); - } - } - } - else - { - _keyboardBrush.Image = bitmap; - _keyboard.Update(); - } - + _keyboardBrush.Image = bitmap; + _keyboard.Update(); } public override KeyMatch? GetKeyPosition(Keys keyCode) diff --git a/Artemis/Artemis/Modules/Games/GtaV/GtaVModel.cs b/Artemis/Artemis/Modules/Games/GtaV/GtaVModel.cs index 38f854a65..f97e8c245 100644 --- a/Artemis/Artemis/Modules/Games/GtaV/GtaVModel.cs +++ b/Artemis/Artemis/Modules/Games/GtaV/GtaVModel.cs @@ -29,7 +29,6 @@ namespace Artemis.Modules.Games.GtaV public override void Enable() { - var process = System.Diagnostics.Process.GetProcessesByName("GTA5").First(); DllManager.PlaceLogitechDll(); _pipeServer.PipeMessage += PipeServerOnPipeMessage; base.Enable(); diff --git a/Artemis/Artemis/Properties/AssemblyInfo.cs b/Artemis/Artemis/Properties/AssemblyInfo.cs index 44b0032cb..9b302b36d 100644 --- a/Artemis/Artemis/Properties/AssemblyInfo.cs +++ b/Artemis/Artemis/Properties/AssemblyInfo.cs @@ -53,7 +53,7 @@ using System.Windows; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.9.0.0")] -[assembly: AssemblyFileVersion("1.9.0.0")] +[assembly: AssemblyVersion("1.9.0.1")] +[assembly: AssemblyFileVersion("1.9.0.1")] [assembly: InternalsVisibleTo("Artemis.Explorables")] diff --git a/Artemis/Artemis/Resources/Keyboards/default-profiles.zip b/Artemis/Artemis/Resources/Keyboards/default-profiles.zip index 298df243e..8b5ead4d6 100644 Binary files a/Artemis/Artemis/Resources/Keyboards/default-profiles.zip and b/Artemis/Artemis/Resources/Keyboards/default-profiles.zip differ diff --git a/Artemis/Artemis/Utilities/DataReaders/DllManager.cs b/Artemis/Artemis/Utilities/DataReaders/DllManager.cs index e1f1802a9..e31be1b13 100644 --- a/Artemis/Artemis/Utilities/DataReaders/DllManager.cs +++ b/Artemis/Artemis/Utilities/DataReaders/DllManager.cs @@ -37,8 +37,11 @@ namespace Artemis.Utilities.DataReaders try { // Change the registry key to point to the fake DLL - var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\CLSID\{a6519e67-7632-4375-afdf-caa889744403}\ServerBinary", true); - key?.SetValue(null, DllPath + @"\LogitechLed.dll"); + // Key doesn't exist yet on systems without LGS installed + var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\CLSID\{a6519e67-7632-4375-afdf-caa889744403}\ServerBinary", true) ?? + Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes\CLSID\{a6519e67-7632-4375-afdf-caa889744403}\ServerBinary", true); + + key.SetValue(null, DllPath + @"\LogitechLed.dll"); // Make sure the fake DLL is in place if (!Directory.Exists(DllPath)) diff --git a/Artemis/Artemis/ViewModels/ProfileEditorViewModel.cs b/Artemis/Artemis/ViewModels/ProfileEditorViewModel.cs index 3f6ee7588..570fd5fb7 100644 --- a/Artemis/Artemis/ViewModels/ProfileEditorViewModel.cs +++ b/Artemis/Artemis/ViewModels/ProfileEditorViewModel.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -12,7 +11,6 @@ using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media; using Artemis.DAL; -using Artemis.DeviceProviders; using Artemis.Events; using Artemis.Managers; using Artemis.Models; @@ -46,14 +44,14 @@ namespace Artemis.ViewModels { public sealed class ProfileEditorViewModel : Screen, IDropTarget { + private readonly KeybindModel _copyKeybind; private readonly DeviceManager _deviceManager; private readonly MetroDialogService _dialogService; private readonly LoopManager _loopManager; private readonly ModuleModel _moduleModel; - private readonly KeybindModel _copyKeybind; + private readonly KeybindModel _pasteKeybind; private ImageSource _keyboardPreview; private ObservableCollection _layers; - private readonly KeybindModel _pasteKeybind; private ObservableCollection _profileNames; private bool _saving; private LayerModel _selectedLayer; @@ -198,7 +196,7 @@ namespace Artemis.ViewModels NotifyOfPropertyChange(() => LayerSelected); } } - + public ProfileModel SelectedProfile => _moduleModel?.ProfileModel; public bool ProfileSelected => SelectedProfile != null; public bool LayerSelected => SelectedProfile != null && SelectedLayer != null; @@ -348,9 +346,7 @@ namespace Artemis.ViewModels return; if (SelectedLayer != null) - { SelectedLayer.InsertAfter(layerModel); - } else { SelectedProfile.Layers.Add(layerModel); @@ -405,6 +401,9 @@ namespace Artemis.ViewModels if (_saving || SelectedProfile == null || _deviceManager.ChangingKeyboard) return; + SelectedProfile.Width = _deviceManager.ActiveKeyboard.Width; + SelectedProfile.Height = _deviceManager.ActiveKeyboard.Height; + _saving = true; try { @@ -421,8 +420,7 @@ namespace Artemis.ViewModels { if (_deviceManager.ActiveKeyboard == null) { - _dialogService.ShowMessageBox("Cannot add profile.", - "To add a profile, please select a keyboard in the options menu first."); + _dialogService.ShowMessageBox("Cannot add profile.", "To add a profile, please select a keyboard in the options menu first."); return; } @@ -701,9 +699,7 @@ namespace Artemis.ViewModels : Cursors.SizeAll; } else - { KeyboardPreviewCursor = Cursors.Hand; - } } private Point GetScaledPosition(MouseEventArgs e) @@ -716,13 +712,13 @@ namespace Artemis.ViewModels var heightScale = sourceImage.ActualHeight / _deviceManager.ActiveKeyboard.PreviewSettings.BackgroundRectangle.Height; // Remove the preview settings' offset from the cursor postion - pos.X = pos.X - (previewSettings.OverlayRectangle.X * widthScale); - pos.Y = pos.Y - (previewSettings.OverlayRectangle.Y * heightScale); + pos.X = pos.X - previewSettings.OverlayRectangle.X * widthScale; + pos.Y = pos.Y - previewSettings.OverlayRectangle.Y * heightScale; // Scale the X and Y position down to match the keyboard's physical size and thus the layer positions - pos.X = pos.X * (SelectedProfile.Width / (previewSettings.OverlayRectangle.Width*widthScale)); + pos.X = pos.X * (SelectedProfile.Width / (previewSettings.OverlayRectangle.Width * widthScale)); pos.Y = pos.Y * (SelectedProfile.Height / (previewSettings.OverlayRectangle.Height * heightScale)); - + return pos; }