diff options
Diffstat (limited to 'src-tauri/src')
-rw-r--r-- | src-tauri/src/lib.rs | 35 | ||||
-rw-r--r-- | src-tauri/src/main.rs | 7 |
2 files changed, 28 insertions, 14 deletions
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index fbef3bac..bfac47c7 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -232,12 +232,31 @@ pub fn get_host_os() -> String { env::consts::OS.to_string() } -pub fn launch_northstar(game_install: GameInstall) -> Result<String, String> { +pub fn launch_northstar( + game_install: GameInstall, + bypass_checks: Option<bool>, +) -> Result<String, String> { dbg!(game_install.clone()); - // Some safety checks before, should have more in the future - if get_northstar_version_number(game_install.game_path.clone()).is_err() { - return Err(anyhow!("Not all checks were met").to_string()); + let bypass_checks = match bypass_checks { + Some(bypass_checks) => bypass_checks, + None => false, + }; + + // Only check guards if bypassing checks is not enabled + if !bypass_checks { + // Some safety checks before, should have more in the future + if get_northstar_version_number(game_install.game_path.clone()).is_err() { + return Err(anyhow!("Not all checks were met").to_string()); + } + + // Require Origin to be running to launch Northstar + let origin_is_running = check_origin_running(); + if !origin_is_running { + return Err( + anyhow!("Origin not running, start Origin before launching Northstar").to_string(), + ); + } } let host_os = get_host_os(); @@ -262,14 +281,6 @@ pub fn launch_northstar(game_install: GameInstall) -> Result<String, String> { return Err(anyhow!("Couldn't access Titanfall2 directory").to_string()); } - // Require Origin to be running to launch Northstar - let origin_is_running = check_origin_running(); - if !origin_is_running { - return Err( - anyhow!("Origin not running, start Origin before launching Northstar").to_string(), - ); - } - // Only Windows with Steam or Origin are supported at the moment if host_os == "windows" && (matches!(game_install.install_type, InstallType::STEAM) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index d775d978..8947d743 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -266,8 +266,11 @@ async fn update_northstar_caller( #[tauri::command] /// Launches Northstar -async fn launch_northstar_caller(game_install: GameInstall) -> Result<String, String> { - launch_northstar(game_install) +async fn launch_northstar_caller( + game_install: GameInstall, + bypass_checks: Option<bool>, +) -> Result<String, String> { + launch_northstar(game_install, bypass_checks) } #[tauri::command] |