From 5db2c3a789783d19ccccd006143f8469de8d8be4 Mon Sep 17 00:00:00 2001 From: Logan Saso Date: Thu, 21 Jan 2016 18:01:20 -0800 Subject: [PATCH 1/4] Added corsair code to K95.cs file. Should work with any sized bitmap or keyboard now. --- Artemis/Artemis/App.config | 425 ++++---- Artemis/Artemis/Artemis.csproj | 954 +++++++++--------- .../Artemis/KeyboardProviders/Corsair/K95.cs | 35 +- Artemis/Artemis/Settings/General.Designer.cs | 124 +-- Artemis/Artemis/Settings/General.settings | 30 +- Artemis/Artemis/Views/SettingsView.xaml.cs | 55 +- Artemis/Artemis/packages.config | 29 +- 7 files changed, 825 insertions(+), 827 deletions(-) diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config index d4dc18237..b2b5b49a5 100644 --- a/Artemis/Artemis/App.config +++ b/Artemis/Artemis/App.config @@ -1,223 +1,204 @@ - - - - - -
-
-
-
-
-
-
-
-
-
-
- - - - - - - - - - {"Game":"RocketLeague","GameVersion":"1.10","GameAddresses":[{"Description":"Boost","BasePointer":{"value":21998084},"Offsets":[88,1452,1780,540]}]} - - - {"Game":"Witcher3","GameVersion":"1.11","GameAddresses":[{"Description":"Sign","BasePointer":{"value":42942304},"Offsets":[40,16,32,3008]}]} - - - - - True - - - - - 4 - - - 21 - - - True - - - 3 - - - #FF0000FF - - - #FF1E90FF - - - - - - - - True - - - #FFFF2900 - - - #FF26F600 - - - True - - - True - - - True - - - True - - - True - - - - - C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive - - - True - - - #FFFF2900 - - - #FF26F600 - - - True - - - True - - - True - - - True - - - - - #FFFF2900 - - - #FF26F600 - - - True - - - - - 4 - - - 21 - - - 1 - - - 3 - - - #FF0000FF - - - #FF1E90FF - - - - - False - - - #FFFF5000 - - - #FFFF0000 - - - - - TypeWave - - - - - True - - - #FFFF0000 - - - True - - - 20 - - - 500 - - - 4 - - - - - TypeWave - - - Razer BlackWidow Chroma - - - True - - - - - - - - - - - - + + + + + +
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + {"Game":"RocketLeague","GameVersion":"1.10","GameAddresses":[{"Description":"Boost","BasePointer":{"value":21998084},"Offsets":[88,1452,1780,540]}]} + + + {"Game":"Witcher3","GameVersion":"1.11","GameAddresses":[{"Description":"Sign","BasePointer":{"value":42942304},"Offsets":[40,16,32,3008]}]} + + + + + True + + + + + 4 + + + 21 + + + True + + + 3 + + + #FF0000FF + + + #FF1E90FF + + + + + + + + True + + + #FFFF2900 + + + #FF26F600 + + + True + + + True + + + True + + + True + + + True + + + + + C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive + + + True + + + #FFFF2900 + + + #FF26F600 + + + True + + + True + + + True + + + True + + + + + #FFFF2900 + + + #FF26F600 + + + True + + + + + 4 + + + 21 + + + 1 + + + 3 + + + #FF0000FF + + + #FF1E90FF + + + + + False + + + #FFFF5000 + + + #FFFF0000 + + + + + TypeWave + + + + + True + + + #FFFF0000 + + + True + + + 20 + + + 500 + + + 4 + + + + + TypeWave + + + Corsair Gaming K95 RGB + + + True + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Artemis/Artemis/Artemis.csproj b/Artemis/Artemis/Artemis.csproj index 7e8f704db..f441be249 100644 --- a/Artemis/Artemis/Artemis.csproj +++ b/Artemis/Artemis/Artemis.csproj @@ -1,482 +1,486 @@ - - - - - Debug - AnyCPU - {ED9997A2-E54C-4E9F-9350-62BE672C3ABE} - WinExe - Properties - Artemis - Artemis - v4.5.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - - - - - - - - - false - C:\Users\spoin\Desktop\Artemis builds\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.0 - false - true - true - - - - - x64 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - EAC088BE27A2DE790AE6F37A020409F4A1B5EC0E - - - Artemis_TemporaryKey.pfx - - - true - - - false - - - logo.ico - - - - ..\packages\Caliburn.Micro.Core.2.0.2\lib\net45\Caliburn.Micro.dll - True - - - ..\packages\Caliburn.Micro.2.0.2\lib\net45\Caliburn.Micro.Platform.dll - True - - - ..\packages\Colore.3.0.2\lib\net35\Corale.Colore.dll - True - - - ..\packages\CUE.NET.1.0.0\lib\net45\CUE.NET.dll - True - - - ..\packages\log4net.2.0.4\lib\net45-full\log4net.dll - True - - - ..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll - True - - - False - - - False - .\MyMemory-x64.dll - False - - - ..\packages\NAudio.1.7.3\lib\net35\NAudio.dll - True - - - ..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll - True - - - ..\packages\Open.WinKeyboardHook.1.0.10.0\lib\net45\Open.WinKeyboardHook.dll - True - - - - - - - - - ..\packages\MahApps.Metro.1.1.2.0\lib\net45\System.Windows.Interactivity.dll - True - - - - - - - - - 4.0 - - - ..\packages\WpfExceptionViewer.1.0.0.0\lib\VioletTape.WpfExceptionViewer.dll - True - - - - - - ..\packages\Extended.Wpf.Toolkit.2.5\lib\net40\Xceed.Wpf.AvalonDock.dll - True - - - ..\packages\Extended.Wpf.Toolkit.2.5\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll - True - - - ..\packages\Extended.Wpf.Toolkit.2.5\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll - True - - - ..\packages\Extended.Wpf.Toolkit.2.5\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll - True - - - ..\packages\Extended.Wpf.Toolkit.2.5\lib\net40\Xceed.Wpf.DataGrid.dll - True - - - ..\packages\Extended.Wpf.Toolkit.2.5\lib\net40\Xceed.Wpf.Toolkit.dll - True - - - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - - - - - - - - - - - - - - - - - AudioVisualization.settings - True - True - - - - - - TypeWave.settings - True - True - - - - - CounterStrike.settings - True - True - - - - - RocketLeague.settings - True - True - - - - True - True - Witcher3.settings - - - - - - - VolumeDisplay.settings - True - True - - - - - - - - - - - True - True - General.settings - - - True - True - Offsets.settings - - - - - - - - - - - - - - - - - - - - - - - - - - - EffectsView.xaml - - - DebugEffectView.xaml - - - AudioVisualizerView.xaml - - - TypeHoleView.xaml - - - TypeWaveView.xaml - - - GamesView.xaml - - - CounterStrikeView.xaml - - - Dota2View.xaml - - - RocketLeagueView.xaml - - - Witcher3View.xaml - - - OverlaysView.xaml - - - VolumeDisplayView.xaml - - - SettingsView.xaml - - - ShellView.xaml - - - - - Code - - - True - True - Resources.resx - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - AudioVisualization.Designer.cs - - - SettingsSingleFileGenerator - TypeWave.Designer.cs - - - SettingsSingleFileGenerator - CounterStrike.Designer.cs - - - SettingsSingleFileGenerator - RocketLeague.Designer.cs - - - SettingsSingleFileGenerator - Witcher3.Designer.cs - - - SettingsSingleFileGenerator - VolumeDisplay.Designer.cs - - - - - - SettingsSingleFileGenerator - Offsets.Designer.cs - - - - SettingsSingleFileGenerator - General.Designer.cs - - - - - - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - - PreserveNewest - - - PreserveNewest - - - - - - - - - False - Microsoft .NET Framework 4.5.2 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + + + Debug + AnyCPU + {ED9997A2-E54C-4E9F-9350-62BE672C3ABE} + WinExe + Properties + Artemis + Artemis + v4.5.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + + + + + + false + C:\Users\spoin\Desktop\Artemis builds\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.0 + false + true + true + + + + + x64 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + EAC088BE27A2DE790AE6F37A020409F4A1B5EC0E + + + Artemis_TemporaryKey.pfx + + + true + + + false + + + logo.ico + + + + ..\packages\Caliburn.Micro.Core.3.0.0-beta2\lib\net45\Caliburn.Micro.dll + True + + + ..\packages\Caliburn.Micro.3.0.0-beta2\lib\net45\Caliburn.Micro.Platform.dll + True + + + ..\packages\Caliburn.Micro.3.0.0-beta2\lib\net45\Caliburn.Micro.Platform.Core.dll + True + + + ..\packages\Colore.3.0.2\lib\net35\Corale.Colore.dll + True + + + ..\packages\CUE.NET.1.0.0\lib\net45\CUE.NET.dll + True + + + ..\packages\log4net.2.0.5\lib\net45-full\log4net.dll + True + + + ..\packages\MahApps.Metro.1.3.0-ALPHA017\lib\net45\MahApps.Metro.dll + True + + + False + + + False + .\MyMemory-x64.dll + False + + + ..\packages\NAudio.1.7.3\lib\net35\NAudio.dll + True + + + ..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll + True + + + ..\packages\Open.WinKeyboardHook.1.0.10.0\lib\net45\Open.WinKeyboardHook.dll + True + + + + + + + + + ..\packages\MahApps.Metro.1.3.0-ALPHA017\lib\net45\System.Windows.Interactivity.dll + True + + + + + + + + + 4.0 + + + ..\packages\WpfExceptionViewer.1.0.0.0\lib\VioletTape.WpfExceptionViewer.dll + True + + + + + + ..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.dll + True + + + ..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll + True + + + ..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll + True + + + ..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll + True + + + ..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.DataGrid.dll + True + + + ..\packages\Extended.Wpf.Toolkit.2.6\lib\net40\Xceed.Wpf.Toolkit.dll + True + + + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + + + + + + + + + + + + + + AudioVisualization.settings + True + True + + + + + + TypeWave.settings + True + True + + + + + CounterStrike.settings + True + True + + + + + RocketLeague.settings + True + True + + + + True + True + Witcher3.settings + + + + + + + VolumeDisplay.settings + True + True + + + + + + + + + + + True + True + General.settings + + + True + True + Offsets.settings + + + + + + + + + + + + + + + + + + + + + + + + + + + EffectsView.xaml + + + DebugEffectView.xaml + + + AudioVisualizerView.xaml + + + TypeHoleView.xaml + + + TypeWaveView.xaml + + + GamesView.xaml + + + CounterStrikeView.xaml + + + Dota2View.xaml + + + RocketLeagueView.xaml + + + Witcher3View.xaml + + + OverlaysView.xaml + + + VolumeDisplayView.xaml + + + SettingsView.xaml + + + ShellView.xaml + + + + + Code + + + True + True + Resources.resx + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + AudioVisualization.Designer.cs + + + SettingsSingleFileGenerator + TypeWave.Designer.cs + + + SettingsSingleFileGenerator + CounterStrike.Designer.cs + + + SettingsSingleFileGenerator + RocketLeague.Designer.cs + + + SettingsSingleFileGenerator + Witcher3.Designer.cs + + + SettingsSingleFileGenerator + VolumeDisplay.Designer.cs + + + + + + SettingsSingleFileGenerator + Offsets.Designer.cs + + + + SettingsSingleFileGenerator + General.Designer.cs + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + + PreserveNewest + + + PreserveNewest + + + + + + + + + False + Microsoft .NET Framework 4.5.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + --> \ No newline at end of file diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs index cd0c8b521..bf2aff810 100644 --- a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs +++ b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs @@ -2,7 +2,9 @@ using CUE.NET; using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Keyboard; - +using CUE.NET.Brushes; +using CUE.NET.Devices.Keyboard.Keys; + namespace Artemis.KeyboardProviders.Corsair { internal class K95 : KeyboardProvider @@ -16,25 +18,38 @@ namespace Artemis.KeyboardProviders.Corsair public override void Enable() { + try + { + CueSDK.Initialize(); + } + catch (CUE.NET.Exceptions.WrapperException){/*CUE is already initialized*/} _keyboard = CueSDK.KeyboardSDK; _keyboard.UpdateMode = UpdateMode.Manual; + _keyboard.Brush = new SolidColorBrush(Color.Black); + _keyboard.Update(); } public override void Disable() { } + /// + /// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap size. + /// + /// public override void DrawBitmap(Bitmap bitmap) - { - // TODO: Resize bitmap to keyboard's size - //if (bitmap.Width > width || bitmap.Height > height) - // bitmap = ResizeImage(bitmap, width, height); - - // One way of doing this, not sure at all if it's any good - for (var y = 0; y < bitmap.Height - 1; y++) - for (var x = 0; x < bitmap.Width - 1; x++) - _keyboard[new PointF(x, y)].Led.Color = bitmap.GetPixel(x, y); + { + RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height]; + RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height]; + for (var x = 0 ; x < bitmap.Width; x++) + { + for (var y = 0; y < bitmap.Height; y++) + { + ledRectangles[x, y] = new RectangleF(_keyboard.KeyboardRectangle.X * (x*(485F / bitmap.Width / _keyboard.KeyboardRectangle.X)), _keyboard.KeyboardRectangle.Y*(y*(133F / bitmap.Height / _keyboard.KeyboardRectangle.Y)), 485F / bitmap.Width, 133F / bitmap.Height); + ledGroups[x, y] = new RectangleKeyGroup(_keyboard, ledRectangles[x, y], 0.1f) { Brush = new SolidColorBrush(bitmap.GetPixel(x, y)) }; + } + } _keyboard.Update(true); } } diff --git a/Artemis/Artemis/Settings/General.Designer.cs b/Artemis/Artemis/Settings/General.Designer.cs index 26087df61..43f0a0fd5 100644 --- a/Artemis/Artemis/Settings/General.Designer.cs +++ b/Artemis/Artemis/Settings/General.Designer.cs @@ -1,62 +1,62 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Artemis.Settings { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class General : global::System.Configuration.ApplicationSettingsBase { - - private static General defaultInstance = ((General)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new General()))); - - public static General Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("TypeWave")] - public string LastEffect { - get { - return ((string)(this["LastEffect"])); - } - set { - this["LastEffect"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("Razer BlackWidow Chroma")] - public string LastKeyboard { - get { - return ((string)(this["LastKeyboard"])); - } - set { - this["LastKeyboard"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool EnablePointersUpdate { - get { - return ((bool)(this["EnablePointersUpdate"])); - } - set { - this["EnablePointersUpdate"] = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Artemis.Settings { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class General : global::System.Configuration.ApplicationSettingsBase { + + private static General defaultInstance = ((General)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new General()))); + + public static General Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("TypeWave")] + public string LastEffect { + get { + return ((string)(this["LastEffect"])); + } + set { + this["LastEffect"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Corsair Gaming K95 RGB")] + public string LastKeyboard { + get { + return ((string)(this["LastKeyboard"])); + } + set { + this["LastKeyboard"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool EnablePointersUpdate { + get { + return ((bool)(this["EnablePointersUpdate"])); + } + set { + this["EnablePointersUpdate"] = value; + } + } + } +} diff --git a/Artemis/Artemis/Settings/General.settings b/Artemis/Artemis/Settings/General.settings index c339986b0..9e3fd5005 100644 --- a/Artemis/Artemis/Settings/General.settings +++ b/Artemis/Artemis/Settings/General.settings @@ -1,17 +1,15 @@ - - - - - - - TypeWave - - - Razer BlackWidow Chroma - - - True - - + + + + + + TypeWave + + + Corsair Gaming K95 RGB + + + True + + \ No newline at end of file diff --git a/Artemis/Artemis/Views/SettingsView.xaml.cs b/Artemis/Artemis/Views/SettingsView.xaml.cs index 519bc52c0..c360a0fed 100644 --- a/Artemis/Artemis/Views/SettingsView.xaml.cs +++ b/Artemis/Artemis/Views/SettingsView.xaml.cs @@ -1,27 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; - -namespace Artemis.Views -{ - /// - /// Interaction logic for SettingsView.xaml - /// - public partial class SettingsView : Window - { - public SettingsView() - { - InitializeComponent(); - } - } -} +using MahApps.Metro.Controls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace Artemis.Views +{ + /// + /// Interaction logic for SettingsView.xaml + /// + public partial class SettingsView : MetroWindow + { + public SettingsView() + { + InitializeComponent(); + } + } +} diff --git a/Artemis/Artemis/packages.config b/Artemis/Artemis/packages.config index 7137d3ff6..ecdf3f7fd 100644 --- a/Artemis/Artemis/packages.config +++ b/Artemis/Artemis/packages.config @@ -1,16 +1,15 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file From 50a681d9e92343f7b250e3477e2f64555ecd748d Mon Sep 17 00:00:00 2001 From: Logan Saso Date: Thu, 21 Jan 2016 18:12:56 -0800 Subject: [PATCH 2/4] Made the keyboard darken option available in the code. --- Artemis/Artemis/KeyboardProviders/Corsair/K95.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs index bf2aff810..dbf204822 100644 --- a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs +++ b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs @@ -16,6 +16,9 @@ namespace Artemis.KeyboardProviders.Corsair Name = "Corsair Gaming K95 RGB"; } + /// + /// Enables the SDK and sets updatemode to manual as well as the color of the background to black. + /// public override void Enable() { try @@ -35,13 +38,14 @@ namespace Artemis.KeyboardProviders.Corsair /// /// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap size. + /// Does not reset the color each time. Uncomment line 48 for collor reset. /// /// public override void DrawBitmap(Bitmap bitmap) { RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height]; RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height]; - + //_keyboard.Brush = new SolidColorBrush(Color.Black); for (var x = 0 ; x < bitmap.Width; x++) { for (var y = 0; y < bitmap.Height; y++) From ec5c4d82e8c89a6e3a89464f1a89f23815c43a23 Mon Sep 17 00:00:00 2001 From: Logan Saso Date: Fri, 22 Jan 2016 06:56:13 -0800 Subject: [PATCH 3/4] Changed keyboard height and width to adjust dynamically --- Artemis/Artemis.sln | 44 +++++------ .../Artemis/KeyboardProviders/Corsair/K95.cs | 74 +++++++++---------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/Artemis/Artemis.sln b/Artemis/Artemis.sln index 9566a2c74..b2742026e 100644 --- a/Artemis/Artemis.sln +++ b/Artemis/Artemis.sln @@ -1,22 +1,22 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis", "Artemis\Artemis.csproj", "{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Artemis", "Artemis\Artemis.csproj", "{ED9997A2-E54C-4E9F-9350-62BE672C3ABE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED9997A2-E54C-4E9F-9350-62BE672C3ABE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs index dbf204822..e8af77206 100644 --- a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs +++ b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs @@ -1,60 +1,60 @@ -using System.Drawing; -using CUE.NET; -using CUE.NET.Devices.Generic.Enums; -using CUE.NET.Devices.Keyboard; +using System.Drawing; +using CUE.NET; +using CUE.NET.Devices.Generic.Enums; +using CUE.NET.Devices.Keyboard; using CUE.NET.Brushes; using CUE.NET.Devices.Keyboard.Keys; -namespace Artemis.KeyboardProviders.Corsair -{ - internal class K95 : KeyboardProvider - { - private CorsairKeyboard _keyboard; - - public K95() - { - Name = "Corsair Gaming K95 RGB"; - } - +namespace Artemis.KeyboardProviders.Corsair +{ + internal class K95 : KeyboardProvider + { + private CorsairKeyboard _keyboard; + + public K95() + { + Name = "Corsair Gaming K95 RGB"; + } + /// /// Enables the SDK and sets updatemode to manual as well as the color of the background to black. /// - public override void Enable() - { + public override void Enable() + { try { CueSDK.Initialize(); } catch (CUE.NET.Exceptions.WrapperException){/*CUE is already initialized*/} - _keyboard = CueSDK.KeyboardSDK; - _keyboard.UpdateMode = UpdateMode.Manual; - _keyboard.Brush = new SolidColorBrush(Color.Black); - _keyboard.Update(); - } - - public override void Disable() - { - } - + _keyboard = CueSDK.KeyboardSDK; + _keyboard.UpdateMode = UpdateMode.Manual; + _keyboard.Brush = new SolidColorBrush(Color.Black); + _keyboard.Update(); + } + + public override void Disable() + { + } + /// /// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap size. /// Does not reset the color each time. Uncomment line 48 for collor reset. /// /// - public override void DrawBitmap(Bitmap bitmap) - { - RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height]; - RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height]; - //_keyboard.Brush = new SolidColorBrush(Color.Black); + public override void DrawBitmap(Bitmap bitmap) + { + RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height]; + RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height]; + //_keyboard.Brush = new SolidColorBrush(Color.Black); for (var x = 0 ; x < bitmap.Width; x++) { for (var y = 0; y < bitmap.Height; y++) { - ledRectangles[x, y] = new RectangleF(_keyboard.KeyboardRectangle.X * (x*(485F / bitmap.Width / _keyboard.KeyboardRectangle.X)), _keyboard.KeyboardRectangle.Y*(y*(133F / bitmap.Height / _keyboard.KeyboardRectangle.Y)), 485F / bitmap.Width, 133F / bitmap.Height); + ledRectangles[x, y] = new RectangleF(_keyboard.KeyboardRectangle.X * (x*(_keyboard.KeyboardRectangle.Width / bitmap.Width / _keyboard.KeyboardRectangle.X)), _keyboard.KeyboardRectangle.Y*(y*(_keyboard.KeyboardRectangle.Height / bitmap.Height / _keyboard.KeyboardRectangle.Y)), _keyboard.KeyboardRectangle.Width / bitmap.Width, _keyboard.KeyboardRectangle.Height / bitmap.Height); ledGroups[x, y] = new RectangleKeyGroup(_keyboard, ledRectangles[x, y], 0.1f) { Brush = new SolidColorBrush(bitmap.GetPixel(x, y)) }; } - } - _keyboard.Update(true); - } - } + } + _keyboard.Update(true); + } + } } \ No newline at end of file From 84f5cbe73524a9c9df52daa2e0389d76fecaa3dd Mon Sep 17 00:00:00 2001 From: Logan Saso Date: Wed, 27 Jan 2016 12:35:38 -0800 Subject: [PATCH 4/4] Update README.md Corsair support for the K95 has been added. Must run a test on K70's K65's and Strafe's also. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13f2e1d38..7d82069da 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Support is planned for: * Dota 2 (Native Gamestate intergration) * Project CARS (Native memory sharing) -Currently the only supported keyboard is the Logitech G910 Orion Spark, but progress is being made to support Corsair and Razer as well. +Currently the only supported keyboards are the Logitech G910 Orion Spark and Corsair K95 RGB, but progress is being made to support Razer as well. For any keyboards/games/effects we'd love PRs!