Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Valkirie committed Nov 10, 2024
2 parents eeceabc + 4944944 commit f9275e3
Show file tree
Hide file tree
Showing 116 changed files with 3,195 additions and 1,681 deletions.
38 changes: 30 additions & 8 deletions HandheldCompanion.iss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define UseNetCoreCheck
#ifdef UseNetCoreCheck
#define UseDotNet80
;#define UseDotNet90
#endif

;#define UseVC2005
Expand All @@ -26,7 +27,7 @@
#define InstallerVersion '0.2'
#define MyAppSetupName 'Handheld Companion'
#define MyBuildId 'HandheldCompanion'
#define MyAppVersion '0.21.6.1'
#define MyAppVersion '0.21.7.0'
#define MyAppPublisher 'BenjaminLSR'
#define MyAppCopyright 'Copyright @ BenjaminLSR'
#define MyAppURL 'https://github.com/Valkirie/HandheldCompanion'
Expand All @@ -52,12 +53,6 @@
; RTSS 7.3.6
#define NewRtssVersion "7.3.5.28010"

//#define DotNetX64DownloadLink "https://download.visualstudio.microsoft.com/download/pr/b280d97f-25a9-4ab7-8a12-8291aa3af117/a37ed0e68f51fcd973e9f6cb4f40b1a7/windowsdesktop-runtime-8.0.0-win-x64.exe"
//#define DotNetX86DownloadLink "https://download.visualstudio.microsoft.com/download/pr/f9e3b581-059d-429f-9f0d-1d1167ff7e32/bd7661030cd5d66cd3eee0fd20b24540/windowsdesktop-runtime-8.0.0-win-x86.exe"

#define DotNetX64DownloadLink "https://download.visualstudio.microsoft.com/download/pr/f18288f6-1732-415b-b577-7fb46510479a/a98239f751a7aed31bc4aa12f348a9bf/windowsdesktop-runtime-8.0.1-win-x64.exe"
#define DotNetX86DownloadLink "https://download.visualstudio.microsoft.com/download/pr/ca725693-6de7-4a4d-b8a4-4390b0387c66/ce13f2f016152d9b5f2d3c6537cc415b/windowsdesktop-runtime-8.0.1-win-x86.exe"

#define DirectXDownloadLink "https://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe"
#define HidHideDownloadLink "https://github.com/nefarius/HidHide/releases/download/v1.5.230.0/HidHide_1.5.230_x64.exe"
#define ViGemDownloadLink "https://github.com/nefarius/ViGEmBus/releases/download/v1.22.0/ViGEmBus_1.22.0_x64_x86_arm64.exe"
Expand All @@ -69,6 +64,14 @@

#ifdef UseDotNet80
#define MyConfigurationExt "net8.0"
#define DotNetX64DownloadLink "https://download.visualstudio.microsoft.com/download/pr/f18288f6-1732-415b-b577-7fb46510479a/a98239f751a7aed31bc4aa12f348a9bf/windowsdesktop-runtime-8.0.1-win-x64.exe"
#define DotNetX86DownloadLink "https://download.visualstudio.microsoft.com/download/pr/ca725693-6de7-4a4d-b8a4-4390b0387c66/ce13f2f016152d9b5f2d3c6537cc415b/windowsdesktop-runtime-8.0.1-win-x86.exe"
#endif

#ifdef UseDotNet90
#define MyConfigurationExt "net9.0"
#define DotNetX64DownloadLink "https://download.visualstudio.microsoft.com/download/pr/30d1fcdb-8bf1-4b6e-ad06-f66ed68017bf/20abf38df849587b0a2de99a31f5c1c8/windowsdesktop-runtime-9.0.0-rc.2.24474.4-win-x64.exe"
#define DotNetX86DownloadLink "https://download.visualstudio.microsoft.com/download/pr/f6a4c462-a2a6-4488-9448-574b659c31e5/7eb8840cb5e42e0fd41a57964fe3472c/windowsdesktop-runtime-9.0.0-rc.2.24474.4-win-x86.exe"
#endif

