Skip to content

Commit

Permalink
Merge pull request #361 from DarthAffe/SDK/Corsair
Browse files Browse the repository at this point in the history
Added GameController as Core device type; Updated Corsair SDK to 4.0.84
  • Loading branch information
DarthAffe authored Dec 22, 2023
2 parents 9575690 + 8aaf602 commit 0444730
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 3 deletions.
5 changes: 5 additions & 0 deletions RGB.NET.Core/Devices/RGBDeviceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public enum RGBDeviceType
/// </summary>
LedController = 1 << 15,

/// <summary>
/// Represents a game controller.
/// </summary>
GameController = 1 << 16,

/// <summary>
/// Represents a device where the type is not known or not present in the list.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions RGB.NET.Core/Devices/TypeInterfaces/IGameController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace RGB.NET.Core;

/// <summary>
/// Represents a gamecontroller-device
/// </summary>
public interface IGameController: IRGBDevice
{ }
130 changes: 130 additions & 0 deletions RGB.NET.Core/Leds/LedId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6294,6 +6294,136 @@ public enum LedId
Cooler127 = 0x00D0007F,
Cooler128 = 0x00D00080,

/*### GameController ###*/
GameController1 = 0x00E00001,
GameController2 = 0x00E00002,
GameController3 = 0x00E00003,
GameController4 = 0x00E00004,
GameController5 = 0x00E00005,
GameController6 = 0x00E00006,
GameController7 = 0x00E00007,
GameController8 = 0x00E00008,
GameController9 = 0x00E00009,
GameController10 = 0x00E0000A,
GameController11 = 0x00E0000B,
GameController12 = 0x00E0000C,
GameController13 = 0x00E0000D,
GameController14 = 0x00E0000E,
GameController15 = 0x00E0000F,
GameController16 = 0x00E00010,
GameController17 = 0x00E00011,
GameController18 = 0x00E00012,
GameController19 = 0x00E00013,
GameController20 = 0x00E00014,
GameController21 = 0x00E00015,
GameController22 = 0x00E00016,
GameController23 = 0x00E00017,
GameController24 = 0x00E00018,
GameController25 = 0x00E00019,
GameController26 = 0x00E0001A,
GameController27 = 0x00E0001B,
GameController28 = 0x00E0001C,
GameController29 = 0x00E0001D,
GameController30 = 0x00E0001E,
GameController31 = 0x00E0001F,
GameController32 = 0x00E00020,
GameController33 = 0x00E00021,
GameController34 = 0x00E00022,
GameController35 = 0x00E00023,
GameController36 = 0x00E00024,
GameController37 = 0x00E00025,
GameController38 = 0x00E00026,
GameController39 = 0x00E00027,
GameController40 = 0x00E00028,
GameController41 = 0x00E00029,
GameController42 = 0x00E0002A,
GameController43 = 0x00E0002B,
GameController44 = 0x00E0002C,
GameController45 = 0x00E0002D,
GameController46 = 0x00E0002E,
GameController47 = 0x00E0002F,
GameController48 = 0x00E00030,
GameController49 = 0x00E00031,
GameController50 = 0x00E00032,
GameController51 = 0x00E00033,
GameController52 = 0x00E00034,
GameController53 = 0x00E00035,
GameController54 = 0x00E00036,
GameController55 = 0x00E00037,
GameController56 = 0x00E00038,
GameController57 = 0x00E00039,
GameController58 = 0x00E0003A,
GameController59 = 0x00E0003B,
GameController60 = 0x00E0003C,
GameController61 = 0x00E0003D,
GameController62 = 0x00E0003E,
GameController63 = 0x00E0003F,
GameController64 = 0x00E00040,
GameController65 = 0x00E00041,
GameController66 = 0x00E00042,
GameController67 = 0x00E00043,
GameController68 = 0x00E00044,
GameController69 = 0x00E00045,
GameController70 = 0x00E00046,
GameController71 = 0x00E00047,
GameController72 = 0x00E00048,
GameController73 = 0x00E00049,
GameController74 = 0x00E0004A,
GameController75 = 0x00E0004B,
GameController76 = 0x00E0004C,
GameController77 = 0x00E0004D,
GameController78 = 0x00E0004E,
GameController79 = 0x00E0004F,
GameController80 = 0x00E00050,
GameController81 = 0x00E00051,
GameController82 = 0x00E00052,
GameController83 = 0x00E00053,
GameController84 = 0x00E00054,
GameController85 = 0x00E00055,
GameController86 = 0x00E00056,
GameController87 = 0x00E00057,
GameController88 = 0x00E00058,
GameController89 = 0x00E00059,
GameController90 = 0x00E0005A,
GameController91 = 0x00E0005B,
GameController92 = 0x00E0005C,
GameController93 = 0x00E0005D,
GameController94 = 0x00E0005E,
GameController95 = 0x00E0005F,
GameController96 = 0x00E00060,
GameController97 = 0x00E00061,
GameController98 = 0x00E00062,
GameController99 = 0x00E00063,
GameController100 = 0x00E00064,
GameController101 = 0x00E00065,
GameController102 = 0x00E00066,
GameController103 = 0x00E00067,
GameController104 = 0x00E00068,
GameController105 = 0x00E00069,
GameController106 = 0x00E0006A,
GameController107 = 0x00E0006B,
GameController108 = 0x00E0006C,
GameController109 = 0x00E0006D,
GameController110 = 0x00E0006E,
GameController111 = 0x00E0006F,
GameController112 = 0x00E00070,
GameController113 = 0x00E00071,
GameController114 = 0x00E00072,
GameController115 = 0x00E00073,
GameController116 = 0x00E00074,
GameController117 = 0x00E00075,
GameController118 = 0x00E00076,
GameController119 = 0x00E00077,
GameController120 = 0x00E00078,
GameController121 = 0x00E00079,
GameController122 = 0x00E0007A,
GameController123 = 0x00E0007B,
GameController124 = 0x00E0007C,
GameController125 = 0x00E0007D,
GameController126 = 0x00E0007E,
GameController127 = 0x00E0007F,
GameController128 = 0x00E00080,

