diff --git a/.github/workflows/publish-hc.yml b/.github/workflows/publish-hc.yml index cd5d237cb..9ae122118 100644 --- a/.github/workflows/publish-hc.yml +++ b/.github/workflows/publish-hc.yml @@ -103,4 +103,4 @@ jobs: draft: true fail_on_unmatched_files: true files: | - ./install/HandheldCompanion-${{ inputs.releaseVersion }}.exe + ./install/HandheldCompanion-${{ inputs.releaseVersion }}.exe \ No newline at end of file diff --git a/HandheldCompanion.iss b/HandheldCompanion.iss index 0341d81dc..b4f9d242c 100644 --- a/HandheldCompanion.iss +++ b/HandheldCompanion.iss @@ -215,28 +215,15 @@ begin Result := ShellExec('', ExpandConstant('{tmp}{\}') + 'netcorecheck' + Dependency_ArchSuffix + '.exe', Version, '', SW_HIDE, ewWaitUntilTerminated, ResultCode) and (ResultCode = 0); end; -procedure Dependency_AddDotNet70; +procedure Dependency_AddDotNet80Desktop; begin - // https://dotnet.microsoft.com/download/dotnet/7.0 - if not Dependency_IsNetCoreInstalled('Microsoft.NETCore.App 7.0.0') then begin - Dependency_Add('dotnet70' + Dependency_ArchSuffix + '.exe', + // https://dotnet.microsoft.com/en-us/download/dotnet/8.0 + if not Dependency_IsNetCoreInstalled('Microsoft.WindowsDesktop.App 8.0.0') then begin + Dependency_Add('dotNet80desktop' + Dependency_ArchSuffix + '.exe', '/lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart', - '.NET Runtime 7.0.0' + Dependency_ArchTitle, - Dependency_String('https://download.visualstudio.microsoft.com/download/pr/75c0d7c7-9f30-46fd-9675-a301f0e051f4/ec04d5cc40aa6537a4af21fad6bf8ba9/dotnet-runtime-7.0.0-win-x86.exe', - 'https://download.visualstudio.microsoft.com/download/pr/87bc5966-97cc-498c-8381-bff4c43aafc6/baca88b989e7d2871e989d33a667d8e9/dotnet-runtime-7.0.0-win-x64.exe'), - '', False, False); - end; -end; - -procedure Dependency_AddDotNet70Desktop; -begin - // https://dotnet.microsoft.com/download/dotnet/7.0 - if not Dependency_IsNetCoreInstalled('Microsoft.WindowsDesktop.App 7.0.10') then begin - Dependency_Add('dotnet70desktop' + Dependency_ArchSuffix + '.exe', - '/lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart', - '.NET Desktop Runtime 7.0.0' + Dependency_ArchTitle, - Dependency_String('https://download.visualstudio.microsoft.com/download/pr/9812249d-fc42-41ab-bd2e-6e858d5dd5a7/95fa5a1a77eace4482bcb98ede190003/windowsdesktop-runtime-7.0.10-win-x86.exe', - 'https://download.visualstudio.microsoft.com/download/pr/747f4a98-2586-4bc6-b828-34f35e384a7d/44225cfd9d365855ec77d00c4812133c/windowsdesktop-runtime-7.0.10-win-x64.exe'), + '.NET Desktop Runtime 8.0.0' + Dependency_ArchTitle, + Dependency_String('https://download.visualstudio.microsoft.com/download/pr/b280d97f-25a9-4ab7-8a12-8291aa3af117/a37ed0e68f51fcd973e9f6cb4f40b1a7/windowsdesktop-runtime-8.0.0-win-x64.exe', + 'https://download.visualstudio.microsoft.com/download/pr/f9e3b581-059d-429f-9f0d-1d1167ff7e32/bd7661030cd5d66cd3eee0fd20b24540/windowsdesktop-runtime-8.0.0-win-x86.exe'), '', False, False); end; end; @@ -325,21 +312,19 @@ end; procedure Dependency_AddHideHide; begin - // https://www.microsoft.com/en-US/download/details.aspx?id=35 Dependency_Add('HidHide_1.4.192_x64.exe', '/quiet /norestart', - 'HidHide Drivers v1.4.192', + 'HidHide Drivers', 'https://github.com/nefarius/HidHide/releases/download/v1.4.192.0/HidHide_1.4.192_x64.exe', '', True, False); end; procedure Dependency_AddViGem; begin - // https://www.microsoft.com/en-US/download/details.aspx?id=35 Dependency_Add('ViGEmBus_1.22.0_x64_x86_arm64.exe', '/quiet /norestart', - 'ViGEmBus Setup 1.22.0', - 'https://github.com/Valkirie/HandheldCompanion/raw/main/redist/ViGEmBus_1.22.0_x64_x86_arm64.exe', + 'ViGEmBus Setup', + 'https://github.com/nefarius/ViGEmBus/releases/download/v1.22.0/ViGEmBus_1.22.0_x64_x86_arm64.exe', '', True, False); end; @@ -370,7 +355,7 @@ end; ; requires netcorecheck.exe and netcorecheck_x64.exe (see download link below) #define UseNetCoreCheck #ifdef UseNetCoreCheck - #define UseDotNet70 + #define UseDotNet80 #endif ;#define UseVC2005 @@ -389,15 +374,15 @@ end; #define MyAppSetupName 'Handheld Companion' #define MyBuildId 'HandheldCompanion' -#define MyAppVersion '0.18.0.6' +#define MyAppVersion '0.19.1.3' #define MyAppPublisher 'BenjaminLSR' #define MyAppCopyright 'Copyright @ BenjaminLSR' #define MyAppURL 'https://github.com/Valkirie/HandheldCompanion' #define MyAppExeName "HandheldCompanion.exe" #define MyConfiguration "Release" -#ifdef UseDotNet70 - #define MyConfigurationExt "net7.0" +#ifdef UseDotNet80 + #define MyConfigurationExt "net8.0" #endif AppName={#MyAppSetupName} @@ -419,7 +404,10 @@ SourceDir=redist OutputDir={#SourcePath}\install AllowNoIcons=yes MinVersion=6.0 -PrivilegesRequired=admin +;PrivilegesRequired=admin +PrivilegesRequiredOverridesAllowed=dialog +Compression=lzma +SolidCompression=yes // remove next line if you only deploy 32-bit binaries and dependencies ArchitecturesInstallIn64BitMode=x64 @@ -454,12 +442,8 @@ Name: "{commondesktop}\{#MyAppSetupName}"; Filename: "{app}\{#MyAppExeName}"; Ta [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}" -[Run] -Filename: "{sys}\sc.exe"; Parameters: "stop ControllerService" ; Flags: runascurrentuser runhidden -Filename: "{sys}\sc.exe"; Parameters: "delete ControllerService" ; Flags: runascurrentuser runhidden - [UninstallRun] -Filename: "C:\Program Files\Nefarius Software Solutions e.U\HidHideCLI\HidHideCLI.exe"; Parameters: "--cloak-off" ; RunOnceId: "CloakOff"; Flags: runascurrentuser runhidden +Filename: "C:\Program Files\Nefarius Software Solutions\HidHide\x64\HidHideCLI.exe"; Parameters: "--cloak-off" ; RunOnceId: "CloakOff"; Flags: runascurrentuser runhidden [UninstallDelete] Type: filesandordirs; Name: "{app}" @@ -508,7 +492,7 @@ begin if not(keepHidhideCheckbox.Checked) then begin - if(ShellExec('', 'msiexec.exe', '/X{50D7EB6D-6A4A-4A38-B09C-CC28F75F082E} /qn /norestart', '', SW_SHOW, ewWaitUntilTerminated, resultCode)) then + if(ShellExec('', 'msiexec.exe', '/X{BE49B9DE-F8EB-4F54-B312-DD4B601985FC}', '', SW_SHOW, ewWaitUntilTerminated, resultCode)) then begin log('Successfully executed Hidhide uninstaller'); if(resultCode = 0) then @@ -524,7 +508,7 @@ begin if not(keepVigemCheckbox.Checked) then begin - if(ShellExec('', 'msiexec.exe', '/X{9C581C76-2D68-40F8-AA6F-94D3C5215C05} /qn /norestart', '', SW_SHOW, ewWaitUntilTerminated, resultCode)) then + if(ShellExec('', 'msiexec.exe', '/X{966606F3-2745-49E9-BF15-5C3EAA4E9077}', '', SW_SHOW, ewWaitUntilTerminated, resultCode)) then begin log('Successfully executed Vigem uninstaller'); if(resultCode = 0) then @@ -564,8 +548,8 @@ end; function InitializeSetup: Boolean; begin -#ifdef UseDotNet70 - Dependency_AddDotNet70Desktop; +#ifdef UseDotNet80 + Dependency_AddDotNet80Desktop; #endif #ifdef UseVC2005 @@ -610,4 +594,4 @@ begin Result := True; end; -#endif +#endif \ No newline at end of file diff --git a/HandheldCompanion/Actions/ButtonActions.cs b/HandheldCompanion/Actions/ButtonActions.cs index 90f46dff5..5e56ea707 100644 --- a/HandheldCompanion/Actions/ButtonActions.cs +++ b/HandheldCompanion/Actions/ButtonActions.cs @@ -24,9 +24,9 @@ public ButtonActions(ButtonFlags button) : this() this.Button = button; } - public override void Execute(ButtonFlags button, bool value, int longTime) + public override void Execute(ButtonFlags button, bool value) { - base.Execute(button, value, longTime); + base.Execute(button, value); switch (this.Value) { diff --git a/HandheldCompanion/Actions/IActions.cs b/HandheldCompanion/Actions/IActions.cs index fca93b499..98e03a224 100644 --- a/HandheldCompanion/Actions/IActions.cs +++ b/HandheldCompanion/Actions/IActions.cs @@ -76,10 +76,6 @@ public abstract class IActions : ICloneable protected object Value; protected object prevValue; - // values below are common for button type actions - - protected int Period; - // TODO: multiple delay, delay ranges public PressType PressType = PressType.Short; public int LongPressTime = 450; // default value for steam @@ -101,7 +97,6 @@ public abstract class IActions : ICloneable public IActions() { - Period = TimerManager.GetPeriod(); } public virtual void SetHaptic(ButtonFlags button, bool up) @@ -113,42 +108,23 @@ public virtual void SetHaptic(ButtonFlags button, bool up) ControllerManager.GetTargetController()?.SetHaptic(this.HapticStrength, button); } - // if longDelay == 0 no new logic will be executed - public virtual void Execute(ButtonFlags button, bool value, int longTime) + public virtual void Execute(ButtonFlags button, bool value) { - // reset failed attempts on button release - if (pressTimer >= 0 && !value && - ((PressType == PressType.Short && pressTimer >= longTime) || - (PressType == PressType.Long && pressTimer < longTime))) - { - pressTimer = -1; - prevValue = false; - return; - } - - // some long presses exist and button was just pressed, start the timer and quit - if (longTime > 0 && value && !(bool)prevValue) - { - pressTimer = 0; - prevValue = true; - return; - } - - if (pressTimer >= 0) + switch(PressType) { - pressTimer += Period; - - // conditions were met to trigger either short or long, reset state, press buttons - if ((!value && PressType == PressType.Short && pressTimer < longTime) || - (value && PressType == PressType.Long && pressTimer >= longTime)) - { - pressTimer = -1; - prevValue = false; // simulate a situation where the button was just pressed - value = true; // prev = false, current = true, this way toggle works - } - // timer active, conditions not met, carry on, maybe smth happens, maybe failed attempt - else - return; + case PressType.Long: + { + if (value || (pressTimer <= LongPressTime && pressTimer >= 0)) + { + pressTimer += TimerManager.GetPeriod(); + value = true; + } + else if(pressTimer >= LongPressTime) + { + pressTimer = -1; + } + } + break; } if (Toggle) @@ -166,7 +142,7 @@ public virtual void Execute(ButtonFlags button, bool value, int longTime) if (TurboIdx % TurboDelay == 0) IsTurboed = !IsTurboed; - TurboIdx += Period; + TurboIdx += TimerManager.GetPeriod(); } else { diff --git a/HandheldCompanion/Actions/KeyboardActions.cs b/HandheldCompanion/Actions/KeyboardActions.cs index 0c9acf3f1..d58a37739 100644 --- a/HandheldCompanion/Actions/KeyboardActions.cs +++ b/HandheldCompanion/Actions/KeyboardActions.cs @@ -31,9 +31,9 @@ public KeyboardActions(VirtualKeyCode key) : this() this.Key = key; } - public override void Execute(ButtonFlags button, bool value, int longTime) + public override void Execute(ButtonFlags button, bool value) { - base.Execute(button, value, longTime); + base.Execute(button, value); switch (this.Value) { diff --git a/HandheldCompanion/Actions/MouseActions.cs b/HandheldCompanion/Actions/MouseActions.cs index a38901699..fdc4941be 100644 --- a/HandheldCompanion/Actions/MouseActions.cs +++ b/HandheldCompanion/Actions/MouseActions.cs @@ -72,9 +72,9 @@ public MouseActions(MouseActionsType type) : this() this.MouseType = type; } - public override void Execute(ButtonFlags button, bool value, int longTime) + public override void Execute(ButtonFlags button, bool value) { - base.Execute(button, value, longTime); + base.Execute(button, value); switch (this.Value) { diff --git a/HandheldCompanion/App.config b/HandheldCompanion/App.config index 2fc584b12..bf7669c66 100644 --- a/HandheldCompanion/App.config +++ b/HandheldCompanion/App.config @@ -141,7 +141,7 @@ True - True + False True @@ -197,8 +197,8 @@ False - - False + + True False @@ -218,6 +218,33 @@ 127.0.0.1 + + 50 + + + #FFFFFF00 + + + False + + + 0 + + + True + + + #FFFFFF00 + + + False + + + 50 + + + False + \ No newline at end of file diff --git a/HandheldCompanion/Controllers/DInputController.cs b/HandheldCompanion/Controllers/DInputController.cs index 9e5bdb903..966bcb580 100644 --- a/HandheldCompanion/Controllers/DInputController.cs +++ b/HandheldCompanion/Controllers/DInputController.cs @@ -17,7 +17,7 @@ public DInputController(Joystick joystick, PnPDetails details) return; this.joystick = joystick; - UserIndex = joystick.Properties.JoystickId; + UserIndex = (byte)joystick.Properties.JoystickId; if (details is null) return; @@ -28,9 +28,9 @@ public DInputController(Joystick joystick, PnPDetails details) // Set BufferSize in order to use buffered data. joystick.Properties.BufferSize = 128; - // ui - DrawControls(); - RefreshControls(); + // UI + DrawUI(); + UpdateUI(); } public override string ToString() diff --git a/HandheldCompanion/Controllers/DS4Controller.cs b/HandheldCompanion/Controllers/DS4Controller.cs index f43ba69a7..7028dc7b5 100644 --- a/HandheldCompanion/Controllers/DS4Controller.cs +++ b/HandheldCompanion/Controllers/DS4Controller.cs @@ -1,7 +1,6 @@ using HandheldCompanion.Inputs; using HandheldCompanion.Managers; using HandheldCompanion.Utils; -using Inkore.UI.WPF.Modern; using System.Windows; using System.Windows.Media; using static JSL; @@ -87,6 +86,11 @@ public override void UpdateInputs(long ticks) base.UpdateInputs(ticks); } + public override string ToString() + { + return "DUALSHOCK®4 Wireless Controller"; + } + public override void Plug() { TimerManager.Tick += UpdateInputs; diff --git a/HandheldCompanion/Controllers/DualSenseController.cs b/HandheldCompanion/Controllers/DualSenseController.cs index 48755e2e8..2c9884e36 100644 --- a/HandheldCompanion/Controllers/DualSenseController.cs +++ b/HandheldCompanion/Controllers/DualSenseController.cs @@ -79,6 +79,11 @@ public override void UpdateInputs(long ticks) base.UpdateInputs(ticks); } + public override string ToString() + { + return "DualSense® Wireless Controller"; + } + public override void Plug() { TimerManager.Tick += UpdateInputs; diff --git a/HandheldCompanion/Controllers/GordonController.cs b/HandheldCompanion/Controllers/GordonController.cs index a30f26ecd..637c007f8 100644 --- a/HandheldCompanion/Controllers/GordonController.cs +++ b/HandheldCompanion/Controllers/GordonController.cs @@ -22,16 +22,7 @@ public class GordonController : SteamController public GordonController(PnPDetails details) : base() { - if (details is null) - return; - - Controller = new(details.attributes.VendorID, details.attributes.ProductID, details.GetMI()); - - // open controller - Open(); - - Details = details; - Details.isHooked = true; + AttachDetails(details); // UI ColoredButtons.Add(ButtonFlags.B1, new SolidColorBrush(Color.FromArgb(255, 81, 191, 61))); @@ -39,9 +30,8 @@ public GordonController(PnPDetails details) : base() ColoredButtons.Add(ButtonFlags.B3, new SolidColorBrush(Color.FromArgb(255, 26, 159, 255))); ColoredButtons.Add(ButtonFlags.B4, new SolidColorBrush(Color.FromArgb(255, 255, 200, 44))); - InitializeComponent(); - DrawControls(); - RefreshControls(); + DrawUI(); + UpdateUI(); // Additional controller specific source buttons/axes SourceButtons.AddRange(new List() { ButtonFlags.L4, ButtonFlags.R4 }); @@ -70,6 +60,16 @@ public GordonController(PnPDetails details) : base() SourceAxis.Remove(AxisLayoutFlags.RightStick); } + public override void AttachDetails(PnPDetails details) + { + base.AttachDetails(details); + + Controller = new(details.VendorID, details.ProductID, details.GetMI()); + + // open controller + Open(); + } + public override string ToString() { string baseName = base.ToString(); diff --git a/HandheldCompanion/Controllers/IController.xaml b/HandheldCompanion/Controllers/IController.xaml index 57033b1a5..595e0f0fd 100644 --- a/HandheldCompanion/Controllers/IController.xaml +++ b/HandheldCompanion/Controllers/IController.xaml @@ -4,8 +4,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:HandheldCompanion.Controllers" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:resx="clr-namespace:HandheldCompanion.Properties" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" d:DesignHeight="450" d:DesignWidth="800" @@ -16,7 +16,7 @@ Background="{DynamicResource SystemControlPageBackgroundAltHighBrush}" CornerRadius="{DynamicResource ControlCornerRadius}"> - + @@ -25,16 +25,27 @@ - - + FontFamily="PromptFont" + FontSize="30" + Glyph="␼" /> + + + + + + + + + + + + + + + + + @@ -43,6 +54,7 @@ Width="100" Click="ui_button_hook_Click" FontSize="14" + Content="{x:Static resx:Resources.Controller_Connect}" Style="{DynamicResource AccentButtonStyle}" />