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

Remove Dram from aura-provider

This commit is contained in:
Darth Affe 2017-10-29 10:07:20 +01:00
parent 4911758728
commit 2a7186012c
3 changed files with 83 additions and 82 deletions

View File

@ -135,22 +135,22 @@ namespace RGB.NET.Devices.Aura
#region DRAM #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) //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); //int dramCount = _AuraSDK.EnumerateDram(IntPtr.Zero, 0);
if (dramCount > 0) //if (dramCount > 0)
{ //{
IntPtr dramHandles = Marshal.AllocHGlobal(dramCount * IntPtr.Size); // IntPtr dramHandles = Marshal.AllocHGlobal(dramCount * IntPtr.Size);
_AuraSDK.EnumerateDram(dramHandles, dramCount); // _AuraSDK.EnumerateDram(dramHandles, dramCount);
for (int i = 0; i < dramCount; i++) // for (int i = 0; i < dramCount; i++)
{ // {
IntPtr handle = Marshal.ReadIntPtr(dramHandles, i); // IntPtr handle = Marshal.ReadIntPtr(dramHandles, i);
_AuraSDK.SetDramMode(handle, 1); // _AuraSDK.SetDramMode(handle, 1);
AuraDramRGBDevice device = new AuraDramRGBDevice(new AuraDramRGBDeviceInfo(RGBDeviceType.DRAM, handle)); // AuraDramRGBDevice device = new AuraDramRGBDevice(new AuraDramRGBDeviceInfo(RGBDeviceType.DRAM, handle));
device.Initialize(); // device.Initialize();
devices.Add(device); // devices.Add(device);
} // }
} //}
#endregion #endregion
@ -209,9 +209,9 @@ namespace RGB.NET.Devices.Aura
case RGBDeviceType.GraphicsCard: case RGBDeviceType.GraphicsCard:
_AuraSDK.SetGPUMode(deviceInfo.Handle, 0); _AuraSDK.SetGPUMode(deviceInfo.Handle, 0);
break; break;
case RGBDeviceType.DRAM: //case RGBDeviceType.DRAM:
_AuraSDK.SetDramMode(deviceInfo.Handle, 0); // _AuraSDK.SetDramMode(deviceInfo.Handle, 0);
break; // break;
} }
} }
} }

View File

@ -1,56 +1,56 @@
using RGB.NET.Core; //using RGB.NET.Core;
using RGB.NET.Devices.Aura.Native; //using RGB.NET.Devices.Aura.Native;
namespace RGB.NET.Devices.Aura //namespace RGB.NET.Devices.Aura
{ //{
/// <inheritdoc /> // /// <inheritdoc />
/// <summary> // /// <summary>
/// Represents a Aura dram. // /// Represents a Aura dram.
/// </summary> // /// </summary>
public class AuraDramRGBDevice : AuraRGBDevice // public class AuraDramRGBDevice : AuraRGBDevice
{ // {
#region Properties & Fields // #region Properties & Fields
/// <summary> // /// <summary>
/// Gets information about the <see cref="AuraDramRGBDevice"/>. // /// Gets information about the <see cref="AuraDramRGBDevice"/>.
/// </summary> // /// </summary>
public AuraDramRGBDeviceInfo DramDeviceInfo { get; } // public AuraDramRGBDeviceInfo DramDeviceInfo { get; }
#endregion // #endregion
#region Constructors // #region Constructors
/// <inheritdoc /> // /// <inheritdoc />
/// <summary> // /// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Aura.AuraDramRGBDevice" /> class. // /// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Aura.AuraDramRGBDevice" /> class.
/// </summary> // /// </summary>
/// <param name="info">The specific information provided by Aura for the DRAM.</param> // /// <param name="info">The specific information provided by Aura for the DRAM.</param>
internal AuraDramRGBDevice(AuraDramRGBDeviceInfo info) // internal AuraDramRGBDevice(AuraDramRGBDeviceInfo info)
: base(info) // : base(info)
{ // {
this.DramDeviceInfo = info; // this.DramDeviceInfo = info;
} // }
#endregion // #endregion
#region Methods // #region Methods
/// <inheritdoc /> // /// <inheritdoc />
protected override void InitializeLayout() // protected override void InitializeLayout()
{ // {
//TODO DarthAffe 21.10.2017: Look for a good default layout // //TODO DarthAffe 21.10.2017: Look for a good default layout
int ledCount = _AuraSDK.GetGPULedCount(DramDeviceInfo.Handle); // int ledCount = _AuraSDK.GetGPULedCount(DramDeviceInfo.Handle);
for (int i = 0; i < ledCount; i++) // for (int i = 0; i < ledCount; i++)
InitializeLed(new AuraLedId(this, AuraLedIds.DramLed1 + i, i), new Rectangle(i * 10, 0, 10, 10)); // 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? // //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"), // ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Aura\Drams\{DramDeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
null, PathHelper.GetAbsolutePath(@"Images\Aura\Drams")); // null, PathHelper.GetAbsolutePath(@"Images\Aura\Drams"));
} // }
/// <inheritdoc /> // /// <inheritdoc />
protected override void ApplyColorData() => _AuraSDK.SetDramColor(DramDeviceInfo.Handle, ColorData); // protected override void ApplyColorData() => _AuraSDK.SetDramColor(DramDeviceInfo.Handle, ColorData);
#endregion // #endregion
} // }
} //}

