From acd72c3537a7e1075ec53133c619158c08328692 Mon Sep 17 00:00:00 2001 From: honjow Date: Thu, 9 May 2024 23:04:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=9F=A5=20Steam=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E6=8F=92=E4=BB=B6=E5=86=85=20TDP=20?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E7=BB=84=E4=BB=B6=20/=20Check=20the=20Steam?= =?UTF-8?q?=20version,=20to=20show=20the=20TDP=20control=20component=20wit?= =?UTF-8?q?hin=20the=20plugin.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config.py | 2 ++ src/components/cpu.tsx | 27 +++++++++++++++++++++++---- src/util/steamClient.ts | 24 ++++++++++++++++++++++++ src/util/steamUtils.tsx | 9 +++++++-- 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/backend/config.py b/backend/config.py index 2d4f445..89756e4 100755 --- a/backend/config.py +++ b/backend/config.py @@ -108,6 +108,8 @@ "7840U": 40, "7640U": 30, "7840": 45, + "7320U": 18, + "7520U": 18, "8840U": 40, "8840": 45, "8850U": 40, diff --git a/src/components/cpu.tsx b/src/components/cpu.tsx index 860ec01..101535a 100755 --- a/src/components/cpu.tsx +++ b/src/components/cpu.tsx @@ -4,7 +4,7 @@ import { ToggleField, } from "decky-frontend-lib"; import { useEffect, useState, VFC } from "react"; -import { Settings, Backend, PluginManager, ComponentName, UpdateType, GPUMODE, Patch } from "../util"; +import { Settings, Backend, PluginManager, ComponentName, UpdateType, GPUMODE, Patch, SteamUtils } from "../util"; import { localizeStrEnum, localizationManager } from "../i18n"; import { SlowSliderField } from "./SlowSliderField" import { CustomTDPComponent } from "."; @@ -122,6 +122,11 @@ const CPUTDPComponent: VFC = () => { const [customTDPRangeMax, setCustomTDPRangeMax] = useState(Settings.appCustomTDPRangeMax()); const [customTDPRangeMin, setCustomTDPRangeMin] = useState(Settings.appCustomTDPRangeMin()); + // 隐藏强制显示TDP开关, 并默认显示 TDP 控制组件。新版 Steam 客户端临时方案 + const [hideForceShowSwitch, setHideForceShowSwitch] = useState(false); + + const minSteamVersion = 1714854927; + const refresh = () => { setTDPEnable(Settings.appTDPEnable()); setDisable(Settings.appGPUMode() == GPUMODE.AUTO); @@ -150,10 +155,24 @@ const CPUTDPComponent: VFC = () => { } } }) + + // 检查 Steam 客户端版本,如果版本大于等于 minSteamVersion。不显示强制 TDP 开关。并默认显示 TDP 控制组件 + // 在解决 QAM 中 TDP 控制组件显示问题后,可以移除该逻辑 + SteamUtils.getSystemInfo().then((systemInfo) => { + // json output + console.log(`>>>>>>>> System Info: ${JSON.stringify(systemInfo, null, 2)}`); + if (systemInfo.nSteamVersion >= minSteamVersion) { + setHideForceShowSwitch(true); + } + }); }, []); + + const _showTdp = !PluginManager.isPatchSuccess(Patch.TDPPatch) || forceShow || hideForceShowSwitch; + console.log(`>>>>>>>> Hide Force Show Switch: ${hideForceShowSwitch}, Show TDP: ${_showTdp}`); + return ( <> - + {!hideForceShowSwitch && { Settings.setForceShowTDP(value); }} /> - - {!PluginManager.isPatchSuccess(Patch.TDPPatch) || forceShow && + } + {_showTdp && <> { + const systemInfo = await SteamClient.System.GetSystemInfo(); + return systemInfo; + } +} \ No newline at end of file