#define WindowsVersion "10.0.19041"
Expand Down Expand Up @@ -169,6 +172,7 @@ procedure Dependency_Add_With_Version(const Filename, NewVersion, InstalledVersi
function Dependency_PrepareToInstall(var NeedsRestart: Boolean): String; forward;
function Dependency_UpdateReadyMemo(const Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String; forward;
procedure Dependency_AddDotNet80Desktop; forward;
procedure Dependency_AddDotNet90Desktop; forward;
procedure Dependency_AddDirectX; forward;
procedure Dependency_AddHideHide; forward;
procedure Dependency_AddViGem; forward;
Expand Down Expand Up @@ -306,6 +310,15 @@ begin
end;
#endif

#ifdef UseDotNet90
installedVersion:= regGetInstalledVersion('{#DotNetName}');
if(compareVersions('{#NewDotNetVersion}', installedVersion, '.', '-') > 0) then
begin
log('{#DotNetName} {#NewDotNetVersion} needs update.');
Dependency_AddDotNet90Desktop;
end;
#endif

#ifdef UseVC2005
Dependency_AddVC2005;
#endif
Expand Down Expand Up @@ -621,8 +634,17 @@ begin
'/lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart',
'{#DotNetName}', Dependency_String('{#DotNetX86DownloadLink}', '{#DotNetX64DownloadLink}'), '', False, False);
end;
end;
end;

procedure Dependency_AddDotNet90Desktop;
begin
// https://dotnet.microsoft.com/fr-fr/download/dotnet/9.0
if not Dependency_IsNetCoreInstalled('Microsoft.WindowsDesktop.App 9.0.0') then begin
Dependency_Add_With_Version('dotNet90desktop' + Dependency_ArchSuffix + '.exe', '{#NewDotNetVersion}', regGetInstalledVersion('{#DotNetName}'),
'/lcid ' + IntToStr(GetUILanguage) + ' /passive /norestart',
'{#DotNetName}', Dependency_String('{#DotNetX86DownloadLink}', '{#DotNetX64DownloadLink}'), '', False, False);
end;
end;

procedure Dependency_AddVC2005;
begin
Expand Down
2 changes: 1 addition & 1 deletion HandheldCompanion/Actions/MouseActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class MouseActions : GyroActions
// settings axis
public int Sensivity = 33;
public float Acceleration = 1.0f;
public int Deadzone = 10; // stick only
public int Deadzone = 15; // stick only
public bool Filtering = false; // pad only
public float FilterCutoff = 0.05f; // pad only
public bool AxisRotated = false;
Expand Down
5 changes: 4 additions & 1 deletion HandheldCompanion/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<value>en-US</value>
</setting>
<setting name="OverlayControllerRestingPitch" serializeAs="String">
<value>0</value>
<value>20</value>
</setting>
<setting name="SensorPlacementUpsideDown" serializeAs="String">
<value>False</value>
Expand Down Expand Up @@ -305,6 +305,9 @@
<setting name="AYANEOFlipScreenBrightness" serializeAs="String">
<value>100</value>
</setting>
<setting name="HotkeyRumbleOnExecution" serializeAs="String">
<value>False</value>
</setting>
</HandheldCompanion.Properties.Settings>
</userSettings>
</configuration>
4 changes: 2 additions & 2 deletions HandheldCompanion/Commands/EmptyCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public EmptyCommands()
base.OnKeyDown = true;
}

public virtual void Execute(bool IsKeyDown, bool IsKeyUp)
public virtual void Execute(bool IsKeyDown, bool IsKeyUp, bool IsBackground)
{
base.Execute(IsKeyDown, IsKeyUp);
base.Execute(IsKeyDown, IsKeyUp, IsBackground);
}
}
}
4 changes: 2 additions & 2 deletions HandheldCompanion/Commands/ExecutableCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ExecutableCommands()
base.OnKeyUp = true;
}