/*### Custom ###*/
Custom1 = 0x0FE00001,
Custom2 = 0x0FE00002,
Expand Down
8 changes: 8 additions & 0 deletions RGB.NET.Devices.Corsair/CorsairDeviceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ private IEnumerable<ICorsairRGBDevice> LoadCorsairDevices()
yield return new CorsairCoolerRGBDevice(new CorsairCoolerRGBDeviceInfo(device, deviceLedCount, 0), updateQueue);
break;

case CorsairDeviceType.GameController:
yield return new CorsairGameControllerRGBDevice(new CorsairGameControllerRGBDeviceInfo(device, deviceLedCount, 0), updateQueue);
break;

case CorsairDeviceType.FanLedController:
case CorsairDeviceType.LedController:
case CorsairDeviceType.Unknown:
Expand Down Expand Up @@ -264,6 +268,10 @@ private IEnumerable<ICorsairRGBDevice> LoadCorsairDevices()
yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "QL Fan"), updateQueue);
break;

case CorsairChannelDeviceType.FanQX:
yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "QX Fan"), updateQueue);
break;

case CorsairChannelDeviceType.EightLedSeriesFan:
yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "8-Led-Series Fan Fan"), updateQueue);
break;
Expand Down
1 change: 1 addition & 0 deletions RGB.NET.Devices.Corsair/Enum/CorsairChannelDeviceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ public enum CorsairChannelDeviceType
Pump = 9,
DRAM = 10,
WaterBlock = 11,
FanQX = 12,
};
5 changes: 5 additions & 0 deletions RGB.NET.Devices.Corsair/Enum/CorsairDeviceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public enum CorsairDeviceType : uint
/// </summary>
Touchbar = 0x0800,

/// <summary>
/// iCUE-SDK: for game controllers
/// </summary>
GameController = 0x1000,

/// <summary>
/// iCUE-SDK: for all devices
/// </summary>
Expand Down
7 changes: 6 additions & 1 deletion RGB.NET.Devices.Corsair/Enum/CorsairLedGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,10 @@ public enum CorsairLedGroup
/// <summary>
/// iCUE-SDK: for touchbar leds
/// </summary>
Touchbar = 14
Touchbar = 14,

/// <summary>
/// iCUE-SDK: for game controller leds
/// </summary>
GameController = 15
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global

