summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>2025-07-19 08:40:49 -0400
committerGitHub <noreply@github.com>2025-07-19 08:40:49 -0400
commitf010473bfdf6b9a58960a5dac71fa48837ae6a1c (patch)
treec0392ef13b7cc47bc27369e7840e58fa23e745b7 /src
parentb9302548a4def670c8600086ba8685c075ceac3d (diff)
parent75a94598341899eea5260206975686c05e793956 (diff)
downloaddecky-lsfg-vk-f010473bfdf6b9a58960a5dac71fa48837ae6a1c.tar.gz
decky-lsfg-vk-f010473bfdf6b9a58960a5dac71fa48837ae6a1c.zip
Merge pull request #41 from xXJSONDeruloXx/nerd-stuffv0.6.4
Nerd stuff
Diffstat (limited to 'src')
-rw-r--r--src/api/lsfgApi.ts13
-rw-r--r--src/components/ConfigurationSection.tsx28
-rw-r--r--src/components/Content.tsx17
-rw-r--r--src/components/NerdStuffModal.tsx95
-rw-r--r--src/components/UsageInstructions.tsx6
-rw-r--r--src/components/index.ts1
-rw-r--r--src/config/configSchema.ts10
7 files changed, 131 insertions, 39 deletions
diff --git a/src/api/lsfgApi.ts b/src/api/lsfgApi.ts
index 5770c43..4c23955 100644
--- a/src/api/lsfgApi.ts
+++ b/src/api/lsfgApi.ts
@@ -28,6 +28,14 @@ export interface DllDetectionResult {
error?: string;
}
+export interface DllStatsResult {
+ success: boolean;
+ dll_path?: string;
+ dll_sha256?: string;
+ dll_source?: string;
+ error?: string;
+}
+
// Use centralized configuration data type
export type LsfgConfig = ConfigurationData;
@@ -77,20 +85,21 @@ 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 getDllStats = callable<[], DllStatsResult>("get_dll_stats");
export const getLsfgConfig = callable<[], ConfigResult>("get_lsfg_config");
export const getConfigSchema = callable<[], ConfigSchemaResult>("get_config_schema");
export const getLaunchOption = callable<[], LaunchOptionResult>("get_launch_option");
// Updated config function using centralized configuration
export const updateLsfgConfig = callable<
- [boolean, string, number, number, boolean, boolean, string, number, boolean, boolean],
+ [string, number, number, boolean, boolean, string, number, boolean, boolean],
ConfigUpdateResult
>("update_lsfg_config");
// Helper function to create config update from configuration object
export const updateLsfgConfigFromObject = async (config: ConfigurationData): Promise<ConfigUpdateResult> => {
const args = ConfigurationManager.createArgsFromConfig(config);
- return updateLsfgConfig(...args as [boolean, string, number, number, boolean, boolean, string, number, boolean, boolean]);
+ return updateLsfgConfig(...args as [string, number, number, boolean, boolean, string, number, boolean, boolean]);
};
// Self-updater API functions
diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx
index 00717bc..ad99c28 100644
--- a/src/components/ConfigurationSection.tsx
+++ b/src/components/ConfigurationSection.tsx
@@ -28,24 +28,6 @@ export function ConfigurationSection({
</div>
</PanelSectionRow>
- {/* <PanelSectionRow>
- <ToggleField
- label="Enable LSFG"
- description="Enables lsfg globally (apply before launching games)"
- checked={config.enable}
- onChange={(value) => onConfigChange('enable', value)}
- />
- </PanelSectionRow> */}
-
- {/* <PanelSectionRow>
- <TextField
- label="Lossless.dll Path"
- description="specify where Lossless.dll is stored"
- value={config.dll}
- onChange={(e) => onConfigChange('dll', e.target.value)}
- />
- </PanelSectionRow> */}
-
<PanelSectionRow>
<SliderField
label="FPS Multiplier"
@@ -56,11 +38,13 @@ export function ConfigurationSection({
step={1}
notchCount={4}
notchLabels={[
- { notchIndex: 1, label: "OFF" },
- { notchIndex: 2, label: "2X" },
- { notchIndex: 3, label: "3X" },
- { notchIndex: 4, label: "4X" }
+ { notchIndex: 0, label: "OFF", value: 1 },
+ { notchIndex: 1, label: "2X", value: 2 },
+ { notchIndex: 2, label: "3X", value: 3 },
+ { notchIndex: 3, label: "4X", value: 4 }
]}
+ showValue={false}
+ notchTicksVisible={true}
onChange={(value) => onConfigChange('multiplier', value)}
/>
</PanelSectionRow>
diff --git a/src/components/Content.tsx b/src/components/Content.tsx
index 613e722..9ce4c35 100644
--- a/src/components/Content.tsx
+++ b/src/components/Content.tsx
@@ -1,5 +1,5 @@
import { useEffect } from "react";
-import { PanelSection } from "@decky/ui";
+import { PanelSection, showModal, ButtonItem, PanelSectionRow } from "@decky/ui";
import { useInstallationStatus, useDllDetection, useLsfgConfig } from "../hooks/useLsfgHooks";
import { useInstallationActions } from "../hooks/useInstallationActions";
import { StatusDisplay } from "./StatusDisplay";
@@ -9,6 +9,7 @@ import { UsageInstructions } from "./UsageInstructions";
import { WikiButton } from "./WikiButton";
import { ClipboardButton } from "./ClipboardButton";
import { PluginUpdateChecker } from "./PluginUpdateChecker";
+import { NerdStuffModal } from "./NerdStuffModal";
import { ConfigurationData } from "../config/configSchema";
export function Content() {
@@ -49,6 +50,10 @@ export function Content() {
handleUninstall(setIsInstalled, setInstallationStatus);
};
+ const handleShowNerdStuff = () => {
+ showModal(<NerdStuffModal />);
+ };
+
return (
<PanelSection>
<InstallationButton
@@ -81,6 +86,16 @@ export function Content() {
{/* Plugin Update Checker */}
<PluginUpdateChecker />
+
+ {/* Nerd Stuff Button */}
+ <PanelSectionRow>
+ <ButtonItem
+ layout="below"
+ onClick={handleShowNerdStuff}
+ >
+ Nerd Stuff
+ </ButtonItem>
+ </PanelSectionRow>
</PanelSection>
);
}
diff --git a/src/components/NerdStuffModal.tsx b/src/components/NerdStuffModal.tsx
new file mode 100644
index 0000000..4dd53b1
--- /dev/null
+++ b/src/components/NerdStuffModal.tsx
@@ -0,0 +1,95 @@
+import { useState, useEffect } from "react";
+import {
+ ModalRoot,
+ Field,
+ Focusable
+} from "@decky/ui";
+import { getDllStats, DllStatsResult } from "../api/lsfgApi";
+
+interface NerdStuffModalProps {
+ closeModal?: () => void;
+}
+
+export function NerdStuffModal({ closeModal }: NerdStuffModalProps) {
+ const [dllStats, setDllStats] = useState<DllStatsResult | null>(null);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState<string | null>(null);
+
+ useEffect(() => {
+ const loadDllStats = async () => {
+ try {
+ setLoading(true);
+ setError(null);
+ const result = await getDllStats();
+ setDllStats(result);
+ } catch (err) {
+ setError(err instanceof Error ? err.message : "Failed to load DLL stats");
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ loadDllStats();
+ }, []);
+
+ const formatSHA256 = (hash: string) => {
+ // Format SHA256 hash for better readability (add spaces every 8 characters)
+ return hash.replace(/(.{8})/g, '$1 ').trim();
+ };
+
+ const copyToClipboard = async (text: string) => {
+ try {
+ await navigator.clipboard.writeText(text);
+ // Could add a toast notification here if desired
+ } catch (err) {
+ console.error("Failed to copy to clipboard:", err);
+ }
+ };
+
+ return (
+ <ModalRoot onCancel={closeModal} onOK={closeModal}>
+ {loading && (
+ <div>Loading DLL information...</div>
+ )}
+
+ {error && (
+ <div>Error: {error}</div>
+ )}
+
+ {!loading && !error && dllStats && (
+ <>
+ {!dllStats.success ? (
+ <div>{dllStats.error || "Failed to get DLL stats"}</div>
+ ) : (
+ <div>
+ <Field label="DLL Path">
+ <Focusable
+ onClick={() => dllStats.dll_path && copyToClipboard(dllStats.dll_path)}
+ onActivate={() => dllStats.dll_path && copyToClipboard(dllStats.dll_path)}
+ >
+ {dllStats.dll_path || "Not available"}
+ </Focusable>
+ </Field>
+
+ <Field label="SHA256 Hash">
+ <Focusable
+ onClick={() => dllStats.dll_sha256 && copyToClipboard(dllStats.dll_sha256)}
+ onActivate={() => dllStats.dll_sha256 && copyToClipboard(dllStats.dll_sha256)}
+ >
+ {dllStats.dll_sha256 ? formatSHA256(dllStats.dll_sha256) : "Not available"}
+ </Focusable>
+ </Field>
+
+ {dllStats.dll_source && (
+ <Field label="Detection Source">
+ <div>{dllStats.dll_source}</div>
+ </Field>
+ )}
+
+ </div>
+ )}
+ </>
+ )}
+ </ModalRoot>
+ );
+}
diff --git a/src/components/UsageInstructions.tsx b/src/components/UsageInstructions.tsx
index be48a82..5de1fcf 100644
--- a/src/components/UsageInstructions.tsx
+++ b/src/components/UsageInstructions.tsx
@@ -33,10 +33,7 @@ export function UsageInstructions({ config }: UsageInstructionsProps) {
whiteSpace: "pre-wrap"
}}
>
- {config.enable
- ? "Add the launch option below (or use \"Launch Option Clipboard\") to Steam games to activate frame generation."
- : "LSFG is disabled. Enable it above and add the launch option to activate frame generation."
- }
+ Add the launch option below (or use "Launch Option Clipboard") to Steam games to activate frame generation.
</div>
</PanelSectionRow>
@@ -69,7 +66,6 @@ export function UsageInstructions({ config }: UsageInstructionsProps) {
}}
>
{`Current Configuration:
-• Enable: ${config.enable ? "Yes" : "No"}
• DLL Path: ${config.dll}
• Multiplier: ${config.multiplier}x
• Flow Scale: ${Math.round(config.flow_scale * 100)}%
diff --git a/src/components/index.ts b/src/components/index.ts
index ed0b803..c0c4804 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -7,3 +7,4 @@ export { WikiButton } from "./WikiButton";
export { ClipboardButton } from "./ClipboardButton";
export { LaunchOptionInfo } from "./LaunchOptionInfo";
export { PluginUpdateChecker } from "./PluginUpdateChecker";
+export { NerdStuffModal } from "./NerdStuffModal";
diff --git a/src/config/configSchema.ts b/src/config/configSchema.ts
index 8715057..fa54336 100644
--- a/src/config/configSchema.ts
+++ b/src/config/configSchema.ts
@@ -23,13 +23,6 @@ export interface ConfigField {
// Configuration schema - must match Python CONFIG_SCHEMA
export const CONFIG_SCHEMA: Record<string, ConfigField> = {
- enable: {
- name: "enable",
- fieldType: ConfigFieldType.BOOLEAN,
- default: true,
- description: "enable/disable lsfg on every game"
- },
-
dll: {
name: "dll",
fieldType: ConfigFieldType.STRING,
@@ -40,7 +33,7 @@ export const CONFIG_SCHEMA: Record<string, ConfigField> = {
multiplier: {
name: "multiplier",
fieldType: ConfigFieldType.INTEGER,
- default: 2,
+ default: 1,
description: "change the fps multiplier"
},
@@ -96,7 +89,6 @@ export const CONFIG_SCHEMA: Record<string, ConfigField> = {
// Type-safe configuration data structure
export interface ConfigurationData {
- enable: boolean;
dll: string;
multiplier: number;
flow_scale: number;