summaryrefslogtreecommitdiff
path: root/src/hooks
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-05 23:58:16 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-05 23:58:16 -0400
commit89e64a7dbddb8f713dd2ca37131924e8bd8ab51f (patch)
tree8238ddece764ab7757f42c7944236eef74f12f8c /src/hooks
parente8e469f99078858dc953663cba6f3428e80b1c5d (diff)
downloaddecky-lsfg-vk-89e64a7dbddb8f713dd2ca37131924e8bd8ab51f.tar.gz
decky-lsfg-vk-89e64a7dbddb8f713dd2ca37131924e8bd8ab51f.zip
feat: select Lossless Scaling lsfg-vk branch
Diffstat (limited to 'src/hooks')
-rw-r--r--src/hooks/useLsfgHooks.ts46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/hooks/useLsfgHooks.ts b/src/hooks/useLsfgHooks.ts
index 597110e..dfbf2cd 100644
--- a/src/hooks/useLsfgHooks.ts
+++ b/src/hooks/useLsfgHooks.ts
@@ -2,8 +2,12 @@ import { useState, useEffect, useCallback } from "react";
import {
checkLsfgVkInstalled,
getLsfgConfig,
+ getLosslessScalingBranchStatus,
+ selectLosslessScalingBranch,
updateLsfgConfigFromObject,
- type ConfigUpdateResult
+ type ConfigUpdateResult,
+ type SteamBranchOperationResult,
+ type SteamBranchStatus
} from "../api/lsfgApi";
import { ConfigurationData, getDefaults } from "../config/configSchema";
import { showErrorToast, ToastMessages } from "../utils/toastUtils";
@@ -13,9 +17,18 @@ export function useInstallationStatus() {
const [installationStatus, setInstallationStatus] = useState<string>("");
const [losslessScalingInstalled, setLosslessScalingInstalled] = useState<boolean>(false);
const [losslessScalingStatus, setLosslessScalingStatus] = useState<string>("");
+ const [steamBranchStatus, setSteamBranchStatus] = useState<SteamBranchStatus | null>(null);
+ const [isSwitchingSteamBranch, setIsSwitchingSteamBranch] = useState<boolean>(false);
const checkInstallation = async () => {
try {
+ setSteamBranchStatus(await getLosslessScalingBranchStatus());
+ } catch (error) {
+ console.error("Error checking Lossless Scaling Steam branch:", error);
+ setSteamBranchStatus(null);
+ }
+
+ try {
const status = await checkLsfgVkInstalled();
setIsInstalled(status.installed);
setLosslessScalingInstalled(status.lossless_scaling_installed);
@@ -27,6 +40,7 @@ export function useInstallationStatus() {
}
return status.installed;
} catch (error) {
+ setSteamBranchStatus(null);
setLosslessScalingInstalled(false);
setLosslessScalingStatus("Lossless Scaling Not Installed");
setInstallationStatus("lsfg-vk Not Installed");
@@ -34,6 +48,33 @@ export function useInstallationStatus() {
}
};
+ const selectLosslessScalingBranchForUser = async (): Promise<SteamBranchOperationResult> => {
+ setIsSwitchingSteamBranch(true);
+ try {
+ const result = await selectLosslessScalingBranch();
+ setSteamBranchStatus(result);
+ return result;
+ } catch (error) {
+ const result: SteamBranchOperationResult = {
+ success: false,
+ message: "",
+ error: String(error),
+ installed: false,
+ manifest_path: undefined,
+ selected_branch: undefined,
+ current_branch: undefined,
+ target_branch: "lsfg-vk",
+ needs_switch: false,
+ restart_required: false,
+ changed: false
+ };
+ setSteamBranchStatus(result);
+ return result;
+ } finally {
+ setIsSwitchingSteamBranch(false);
+ }
+ };
+
useEffect(() => {
checkInstallation();
}, []);
@@ -45,6 +86,9 @@ export function useInstallationStatus() {
setInstallationStatus,
losslessScalingInstalled,
losslessScalingStatus,
+ steamBranchStatus,
+ isSwitchingSteamBranch,
+ selectLosslessScalingBranch: selectLosslessScalingBranchForUser,
checkInstallation
};
}