diff --git a/plugins/decky-vault/src/components/main-panel.tsx b/plugins/decky-vault/src/components/main-panel.tsx index 3636445..dff0075 100644 --- a/plugins/decky-vault/src/components/main-panel.tsx +++ b/plugins/decky-vault/src/components/main-panel.tsx @@ -1,14 +1,15 @@ -import { useEffect, useState } from "react" import { ButtonItem, PanelSection, PanelSectionRow, + TextField, staticClasses, } from "@decky/ui" import { FaPlay, FaStop, FaClock, + FaGamepad, } from "react-icons/fa" import type { RecordingState, SessionData, RecentSession, PluginSettings } from "../lib/store" import SessionForm from "./session-form" @@ -25,6 +26,7 @@ interface MainPanelProps { onAddToRecent: (sess: SessionData) => void onReset: () => void setError: (msg: string) => void + setGameName: (name: string, appId?: number) => void } export default function MainPanel({ @@ -39,6 +41,7 @@ export default function MainPanel({ onAddToRecent, onReset, setError, + setGameName, }: MainPanelProps) { const [elapsed, setElapsed] = useState(0) @@ -123,12 +126,22 @@ export default function MainPanel({ )} {recordingState === "idle" && ( - -
- Enable MangoHud for your game, then press Start Recording before launching. - Configure MangoHud in the Settings tab. -
-
+ <> + + setGameName(e.target.value)} + placeholder="e.g. Cyberpunk 2077" + /> + + +
+ Enable MangoHud for your game, then press Start Recording before launching. + Configure MangoHud in the Settings tab. +
+
+ )} {recentSessions.length > 0 && recordingState === "idle" && ( diff --git a/plugins/decky-vault/src/index.tsx b/plugins/decky-vault/src/index.tsx index 92732b4..69a071e 100644 --- a/plugins/decky-vault/src/index.tsx +++ b/plugins/decky-vault/src/index.tsx @@ -36,6 +36,7 @@ function Content() { reset, onGameStart, onGameStop, + setGameName, } = useSession() const gameStartedUnregRef = useRef<{ unregister: () => void } | null>(null) const gameStoppedUnregRef = useRef<{ unregister: () => void } | null>(null) @@ -159,6 +160,7 @@ function Content() { onAddToRecent={addToRecent} onReset={reset} setError={setError} + setGameName={setGameName} /> { + currentAppNameRef.current = name + if (appId !== undefined) currentAppIdRef.current = appId + setSession((prev) => ({ ...prev, gameName: name, appId: appId ?? prev.appId })) + }, []) + return { recordingState, session, @@ -184,6 +191,7 @@ export function useSession() { reset, onGameStart, onGameStop, + setGameName, } }