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

EA to public #1070

Merged
merged 73 commits into from
May 31, 2024
Merged

EA to public #1070

merged 73 commits into from
May 31, 2024

Conversation

CasperH2O
Copy link
Collaborator

@CasperH2O CasperH2O commented May 31, 2024

Summary by CodeRabbit

  • Bug Fixes

    • Corrected typos and updated labels in bug report and feature request templates.
    • Improved setup configuration and dependency management.
    • Fixed issues related to controller settings and input handling.
  • New Features

    • Added GPU telemetry and control methods.
    • Introduced new settings for UI sounds and on-screen display levels.
    • Enhanced controller support with new initialization and input processing methods.
  • Refactor

    • Streamlined controller input update methods to include delta parameters.
    • Updated constructors and initialization methods for better performance and maintainability.
  • Style

    • Improved code readability and structure in various controller files.

Copy link
Contributor

coderabbitai bot commented May 31, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

This update brings a comprehensive set of changes to the Handheld Companion project, encompassing bug fixes, feature enhancements, and significant updates to device support and setup configurations. Key modifications include adjustments to issue templates, extensive setup script updates, improvements in controller handling, and the introduction of new telemetry and control features for GPUs.

Changes

File(s) Change Summary
.github/ISSUE_TEMPLATE/bug_report.md Changed label from bug to Bug, added LENOVO and MSI to device labels, corrected a typo.
.github/ISSUE_TEMPLATE/feature_request.md Updated labels field from enhancement to Enhancement.
HandheldCompanion.iss Major updates to setup configuration, dependency management, and installation procedures.
HandheldCompanion/ADLX/ADLXBackend.cs Added new static class ADLXBackend for GPU telemetry and control.
HandheldCompanion/Actions/GyroActions.cs Changed MotionInput property from JoystickCamera to LocalSpace.
HandheldCompanion/App.config Modified various settings including OverlayRenderAntialiasing, QuickToolsLocation, and added new UI and OSD settings.
HandheldCompanion/App.xaml Added new namespace declaration, updated theme resources, and included new converters.
HandheldCompanion/App.xaml.cs Added IsMultiThreaded property, environment variable settings, and exception logging.
HandheldCompanion/Controllers/... Updated various controller classes (DInputController, DS4Controller, DualSenseController, GordonController, JSController, LegionController, NeptuneController, ProController, SteamController) to include new parameters, methods, and refactored logic for input updates and initialization.
HandheldCompanion/Controls/ProcessEx.cs Various changes related to process handling and control.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant App
    participant ADLXBackend
    participant GPU

    User->>App: Launch Handheld Companion
    App->>ADLXBackend: Initialize ADLX
    ADLXBackend->>GPU: Fetch Telemetry Data
    GPU-->>ADLXBackend: Return Data
    ADLXBackend-->>App: Provide Telemetry Data
    App-->>User: Display GPU Telemetry
Loading

Poem

🐇✨
In the realm of code so bright,
Controllers dance, settings take flight.
Bugs squashed, features bloom,
Handheld Companion, no more gloom.
With telemetry clear and dependencies set,
A rabbit's joy, a coder's bet.
🌟🐰


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 14

Outside diff range and nitpick comments (5)
HandheldCompanion/Controllers/GordonController.cs (1)

Line range hint 88-224: Complex method UpdateInputs needs refactoring.

This method is quite long and handles multiple responsibilities. Consider breaking it down into smaller methods, each handling a specific part of the input update process.

- public override void UpdateInputs(long ticks, float delta)
+ private void UpdateButtonStates()
+ private void UpdateAxisStates()
+ private void ProcessMotion()
+ public override void UpdateInputs(long ticks, float delta)
{
    UpdateButtonStates();
    UpdateAxisStates();
    ProcessMotion();
}
HandheldCompanion/Controllers/XInputController.cs (1)

Line range hint 57-124: Method UpdateInputs handles multiple responsibilities.

This method is lengthy and handles various aspects of input processing. Consider refactoring it into smaller, more focused methods.

- public virtual void UpdateInputs(long ticks, float delta, bool commit)
+ private void UpdateGamepadState()
+ private void UpdateButtonStates()
+ private void UpdateAxisStates()
+ public virtual void UpdateInputs(long ticks, float delta, bool commit)
{
    UpdateGamepadState();
    UpdateButtonStates();
    UpdateAxisStates();
    if (commit) base.UpdateInputs(ticks, delta);
}
HandheldCompanion/Controllers/IController.xaml.cs (1)

71-71: Use a resource dictionary for UI constants.

Instead of hardcoding UI constants like font families and glyphs, consider using a resource dictionary. This allows for easier theming and localization.

Also applies to: 72-72

HandheldCompanion.iss (2)

166-167: Ensure consistency in naming conventions.

The procedure Dependency_Add_With_Version uses underscores in its name, which is inconsistent with other procedure names that use camel case. Consider renaming to DependencyAddWithVersion to maintain consistency.


Line range hint 390-441: Refactor to reduce duplication in Dependency_Add and Dependency_Add_With_Version.

There is significant code duplication between Dependency_Add and Dependency_Add_With_Version. Consider extracting common code into a helper function to improve maintainability and reduce potential errors.

+ function AddDependencyCommon(Dependency: TDependency_Entry): Integer;
+ begin
+   DependencyCount := GetArrayLength(Dependency_List);
+   SetArrayLength(Dependency_List, DependencyCount + 1);
+   Dependency_List[DependencyCount] := Dependency;
+   return DependencyCount;
+ end;

-  DependencyCount := GetArrayLength(Dependency_List);
-  SetArrayLength(Dependency_List, DependencyCount + 1);
-  Dependency_List[DependencyCount] := Dependency;
+  AddDependencyCommon(Dependency);
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 761130a and 9bb8b96.

Files ignored due to path filters (20)
  • HandheldCompanion/ADLX_3DSettings.dll is excluded by !**/*.dll
  • HandheldCompanion/ADLX_DisplaySettings.dll is excluded by !**/*.dll
  • HandheldCompanion/ADLX_Wrapper.dll is excluded by !**/*.dll
  • HandheldCompanion/GamepadMotion.dll is excluded by !**/*.dll
  • HandheldCompanion/IGCL_Wrapper.dll is excluded by !**/*.dll
  • HandheldCompanion/Resources/device_aya_flip_ds.png is excluded by !**/*.png
  • HandheldCompanion/Resources/device_aya_flip_kb.png is excluded by !**/*.png
  • HandheldCompanion/Resources/device_aya_slide.png is excluded by !**/*.png
  • HandheldCompanion/Resources/device_gpd_winmini.png is excluded by !**/*.png
  • HandheldCompanion/Resources/device_msi_claw.png is excluded by !**/*.png
  • HandheldCompanion/Resources/device_onexplayer_x1.png is excluded by !**/*.png
  • HandheldCompanion/Resources/libryzenadj.dll is excluded by !**/*.dll
  • HandheldCompanion/SapientiaUsb.dll is excluded by !**/*.dll
  • HandheldCompanion/UI/Audio/bong_001.ogg is excluded by !**/*.ogg
  • HandheldCompanion/UI/Audio/drop_001.ogg is excluded by !**/*.ogg
  • HandheldCompanion/UI/Audio/drop_002.ogg is excluded by !**/*.ogg
  • HandheldCompanion/UI/Audio/glitch_004.ogg is excluded by !**/*.ogg
  • HandheldCompanion/UI/Audio/switch_004.ogg is excluded by !**/*.ogg
  • HandheldCompanion/UI/Audio/switch_005.ogg is excluded by !**/*.ogg
  • HandheldCompanion/UI/Audio/switch_007.ogg is excluded by !**/*.ogg
