From eb1c32ee61d4d4098feb1441ea5bf3b73f520780 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Wed, 16 Jul 2025 10:42:54 -0400 Subject: initial add of fps cap ui toggle --- src/components/ConfigurationSection.tsx | 27 ++++++++++++++++++++++++++- src/components/Content.tsx | 20 +++++++++++++------- src/components/UsageInstructions.tsx | 5 +++++ 3 files changed, 44 insertions(+), 8 deletions(-) (limited to 'src/components') diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index 34955f8..6c6f50a 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -8,6 +8,7 @@ interface LsfgConfig { perfMode: boolean; immediateMode: boolean; disableVkbasalt: boolean; + frameCap: number; } interface ConfigurationSectionProps { @@ -19,6 +20,7 @@ interface ConfigurationSectionProps { onPerfModeChange: (value: boolean) => Promise; onImmediateModeChange: (value: boolean) => Promise; onDisableVkbasaltChange: (value: boolean) => Promise; + onFrameCapChange: (value: number) => Promise; } export function ConfigurationSection({ @@ -29,7 +31,8 @@ export function ConfigurationSection({ onHdrChange, onPerfModeChange, onImmediateModeChange, - onDisableVkbasaltChange + onDisableVkbasaltChange, + onFrameCapChange }: ConfigurationSectionProps) { return ( <> @@ -114,6 +117,28 @@ export function ConfigurationSection({ /> + + + + {/* { setters.setEnableLsfg(value); - await updateConfig(value, config.multiplier, config.flowScale, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt); + await updateConfig(value, config.multiplier, config.flowScale, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt, config.frameCap); }; const handleMultiplierChange = async (value: number) => { setters.setMultiplier(value); - await updateConfig(config.enableLsfg, value, config.flowScale, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt); + await updateConfig(config.enableLsfg, value, config.flowScale, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt, config.frameCap); }; const handleFlowScaleChange = async (value: number) => { setters.setFlowScale(value); - await updateConfig(config.enableLsfg, config.multiplier, value, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt); + await updateConfig(config.enableLsfg, config.multiplier, value, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt, config.frameCap); }; const handleHdrChange = async (value: boolean) => { setters.setHdr(value); - await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, value, config.perfMode, config.immediateMode, config.disableVkbasalt); + await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, value, config.perfMode, config.immediateMode, config.disableVkbasalt, config.frameCap); }; const handlePerfModeChange = async (value: boolean) => { setters.setPerfMode(value); - await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, value, config.immediateMode, config.disableVkbasalt); + await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, value, config.immediateMode, config.disableVkbasalt, config.frameCap); }; const handleImmediateModeChange = async (value: boolean) => { setters.setImmediateMode(value); - await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, config.perfMode, value, config.disableVkbasalt); + await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, config.perfMode, value, config.disableVkbasalt, config.frameCap); }; const handleDisableVkbasaltChange = async (value: boolean) => { setters.setDisableVkbasalt(value); - await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, config.perfMode, config.immediateMode, value); + await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, config.perfMode, config.immediateMode, value, config.frameCap); + }; + + const handleFrameCapChange = async (value: number) => { + setters.setFrameCap(value); + await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt, value); }; const onInstall = () => { @@ -107,6 +112,7 @@ export function Content() { onPerfModeChange={handlePerfModeChange} onImmediateModeChange={handleImmediateModeChange} onDisableVkbasaltChange={handleDisableVkbasaltChange} + onFrameCapChange={handleFrameCapChange} /> )} diff --git a/src/components/UsageInstructions.tsx b/src/components/UsageInstructions.tsx index bf80630..3589c04 100644 --- a/src/components/UsageInstructions.tsx +++ b/src/components/UsageInstructions.tsx @@ -8,6 +8,7 @@ interface ConfigType { perfMode: boolean; immediateMode: boolean; disableVkbasalt: boolean; + frameCap: number; } interface UsageInstructionsProps { @@ -45,6 +46,10 @@ export function UsageInstructions({ config }: UsageInstructionsProps) { envVars.push("DISABLE_VKBASALT=1"); } + if (config.frameCap > 0) { + envVars.push(`DXVK_FRAME_RATE=${config.frameCap}`); + } + return envVars.length > 0 ? `${envVars.join(" ")} %command%` : "%command%"; }; -- cgit v1.2.3 From 9ca1d59049f8c37a49db1bfb75e471f752b8daaf Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Wed, 16 Jul 2025 11:33:17 -0400 Subject: slider non notches for fps capper --- src/components/ConfigurationSection.tsx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/components') diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index 6c6f50a..ab1e1b7 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -124,17 +124,7 @@ export function ConfigurationSection({ value={config.frameCap} min={0} max={60} - step={5} - notchCount={7} - notchLabels={[ - { notchIndex: 0, label: "Off" }, - { notchIndex: 1, label: "10" }, - { notchIndex: 2, label: "20" }, - { notchIndex: 3, label: "30" }, - { notchIndex: 4, label: "40" }, - { notchIndex: 5, label: "50" }, - { notchIndex: 6, label: "60" } - ]} + step={1} onChange={onFrameCapChange} /> -- cgit v1.2.3 From 1bc7e97c0a915f2d3c035a65659cea4e37aa9ad6 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Wed, 16 Jul 2025 11:37:40 -0400 Subject: revise desc of fps slider --- src/components/ConfigurationSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index ab1e1b7..11bb6b9 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -120,7 +120,7 @@ export function ConfigurationSection({ Date: Wed, 16 Jul 2025 13:54:09 -0400 Subject: centralized configuration system for lsfg-vk params --- src/components/ConfigurationSection.tsx | 64 +++++++++++---------------------- src/components/Content.tsx | 55 ++++------------------------ src/components/UsageInstructions.tsx | 30 ++++++---------- 3 files changed, 36 insertions(+), 113 deletions(-) (limited to 'src/components') diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index 11bb6b9..2545217 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -1,38 +1,14 @@ import { PanelSectionRow, ToggleField, SliderField } from "@decky/ui"; - -interface LsfgConfig { - enableLsfg: boolean; - multiplier: number; - flowScale: number; - hdr: boolean; - perfMode: boolean; - immediateMode: boolean; - disableVkbasalt: boolean; - frameCap: number; -} +import { ConfigurationData } from "../config/configSchema"; interface ConfigurationSectionProps { - config: LsfgConfig; - onEnableLsfgChange: (value: boolean) => Promise; - onMultiplierChange: (value: number) => Promise; - onFlowScaleChange: (value: number) => Promise; - onHdrChange: (value: boolean) => Promise; - onPerfModeChange: (value: boolean) => Promise; - onImmediateModeChange: (value: boolean) => Promise; - onDisableVkbasaltChange: (value: boolean) => Promise; - onFrameCapChange: (value: number) => Promise; + config: ConfigurationData; + onConfigChange: (fieldName: keyof ConfigurationData, value: boolean | number) => Promise; } export function ConfigurationSection({ config, - onEnableLsfgChange, - onMultiplierChange, - onFlowScaleChange, - onHdrChange, - onPerfModeChange, - onImmediateModeChange, - onDisableVkbasaltChange, - onFrameCapChange + onConfigChange }: ConfigurationSectionProps) { return ( <> @@ -55,8 +31,8 @@ export function ConfigurationSection({ onConfigChange('enable_lsfg', value)} /> @@ -74,19 +50,19 @@ export function ConfigurationSection({ { notchIndex: 1, label: "3X" }, { notchIndex: 2, label: "4X" } ]} - onChange={onMultiplierChange} + onChange={(value) => onConfigChange('multiplier', value)} /> onConfigChange('flow_scale', value)} /> @@ -95,7 +71,7 @@ export function ConfigurationSection({ label="HDR Mode" description="Enable HDR mode (only if Game supports HDR)" checked={config.hdr} - onChange={onHdrChange} + onChange={(value) => onConfigChange('hdr', value)} /> @@ -103,8 +79,8 @@ export function ConfigurationSection({ onConfigChange('perf_mode', value)} /> @@ -112,20 +88,20 @@ export function ConfigurationSection({ onConfigChange('immediate_mode', value)} /> onConfigChange('frame_cap', value)} /> @@ -133,8 +109,8 @@ export function ConfigurationSection({ onConfigChange('disable_vkbasalt', value)} /> */} diff --git a/src/components/Content.tsx b/src/components/Content.tsx index 895b2fc..ba651d4 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -8,6 +8,7 @@ import { ConfigurationSection } from "./ConfigurationSection"; import { UsageInstructions } from "./UsageInstructions"; import { WikiButton } from "./WikiButton"; import { ClipboardButton } from "./ClipboardButton"; +import { ConfigurationData } from "../config/configSchema"; export function Content() { const { @@ -21,9 +22,8 @@ export function Content() { const { config, - setters, loadLsfgConfig, - updateConfig + updateField } = useLsfgConfig(); const { isInstalling, isUninstalling, handleInstall, handleUninstall } = useInstallationActions(); @@ -35,45 +35,9 @@ export function Content() { } }, [isInstalled, loadLsfgConfig]); - // Configuration change handlers - const handleEnableLsfgChange = async (value: boolean) => { - setters.setEnableLsfg(value); - await updateConfig(value, config.multiplier, config.flowScale, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt, config.frameCap); - }; - - const handleMultiplierChange = async (value: number) => { - setters.setMultiplier(value); - await updateConfig(config.enableLsfg, value, config.flowScale, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt, config.frameCap); - }; - - const handleFlowScaleChange = async (value: number) => { - setters.setFlowScale(value); - await updateConfig(config.enableLsfg, config.multiplier, value, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt, config.frameCap); - }; - - const handleHdrChange = async (value: boolean) => { - setters.setHdr(value); - await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, value, config.perfMode, config.immediateMode, config.disableVkbasalt, config.frameCap); - }; - - const handlePerfModeChange = async (value: boolean) => { - setters.setPerfMode(value); - await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, value, config.immediateMode, config.disableVkbasalt, config.frameCap); - }; - - const handleImmediateModeChange = async (value: boolean) => { - setters.setImmediateMode(value); - await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, config.perfMode, value, config.disableVkbasalt, config.frameCap); - }; - - const handleDisableVkbasaltChange = async (value: boolean) => { - setters.setDisableVkbasalt(value); - await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, config.perfMode, config.immediateMode, value, config.frameCap); - }; - - const handleFrameCapChange = async (value: number) => { - setters.setFrameCap(value); - await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, config.perfMode, config.immediateMode, config.disableVkbasalt, value); + // Generic configuration change handler + const handleConfigChange = async (fieldName: keyof ConfigurationData, value: boolean | number) => { + await updateField(fieldName, value); }; const onInstall = () => { @@ -105,14 +69,7 @@ export function Content() { {isInstalled && ( )} diff --git a/src/components/UsageInstructions.tsx b/src/components/UsageInstructions.tsx index 3589c04..727a0ab 100644 --- a/src/components/UsageInstructions.tsx +++ b/src/components/UsageInstructions.tsx @@ -1,18 +1,8 @@ import { PanelSectionRow } from "@decky/ui"; - -interface ConfigType { - enableLsfg: boolean; - multiplier: number; - flowScale: number; - hdr: boolean; - perfMode: boolean; - immediateMode: boolean; - disableVkbasalt: boolean; - frameCap: number; -} +import { ConfigurationData } from "../config/configSchema"; interface UsageInstructionsProps { - config: ConfigType; + config: ConfigurationData; } export function UsageInstructions({ config }: UsageInstructionsProps) { @@ -20,34 +10,34 @@ export function UsageInstructions({ config }: UsageInstructionsProps) { const buildManualEnvVars = (): string => { const envVars: string[] = []; - if (config.enableLsfg) { + if (config.enable_lsfg) { envVars.push("ENABLE_LSFG=1"); } // Always include multiplier and flow_scale if LSFG is enabled, as they have defaults - if (config.enableLsfg) { + if (config.enable_lsfg) { envVars.push(`LSFG_MULTIPLIER=${config.multiplier}`); - envVars.push(`LSFG_FLOW_SCALE=${config.flowScale}`); + envVars.push(`LSFG_FLOW_SCALE=${config.flow_scale}`); } if (config.hdr) { envVars.push("LSFG_HDR=1"); } - if (config.perfMode) { + if (config.perf_mode) { envVars.push("LSFG_PERF_MODE=1"); } - if (config.immediateMode) { + if (config.immediate_mode) { envVars.push("MESA_VK_WSI_PRESENT_MODE=immediate"); } - if (config.disableVkbasalt) { + if (config.disable_vkbasalt) { envVars.push("DISABLE_VKBASALT=1"); } - if (config.frameCap > 0) { - envVars.push(`DXVK_FRAME_RATE=${config.frameCap}`); + if (config.frame_cap > 0) { + envVars.push(`DXVK_FRAME_RATE=${config.frame_cap}`); } return envVars.length > 0 ? `${envVars.join(" ")} %command%` : "%command%"; -- cgit v1.2.3