diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/ClipboardCommands.tsx | 17 | ||||
| -rw-r--r-- | src/components/CustomPathOverride.tsx | 13 | ||||
| -rw-r--r-- | src/components/OptiScalerControls.tsx | 23 |
3 files changed, 40 insertions, 13 deletions
diff --git a/src/components/ClipboardCommands.tsx b/src/components/ClipboardCommands.tsx index 5a6f38f..b8cf6bf 100644 --- a/src/components/ClipboardCommands.tsx +++ b/src/components/ClipboardCommands.tsx @@ -1,20 +1,27 @@ import { SmartClipboardButton } from "./SmartClipboardButton"; +import { DEFAULT_PROXY_DLL } from "../utils/constants"; interface ClipboardCommandsProps { pathExists: boolean | null; + dllName: string; } -export function ClipboardCommands({ pathExists }: ClipboardCommandsProps) { +export function ClipboardCommands({ pathExists, dllName }: ClipboardCommandsProps) { if (pathExists !== true) return null; + const launchCommand = + dllName === DEFAULT_PROXY_DLL + ? "~/fgmod/fgmod %command%" + : `DLL=${dllName} ~/fgmod/fgmod %command%`; + return ( <> - <SmartClipboardButton - command="~/fgmod/fgmod %command%" + <SmartClipboardButton + command={launchCommand} buttonText="Copy Patch Command" /> - - <SmartClipboardButton + + <SmartClipboardButton command="~/fgmod/fgmod-uninstaller.sh %command%" buttonText="Copy Unpatch Command" /> diff --git a/src/components/CustomPathOverride.tsx b/src/components/CustomPathOverride.tsx index ffc4b1f..14a0905 100644 --- a/src/components/CustomPathOverride.tsx +++ b/src/components/CustomPathOverride.tsx @@ -36,6 +36,7 @@ const ensureDirectory = (value: string) => { interface ManualPatchControlsProps { isAvailable: boolean; onManualModeChange?: (enabled: boolean) => void; + dllName: string; } interface PickerState { @@ -56,7 +57,7 @@ const formatResultMessage = (result: ApiResponse | null) => { return result.message || result.output || "Operation failed."; }; -export const ManualPatchControls = ({ isAvailable, onManualModeChange }: ManualPatchControlsProps) => { +export const ManualPatchControls = ({ isAvailable, onManualModeChange, dllName }: ManualPatchControlsProps) => { const [isEnabled, setEnabled] = useState(false); const [defaults, setDefaults] = useState<PathDefaults>(INITIAL_DEFAULTS); const [pickerState, setPickerState] = useState<PickerState>(INITIAL_PICKER_STATE); @@ -165,7 +166,7 @@ export const ManualPatchControls = ({ isAvailable, onManualModeChange }: ManualP try { const response = action === "patch" - ? await runManualPatch(selectedPath) + ? await runManualPatch(selectedPath, dllName) : await runManualUnpatch(selectedPath); setOperationResult(response ?? { status: "error", message: "No response from backend." }); } catch (err) { @@ -177,7 +178,7 @@ export const ManualPatchControls = ({ isAvailable, onManualModeChange }: ManualP setBusy(false); } }, - [selectedPath] + [selectedPath, dllName] ); const handleToggle = (value: boolean) => { @@ -216,7 +217,11 @@ export const ManualPatchControls = ({ isAvailable, onManualModeChange }: ManualP {canInteract && ( <> <SmartClipboardButton - command='WINEDLLOVERRIDES="dxgi=n,b" SteamDeck=0 %command%' + command={ + dllName === "OptiScaler.asi" + ? "SteamDeck=0 %command%" + : `WINEDLLOVERRIDES="${dllName.replace(".dll", "")}=n,b" SteamDeck=0 %command%` + } buttonText="Manual launch cmd" /> <PanelSectionRow> diff --git a/src/components/OptiScalerControls.tsx b/src/components/OptiScalerControls.tsx index 468683c..fb5d2f8 100644 --- a/src/components/OptiScalerControls.tsx +++ b/src/components/OptiScalerControls.tsx @@ -1,9 +1,9 @@ import { useState, useEffect } from "react"; -import { PanelSection } from "@decky/ui"; +import { DropdownItem, PanelSection, PanelSectionRow } from "@decky/ui"; import { runInstallFGMod, runUninstallFGMod } from "../api"; import { OperationResult } from "./ResultDisplay"; import { createAutoCleanupTimer } from "../utils"; -import { TIMEOUTS } from "../utils/constants"; +import { TIMEOUTS, PROXY_DLL_OPTIONS, DEFAULT_PROXY_DLL } from "../utils/constants"; import { InstallationStatus } from "./InstallationStatus"; import { OptiScalerHeader } from "./OptiScalerHeader"; import { ClipboardCommands } from "./ClipboardCommands"; @@ -23,6 +23,7 @@ export function OptiScalerControls({ pathExists, setPathExists }: OptiScalerCont const [installResult, setInstallResult] = useState<OperationResult | null>(null); const [uninstallResult, setUninstallResult] = useState<OperationResult | null>(null); const [manualModeEnabled, setManualModeEnabled] = useState(false); + const [dllName, setDllName] = useState<string>(DEFAULT_PROXY_DLL); useEffect(() => { if (installResult) { return createAutoCleanupTimer(() => setInstallResult(null), TIMEOUTS.resultDisplay); @@ -76,15 +77,29 @@ export function OptiScalerControls({ pathExists, setPathExists }: OptiScalerCont /> <OptiScalerHeader pathExists={pathExists} /> - + + {pathExists === true && ( + <PanelSectionRow> + <DropdownItem + label="Proxy DLL name" + description={PROXY_DLL_OPTIONS.find((o) => o.value === dllName)?.hint} + menuLabel="Proxy DLL name" + selectedOption={dllName} + rgOptions={PROXY_DLL_OPTIONS.map((o) => ({ data: o.value, label: o.label }))} + onChange={(option) => setDllName(String(option.data))} + /> + </PanelSectionRow> + )} + <ManualPatchControls isAvailable={pathExists === true} onManualModeChange={setManualModeEnabled} + dllName={dllName} /> {!manualModeEnabled && ( <> - <ClipboardCommands pathExists={pathExists} /> + <ClipboardCommands pathExists={pathExists} dllName={dllName} /> <InstructionCard pathExists={pathExists} /> </> |
