diff options
-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 | ||||
-rw-r--r-- | src-vue/src/i18n/lang/en.json | 1 | ||||
-rw-r--r-- | src-vue/src/plugins/store.ts | 10 | ||||
-rw-r--r-- | src-vue/src/utils/GameInstall.ts | 1 | ||||
-rw-r--r-- | src-vue/src/views/SettingsView.vue | 19 |
7 files changed, 11 insertions, 36 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()), } diff --git a/src-vue/src/i18n/lang/en.json b/src-vue/src/i18n/lang/en.json index b1c69388..470e98be 100644 --- a/src-vue/src/i18n/lang/en.json +++ b/src-vue/src/i18n/lang/en.json @@ -92,7 +92,6 @@ "settings": { "manage_install": "Manage installation", - "launch_parameters": "Launch parameters", "choose_folder": "Choose installation folder", "open_game_folder": "Open Folder", "nb_ts_mods_per_page": "Number of Thunderstore mods per page", diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index 57021c97..e7dc0763 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -26,7 +26,6 @@ const persistentStore = new Store('flight-core-settings.json'); export interface FlightCoreStore { developer_mode: boolean, game_path: string, - launch_parameters: string, install_type: InstallType, flightcore_version: string, @@ -63,7 +62,6 @@ export const store = createStore<FlightCoreStore>({ return { developer_mode: false, game_path: undefined as unknown as string, - launch_parameters: undefined as unknown as string, install_type: undefined as unknown as InstallType, flightcore_version: "", @@ -245,8 +243,7 @@ export const store = createStore<FlightCoreStore>({ async launchGameSteam(state: any, no_checks = false) { let game_install = { game_path: state.game_path, - install_type: state.install_type, - launch_parameters: state.launch_parameters + install_type: state.install_type } as GameInstall; await invoke("launch_northstar_steam", { gameInstall: game_install, bypassChecks: no_checks }) @@ -377,11 +374,6 @@ async function _initializeApp(state: any) { state.enableReleasesSwitch = valueFromStore.value; } - const paramsFromStore: { value: boolean } | null = await persistentStore.get('northstar-launch-parameters'); - if (paramsFromStore) { - state.launch_parameters = paramsFromStore.value; - } - // Grab "Thunderstore mods per page" setting from store if possible const perPageFromStore: { value: number } | null = await persistentStore.get('thunderstore-mods-per-page'); if (perPageFromStore && perPageFromStore.value) { diff --git a/src-vue/src/utils/GameInstall.ts b/src-vue/src/utils/GameInstall.ts index 22081afc..07358f6c 100644 --- a/src-vue/src/utils/GameInstall.ts +++ b/src-vue/src/utils/GameInstall.ts @@ -1,5 +1,4 @@ export interface GameInstall { game_path: string; - launch_parameters: string; install_type: string; } diff --git a/src-vue/src/views/SettingsView.vue b/src-vue/src/views/SettingsView.vue index 5cc87213..c4e94c80 100644 --- a/src-vue/src/views/SettingsView.vue +++ b/src-vue/src/views/SettingsView.vue @@ -21,15 +21,6 @@ </el-input> </div> - <!-- Extra Launch parameters when starting Northtsar --> - <div class="fc_parameter__panel"> - <h3>{{ $t('settings.launch_parameters') }}</h3> - <el-input - v-model="launchParameters" - > - </el-input> - </div> - <!-- Thunderstore mods per page configuration --> <div class="fc_parameter__panel"> <h3>{{ $t('settings.nb_ts_mods_per_page') }}</h3> @@ -144,16 +135,6 @@ export default defineComponent({ } } }, - launchParameters: { - get(): string { - return this.$store.state.launch_parameters - }, - async set(value: string) { - this.$store.state.launch_parameters = value; - persistentStore.set('northstar-launch-parameters', { value }); - await persistentStore.save(); // explicit save to disk - } - }, modsPerPage: { get(): number { return this.$store.state.mods_per_page; |