From c02343e68874efd57c2e312cb6b7e4f02222e43a Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Tue, 22 Jul 2025 11:11:44 -0400 Subject: add workaround env vars, rm old tests --- src/api/lsfgApi.ts | 4 ++-- src/components/ConfigurationSection.tsx | 18 ++++++++++++++++++ src/config/configSchema.ts | 6 ++++-- src/config/generatedConfigSchema.ts | 18 ++++++++++++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/api/lsfgApi.ts b/src/api/lsfgApi.ts index 74caa57..0b221e9 100644 --- a/src/api/lsfgApi.ts +++ b/src/api/lsfgApi.ts @@ -101,14 +101,14 @@ export const getLaunchScriptContent = callable<[], FileContentResult>("get_launc // Updated config function using centralized configuration export const updateLsfgConfig = callable< - [string, number, number, boolean, boolean, string, number, boolean, boolean], + [string, number, number, boolean, boolean, string, number, boolean, boolean, boolean, boolean], ConfigUpdateResult >("update_lsfg_config"); // Helper function to create config update from configuration object export const updateLsfgConfigFromObject = async (config: ConfigurationData): Promise => { const args = ConfigurationManager.createArgsFromConfig(config); - return updateLsfgConfig(...args as [string, number, number, boolean, boolean, string, number, boolean, boolean]); + return updateLsfgConfig(...args as [string, number, number, boolean, boolean, string, number, boolean, boolean, boolean, boolean]); }; // Self-updater API functions diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index 59ad880..26099e7 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -154,6 +154,24 @@ export function ConfigurationSection({ onChange={(value) => onConfigChange('disable_steamdeck_mode', value)} /> + + + onConfigChange('mangohud_workaround', value)} + /> + + + + onConfigChange('disable_vkbasalt', value)} + /> + ); } diff --git a/src/config/configSchema.ts b/src/config/configSchema.ts index 4ab0d25..979d3c9 100644 --- a/src/config/configSchema.ts +++ b/src/config/configSchema.ts @@ -52,7 +52,7 @@ export class ConfigurationManager { /** * Create args array from config object for lsfg API calls */ - static createArgsFromConfig(config: ConfigurationData): [string, number, number, boolean, boolean, string, number, boolean, boolean] { + static createArgsFromConfig(config: ConfigurationData): [string, number, number, boolean, boolean, string, number, boolean, boolean, boolean, boolean] { return [ config.dll, config.multiplier, @@ -62,7 +62,9 @@ export class ConfigurationManager { config.experimental_present_mode, config.dxvk_frame_rate, config.enable_wow64, - config.disable_steamdeck_mode + config.disable_steamdeck_mode, + config.mangohud_workaround, + config.disable_vkbasalt ]; } diff --git a/src/config/generatedConfigSchema.ts b/src/config/generatedConfigSchema.ts index 5f0e368..cb08252 100644 --- a/src/config/generatedConfigSchema.ts +++ b/src/config/generatedConfigSchema.ts @@ -71,6 +71,18 @@ export const CONFIG_SCHEMA: Record = { default: false, description: "disable Steam Deck mode (unlocks hidden settings in some games)" }, + mangohud_workaround: { + name: "mangohud_workaround", + fieldType: ConfigFieldType.BOOLEAN, + default: false, + description: "Enables a transparent mangohud overlay, sometimes fixes issues with 2X multiplier in game mode" + }, + disable_vkbasalt: { + name: "disable_vkbasalt", + fieldType: ConfigFieldType.BOOLEAN, + default: false, + description: "Disables vkBasalt layer which can conflict with LSFG (Reshade, some Decky plugins)" + }, }; // Type-safe configuration data structure @@ -84,6 +96,8 @@ export interface ConfigurationData { dxvk_frame_rate: number; enable_wow64: boolean; disable_steamdeck_mode: boolean; + mangohud_workaround: boolean; + disable_vkbasalt: boolean; } // Helper functions @@ -102,6 +116,8 @@ export function getDefaults(): ConfigurationData { dxvk_frame_rate: 0, enable_wow64: false, disable_steamdeck_mode: false, + mangohud_workaround: false, + disable_vkbasalt: false, }; } @@ -116,6 +132,8 @@ export function getFieldTypes(): Record { dxvk_frame_rate: ConfigFieldType.INTEGER, enable_wow64: ConfigFieldType.BOOLEAN, disable_steamdeck_mode: ConfigFieldType.BOOLEAN, + mangohud_workaround: ConfigFieldType.BOOLEAN, + disable_vkbasalt: ConfigFieldType.BOOLEAN, }; } -- cgit v1.2.3 From dfe4c033dd1922a63c8393ab467e9aa58fa757e4 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Tue, 22 Jul 2025 11:41:49 -0400 Subject: refactor: update configuration handling to use object-based API --- src/api/lsfgApi.ts | 11 +++++------ src/components/ConfigurationSection.tsx | 26 ++++++++++++++++++-------- src/config/configSchema.ts | 23 ++--------------------- 3 files changed, 25 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/api/lsfgApi.ts b/src/api/lsfgApi.ts index 0b221e9..8d14da6 100644 --- a/src/api/lsfgApi.ts +++ b/src/api/lsfgApi.ts @@ -1,5 +1,5 @@ import { callable } from "@decky/api"; -import { ConfigurationData, ConfigurationManager } from "../config/configSchema"; +import { ConfigurationData } from "../config/configSchema"; // Type definitions for API responses export interface InstallationResult { @@ -99,16 +99,15 @@ export const getLaunchOption = callable<[], LaunchOptionResult>("get_launch_opti export const getConfigFileContent = callable<[], FileContentResult>("get_config_file_content"); export const getLaunchScriptContent = callable<[], FileContentResult>("get_launch_script_content"); -// Updated config function using centralized configuration +// Updated config function using object-based configuration (single source of truth) export const updateLsfgConfig = callable< - [string, number, number, boolean, boolean, string, number, boolean, boolean, boolean, boolean], + [ConfigurationData], ConfigUpdateResult >("update_lsfg_config"); -// Helper function to create config update from configuration object +// Legacy helper function for backward compatibility export const updateLsfgConfigFromObject = async (config: ConfigurationData): Promise => { - const args = ConfigurationManager.createArgsFromConfig(config); - return updateLsfgConfig(...args as [string, number, number, boolean, boolean, string, number, boolean, boolean, boolean, boolean]); + return updateLsfgConfig(config); }; // Self-updater API functions diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index 26099e7..1c0d2b2 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -112,16 +112,26 @@ export function ConfigurationSection({
+ Environment Variables +
+
- Environment Variables (Requires re-launch) + Must be toggled before game start or restart game to take effect
diff --git a/src/config/configSchema.ts b/src/config/configSchema.ts index 979d3c9..fdf6212 100644 --- a/src/config/configSchema.ts +++ b/src/config/configSchema.ts @@ -8,6 +8,7 @@ import { callable } from "@decky/api"; import type { ConfigurationData } from './generatedConfigSchema'; import { getDefaults } from './generatedConfigSchema'; +import { updateLsfgConfig } from "../api/lsfgApi"; // Re-export all auto-generated configuration constants export { @@ -30,7 +31,6 @@ export class ConfigurationManager { // Callable methods for backend communication private getConfiguration = callable<[], { success: boolean; data?: ConfigurationData; error?: string }>("get_configuration"); - private setConfiguration = callable<[{ config_data: ConfigurationData }], { success: boolean; error?: string }>("set_configuration"); private resetConfiguration = callable<[], { success: boolean; data?: ConfigurationData; error?: string }>("reset_configuration"); private constructor() {} @@ -49,25 +49,6 @@ export class ConfigurationManager { return getDefaults(); } - /** - * Create args array from config object for lsfg API calls - */ - static createArgsFromConfig(config: ConfigurationData): [string, number, number, boolean, boolean, string, number, boolean, boolean, boolean, boolean] { - return [ - config.dll, - config.multiplier, - config.flow_scale, - config.performance_mode, - config.hdr_mode, - config.experimental_present_mode, - config.dxvk_frame_rate, - config.enable_wow64, - config.disable_steamdeck_mode, - config.mangohud_workaround, - config.disable_vkbasalt - ]; - } - /** * Load configuration from backend */ @@ -91,7 +72,7 @@ export class ConfigurationManager { */ async saveConfig(config: ConfigurationData): Promise { try { - const result = await this.setConfiguration({ config_data: config }); + const result = await updateLsfgConfig(config); if (result.success) { this._config = config; } else { -- cgit v1.2.3 From f8139896f2077a95a78a54c818637f78dd102de8 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Tue, 22 Jul 2025 12:11:53 -0400 Subject: consolidate toml and script values --- src/components/ConfigurationSection.tsx | 32 ++++++++++++++++++++++++++++++++ src/config/generatedConfigSchema.ts | 18 ++++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'src') diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index 1c0d2b2..3f15bac 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -182,6 +182,38 @@ export function ConfigurationSection({ onChange={(value) => onConfigChange('disable_vkbasalt', value)} /> + + + onConfigChange('foobar_toggle', value)} + /> + + + +
+
Test Config Only Field
+ onConfigChange('test_config_only', e.target.value)} + placeholder="Enter test value" + style={{ + width: "100%", + padding: "8px", + borderRadius: "4px", + border: "1px solid #4c4c4c", + backgroundColor: "#2d2d2d", + color: "#ffffff" + }} + /> +
+ Test TOML-only configuration field (not in script) +
+
+
); } diff --git a/src/config/generatedConfigSchema.ts b/src/config/generatedConfigSchema.ts index cb08252..b7487bd 100644 --- a/src/config/generatedConfigSchema.ts +++ b/src/config/generatedConfigSchema.ts @@ -83,6 +83,18 @@ export const CONFIG_SCHEMA: Record = { default: false, description: "Disables vkBasalt layer which can conflict with LSFG (Reshade, some Decky plugins)" }, + foobar_toggle: { + name: "foobar_toggle", + fieldType: ConfigFieldType.BOOLEAN, + default: false, + description: "Test script-only toggle that exports FOOBAR=1 (for testing purposes)" + }, + test_config_only: { + name: "test_config_only", + fieldType: ConfigFieldType.STRING, + default: "default_value", + description: "Test TOML-only configuration field (not in script)" + }, }; // Type-safe configuration data structure @@ -98,6 +110,8 @@ export interface ConfigurationData { disable_steamdeck_mode: boolean; mangohud_workaround: boolean; disable_vkbasalt: boolean; + foobar_toggle: boolean; + test_config_only: string; } // Helper functions @@ -118,6 +132,8 @@ export function getDefaults(): ConfigurationData { disable_steamdeck_mode: false, mangohud_workaround: false, disable_vkbasalt: false, + foobar_toggle: false, + test_config_only: "default_value", }; } @@ -134,6 +150,8 @@ export function getFieldTypes(): Record { disable_steamdeck_mode: ConfigFieldType.BOOLEAN, mangohud_workaround: ConfigFieldType.BOOLEAN, disable_vkbasalt: ConfigFieldType.BOOLEAN, + foobar_toggle: ConfigFieldType.BOOLEAN, + test_config_only: ConfigFieldType.STRING, }; } -- cgit v1.2.3 From f8c09209513507ad9af7822c32119cf6d6fae0ac Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Tue, 22 Jul 2025 12:40:23 -0400 Subject: rm test config options --- src/components/ConfigurationSection.tsx | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'src') diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx index 3f15bac..1c0d2b2 100644 --- a/src/components/ConfigurationSection.tsx +++ b/src/components/ConfigurationSection.tsx @@ -182,38 +182,6 @@ export function ConfigurationSection({ onChange={(value) => onConfigChange('disable_vkbasalt', value)} /> - - - onConfigChange('foobar_toggle', value)} - /> - - - -
-
Test Config Only Field
- onConfigChange('test_config_only', e.target.value)} - placeholder="Enter test value" - style={{ - width: "100%", - padding: "8px", - borderRadius: "4px", - border: "1px solid #4c4c4c", - backgroundColor: "#2d2d2d", - color: "#ffffff" - }} - /> -
- Test TOML-only configuration field (not in script) -
-
-
); } -- cgit v1.2.3 From df0635f1bba611b8b44975057acd579102d209dd Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Tue, 22 Jul 2025 13:06:46 -0400 Subject: further automate population of hardcoded fields --- src/config/generatedConfigSchema.ts | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'src') diff --git a/src/config/generatedConfigSchema.ts b/src/config/generatedConfigSchema.ts index b7487bd..cb08252 100644 --- a/src/config/generatedConfigSchema.ts +++ b/src/config/generatedConfigSchema.ts @@ -83,18 +83,6 @@ export const CONFIG_SCHEMA: Record = { default: false, description: "Disables vkBasalt layer which can conflict with LSFG (Reshade, some Decky plugins)" }, - foobar_toggle: { - name: "foobar_toggle", - fieldType: ConfigFieldType.BOOLEAN, - default: false, - description: "Test script-only toggle that exports FOOBAR=1 (for testing purposes)" - }, - test_config_only: { - name: "test_config_only", - fieldType: ConfigFieldType.STRING, - default: "default_value", - description: "Test TOML-only configuration field (not in script)" - }, }; // Type-safe configuration data structure @@ -110,8 +98,6 @@ export interface ConfigurationData { disable_steamdeck_mode: boolean; mangohud_workaround: boolean; disable_vkbasalt: boolean; - foobar_toggle: boolean; - test_config_only: string; } // Helper functions @@ -132,8 +118,6 @@ export function getDefaults(): ConfigurationData { disable_steamdeck_mode: false, mangohud_workaround: false, disable_vkbasalt: false, - foobar_toggle: false, - test_config_only: "default_value", }; } @@ -150,8 +134,6 @@ export function getFieldTypes(): Record { disable_steamdeck_mode: ConfigFieldType.BOOLEAN, mangohud_workaround: ConfigFieldType.BOOLEAN, disable_vkbasalt: ConfigFieldType.BOOLEAN, - foobar_toggle: ConfigFieldType.BOOLEAN, - test_config_only: ConfigFieldType.STRING, }; } -- cgit v1.2.3 From d063284dea10e82a23c2c332ecd4901d7254171b Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Tue, 22 Jul 2025 13:23:25 -0400 Subject: use generated kwargs and config in more hardcoded places --- src/components/ConfigurationSection.tsx | 23 ++++++++++++++--------- src/config/configSchema.ts | 6 +++++- src/config/generatedConfigSchema.ts | 13 +++++++++++++ 3 files changed, 32 insertions(+), 10 deletions(-) (limited to 'src') 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)} /> @@ -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)} /> @@ -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)} /> @@ -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)} /> @@ -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)} /> @@ -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)} /> @@ -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)} /> @@ -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)} /> 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; -- cgit v1.2.3