diff --git a/RGB.NET.Core/Devices/RGBDeviceType.cs b/RGB.NET.Core/Devices/RGBDeviceType.cs
index 01c8a8c..e8e96c0 100644
--- a/RGB.NET.Core/Devices/RGBDeviceType.cs
+++ b/RGB.NET.Core/Devices/RGBDeviceType.cs
@@ -51,6 +51,11 @@ namespace RGB.NET.Core
///
/// Represents a Graphics card
///
- GraphicsCard = 1 << 7
+ GraphicsCard = 1 << 7,
+
+ ///
+ /// Represents a DRAM-bank
+ ///
+ DRAM = 1 << 8,
}
}
diff --git a/RGB.NET.Core/RGBSurfaceDeviceLoader.cs b/RGB.NET.Core/RGBSurfaceDeviceLoader.cs
index afe9bba..aa0ec63 100644
--- a/RGB.NET.Core/RGBSurfaceDeviceLoader.cs
+++ b/RGB.NET.Core/RGBSurfaceDeviceLoader.cs
@@ -12,13 +12,14 @@ namespace RGB.NET.Core
///
/// Loads all devices the given is able to provide.
///
- ///
- public void LoadDevices(IRGBDeviceProvider deviceProvider)
+ /// The to load the devices from.
+ /// Specifies whether exception during the initialization sequence should be thrown or not.
+ public void LoadDevices(IRGBDeviceProvider deviceProvider, bool throwExceptions = false)
{
if (_deviceProvider.Contains(deviceProvider) || _deviceProvider.Any(x => x.GetType() == deviceProvider.GetType())) return;
List addedDevices = new List();
- if (deviceProvider.IsInitialized || deviceProvider.Initialize())
+ if (deviceProvider.IsInitialized || deviceProvider.Initialize(throwExceptions))
{
_deviceProvider.Add(deviceProvider);
diff --git a/RGB.NET.Devices.Aura/AuraDeviceProvider.cs b/RGB.NET.Devices.Aura/AuraDeviceProvider.cs
index ff1a8c8..666e0a4 100644
--- a/RGB.NET.Devices.Aura/AuraDeviceProvider.cs
+++ b/RGB.NET.Devices.Aura/AuraDeviceProvider.cs
@@ -93,6 +93,7 @@ namespace RGB.NET.Devices.Aura
#region Mainboard
+ //TODO DarthAffe 21.10.2017: Requesting mainboards seems to fail if only a non mb-device (tested with only a gpu) is connected
int mainboardCount = _AuraSDK.EnumerateMbController(IntPtr.Zero, 0);
if (mainboardCount > 0)
{
@@ -113,22 +114,43 @@ namespace RGB.NET.Devices.Aura
#region Graphics cards
- //TODO DarthAffe 07.10.2017: GPU works but causes huge lags on update
- //int graphicCardCount = _AuraSDK.EnumerateGPU(IntPtr.Zero, 0);
- //if (graphicCardCount > 0)
- //{
- // IntPtr grapicsCardHandles = Marshal.AllocHGlobal(graphicCardCount * IntPtr.Size);
- // _AuraSDK.EnumerateGPU(grapicsCardHandles, graphicCardCount);
+ //TODO DarthAffe 21.10.2017: This somehow returns non-existant gpus (at least for me) which cause huge lags (if a real aura-ready gpu is connected this doesn't happen)
+ int graphicCardCount = _AuraSDK.EnumerateGPU(IntPtr.Zero, 0);
+ if (graphicCardCount > 0)
+ {
+ IntPtr grapicsCardHandles = Marshal.AllocHGlobal(graphicCardCount * IntPtr.Size);
+ _AuraSDK.EnumerateGPU(grapicsCardHandles, graphicCardCount);
- // for (int i = 0; i < graphicCardCount; i++)
- // {
- // IntPtr handle = Marshal.ReadIntPtr(grapicsCardHandles, i);
- // _AuraSDK.SetGPUMode(handle, 1);
- // AuraGraphicsCardRGBDevice device = new AuraGraphicsCardRGBDevice(new AuraGraphicsCardRGBDeviceInfo(RGBDeviceType.GraphicsCard, handle));
- // device.Initialize();
- // devices.Add(device);
- // }
- //}
+ for (int i = 0; i < graphicCardCount; i++)
+ {
+ IntPtr handle = Marshal.ReadIntPtr(grapicsCardHandles, i);
+ _AuraSDK.SetGPUMode(handle, 1);
+ AuraGraphicsCardRGBDevice device = new AuraGraphicsCardRGBDevice(new AuraGraphicsCardRGBDeviceInfo(RGBDeviceType.GraphicsCard, handle));
+ device.Initialize();
+ devices.Add(device);
+ }
+ }
+
+ #endregion
+
+ #region DRAM
+
+ //TODO DarthAffe 21.10.2017: This somehow returns non-existant gpus (at least for me) which cause huge lags (if a real aura-ready gpu is connected this doesn't happen)
+ int dramCount = _AuraSDK.EnumerateDram(IntPtr.Zero, 0);
+ if (dramCount > 0)
+ {
+ IntPtr dramHandles = Marshal.AllocHGlobal(dramCount * IntPtr.Size);
+ _AuraSDK.EnumerateDram(dramHandles, dramCount);
+
+ for (int i = 0; i < dramCount; i++)
+ {
+ IntPtr handle = Marshal.ReadIntPtr(dramHandles, i);
+ _AuraSDK.SetDramMode(handle, 1);
+ AuraDramRGBDevice device = new AuraDramRGBDevice(new AuraDramRGBDeviceInfo(RGBDeviceType.DRAM, handle));
+ device.Initialize();
+ devices.Add(device);
+ }
+ }
#endregion
@@ -176,7 +198,22 @@ namespace RGB.NET.Devices.Aura
///
public void ResetDevices()
{
- //TODO DarthAffe 07.10.2017: This seems to be impossible right now
+ foreach (IRGBDevice device in Devices)
+ {
+ AuraRGBDeviceInfo deviceInfo = (AuraRGBDeviceInfo)device.DeviceInfo;
+ switch (deviceInfo.DeviceType)
+ {
+ case RGBDeviceType.Mainboard:
+ _AuraSDK.SetMbMode(deviceInfo.Handle, 0);
+ break;
+ case RGBDeviceType.GraphicsCard:
+ _AuraSDK.SetGPUMode(deviceInfo.Handle, 0);
+ break;
+ case RGBDeviceType.DRAM:
+ _AuraSDK.SetDramMode(deviceInfo.Handle, 0);
+ break;
+ }
+ }
}
#endregion
diff --git a/RGB.NET.Devices.Aura/Dram/AuraDramRGBDevice.cs b/RGB.NET.Devices.Aura/Dram/AuraDramRGBDevice.cs
new file mode 100644
index 0000000..18b1ad7
--- /dev/null
+++ b/RGB.NET.Devices.Aura/Dram/AuraDramRGBDevice.cs
@@ -0,0 +1,56 @@
+using RGB.NET.Core;
+using RGB.NET.Devices.Aura.Native;
+
+namespace RGB.NET.Devices.Aura
+{
+ ///
+ ///
+ /// Represents a Aura dram.
+ ///
+ public class AuraDramRGBDevice : AuraRGBDevice
+ {
+ #region Properties & Fields
+
+ ///
+ /// Gets information about the .
+ ///
+ public AuraDramRGBDeviceInfo DramDeviceInfo { get; }
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The specific information provided by Aura for the DRAM.
+ internal AuraDramRGBDevice(AuraDramRGBDeviceInfo info)
+ : base(info)
+ {
+ this.DramDeviceInfo = info;
+ }
+
+ #endregion
+
+ #region Methods
+
+ ///
+ protected override void InitializeLayout()
+ {
+ //TODO DarthAffe 21.10.2017: Look for a good default layout
+ int ledCount = _AuraSDK.GetGPULedCount(DramDeviceInfo.Handle);
+ for (int i = 0; i < ledCount; i++)
+ InitializeLed(new AuraLedId(this, AuraLedIds.DramLed1 + i, i), new Rectangle(i * 10, 0, 10, 10));
+
+ //TODO DarthAffe 21.10.2017: We don'T know the model, how to save layouts and images?
+ ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Aura\Drams\{DramDeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
+ null, PathHelper.GetAbsolutePath(@"Images\Aura\Drams"));
+ }
+
+ ///
+ protected override void ApplyColorData() => _AuraSDK.SetDramColor(DramDeviceInfo.Handle, ColorData);
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.Aura/Dram/AuraDramRGBDeviceInfo.cs b/RGB.NET.Devices.Aura/Dram/AuraDramRGBDeviceInfo.cs
new file mode 100644
index 0000000..9252d21
--- /dev/null
+++ b/RGB.NET.Devices.Aura/Dram/AuraDramRGBDeviceInfo.cs
@@ -0,0 +1,28 @@
+using System;
+using RGB.NET.Core;
+
+namespace RGB.NET.Devices.Aura
+{
+ ///
+ ///
+ /// Represents a generic information for a .
+ ///
+ public class AuraDramRGBDeviceInfo : AuraRGBDeviceInfo
+ {
+ #region Constructors
+
+ ///
+ ///
+ /// Internal constructor of managed .
+ ///
+ /// The type of the .
+ /// The handle of the .
+ internal AuraDramRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle)
+ : base(deviceType, handle)
+ {
+ Image = new Uri(PathHelper.GetAbsolutePath($@"Images\Aura\Drams\{Model.Replace(" ", string.Empty).ToUpper()}.png"), UriKind.Absolute);
+ }
+
+ #endregion
+ }
+}
diff --git a/RGB.NET.Devices.Aura/Enum/AuraLedIds.cs b/RGB.NET.Devices.Aura/Enum/AuraLedIds.cs
index 26e50f3..01df76e 100644
--- a/RGB.NET.Devices.Aura/Enum/AuraLedIds.cs
+++ b/RGB.NET.Devices.Aura/Enum/AuraLedIds.cs
@@ -21,8 +21,10 @@ namespace RGB.NET.Devices.Aura
GraphicsCardLed1 = 0x11,
- MouseLed1 = 0x21,
+ DramLed1 = 0x21,
- KeyboardLed1 = 0x31,
+ MouseLed1 = 0x31,
+
+ KeyboardLed1 = 0x41,
}
}
diff --git a/RGB.NET.Devices.Aura/Native/_AuraSDK.cs b/RGB.NET.Devices.Aura/Native/_AuraSDK.cs
index c92175f..24bd5da 100644
--- a/RGB.NET.Devices.Aura/Native/_AuraSDK.cs
+++ b/RGB.NET.Devices.Aura/Native/_AuraSDK.cs
@@ -17,8 +17,6 @@ namespace RGB.NET.Devices.Aura.Native
private static IntPtr _dllHandle = IntPtr.Zero;
- private static List _helperLibraries = new List();
-
///
/// Gets the loaded architecture (x64/x86).
///
@@ -62,10 +60,16 @@ namespace RGB.NET.Devices.Aura.Native
_setClaymoreKeyboardModePointer = (SetClaymoreKeyboardModePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetClaymoreKeyboardMode"), typeof(SetClaymoreKeyboardModePointer));
_setClaymoreKeyboardColorPointer = (SetClaymoreKeyboardColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetClaymoreKeyboardColor"), typeof(SetClaymoreKeyboardColorPointer));
- _enumerateRogMouseControllerPointer = (CreateRogMousePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateRogMouse"), typeof(CreateRogMousePointer));
+ _enumerateRogMousePointer = (CreateRogMousePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "CreateRogMouse"), typeof(CreateRogMousePointer));
_getRogMouseLedCountPointer = (GetRogMouseLedCountPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "RogMouseLedCount"), typeof(GetRogMouseLedCountPointer)); // DarthAffe 07.10.2017: Be careful with the naming here - i don't know why but there is no 'Get'!
_setRogMouseModePointer = (SetRogMouseModePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetRogMouseMode"), typeof(SetRogMouseModePointer));
_setRogMouseColorPointer = (SetRogMouseColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetRogMouseColor"), typeof(SetRogMouseColorPointer));
+
+ _enumerateDramPointer = (EnumerateDramPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "EnumerateDram"), typeof(EnumerateDramPointer));
+ _getDramLedCountPointer = (GetDramLedCountPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "GetDramLedCount"), typeof(GetDramLedCountPointer));
+ _setDramModePointer = (SetDramModePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetDramMode"), typeof(SetDramModePointer));
+ _setDramColorPointer = (SetDramColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetDramColor"), typeof(SetDramColorPointer));
+ _getDramColorPointer = (GetDramColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "GetDramColor"), typeof(GetDramColorPointer));
}
private static void UnloadAuraSDK()
@@ -111,11 +115,17 @@ namespace RGB.NET.Devices.Aura.Native
private static SetClaymoreKeyboardModePointer _setClaymoreKeyboardModePointer;
private static SetClaymoreKeyboardColorPointer _setClaymoreKeyboardColorPointer;
- private static CreateRogMousePointer _enumerateRogMouseControllerPointer;
+ private static CreateRogMousePointer _enumerateRogMousePointer;
private static GetRogMouseLedCountPointer _getRogMouseLedCountPointer;
private static SetRogMouseModePointer _setRogMouseModePointer;
private static SetRogMouseColorPointer _setRogMouseColorPointer;
+ private static EnumerateDramPointer _enumerateDramPointer;
+ private static SetDramModePointer _setDramModePointer;
+ private static GetDramLedCountPointer _getDramLedCountPointer;
+ private static SetDramColorPointer _setDramColorPointer;
+ private static GetDramColorPointer _getDramColorPointer;
+
#endregion
#region Delegates
@@ -129,7 +139,7 @@ namespace RGB.NET.Devices.Aura.Native
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void SetMbColorPointer(IntPtr handle, byte[] colors, int size);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void GetMbColorPointer(IntPtr handle, IntPtr colors, int size);
+ private delegate int GetMbColorPointer(IntPtr handle, IntPtr colors, int size);
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int EnumerateGPUPointer(IntPtr handles, int size);
@@ -158,6 +168,17 @@ namespace RGB.NET.Devices.Aura.Native
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void SetRogMouseColorPointer(IntPtr handle, byte[] colors, int size);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate int EnumerateDramPointer(IntPtr handles, int size);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate int GetDramLedCountPointer(IntPtr handle);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void SetDramModePointer(IntPtr handle, int mode);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void SetDramColorPointer(IntPtr handle, byte[] colors, int size);
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate int GetDramColorPointer(IntPtr handle, IntPtr colors, int size);
+
#endregion
// ReSharper disable EventExceptionNotDocumented
@@ -167,9 +188,10 @@ namespace RGB.NET.Devices.Aura.Native
internal static void SetMbMode(IntPtr handle, int mode) => _setMbModePointer(handle, mode);
internal static void SetMbColor(IntPtr handle, byte[] colors) => _setMbColorPointer(handle, colors, colors.Length);
- internal static byte[] GetMbColor(IntPtr handle, int ledCount)
+ internal static byte[] GetMbColor(IntPtr handle)
{
- byte[] colors = new byte[ledCount * 3];
+ int count = _getDramColorPointer(handle, IntPtr.Zero, 0);
+ byte[] colors = new byte[count];
IntPtr readColorsPtr = Marshal.AllocHGlobal(colors.Length);
_getMbColorPointer(handle, readColorsPtr, colors.Length);
Marshal.Copy(readColorsPtr, colors, 0, colors.Length);
@@ -187,11 +209,27 @@ namespace RGB.NET.Devices.Aura.Native
internal static void SetClaymoreKeyboardMode(IntPtr handle, int mode) => _setClaymoreKeyboardModePointer(handle, mode);
internal static void SetClaymoreKeyboardColor(IntPtr handle, byte[] colors) => _setClaymoreKeyboardColorPointer(handle, colors, colors.Length);
- internal static bool CreateRogMouse(IntPtr handle) => _enumerateRogMouseControllerPointer(handle);
+ internal static bool CreateRogMouse(IntPtr handle) => _enumerateRogMousePointer(handle);
internal static int GetRogMouseLedCount(IntPtr handle) => _getRogMouseLedCountPointer(handle);
internal static void SetRogMouseMode(IntPtr handle, int mode) => _setRogMouseModePointer(handle, mode);
internal static void SetRogMouseColor(IntPtr handle, byte[] colors) => _setRogMouseColorPointer(handle, colors, colors.Length);
+ internal static int EnumerateDram(IntPtr handles, int size) => _enumerateDramPointer(handles, size);
+ internal static int GetDramLedCount(IntPtr handle) => _getDramLedCountPointer(handle);
+ internal static void SetDramMode(IntPtr handle, int mode) => _setDramModePointer(handle, mode);
+ internal static void SetDramColor(IntPtr handle, byte[] colors) => _setDramColorPointer(handle, colors, colors.Length);
+
+ internal static byte[] GetDramColor(IntPtr handle)
+ {
+ int count = _getDramColorPointer(handle, IntPtr.Zero, 0);
+ byte[] colors = new byte[count];
+ IntPtr readColorsPtr = Marshal.AllocHGlobal(colors.Length);
+ _getDramColorPointer(handle, readColorsPtr, colors.Length);
+ Marshal.Copy(readColorsPtr, colors, 0, colors.Length);
+ Marshal.FreeHGlobal(readColorsPtr);
+ return colors;
+ }
+
// ReSharper restore EventExceptionNotDocumented
#endregion
diff --git a/RGB.NET.Devices.Aura/RGB.NET.Devices.Aura.csproj b/RGB.NET.Devices.Aura/RGB.NET.Devices.Aura.csproj
index 54eb47e..d5e168f 100644
--- a/RGB.NET.Devices.Aura/RGB.NET.Devices.Aura.csproj
+++ b/RGB.NET.Devices.Aura/RGB.NET.Devices.Aura.csproj
@@ -46,6 +46,8 @@
+
+
diff --git a/RGB.NET.Devices.Aura/RGB.NET.Devices.Aura.csproj.DotSettings b/RGB.NET.Devices.Aura/RGB.NET.Devices.Aura.csproj.DotSettings
index 8ae9131..e9f0b89 100644
--- a/RGB.NET.Devices.Aura/RGB.NET.Devices.Aura.csproj.DotSettings
+++ b/RGB.NET.Devices.Aura/RGB.NET.Devices.Aura.csproj.DotSettings
@@ -1,4 +1,5 @@
+ True
True
True
True