add --ignore-required-files

This commit is contained in:
mxve 2024-02-09 18:45:19 +01:00
parent e8aee89f45
commit 5ef075d4c3
2 changed files with 12 additions and 2 deletions

View File

@ -37,6 +37,8 @@
- See [client-args.md](client-args.md) - See [client-args.md](client-args.md)
- ```--version```, ```-v``` - ```--version```, ```-v```
- Print the launcher version - Print the launcher version
- ```--ignore-required-files```
- Install client even if required files are missing
Example: ```alterware-launcher.exe iw4x --bonus -u --path "C:\Games\IW4x" --pass "-console"``` Example: ```alterware-launcher.exe iw4x --bonus -u --path "C:\Games\IW4x" --pass "-console"```

View File

@ -103,7 +103,7 @@ fn setup_desktop_links(path: &Path, game: &Game) {
async fn auto_install(path: &Path, game: &Game<'_>, master_url: &String) { async fn auto_install(path: &Path, game: &Game<'_>, master_url: &String) {
setup_client_links(game, path); setup_client_links(game, path);
setup_desktop_links(path, game); setup_desktop_links(path, game);
update(game, path, false, false, None, master_url).await; update(game, path, false, false, None, master_url, None).await;
} }
#[cfg(windows)] #[cfg(windows)]
@ -292,15 +292,17 @@ async fn update(
force: bool, force: bool,
skip_iw4x_sp: Option<bool>, skip_iw4x_sp: Option<bool>,
master_url: &String, master_url: &String,
ignore_required_files: Option<bool>
) { ) {
let skip_iw4x_sp = skip_iw4x_sp.unwrap_or(false); let skip_iw4x_sp = skip_iw4x_sp.unwrap_or(false);
let ignore_required_files = ignore_required_files.unwrap_or(false);
let cdn_info: Vec<CdnFile> = serde_json::from_str(&http::get_body_string( let cdn_info: Vec<CdnFile> = serde_json::from_str(&http::get_body_string(
format!("{}/files.json", master_url).as_str(), format!("{}/files.json", master_url).as_str(),
)) ))
.unwrap(); .unwrap();
if !game.required_files_exist(dir) { if !ignore_required_files && !game.required_files_exist(dir) {
println!( println!(
"{}\nVerify game file integrity on Steam or reinstall the game.", "{}\nVerify game file integrity on Steam or reinstall the game.",
"Critical game files missing.".bright_red() "Critical game files missing.".bright_red()
@ -578,6 +580,11 @@ async fn main() {
arg_remove(&mut args, "-f"); arg_remove(&mut args, "-f");
} }
let ignore_required_files = arg_bool(&args, "--ignore-required-files");
if ignore_required_files {
arg_remove(&mut args, "--ignore-required-files");
}
if let Some(pass) = arg_value(&args, "--pass") { if let Some(pass) = arg_value(&args, "--pass") {
cfg.args = pass; cfg.args = pass;
arg_remove_value(&mut args, "--pass"); arg_remove_value(&mut args, "--pass");
@ -663,6 +670,7 @@ async fn main() {
cfg.force_update, cfg.force_update,
Some(&game != "iw4x-sp"), Some(&game != "iw4x-sp"),
&master_url, &master_url,
Some(ignore_required_files),
) )
.await; .await;
if !cfg.update_only { if !cfg.update_only {