Merge pull request #185 from DarthAffe/SDK/CoolerMaster

CoolerMaster - Update SDK & added missing devices
This commit is contained in:
Robert Beekman authored and GitHub committed 2021-03-11 21:54:58 +01:00
commit ebc62f5e5c
6 files changed
+2261 -16

No files matched your search

+1
View File
@@ -95,6 +95,7 @@ namespace RGB.NET.Core
Keyboard_International3 = 0x00000052,
Keyboard_International5 = 0x00000053,
Keyboard_International4 = 0x00000054,
Keyboard_Function = 0x00000055,
Keyboard_PrintScreen = 0x00001001,
Keyboard_ScrollLock = 0x000001002,
@@ -91,6 +91,15 @@ namespace RGB.NET.Devices.CoolerMaster
}
}
/// <inheritdoc />
public override void Dispose()
{
base.Dispose();
try { _CoolerMasterSDK.Reload(); }
catch { /* Unlucky.. */ }
}
#endregion
}
}
@@ -81,6 +81,22 @@ namespace RGB.NET.Devices.CoolerMaster
[DeviceType(RGBDeviceType.Keyboard)]
MK850 = 16,
[Description("SK630")]
[DeviceType(RGBDeviceType.Keyboard)]
SK630 = 17,
[Description("SK650")]
[DeviceType(RGBDeviceType.Keyboard)]
SK650 = 18,
[Description("SK621")]
[DeviceType(RGBDeviceType.Keyboard)]
SK621 = 19,
[Description("MK730")]
[DeviceType(RGBDeviceType.Keyboard)]
MK730 = 20,
[DeviceType(RGBDeviceType.None)]
Default = 0xFFFF
}
File diff suppressed because it is too large. Load diff
@@ -9,7 +9,7 @@ namespace RGB.NET.Devices.CoolerMaster.Native
// ReSharper disable MemberCanBePrivate.Global
internal const int ROWS = 7;
internal const int ROWS = 8;
internal const int COLUMNS = 24;
// ReSharper restore MemberCanBePrivate.Global
@@ -22,8 +22,13 @@ namespace RGB.NET.Devices.CoolerMaster.Native
/// </summary>
internal static void Reload()
{
UnloadCMSDK();
LoadCMSDK();
if (_dllHandle != IntPtr.Zero)
{
foreach (CoolerMasterDevicesIndexes index in Enum.GetValues(typeof(CoolerMasterDevicesIndexes)))
EnableLedControl(false, index);
}
else
LoadCMSDK();
}
private static void LoadCMSDK()
@@ -47,15 +52,6 @@ namespace RGB.NET.Devices.CoolerMaster.Native
_setAllLedColorPointer = (SetAllLedColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetAllLedColor"), typeof(SetAllLedColorPointer));
}
internal static void UnloadCMSDK()
{
if (_dllHandle == IntPtr.Zero) return;
// ReSharper disable once EmptyEmbeddedStatement - DarthAffe 20.02.2016: We might need to reduce the internal reference counter more than once to set the library free
while (FreeLibrary(_dllHandle)) ;
_dllHandle = IntPtr.Zero;
}
[DllImport("kernel32.dll")]
private static extern IntPtr LoadLibrary(string dllToLoad);