Prepare ThreadPilot 1.7.0 gaming and signing release (#51)

This commit is contained in:
Prime Build
2026-08-13 01:50:48 +02:00
committed by GitHub
parent 23cbad397b
commit d730260541
152 changed files with 2155 additions and 600 deletions
+59
View File
@@ -50,7 +50,9 @@ namespace ThreadPilot.ViewModels
Enum.GetValues<SystemTweak>().Select(type => new SystemTweakItem
{
TweakType = type,
IsGuidedAction = type is SystemTweak.MemoryIntegrity or SystemTweak.Hags or SystemTweak.WindowedOptimizations,
ToggleCommand = new AsyncRelayCommand<SystemTweakItem>(this.ToggleTweakAsync),
ActionCommand = new AsyncRelayCommand<SystemTweakItem>(this.OpenTweakSettingsAsync),
}));
this.ApplyLocalizedTweakText();
}
@@ -105,8 +107,20 @@ namespace ThreadPilot.ViewModels
{
TweakStatus status = item.TweakType switch
{
SystemTweak.GameMode => await this.systemTweaksService.GetGameModeStatusAsync(),
SystemTweak.CoreParking => await this.systemTweaksService.GetCoreParkingStatusAsync(),
SystemTweak.CStates => await this.systemTweaksService.GetCStatesStatusAsync(),
SystemTweak.MemoryIntegrity => await this.systemTweaksService.GetMemoryIntegrityStatusAsync(),
SystemTweak.Hags or SystemTweak.WindowedOptimizations => new TweakStatus
{
IsAvailable = true,
StatusText = this.Localize("SystemTweaks_StatusManagedByWindows", "Managed by Windows"),
},
SystemTweak.UsbSelectiveSuspend => await this.systemTweaksService.GetUsbSelectiveSuspendStatusAsync(),
SystemTweak.PointerPrecision => await this.systemTweaksService.GetPointerPrecisionStatusAsync(),
SystemTweak.EthernetPowerSaving => await this.systemTweaksService.GetEthernetPowerSavingStatusAsync(),
SystemTweak.InterruptModeration => await this.systemTweaksService.GetInterruptModerationStatusAsync(),
SystemTweak.GpuMsiMode => await this.systemTweaksService.GetGpuMsiModeStatusAsync(),
SystemTweak.SysMain => await this.systemTweaksService.GetSysMainStatusAsync(),
SystemTweak.Prefetch => await this.systemTweaksService.GetPrefetchStatusAsync(),
SystemTweak.PowerThrottling => await this.systemTweaksService.GetPowerThrottlingStatusAsync(),
@@ -118,6 +132,7 @@ namespace ThreadPilot.ViewModels
item.IsEnabled = status.IsEnabled;
item.IsAvailable = status.IsAvailable;
item.ErrorMessage = status.ErrorMessage;
item.StatusText = status.StatusText ?? this.GetStatusText(status);
}
catch (Exception ex)
{
@@ -144,8 +159,14 @@ namespace ThreadPilot.ViewModels
var newState = !item.IsEnabled;
bool success = item.TweakType switch
{
SystemTweak.GameMode => await this.systemTweaksService.SetGameModeAsync(newState),
SystemTweak.CoreParking => await this.systemTweaksService.SetCoreParkingAsync(newState),
SystemTweak.CStates => await this.systemTweaksService.SetCStatesAsync(newState),
SystemTweak.UsbSelectiveSuspend => await this.systemTweaksService.SetUsbSelectiveSuspendAsync(newState),
SystemTweak.PointerPrecision => await this.systemTweaksService.SetPointerPrecisionAsync(newState),
SystemTweak.EthernetPowerSaving => await this.systemTweaksService.SetEthernetPowerSavingAsync(newState),
SystemTweak.InterruptModeration => await this.systemTweaksService.SetInterruptModerationAsync(newState),
SystemTweak.GpuMsiMode => await this.systemTweaksService.SetGpuMsiModeAsync(newState),
SystemTweak.SysMain => await this.systemTweaksService.SetSysMainAsync(newState),
SystemTweak.Prefetch => await this.systemTweaksService.SetPrefetchAsync(newState),
SystemTweak.PowerThrottling => await this.systemTweaksService.SetPowerThrottlingAsync(newState),
@@ -209,6 +230,18 @@ namespace ThreadPilot.ViewModels
}
}
private async Task OpenTweakSettingsAsync(SystemTweakItem? item)
{
if (item == null || !await this.systemTweaksService.OpenSettingsAsync(item.TweakType))
{
this.SetError(this.Localize("SystemTweaks_StatusOpenSettingsFailed", "Could not open Windows settings"), null);
return;
}
this.SetStatus(this.Localize("SystemTweaks_StatusSettingsOpenedFormat", "Opened settings for {0}", item.Name));
await this.LogUserActionAsync("SystemTweakSettingsOpened", $"Opened settings for {item.Name}", item.TweakType.ToString());
}
private static Task InvokeOnUiAsync(Action action)
{
var dispatcher = System.Windows.Application.Current?.Dispatcher;
@@ -227,8 +260,17 @@ namespace ThreadPilot.ViewModels
{
var text = item.TweakType switch
{
SystemTweak.GameMode => ("SystemTweak_GameMode_Name", "Game Mode", "SystemTweak_GameMode_Desc", "Windows Game Mode scheduling optimizations"),
SystemTweak.CoreParking => ("SystemTweak_CoreParking_Name", "Core Parking", "SystemTweak_CoreParking_Desc", "Controls CPU core parking for power management"),
SystemTweak.CStates => ("SystemTweak_CStates_Name", "C-States", "SystemTweak_CStates_Desc", "Controls CPU C-States for power management"),
SystemTweak.MemoryIntegrity => ("SystemTweak_MemoryIntegrity_Name", "Memory Integrity (HVCI)", "SystemTweak_MemoryIntegrity_Desc", "Opens Windows Security. Disabling this protection reduces system security and may require a restart."),
SystemTweak.Hags => ("SystemTweak_Hags_Name", "Hardware-accelerated GPU scheduling", "SystemTweak_Hags_Desc", "Opens Windows graphics settings to let you review HAGS."),
SystemTweak.WindowedOptimizations => ("SystemTweak_WindowedOptimizations_Name", "Optimizations for windowed games", "SystemTweak_WindowedOptimizations_Desc", "Opens Windows graphics settings to manage Flip Model optimizations."),
SystemTweak.UsbSelectiveSuspend => ("SystemTweak_UsbSelectiveSuspend_Name", "USB Selective Suspend", "SystemTweak_UsbSelectiveSuspend_Desc", "Controls USB selective suspend for the active power plan while plugged in."),
SystemTweak.PointerPrecision => ("SystemTweak_PointerPrecision_Name", "Enhance pointer precision", "SystemTweak_PointerPrecision_Desc", "Controls Windows mouse acceleration."),
SystemTweak.EthernetPowerSaving => ("SystemTweak_EthernetPowerSaving_Name", "Disable Ethernet power saving", "SystemTweak_EthernetPowerSaving_Desc", "Disables supported EEE, Green Ethernet and power-saving driver properties on physical Ethernet adapters."),
SystemTweak.InterruptModeration => ("SystemTweak_InterruptModeration_Name", "Disable interrupt moderation", "SystemTweak_InterruptModeration_Desc", "Can reduce Ethernet latency at the cost of higher CPU and interrupt load."),
SystemTweak.GpuMsiMode => ("SystemTweak_GpuMsiMode_Name", "GPU MSI Mode", "SystemTweak_GpuMsiMode_Desc", "Controls MSI only when the display driver already exposes MSISupported. A restart is required."),
SystemTweak.SysMain => ("SystemTweak_SysMain_Name", "SysMain Service", "SystemTweak_SysMain_Desc", "Windows SysMain service for memory management"),
SystemTweak.Prefetch => ("SystemTweak_Prefetch_Name", "Prefetch", "SystemTweak_Prefetch_Desc", "Windows Prefetch for faster application loading"),
SystemTweak.PowerThrottling => ("SystemTweak_PowerThrottling_Name", "Power Throttling", "SystemTweak_PowerThrottling_Desc", "Turns off Windows Power Throttling for sustained performance"),
@@ -239,6 +281,10 @@ namespace ThreadPilot.ViewModels
item.Name = this.Localize(text.Item1, text.Item2);
item.Description = this.Localize(text.Item3, text.Item4);
if (!string.IsNullOrEmpty(item.StatusText) && item.TweakType is not SystemTweak.Hags and not SystemTweak.WindowedOptimizations)
{
item.StatusText = this.GetStatusText(new TweakStatus { IsAvailable = item.IsAvailable, IsEnabled = item.IsEnabled });
}
}
this.RefreshStatusText = this.Localize("SystemTweaks_StatusReady", "Ready");
@@ -255,6 +301,10 @@ namespace ThreadPilot.ViewModels
: string.Format(CultureInfo.CurrentCulture, format, arguments);
}
private string GetStatusText(TweakStatus status) => !status.IsAvailable
? this.Localize("SystemTweaks_StatusNotAvailable", "Not available")
: this.Localize(status.IsEnabled ? "SystemTweaks_StatusEnabled" : "SystemTweaks_StatusDisabled", status.IsEnabled ? "Enabled" : "Disabled");
private void OnLanguageChanged(object? sender, string language) => this.ApplyLocalizedTweakText();
private void OnTweakStatusChanged(object? sender, TweakStatusChangedEventArgs e)
@@ -267,6 +317,7 @@ namespace ThreadPilot.ViewModels
item.IsEnabled = e.Status.IsEnabled;
item.IsAvailable = e.Status.IsAvailable;
item.ErrorMessage = e.Status.ErrorMessage;
item.StatusText = e.Status.StatusText ?? this.GetStatusText(e.Status);
}
}
catch (Exception ex)
@@ -303,6 +354,14 @@ namespace ThreadPilot.ViewModels
[ObservableProperty]
private string? errorMessage;
[ObservableProperty]
private string statusText = string.Empty;
[ObservableProperty]
private bool isGuidedAction;
public IAsyncRelayCommand<SystemTweakItem>? ToggleCommand { get; set; }
public IAsyncRelayCommand<SystemTweakItem>? ActionCommand { get; set; }
}
}