View File

@ -65,11 +65,12 @@ namespace RGB.NET.Devices.Aura.Native
_setRogMouseModePointer = (SetRogMouseModePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetRogMouseMode"), typeof(SetRogMouseModePointer)); _setRogMouseModePointer = (SetRogMouseModePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetRogMouseMode"), typeof(SetRogMouseModePointer));
_setRogMouseColorPointer = (SetRogMouseColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetRogMouseColor"), typeof(SetRogMouseColorPointer)); _setRogMouseColorPointer = (SetRogMouseColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetRogMouseColor"), typeof(SetRogMouseColorPointer));
_enumerateDramPointer = (EnumerateDramPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "EnumerateDram"), typeof(EnumerateDramPointer)); //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.
_getDramLedCountPointer = (GetDramLedCountPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "GetDramLedCount"), typeof(GetDramLedCountPointer)); //_enumerateDramPointer = (EnumerateDramPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "EnumerateDram"), typeof(EnumerateDramPointer));
_setDramModePointer = (SetDramModePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetDramMode"), typeof(SetDramModePointer)); //_getDramLedCountPointer = (GetDramLedCountPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "GetDramLedCount"), typeof(GetDramLedCountPointer));
_setDramColorPointer = (SetDramColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetDramColor"), typeof(SetDramColorPointer)); //_setDramModePointer = (SetDramModePointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetDramMode"), typeof(SetDramModePointer));
_getDramColorPointer = (GetDramColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "GetDramColor"), typeof(GetDramColorPointer)); //_setDramColorPointer = (SetDramColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "SetDramColor"), typeof(SetDramColorPointer));
//_getDramColorPointer = (GetDramColorPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(_dllHandle, "GetDramColor"), typeof(GetDramColorPointer));
} }
private static void UnloadAuraSDK() 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 SetRogMouseMode(IntPtr handle, int mode) => _setRogMouseModePointer(handle, mode);
internal static void SetRogMouseColor(IntPtr handle, byte[] colors) => _setRogMouseColorPointer(handle, colors, colors.Length); 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 EnumerateDram(IntPtr handles, int size) => _enumerateDramPointer(handles, size);
internal static int GetDramLedCount(IntPtr handle) => _getDramLedCountPointer(handle); //internal static int GetDramLedCount(IntPtr handle) => _getDramLedCountPointer(handle);
internal static void SetDramMode(IntPtr handle, int mode) => _setDramModePointer(handle, mode); //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 void SetDramColor(IntPtr handle, byte[] colors) => _setDramColorPointer(handle, colors, colors.Length);
internal static byte[] GetDramColor(IntPtr handle) //internal static byte[] GetDramColor(IntPtr handle)
{ //{
int count = _getDramColorPointer(handle, IntPtr.Zero, 0); // int count = _getDramColorPointer(handle, IntPtr.Zero, 0);
byte[] colors = new byte[count]; // byte[] colors = new byte[count];
IntPtr readColorsPtr = Marshal.AllocHGlobal(colors.Length); // IntPtr readColorsPtr = Marshal.AllocHGlobal(colors.Length);
_getDramColorPointer(handle, readColorsPtr, colors.Length); // _getDramColorPointer(handle, readColorsPtr, colors.Length);
Marshal.Copy(readColorsPtr, colors, 0, colors.Length); // Marshal.Copy(readColorsPtr, colors, 0, colors.Length);
Marshal.FreeHGlobal(readColorsPtr); // Marshal.FreeHGlobal(readColorsPtr);
return colors; // return colors;
} //}
// ReSharper restore EventExceptionNotDocumented // ReSharper restore EventExceptionNotDocumented