-
Notifications
You must be signed in to change notification settings - Fork 90
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
EA to public #1070
Merged
Merged
EA to public #1070
Changes from all commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
e121a8e
Implement CustomWpf (#154)
Valkirie 69453a4
Implement support for Intel Graphics Control Library (IGCL) (#158)
Valkirie efd3d01
Implement new UI classes (#153)
Valkirie 16fb364
Improve ADLX and IGCL (#160)
Valkirie 38440d6
Allow OSD customization (#161)
0SkillAllLuck 70ebce9
Change Serilog.Sinks.File MinimumLevel to Information
Valkirie 905bbc5
Update README.md to include Droix Discord link (#168)
CasperH2O 009f5c2
Improvement Increased gyro aiming down sites multiplier lower range. …
CasperH2O 7c5fa1b
Translation and localization update (#167)
CasperH2O 6c1dcb5
Support GPD WIN MINI (Initial) (#169)
CasperH2O 9334357
Build 0.20.4.0
CasperH2O a0a753a
do not try and restore default GPU frequency on AMD GPUs
Valkirie 44786fa
Update HidHide to 1.4.202 (#182)
Valkirie 2b07581
Added support for multi-display and multi-GPU configurations (#186)
Valkirie 0820fdb
Misc fixes (#189)
Valkirie 671d686
MVVM Rework - Batch 1 (#193)
CasperH2O 15e5362
Build 0.20.5.0
CasperH2O 0b16640
Build 0.20.5.1
CasperH2O 1895d59
Implement JibbSmart's GamepadMotionHelper (#206)
Valkirie 3f84666
Build 0.20.5.2
CasperH2O d5512e4
InnoSetup Update (#209)
CasperH2O 69ace20
Build 0.20.5.3
CasperH2O 76f4380
implement enum SteeringAxis
Valkirie efaf17d
Support for MSI Claw (#213)
romracer 2ec8425
fix profile management
Valkirie bfed49f
Build 0.20.5.4
CasperH2O 523c86d
Build 0.20.5.5
CasperH2O 9451cae
Update RTSS to 7.3.6
dc1fcbb
implement automatic Roll/Yaw swap (#229)
Valkirie e76fe46
code cleanup
Valkirie e5149d0
Build 0.20.5.6
CasperH2O f8858f7
Crash on launch (#238)
romracer 42c71c2
Prevent crash when deleting profiles (#240)
romracer 5dd9202
initialize all MotherboardInfo getters with static object
Valkirie 40fa40d
Set the default log directory to the exe's current location
romracer 4fae43d
Changes profiles to ConcurrentDictionary (#252)
romracer 5df48c1
Fixed an issue preventing GPU clock from being set on latest Steam De…
Valkirie 693c7e5
Fixed an issue causing a crash when profile.Path is null
Valkirie 56943d6
fixed an issue causing a crash when halting performance manager and p…
Valkirie d24155c
made MotherboardInfo more robust
Valkirie bab7774
GPD Win 4 2024 and RyzenAdj Hawk Point Updatede (#228)
CasperH2O caa830e
Fix 3D overlay motion (#259)
CasperH2O a8164c9
AOKZOE A2 Support
CasperH2O af2663d
Build 0.21.1.0
CasperH2O 8b92ad8
Fix Custom OSD Battery Level Valkirie/HandheldCompanion#1055
CasperH2O 04f09ba
Build 0.21.1.1
CasperH2O 38455fb
Improve controller manager and virtual manager relationship (#272)
Valkirie 4c50029
Quick tools profile page power preset, fix glyph, expand default fals…
CasperH2O ef9d8b5
Fix button prompt visibility and placement HandheldCompanion#1063 (#270)
CasperH2O fa23a8c
Fix OSD selection without usable RTSS Valkirie/HandheldCompanion#1030…
CasperH2O d4c47e4
3D Overlay fixes (#268)
CasperH2O b91e7d5
[AYANEO] Add FlipKB and FlipDS (#267)
0SkillAllLuck 2cff438
Add trackpad glyphs to GetGlyph functions (#273)
CasperH2O 2a50fc2
Fix 3D overlay shoulder buttons rotating incorrectly with face camera…
CasperH2O 9dc5a76
Improve ClawA1M Open and Close logic (#276)
Valkirie 2ef15c6
ROGAlly and ClawA1M Open/Close logic tweak
Valkirie 2daf267
OneXPlayer X1 Support
joshuatam b46b29c
Update to latest build (#278)
Valkirie 62b0f9e
Fixed an issue causing a crash on null GetGlyph()
Valkirie 16ffec7
prevent profile processing if string.IsNullOrEmpty(Name or Path)
Valkirie 79dec40
Fix DualSense touchpad range mapping.
CasperH2O a020510
Build 0.21.2.0
CasperH2O ffe956e
Fixed an issue causing a crash when trying to initialize ViGEm client…
Valkirie 78a8959
Fix a few issues with sensor management (#283)
Valkirie 5b8f4aa
Improve profile management robustness (#282)
Valkirie 29fa60c
Fixed an issue causing a crash when AppCompatRegistry can't be accessed
Valkirie 4efeae8
Fixed an issue creating a blank profile when a null or Empty ProcessE…
Valkirie cb1400b
Build 0.21.2.1
Valkirie eb46968
Build 0.21.2.3
Valkirie 1bd6651
Use TheNathannator ViGEm.NET bugfix branche (#285)
Valkirie 5a8235b
Fix QT default location in settings (again)
CasperH2O fd57191
AOKZOE A2 LED control
CasperH2O 0ca78e6
Build 0.21.2.4
CasperH2O File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
using HidLibrary; | ||
using System; | ||
using System.Linq; | ||
using System.Windows.Media; | ||
using static HandheldCompanion.Utils.DeviceUtils; | ||
|
||
namespace HandheldCompanion.Devices; | ||
|
||
public class AOKZOEA2 : AOKZOEA1Pro | ||
{ | ||
HidDevice hidDevice; | ||
|
||
public AOKZOEA2() | ||
{ | ||
// device specific settings | ||
ProductModel = "AOKZOEA2"; | ||
|
||
// device specific capacities | ||
Capabilities |= DeviceCapabilities.DynamicLighting; | ||
Capabilities |= DeviceCapabilities.DynamicLightingBrightness; | ||
DynamicLightingCapabilities |= LEDLevel.SolidColor; | ||
DynamicLightingCapabilities |= LEDLevel.Rainbow; | ||
|
||
// LED HID Device | ||
_vid = 0x1A2C; | ||
_pid = 0xB001; | ||
} | ||
public override bool IsReady() | ||
{ | ||
// Prepare list for all HID devices | ||
HidDevice[] HidDeviceList = HidDevices.Enumerate(_vid, new int[] { _pid }).ToArray(); | ||
|
||
// Check every HID device to find LED device | ||
foreach (HidDevice device in HidDeviceList) | ||
{ | ||
// OneXFly device for LED control does not support a FeatureReport, hardcoded to match the Interface Number | ||
if (device.IsConnected && device.DevicePath.Contains("&mi_00")) | ||
{ | ||
hidDevice = device; | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public override bool SetLedBrightness(int brightness) | ||
{ | ||
// OneXFly brightness range is: 0 - 4 range, 0 is off, convert from 0 - 100 % range | ||
brightness = (int)Math.Round(brightness / 20.0); | ||
|
||
// Check if device is availible | ||
if (hidDevice is null || !hidDevice.IsConnected) | ||
return false; | ||
|
||
// Define the HID message for setting brightness. | ||
byte[] msg = { 0x00, 0x07, 0xFF, 0xFD, 0x01, 0x05, (byte)brightness }; | ||
|
||
// Write the HID message to set the LED brightness. | ||
hidDevice.Write(msg); | ||
|
||
return true; | ||
} | ||
|
||
public override bool SetLedColor(Color mainColor, Color secondaryColor, LEDLevel level, int speed = 100) | ||
{ | ||
if (!DynamicLightingCapabilities.HasFlag(level)) | ||
return false; | ||
|
||
// Data message consists of a prefix, LED option, RGB data, and closing byte (0x00) | ||
byte[] prefix = { 0x00, 0x07, 0xFF }; | ||
byte[] LEDOption = { 0x00 }; | ||
byte[] rgbData = { 0x00 }; | ||
|
||
// Perform functions and command build-up based on LED level | ||
switch (level) | ||
{ | ||
case LEDLevel.SolidColor: | ||
// Find nearest possible color due to RGB limitations of the device | ||
Color ledColor = FindClosestColor(mainColor); | ||
|
||
LEDOption = new byte[] { 0xFE }; | ||
|
||
// RGB data repeats 20 times, fill accordingly | ||
rgbData = Enumerable.Repeat(new[] { ledColor.R, ledColor.G, ledColor.B }, 20) | ||
.SelectMany(colorBytes => colorBytes) | ||
.ToArray(); | ||
break; | ||
|
||
case LEDLevel.Rainbow: | ||
// OneXConsole "Flowing Light" effect as a rainbow effect | ||
LEDOption = new byte[] { 0x03 }; | ||
|
||
// RGB data empty, repeats 60 times, fill accordingly | ||
rgbData = Enumerable.Repeat((byte)0x00, 60).ToArray(); | ||
break; | ||
|
||
default: | ||
return false; | ||
} | ||
|
||
// Check if device is availible | ||
if (hidDevice is null || !hidDevice.IsConnected) | ||
return false; | ||
|
||
// Combine prefix, LED Option, RGB data, and closing byte (0x00) | ||
byte[] msg = prefix.Concat(LEDOption).Concat(rgbData).Concat(new byte[] { 0x00 }).ToArray(); | ||
|
||
// Write the HID message to set the RGB color effect | ||
hidDevice.Write(msg); | ||
|
||
return true; | ||
} | ||
|
||
static Color FindClosestColor(Color inputColor) | ||
{ | ||
// Predefined colors that work on the device | ||
Color[] predefinedColors = new Color[] | ||
{ | ||
Color.FromRgb(255, 0, 0), // Red (255,0,0) | ||
Color.FromRgb(255, 82, 0), // Orange (255, 165, 0) | ||
Color.FromRgb(255, 255, 0), // Yellow (255, 255, 0) | ||
Color.FromRgb(130, 255, 0), // Lime Green (50, 205, 50) | ||
Color.FromRgb(0, 255, 0), // Green (0, 128, 0) | ||
Color.FromRgb(0, 255, 110), // Turquoise (Cyan) (0, 255, 255) | ||
Color.FromRgb(0, 255, 255), // Teal (0, 128, 128) | ||
Color.FromRgb(130, 255, 255), // Blue (? ? ?) | ||
Color.FromRgb(0, 0, 255), // Dark Blue (? ? ?) | ||
Color.FromRgb(122, 0, 255), // Purple (Violet) (128, 0, 128) | ||
Color.FromRgb(255, 0, 255), // Pink (255, 182, 193) | ||
Color.FromRgb(255, 0, 129), // Magenta (255, 0, 255) | ||
}; | ||
|
||
// Initialize with the first color | ||
Color closestColor = predefinedColors[0]; | ||
double minDistance = CalculateDistance(inputColor, closestColor); | ||
|
||
// Iterate through predefined colors to find the closest one | ||
foreach (var predefinedColor in predefinedColors) | ||
{ | ||
double distance = CalculateDistance(inputColor, predefinedColor); | ||
|
||
// Update closest color if a closer one is found | ||
if (distance < minDistance) | ||
{ | ||
minDistance = distance; | ||
closestColor = predefinedColor; | ||
} | ||
} | ||
|
||
// Return the closest predefined color | ||
return closestColor; | ||
} | ||
|
||
static double CalculateDistance(Color color1, Color color2) | ||
{ | ||
// Helper method to calculate the Euclidean distance between two colors | ||
|
||
int deltaR = color2.R - color1.R; | ||
int deltaG = color2.G - color1.G; | ||
int deltaB = color2.B - color1.B; | ||
|
||
// Euclidean distance formula | ||
return Math.Sqrt(deltaR * deltaR + deltaG * deltaG + deltaB * deltaB); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review asynchronous task handling and device management.
The asynchronous handling of device reports and the management of device connections could be improved for better error handling and resource management.
Additionally, consider handling exceptions and ensuring that devices are properly released if an error occurs or the device is disconnected.
Also applies to: 389-399