diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-07-22 13:23:25 -0400 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-07-22 13:23:25 -0400 |
| commit | d063284dea10e82a23c2c332ecd4901d7254171b (patch) | |
| tree | 8433fc86936229eeb01d4b200fbb93da0dec8d18 /src | |
| parent | df0635f1bba611b8b44975057acd579102d209dd (diff) | |
| download | decky-lsfg-vk-d063284dea10e82a23c2c332ecd4901d7254171b.tar.gz decky-lsfg-vk-d063284dea10e82a23c2c332ecd4901d7254171b.zip | |
use generated kwargs and config in more hardcoded places
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/ConfigurationSection.tsx | 23 | ||||
| -rw-r--r-- | src/config/configSchema.ts | 6 | ||||
| -rw-r--r-- | src/config/generatedConfigSchema.ts | 13 |
3 files changed, 32 insertions, 10 deletions
diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index 1c0d2b2..c0b67fd 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -1,5 +1,10 @@ import { PanelSectionRow, ToggleField, SliderField, DropdownItem } from "@decky/ui"; import { ConfigurationData } from "../config/configSchema"; +import { + MULTIPLIER, FLOW_SCALE, PERFORMANCE_MODE, HDR_MODE, + EXPERIMENTAL_PRESENT_MODE, DXVK_FRAME_RATE, DISABLE_STEAMDECK_MODE, + MANGOHUD_WORKAROUND, DISABLE_VKBASALT +} from "../config/generatedConfigSchema"; interface ConfigurationSectionProps { config: ConfigurationData; @@ -45,7 +50,7 @@ export function ConfigurationSection({ ]} showValue={false} notchTicksVisible={true} - onChange={(value) => onConfigChange('multiplier', value)} + onChange={(value) => onConfigChange(MULTIPLIER, value)} /> </PanelSectionRow> @@ -57,7 +62,7 @@ export function ConfigurationSection({ min={0.25} max={1.0} step={0.01} - onChange={(value) => onConfigChange('flow_scale', value)} + onChange={(value) => onConfigChange(FLOW_SCALE, value)} /> </PanelSectionRow> @@ -66,7 +71,7 @@ export function ConfigurationSection({ label="Performance Mode" description="Uses a lighter model for FG (Recommended for most games)" checked={config.performance_mode} - onChange={(value) => onConfigChange('performance_mode', value)} + onChange={(value) => onConfigChange(PERFORMANCE_MODE, value)} /> </PanelSectionRow> @@ -75,7 +80,7 @@ export function ConfigurationSection({ label="HDR Mode" description="Enables HDR mode (only for games that support HDR)" checked={config.hdr_mode} - onChange={(value) => onConfigChange('hdr_mode', value)} + onChange={(value) => onConfigChange(HDR_MODE, value)} /> </PanelSectionRow> @@ -101,7 +106,7 @@ export function ConfigurationSection({ description="Select a specific Vulkan presentation mode for better performance or compatibility (May cause crashes)" menuLabel="Select presentation mode" selectedOption={config.experimental_present_mode || "fifo"} - onChange={(value) => onConfigChange('experimental_present_mode', value.data)} + onChange={(value) => onConfigChange(EXPERIMENTAL_PRESENT_MODE, value.data)} rgOptions={[ { data: "fifo", label: "FIFO (VSync) - Default" }, { data: "mailbox", label: "Mailbox" } @@ -143,7 +148,7 @@ export function ConfigurationSection({ min={0} max={60} step={1} - onChange={(value) => onConfigChange('dxvk_frame_rate', value)} + onChange={(value) => onConfigChange(DXVK_FRAME_RATE, value)} /> </PanelSectionRow> @@ -161,7 +166,7 @@ export function ConfigurationSection({ label="Disable Steam Deck Mode" description="Disables Steam Deck mode (Unlocks hidden settings in some games)" checked={config.disable_steamdeck_mode} - onChange={(value) => onConfigChange('disable_steamdeck_mode', value)} + onChange={(value) => onConfigChange(DISABLE_STEAMDECK_MODE, value)} /> </PanelSectionRow> @@ -170,7 +175,7 @@ export function ConfigurationSection({ label="MangoHud Workaround" description="Enables a transparent mangohud overlay, sometimes fixes issues with 2X multiplier in game mode" checked={config.mangohud_workaround} - onChange={(value) => onConfigChange('mangohud_workaround', value)} + onChange={(value) => onConfigChange(MANGOHUD_WORKAROUND, value)} /> </PanelSectionRow> @@ -179,7 +184,7 @@ export function ConfigurationSection({ label="Disable vkBasalt" description="Disables vkBasalt layer which can conflict with LSFG (Reshade, some Decky plugins)" checked={config.disable_vkbasalt} - onChange={(value) => onConfigChange('disable_vkbasalt', value)} + onChange={(value) => onConfigChange(DISABLE_VKBASALT, value)} /> </PanelSectionRow> </> diff --git a/src/config/configSchema.ts b/src/config/configSchema.ts index fdf6212..9568fd8 100644 --- a/src/config/configSchema.ts +++ b/src/config/configSchema.ts @@ -18,7 +18,11 @@ export { ConfigurationData, getFieldNames, getDefaults, - getFieldTypes + getFieldTypes, + // Field name constants for type-safe access + DLL, MULTIPLIER, FLOW_SCALE, PERFORMANCE_MODE, HDR_MODE, + EXPERIMENTAL_PRESENT_MODE, DXVK_FRAME_RATE, ENABLE_WOW64, + DISABLE_STEAMDECK_MODE, MANGOHUD_WORKAROUND, DISABLE_VKBASALT } from './generatedConfigSchema'; /** diff --git a/src/config/generatedConfigSchema.ts b/src/config/generatedConfigSchema.ts index cb08252..4a301a1 100644 --- a/src/config/generatedConfigSchema.ts +++ b/src/config/generatedConfigSchema.ts @@ -7,6 +7,19 @@ export enum ConfigFieldType { STRING = "string" } +// Field name constants for type-safe access +export const DLL = "dll" as const; +export const MULTIPLIER = "multiplier" as const; +export const FLOW_SCALE = "flow_scale" as const; +export const PERFORMANCE_MODE = "performance_mode" as const; +export const HDR_MODE = "hdr_mode" as const; +export const EXPERIMENTAL_PRESENT_MODE = "experimental_present_mode" as const; +export const DXVK_FRAME_RATE = "dxvk_frame_rate" as const; +export const ENABLE_WOW64 = "enable_wow64" as const; +export const DISABLE_STEAMDECK_MODE = "disable_steamdeck_mode" as const; +export const MANGOHUD_WORKAROUND = "mangohud_workaround" as const; +export const DISABLE_VKBASALT = "disable_vkbasalt" as const; + // Configuration field definition export interface ConfigField { name: string; |
