diff --git a/HandheldCompanion/Devices/IDevice.cs b/HandheldCompanion/Devices/IDevice.cs index 37b62377f..07a708b64 100644 --- a/HandheldCompanion/Devices/IDevice.cs +++ b/HandheldCompanion/Devices/IDevice.cs @@ -368,6 +368,12 @@ public static IDevice GetCurrent() { switch (ProductName) { + case "ONEXPLAYER X1 i": + device = new OneXPlayerX1Intel(); + break; + case "ONEXPLAYER X1 a": // TDOO: check name after release + device = new OneXPlayerX1AMD(); + break; case "ONEXPLAYER F1": { switch (Version) diff --git a/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1.cs b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1.cs new file mode 100644 index 000000000..0e9fc71be --- /dev/null +++ b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1.cs @@ -0,0 +1,67 @@ +using HandheldCompanion.Inputs; +using HandheldCompanion.Managers; +using System.Collections.Generic; +using WindowsInput.Events; + +namespace HandheldCompanion.Devices; + +public class OneXPlayerX1 : IDevice +{ + public OneXPlayerX1() + { + // device specific settings + ProductIllustration = "device_onexplayer_x1"; + ProductModel = "ONEXPLAYERX1"; + + // device specific capacities + Capabilities = DeviceCapabilities.FanControl; + + ECDetails = new ECDetails + { + AddressFanControl = 0x44A, + AddressFanDuty = 0x44B, + AddressStatusCommandPort = 0x4E, + AddressDataPort = 0x4F, + FanValueMin = 0, + FanValueMax = 184 + }; + + OEMChords.Add(new DeviceChord("Turbo", + new List { KeyCode.RControlKey, KeyCode.LWin, KeyCode.LMenu }, + new List { KeyCode.LMenu, KeyCode.LWin, KeyCode.RControlKey }, + false, ButtonFlags.OEM1 + )); + } + + public override string GetGlyph(ButtonFlags button) + { + switch (button) + { + case ButtonFlags.OEM1: + return "\u2211"; + } + + return defaultGlyph; + } + + public override bool Open() + { + var success = base.Open(); + if (!success) + return false; + + // allow OneX button to pass key inputs + LogManager.LogInformation("Unlocked {0} OEM button", ButtonFlags.OEM1); + + ECRamDirectWrite(0x4EB, ECDetails, 0x40); + + return ECRamReadByte(0x4EB, ECDetails) == 0x40; + } + + public override void Close() + { + LogManager.LogInformation("Locked {0} OEM button", ButtonFlags.OEM1); + ECRamDirectWrite(0x4EB, ECDetails, 0x00); + base.Close(); + } +} diff --git a/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1AMD.cs b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1AMD.cs new file mode 100644 index 000000000..a8af602c0 --- /dev/null +++ b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1AMD.cs @@ -0,0 +1,22 @@ +using HandheldCompanion.Inputs; +using HandheldCompanion.Managers; +using HandheldCompanion.Misc; +using System; +using System.Collections.Generic; +using System.Numerics; +using WindowsInput.Events; +using static HandheldCompanion.Utils.DeviceUtils; + +namespace HandheldCompanion.Devices; + +public class OneXPlayerX1AMD : OneXPlayerX1 +{ + public OneXPlayerX1AMD() + { + // https://www.amd.com/en/products/apu/amd-ryzen-7-8840u + nTDP = new double[] { 15, 15, 28 }; + cTDP = new double[] { 15, 30 }; + GfxClock = new double[] { 100, 2700 }; + CpuClock = 5100; + } +} diff --git a/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1Intel.cs b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1Intel.cs new file mode 100644 index 000000000..5919b66db --- /dev/null +++ b/HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1Intel.cs @@ -0,0 +1,14 @@ +namespace HandheldCompanion.Devices; + +public class OneXPlayerX1Intel : OneXPlayerX1 +{ + public OneXPlayerX1Intel() + { + // https://www.intel.com/content/www/us/en/products/sku/236847/intel-core-ultra-7-processor-155h-24m-cache-up-to-4-80-ghz/specifications.html + // follow the values presented in OneXConsole + nTDP = new double[] { 15, 15, 35 }; + cTDP = new double[] { 6, 35 }; + GfxClock = new double[] { 100, 2250 }; + CpuClock = 4800; + } +} diff --git a/HandheldCompanion/HandheldCompanion.csproj b/HandheldCompanion/HandheldCompanion.csproj index b6e102c4b..6f4437aca 100644 --- a/HandheldCompanion/HandheldCompanion.csproj +++ b/HandheldCompanion/HandheldCompanion.csproj @@ -80,6 +80,7 @@ + @@ -139,6 +140,7 @@ + diff --git a/HandheldCompanion/Resources/device_onexplayer_x1.png b/HandheldCompanion/Resources/device_onexplayer_x1.png new file mode 100644 index 000000000..e02c87368 Binary files /dev/null and b/HandheldCompanion/Resources/device_onexplayer_x1.png differ diff --git a/HandheldCompanion/Views/Pages/AboutPage.xaml b/HandheldCompanion/Views/Pages/AboutPage.xaml index 372f01bc4..abcca9358 100644 --- a/HandheldCompanion/Views/Pages/AboutPage.xaml +++ b/HandheldCompanion/Views/Pages/AboutPage.xaml @@ -193,7 +193,7 @@ Margin="0,0,0,5" Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}" Style="{StaticResource BodyTextBlockStyle}" - Text="Nefarius, CasperH2O, B-Core, Frank东, Toomy, Havner, CoryManson, MSeys, ShadowFlare, trippyone, MiguelLedesmaC, Cheng77777, thororen1234, fighterguard, micdah, Geckon01, Bagboii, MeikoMenmaHonma, cerahmed, indiesaudi, Radther, Staubgeborener, twjmy, m33ts4k0z, howanghk, Creaous, xerootg, quangmach, MrCivsteR, 0SkillAllLuck, DevL0rd, romracer" /> + Text="Nefarius, CasperH2O, B-Core, Frank东, Toomy, Havner, CoryManson, MSeys, ShadowFlare, trippyone, MiguelLedesmaC, Cheng77777, thororen1234, fighterguard, micdah, Geckon01, Bagboii, MeikoMenmaHonma, cerahmed, indiesaudi, Radther, Staubgeborener, twjmy, m33ts4k0z, howanghk, Creaous, xerootg, quangmach, MrCivsteR, 0SkillAllLuck, DevL0rd, romracer, JT" />