using RGB.NET.Core;
using System.Collections.Generic;

namespace RGB.NET.Devices.Corsair;

/// <inheritdoc cref="CorsairRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a corsair gamecontroller.
/// </summary>
public sealed class CorsairGameControllerRGBDevice : CorsairRGBDevice<CorsairGameControllerRGBDeviceInfo>, IGameController
{
#region Constructors

/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Corsair.CorsairGameControllerRGBDevice" /> class.
/// </summary>
/// <param name="info">The specific information provided by CUE for the gamecontroller</param>
/// <param name="updateQueue">The queue used to update this device.</param>
internal CorsairGameControllerRGBDevice(CorsairGameControllerRGBDeviceInfo info, CorsairDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{ }

#endregion

#region Methods

protected override LedMapping<CorsairLedId> CreateMapping(IEnumerable<CorsairLedId> ids) => LedMappings.CreateGameControllerMapping(ids);

#endregion
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using RGB.NET.Core;
using RGB.NET.Devices.Corsair.Native;

namespace RGB.NET.Devices.Corsair;

/// <inheritdoc />
/// <summary>
/// Represents a generic information for a <see cref="T:RGB.NET.Devices.Corsair.CorsairGameControllerRGBDevice" />.
/// </summary>
public sealed class CorsairGameControllerRGBDeviceInfo : CorsairRGBDeviceInfo
{
#region Constructors

/// <inheritdoc />
internal CorsairGameControllerRGBDeviceInfo(_CorsairDeviceInfo nativeInfo, int ledCount, int ledOffset)
: base(RGBDeviceType.GameController, nativeInfo, ledCount, ledOffset)
{ }

#endregion
}
1 change: 1 addition & 0 deletions RGB.NET.Devices.Corsair/Generic/LedMappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ internal static class LedMappings
internal static LedMapping<CorsairLedId> CreateMousepadMapping(IEnumerable<CorsairLedId> ids) => CreateMapping(ids, LedId.Mousepad1);
internal static LedMapping<CorsairLedId> CreateHeadsetMapping(IEnumerable<CorsairLedId> ids) => CreateMapping(ids, LedId.Headset1);
internal static LedMapping<CorsairLedId> CreateMouseMapping(IEnumerable<CorsairLedId> ids) => CreateMapping(ids, LedId.Mouse1);
internal static LedMapping<CorsairLedId> CreateGameControllerMapping(IEnumerable<CorsairLedId> ids) => CreateMapping(ids, LedId.GameController1);
internal static LedMapping<CorsairLedId> CreateUnknownMapping(IEnumerable<CorsairLedId> ids) => CreateMapping(ids, LedId.Unknown1);

internal static LedMapping<CorsairLedId> CreateMapping(IEnumerable<CorsairLedId> ids, LedId referenceId)
Expand Down
4 changes: 2 additions & 2 deletions RGB.NET.Devices.Corsair/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ surface.Load(CorsairDeviceProvider.Instance);
This providers requires native SDK-dlls.
You can get them directly from Corsair at [https://github.com/CorsairOfficial/cue-sdk/releases](https://github.com/CorsairOfficial/cue-sdk/releases)

(Developed and tested with iCUE SDK v4.0.48)
(Developed and tested with iCUE SDK v4.0.84)

Since the SDK-dlls are native it's important to use the correct architecture you're building your application for. (If in doubt you can always include both.)

Expand All @@ -20,7 +20,7 @@ Since the SDK-dlls are native it's important to use the correct architecture you

You can use other, custom paths by adding them to `CorsairDeviceProvider.PossibleX64NativePaths`.

### x86
### x86 (only SDKs before v4.0.84)
`redist\i386\iCUESDK_2019.dll` from the SDK-zip needs to be distributed as `<application-directory>\x86\iCUESDK_2019.dll` (or simply named `iCUESDK.dll`)

You can use other, custom paths by adding them to `CorsairDeviceProvider.PossibleX86NativePaths`.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cooler/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=fan/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=gamecontroller/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=generic_005Cupdate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=graphicscard/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=headsetstand/@EntryIndexedValue">True</s:Boolean>
Expand Down

0 comments on commit 0444730

Please sign in to comment.