fix(plugin): add manual game name input, autostart MangoHud logging
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
import { useEffect, useState } from "react"
|
|
||||||
import {
|
import {
|
||||||
ButtonItem,
|
ButtonItem,
|
||||||
PanelSection,
|
PanelSection,
|
||||||
PanelSectionRow,
|
PanelSectionRow,
|
||||||
|
TextField,
|
||||||
staticClasses,
|
staticClasses,
|
||||||
} from "@decky/ui"
|
} from "@decky/ui"
|
||||||
import {
|
import {
|
||||||
FaPlay,
|
FaPlay,
|
||||||
FaStop,
|
FaStop,
|
||||||
FaClock,
|
FaClock,
|
||||||
|
FaGamepad,
|
||||||
} from "react-icons/fa"
|
} from "react-icons/fa"
|
||||||
import type { RecordingState, SessionData, RecentSession, PluginSettings } from "../lib/store"
|
import type { RecordingState, SessionData, RecentSession, PluginSettings } from "../lib/store"
|
||||||
import SessionForm from "./session-form"
|
import SessionForm from "./session-form"
|
||||||
@@ -25,6 +26,7 @@ interface MainPanelProps {
|
|||||||
onAddToRecent: (sess: SessionData) => void
|
onAddToRecent: (sess: SessionData) => void
|
||||||
onReset: () => void
|
onReset: () => void
|
||||||
setError: (msg: string) => void
|
setError: (msg: string) => void
|
||||||
|
setGameName: (name: string, appId?: number) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function MainPanel({
|
export default function MainPanel({
|
||||||
@@ -39,6 +41,7 @@ export default function MainPanel({
|
|||||||
onAddToRecent,
|
onAddToRecent,
|
||||||
onReset,
|
onReset,
|
||||||
setError,
|
setError,
|
||||||
|
setGameName,
|
||||||
}: MainPanelProps) {
|
}: MainPanelProps) {
|
||||||
const [elapsed, setElapsed] = useState(0)
|
const [elapsed, setElapsed] = useState(0)
|
||||||
|
|
||||||
@@ -123,12 +126,22 @@ export default function MainPanel({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{recordingState === "idle" && (
|
{recordingState === "idle" && (
|
||||||
|
<>
|
||||||
|
<PanelSectionRow>
|
||||||
|
<TextField
|
||||||
|
label="Game Name"
|
||||||
|
value={session.gameName}
|
||||||
|
onChange={(e) => setGameName(e.target.value)}
|
||||||
|
placeholder="e.g. Cyberpunk 2077"
|
||||||
|
/>
|
||||||
|
</PanelSectionRow>
|
||||||
<PanelSectionRow>
|
<PanelSectionRow>
|
||||||
<div className={staticClasses.Text} style={{ padding: "8px 0", fontSize: "12px", opacity: 0.7 }}>
|
<div className={staticClasses.Text} style={{ padding: "8px 0", fontSize: "12px", opacity: 0.7 }}>
|
||||||
Enable MangoHud for your game, then press Start Recording before launching.
|
Enable MangoHud for your game, then press Start Recording before launching.
|
||||||
Configure MangoHud in the Settings tab.
|
Configure MangoHud in the Settings tab.
|
||||||
</div>
|
</div>
|
||||||
</PanelSectionRow>
|
</PanelSectionRow>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{recentSessions.length > 0 && recordingState === "idle" && (
|
{recentSessions.length > 0 && recordingState === "idle" && (
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ function Content() {
|
|||||||
reset,
|
reset,
|
||||||
onGameStart,
|
onGameStart,
|
||||||
onGameStop,
|
onGameStop,
|
||||||
|
setGameName,
|
||||||
} = useSession()
|
} = useSession()
|
||||||
const gameStartedUnregRef = useRef<{ unregister: () => void } | null>(null)
|
const gameStartedUnregRef = useRef<{ unregister: () => void } | null>(null)
|
||||||
const gameStoppedUnregRef = useRef<{ unregister: () => void } | null>(null)
|
const gameStoppedUnregRef = useRef<{ unregister: () => void } | null>(null)
|
||||||
@@ -159,6 +160,7 @@ function Content() {
|
|||||||
onAddToRecent={addToRecent}
|
onAddToRecent={addToRecent}
|
||||||
onReset={reset}
|
onReset={reset}
|
||||||
setError={setError}
|
setError={setError}
|
||||||
|
setGameName={setGameName}
|
||||||
/>
|
/>
|
||||||
<SettingsPanel
|
<SettingsPanel
|
||||||
settings={settings}
|
settings={settings}
|
||||||
|
|||||||
@@ -171,6 +171,13 @@ export function useSession() {
|
|||||||
currentAppNameRef.current = ""
|
currentAppNameRef.current = ""
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
// Manual game name override (fallback when SteamClient events don't fire)
|
||||||
|
const setGameName = useCallback((name: string, appId?: number) => {
|
||||||
|
currentAppNameRef.current = name
|
||||||
|
if (appId !== undefined) currentAppIdRef.current = appId
|
||||||
|
setSession((prev) => ({ ...prev, gameName: name, appId: appId ?? prev.appId }))
|
||||||
|
}, [])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
recordingState,
|
recordingState,
|
||||||
session,
|
session,
|
||||||
@@ -184,6 +191,7 @@ export function useSession() {
|
|||||||
reset,
|
reset,
|
||||||
onGameStart,
|
onGameStart,
|
||||||
onGameStop,
|
onGameStop,
|
||||||
|
setGameName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user