1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

CoolerMaster - Added missing SDK-supported keyboards

CoolerMaster - Added mappings for every SDK-supported keyboard
CoolerMaster - Fixed enabling/disabling the provider at runtime
Core - Added Keyboard.Function LED ID
This commit is contained in:
Robert 2021-03-06 22:55:10 +01:00
parent d14f272ba9
commit 8ff4c0b243
5 changed files with 2260 additions and 15 deletions

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,

View File

@ -91,6 +91,15 @@ namespace RGB.NET.Devices.CoolerMaster
}
}
/// <inheritdoc />
public override void Dispose()
{
base.Dispose();
try { _CoolerMasterSDK.Reload(); }
catch { /* Unlucky.. */ }
}
#endregion
}
}

View File

@ -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
}

View File

@ -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);