public override void Execute(bool IsKeyDown, bool IsKeyUp)
public override void Execute(bool IsKeyDown, bool IsKeyUp, bool IsBackground)
{
if (!File.Exists(this.Path))
return;
Expand All @@ -45,7 +45,7 @@ public override void Execute(bool IsKeyDown, bool IsKeyUp)
process.Start();
});

base.Execute(IsKeyDown, IsKeyUp);
base.Execute(IsKeyDown, IsKeyUp, false);
}

public override object Clone()
Expand Down
20 changes: 16 additions & 4 deletions HandheldCompanion/Commands/FunctionCommands.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using HandheldCompanion.Commands.Functions.HC;
using HandheldCompanion.Commands.Functions.Multimedia;
using HandheldCompanion.Commands.Functions.Multitasking;
using HandheldCompanion.Commands.Functions.Performance;
using HandheldCompanion.Commands.Functions.Windows;
using System;
using System.Collections.Generic;
Expand All @@ -19,28 +21,38 @@ public class FunctionCommands : ICommands
typeof(HIDModeCommands),
typeof(DesktopLayoutCommands),
typeof(CycleSubProfileCommands),
typeof(QuickOverlayCommands),
"Power & battery",
typeof(TDPIncrease),
typeof(TDPDecrease),
"Windows",
typeof(OnScreenKeyboardCommands),
typeof(OnScreenKeyboardLegacyCommands),
typeof(KillForegroundCommands),
typeof(ActionCenterCommands),
typeof(SettingsCommands),
typeof(ScreenshotCommands),
"Multimedia",
typeof(GameBarCommands),
"Multitasking",
typeof(KillForegroundCommands),
typeof(TaskManagerCommands),
typeof(SwapScreenCommands),
"Display",
typeof(BrightnessIncrease),
typeof(BrightnessDecrease),
"Sound",
typeof(VolumeIncrease),
typeof(VolumeDecrease),
typeof(VolumeMute),
];

public FunctionCommands()
{
base.commandType = CommandType.Function;
}

public override void Execute(bool IsKeyDown, bool IsKeyUp)
public override void Execute(bool IsKeyDown, bool IsKeyUp, bool IsBackground)
{
base.Execute(IsKeyDown, IsKeyUp);
base.Execute(IsKeyDown, IsKeyUp, IsBackground);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public CycleSubProfileCommands()
base.OnKeyUp = true;
}

public override void Execute(bool IsKeyDown, bool IsKeyUp)
public override void Execute(bool IsKeyDown, bool IsKeyUp, bool IsBackground)
{
switch (CycleIndex)
{
Expand All @@ -28,7 +28,7 @@ public override void Execute(bool IsKeyDown, bool IsKeyUp)
break;
}

base.Execute(IsKeyDown, IsKeyUp);
base.Execute(IsKeyDown, IsKeyUp, false);
}

public override object Clone()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ public DesktopLayoutCommands()
SettingsManager.SettingValueChanged += SettingsManager_SettingValueChanged;
}

private void SettingsManager_SettingValueChanged(string name, object value)
private void SettingsManager_SettingValueChanged(string name, object value, bool temporary)
{
switch (name)
{
case SettingsName:
base.Execute(OnKeyDown, OnKeyUp);
base.Execute(OnKeyDown, OnKeyUp, true);
break;
}
}

public override void Execute(bool IsKeyDown, bool IsKeyUp)
public override void Execute(bool IsKeyDown, bool IsKeyUp, bool IsBackground)
{
bool value = !SettingsManager.GetBoolean(SettingsName, true);
SettingsManager.SetProperty(SettingsName, value, false, true);

base.Execute(IsKeyDown, IsKeyUp);
base.Execute(IsKeyDown, IsKeyUp, false);
}

