mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 09:43:46 +00:00
parent
ec490155fd
commit
99762a5ce2
@ -329,6 +329,8 @@
|
|||||||
<Compile Include="DeviceProviders\Artemis\NoneKeyboard.cs" />
|
<Compile Include="DeviceProviders\Artemis\NoneKeyboard.cs" />
|
||||||
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProL.cs" />
|
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProL.cs" />
|
||||||
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProS.cs" />
|
<Compile Include="DeviceProviders\CoolerMaster\MasterkeysProS.cs" />
|
||||||
|
<Compile Include="DeviceProviders\CoolerMaster\MastermouseProL.cs" />
|
||||||
|
<Compile Include="DeviceProviders\CoolerMaster\MastermouseProS.cs" />
|
||||||
<Compile Include="DeviceProviders\CoolerMaster\Utilities\CmSdk.cs" />
|
<Compile Include="DeviceProviders\CoolerMaster\Utilities\CmSdk.cs" />
|
||||||
<Compile Include="DeviceProviders\Corsair\CorsairMouse.cs" />
|
<Compile Include="DeviceProviders\Corsair\CorsairMouse.cs" />
|
||||||
<Compile Include="DeviceProviders\Corsair\CorsairHeadset.cs" />
|
<Compile Include="DeviceProviders\Corsair\CorsairHeadset.cs" />
|
||||||
|
|||||||
@ -72,6 +72,7 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send the matrix to the keyboard
|
// Send the matrix to the keyboard
|
||||||
|
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_L);
|
||||||
CmSdk.SetAllLedColor(matrix);
|
CmSdk.SetAllLedColor(matrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,6 +72,7 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send the matrix to the keyboard
|
// Send the matrix to the keyboard
|
||||||
|
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MKeys_S);
|
||||||
CmSdk.SetAllLedColor(matrix);
|
CmSdk.SetAllLedColor(matrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using Artemis.DeviceProviders.CoolerMaster.Utilities;
|
||||||
|
using Ninject.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Artemis.DeviceProviders.CoolerMaster
|
||||||
|
{
|
||||||
|
public class MastermouseProL : DeviceProvider
|
||||||
|
{
|
||||||
|
public MastermouseProL(ILogger logger)
|
||||||
|
{
|
||||||
|
Logger = logger;
|
||||||
|
Type = DeviceType.Mouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ILogger Logger { get; }
|
||||||
|
|
||||||
|
public override void UpdateDevice(Bitmap bitmap)
|
||||||
|
{
|
||||||
|
// Create an empty matrix
|
||||||
|
var matrix = new COLOR_MATRIX { KeyColor = new KEY_COLOR[6, 22] };
|
||||||
|
|
||||||
|
// Get colors from the bitmap's center X and on 2/5th, 3/5th and 4/5th Y
|
||||||
|
var x = bitmap.Width / 2;
|
||||||
|
var y = bitmap.Width / 5;
|
||||||
|
var led1Color = bitmap.GetPixel(x, y);
|
||||||
|
var led2Color = bitmap.GetPixel(x, y * 2);
|
||||||
|
var led3Color = bitmap.GetPixel(x, y * 3);
|
||||||
|
var led4Color = bitmap.GetPixel(x, y * 4);
|
||||||
|
matrix.KeyColor[0, 0] = new KEY_COLOR(led1Color.R, led1Color.G, led1Color.B);
|
||||||
|
matrix.KeyColor[0, 1] = new KEY_COLOR(led2Color.R, led2Color.G, led2Color.B);
|
||||||
|
matrix.KeyColor[0, 2] = new KEY_COLOR(led3Color.R, led3Color.G, led3Color.B);
|
||||||
|
matrix.KeyColor[0, 3] = new KEY_COLOR(led4Color.R, led4Color.G, led4Color.B);
|
||||||
|
|
||||||
|
// Send the matrix to the mouse
|
||||||
|
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_L);
|
||||||
|
CmSdk.SetAllLedColor(matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool TryEnable()
|
||||||
|
{
|
||||||
|
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_L);
|
||||||
|
|
||||||
|
// Doesn't seem reliable but better than nothing I suppose
|
||||||
|
CanUse = CmSdk.IsDevicePlug();
|
||||||
|
if (CanUse)
|
||||||
|
CmSdk.EnableLedControl(true);
|
||||||
|
|
||||||
|
Logger.Debug("Attempted to enable Mastermouse Pro L. CanUse: {0}", CanUse);
|
||||||
|
return CanUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Disable()
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("Can only disable a keyboard");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using Artemis.DeviceProviders.CoolerMaster.Utilities;
|
||||||
|
using Ninject.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Artemis.DeviceProviders.CoolerMaster
|
||||||
|
{
|
||||||
|
public class MastermouseProS : DeviceProvider
|
||||||
|
{
|
||||||
|
public MastermouseProS(ILogger logger)
|
||||||
|
{
|
||||||
|
Logger = logger;
|
||||||
|
Type = DeviceType.Mouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ILogger Logger { get; }
|
||||||
|
|
||||||
|
public override void UpdateDevice(Bitmap bitmap)
|
||||||
|
{
|
||||||
|
// Create an empty matrix
|
||||||
|
var matrix = new COLOR_MATRIX {KeyColor = new KEY_COLOR[6, 22]};
|
||||||
|
|
||||||
|
// Get colors from the bitmap's center X and on 1/3rd and 2/3rd Y
|
||||||
|
var x = bitmap.Width / 2;
|
||||||
|
var y = bitmap.Width / 3;
|
||||||
|
var led1Color = bitmap.GetPixel(x, y);
|
||||||
|
var led2Color = bitmap.GetPixel(x, y * 2);
|
||||||
|
matrix.KeyColor[0, 0] = new KEY_COLOR(led1Color.R, led1Color.G, led1Color.B);
|
||||||
|
matrix.KeyColor[0, 1] = new KEY_COLOR(led2Color.R, led2Color.G, led2Color.B);
|
||||||
|
|
||||||
|
// Send the matrix to the mouse
|
||||||
|
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_S);
|
||||||
|
CmSdk.SetAllLedColor(matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool TryEnable()
|
||||||
|
{
|
||||||
|
CmSdk.SetControlDevice(DEVICE_INDEX.DEV_MMouse_S);
|
||||||
|
|
||||||
|
// Doesn't seem reliable but better than nothing I suppose
|
||||||
|
CanUse = CmSdk.IsDevicePlug();
|
||||||
|
if (CanUse)
|
||||||
|
CmSdk.EnableLedControl(true);
|
||||||
|
|
||||||
|
Logger.Debug("Attempted to enable Mastermouse Pro S. CanUse: {0}", CanUse);
|
||||||
|
return CanUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Disable()
|
||||||
|
{
|
||||||
|
throw new NotSupportedException("Can only disable a keyboard");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -28,7 +28,10 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
|||||||
DEV_MKeys_S = 1,
|
DEV_MKeys_S = 1,
|
||||||
DEV_MKeys_L_White = 2,
|
DEV_MKeys_L_White = 2,
|
||||||
DEV_MKeys_M_White = 3,
|
DEV_MKeys_M_White = 3,
|
||||||
DEV_MMouse_L = 4
|
DEV_MMouse_L = 4,
|
||||||
|
DEV_MMouse_S = 5,
|
||||||
|
DEV_MKeys_M = 6,
|
||||||
|
DEV_MKeys_S_White = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
//Enumeration of device layout
|
//Enumeration of device layout
|
||||||
@ -53,6 +56,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern LAYOUT_KEYBOARD GetDeviceLayout();
|
public static extern LAYOUT_KEYBOARD GetDeviceLayout();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -60,6 +64,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern bool IsDevicePlug();
|
public static extern bool IsDevicePlug();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -68,6 +73,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
|||||||
/// <param name="bEnable"></param>
|
/// <param name="bEnable"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern bool EnableLedControl(bool bEnable);
|
public static extern bool EnableLedControl(bool bEnable);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -80,6 +86,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
|||||||
/// <param name="b"></param>
|
/// <param name="b"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern bool SetLedColor(int iRow, int iColumn, byte r, byte g, byte b);
|
public static extern bool SetLedColor(int iRow, int iColumn, byte r, byte g, byte b);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -88,6 +95,7 @@ namespace Artemis.DeviceProviders.CoolerMaster.Utilities
|
|||||||
/// <param name="colorMatrix"></param>
|
/// <param name="colorMatrix"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("lib\\SDKDLL ", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern bool SetAllLedColor(COLOR_MATRIX colorMatrix);
|
public static extern bool SetAllLedColor(COLOR_MATRIX colorMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -62,9 +63,9 @@ namespace Artemis.Managers
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
if (Debugger.IsAttached)
|
||||||
throw e;
|
throw;
|
||||||
#endif
|
|
||||||
_logger.Warn(e, "Exception in render loop");
|
_logger.Warn(e, "Exception in render loop");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,11 +15,12 @@ namespace Artemis.Profiles.Layers.Animations
|
|||||||
|
|
||||||
public void Update(LayerModel layerModel, bool updateAnimations)
|
public void Update(LayerModel layerModel, bool updateAnimations)
|
||||||
{
|
{
|
||||||
|
var animationSpeed = 3.1 - layerModel.Properties.AnimationSpeed;
|
||||||
// TODO: Generic implementation
|
// TODO: Generic implementation
|
||||||
// Reset animation progress if layer wasn't drawn for 100ms
|
// Reset animation progress if layer wasn't drawn for 100ms
|
||||||
if (new TimeSpan(0, 0, 0, 0, 100) < DateTime.Now - layerModel.LastRender && updateAnimations || MustExpire(layerModel))
|
if (new TimeSpan(0, 0, 0, 0, 100) < DateTime.Now - layerModel.LastRender && updateAnimations || MustExpire(layerModel))
|
||||||
{
|
{
|
||||||
_opacityTweener = new Tweener<float>(0, 1000, 1000, Ease.Quad.InOut, LerpFuncFloat);
|
_opacityTweener = new Tweener<float>(0, 1000, animationSpeed * 1000, Ease.Quad.InOut, LerpFuncFloat);
|
||||||
_increase = true;
|
_increase = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +30,7 @@ namespace Artemis.Profiles.Layers.Animations
|
|||||||
|
|
||||||
if (!_opacityTweener.Running && _increase)
|
if (!_opacityTweener.Running && _increase)
|
||||||
{
|
{
|
||||||
_opacityTweener = new Tweener<float>(1000, 0, 1000, Ease.Quad.InOut, LerpFuncFloat);
|
_opacityTweener = new Tweener<float>(1000, 0, animationSpeed * 1000, Ease.Quad.InOut, LerpFuncFloat);
|
||||||
_increase = false;
|
_increase = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -88,6 +88,7 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
switch (ToggleType)
|
switch (ToggleType)
|
||||||
{
|
{
|
||||||
case ToggleType.EnableHeldDown:
|
case ToggleType.EnableHeldDown:
|
||||||
|
layerModel.RenderAllowed = false;
|
||||||
downAction = () => layerModel.RenderAllowed = true;
|
downAction = () => layerModel.RenderAllowed = true;
|
||||||
upAction = () => layerModel.RenderAllowed = false;
|
upAction = () => layerModel.RenderAllowed = false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -21,6 +21,7 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
{
|
{
|
||||||
Children = new ChildItemCollection<LayerModel, LayerModel>(this);
|
Children = new ChildItemCollection<LayerModel, LayerModel>(this);
|
||||||
TweenModel = new TweenModel(this);
|
TweenModel = new TweenModel(this);
|
||||||
|
RenderAllowed = true;
|
||||||
|
|
||||||
var model = Properties as KeyboardPropertiesModel;
|
var model = Properties as KeyboardPropertiesModel;
|
||||||
if (model != null)
|
if (model != null)
|
||||||
@ -284,6 +285,8 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
|
|
||||||
public void SetupKeybinds()
|
public void SetupKeybinds()
|
||||||
{
|
{
|
||||||
|
RenderAllowed = true;
|
||||||
|
|
||||||
// Clean up old keybinds
|
// Clean up old keybinds
|
||||||
RemoveKeybinds();
|
RemoveKeybinds();
|
||||||
|
|
||||||
@ -315,7 +318,7 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
public bool Enabled { get; set; }
|
public bool Enabled { get; set; }
|
||||||
public bool RenderAllowed { get; set; } = true;
|
public bool RenderAllowed { get; set; }
|
||||||
public bool Expanded { get; set; }
|
public bool Expanded { get; set; }
|
||||||
public bool IsEvent { get; set; }
|
public bool IsEvent { get; set; }
|
||||||
public LayerPropertiesModel Properties { get; set; }
|
public LayerPropertiesModel Properties { get; set; }
|
||||||
|
|||||||
@ -12,7 +12,7 @@ using System.Windows;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("SpoinkyNL")]
|
[assembly: AssemblyCompany("SpoinkyNL")]
|
||||||
[assembly: AssemblyProduct("Artemis")]
|
[assembly: AssemblyProduct("Artemis")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ using System.Windows;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.8.2.0")]
|
[assembly: AssemblyVersion("1.9.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.8.2.0")]
|
[assembly: AssemblyFileVersion("1.9.0.0")]
|
||||||
[assembly: InternalsVisibleTo("Artemis.Explorables")]
|
[assembly: InternalsVisibleTo("Artemis.Explorables")]
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,8 @@ namespace Artemis.ViewModels
|
|||||||
{
|
{
|
||||||
DisplayName = "General";
|
DisplayName = "General";
|
||||||
_vms = moduleViewModels.Where(m => !m.ModuleModel.IsOverlay && !m.ModuleModel.IsBoundToProcess)
|
_vms = moduleViewModels.Where(m => !m.ModuleModel.IsOverlay && !m.ModuleModel.IsBoundToProcess)
|
||||||
.OrderBy(m => m.DisplayName).ToList();
|
.OrderByDescending(m => m.DisplayName == "General profile")
|
||||||
|
.ThenBy(m => m.DisplayName).ToList();
|
||||||
|
|
||||||
previewManager.PreviewViewModules.Clear();
|
previewManager.PreviewViewModules.Clear();
|
||||||
previewManager.PreviewViewModules.AddRange(moduleViewModels.Where(m => m.UsesProfileEditor));
|
previewManager.PreviewViewModules.AddRange(moduleViewModels.Where(m => m.UsesProfileEditor));
|
||||||
|
|||||||
@ -19,6 +19,7 @@ namespace Artemis.ViewModels.Profiles
|
|||||||
{
|
{
|
||||||
_editorViewModel = editorViewModel;
|
_editorViewModel = editorViewModel;
|
||||||
LayerKeybindModel = layerKeybindModel;
|
LayerKeybindModel = layerKeybindModel;
|
||||||
|
CanToggleType = !editorViewModel.ProposedLayer.IsEvent;
|
||||||
|
|
||||||
PropertyChanged += MapViewToModel;
|
PropertyChanged += MapViewToModel;
|
||||||
editorViewModel.PropertyChanged += EditorViewModelOnPropertyChanged;
|
editorViewModel.PropertyChanged += EditorViewModelOnPropertyChanged;
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user