Files selected for processing (54)
  • .github/ISSUE_TEMPLATE/bug_report.md (2 hunks)
  • .github/ISSUE_TEMPLATE/feature_request.md (1 hunks)
  • HandheldCompanion.iss (12 hunks)
  • HandheldCompanion/ADLX/ADLXBackend.cs (1 hunks)
  • HandheldCompanion/Actions/GyroActions.cs (1 hunks)
  • HandheldCompanion/App.config (5 hunks)
  • HandheldCompanion/App.xaml (2 hunks)
  • HandheldCompanion/App.xaml.cs (4 hunks)
  • HandheldCompanion/Controllers/DInputController.cs (2 hunks)
  • HandheldCompanion/Controllers/DS4Controller.cs (6 hunks)
  • HandheldCompanion/Controllers/DualSenseController.cs (5 hunks)
  • HandheldCompanion/Controllers/GordonController.cs (6 hunks)
  • HandheldCompanion/Controllers/IController.xaml (4 hunks)
  • HandheldCompanion/Controllers/IController.xaml.cs (15 hunks)
  • HandheldCompanion/Controllers/JSController.cs (6 hunks)
  • HandheldCompanion/Controllers/LegionController.cs (1 hunks)
  • HandheldCompanion/Controllers/NeptuneController.cs (7 hunks)
  • HandheldCompanion/Controllers/ProController.cs (1 hunks)
  • HandheldCompanion/Controllers/SteamController.cs (2 hunks)
  • HandheldCompanion/Controllers/XInputController.cs (4 hunks)
  • HandheldCompanion/Controls/Hints/Hint_AMD_IntegerScalingCheck.cs (3 hunks)
  • HandheldCompanion/Controls/Hints/Hint_CoreIsolationCheck.cs (3 hunks)
  • HandheldCompanion/Controls/Hints/Hint_LegionGoLegionSpace.cs (4 hunks)
  • HandheldCompanion/Controls/Hints/Hint_MSIClawCenter.cs (1 hunks)
  • HandheldCompanion/Controls/Hints/Hint_RogAllyServiceCheck.cs (5 hunks)
  • HandheldCompanion/Controls/Hints/Hint_SteamNeptuneDesktop.cs (1 hunks)
  • HandheldCompanion/Controls/Hints/Hint_SteamXboxDrivers.cs (1 hunks)
  • HandheldCompanion/Controls/ProcessEx.cs (1 hunks)
  • HandheldCompanion/Converters/InverseBooleanToVisibilityConverter.cs (1 hunks)
  • HandheldCompanion/Converters/InvertPercentageConverter.cs (1 hunks)
  • HandheldCompanion/Converters/IsNullConverter.cs (1 hunks)
  • HandheldCompanion/DSU/DSUServer.cs (2 hunks)
  • HandheldCompanion/Devices/AOKZOE/AOKZOEA1.cs (2 hunks)
  • HandheldCompanion/Devices/AOKZOE/AOKZOEA2.cs (1 hunks)
  • HandheldCompanion/Devices/ASUS/ROGAlly.cs (8 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEO2.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEO2021.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEO2021Pro.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEO2S.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOAIR.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOAIR1S.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOAIRLite.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOAIRPlus.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOAIRPlusAMD.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOAIRPlusAMDMendocino.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOAIRPlusIntel.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOAIRPro.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEODevice.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEODeviceCEc.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEODeviceCEii.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOFlipDS.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOFlipKB.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEOKUN.cs (1 hunks)
  • HandheldCompanion/Devices/AYANEO/AYANEONEXT.cs (1 hunks)
Files not processed due to max files limit (61)
  • HandheldCompanion/Devices/AYANEO/AYANEONEXTLite.cs
  • HandheldCompanion/Devices/AYANEO/AYANEONEXTLite4500U.cs
  • HandheldCompanion/Devices/AYANEO/AYANEOSLIDE.cs
  • HandheldCompanion/Devices/Ayn/AynLoki.cs
  • HandheldCompanion/Devices/DefaultDevice.cs
  • HandheldCompanion/Devices/GPD/GPDWin3.cs
  • HandheldCompanion/Devices/GPD/GPDWin4-2023-7840U.cs
  • HandheldCompanion/Devices/GPD/GPDWin4-2024-8640U.cs
  • HandheldCompanion/Devices/GPD/GPDWin4-2024-8840U.cs
  • HandheldCompanion/Devices/GPD/GPDWin4.cs
  • HandheldCompanion/Devices/GPD/GPDWinMax2AMD.cs
  • HandheldCompanion/Devices/GPD/GPDWinMax2Intel.cs
  • HandheldCompanion/Devices/GPD/GPDWinMini-7640U.cs
  • HandheldCompanion/Devices/GPD/GPDWinMini-7840U.cs
  • HandheldCompanion/Devices/IDevice.cs
  • HandheldCompanion/Devices/Lenovo/LegionGo.cs
  • HandheldCompanion/Devices/Lenovo/SapientiaUsb.cs
  • HandheldCompanion/Devices/MSI/ClawA1M.cs
  • HandheldCompanion/Devices/OneXPlayer/OneXPlayer2.cs
  • HandheldCompanion/Devices/OneXPlayer/OneXPlayerMini.cs
  • HandheldCompanion/Devices/OneXPlayer/OneXPlayerMiniAMD.cs
  • HandheldCompanion/Devices/OneXPlayer/OneXPlayerMiniIntel.cs
  • HandheldCompanion/Devices/OneXPlayer/OneXPlayerMiniPro.cs
  • HandheldCompanion/Devices/OneXPlayer/OneXPlayerOneXFly.cs
  • HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1.cs
  • HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1AMD.cs
  • HandheldCompanion/Devices/OneXPlayer/OneXPlayerX1Intel.cs
  • HandheldCompanion/Devices/Valve/SteamDeck.cs
  • HandheldCompanion/Extensions/GlyphExtensions.cs
  • HandheldCompanion/Extensions/ManagementObjectSearcherExtensions.cs
  • HandheldCompanion/Extensions/UIThreadExtensions.cs
  • HandheldCompanion/GraphicsProcessingUnit/AMDGPU.cs
  • HandheldCompanion/GraphicsProcessingUnit/GPU.cs
  • HandheldCompanion/GraphicsProcessingUnit/IntelGPU.cs
  • HandheldCompanion/HandheldCompanion.csproj
  • HandheldCompanion/HandheldCompanion.json
  • HandheldCompanion/Helpers/GamepadMotion.cs
  • HandheldCompanion/Helpers/VangoghGPU.cs
  • HandheldCompanion/IGCL/IGCLBackend.cs
  • HandheldCompanion/Inputs/AxisState.cs
  • HandheldCompanion/Inputs/ButtonFlags.cs
  • HandheldCompanion/Inputs/ButtonState.cs
  • HandheldCompanion/Inputs/GyroState.cs
  • HandheldCompanion/Managers/ControllerManager.cs
  • HandheldCompanion/Managers/Desktop/DesktopScreen.cs
  • HandheldCompanion/Managers/DeviceManager.cs
  • HandheldCompanion/Managers/DynamicLightingManager.cs
  • HandheldCompanion/Managers/GPUManager.cs
  • HandheldCompanion/Managers/Hotkeys/Hotkey.cs
  • HandheldCompanion/Managers/Hotkeys/InputsHotkey.cs
  • HandheldCompanion/Managers/HotkeysManager.cs
  • HandheldCompanion/Managers/InputsManager.cs
  • HandheldCompanion/Managers/LayoutManager.cs
  • HandheldCompanion/Managers/MotionManager.cs
  • HandheldCompanion/Managers/MultimediaManager.cs
  • HandheldCompanion/Managers/OSDManager.cs
  • HandheldCompanion/Managers/PerformanceManager.cs
  • HandheldCompanion/Managers/PlatformManager.cs
  • HandheldCompanion/Managers/PowerManager.cs
  • HandheldCompanion/Managers/PowerProfileManager.cs
  • HandheldCompanion/Managers/ProcessManager.cs
Files not reviewed due to errors (3)
  • HandheldCompanion/Devices/AYANEO/AYANEOKUN.cs (no review received)
  • HandheldCompanion/Devices/AYANEO/AYANEOAIR.cs (no review received)
  • HandheldCompanion/Devices/AYANEO/AYANEONEXT.cs (no review received)
Files skipped from review due to trivial changes (6)
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/feature_request.md
  • HandheldCompanion/Devices/AYANEO/AYANEO2S.cs
  • HandheldCompanion/Devices/AYANEO/AYANEOAIRLite.cs
  • HandheldCompanion/Devices/AYANEO/AYANEOAIRPlusAMD.cs
  • HandheldCompanion/Devices/AYANEO/AYANEOAIRPro.cs
Additional comments not posted (110)
HandheldCompanion/Devices/AYANEO/AYANEO2021Pro.cs (4)

8-8: Initialization of nTDP looks correct and consistent with device specifications.


9-9: Initialization of cTDP looks correct and consistent with device specifications.


10-10: Initialization of GfxClock looks correct and consistent with device specifications.


11-11: Initialization of CpuClock looks correct and consistent with device specifications.

HandheldCompanion/Devices/AYANEO/AYANEOAIRPlusAMDMendocino.cs (5)

8-8: Initialization of nTDP looks correct and consistent with device specifications.


9-9: Initialization of cTDP looks correct and consistent with device specifications.


10-10: Initialization of GfxClock looks correct and consistent with device specifications.


11-11: Initialization of CpuClock looks correct and consistent with device specifications.


13-13: Initialization of ECDetails.AddressFanDuty looks correct and consistent with device specifications.

HandheldCompanion/Devices/AYANEO/AYANEOAIRPlusIntel.cs (5)

8-8: Initialization of nTDP looks correct and consistent with device specifications.


9-9: Initialization of cTDP looks correct and consistent with device specifications.


10-10: Initialization of GfxClock looks correct and consistent with device specifications.


11-11: Initialization of CpuClock looks correct and consistent with device specifications.


13-13: Initialization of ECDetails.AddressFanDuty looks correct and consistent with device specifications.

HandheldCompanion/Converters/InvertPercentageConverter.cs (2)

9-12: The Convert method correctly calculates the inverted percentage, which is consistent with the expected functionality.


14-17: The ConvertBack method correctly calculates the inverted percentage, which is consistent with the expected functionality.

HandheldCompanion/Devices/AYANEO/AYANEO2.cs (6)

8-8: Initialization of ProductIllustration looks correct and specific to the AYANEO2 model.


9-9: Initialization of ProductModel looks correct and specific to the AYANEO2 model.


12-12: Initialization of nTDP looks correct and consistent with device specifications.


13-13: Initialization of cTDP looks correct and consistent with device specifications.


14-14: Initialization of GfxClock looks correct and consistent with device specifications.


15-15: Initialization of CpuClock looks correct and consistent with device specifications.

HandheldCompanion/Converters/IsNullConverter.cs (2)

9-14: The Convert method correctly handles null checks and zero checks, which is consistent with the expected functionality.


17-20: The ConvertBack method correctly throws an exception to indicate that it should not be used for reverse conversion, adhering to best practices.

HandheldCompanion/Devices/AYANEO/AYANEOFlipDS.cs (1)

12-13: The removal of DeviceCapabilities.DynamicLighting and DeviceCapabilities.DynamicLightingBrightness seems appropriate given the device specifics.

HandheldCompanion/Devices/AYANEO/AYANEOFlipKB.cs (1)

15-21: The updated device specifications with links to AMD products are clear and well-documented.

HandheldCompanion/Devices/AYANEO/AYANEOAIRPlus.cs (1)

15-29: The updates to the gyrometer and accelerometer settings, including axis definitions and swaps, are well-implemented using SortedDictionary for maintaining order.

HandheldCompanion/Actions/GyroActions.cs (1)

10-10: The updates to the default settings for motion input properties, including the use of constants for default values, are well-implemented and enhance maintainability.

HandheldCompanion/Devices/AYANEO/AYANEODevice.cs (1)

9-36: The addition of the LEDGroup enum and updates to glyph mappings using Unicode characters are well-implemented and enhance clarity and maintainability.

HandheldCompanion/Controls/Hints/Hint_SteamXboxDrivers.cs (1)

37-37: The update to UI visibility based on Xbox driver installation status using Dispatcher.Invoke for thread safety is well-implemented.

HandheldCompanion/Controllers/DInputController.cs (2)

11-11: Formatting changes in the constructor look good.


45-47: The addition of the float delta parameter in UpdateInputs method aligns with the PR objectives for enhanced input handling.

#!/bin/bash
# Description: Verify that all controller classes have the `UpdateInputs` method updated to include the `float delta` parameter.

# Test: Search for the method signature in all controller classes. Expect: All occurrences should include the `float delta` parameter.
rg --type cs "public override void UpdateInputs\(long ticks, float delta\)" --files-with-matches
HandheldCompanion/Devices/AYANEO/AYANEOAIR1S.cs (2)

12-15: Updated device specifications (nTDP, cTDP, GfxClock, CpuClock) appear accurate and reflect the hardware details.


17-37: Addition of new OEM chords for custom key mappings is consistent with device-specific configurations.

#!/bin/bash
# Description: Verify that similar devices have consistent logic for OEM chords.

# Test: Search for OEM chord logic in similar device classes. Expect: Consistent logic and structure.
rg --type cs "OEMChords.Add" --files-with-matches
HandheldCompanion/Converters/InverseBooleanToVisibilityConverter.cs (2)

18-31: Implementation of the Convert method in InverseBooleanToVisibilityConverter follows standard practices for visibility conversion in UI frameworks.


42-47: The ConvertBack method correctly implements the reverse of the Convert method, providing flexibility in data binding scenarios.

#!/bin/bash
# Description: Verify that the `ConvertBack` method is used consistently across the project where needed.

# Test: Search for usage of `ConvertBack` in data binding scenarios. Expect: Consistent and correct usage.
rg --type xaml "InverseBooleanToVisibilityConverter" --files-with-matches
HandheldCompanion/Controls/Hints/Hint_SteamNeptuneDesktop.cs (1)

31-31: Ensure UI updates are performed on the UI thread.

This change correctly uses Dispatcher.Invoke to update UI elements from a non-UI thread, which is a best practice in WPF to avoid threading issues.

HandheldCompanion/Devices/AYANEO/AYANEO2021.cs (1)

16-20: Validate hardware specifications.

#!/bin/bash
# Description: Verify the hardware specifications for AYANEO2021.

# Test: Search for official specs. Expect: Match the hardcoded values.
rg --type markdown 'AYANEO2021 specs' README.md

Ensure the hardcoded values for nTDP, cTDP, GfxClock, and CpuClock match the official specifications for the AYANEO2021 device.

HandheldCompanion/Controllers/ProController.cs (2)

16-16: Ensure controller-specific initialization is comprehensive.

The addition of Special2 and Gyroscope to SourceButtons and SourceAxis respectively ensures that all relevant inputs are considered during initialization.


23-33: Check for controller connection before updating inputs.

The check if (!IsConnected()) return; is a good practice to ensure that the controller is connected before attempting to update its state.

HandheldCompanion/Controls/Hints/Hint_AMD_IntegerScalingCheck.cs (2)

45-45: Ensure UI updates are performed on the UI thread.

This change correctly uses Dispatcher.Invoke to update UI elements from a non-UI thread, which is a best practice in WPF to avoid threading issues.


55-66: Handle dialog results properly in asynchronous context.

The use of await dialogTask; followed by a switch on dialogTask.Result is a correct pattern for handling dialog results asynchronously in WPF.

HandheldCompanion/Controls/Hints/Hint_RogAllyServiceCheck.cs (2)

27-27: Validate device type before proceeding.

The check if (IDevice.GetCurrent() is not ROGAlly) ensures that the hint is only active for ROG Ally devices, which is a good practice to avoid unnecessary operations on non-target devices.


79-79: Ensure UI updates are performed on the UI thread.

This change correctly uses Dispatcher.Invoke to update UI elements from a non-UI thread, which is a best practice in WPF to avoid threading issues.

HandheldCompanion/Controls/Hints/Hint_MSIClawCenter.cs (1)

100-104: Ensure UI updates are performed on the UI thread.

This change correctly uses Dispatcher.Invoke to update UI elements from a non-UI thread, which is a best practice in WPF to avoid threading issues.

HandheldCompanion/Devices/AOKZOE/AOKZOEA1.cs (3)

21-21: Ensure that the CpuClock value of 4700 is validated against the device's specifications.

#!/bin/bash
# Description: Verify if the CpuClock value is within the supported range for the AOKZOEA1 device.

# Test: Search for device specifications. Expect: CpuClock value within the supported range.
cat specs/AOKZOEA1.md | grep "CpuClock"

31-31: Ensure that the accelerometer axis configuration matches the physical layout and orientation of the device.

#!/bin/bash
# Description: Verify the accelerometer axis configuration for the AOKZOEA1 device.

# Test: Search for device orientation specifications. Expect: Accelerometer axis configuration matches the physical layout.
cat specs/AOKZOEA1.md | grep "AccelerometerAxis"

130-130: Ensure that the overridden GetGlyph method correctly handles all possible ButtonFlags values.

#!/bin/bash
# Description: Verify that all ButtonFlags values are handled in the GetGlyph method.

# Test: Search for ButtonFlags usage in the codebase. Expect: All values handled in GetGlyph.
rg --type cs "ButtonFlags" --files-with-matches | xargs cat | grep "GetGlyph"
HandheldCompanion/Controls/Hints/Hint_LegionGoLegionSpace.cs (2)

33-33: Ensure that the service initialization logic is robust and handles exceptions appropriately.

#!/bin/bash
# Description: Verify the robustness of service initialization logic in Hint_LegionGoLegionSpace.

# Test: Search for exception handling patterns in the constructor. Expect: Adequate exception handling.
rg --type cs "try" "Hint_LegionGoLegionSpace.cs"

85-85: Ensure that the UI update logic in ServiceTimer_Elapsed is thread-safe and does not cause any race conditions.

#!/bin/bash
# Description: Verify the thread safety of UI update logic in ServiceTimer_Elapsed.

# Test: Search for locking mechanisms around UI updates. Expect: Adequate synchronization.
rg --type cs "lock" "Hint_LegionGoLegionSpace.cs"
HandheldCompanion/App.xaml.cs (4)

19-19: Verify that the IsMultiThreaded property is used consistently across the application to manage threading behavior.

#!/bin/bash
# Description: Verify the usage of the IsMultiThreaded property across the application.

# Test: Search for IsMultiThreaded usage in the codebase. Expect: Consistent usage.
rg --type cs "IsMultiThreaded" --files-with-matches | xargs cat | grep "IsMultiThreaded"

42-42: Ensure that the environment variable APP_BASE_DIRECTORY is used securely and does not expose sensitive information.

#!/bin/bash
# Description: Verify the security of the APP_BASE_DIRECTORY environment variable usage.

# Test: Search for APP_BASE_DIRECTORY usage in the codebase. Expect: Secure usage.
rg --type cs "APP_BASE_DIRECTORY" --files-with-matches | xargs cat | grep "APP_BASE_DIRECTORY"

53-71: Ensure that the logic for handling multiple instances of the application is robust and correctly manages process focus and termination.

#!/bin/bash
# Description: Verify the robustness of the logic for handling multiple instances of the application.

# Test: Search for process management patterns in the codebase. Expect: Adequate handling of multiple instances.
rg --type cs "Process" "App.xaml.cs"

118-121: Ensure that the exception handling in Application_ThreadException logs all relevant information and does not miss any critical details.

#!/bin/bash
# Description: Verify the completeness of exception logging in Application_ThreadException.

# Test: Search for logging patterns in the exception handling code. Expect: Comprehensive logging.
rg --type cs "Log" "App.xaml.cs"
HandheldCompanion/Devices/AYANEO/AYANEODeviceCEii.cs (3)

64-75: Ensure that the SetFanDuty method correctly calculates the fan duty cycle and writes the correct value to the EC RAM.

#!/bin/bash
# Description: Verify the correctness of the fan duty cycle calculation in SetFanDuty.

# Test: Search for fan duty cycle calculation logic. Expect: Correct calculation and EC RAM write.
rg --type cs "SetFanDuty" "AYANEODeviceCEii.cs"

78-88: Verify that the SetFanControl method handles the fan control logic securely and does not allow unauthorized modifications.

#!/bin/bash
# Description: Verify the security of the fan control logic in SetFanControl.

# Test: Search for security checks in the fan control logic. Expect: Adequate security measures.
rg --type cs "SetFanControl" "AYANEODeviceCEii.cs"

90-100: Ensure that the CEcControl_RgbI2cWrite method correctly handles RGB control commands and writes the appropriate values to the EC.

#!/bin/bash
# Description: Verify the correctness of RGB control commands in CEcControl_RgbI2cWrite.

# Test: Search for RGB control command logic. Expect: Correct command handling and EC write.
rg --type cs "CEcControl_RgbI2cWrite" "AYANEODeviceCEii.cs"
HandheldCompanion/Controls/Hints/Hint_CoreIsolationCheck.cs (2)

62-62: Ensure that the UI update logic in CheckSettings is thread-safe and does not cause any race conditions.

#!/bin/bash
# Description: Verify the thread safety of UI update logic in CheckSettings.

# Test: Search for locking mechanisms around UI updates. Expect: Adequate synchronization.
rg --type cs "lock" "Hint_CoreIsolationCheck.cs"

73-84: Verify that the dialog handling logic in HintActionButton_Click correctly manages user responses and performs the appropriate actions based on the dialog result.

#!/bin/bash
# Description: Verify the correctness of dialog handling logic in HintActionButton_Click.

# Test: Search for dialog handling patterns in the codebase. Expect: Correct management of user responses.
rg --type cs "Dialog" "Hint_CoreIsolationCheck.cs"
HandheldCompanion/App.xaml (1)

14-14: Ensure that the ThemeResources resource dictionary is correctly configured to be accessed across threads as specified by the IsMultiThreaded property.

#!/bin/bash
# Description: Verify the thread safety of the ThemeResources resource dictionary configuration.

# Test: Search for ThemeResources usage in the codebase. Expect: Correct thread safety configuration.
rg --type xaml "ThemeResources" --files-with-matches | xargs cat | grep "ThemeResources"
HandheldCompanion/Controllers/DS4Controller.cs (5)

12-12: Consider removing the empty constructor if it's not required, or add a comment explaining its necessity.
[REFACTOR_SUGGESTion]


21-21: Ensure that the constructor initializes all necessary fields to prevent any uninitialized state issues.


23-24: Ensure that all added buttons and axes are necessary and correctly mapped to the DS4 controller's capabilities.


Line range hint 43-87: Verify that the touch inputs and button states are correctly handled and mapped. Consider adding error handling for potential failures in touch input retrieval.


109-109: Ensure that the RGB to integer conversion is correctly implemented in CommonUtils.rgb_to_int to prevent color inaccuracies.

HandheldCompanion/Controllers/DualSenseController.cs (4)

14-20: Ensure that the constructor initializes all necessary fields to prevent any uninitialized state issues.


23-23: Ensure that all added buttons and axes are necessary and correctly mapped to the DualSense controller's capabilities.


Line range hint 43-87: Verify that the touch inputs and button states are correctly handled and mapped. Consider adding error handling for potential failures in touch input retrieval.


109-109: Ensure that the RGB to integer conversion is correctly implemented in CommonUtils.rgb_to_int to prevent color inaccuracies.

HandheldCompanion/Devices/AOKZOE/AOKZOEA2.cs (5)

13-27: Ensure that the device-specific settings and capabilities are correctly initialized and that the VID and PID are accurate for the AOKZOEA2 device.


28-45: Verify that the method correctly identifies the connected LED device and handles cases where multiple devices could match the criteria.


47-63: Ensure that the brightness conversion from percentage to device-specific range is accurate and consider handling cases where the device is not connected.


65-113: Verify that the LED color setting functionality correctly handles different LED levels and properly constructs the HID message.


115-165: Ensure that the color distance calculation is accurate and that the method correctly identifies the closest predefined color.

HandheldCompanion/Controllers/JSController.cs (2)

51-53: Ensure that the base method UpdateInputs is correctly overridden to handle specific controller inputs.


Line range hint 56-123: Verify that the state update logic correctly handles button states, triggers, and motion inputs. Consider adding error handling for potential input retrieval failures.

HandheldCompanion/Controllers/IController.xaml (3)

8-8: Ensure that the added namespaces and resources are necessary for the UI components and correctly referenced.


28-99: Verify that the UI elements are correctly aligned and styled according to the design specifications. Consider accessibility and usability aspects.


Line range hint 110-141: Ensure that the button configurations and visibility settings are correctly implemented to provide a consistent and functional user experience.

HandheldCompanion/Controls/ProcessEx.cs (2)

126-144: Verify that the fullscreen optimization and DPI awareness properties correctly reflect the application compatibility settings.


146-226: Ensure that the process suspension and refresh logic correctly handles thread states and disposes of resources to prevent memory leaks.

HandheldCompanion/Controllers/SteamController.cs (3)

16-19: Constructor changes look good. Proper initialization of settings and event subscription.


26-29: The UpdateSettings method is well-implemented for updating the mute state based on settings.


31-38: Effective handling of settings changes in SettingsManager_SettingValueChanged.

HandheldCompanion/ADLX/ADLXBackend.cs (2)

10-52: The AdlxTelemetryData struct is well-structured and covers a comprehensive range of GPU telemetry data.


73-126: The GPU control and telemetry methods are correctly implemented using P/Invoke, ensuring proper interaction with the native library.

HandheldCompanion/App.config (3)

84-84: Change in OverlayRenderAntialiasing from False to True is approved. Consider documenting this change or making it configurable if it significantly impacts performance.


248-277: Addition of new settings for UI sounds and on-screen display levels enhances user customization options. Good implementation.


183-183: The change in QuickToolsLocation from 3 to 1 is noted. Ensure this change aligns with the intended user interface layout and user expectations.

#!/bin/bash
# Description: Verify that the change in QuickToolsLocation aligns with UI design principles and user expectations.

# Test: Check user feedback or UI mockups for alignment.
echo "Check user feedback or UI mockups for alignment with QuickToolsLocation change."
HandheldCompanion/Devices/AYANEO/AYANEODeviceCEc.cs (1)

24-241: Comprehensive updates to AYANEODeviceCEc for enhanced control over device features like LEDs and fans. Thread safety is well-handled with locks, and the methods are appropriately structured.

HandheldCompanion/Controllers/GordonController.cs (3)

23-24: Constructor is empty.

This empty constructor is acceptable as it simply uses the base class constructor implicitly.


40-41: Initialization of input and output in InitializeInputOutput.

The method correctly initializes controller-specific settings. Good use of method overriding to extend base class functionality.


207-214: Clarification needed on axis swapping.

The comments indicate confusion about axis swapping. It's important to verify if this is intentional and document the reason behind it.

#!/bin/bash
# Description: Check for other instances of axis swapping in the codebase to understand if it's a common pattern.
rg --type cs "GyroAccelX.*GyroAccelZ.*GyroAccelY"
HandheldCompanion/Controllers/XInputController.cs (2)

152-152: Event subscription and unsubscription in Plug and Unplug.

Proper management of event handlers during the lifecycle of the controller. Ensures that the controller responds to ticks only when plugged in.

Also applies to: 158-158


201-212: Wireless detection based on enumerator.

The method IsWireless uses the enumerator to determine if the controller is wireless. This is a clean and effective way to handle different connection types.

HandheldCompanion/Controllers/NeptuneController.cs (5)

31-32: Constructor is correctly implemented as a parameterless initializer.


43-49: Method InitializeInputOutput correctly initializes controller-specific buttons and axes.


Line range hint 80-251: Method UpdateInputs correctly processes input states and updates them accordingly, including motion processing.


Line range hint 251-279: Method Open correctly attempts to open the controller connection and handles input events.


336-343: Method Unplug correctly handles the thread termination and controller disconnection.

HandheldCompanion/Controllers/LegionController.cs (5)

101-114: Constructor correctly initializes controller capabilities and settings.


121-143: Method InitializeInputOutput correctly initializes controller-specific buttons and axes.


248-338: Method UpdateInputs correctly processes input states and updates them accordingly, including motion processing.


203-222: Method Plug correctly attempts to open the HID device and starts a data thread.


224-245: Method Unplug correctly handles the thread termination and HID device disconnection.

HandheldCompanion/Devices/ASUS/ROGAlly.cs (3)

125-156: Ensure consistency in power profile GUIDs.

The GUIDs for the power profiles seem to be hardcoded. It's important to verify that these GUIDs are unique and not used elsewhere in the application to avoid conflicts.

#!/bin/bash
# Description: Search for duplicate GUIDs in the codebase.
rg --type cs '961cc777-2547-4f9d-8174-7d86181b8a7a|3af9B8d9-7c97-431d-ad78-34a8bfea439f|ded574b5-45a0-4f42-8737-46345c09c238'

171-178: Check for potential key conflicts.

The key codes F18 and F17 are used for both M1 and M2 chords. Verify that these key codes do not conflict with other functionalities or shortcuts within the application.

#!/bin/bash
# Description: Search for key code usage in the application.
rg --type cs 'KeyCode.F18|KeyCode.F17'

678-678: Validate the remapping functionality.

The remapping of M1 and M2 to different key codes based on the Remap flag should be tested to ensure it behaves as expected under different configurations.

#!/bin/bash
# Description: Test the remapping functionality by simulating different configurations.
# Simulate different configurations and check the output.
echo "Simulating remapping..."
# Add simulation commands here
HandheldCompanion/DSU/DSUServer.cs (1)

566-566: Ensure proper handling of byte order during data conversion.

#!/bin/bash
# Description: Verify that the byte order (endianness) is correctly handled during data conversion.

# Test: Search for BitConverter usage. Expect: Correct handling of endianness.
rg --type python $'BitConverter.GetBytes'

This is crucial as incorrect byte order can lead to data corruption when the application runs on different architectures.

Also applies to: 569-569, 572-572, 577-577, 580-580, 583-583

HandheldCompanion.iss (1)

166-175: Verify the necessity of the RestartNeeded parameter.

#!/bin/bash
# Description: Verify if the `RestartNeeded` parameter is used consistently across the codebase.

# Test: Search for the usage of `RestartNeeded`. Expect: Consistent usage across all relevant functions.
rg --type iss 'RestartNeeded'

Comment on lines 145 to 156
TIntegerArray = array of integer;

TDependency_Entry = record
Filename: String;
NewVersion: String;
InstalledVersion: String;
Parameters: String;
Title: String;
URL: String;
Checksum: String;
ForceSuccess: Boolean;
RestartAfter: Boolean;
RestartNeeded: Boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation for TDependency_Entry.

Consider adding comments to describe the fields of the TDependency_Entry struct, especially new fields like NewVersion, InstalledVersion, and RestartNeeded. This will improve code readability and maintainability.

Comment on lines 97 to 105
GyrometerAxis = new Vector3(-1.0f, -1.0f, 1.0f);
GyrometerAxisSwap = new SortedDictionary<char, char>
{
{ 'X', 'X' },
{ 'Y', 'Z' },
{ 'Z', 'Y' }
};

AccelerometerAxis = new Vector3(1.0f, 1.0f, 1.0f);
AccelerometerAxis = new Vector3(-1.0f, -1.0f, 1.0f);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider simplifying the axis swap dictionaries.

The dictionaries for GyrometerAxisSwap and AccelerometerAxisSwap are identical and could be combined into a single dictionary to avoid redundancy and simplify the code.

- GyrometerAxisSwap = new SortedDictionary<char, char>
- {
-     { 'X', 'X' },
-     { 'Y', 'Z' },
-     { 'Z', 'Y' }
- };
- AccelerometerAxisSwap = new SortedDictionary<char, char>
- {
-     { 'X', 'X' },
-     { 'Y', 'Z' },
-     { 'Z', 'Y' }
- };
+ AxisSwap = new SortedDictionary<char, char>
+ {
+     { 'X', 'X' },
+     { 'Y', 'Z' },
+     { 'Z', 'Y' }
+ };

Committable suggestion was skipped due low confidence.

Comment on lines +331 to +339
if (hidDevices.TryGetValue(INPUT_HID_ID, out HidDevice device))
{
device.OpenDevice();
device.MonitorDeviceEvents = true;

Task<HidReport> ReportDevice = Task.Run(async () => await device.ReadReportAsync());
ReportDevice.ContinueWith(t => OnReport(ReportDevice.Result, device));
}

Copy link
Contributor

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.

- Task<HidReport> ReportDevice = Task.Run(async () => await device.ReadReportAsync());
- ReportDevice.ContinueWith(t => OnReport(ReportDevice.Result, device));
+ await device.ReadReportAsync().ContinueWith(t => OnReport(t.Result, device), TaskContinuationOptions.OnlyOnRanToCompletion);

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

Committable suggestion was skipped due low confidence.

Comment on lines 494 to 515
if ShellExec('', ExpandConstant('{tmp}{\}') + Dependency_List[DependencyIndex].Filename, Dependency_List[DependencyIndex].Parameters, '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode) then
begin
log('Successfully executed ' +Dependency_List[DependencyIndex].Filename+ ' with result code: ' +intToStr(ResultCode));

if (ResultCode = 0) or Dependency_List[DependencyIndex].ForceSuccess then begin // ERROR_SUCCESS (0)
begin
if(Dependency_List[DependencyIndex].RestartNeeded) then
begin
log('Restart is needed by ' +Dependency_List[DependencyIndex].Title);
Dependency_NeedRestart := True;
end;
regSetVersion(Dependency_List[DependencyIndex].Title, Dependency_List[DependencyIndex].NewVersion);
break;
end else if (ResultCode = 0) or Dependency_List[DependencyIndex].ForceSuccess then begin // ERROR_SUCCESS (0)
break;
end
end else if ResultCode = 1641 then begin // ERROR_SUCCESS_REBOOT_INITIATED (1641)
NeedsRestart := True;
log(Dependency_List[DependencyIndex].Title + ' needs restart with result code ' +intToStr(ResultCode));
Result := Dependency_List[DependencyIndex].Title;
break;
end else if ResultCode = 3010 then begin // ERROR_SUCCESS_REBOOT_REQUIRED (3010)
Dependency_NeedRestart := True;
log(Dependency_List[DependencyIndex].Title + ' needs restart with result code ' +intToStr(ResultCode));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve error handling in dependency installation.

The error handling in the dependency installation loop can be improved by extracting the error handling logic into a separate function. This will make the code cleaner and easier to maintain.

+ function HandleInstallationError(DependencyIndex: Integer; ResultCode: Integer): String;
+ begin
+   case SuppressibleMsgBox(FmtMessage(SetupMessage(msgErrorFunctionFailed), [Dependency_List[DependencyIndex].Title, IntToStr(ResultCode)]), mbError, MB_ABORTRETRYIGNORE, IDIGNORE) of
+     IDABORT: begin
+       Result := Dependency_List[DependencyIndex].Title;
+     end;
+     IDIGNORE: begin
+       Result := '';
+     end;
+   end;
+   return Result;
+ end;

-  case SuppressibleMsgBox(FmtMessage(SetupMessage(msgErrorFunctionFailed), [Dependency_List[DependencyIndex].Title, IntToStr(ResultCode)]), mbError, MB_ABORTRETRYIGNORE, IDIGNORE) of
-    IDABORT: begin
-      Result := Dependency_List[DependencyIndex].Title;
-      break;
-    end;
-    IDIGNORE: begin
-      break;
-    end;
-  end;
+  Result := HandleInstallationError(DependencyIndex, ResultCode);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
if ShellExec('', ExpandConstant('{tmp}{\}') + Dependency_List[DependencyIndex].Filename, Dependency_List[DependencyIndex].Parameters, '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode) then
begin
log('Successfully executed ' +Dependency_List[DependencyIndex].Filename+ ' with result code: ' +intToStr(ResultCode));
if (ResultCode = 0) or Dependency_List[DependencyIndex].ForceSuccess then begin // ERROR_SUCCESS (0)
begin
if(Dependency_List[DependencyIndex].RestartNeeded) then
begin
log('Restart is needed by ' +Dependency_List[DependencyIndex].Title);
Dependency_NeedRestart := True;
end;
regSetVersion(Dependency_List[DependencyIndex].Title, Dependency_List[DependencyIndex].NewVersion);
break;
end else if (ResultCode = 0) or Dependency_List[DependencyIndex].ForceSuccess then begin // ERROR_SUCCESS (0)
break;
end
end else if ResultCode = 1641 then begin // ERROR_SUCCESS_REBOOT_INITIATED (1641)
NeedsRestart := True;
log(Dependency_List[DependencyIndex].Title + ' needs restart with result code ' +intToStr(ResultCode));
Result := Dependency_List[DependencyIndex].Title;
break;
end else if ResultCode = 3010 then begin // ERROR_SUCCESS_REBOOT_REQUIRED (3010)
Dependency_NeedRestart := True;
log(Dependency_List[DependencyIndex].Title + ' needs restart with result code ' +intToStr(ResultCode));
if ShellExec('', ExpandConstant('{tmp}{\}') + Dependency_List[DependencyIndex].Filename, Dependency_List[DependencyIndex].Parameters, '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode) then
begin
log('Successfully executed ' +Dependency_List[DependencyIndex].Filename+ ' with result code: ' +intToStr(ResultCode));
if (ResultCode = 0) or Dependency_List[DependencyIndex].ForceSuccess then begin // ERROR_SUCCESS (0)
begin
if(Dependency_List[DependencyIndex].RestartNeeded) then
begin
log('Restart is needed by ' +Dependency_List[DependencyIndex].Title);
Dependency_NeedRestart := True;
end;
regSetVersion(Dependency_List[DependencyIndex].Title, Dependency_List[DependencyIndex].NewVersion);
break;
end
end else if ResultCode = 1641 then begin // ERROR_SUCCESS_REBOOT_INITIATED (1641)
NeedsRestart := True;
log(Dependency_List[DependencyIndex].Title + ' needs restart with result code ' +intToStr(ResultCode));
Result := Dependency_List[DependencyIndex].Title;
break;
end else if ResultCode = 3010 then begin // ERROR_SUCCESS_REBOOT_REQUIRED (3010)
Dependency_NeedRestart := True;
log(Dependency_List[DependencyIndex].Title + ' needs restart with result code ' +intToStr(ResultCode));
function HandleInstallationError(DependencyIndex: Integer; ResultCode: Integer): String;
begin
case SuppressibleMsgBox(FmtMessage(SetupMessage(msgErrorFunctionFailed), [Dependency_List[DependencyIndex].Title, IntToStr(ResultCode)]), mbError, MB_ABORTRETRYIGNORE, IDIGNORE) of
IDABORT: begin
Result := Dependency_List[DependencyIndex].Title;
end;
IDIGNORE: begin
Result := '';
end;
end;
return Result;
end;
Result := HandleInstallationError(DependencyIndex, ResultCode);

outIdx += 4;
}

return true;
}

public void Tick(long ticks)
public void Tick(long ticks, float delta)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a more precise timing mechanism for Tick.

Using DateTime.UtcNow for timing can lead to inaccuracies due to its lower resolution. Consider using Stopwatch for more precise control over timing, especially in a context where timing is critical.

Comment on lines +11 to +15
// TODO: Check if there really is no RGB but looks like it
this.Capabilities -= DeviceCapabilities.DynamicLighting;
this.Capabilities -= DeviceCapabilities.DynamicLightingBrightness;

// TODO: Add OEMChords for "Dual-Screen Keys" key here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Add OEMChords for "Dual-Screen Keys" key here.

Would you like me to help implement the OEM chords for the "Dual-Screen Keys" key or should I open a GitHub issue to track this task?

using static JSL;

namespace HandheldCompanion.Controllers;

public class DualSenseController : JSController
{
public DualSenseController()
{ }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing the empty constructor if it's not required, or add a comment explaining its necessity.

public JSController()
{
}
{ }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing the empty constructor if it's not required, or add a comment explaining its necessity.

Comment on lines +18 to +20
protected void CEcControl_SetSecDispBrightness(short brightness)
{
this.ECRAMWrite(0x4e, (byte)((brightness * 0xff) / 100));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding input validation for brightness to ensure it's within the expected range (0-100).

+ if (brightness < 0 || brightness > 100) {
+     throw new ArgumentOutOfRangeException(nameof(brightness), "Brightness must be between 0 and 100.");
+ }
  this.ECRAMWrite(0x4e, (byte)((brightness * 0xff) / 100));
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
protected void CEcControl_SetSecDispBrightness(short brightness)
{
this.ECRAMWrite(0x4e, (byte)((brightness * 0xff) / 100));
protected void CEcControl_SetSecDispBrightness(short brightness)
{
if (brightness < 0 || brightness > 100) {
throw new ArgumentOutOfRangeException(nameof(brightness), "Brightness must be between 0 and 100.");
}
this.ECRAMWrite(0x4e, (byte)((brightness * 0xff) / 100));

Comment on lines +15 to +23
// https://www.amd.com/en/products/apu/amd-ryzen-7-7840u
// https://www.amd.com/en/products/apu/amd-ryzen-7-8840u
this.nTDP = new double[] { 15, 15, 20 };
this.cTDP = new double[] { 3, 28 };
this.GfxClock = new double[] { 100, 2700 };
this.CpuClock = 5100;


// TODO: Add OEMChords for "three dots" key here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Add OEMChords for "three dots" key here.

Would you like me to help implement the OEM chords for the "three dots" key or should I open a GitHub issue to track this task?

Valkirie and others added 28 commits May 31, 2024 11:43
* Disable the RealTimeStylus for WPF Applications

* Update MainWindow.xaml.cs

* test ?
…#158)

* Start implementing IGCL (wip)

* More work

- Implemented GPUManager
- Implemented GPU-specific classes (AMDGPU, IntelGPU)
- Implemented IGCLBackend (wip)
- SystemManager renamed to MultimediaManager
- PowerManager renamed to SystemManager

* more work on IGCL

* prevent crash on null MainThread

* prevent useless SetResolution() calls

* more work on IGCL

* add missing sharpness check

* implement ctl_device_adapter_properties_t  (wip)

* what if the issue was deviceIdx all along...

* Update IGCL_Wrapper.dll

* fix remaining implementations

* implement IntegerScalingType (Intel only)

* make sure to use defaultGPU (idx: 0)

We need to find a proper way to guess which one is used for 3D rendering I guess or linked to main screen..

* fix ctl_device_adapter_properties_t Marshalling

* implemented some form of logic to pick the first available external GPU (if any)

* improve GPUManager

- add support for Manufacturer: "Advanced Micro Devices, Inc."
- improve GPUManager and GPU Start() and Stop() logics
- prevent Task Execution within Tasks on AMDGPU

* fix a crash when UpdateTimer is null
* Implement new UI classes

- UISounds to manage UI sounds on interaction.
- UIGamepad to manage gamepad interactions.
- Audio files from https://kenney.nl/assets/ui-audio.
- Add support for TextBox and RepeatButton selection via gamepad.

* Update HandheldCompanion/UI/UISounds.cs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix PlayOggFile refs

* removed unused audio files

* Add UI Sounds toggle on SettingsPage (default Off)

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Migrate everything ADLX related to ADLX_Wrapper()

* update IGCL logic

- Implemented Terminate() and Initialize() as well as GetTelemetryData()

* debug functions on both IGCL and ADLX backends

* Update ADLX_Wrapper and fix Initialize() calls on GPU classes

* add Telemetry Timer as part of GPU class

* Implement GPU GetLoad() and GetPower()
This should prevent AutoTDP and TDP control to flood the log.
* Improvement, translations update.

* Localization support for Device page Legion Go settings.
Fixing the rare case of soft-brick issue on uninstallation caused by a race condition
…e#186)

* early wip

* more work

* improve DesktopScreen GetResolution() logic

* implement GPUManager Hooked event

* prevent crash on null gpu variable

* improve performance manager locks logic

* more work on ADLX

- Implemented displayIdx logic
- Renamed a few ADLXBackend arguments for clarity
- Leveraging WindowsDisplayAPI library to link a display DisplayName with its FriendlyName (which is reported by ADLX
- Now storing FriendlyName and DevicePath on DesktopScreen

* add new functions to MultimediaManager

- GetDisplayFriendlyName()
- GetDisplayPath()
- GetDisplayTarget()
* move a few calls away from MainWindow

* improve main window loading experience

* halt and resume GPU manager on sleep/resume

* suspend/resume LibreHardwareMonitor with system

* check IGCL/ADLX status before trying to terminate()

* migrate GPU wait to GPUManager

* mark GPU as Halting on system stop/sleep

Prevents any further ADLX/IGCL calls while GPU is halting

* Fixes Valkirie#990

* misc edit to VirtualManager and vTargets

* Improved management of controller-specific parameters

- Implemented IController UpdateSettings()
- Implemented UpdateSettings() supports over LegionController and SteamController

* improve lock logic on GPU

* revert GPU halting logic

I need to learn about Semaphore here to lock and release from different thread.

* implement CrossThreadLock class

- used by GPU

* delay system until we're done !

* fix usage of CrossThreadLock within GPU

* fix DesktopScreen GetResolution()

That's dirty :'(

* Support for Ayaneo Slide

Support for Ayaneo Slide

---------

Co-authored-by: DevL0rd <[email protected]>
* MVVM Rework - Batch 1

* Fix merge mistake.

* update IController

- make TargetButtons, TargetAxis, SourceAxis, SourceButtons non static

* feed SourceButtons, SourceAxis on IController creation

* Corrected inconsistencies in the use of Environment.ProcessorCount and MotherboardInfo.NumberOfCores

---------

Co-authored-by: Matthias Seys <[email protected]>
Co-authored-by: Lesueur Benjamin <[email protected]>
* Testing left gyro

* start implementing per-controller gyro support

* improve the automatic sensor switching logic

- when a controller is targeted, use its sensors if available
- when unplugged, if controller had sensors, pick next available
- if a controller is plugged and doesn't have sensors, pick next available

* implement LegionControllerGyroIndex on DevicePage

* fix type on gZ

* migrate sensor filtering

* improve filtering logic

* Tentative

* it's working

* remove deprecated filtering

* sorting all axis

* more work on axis, UI and calibration

- still getting awkward results when testing PadTest (Cemuhook)

* remove deprecated FilterMotion() function

* more work on gyro aiming

- implemented local space, player space and world space

* add missing glyph for MotionInput.LocalSpace

* fix inclination

* use GetGravity() instead of GetProcessedAcceleration()

* restore normal inclination now that we're using GetGravity instead of GetProcessedAcceleration

* fix legion controller gyro/accelero computation

* improve overall motion experience

- remove hardcoded motion delta, use TimerManager event to pass double delta value.
- implement SensorsManager ProcessReport() function

* remove useless argument from SensorsManager UpdateReport()

* Make TimerManager delta float

- One cast instead of several.

* remove MadgwickAHRS

- migrate ToEulerAngles to InputUtils

* compile GamepadMotionHelper in Release

* rename Legion Controller

* implement IMUCalibration

- SensorsManager can store and retrieve calibration offset data from GamepadMotion objects

* fix incorrect GamepadMotion variable when using Internal IMU

* Implement device IMU calibration

* set calibration button style to accent

* prevent crash on null gamepadMotion

* move motion processing to Motion Manager

* remove redundant switch

* more work on motion manager

- fixed motion invert (horizontal, vertical)
- fixed steering
- now properly swapping (Roll, Yaw) on LocalSpace
* InnoSetup Update

Update InnoSetup with the following:
- Install dependencies only when not installed or newer version comes with installer
- Show optional reboot screen only when required
- After installing HidHide, remove desktop icon
- Option to open the application after install

* update HidHide and RTSS redist

Files were already pushed to mainline

* update NewHidHideVersion

---------

Co-authored-by: Lesueur Benjamin <[email protected]>
* Support for MSI Claw

Adds support for Claw and Quick Settings buttons
Adds orientation for IMU
Adds TDP and clock information
Updated PromptFont with MSI Claw glyphs

* fix gyro axis

* force device to XInput mode on startup (poc)

* fix CPU power reading on Intel CPUs

* fix incorrect accelerometer axis

* add default power profiles

* implementing hint (WIP)

* implement hint

* prevent crash if ContentFrame can't go back on power profile delete

* fix MSI power profiles naming

* rename OEM power presets variable names

* change profile CPUBoostLevel default value to 1:Enabled

---------

Co-authored-by: romracer <romracer@localhost>
Co-authored-by: Lesueur Benjamin <[email protected]>
Valkirie and others added 27 commits May 31, 2024 12:13
* Fix shoulder button visibility on model type change

* Fix 3D Overlay face camera
* Add Flip KB

* Fix comment

* Add Flip DS

* Add illustrations

* IDevice to detect Ayaneo Flip KB and DS

---------

Co-authored-by: CasperH <[email protected]>
* migrate some code to Open() and improve IsReady()

* improve open/close
* restore IMUCalibration saving

* Make it so overlay model uses calibrated gyro/accelero and delta output

* only replace SensorsManager delta if internal sensor is reporting its timestamp
* Improve profile manager robustness

- Prevent the creation of an empty profile when an event is raised by UI before ProfileManager is ready.
- Fix an issue prevent default profile from being loaded on initialization

* improve logging

* remove redundant log

* prevent useless profile update on profile switching

* prevent HC from loading a profile that has no actual "FileNameWithoutExtension"
* Use TheNathannator ViGEm.NET bugfix branche : https://github.com/TheNathannator/ViGEm.NET/tree/error-handling

* ViGEmTarget Connect() and Disconnect() will return boolean

* only update HIDstatus if we have successfully connected/disconnected the virtual controller
@CasperH2O CasperH2O merged commit cead895 into Valkirie:main May 31, 2024
1 check failed
@CasperH2O CasperH2O deleted the EA-To-Public branch May 31, 2024 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants