From 297cec6e778466168bdbf04d99244334f65be12a Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sun, 30 Jul 2023 16:30:16 +0200 Subject: [PATCH] Added Rog Keris Wireless mouse support --- .../Mouse/Models/ROGKerisWireless.cs | 169 ++++++++++++++++++ app/Peripherals/PeripheralsProvider.cs | 2 + 2 files changed, 171 insertions(+) create mode 100644 app/Peripherals/Mouse/Models/ROGKerisWireless.cs diff --git a/app/Peripherals/Mouse/Models/ROGKerisWireless.cs b/app/Peripherals/Mouse/Models/ROGKerisWireless.cs new file mode 100644 index 00000000..b75c0d63 --- /dev/null +++ b/app/Peripherals/Mouse/Models/ROGKerisWireless.cs @@ -0,0 +1,169 @@ +namespace GHelper.Peripherals.Mouse.Models +{ + //P513 + public class ROGKerisWireless : AsusMouse + { + public ROGKerisWireless() : base(0x0B05, 0x1960, "mi_00", true) + { + } + + protected ROGKerisWireless(ushort vendorId, bool wireless) : base(0x0B05, vendorId, "mi_00", wireless) + { + } + + public override int DPIProfileCount() + { + return 4; + } + + public override string GetDisplayName() + { + return "ROG Keris (Wireless)"; + } + + + public override PollingRate[] SupportedPollingrates() + { + return new PollingRate[] { + PollingRate.PR125Hz, + PollingRate.PR250Hz, + PollingRate.PR500Hz, + PollingRate.PR1000Hz + }; + } + + public override int ProfileCount() + { + return 3; + } + public override int MaxDPI() + { + return 16_000; + } + + public override bool HasLiftOffSetting() + { + return true; + } + + public override bool HasRGB() + { + return true; + } + + public override bool HasAutoPowerOff() + { + return true; + } + + public override bool HasAngleSnapping() + { + return true; + } + + public override bool HasAngleTuning() + { + return false; + } + + public override bool HasLowBatteryWarning() + { + return true; + } + + public override bool HasDPIColors() + { + return false; + } + + public override bool IsLightingModeSupported(LightingMode lightingMode) + { + return lightingMode == LightingMode.Static + || lightingMode == LightingMode.Breathing + || lightingMode == LightingMode.ColorCycle + || lightingMode == LightingMode.React + || lightingMode == LightingMode.BatteryState + || lightingMode == LightingMode.Off; + } + + //Has 25% increments + protected override int ParseBattery(byte[] packet) + { + if (packet[1] == 0x12 && packet[2] == 0x07) + { + return packet[5] * 25; + } + + return -1; + } + + + public override int DPIIncrements() + { + return 100; + } + + public override bool CanChangeDPIProfile() + { + return false; + } + + protected override byte[] GetUpdateEnergySettingsPacket(int lowBatteryWarning, PowerOffSetting powerOff) + { + return base.GetUpdateEnergySettingsPacket(lowBatteryWarning / 25, powerOff); + } + + protected override int ParseLowBatteryWarning(byte[] packet) + { + int lowBat = base.ParseLowBatteryWarning(packet); + + return lowBat * 25; + } + + protected override LiftOffDistance ParseLiftOffDistance(byte[] packet) + { + if (packet[1] != 0x12 || packet[2] != 0x06) + { + return LiftOffDistance.Low; + } + + return (LiftOffDistance)packet[5]; + } + + protected override byte[] GetUpdateLiftOffDistancePacket(LiftOffDistance liftOffDistance) + { + return new byte[] { 0x00, 0x51, 0x35, 0x00, 0x00, ((byte)liftOffDistance) }; + } + + public override LightingZone[] SupportedLightingZones() + { + return new LightingZone[] { LightingZone.Logo, LightingZone.Scrollwheel }; + } + + public override int MaxBrightness() + { + return 4; + } + + protected override byte IndexForLightingMode(LightingMode lightingMode) + { + if (lightingMode == LightingMode.Off) + { + return 0xFF; + } + return ((byte)lightingMode); + } + } + + public class ROGKerisWirelessWired : ROGKerisWireless + { + public ROGKerisWirelessWired() : base(0x195E, false) + { + } + + public override string GetDisplayName() + { + return "ROG Keris (Wired)"; + } + } +} diff --git a/app/Peripherals/PeripheralsProvider.cs b/app/Peripherals/PeripheralsProvider.cs index c2edb5f9..31cd0635 100644 --- a/app/Peripherals/PeripheralsProvider.cs +++ b/app/Peripherals/PeripheralsProvider.cs @@ -187,6 +187,8 @@ namespace GHelper.Peripherals DetectMouse(new ChakramXWired()); DetectMouse(new GladiusIIIAimpoint()); DetectMouse(new GladiusIIIAimpointWired()); + DetectMouse(new ROGKerisWireless()); + DetectMouse(new ROGKerisWirelessWired()); DetectMouse(new TUFM4Wirelss()); }