public override bool IsToggled => SettingsManager.GetBoolean(SettingsName, true);
Expand Down
27 changes: 16 additions & 11 deletions HandheldCompanion/Commands/Functions/HC/HIDModeCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ public HIDModeCommands()
base.FontFamily = "PromptFont";
base.Glyph = "\u243C";

Update();

ProfileManager.Applied += ProfileManager_Applied;
}

private void ProfileManager_Applied(Profile profile, UpdateSource source)
{
IsEnabled = profile.HID == HIDmode.NotSelected;
Update();
}

public override void Update()
{
HIDmode currentHIDmode = (HIDmode)SettingsManager.GetInt(SettingsName, true);
switch (currentHIDmode)
{
Expand All @@ -28,16 +41,10 @@ public HIDModeCommands()
break;
}

ProfileManager.Applied += ProfileManager_Applied;
}

private void ProfileManager_Applied(Profile profile, UpdateSource source)
{
IsEnabled = profile.HID == HIDmode.NotSelected;
base.Update();
}

public override void Execute(bool IsKeyDown, bool IsKeyUp)
public override void Execute(bool IsKeyDown, bool IsKeyUp, bool IsBackground)
{
if (IsEnabled)
{
Expand All @@ -46,19 +53,17 @@ public override void Execute(bool IsKeyDown, bool IsKeyUp)
{
case HIDmode.Xbox360Controller:
SettingsManager.SetProperty(SettingsName, (int)HIDmode.DualShock4Controller);
LiveGlyph = "\uE000";
break;
case HIDmode.DualShock4Controller:
SettingsManager.SetProperty(SettingsName, (int)HIDmode.Xbox360Controller);
LiveGlyph = "\uE001";
break;
default:
break;
}
}

base.Update();
base.Execute(IsKeyDown, IsKeyUp);
Update();
base.Execute(IsKeyDown, IsKeyUp, false);
}

public override object Clone()
Expand Down
6 changes: 3 additions & 3 deletions HandheldCompanion/Commands/Functions/HC/MainWindowCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public MainWindowCommands()

private void StateChanged(object? sender, EventArgs e)
{
base.Execute(OnKeyDown, OnKeyUp);
base.Execute(OnKeyDown, OnKeyUp, true);
}

public override void Execute(bool IsKeyDown, bool IsKeyUp)
public override void Execute(bool IsKeyDown, bool IsKeyUp, bool IsBackground)
{
MainWindow.GetCurrent().SwapWindowState();

base.Execute(IsKeyDown, IsKeyUp);
base.Execute(IsKeyDown, IsKeyUp, false);
}

public override bool IsToggled => MainWindow.GetCurrent().WindowState != System.Windows.WindowState.Minimized;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public OverlayGamepadCommands()

private void IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
{
base.Execute(OnKeyDown, OnKeyUp);
base.Execute(OnKeyDown, OnKeyUp, true);
}

public override void Execute(bool IsKeyDown, bool IsKeyUp)
public override void Execute(bool IsKeyDown, bool IsKeyUp, bool IsBackground)
{
MainWindow.overlayModel.ToggleVisibility();

base.Execute(IsKeyDown, IsKeyUp);
base.Execute(IsKeyDown, IsKeyUp, false);
}

public override bool IsToggled => MainWindow.overlayModel.Visibility == System.Windows.Visibility.Visible;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public OverlayTrackpadCommands()

private void IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
{
base.Execute(OnKeyDown, OnKeyUp);
base.Execute(OnKeyDown, OnKeyUp, true);
}

public override void Execute(bool IsKeyDown, bool IsKeyUp)
public override void Execute(bool IsKeyDown, bool IsKeyUp, bool IsBackground)
{
MainWindow.overlayTrackpad.ToggleVisibility();

base.Execute(IsKeyDown, IsKeyUp);
base.Execute(IsKeyDown, IsKeyUp, false);
}

public override bool IsToggled => MainWindow.overlayTrackpad.Visibility == System.Windows.Visibility.Visible;
Expand Down
Loading

0 comments on commit f9275e3

Please sign in to comment.