diff --git a/RGB.NET.Devices.Razer/Generic/LedMappings.cs b/RGB.NET.Devices.Razer/Generic/LedMappings.cs index 7fa6267..cccfc5e 100644 --- a/RGB.NET.Devices.Razer/Generic/LedMappings.cs +++ b/RGB.NET.Devices.Razer/Generic/LedMappings.cs @@ -250,5 +250,49 @@ namespace RGB.NET.Devices.Razer //Row 7 is also empty }; + + internal static readonly LedMapping Mouse = new() + { + //row 0 empty + + //row 1 + [LedId.Mouse1] = (_Defines.MOUSE_MAX_COLUMN * 1) + 0, + [LedId.Mouse2] = (_Defines.MOUSE_MAX_COLUMN * 1) + 6, + + //row 2 + + [LedId.Mouse3] = (_Defines.MOUSE_MAX_COLUMN * 2) + 0, + [LedId.Mouse4] = (_Defines.MOUSE_MAX_COLUMN * 2) + 3, + [LedId.Mouse5] = (_Defines.MOUSE_MAX_COLUMN * 2) + 6, + + //row 3 + [LedId.Mouse6] = (_Defines.MOUSE_MAX_COLUMN * 3) + 0, + [LedId.Mouse7] = (_Defines.MOUSE_MAX_COLUMN * 3) + 6, + + //row 4 + [LedId.Mouse8] = (_Defines.MOUSE_MAX_COLUMN * 4) + 0, + [LedId.Mouse9] = (_Defines.MOUSE_MAX_COLUMN * 4) + 3, + [LedId.Mouse10] = (_Defines.MOUSE_MAX_COLUMN * 4) + 6, + + //row 5 + [LedId.Mouse11] = (_Defines.MOUSE_MAX_COLUMN * 5) + 0, + [LedId.Mouse12] = (_Defines.MOUSE_MAX_COLUMN * 5) + 6, + + //row 6 + [LedId.Mouse13] = (_Defines.MOUSE_MAX_COLUMN * 6) + 0, + [LedId.Mouse14] = (_Defines.MOUSE_MAX_COLUMN * 6) + 6, + + //row 7 + [LedId.Mouse15] = (_Defines.MOUSE_MAX_COLUMN * 7) + 0, + [LedId.Mouse16]= (_Defines.MOUSE_MAX_COLUMN * 7) + 3, + [LedId.Mouse17] = (_Defines.MOUSE_MAX_COLUMN * 7) + 6, + + //row 8 + [LedId.Mouse18] = (_Defines.MOUSE_MAX_COLUMN * 8) + 1, + [LedId.Mouse19] = (_Defines.MOUSE_MAX_COLUMN * 8) + 2, + [LedId.Mouse20] = (_Defines.MOUSE_MAX_COLUMN * 8) + 3, + [LedId.Mouse21] = (_Defines.MOUSE_MAX_COLUMN * 8) + 4, + [LedId.Mouse22] = (_Defines.MOUSE_MAX_COLUMN * 8) + 5, + }; } } diff --git a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs index 8cddb64..77e2081 100644 --- a/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs +++ b/RGB.NET.Devices.Razer/Mouse/RazerMouseRGBDevice.cs @@ -12,6 +12,12 @@ namespace RGB.NET.Devices.Razer /// public class RazerMouseRGBDevice : RazerRGBDevice, IMouse { + #region Properties & Fields + + private readonly LedMapping _ledMapping; + + #endregion + #region Constructors /// @@ -19,9 +25,10 @@ namespace RGB.NET.Devices.Razer /// Initializes a new instance of the class. /// /// The specific information provided by CUE for the mouse. - internal RazerMouseRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger) + internal RazerMouseRGBDevice(RazerRGBDeviceInfo info, IDeviceUpdateTrigger updateTrigger, LedMapping ledMapping) : base(info, new RazerMouseUpdateQueue(updateTrigger)) { + _ledMapping = ledMapping; InitializeLayout(); } @@ -32,12 +39,19 @@ namespace RGB.NET.Devices.Razer private void InitializeLayout() { for (int i = 0; i < _Defines.MOUSE_MAX_ROW; i++) + { for (int j = 0; j < _Defines.MOUSE_MAX_COLUMN; j++) - AddLed(LedId.Mouse1 + ((i * _Defines.MOUSE_MAX_COLUMN) + j), new Point(j * 11, i * 11), new Size(10, 10)); + { + if (_ledMapping.TryGetValue((i * _Defines.MOUSE_MAX_COLUMN) + j, out LedId ledId)) + { + AddLed(ledId, new Point(j * 11, i * 11), new Size(10, 10)); + } + } + } } /// - protected override object? GetLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mouse1; + protected override object? GetLedCustomData(LedId ledId) => _ledMapping[ledId]; #endregion } diff --git a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs index 464f8bf..8f166d5 100644 --- a/RGB.NET.Devices.Razer/RazerDeviceProvider.cs +++ b/RGB.NET.Devices.Razer/RazerDeviceProvider.cs @@ -103,59 +103,59 @@ namespace RGB.NET.Devices.Razer { 0x025E, RGBDeviceType.Keyboard, "Cynosa V2", LedMappings.Keyboard, RazerEndpointType.Keyboard }, // Mice - { 0x0013, RGBDeviceType.Mouse, "Orochi 2011", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0016, RGBDeviceType.Mouse, "DeathAdder 3.5G", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0020, RGBDeviceType.Mouse, "Abyssus 1800", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0024, RGBDeviceType.Mouse, "Mamba 2012 (Wired)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0025, RGBDeviceType.Mouse, "Mamba 2012 (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x002E, RGBDeviceType.Mouse, "Naga 2012", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x002F, RGBDeviceType.Mouse, "Imperator 2012", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0032, RGBDeviceType.Mouse, "Ouroboros 2012", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0034, RGBDeviceType.Mouse, "Taipan", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0036, RGBDeviceType.Mouse, "Naga Hex (Red)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0037, RGBDeviceType.Mouse, "DeathAdder 2013", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0038, RGBDeviceType.Mouse, "DeathAdder 1800", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0039, RGBDeviceType.Mouse, "Orochi 2013", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0040, RGBDeviceType.Mouse, "Naga 2014", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0041, RGBDeviceType.Mouse, "Naga Hex", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0042, RGBDeviceType.Mouse, "Abyssus 2014", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0043, RGBDeviceType.Mouse, "DeathAdder Chroma", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0044, RGBDeviceType.Mouse, "Mamba (Wired)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0045, RGBDeviceType.Mouse, "Mamba (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0046, RGBDeviceType.Mouse, "Mamba Tournament Edition", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0048, RGBDeviceType.Mouse, "Orochi (Wired)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x004C, RGBDeviceType.Mouse, "Diamondback Chroma", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x004F, RGBDeviceType.Mouse, "DeathAdder 2000", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0050, RGBDeviceType.Mouse, "Naga Hex V2", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0053, RGBDeviceType.Mouse, "Naga Chroma", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0054, RGBDeviceType.Mouse, "DeathAdder 3500", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0059, RGBDeviceType.Mouse, "Lancehead (Wired)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x005A, RGBDeviceType.Mouse, "Lancehead (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x005B, RGBDeviceType.Mouse, "Abyssus V2", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x005C, RGBDeviceType.Mouse, "DeathAdder Elite", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x005E, RGBDeviceType.Mouse, "Abyssus 2000", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0060, RGBDeviceType.Mouse, "Lancehead Tournament Edition", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0062, RGBDeviceType.Mouse, "Atheris (Receiver)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0064, RGBDeviceType.Mouse, "Basilisk", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0067, RGBDeviceType.Mouse, "Naga Trinity", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x006A, RGBDeviceType.Mouse, "Abyssus Elite (D.Va Edition)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x006B, RGBDeviceType.Mouse, "Abyssus Essential", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x006C, RGBDeviceType.Mouse, "Mamba Elite (Wired)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x006E, RGBDeviceType.Mouse, "DeathAdder Essential", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x006F, RGBDeviceType.Mouse, "Lancehead Wireless (Receiver)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0070, RGBDeviceType.Mouse, "Lancehead Wireless (Wired)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0071, RGBDeviceType.Mouse, "DeathAdder Essential (White Edition)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0072, RGBDeviceType.Mouse, "Mamba Wireless (Receiver)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0073, RGBDeviceType.Mouse, "Mamba Wireless (Wired)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0078, RGBDeviceType.Mouse, "Viper", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x007A, RGBDeviceType.Mouse, "Viper Ultimate (Wired)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x007B, RGBDeviceType.Mouse, "Viper Ultimate (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x007C, RGBDeviceType.Mouse, "DeathAdder V2 Pro (Wired)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x007D, RGBDeviceType.Mouse, "DeathAdder V2 Pro (Wireless)", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0083, RGBDeviceType.Mouse, "Basilisk X HyperSpeed", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0088, RGBDeviceType.Mouse, "Basilisk Ultimate", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x0084, RGBDeviceType.Mouse, "DeathAdder V2", LedMappings.TODO, RazerEndpointType.Mouse }, - { 0x008A, RGBDeviceType.Mouse, "Viper Mini", LedMappings.TODO, RazerEndpointType.Mouse }, + { 0x0013, RGBDeviceType.Mouse, "Orochi 2011", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0016, RGBDeviceType.Mouse, "DeathAdder 3.5G", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0020, RGBDeviceType.Mouse, "Abyssus 1800", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0024, RGBDeviceType.Mouse, "Mamba 2012 (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0025, RGBDeviceType.Mouse, "Mamba 2012 (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x002E, RGBDeviceType.Mouse, "Naga 2012", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x002F, RGBDeviceType.Mouse, "Imperator 2012", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0032, RGBDeviceType.Mouse, "Ouroboros 2012", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0034, RGBDeviceType.Mouse, "Taipan", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0036, RGBDeviceType.Mouse, "Naga Hex (Red)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0037, RGBDeviceType.Mouse, "DeathAdder 2013", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0038, RGBDeviceType.Mouse, "DeathAdder 1800", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0039, RGBDeviceType.Mouse, "Orochi 2013", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0040, RGBDeviceType.Mouse, "Naga 2014", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0041, RGBDeviceType.Mouse, "Naga Hex", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0042, RGBDeviceType.Mouse, "Abyssus 2014", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0043, RGBDeviceType.Mouse, "DeathAdder Chroma", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0044, RGBDeviceType.Mouse, "Mamba (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0045, RGBDeviceType.Mouse, "Mamba (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0046, RGBDeviceType.Mouse, "Mamba Tournament Edition", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0048, RGBDeviceType.Mouse, "Orochi (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x004C, RGBDeviceType.Mouse, "Diamondback Chroma", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x004F, RGBDeviceType.Mouse, "DeathAdder 2000", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0050, RGBDeviceType.Mouse, "Naga Hex V2", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0053, RGBDeviceType.Mouse, "Naga Chroma", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0054, RGBDeviceType.Mouse, "DeathAdder 3500", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0059, RGBDeviceType.Mouse, "Lancehead (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x005A, RGBDeviceType.Mouse, "Lancehead (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x005B, RGBDeviceType.Mouse, "Abyssus V2", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x005C, RGBDeviceType.Mouse, "DeathAdder Elite", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x005E, RGBDeviceType.Mouse, "Abyssus 2000", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0060, RGBDeviceType.Mouse, "Lancehead Tournament Edition", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0062, RGBDeviceType.Mouse, "Atheris (Receiver)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0064, RGBDeviceType.Mouse, "Basilisk", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0067, RGBDeviceType.Mouse, "Naga Trinity", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x006A, RGBDeviceType.Mouse, "Abyssus Elite (D.Va Edition)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x006B, RGBDeviceType.Mouse, "Abyssus Essential", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x006C, RGBDeviceType.Mouse, "Mamba Elite (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x006E, RGBDeviceType.Mouse, "DeathAdder Essential", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x006F, RGBDeviceType.Mouse, "Lancehead Wireless (Receiver)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0070, RGBDeviceType.Mouse, "Lancehead Wireless (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0071, RGBDeviceType.Mouse, "DeathAdder Essential (White Edition)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0072, RGBDeviceType.Mouse, "Mamba Wireless (Receiver)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0073, RGBDeviceType.Mouse, "Mamba Wireless (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0078, RGBDeviceType.Mouse, "Viper", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x007A, RGBDeviceType.Mouse, "Viper Ultimate (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x007B, RGBDeviceType.Mouse, "Viper Ultimate (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x007C, RGBDeviceType.Mouse, "DeathAdder V2 Pro (Wired)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x007D, RGBDeviceType.Mouse, "DeathAdder V2 Pro (Wireless)", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0083, RGBDeviceType.Mouse, "Basilisk X HyperSpeed", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0088, RGBDeviceType.Mouse, "Basilisk Ultimate", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x0084, RGBDeviceType.Mouse, "DeathAdder V2", LedMappings.Mouse, RazerEndpointType.Mouse }, + { 0x008A, RGBDeviceType.Mouse, "Viper Mini", LedMappings.Mouse, RazerEndpointType.Mouse }, // Mousepads { 0x0068, RGBDeviceType.Mousepad, "Firefly Hyperflux", LedMappings.TODO, RazerEndpointType.Mousepad }, @@ -234,7 +234,7 @@ namespace RGB.NET.Devices.Razer if (loadFilter.HasFlag(RGBDeviceType.Keyboard) && devices.All(d => d is not RazerKeyboardRGBDevice)) devices.Add(new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo("Emulator Keyboard", RazerEndpointType.Keyboard), GetUpdateTrigger(), LedMappings.Keyboard)); if (loadFilter.HasFlag(RGBDeviceType.Mouse) && devices.All(d => d is not RazerMouseRGBDevice)) - devices.Add(new RazerMouseRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Mouse, RazerEndpointType.Mouse, "Emulator Mouse"), GetUpdateTrigger())); + devices.Add(new RazerMouseRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Mouse, RazerEndpointType.Mouse, "Emulator Mouse"), GetUpdateTrigger(), LedMappings.Mouse)); if (loadFilter.HasFlag(RGBDeviceType.Headset) && devices.All(d => d is not RazerHeadsetRGBDevice)) devices.Add(new RazerHeadsetRGBDevice(new RazerRGBDeviceInfo(RGBDeviceType.Headset, RazerEndpointType.Headset, "Emulator Headset"), GetUpdateTrigger())); if (loadFilter.HasFlag(RGBDeviceType.Mousepad) && devices.All(d => d is not RazerMousepadRGBDevice)) @@ -257,7 +257,7 @@ namespace RGB.NET.Devices.Razer { RazerEndpointType.Keyboard => new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(definition.Name, definition.CustomData), GetUpdateTrigger(), definition.LedMapping), RazerEndpointType.LaptopKeyboard => new RazerKeyboardRGBDevice(new RazerKeyboardRGBDeviceInfo(definition.Name, definition.CustomData), GetUpdateTrigger(), definition.LedMapping), - RazerEndpointType.Mouse => new RazerMouseRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger()), + RazerEndpointType.Mouse => new RazerMouseRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger(), definition.LedMapping), RazerEndpointType.Headset => new RazerHeadsetRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger()), RazerEndpointType.Mousepad => new RazerMousepadRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger()), RazerEndpointType.Keypad => new RazerKeypadRGBDevice(new RazerRGBDeviceInfo(definition.DeviceType, definition.CustomData, definition.Name), GetUpdateTrigger()),