diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 94face5..264adac 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -243,15 +243,24 @@ fn uninstall_profile(profile_path: String) -> Result<(), String> { } #[tauri::command] -fn launch_profile(profile_path: String, exec_path: String, arguments: Vec) -> Result<(), String> { +fn launch_profile(profile_path: String, exec_path: String, use_obs_vkcapture: bool, arguments: Vec) -> Result<(), String> { let mut path = PathBuf::from(&profile_path); path.push("installation"); path.push(exec_path); - Command::new(path) - .args(arguments) - .spawn() - .map_err(|e| format!("Failed to launch profile? Is the executable installed?\n{:?}", e))?; + if !use_obs_vkcapture { + Command::new(path) + .args(arguments) + .spawn() + .map_err(|e| format!("Failed to launch profile! Is the executable installed?\n{:?}", e))?; + } else { + let path_str = path_to_string(path)?; + + Command::new("obs-gamecapture") + .args([path_str].iter().chain(&arguments)) + .spawn() + .map_err(|e| format!("Failed to launch profile! Is the executable installed? Is obs-vkcapture installed and pathed?\n{:?}", e))?; + } Ok(()) } diff --git a/src/profiles/actions.ts b/src/profiles/actions.ts index 3e9c30c..cf80cc9 100644 --- a/src/profiles/actions.ts +++ b/src/profiles/actions.ts @@ -63,6 +63,7 @@ export const launch = async (activeProfile: ActiveProfile, profilePath: string): await invoke("launch_profile", { profilePath: profilePath, execPath: launchOptions.executablePath, + useObsVkcapture: os === "linux" && activeProfile.useObsVkcapture, arguments: [...launchOptions.arguments, ...otherArguments, ...customArguments] }); } catch (e) { diff --git a/src/profiles/store.ts b/src/profiles/store.ts index b3ba6cb..7eac79f 100644 --- a/src/profiles/store.ts +++ b/src/profiles/store.ts @@ -85,6 +85,7 @@ export const useProfileStore = create()((set, get) => ({ displayName: undefined, selectedVersion: undefined, launchArguments: "", + useObsVkcapture: false, lastPlayed: undefined, diff --git a/src/profiles/types.ts b/src/profiles/types.ts index f66c7bf..157869e 100644 --- a/src/profiles/types.ts +++ b/src/profiles/types.ts @@ -117,6 +117,7 @@ export interface ActiveProfile { displayName?: string, selectedVersion?: string, launchArguments: string, + useObsVkcapture: boolean, lastPlayed?: string, diff --git a/src/routes/AppProfile/AppSettings.module.css b/src/routes/AppProfile/AppSettings.module.css index e8278af..26f98e6 100644 --- a/src/routes/AppProfile/AppSettings.module.css +++ b/src/routes/AppProfile/AppSettings.module.css @@ -85,17 +85,29 @@ gap: 15px; } +.setting.wide { + justify-content: space-between; +} + .setting > p { width: 175px; color: #41475F; } +.setting.wide > p { + width: auto; +} + .setting > input { align-self: center; flex: 1 0 0; } +.setting > button { + align-self: center; +} + .navigation { display: flex; flex-direction: row; diff --git a/src/routes/AppProfile/AppSettings.tsx b/src/routes/AppProfile/AppSettings.tsx index 3d73378..088df93 100644 --- a/src/routes/AppProfile/AppSettings.tsx +++ b/src/routes/AppProfile/AppSettings.tsx @@ -1,6 +1,6 @@ import Button, { ButtonColor } from "@app/components/Button"; import styles from "./AppSettings.module.css"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { ActiveProfile, VersionInfoList, VersionList } from "@app/profiles/types"; import { localizeMetadata } from "@app/profiles/utils"; import { tryFetchVersion, useProfileStore } from "@app/profiles/store"; @@ -11,6 +11,7 @@ import { useQuery } from "@tanstack/react-query"; import { createAndShowDialog, showErrorDialog } from "@app/dialogs"; import { distanceFromToday } from "@app/utils/timeFormat"; import { OldVersionDialog } from "@app/dialogs/Dialogs/OldVersionDialog"; +import { OS, getOS } from "@app/utils/os"; interface VersionListProps { activeProfile: ActiveProfile, @@ -36,7 +37,7 @@ const VersionListComp: React.FC = ({ activeProfile, selectedVe if (versionDialogOutput === "okay") { setSelectedVersion(uuid); - } + } } else { setSelectedVersion(uuid); } @@ -100,8 +101,17 @@ const AppSettings: React.FC = ({ activeProfile, setSettingsOpen }: Props) initalDisplayName = localizeMetadata(activeProfile.profile, "en-US").name; } + const [os, setOs] = useState(); + useEffect(() => { + (async () => { + setOs(await getOS()); + })(); + }); + const [displayName, setDisplayName] = useState(initalDisplayName); const [launchArguments, setLaunchArguments] = useState(activeProfile.launchArguments); + const [obsVkcapture, setObsVkcapture] = useState(activeProfile.useObsVkcapture); + const [selectedVerison, setSelectedVersion] = useState(activeProfile.selectedVersion); return
@@ -124,6 +134,25 @@ const AppSettings: React.FC = ({ activeProfile, setSettingsOpen }: Props)

Additional Launch Arguments

+ {os === "linux" && +
+

Use obs-vkcapture wrapper (you need to have it installed)

+ {obsVkcapture && + + } + {!obsVkcapture && + + } +
+ } = ({ activeProfile, setSettingsOpen }: Props) activeProfile.displayName = displayName; } - // Update launch arguments + // Update other fields activeProfile.launchArguments = launchArguments; + activeProfile.useObsVkcapture = obsVkcapture; // Update profile version if (selectedVerison !== activeProfile.selectedVersion) {