-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Primitive dev-only launch params #449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
baa1c52
f2d5d62
59ff687
a498564
67867f7
c227cd0
31ecd72
e621728
4187ef1
df5978f
869300c
439574d
d6bc5b4
9d15ffb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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,8 +113,17 @@ pub fn launch_northstar( | |
| || matches!(game_install.install_type, InstallType::UNKNOWN)) | ||
| { | ||
| let ns_exe_path = format!("{}/NorthstarLauncher.exe", game_install.game_path); | ||
|
|
||
| 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_default(); | ||
| 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(["/C", "start", "", &ns_exe_path]) | ||
| .args(args) | ||
|
Comment on lines
+117
to
+224
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @Jan200101 cause this will 100% merge conflict with #444 so we should probably figure out how to best merge it ^^" I.e. turn profile command into launch arg and then pass it or keep profile arg in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A lot of APIs rely on having profile information available, that would require adapting, which is why I made the profile part of
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, profile should stay in |
||
| .spawn() | ||
| .expect("failed to execute process"); | ||
| return Ok("Launched game".to_string()); | ||
|
|
@@ -131,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()); | ||
|
|
@@ -173,7 +184,11 @@ pub fn launch_northstar_steam( | |
| return Err("Couldn't access Titanfall2 directory".to_string()); | ||
| } | ||
|
|
||
| match open::that(format!("steam://run/{}//--northstar/", TITANFALL2_STEAM_ID)) { | ||
| let launch_parameters = launch_parameters.unwrap_or_default(); | ||
| 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()), | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export interface LaunchObject { | ||
| no_checks: boolean, | ||
| launch_args: string, | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you try powershell? or is it the same thing for powershell?