mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-12 08:48:30 +00:00
Updated CUE SDK to 2.4.67
Implemented SDK change: ledsCount added to DeviceInfo Implemented SDK change: CorsairGetLedPositionsByDeviceIndex method added Added mousemat support
This commit is contained in:
parent
5a296dd048
commit
6c1a3d6744
@ -58,6 +58,9 @@
|
||||
<Compile Include="Devices\Generic\EventArgs\UpdatingEventArgs.cs" />
|
||||
<Compile Include="Devices\Generic\LedUpateRequest.cs" />
|
||||
<Compile Include="Devices\Keyboard\Enums\BrushCalculationMode.cs" />
|
||||
<Compile Include="Devices\Mousemat\CorsairMousemat.cs" />
|
||||
<Compile Include="Devices\Mousemat\CorsairMousematDeviceInfo.cs" />
|
||||
<Compile Include="Devices\Mousemat\Enums\CorsairMousematLedId.cs" />
|
||||
<Compile Include="Gradients\AbstractGradient.cs" />
|
||||
<Compile Include="Gradients\GradientStop.cs" />
|
||||
<Compile Include="Gradients\IGradient.cs" />
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CUE.NET", "CUE.NET.csproj", "{70A266B5-E9D4-4EAA-A91A-947C0039FFB6}"
|
||||
EndProject
|
||||
@ -20,12 +20,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{D69EF6D8-6
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x86", "x86", "{0525D895-E706-4920-8733-DABD9194BFB1}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
libs\x86\CUESDK_2013.dll = libs\x86\CUESDK_2013.dll
|
||||
bin\x86\CUESDK_2015.dll = bin\x86\CUESDK_2015.dll
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x64", "x64", "{2F99124B-FAED-432D-B797-45566D373411}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
libs\x64\CUESDK_2013.dll = libs\x64\CUESDK_2013.dll
|
||||
bin\x64\CUESDK_2015.dll = bin\x64\CUESDK_2015.dll
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AudioAnalyzer", "AudioAnalyzer", "{BE16A0BF-6794-4718-AF27-F2A50078D880}"
|
||||
|
||||
19
CueSDK.cs
19
CueSDK.cs
@ -7,6 +7,7 @@ using CUE.NET.Devices.Generic.Enums;
|
||||
using CUE.NET.Devices.Headset;
|
||||
using CUE.NET.Devices.Keyboard;
|
||||
using CUE.NET.Devices.Mouse;
|
||||
using CUE.NET.Devices.Mousemat;
|
||||
using CUE.NET.Exceptions;
|
||||
using CUE.NET.Native;
|
||||
|
||||
@ -61,6 +62,12 @@ namespace CUE.NET
|
||||
/// </summary>
|
||||
public static CorsairHeadset HeadsetSDK { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the managed representation of a moustmat managed by the CUE-SDK.
|
||||
/// Note that currently only one connected mousemat is supported.
|
||||
/// </summary>
|
||||
public static CorsairMousemat MousematSDK { get; private set; }
|
||||
|
||||
// ReSharper restore UnusedAutoPropertyAccessor.Global
|
||||
|
||||
#endregion
|
||||
@ -86,6 +93,8 @@ namespace CUE.NET
|
||||
return MouseSDK != null;
|
||||
case CorsairDeviceType.Headset:
|
||||
return HeadsetSDK != null;
|
||||
case CorsairDeviceType.Mousemat:
|
||||
return MousematSDK != null;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
@ -163,7 +172,9 @@ namespace CUE.NET
|
||||
case CorsairDeviceType.Headset:
|
||||
HeadsetSDK = new CorsairHeadset(new CorsairHeadsetDeviceInfo(nativeDeviceInfo));
|
||||
break;
|
||||
|
||||
case CorsairDeviceType.Mousemat:
|
||||
MousematSDK = new CorsairMousemat(new CorsairMousematDeviceInfo(nativeDeviceInfo));
|
||||
break;
|
||||
// ReSharper disable once RedundantCaseLabel
|
||||
case CorsairDeviceType.Unknown:
|
||||
default:
|
||||
@ -198,6 +209,7 @@ namespace CUE.NET
|
||||
KeyboardSDK?.ResetLeds();
|
||||
MouseSDK?.ResetLeds();
|
||||
HeadsetSDK?.ResetLeds();
|
||||
MousematSDK?.ResetLeds();
|
||||
|
||||
_CUESDK.Reload();
|
||||
|
||||
@ -244,6 +256,10 @@ namespace CUE.NET
|
||||
if (!reloadedDevices.ContainsKey(CorsairDeviceType.Headset)
|
||||
|| HeadsetSDK.HeadsetDeviceInfo.Model != reloadedDevices[CorsairDeviceType.Headset].Model)
|
||||
throw new WrapperException("The previously loaded Headset got disconnected.");
|
||||
if (MousematSDK != null)
|
||||
if (!reloadedDevices.ContainsKey(CorsairDeviceType.Mousemat)
|
||||
|| MousematSDK.MousematDeviceInfo.Model != reloadedDevices[CorsairDeviceType.Mousemat].Model)
|
||||
throw new WrapperException("The previously loaded Mousemat got disconnected.");
|
||||
|
||||
IsInitialized = true;
|
||||
}
|
||||
@ -255,6 +271,7 @@ namespace CUE.NET
|
||||
KeyboardSDK = null;
|
||||
MouseSDK = null;
|
||||
HeadsetSDK = null;
|
||||
MousematSDK = null;
|
||||
IsInitialized = false;
|
||||
|
||||
throw new CUEException(error);
|
||||
|
||||
@ -11,6 +11,7 @@ namespace CUE.NET.Devices.Generic.Enums
|
||||
Unknown = 0,
|
||||
Mouse = 1,
|
||||
Keyboard = 2,
|
||||
Headset = 3
|
||||
Headset = 3,
|
||||
Mousemat = 4
|
||||
};
|
||||
}
|
||||
|
||||
149
Devices/Mousemat/CorsairMousemat.cs
Normal file
149
Devices/Mousemat/CorsairMousemat.cs
Normal file
@ -0,0 +1,149 @@
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using CUE.NET.Devices.Generic;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using CUE.NET.Devices.Mousemat.Enums;
|
||||
using CUE.NET.Effects;
|
||||
using CUE.NET.Exceptions;
|
||||
using CUE.NET.Native;
|
||||
|
||||
namespace CUE.NET.Devices.Mousemat
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the SDK for a corsair mousemat.
|
||||
/// </summary>
|
||||
public class CorsairMousemat : AbstractCueDevice, IEnumerable<CorsairLed>
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
#region Indexer
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="CorsairLed" /> with the specified ID.
|
||||
/// </summary>
|
||||
/// <param name="ledId">The ID of the LED to get.</param>
|
||||
/// <returns>The LED with the specified ID.</returns>
|
||||
public CorsairLed this[CorsairMousematLedId ledId]
|
||||
{
|
||||
get
|
||||
{
|
||||
CorsairLed led;
|
||||
return base.Leds.TryGetValue((int)ledId, out led) ? led : null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gets specific information provided by CUE for the mousemat.
|
||||
/// </summary>
|
||||
public CorsairMousematDeviceInfo MousematDeviceInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating if the mousemat has an active effect to deal with or not.
|
||||
/// </summary>
|
||||
protected override bool HasEffect => false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a read-only collection containing all LEDs of the mousemat.
|
||||
/// </summary>
|
||||
public new IEnumerable<CorsairLed> Leds => new ReadOnlyCollection<CorsairLed>(base.Leds.Values.ToList());
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CorsairMousemat"/> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by CUE for the mousemat</param>
|
||||
internal CorsairMousemat(CorsairMousematDeviceInfo info)
|
||||
: base(info)
|
||||
{
|
||||
this.MousematDeviceInfo = info;
|
||||
InitializeLeds();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void InitializeLeds()
|
||||
{
|
||||
int deviceCount = _CUESDK.CorsairGetDeviceCount();
|
||||
|
||||
// Get mousemat device index
|
||||
int mousematIndex = -1;
|
||||
for (int i = 0; i < deviceCount; i++)
|
||||
{
|
||||
_CorsairDeviceInfo nativeDeviceInfo = (_CorsairDeviceInfo)Marshal.PtrToStructure(_CUESDK.CorsairGetDeviceInfo(i), typeof(_CorsairDeviceInfo));
|
||||
GenericDeviceInfo info = new GenericDeviceInfo(nativeDeviceInfo);
|
||||
if (info.Type != CorsairDeviceType.Mousemat)
|
||||
continue;
|
||||
|
||||
mousematIndex = i;
|
||||
break;
|
||||
}
|
||||
if (mousematIndex < 0)
|
||||
throw new WrapperException("Can't determine mousemat device index");
|
||||
|
||||
_CorsairLedPositions nativeLedPositions = (_CorsairLedPositions)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(mousematIndex), typeof(_CorsairLedPositions));
|
||||
int structSize = Marshal.SizeOf(typeof(_CorsairLedPosition));
|
||||
IntPtr ptr = nativeLedPositions.pLedPosition;
|
||||
|
||||
// Put the positions in an array for sorting later on
|
||||
List<_CorsairLedPosition> positions = new List<_CorsairLedPosition>();
|
||||
for (int i = 0; i < nativeLedPositions.numberOfLed; i++)
|
||||
{
|
||||
_CorsairLedPosition ledPosition = (_CorsairLedPosition)Marshal.PtrToStructure(ptr, typeof(_CorsairLedPosition));
|
||||
ptr = new IntPtr(ptr.ToInt64() + structSize);
|
||||
positions.Add(ledPosition);
|
||||
}
|
||||
|
||||
// Sort for easy iteration by clients
|
||||
foreach (_CorsairLedPosition position in positions.OrderBy(p => p.ledId))
|
||||
GetLed((int)position.ledId);
|
||||
}
|
||||
|
||||
protected override void DeviceUpdate()
|
||||
{
|
||||
//TODO SpoinkyNL 01.09.2016: I'm not sure what DarthAffe is planning with this, will note in PR
|
||||
}
|
||||
|
||||
protected override void ApplyEffect(IEffect effect)
|
||||
{
|
||||
//TODO SpoinkyNL 09.09.2016: How should brushes be applied to mousemats? This seems to be gone in the dev branch
|
||||
foreach (CorsairLed led in effect.LedList)
|
||||
led.Color = effect.EffectBrush.GetColorAtPoint(new RectangleF(0, 0, 2, 2), new PointF(1, 1));
|
||||
}
|
||||
|
||||
#region IEnumerable
|
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that iterates over all LEDs of the mousemat.
|
||||
/// </summary>
|
||||
/// <returns>An enumerator for all LDS of the mousemat.</returns>
|
||||
public IEnumerator<CorsairLed> GetEnumerator()
|
||||
{
|
||||
return Leds.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
27
Devices/Mousemat/CorsairMousematDeviceInfo.cs
Normal file
27
Devices/Mousemat/CorsairMousematDeviceInfo.cs
Normal file
@ -0,0 +1,27 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
|
||||
using CUE.NET.Devices.Generic;
|
||||
using CUE.NET.Native;
|
||||
|
||||
namespace CUE.NET.Devices.Mousemat
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents specific information for a CUE Mousemat.
|
||||
/// </summary>
|
||||
public class CorsairMousematDeviceInfo : GenericDeviceInfo
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Internal constructor of managed <see cref="CorsairMousematDeviceInfo" />.
|
||||
/// </summary>
|
||||
/// <param name="nativeInfo">The native <see cref="_CorsairDeviceInfo" />-struct</param>
|
||||
internal CorsairMousematDeviceInfo(_CorsairDeviceInfo nativeInfo)
|
||||
: base(nativeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
25
Devices/Mousemat/Enums/CorsairMousematLedId.cs
Normal file
25
Devices/Mousemat/Enums/CorsairMousematLedId.cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace CUE.NET.Devices.Mousemat.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains list of all LEDs available for corsair mousemats.
|
||||
/// </summary>
|
||||
public enum CorsairMousematLedId
|
||||
{
|
||||
Invalid = 0,
|
||||
Zone1 = 155,
|
||||
Zone2 = 156,
|
||||
Zone3 = 157,
|
||||
Zone4 = 158,
|
||||
Zone5 = 159,
|
||||
Zone6 = 160,
|
||||
Zone7 = 161,
|
||||
Zone8 = 162,
|
||||
Zone9 = 163,
|
||||
Zone10 = 164,
|
||||
Zone11 = 165,
|
||||
Zone12 = 166,
|
||||
Zone13 = 167,
|
||||
Zone14 = 168,
|
||||
Zone15 = 169
|
||||
}
|
||||
}
|
||||
@ -96,7 +96,7 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy "$(SolutionDir)libs\x86\CUESDK_2013.dll" "$(TargetDir)x86\" /y</PostBuildEvent>
|
||||
<PostBuildEvent>xcopy "$(SolutionDir)libs\x86\CUESDK_2015.dll" "$(TargetDir)x86\" /y</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CUE.NET;
|
||||
@ -10,6 +12,8 @@ using CUE.NET.Devices.Keyboard;
|
||||
using CUE.NET.Devices.Keyboard.Enums;
|
||||
using CUE.NET.Devices.Keyboard.Extensions;
|
||||
using CUE.NET.Devices.Keyboard.Keys;
|
||||
using CUE.NET.Devices.Mousemat;
|
||||
using CUE.NET.Devices.Mousemat.Enums;
|
||||
using CUE.NET.Exceptions;
|
||||
using CUE.NET.Gradients;
|
||||
using CUE.NET.Profiles;
|
||||
@ -18,6 +22,8 @@ namespace SimpleDevTest
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
private static readonly Random Rand = new Random();
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Press any key to exit ...");
|
||||
@ -70,6 +76,40 @@ namespace SimpleDevTest
|
||||
spotGroup.Rectangle = spot;
|
||||
};
|
||||
|
||||
CorsairMousemat mousemat = CueSDK.MousematSDK;
|
||||
mousemat.UpdateMode = UpdateMode.Continuous;
|
||||
|
||||
// Left
|
||||
mousemat[CorsairMousematLedId.Zone1].Color = Color.Red;
|
||||
mousemat[CorsairMousematLedId.Zone2].Color = Color.Red;
|
||||
mousemat[CorsairMousematLedId.Zone3].Color = Color.Red;
|
||||
mousemat[CorsairMousematLedId.Zone4].Color = Color.Red;
|
||||
mousemat[CorsairMousematLedId.Zone5].Color = Color.Red;
|
||||
// Bottom
|
||||
mousemat[CorsairMousematLedId.Zone6].Color = Color.LawnGreen;
|
||||
mousemat[CorsairMousematLedId.Zone7].Color = Color.LawnGreen;
|
||||
mousemat[CorsairMousematLedId.Zone8].Color = Color.LawnGreen;
|
||||
mousemat[CorsairMousematLedId.Zone9].Color = Color.LawnGreen;
|
||||
mousemat[CorsairMousematLedId.Zone10].Color = Color.LawnGreen;
|
||||
// Right
|
||||
mousemat[CorsairMousematLedId.Zone11].Color = Color.Blue;
|
||||
mousemat[CorsairMousematLedId.Zone12].Color = Color.Blue;
|
||||
mousemat[CorsairMousematLedId.Zone13].Color = Color.Blue;
|
||||
mousemat[CorsairMousematLedId.Zone14].Color = Color.Blue;
|
||||
mousemat[CorsairMousematLedId.Zone15].Color = Color.Blue;
|
||||
|
||||
// Random colors to show update rate
|
||||
//foreach (var mousematLed in mousemat.Leds)
|
||||
// mousematLed.Color = GetRandomRainbowColor();
|
||||
|
||||
//mousemat.Updating += (sender, eventArgs) =>
|
||||
//{
|
||||
// foreach (var mousematLed in mousemat.Leds)
|
||||
// {
|
||||
// mousematLed.Color = ShiftColor(mousematLed.Color, 20);
|
||||
// }
|
||||
//};
|
||||
|
||||
//keyboard.Brush = new SolidColorBrush(Color.Black);
|
||||
//IKeyGroup group = new RectangleKeyGroup(keyboard, CorsairKeyboardKeyId.F1, CorsairKeyboardKeyId.RightShift);
|
||||
//group.Brush = new LinearGradientBrush(new RainbowGradient());
|
||||
@ -350,5 +390,66 @@ namespace SimpleDevTest
|
||||
}
|
||||
return p2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Comes up with a 'pure' psuedo-random color
|
||||
/// </summary>
|
||||
/// <returns>The color</returns>
|
||||
public static Color GetRandomRainbowColor()
|
||||
{
|
||||
var colors = new List<int>();
|
||||
for (var i = 0; i < 3; i++)
|
||||
colors.Add(Rand.Next(0, 256));
|
||||
|
||||
var highest = colors.Max();
|
||||
var lowest = colors.Min();
|
||||
colors[colors.FindIndex(c => c == highest)] = 255;
|
||||
colors[colors.FindIndex(c => c == lowest)] = 0;
|
||||
|
||||
var returnColor = Color.FromArgb(255, colors[0], colors[1], colors[2]);
|
||||
|
||||
return returnColor;
|
||||
}
|
||||
public static Color ShiftColor(Color c, int shiftAmount)
|
||||
{
|
||||
int newRed = c.R;
|
||||
int newGreen = c.G;
|
||||
int newBlue = c.B;
|
||||
|
||||
// Red to purple
|
||||
if (c.R == 255 && c.B < 255 && c.G == 0)
|
||||
newBlue = newBlue + shiftAmount;
|
||||
// Purple to blue
|
||||
else if (c.B == 255 && c.R > 0)
|
||||
newRed = newRed - shiftAmount;
|
||||
// Blue to light-blue
|
||||
else if (c.B == 255 && c.G < 255)
|
||||
newGreen = newGreen + shiftAmount;
|
||||
// Light-blue to green
|
||||
else if (c.G == 255 && c.B > 0)
|
||||
newBlue = newBlue - shiftAmount;
|
||||
// Green to yellow
|
||||
else if (c.G == 255 && c.R < 255)
|
||||
newRed = newRed + shiftAmount;
|
||||
// Yellow to red
|
||||
else if (c.R == 255 && c.G > 0)
|
||||
newGreen = newGreen - shiftAmount;
|
||||
|
||||
newRed = BringIntInColorRange(newRed);
|
||||
newGreen = BringIntInColorRange(newGreen);
|
||||
newBlue = BringIntInColorRange(newBlue);
|
||||
|
||||
return Color.FromArgb(c.A, newRed, newGreen, newBlue);
|
||||
}
|
||||
|
||||
private static int BringIntInColorRange(int i)
|
||||
{
|
||||
if (i < 0)
|
||||
return 0;
|
||||
if (i > 255)
|
||||
return 255;
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,8 +63,8 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy "$(SolutionDir)libs\x64\CUESDK_2013.dll" "$(TargetDir)x64\" /y
|
||||
xcopy "$(SolutionDir)libs\x86\CUESDK_2013.dll" "$(TargetDir)x86\" /y</PostBuildEvent>
|
||||
<PostBuildEvent>xcopy "$(SolutionDir)libs\x64\CUESDK_2015.dll" "$(TargetDir)x64\" /y
|
||||
xcopy "$(SolutionDir)libs\x86\CUESDK_2015.dll" "$(TargetDir)x86\" /y</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@ -36,12 +36,13 @@ namespace CUE.NET.Native
|
||||
if (_dllHandle != IntPtr.Zero) return;
|
||||
|
||||
// HACK: Load library at runtime to support both, x86 and x64 with one managed dll
|
||||
_dllHandle = LoadLibrary((LoadedArchitecture = Environment.Is64BitProcess ? "x64" : "x86") + "/CUESDK_2013.dll");
|
||||
_dllHandle = LoadLibrary((LoadedArchitecture = Environment.Is64BitProcess ? "x64" : "x86") + "/CUESDK_2015.dll");
|
||||
|
||||
_corsairSetLedsColorsPointer = (CorsairSetLedsColorsPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairSetLedsColors"), typeof(CorsairSetLedsColorsPointer));
|
||||
_corsairGetDeviceCountPointer = (CorsairGetDeviceCountPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairGetDeviceCount"), typeof(CorsairGetDeviceCountPointer));
|
||||
_corsairGetDeviceInfoPointer = (CorsairGetDeviceInfoPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairGetDeviceInfo"), typeof(CorsairGetDeviceInfoPointer));
|
||||
_corsairGetLedPositionsPointer = (CorsairGetLedPositionsPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairGetLedPositions"), typeof(CorsairGetLedPositionsPointer));
|
||||
_corsairGetLedPositionsByDeviceIndexPointer = (CorsairGetLedPositionsByDeviceIndexPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairGetLedPositionsByDeviceIndex"), typeof(CorsairGetLedPositionsByDeviceIndexPointer));
|
||||
_corsairGetLedIdForKeyNamePointer = (CorsairGetLedIdForKeyNamePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairGetLedIdForKeyName"), typeof(CorsairGetLedIdForKeyNamePointer));
|
||||
_corsairRequestControlPointer = (CorsairRequestControlPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairRequestControl"), typeof(CorsairRequestControlPointer));
|
||||
_corsairReleaseControlPointer = (CorsairReleaseControlPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CorsairReleaseControl"), typeof(CorsairReleaseControlPointer));
|
||||
@ -78,6 +79,7 @@ namespace CUE.NET.Native
|
||||
private static CorsairGetDeviceInfoPointer _corsairGetDeviceInfoPointer;
|
||||
private static CorsairGetLedPositionsPointer _corsairGetLedPositionsPointer;
|
||||
private static CorsairGetLedIdForKeyNamePointer _corsairGetLedIdForKeyNamePointer;
|
||||
private static CorsairGetLedPositionsByDeviceIndexPointer _corsairGetLedPositionsByDeviceIndexPointer;
|
||||
private static CorsairRequestControlPointer _corsairRequestControlPointer;
|
||||
private static CorsairReleaseControlPointer _corsairReleaseControlPointer;
|
||||
private static CorsairPerformProtocolHandshakePointer _corsairPerformProtocolHandshakePointer;
|
||||
@ -99,6 +101,9 @@ namespace CUE.NET.Native
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate IntPtr CorsairGetLedPositionsPointer();
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate IntPtr CorsairGetLedPositionsByDeviceIndexPointer(int deviceIndex);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private delegate CorsairKeyboardKeyId CorsairGetLedIdForKeyNamePointer(char keyName);
|
||||
|
||||
@ -150,6 +155,14 @@ namespace CUE.NET.Native
|
||||
return _corsairGetLedPositionsPointer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CUE-SDK: provides list of keyboard or mousemat LEDs with their physical positions.
|
||||
/// </summary>
|
||||
internal static IntPtr CorsairGetLedPositionsByDeviceIndex(int deviceIndex)
|
||||
{
|
||||
return _corsairGetLedPositionsByDeviceIndexPointer(deviceIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CUE-SDK: retrieves led id for key name taking logical layout into account.
|
||||
/// </summary>
|
||||
|
||||
@ -39,5 +39,10 @@ namespace CUE.NET.Native
|
||||
/// CUE-SDK: mask that describes device capabilities, formed as logical “or” of CorsairDeviceCaps enum values
|
||||
/// </summary>
|
||||
internal int capsMask;
|
||||
|
||||
/// <summary>
|
||||
/// CUE-SDK: number of controllable LEDs on the device
|
||||
/// </summary>
|
||||
internal int ledsCount;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
libs/x64/CUESDK_2015.dll
Normal file
BIN
libs/x64/CUESDK_2015.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
libs/x86/CUESDK_2015.dll
Normal file
BIN
libs/x86/CUESDK_2015.dll
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user