From 77494457e2a4f5c80c3a2f7acb054b12d918d8ad Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Sun, 13 Jul 2025 00:04:54 -0400 Subject: restructure for maintainability --- src/api/lsfgApi.ts | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/api/lsfgApi.ts (limited to 'src/api') diff --git a/src/api/lsfgApi.ts b/src/api/lsfgApi.ts new file mode 100644 index 0000000..a35f274 --- /dev/null +++ b/src/api/lsfgApi.ts @@ -0,0 +1,60 @@ +import { callable } from "@decky/api"; + +// Type definitions for API responses +export interface InstallationResult { + success: boolean; + error?: string; + message?: string; + removed_files?: string[]; +} + +export interface InstallationStatus { + installed: boolean; + lib_exists: boolean; + json_exists: boolean; + script_exists: boolean; + lib_path: string; + json_path: string; + script_path: string; + error?: string; +} + +export interface DllDetectionResult { + detected: boolean; + path?: string; + source?: string; + message?: string; + error?: string; +} + +export interface LsfgConfig { + enable_lsfg: boolean; + multiplier: number; + flow_scale: number; + hdr: boolean; + perf_mode: boolean; + immediate_mode: boolean; +} + +export interface ConfigResult { + success: boolean; + config?: LsfgConfig; + error?: string; +} + +export interface ConfigUpdateResult { + success: boolean; + message?: string; + error?: string; +} + +// API functions +export const installLsfgVk = callable<[], InstallationResult>("install_lsfg_vk"); +export const uninstallLsfgVk = callable<[], InstallationResult>("uninstall_lsfg_vk"); +export const checkLsfgVkInstalled = callable<[], InstallationStatus>("check_lsfg_vk_installed"); +export const checkLosslessScalingDll = callable<[], DllDetectionResult>("check_lossless_scaling_dll"); +export const getLsfgConfig = callable<[], ConfigResult>("get_lsfg_config"); +export const updateLsfgConfig = callable< + [boolean, number, number, boolean, boolean, boolean], + ConfigUpdateResult +>("update_lsfg_config"); -- cgit v1.2.3