LenovoLegionToolkit
694 строки · 26.1 Кб
1using System;2using System.Collections.Generic;3using System.Linq;4using System.Threading.Tasks;5using LenovoLegionToolkit.Lib.Extensions;6using LenovoLegionToolkit.Lib.Settings;7using LenovoLegionToolkit.Lib.SoftwareDisabler;8using LenovoLegionToolkit.Lib.System.Management;9using LenovoLegionToolkit.Lib.Utils;10
11namespace LenovoLegionToolkit.Lib.Controllers.GodMode;12
13public class GodModeControllerV1 : AbstractGodModeController14{
15public GodModeControllerV1(GodModeSettings settings, VantageDisabler vantageDisabler, LegionZoneDisabler legionZoneDisabler) : base(settings, vantageDisabler, legionZoneDisabler) { }16
17public override Task<bool> NeedsVantageDisabledAsync() => Task.FromResult(false);18public override Task<bool> NeedsLegionZoneDisabledAsync() => Task.FromResult(true);19
20public override async Task ApplyStateAsync()21{22if (await LegionZoneDisabler.GetStatusAsync().ConfigureAwait(false) == SoftwareStatus.Enabled)23{24if (Log.Instance.IsTraceEnabled)25Log.Instance.Trace($"Can't correctly apply state when Legion Zone is running.");26return;27}28
29if (Log.Instance.IsTraceEnabled)30Log.Instance.Trace($"Applying state...");31
32var (presetId, preset) = await GetActivePresetAsync().ConfigureAwait(false);33
34var cpuLongTermPowerLimit = preset.CPULongTermPowerLimit;35var cpuShortTermPowerLimit = preset.CPUShortTermPowerLimit;36var cpuPeakPowerLimit = preset.CPUPeakPowerLimit;37var cpuCrossLoadingPowerLimit = preset.CPUCrossLoadingPowerLimit;38var apuSPPTPowerLimit = preset.APUsPPTPowerLimit;39var cpuTemperatureLimit = preset.CPUTemperatureLimit;40var gpuPowerBoost = preset.GPUPowerBoost;41var gpuConfigurableTgp = preset.GPUConfigurableTGP;42var gpuTemperatureLimit = preset.GPUTemperatureLimit;43var fanTable = preset.FanTable ?? await GetDefaultFanTableAsync().ConfigureAwait(false);44var fanFullSpeed = preset.FanFullSpeed ?? false;45
46if (cpuLongTermPowerLimit is not null)47{48try49{50if (Log.Instance.IsTraceEnabled)51Log.Instance.Trace($"Applying CPU Long Term Power Limit: {cpuLongTermPowerLimit}");52
53await SetCPULongTermPowerLimitAsync(cpuLongTermPowerLimit.Value.Value).ConfigureAwait(false);54}55catch (Exception ex)56{57if (Log.Instance.IsTraceEnabled)58Log.Instance.Trace($"Apply failed. [setting=cpuLongTermPowerLimit]", ex);59throw;60}61}62
63if (cpuShortTermPowerLimit is not null)64{65try66{67if (Log.Instance.IsTraceEnabled)68Log.Instance.Trace($"Applying CPU Short Term Power Limit: {cpuShortTermPowerLimit}");69
70await SetCPUShortTermPowerLimitAsync(cpuShortTermPowerLimit.Value.Value).ConfigureAwait(false);71}72catch (Exception ex)73{74if (Log.Instance.IsTraceEnabled)75Log.Instance.Trace($"Apply failed. [setting=cpuShortTermPowerLimit]", ex);76throw;77}78}79
80if (cpuPeakPowerLimit is not null)81{82try83{84if (Log.Instance.IsTraceEnabled)85Log.Instance.Trace($"Applying CPU Peak Power Limit: {cpuPeakPowerLimit}");86
87await SetCPUPeakPowerLimitAsync(cpuPeakPowerLimit.Value.Value).ConfigureAwait(false);88}89catch (Exception ex)90{91if (Log.Instance.IsTraceEnabled)92Log.Instance.Trace($"Apply failed. [setting=cpuPeakPowerLimit]", ex);93throw;94}95}96
97if (cpuCrossLoadingPowerLimit is not null)98{99try100{101if (Log.Instance.IsTraceEnabled)102Log.Instance.Trace($"Applying CPU Cross Loading Power Limit: {cpuCrossLoadingPowerLimit}");103
104await SetCPUCrossLoadingPowerLimitAsync(cpuCrossLoadingPowerLimit.Value.Value).ConfigureAwait(false);105}106catch (Exception ex)107{108if (Log.Instance.IsTraceEnabled)109Log.Instance.Trace($"Apply failed. [setting=cpuCrossLoadingPowerLimit]", ex);110throw;111}112}113
114if (apuSPPTPowerLimit is not null)115{116try117{118if (Log.Instance.IsTraceEnabled)119Log.Instance.Trace($"Applying APU sPPT Power Limit: {apuSPPTPowerLimit}");120
121await SetAPUSPPTPowerLimitAsync(apuSPPTPowerLimit.Value.Value).ConfigureAwait(false);122}123catch (Exception ex)124{125if (Log.Instance.IsTraceEnabled)126Log.Instance.Trace($"Apply failed. [setting=apuSPPTPowerLimit]", ex);127throw;128}129}130
131if (cpuTemperatureLimit is not null)132{133try134{135if (Log.Instance.IsTraceEnabled)136Log.Instance.Trace($"Applying CPU Temperature Limit: {cpuTemperatureLimit}");137
138await SetCPUTemperatureLimitAsync(cpuTemperatureLimit.Value.Value).ConfigureAwait(false);139}140catch (Exception ex)141{142if (Log.Instance.IsTraceEnabled)143Log.Instance.Trace($"Apply failed. [setting=cpuTemperatureLimit]", ex);144throw;145}146}147
148if (gpuPowerBoost is not null)149{150try151{152if (Log.Instance.IsTraceEnabled)153Log.Instance.Trace($"Applying GPU Power Boost: {gpuPowerBoost}");154
155await SetGPUPowerBoostAsync(gpuPowerBoost.Value.Value).ConfigureAwait(false);156}157catch (Exception ex)158{159if (Log.Instance.IsTraceEnabled)160Log.Instance.Trace($"Apply failed. [setting=gpuPowerBoost]", ex);161throw;162}163}164
165if (gpuConfigurableTgp is not null)166{167try168{169if (Log.Instance.IsTraceEnabled)170Log.Instance.Trace($"Applying GPU Configurable TGP: {gpuConfigurableTgp}");171
172await SetGPUConfigurableTGPAsync(gpuConfigurableTgp.Value.Value).ConfigureAwait(false);173}174catch (Exception ex)175{176if (Log.Instance.IsTraceEnabled)177Log.Instance.Trace($"Apply failed. [setting=gpuConfigurableTgp]", ex);178throw;179}180}181
182if (gpuTemperatureLimit is not null)183{184try185{186if (Log.Instance.IsTraceEnabled)187Log.Instance.Trace($"Applying GPU Temperature Limit: {gpuTemperatureLimit}");188
189await SetGPUTemperatureLimitAsync(gpuTemperatureLimit.Value.Value).ConfigureAwait(false);190}191catch (Exception ex)192{193if (Log.Instance.IsTraceEnabled)194Log.Instance.Trace($"Apply failed. [setting=gpuTemperatureLimit]", ex);195throw;196}197}198
199if (fanFullSpeed)200{201try202{203if (Log.Instance.IsTraceEnabled)204Log.Instance.Trace($"Applying Fan Full Speed {fanFullSpeed}...");205
206await SetFanFullSpeedAsync(fanFullSpeed).ConfigureAwait(false);207}208catch (Exception ex)209{210if (Log.Instance.IsTraceEnabled)211Log.Instance.Trace($"Apply failed. [setting=fanFullSpeed]", ex);212throw;213}214}215else216{217
218try219{220if (Log.Instance.IsTraceEnabled)221Log.Instance.Trace($"Making sure Fan Full Speed is false...");222
223await SetFanFullSpeedAsync(false).ConfigureAwait(false);224}225catch (Exception ex)226{227if (Log.Instance.IsTraceEnabled)228Log.Instance.Trace($"Apply failed. [setting=fanFullSpeed]", ex);229throw;230}231
232try233{234if (Log.Instance.IsTraceEnabled)235Log.Instance.Trace($"Applying Fan Table {fanTable}...");236
237if (!await IsValidFanTableAsync(fanTable).ConfigureAwait(false))238{239if (Log.Instance.IsTraceEnabled)240Log.Instance.Trace($"Fan table invalid, replacing with default...");241
242fanTable = await GetDefaultFanTableAsync().ConfigureAwait(false);243}244
245await SetFanTable(fanTable).ConfigureAwait(false);246}247catch (Exception ex)248{249if (Log.Instance.IsTraceEnabled)250Log.Instance.Trace($"Apply failed. [setting=fanTable]", ex);251throw;252}253}254
255RaisePresetChanged(presetId);256
257if (Log.Instance.IsTraceEnabled)258Log.Instance.Trace($"State applied. [name={preset.Name}, id={presetId}]");259}260
261public override Task<FanTable> GetMinimumFanTableAsync()262{263var fanTable = new FanTable(new ushort[] { 0, 0, 0, 0, 0, 0, 0, 1, 3, 5 });264return Task.FromResult(fanTable);265}266
267public override async Task<Dictionary<PowerModeState, GodModeDefaults>> GetDefaultsInOtherPowerModesAsync()268{269try270{271if (Log.Instance.IsTraceEnabled)272Log.Instance.Trace($"Getting defaults in other power modes...");273
274var result = await GetDefaultValuesInDifferentModeAsync().ConfigureAwait(false);275
276if (Log.Instance.IsTraceEnabled)277{278Log.Instance.Trace($"Defaults in other power modes retrieved:");279foreach (var (powerMode, defaults) in result)280Log.Instance.Trace($" - {powerMode}: {defaults}");281}282
283return result;284}285catch (Exception ex)286{287if (Log.Instance.IsTraceEnabled)288Log.Instance.Trace($"Failed to get defaults in other power modes.", ex);289return new Dictionary<PowerModeState, GodModeDefaults>();290}291}292
293public override async Task RestoreDefaultsInOtherPowerModeAsync(PowerModeState state)294{295try296{297if (Log.Instance.IsTraceEnabled)298Log.Instance.Trace($"Restoring defaults for {state}...");299
300var result = await GetDefaultValuesInDifferentModeAsync().ConfigureAwait(false);301
302if (!result.TryGetValue(state, out var defaults))303{304if (Log.Instance.IsTraceEnabled)305Log.Instance.Trace($"Defaults for {state} not found. Skipping...");306
307return;308}309
310if (defaults.CPULongTermPowerLimit is not null)311{312try313{314if (Log.Instance.IsTraceEnabled)315Log.Instance.Trace($"Applying CPU Long Term Power Limit: {defaults.CPULongTermPowerLimit}");316
317await SetCPULongTermPowerLimitAsync(defaults.CPULongTermPowerLimit.Value).ConfigureAwait(false);318}319catch (Exception ex)320{321if (Log.Instance.IsTraceEnabled)322Log.Instance.Trace($"Apply failed. [setting=cpuLongTermPowerLimit]", ex);323throw;324}325}326
327if (defaults.CPUShortTermPowerLimit is not null)328{329try330{331if (Log.Instance.IsTraceEnabled)332Log.Instance.Trace($"Applying CPU Short Term Power Limit: {defaults.CPUShortTermPowerLimit}");333
334await SetCPUShortTermPowerLimitAsync(defaults.CPUShortTermPowerLimit.Value).ConfigureAwait(false);335}336catch (Exception ex)337{338if (Log.Instance.IsTraceEnabled)339Log.Instance.Trace($"Apply failed. [setting=cpuShortTermPowerLimit]", ex);340throw;341}342}343
344if (defaults.CPUPeakPowerLimit is not null)345{346try347{348if (Log.Instance.IsTraceEnabled)349Log.Instance.Trace($"Applying CPU Peak Power Limit: {defaults.CPUPeakPowerLimit}");350
351await SetCPUPeakPowerLimitAsync(defaults.CPUPeakPowerLimit.Value).ConfigureAwait(false);352}353catch (Exception ex)354{355if (Log.Instance.IsTraceEnabled)356Log.Instance.Trace($"Apply failed. [setting=cpuPeakPowerLimit]", ex);357throw;358}359}360
361if (defaults.CPUCrossLoadingPowerLimit is not null)362{363try364{365if (Log.Instance.IsTraceEnabled)366Log.Instance.Trace($"Applying CPU Cross Loading Power Limit: {defaults.CPUCrossLoadingPowerLimit}");367
368await SetCPUCrossLoadingPowerLimitAsync(defaults.CPUCrossLoadingPowerLimit.Value).ConfigureAwait(false);369}370catch (Exception ex)371{372if (Log.Instance.IsTraceEnabled)373Log.Instance.Trace($"Apply failed. [setting=cpuCrossLoadingPowerLimit]", ex);374throw;375}376}377
378if (defaults.APUsPPTPowerLimit is not null)379{380try381{382if (Log.Instance.IsTraceEnabled)383Log.Instance.Trace($"Applying APU sPPT Power Limit: {defaults.APUsPPTPowerLimit}");384
385await SetAPUSPPTPowerLimitAsync(defaults.APUsPPTPowerLimit.Value).ConfigureAwait(false);386}387catch (Exception ex)388{389if (Log.Instance.IsTraceEnabled)390Log.Instance.Trace($"Apply failed. [setting=apuSPPTPowerLimit]", ex);391throw;392}393}394
395if (defaults.CPUTemperatureLimit is not null)396{397try398{399if (Log.Instance.IsTraceEnabled)400Log.Instance.Trace($"Applying CPU Temperature Limit: {defaults.CPUTemperatureLimit}");401
402await SetCPUTemperatureLimitAsync(defaults.CPUTemperatureLimit.Value).ConfigureAwait(false);403}404catch (Exception ex)405{406if (Log.Instance.IsTraceEnabled)407Log.Instance.Trace($"Apply failed. [setting=cpuTemperatureLimit]", ex);408throw;409}410}411
412if (defaults.GPUPowerBoost is not null)413{414try415{416if (Log.Instance.IsTraceEnabled)417Log.Instance.Trace($"Applying GPU Power Boost: {defaults.GPUPowerBoost}");418
419await SetGPUPowerBoostAsync(defaults.GPUPowerBoost.Value).ConfigureAwait(false);420}421catch (Exception ex)422{423if (Log.Instance.IsTraceEnabled)424Log.Instance.Trace($"Apply failed. [setting=gpuPowerBoost]", ex);425throw;426}427}428
429if (defaults.GPUConfigurableTGP is not null)430{431try432{433if (Log.Instance.IsTraceEnabled)434Log.Instance.Trace($"Applying GPU Configurable TGP: {defaults.GPUConfigurableTGP}");435
436await SetGPUConfigurableTGPAsync(defaults.GPUConfigurableTGP.Value).ConfigureAwait(false);437}438catch (Exception ex)439{440if (Log.Instance.IsTraceEnabled)441Log.Instance.Trace($"Apply failed. [setting=gpuConfigurableTgp]", ex);442throw;443}444}445}446catch (Exception ex)447{448if (Log.Instance.IsTraceEnabled)449Log.Instance.Trace($"Failed to restore defaults for {state}.", ex);450}451}452
453protected override async Task<GodModePreset> GetDefaultStateAsync()454{455var fanTableData = await GetFanTableDataAsync().ConfigureAwait(false);456
457var preset = new GodModePreset458{459Name = "Default",460CPULongTermPowerLimit = await GetCPULongTermPowerLimitAsync().OrNullIfException().ConfigureAwait(false),461CPUShortTermPowerLimit = await GetCPUShortTermPowerLimitAsync().OrNullIfException().ConfigureAwait(false),462CPUPeakPowerLimit = await GetCPUPeakPowerLimitAsync().OrNullIfException().ConfigureAwait(false),463CPUCrossLoadingPowerLimit = await GetCPUCrossLoadingPowerLimitAsync().OrNullIfException().ConfigureAwait(false),464APUsPPTPowerLimit = await GetAPUSPPTPowerLimitAsync().OrNullIfException().ConfigureAwait(false),465CPUTemperatureLimit = await GetCPUTemperatureLimitAsync().OrNullIfException().ConfigureAwait(false),466GPUPowerBoost = await GetGPUPowerBoost().OrNullIfException().ConfigureAwait(false),467GPUConfigurableTGP = await GetGPUConfigurableTGPAsync().OrNullIfException().ConfigureAwait(false),468GPUTemperatureLimit = await GetGPUTemperatureLimitAsync().OrNullIfException().ConfigureAwait(false),469FanTableInfo = fanTableData is null ? null : new FanTableInfo(fanTableData, await GetDefaultFanTableAsync().ConfigureAwait(false)),470FanFullSpeed = await GetFanFullSpeedAsync().ConfigureAwait(false),471MinValueOffset = 0,472MaxValueOffset = 0473};474
475if (Log.Instance.IsTraceEnabled)476Log.Instance.Trace($"Default state retrieved: {preset}");477
478return preset;479}480
481#region CPU Long Term Power Limit482
483private static async Task<StepperValue> GetCPULongTermPowerLimitAsync()484{485var defaultValue = await WMI.LenovoCpuMethod.CPUGetDefaultPowerLimitAsync().OrNullIfException().ConfigureAwait(false);486var (value, min, max, step) = await WMI.LenovoCpuMethod.CPUGetLongTermPowerLimitAsync().ConfigureAwait(false);487return new(value, min, max, step, Array.Empty<int>(), defaultValue?.longTerm);488}489
490private static Task SetCPULongTermPowerLimitAsync(int value) => WMI.LenovoCpuMethod.CPUSetLongTermPowerLimitAsync(value);491
492#endregion493
494#region CPU Short Term Power Limit495
496private static async Task<StepperValue> GetCPUShortTermPowerLimitAsync()497{498var defaultValue = await WMI.LenovoCpuMethod.CPUGetDefaultPowerLimitAsync().OrNullIfException().ConfigureAwait(false);499var (value, min, max, step) = await WMI.LenovoCpuMethod.CPUGetShortTermPowerLimitAsync().ConfigureAwait(false);500return new(value, min, max, step, Array.Empty<int>(), defaultValue?.shortTerm);501}502
503private static Task SetCPUShortTermPowerLimitAsync(int value) => WMI.LenovoCpuMethod.CPUSetShortTermPowerLimitAsync(value);504
505#endregion506
507#region CPU Peak Power Limit508
509private static async Task<StepperValue> GetCPUPeakPowerLimitAsync()510{511var (value, min, max, step, defaultValue) = await WMI.LenovoCpuMethod.CPUGetPeakPowerLimitAsync().ConfigureAwait(false);512return new(value, min, max, step, Array.Empty<int>(), defaultValue);513}514
515private static Task SetCPUPeakPowerLimitAsync(int value) => WMI.LenovoCpuMethod.CPUSetPeakPowerLimitAsync(value);516
517#endregion518
519#region CPU Cross Loading Power Limit520
521private static async Task<StepperValue> GetCPUCrossLoadingPowerLimitAsync()522{523var (value, min, max, step, defaultValue) = await WMI.LenovoCpuMethod.CPUGetCrossLoadingPowerLimitAsync().ConfigureAwait(false);524return new(value, min, max, step, Array.Empty<int>(), defaultValue);525}526
527private static Task SetCPUCrossLoadingPowerLimitAsync(int value) => WMI.LenovoCpuMethod.CPUSetCrossLoadingPowerLimitAsync(value);528
529#endregion530
531#region APU sPPT Power Limit532
533private static async Task<StepperValue> GetAPUSPPTPowerLimitAsync()534{535var (value, min, max, step, defaultValue) = await WMI.LenovoCpuMethod.GetAPUSPPTPowerLimitAsync().ConfigureAwait(false);536return new(value, min, max, step, Array.Empty<int>(), defaultValue);537}538
539private static Task SetAPUSPPTPowerLimitAsync(int value) => WMI.LenovoCpuMethod.SetAPUSPPTPowerLimitAsync(value);540
541#endregion542
543#region CPU Temperature Limit544
545private static async Task<StepperValue> GetCPUTemperatureLimitAsync()546{547var (value, min, max, step, defaultValue) = await WMI.LenovoCpuMethod.CPUGetTemperatureControlAsync().ConfigureAwait(false);548return new(value, min, max, step, Array.Empty<int>(), defaultValue);549}550
551private static Task SetCPUTemperatureLimitAsync(int value) => WMI.LenovoCpuMethod.CPUSetTemperatureControlAsync(value);552
553#endregion554
555#region GPU Configurable TGP556
557private static async Task<StepperValue> GetGPUConfigurableTGPAsync()558{559var defaultValue = await WMI.LenovoGpuMethod.GPUGetDefaultPPABcTGPPowerLimit().OrNullIfException().ConfigureAwait(false);560var (value, min, max, step) = await WMI.LenovoGpuMethod.GPUGetCTGPPowerLimitAsync().ConfigureAwait(false);561return new(value, min, max, step, Array.Empty<int>(), defaultValue?.ctgp);562}563
564private static Task SetGPUConfigurableTGPAsync(int value) => WMI.LenovoGpuMethod.GPUSetCTGPPowerLimitAsync(value);565
566#endregion567
568#region GPU Power Boost569
570private static async Task<StepperValue> GetGPUPowerBoost()571{572var defaultValue = await WMI.LenovoGpuMethod.GPUGetDefaultPPABcTGPPowerLimit().OrNullIfException().ConfigureAwait(false);573var (value, min, max, step) = await WMI.LenovoGpuMethod.GPUGetPPABPowerLimitAsync().ConfigureAwait(false);574return new(value, min, max, step, Array.Empty<int>(), defaultValue?.ppab);575}576
577private static Task SetGPUPowerBoostAsync(int value) => WMI.LenovoGpuMethod.GPUSetPPABPowerLimitAsync(value);578
579#endregion580
581#region GPU Temperature Limit582
583private static async Task<StepperValue> GetGPUTemperatureLimitAsync()584{585var (value, min, max, step, defaultValue) = await WMI.LenovoGpuMethod.GPUGetTemperatureLimitAsync().ConfigureAwait(false);586return new(value, min, max, step, Array.Empty<int>(), defaultValue);587}588
589private static Task SetGPUTemperatureLimitAsync(int value) => WMI.LenovoGpuMethod.GPUSetTemperatureLimitAsync(value);590
591#endregion592
593#region Fan Table594
595private static async Task<FanTableData[]?> GetFanTableDataAsync()596{597if (Log.Instance.IsTraceEnabled)598Log.Instance.Trace($"Reading fan table data...");599
600var data = await WMI.LenovoFanTableData.ReadAsync().ConfigureAwait(false);601
602var fanTableData = data603.Select(d => new FanTableData604{605Type = (d.fanId, d.sensorId) switch606{607(0, 3) => FanTableType.CPU,608(1, 4) => FanTableType.GPU,609(0, 0) => FanTableType.CPUSensor,610_ => FanTableType.Unknown,611},612FanId = d.fanId,613SensorId = d.sensorId,614FanSpeeds = d.fanTableData,615Temps = d.sensorTableData616})617.ToArray();618
619if (fanTableData.Length != 3)620{621if (Log.Instance.IsTraceEnabled)622Log.Instance.Trace($"Bad fan table length: {fanTableData}");623
624return null;625}626
627if (fanTableData.Count(ftd => ftd.FanSpeeds.Length == 10) != 3)628{629if (Log.Instance.IsTraceEnabled)630Log.Instance.Trace($"Bad fan table fan speeds length: {fanTableData}");631
632return null;633}634
635if (fanTableData.Count(ftd => ftd.Temps.Length == 10) != 3)636{637if (Log.Instance.IsTraceEnabled)638Log.Instance.Trace($"Bad fan table temps length: {fanTableData}");639
640return null;641}642
643if (Log.Instance.IsTraceEnabled)644Log.Instance.Trace($"Fan table data: {fanTableData}");645
646return fanTableData;647}648
649private static Task SetFanTable(FanTable fanTable) => WMI.LenovoFanMethod.FanSetTableAsync(fanTable.GetBytes());650
651#endregion652
653#region Fan Full Speed654
655private static Task<bool> GetFanFullSpeedAsync() => WMI.LenovoFanMethod.FanGetFullSpeedAsync();656
657private static Task SetFanFullSpeedAsync(bool enabled) => WMI.LenovoFanMethod.FanSetFullSpeedAsync(enabled ? 1 : 0);658
659#endregion660
661#region Default values662
663private async Task<Dictionary<PowerModeState, GodModeDefaults>> GetDefaultValuesInDifferentModeAsync()664{665var defaultFanTableAsync = await GetDefaultFanTableAsync().ConfigureAwait(false);666
667var result = await WMI.LenovoDefaultValueInDifferentModeData.ReadAsync().ConfigureAwait(false);668return result.Select(d =>669{670var powerMode = (PowerModeState)(d.Mode - 1);671var defaults = new GodModeDefaults672{673CPULongTermPowerLimit = d.CPULongTermPowerLimit,674CPUShortTermPowerLimit = d.CPUShortTermPowerLimit,675CPUPeakPowerLimit = d.CPUPeakPowerLimit,676CPUCrossLoadingPowerLimit = d.CPUCrossLoadingPowerLimit,677APUsPPTPowerLimit = d.APUsPPTPowerLimit,678CPUTemperatureLimit = d.CPUTemperatureLimit,679GPUPowerBoost = d.GPUPowerBoost,680GPUConfigurableTGP = d.GPUConfigurableTGP,681GPUTemperatureLimit = d.GPUTemperatureLimit,682FanTable = defaultFanTableAsync,683FanFullSpeed = false684};685return (powerMode, defaults);686})687.Where(d => d.powerMode is PowerModeState.Quiet or PowerModeState.Balance or PowerModeState.Performance)688.DistinctBy(d => d.powerMode)689.ToDictionary(d => d.powerMode, d => d.defaults);690}691
692#endregion693
694}
695