feat(Compat): Implemented spawning with umu (using umu-wrapper-lib)

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-12-30 13:12:04 +11:00
parent 95f2174f8d
commit 88b2505e71
3 changed files with 16 additions and 1 deletions

7
src-tauri/Cargo.lock generated
View File

@ -995,6 +995,7 @@ dependencies = [
"tauri-plugin-shell",
"tauri-plugin-single-instance",
"tokio",
"umu-wrapper-lib",
"url",
"urlencoding",
"uuid",
@ -4926,6 +4927,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "umu-wrapper-lib"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baa36636bef667cee9eb4f497c24279182b8b9f098fd04b0b8c5d2ebc4e451f1"
[[package]]
name = "unic-char-property"
version = "0.9.0"

View File

@ -43,6 +43,7 @@ md5 = "0.7.0"
chrono = "0.4.38"
tauri-plugin-os = "2"
boxcar = "0.2.7"
umu-wrapper-lib = "0.1.0"
[dependencies.tauri]
version = "2.1.1"

View File

@ -10,6 +10,7 @@ use std::{
use log::{info, warn};
use serde::{Deserialize, Serialize};
use tauri::{AppHandle, Manager};
use umu_wrapper_lib::command_builder::UmuCommandBuilder;
use crate::{
db::{GameStatus, GameTransientStatus, DATA_ROOT_DIR},
@ -315,6 +316,7 @@ impl ProcessHandler for NativeGameLauncher {
}
}
const UMU_LAUNCHER_EXECUTABLE: &str = "umu-run";
struct UMULauncher;
impl ProcessHandler for UMULauncher {
fn launch_process(
@ -327,6 +329,11 @@ impl ProcessHandler for UMULauncher {
log_file: File,
error_file: File,
) -> Result<Child, String> {
todo!()
UmuCommandBuilder::new(UMU_LAUNCHER_EXECUTABLE, command)
.game_id(game_id.into())
.launch_args(args)
.build()
.spawn()
.map_err(|x| x.to_string())
}
}