1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 01:58:30 +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
//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;
}
}
}

View File

@ -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
{
/// <inheritdoc />
/// <summary>
/// Represents a Aura dram.
/// </summary>
public class AuraDramRGBDevice : AuraRGBDevice
{
#region Properties & Fields
//namespace RGB.NET.Devices.Aura
//{
// /// <inheritdoc />
// /// <summary>
// /// Represents a Aura dram.
// /// </summary>
// public class AuraDramRGBDevice : AuraRGBDevice
// {
// #region Properties & Fields
/// <summary>
/// Gets information about the <see cref="AuraDramRGBDevice"/>.
/// </summary>
public AuraDramRGBDeviceInfo DramDeviceInfo { get; }
// /// <summary>
// /// Gets information about the <see cref="AuraDramRGBDevice"/>.
// /// </summary>
// public AuraDramRGBDeviceInfo DramDeviceInfo { get; }
#endregion
// #endregion
#region Constructors
// #region Constructors
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Aura.AuraDramRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by Aura for the DRAM.</param>
internal AuraDramRGBDevice(AuraDramRGBDeviceInfo info)
: base(info)
{
this.DramDeviceInfo = info;
}
// /// <inheritdoc />
// /// <summary>
// /// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Aura.AuraDramRGBDevice" /> class.
// /// </summary>
// /// <param name="info">The specific information provided by Aura for the DRAM.</param>
// internal AuraDramRGBDevice(AuraDramRGBDeviceInfo info)
// : base(info)
// {
// this.DramDeviceInfo = info;
// }
#endregion
// #endregion
#region Methods
// #region Methods
/// <inheritdoc />
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));
// /// <inheritdoc />
// 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"));
// }
/// <inheritdoc />
protected override void ApplyColorData() => _AuraSDK.SetDramColor(DramDeviceInfo.Handle, ColorData);
// /// <inheritdoc />
// 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));
_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