diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-07-24 00:41:38 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-07-24 00:41:38 +0200 |
commit | 59ff6871f74d164a8d2d308094d5c8fd253d03e5 (patch) | |
tree | 047c0bf481423ed34b8408fa69147b13873451fa /src-tauri | |
parent | f2d5d62366b80ad596824853bdcf72e1dc296243 (diff) | |
download | FlightCore-59ff6871f74d164a8d2d308094d5c8fd253d03e5.tar.gz FlightCore-59ff6871f74d164a8d2d308094d5c8fd253d03e5.zip |
refactor: Remove all of arg store again
Diffstat (limited to 'src-tauri')
-rw-r--r-- | src-tauri/src/main.rs | 1 | ||||
-rw-r--r-- | src-tauri/src/northstar/install.rs | 1 | ||||
-rw-r--r-- | src-tauri/src/northstar/mod.rs | 14 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 21408ff8..1067f5d3 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -467,7 +467,6 @@ pub enum InstallType { #[derive(Serialize, Deserialize, Debug, Clone)] pub struct GameInstall { pub game_path: String, - pub launch_parameters: String, pub install_type: InstallType, } diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs index 28366738..c77fd538 100644 --- a/src-tauri/src/northstar/install.rs +++ b/src-tauri/src/northstar/install.rs @@ -190,7 +190,6 @@ pub fn find_game_install_location() -> Result<GameInstall, String> { // println!("{:#?}", app); let game_install = GameInstall { game_path: app.path.to_str().unwrap().to_string(), - launch_parameters: "".to_string(), install_type: InstallType::STEAM, }; return Ok(game_install); diff --git a/src-tauri/src/northstar/mod.rs b/src-tauri/src/northstar/mod.rs index 6d0e26d2..a77755cb 100644 --- a/src-tauri/src/northstar/mod.rs +++ b/src-tauri/src/northstar/mod.rs @@ -62,6 +62,7 @@ pub fn get_northstar_version_number(game_path: &str) -> Result<String, String> { pub fn launch_northstar( game_install: GameInstall, bypass_checks: Option<bool>, + launch_parameters: Option<String>, ) -> Result<String, String> { dbg!(game_install.clone()); @@ -77,7 +78,7 @@ pub fn launch_northstar( )); } - return launch_northstar_steam(game_install, bypass_checks); + return launch_northstar_steam(game_install, bypass_checks, launch_parameters); } let bypass_checks = bypass_checks.unwrap_or(false); @@ -112,11 +113,14 @@ pub fn launch_northstar( || matches!(game_install.install_type, InstallType::UNKNOWN)) { let ns_exe_path = format!("{}/NorthstarLauncher.exe", game_install.game_path); - let ns_params: Vec<&str> = game_install.launch_parameters.split_whitespace().collect(); - + let mut args = vec!["/C", "start", "", &ns_exe_path]; // We cannot add the params directly because of limitations with cmd.exe // https://stackoverflow.com/questions/9964865/c-system-not-working-when-there-are-spaces-in-two-different-parameters/9965141#9965141 + + let launch_parameters = launch_parameters.unwrap_or_else(|| "".to_string()); + let ns_params: Vec<&str> = launch_parameters.split_whitespace().collect(); + dbg!(ns_params.clone()); args.extend(ns_params); let _output = std::process::Command::new("C:\\Windows\\System32\\cmd.exe") .args(args) @@ -137,6 +141,7 @@ pub fn launch_northstar( pub fn launch_northstar_steam( game_install: GameInstall, _bypass_checks: Option<bool>, + launch_parameters: Option<String>, ) -> Result<String, String> { if !matches!(game_install.install_type, InstallType::STEAM) { return Err("Titanfall2 was not installed via Steam".to_string()); @@ -179,7 +184,8 @@ pub fn launch_northstar_steam( return Err("Couldn't access Titanfall2 directory".to_string()); } - match open::that(format!("steam://run/{}//--northstar {}/", TITANFALL2_STEAM_ID, game_install.launch_parameters)) { + let launch_parameters = launch_parameters.unwrap_or_else(|| "".to_string()); + match open::that(format!("steam://run/{}//--northstar {}/", TITANFALL2_STEAM_ID, launch_parameters)) { Ok(()) => Ok("Started game".to_string()), Err(_err) => Err("Failed to launch Titanfall 2 via Steam".to_string()), } |