From 2a7186012ced477773d93c476b9abb7416bf096f Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 29 Oct 2017 10:07:20 +0100 Subject: [PATCH] Remove Dram from aura-provider --- RGB.NET.Devices.Aura/AuraDeviceProvider.cs | 36 ++++---- .../Dram/AuraDramRGBDevice.cs | 90 +++++++++---------- RGB.NET.Devices.Aura/Native/_AuraSDK.cs | 39 ++++---- 3 files changed, 83 insertions(+), 82 deletions(-) diff --git a/RGB.NET.Devices.Aura/AuraDeviceProvider.cs b/RGB.NET.Devices.Aura/AuraDeviceProvider.cs index 666e0a4..1d76228 100644 --- a/RGB.NET.Devices.Aura/AuraDeviceProvider.cs +++ b/RGB.NET.Devices.Aura/AuraDeviceProvider.cs @@ -135,22 +135,22 @@ namespace RGB.NET.Devices.Aura #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); + //TODO DarthAffe 29.10.2017: I don't know why they are even documented, but the asus guy said they aren't in the SDK right now. + //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); - } - } + // 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 @@ -209,9 +209,9 @@ namespace RGB.NET.Devices.Aura case RGBDeviceType.GraphicsCard: _AuraSDK.SetGPUMode(deviceInfo.Handle, 0); break; - case RGBDeviceType.DRAM: - _AuraSDK.SetDramMode(deviceInfo.Handle, 0); - break; + //case RGBDeviceType.DRAM: + // _AuraSDK.SetDramMode(deviceInfo.Handle, 0); + // break; } } } diff --git a/RGB.NET.Devices.Aura/Dram/AuraDramRGBDevice.cs b/RGB.NET.Devices.Aura/Dram/AuraDramRGBDevice.cs index 18b1ad7..5829d36 100644 --- a/RGB.NET.Devices.Aura/Dram/AuraDramRGBDevice.cs +++ b/RGB.NET.Devices.Aura/Dram/AuraDramRGBDevice.cs @@ -1,56 +1,56 @@ -using RGB.NET.Core; -using RGB.NET.Devices.Aura.Native; +//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 +//namespace RGB.NET.Devices.Aura +//{ +// /// +// /// +// /// Represents a Aura dram. +// /// +// public class AuraDramRGBDevice : AuraRGBDevice +// { +// #region Properties & Fields - /// - /// Gets information about the . - /// - public AuraDramRGBDeviceInfo DramDeviceInfo { get; } +// /// +// /// Gets information about the . +// /// +// public AuraDramRGBDeviceInfo DramDeviceInfo { get; } - #endregion +// #endregion - #region Constructors +// #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; - } +// /// +// /// +// /// 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 +// #endregion - #region Methods +// #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)); +// /// +// 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")); - } +// //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); +// /// +// protected override void ApplyColorData() => _AuraSDK.SetDramColor(DramDeviceInfo.Handle, ColorData); - #endregion - } -} +// #endregion +// } +//} diff --git a/RGB.NET.Devices.Aura/Native/_AuraSDK.cs b/RGB.NET.Devices.Aura/Native/_AuraSDK.cs index 24bd5da..5a19282 100644 --- a/RGB.NET.Devices.Aura/Native/_AuraSDK.cs +++ b/RGB.NET.Devices.Aura/Native/_AuraSDK.cs @@ -65,11 +65,12 @@ namespace RGB.NET.Devices.Aura.Native _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)); + //TODO DarthAffe 29.10.2017: I don't know why they are even documented, but the asus guy said they aren't in the SDK right now. + //_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() @@ -214,21 +215,21 @@ namespace RGB.NET.Devices.Aura.Native 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 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; - } + //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