Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OneXPlayer X1 support #1066

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions HandheldCompanion/Devices/IDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
67 changes: 67 additions & 0 deletions HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1.cs
Original file line number Diff line number Diff line change
@@ -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> { KeyCode.RControlKey, KeyCode.LWin, KeyCode.LMenu },
new List<KeyCode> { 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();
}
}
22 changes: 22 additions & 0 deletions HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1AMD.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
14 changes: 14 additions & 0 deletions HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1Intel.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
2 changes: 2 additions & 0 deletions HandheldCompanion/HandheldCompanion.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
<None Remove="Resources\device_onexplayer_2.png" />
<None Remove="Resources\device_onexplayer_mini.png" />
<None Remove="Resources\device_onexplayer_onexfly.png" />
<None Remove="Resources\device_onexplayer_x1.png" />
<None Remove="Resources\device_rog_ally.png" />
<None Remove="Resources\device_valve_jupiter.png" />
<None Remove="Resources\droix.png" />
Expand Down Expand Up @@ -139,6 +140,7 @@
<Resource Include="Resources\device_onexplayer_2.png" />
<Resource Include="Resources\device_onexplayer_mini.png" />
<Resource Include="Resources\device_onexplayer_onexfly.png" />
<Resource Include="Resources\device_onexplayer_x1.png" />
<Resource Include="Resources\device_rog_ally.png" />
<Resource Include="Resources\device_valve_jupiter.png" />
<Resource Include="Resources\droix.png" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion HandheldCompanion/Views/Pages/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />

<!-- Description -->
<TextBlock
Expand Down