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

Merge pull request #164 from DarthAffe/Net5

Net5
This commit is contained in:
DarthAffe 2020-12-25 19:32:41 +01:00 committed by GitHub
commit 412cbd8c98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 3 deletions

View File

@ -42,6 +42,9 @@ namespace RGB.NET.Devices.Razer
return ptr;
}
/// <inheritdoc />
protected override void CreateEffect(IntPtr effectParams, ref Guid effectId) => _RazerSDK.CreateKeyboardEffect(_Defines.KEYBOARD_EFFECT_ID, effectParams, ref effectId);
#endregion
}
}

View File

@ -42,6 +42,9 @@ namespace RGB.NET.Devices.Razer
return ptr;
}
/// <inheritdoc />
protected override void CreateEffect(IntPtr effectParams, ref Guid effectId) => _RazerSDK.CreateMousepadEffect(_Defines.MOUSEPAD_EFFECT_ID, effectParams, ref effectId);
#endregion
}
}

View File

@ -5,9 +5,11 @@
internal const int EFFECT_ID = 7;
internal const int HEADSET_EFFECT_ID = 4;
internal const int CHROMALINK_EFFECT_ID = 1;
internal const int KEYBOARD_EFFECT_ID = 9;
internal const int MOUSEPAD_EFFECT_ID = 6;
internal const int KEYBOARD_MAX_ROW = 6;
internal const int KEYBOARD_MAX_COLUMN = 22;
internal const int KEYBOARD_MAX_ROW = 8;
internal const int KEYBOARD_MAX_COLUMN = 24;
internal const int KEYBOARD_MAX_LEDS = KEYBOARD_MAX_ROW * KEYBOARD_MAX_COLUMN;
internal const int MOUSE_MAX_ROW = 9;
@ -16,7 +18,7 @@
internal const int HEADSET_MAX_LEDS = 5;
internal const int MOUSEPAD_MAX_LEDS = 15;
internal const int MOUSEPAD_MAX_LEDS = 20;
internal const int KEYPAD_MAX_ROW = 4;
internal const int KEYPAD_MAX_COLUMN = 5;

View File

@ -7,5 +7,10 @@ namespace RGB.NET.Devices.Razer.Native
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = _Defines.KEYBOARD_MAX_LEDS)]
public _Color[] Color;
//diogotr7: I don't know what these "keys" mean, they were introduced in the Keyboard::v2
//namespace. we need to put them here to give razer the struct size it expects
[MarshalAs(UnmanagedType.ByValArray, SizeConst = _Defines.KEYBOARD_MAX_LEDS)]
public uint[] Key;
}
}

View File

@ -48,6 +48,8 @@ namespace RGB.NET.Devices.Razer.Native
_createEffectPointer = (CreateEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateEffect"), typeof(CreateEffectPointer));
_createHeadsetEffectPointer = (CreateHeadsetEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateHeadsetEffect"), typeof(CreateHeadsetEffectPointer));
_createChromaLinkEffectPointer = (CreateChromaLinkEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateChromaLinkEffect"), typeof(CreateChromaLinkEffectPointer));
_createKeyboardEffectPointer = (CreateKeyboardEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateKeyboardEffect"), typeof(CreateKeyboardEffectPointer));
_createMousepadEffectPointer = (CreateMousepadEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateMousepadEffect"), typeof(CreateMousepadEffectPointer));
_setEffectPointer = (SetEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetEffect"), typeof(SetEffectPointer));
_deleteEffectPointer = (DeleteEffectPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "DeleteEffect"), typeof(DeleteEffectPointer));
}
@ -82,6 +84,8 @@ namespace RGB.NET.Devices.Razer.Native
private static CreateEffectPointer _createEffectPointer;
private static CreateHeadsetEffectPointer _createHeadsetEffectPointer;
private static CreateChromaLinkEffectPointer _createChromaLinkEffectPointer;
private static CreateKeyboardEffectPointer _createKeyboardEffectPointer;
private static CreateMousepadEffectPointer _createMousepadEffectPointer;
private static SetEffectPointer _setEffectPointer;
private static DeleteEffectPointer _deleteEffectPointer;
@ -107,6 +111,12 @@ namespace RGB.NET.Devices.Razer.Native
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate RazerError CreateChromaLinkEffectPointer(int effectType, IntPtr param, ref Guid effectId);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate RazerError CreateKeyboardEffectPointer(int effectType, IntPtr param, ref Guid effectId);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate RazerError CreateMousepadEffectPointer(int effectType, IntPtr param, ref Guid effectId);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate RazerError SetEffectPointer(Guid effectId);
@ -149,6 +159,10 @@ namespace RGB.NET.Devices.Razer.Native
internal static RazerError CreateChromaLinkEffect(int effectType, IntPtr param, ref Guid effectId) => _createChromaLinkEffectPointer(effectType, param, ref effectId);
internal static RazerError CreateKeyboardEffect(int effectType, IntPtr param, ref Guid effectId) => _createKeyboardEffectPointer(effectType, param, ref effectId);
internal static RazerError CreateMousepadEffect(int effectType, IntPtr param, ref Guid effectId) => _createMousepadEffectPointer(effectType, param, ref effectId);
internal static RazerError SetEffect(Guid effectId) => _setEffectPointer(effectId);
internal static RazerError DeleteEffect(Guid effectId) => _deleteEffectPointer(effectId);