Skip to content

Commit

Permalink
Add X1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuatam committed May 22, 2024
1 parent 325ab29 commit 795925b
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 1 deletion.
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
60 changes: 60 additions & 0 deletions HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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";

ECDetails = new ECDetails
{
AddressStatusCommandPort = 0x4E,
AddressDataPort = 0x4F,
};

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 some of the values presented in OneXConsole at the moment
nTDP = new double[] { 15, 15, 65 };
cTDP = new double[] { 15, 65 };
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

0 comments on commit 795925b

Please sign in to comment.