From b03471f869c29fc066fc02f7c59f76e3ac4eea4d Mon Sep 17 00:00:00 2001
From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
Date: Sun, 13 Sep 2026 07:47:06 -0400
Subject: fix: handle v1-v2 migration state cleanly
---
py_modules/lsfg_vk/installation.py | 19 ++++++++++++-------
py_modules/lsfg_vk/steam_service.py | 35 +++++++++++++++++++++++------------
src/components/Content.tsx | 7 ++++++-
src/components/SettingsTab.tsx | 2 +-
src/hooks/useLsfgHooks.ts | 1 -
5 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/py_modules/lsfg_vk/installation.py b/py_modules/lsfg_vk/installation.py
index e7366ee..4003228 100644
--- a/py_modules/lsfg_vk/installation.py
+++ b/py_modules/lsfg_vk/installation.py
@@ -183,18 +183,23 @@ class InstallationService(BaseService):
def check_installation(self) -> InstallationCheckResponse:
try:
- installation_error = None
- try:
- installed = self.runtime_service.is_healthy()
- except Exception as error:
- installed = False
- installation_error = str(error)
+ installed = all(
+ path.is_file()
+ for path in (
+ self.cli_file,
+ self.lib_file,
+ self.lib_x86_file,
+ self.json_file,
+ self.json_x86_file,
+ self.config_file_path,
+ )
+ )
lossless_scaling = self.runtime_service.check_lossless_scaling()
return {
"installed": installed,
"lossless_scaling_installed": bool(lossless_scaling["installed"]),
"lossless_scaling_status": str(lossless_scaling["status"]),
- "error": installation_error,
+ "error": None,
}
except Exception as error:
return {
diff --git a/py_modules/lsfg_vk/steam_service.py b/py_modules/lsfg_vk/steam_service.py
index 93f2593..71a4634 100644
--- a/py_modules/lsfg_vk/steam_service.py
+++ b/py_modules/lsfg_vk/steam_service.py
@@ -147,6 +147,13 @@ class SteamService(BaseService):
games.setdefault(game["appid"], game)
return list(games.values())
+ def _lossless_scaling_path(self) -> Optional[Path]:
+ return next((
+ path
+ for root in self._steam_library_roots()
+ if (path := root / "steamapps/common/Lossless Scaling").is_dir()
+ ), None)
+
def _manifest_path(self) -> Optional[Path]:
return next((
path
@@ -207,7 +214,7 @@ class SteamService(BaseService):
self._section_value(content, "MountedConfig", "BetaKey")
or self._section_value(content, "UserConfig", "BetaKey")
)
- needs_switch = selected != STEAM_LOSSLESS_SCALING_BRANCH or current != STEAM_LOSSLESS_SCALING_BRANCH
+ needs_switch = selected != STEAM_LOSSLESS_SCALING_BRANCH
return {
"installed": True,
"manifest_path": str(manifest_path),
@@ -215,7 +222,7 @@ class SteamService(BaseService):
"current_branch": current,
"target_branch": STEAM_LOSSLESS_SCALING_BRANCH,
"needs_switch": needs_switch,
- "restart_required": selected == STEAM_LOSSLESS_SCALING_BRANCH and current != STEAM_LOSSLESS_SCALING_BRANCH,
+ "restart_required": False,
}
@staticmethod
@@ -233,27 +240,31 @@ class SteamService(BaseService):
def find_lsfg_vk_dll(self) -> Optional[str]:
if self.get_branch_status().get("needs_switch"):
return None
- return next((
- str(path)
- for root in self._steam_library_roots()
- if (path := root / "steamapps/common/Lossless Scaling/lsfg-vk.dll").is_file()
- ), None)
+ directory = self._lossless_scaling_path()
+ path = directory / "lsfg-vk.dll" if directory else None
+ return str(path) if path and path.is_file() else None
def get_branch_status(self) -> Dict[str, object]:
try:
- manifest = self._manifest_path()
- if manifest is None:
+ if self._lossless_scaling_path() is None:
return self._success_response(
dict,
"Lossless Scaling is not installed through Steam",
**self._missing_branch_fields(),
)
+ manifest = self._manifest_path()
+ if manifest is None:
+ fields = self._missing_branch_fields()
+ fields.update(installed=True, needs_switch=True)
+ return self._success_response(
+ dict,
+ "Lossless Scaling is installed but its Steam branch could not be determined",
+ **fields,
+ )
fields = self._status_fields(manifest, manifest.read_text(encoding="utf-8"))
message = (
- "Lossless Scaling is using the lsfg-vk Steam branch"
+ "Lossless Scaling has the lsfg-vk Steam branch selected"
if not fields["needs_switch"]
- else "lsfg-vk is selected; restart Steam to finish the branch switch"
- if fields["restart_required"]
else "Select lsfg-vk in Lossless Scaling's Steam Properties > Betas"
)
return self._success_response(dict, message, **fields)
diff --git a/src/components/Content.tsx b/src/components/Content.tsx
index 470db95..fdb7afa 100644
--- a/src/components/Content.tsx
+++ b/src/components/Content.tsx
@@ -251,7 +251,12 @@ export function Content() {
...(showDebugTab ? [{ id: "ConfigFile", title: tabIcons.configFile, content: tabContent() }] : []),
{ id: "Settings", title: tabIcons.settings, content: tabContent(settings) },
]
- : [{ id: "Settings", title: tabIcons.settings, content: tabContent(settings) }];
+ : [
+ ...(isInstalled && showDebugTab
+ ? [{ id: "ConfigFile", title: tabIcons.configFile, content: tabContent() }]
+ : []),
+ { id: "Settings", title: tabIcons.settings, content: tabContent(settings) },
+ ];
const availableTabIds = new Set(tabs.map(({ id }) => id));
const activeTab = availableTabIds.has(tab) ? tab : setupComplete ? "Steam" : "Settings";
diff --git a/src/components/SettingsTab.tsx b/src/components/SettingsTab.tsx
index 35a74cc..d06cb52 100644
--- a/src/components/SettingsTab.tsx
+++ b/src/components/SettingsTab.tsx
@@ -59,7 +59,7 @@ export function SettingsTab(props: SettingsTabProps) {
)}
diff --git a/src/hooks/useLsfgHooks.ts b/src/hooks/useLsfgHooks.ts
index 0f51e90..2181272 100644
--- a/src/hooks/useLsfgHooks.ts
+++ b/src/hooks/useLsfgHooks.ts
@@ -63,7 +63,6 @@ export function useInstallation(
showInstallErrorToast(result.error ?? undefined);
return;
}
- setIsInstalled(true);
setInstallationStatus("lsfg-vk installed");
showInstallSuccessToast();
await reloadConfig?.();
--
cgit v1.2.3