mirror of
https://github.com/open-goal/launcher.git
synced 2024-10-19 14:47:36 -04:00
support: Some hopefully useful support improvements (#302)
This commit is contained in:
parent
504031a699
commit
9a3be036b0
|
@ -181,6 +181,10 @@ fn get_exec_location(
|
|||
.join(&config_info.active_version);
|
||||
let exec_path = exec_dir.join(bin_ext(executable_name));
|
||||
if !exec_path.exists() {
|
||||
log::error!(
|
||||
"Could not find the required binary '{}', can't perform operation",
|
||||
exec_path.to_string_lossy()
|
||||
);
|
||||
return Err(CommandError::BinaryExecution(format!(
|
||||
"Could not find the required binary '{}', can't perform operation",
|
||||
exec_path.to_string_lossy()
|
||||
|
@ -270,10 +274,11 @@ pub async fn extract_and_validate_iso(
|
|||
let exec_info = match get_exec_location(&config_info, "extractor") {
|
||||
Ok(exec_info) => exec_info,
|
||||
Err(_) => {
|
||||
log::error!("extractor executable not found");
|
||||
return Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some("Tooling appears to be missing critical files. This may be caused by antivirus software. You will need to redownload the version and try again.".to_string()),
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -305,6 +310,7 @@ pub async fn extract_and_validate_iso(
|
|||
match output.status.code() {
|
||||
Some(code) => {
|
||||
if code == 0 {
|
||||
log::info!("extraction and validation was successful");
|
||||
return Ok(InstallStepOutput {
|
||||
success: true,
|
||||
msg: None,
|
||||
|
@ -315,15 +321,23 @@ pub async fn extract_and_validate_iso(
|
|||
msg: format!("Unexpected error occured with code {code}"),
|
||||
};
|
||||
let message = error_code_map.get(&code).unwrap_or(&default_error);
|
||||
log::error!("extraction and validation was not successful. Code {code}");
|
||||
log::error!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
||||
log::error!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some(message.msg.clone()),
|
||||
})
|
||||
}
|
||||
None => Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some("Unexpected error occurred".to_owned()),
|
||||
}),
|
||||
None => {
|
||||
log::error!("extraction and validation was not successful. No status code");
|
||||
log::error!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
||||
log::error!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some("Unexpected error occurred".to_owned()),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -339,13 +353,18 @@ pub async fn run_decompiler(
|
|||
let config_info = common_prelude(&config_lock)?;
|
||||
|
||||
let data_folder = get_data_dir(&config_info, &game_name, false)?;
|
||||
log::info!(
|
||||
"decompiling using data folder: {}",
|
||||
data_folder.to_string_lossy()
|
||||
);
|
||||
let exec_info = match get_exec_location(&config_info, "extractor") {
|
||||
Ok(exec_info) => exec_info,
|
||||
Err(_) => {
|
||||
log::error!("extractor executable not found");
|
||||
return Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some("Tooling appears to be missing critical files. This may be caused by antivirus software. You will need to redownload the version and try again.".to_string()),
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -378,6 +397,7 @@ pub async fn run_decompiler(
|
|||
match output.status.code() {
|
||||
Some(code) => {
|
||||
if code == 0 {
|
||||
log::info!("decompilation was successful");
|
||||
return Ok(InstallStepOutput {
|
||||
success: true,
|
||||
msg: None,
|
||||
|
@ -388,15 +408,23 @@ pub async fn run_decompiler(
|
|||
msg: format!("Unexpected error occured with code {code}"),
|
||||
};
|
||||
let message = error_code_map.get(&code).unwrap_or(&default_error);
|
||||
log::error!("decompilation was not successful. Code {code}");
|
||||
log::error!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
||||
log::error!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some(message.msg.clone()),
|
||||
})
|
||||
}
|
||||
None => Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some("Unexpected error occurred".to_owned()),
|
||||
}),
|
||||
None => {
|
||||
log::error!("decompilation was not successful. No status code");
|
||||
log::error!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
||||
log::error!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some("Unexpected error occurred".to_owned()),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,6 +440,10 @@ pub async fn run_compiler(
|
|||
let config_info = common_prelude(&config_lock)?;
|
||||
|
||||
let data_folder = get_data_dir(&config_info, &game_name, false)?;
|
||||
log::info!(
|
||||
"compiling using data folder: {}",
|
||||
data_folder.to_string_lossy()
|
||||
);
|
||||
let exec_info = match get_exec_location(&config_info, "extractor") {
|
||||
Ok(exec_info) => exec_info,
|
||||
Err(_) => {
|
||||
|
@ -451,6 +483,7 @@ pub async fn run_compiler(
|
|||
match output.status.code() {
|
||||
Some(code) => {
|
||||
if code == 0 {
|
||||
log::info!("compilation was successful");
|
||||
return Ok(InstallStepOutput {
|
||||
success: true,
|
||||
msg: None,
|
||||
|
@ -461,15 +494,23 @@ pub async fn run_compiler(
|
|||
msg: format!("Unexpected error occured with code {code}"),
|
||||
};
|
||||
let message = error_code_map.get(&code).unwrap_or(&default_error);
|
||||
log::error!("compilation was not successful. Code {code}");
|
||||
log::error!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
||||
log::error!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some(message.msg.clone()),
|
||||
})
|
||||
}
|
||||
None => Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some("Unexpected error occurred".to_owned()),
|
||||
}),
|
||||
None => {
|
||||
log::error!("compilation was not successful. No status code");
|
||||
log::error!("stderr: {}", String::from_utf8_lossy(&output.stderr));
|
||||
log::error!("stdout: {}", String::from_utf8_lossy(&output.stdout));
|
||||
Ok(InstallStepOutput {
|
||||
success: false,
|
||||
msg: Some("Unexpected error occurred".to_owned()),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ pub struct SupportPackage {
|
|||
pub gpu_info: Vec<GPUInfo>,
|
||||
pub game_info: PerGameInfo,
|
||||
pub launcher_version: String,
|
||||
pub extractor_binary_exists: bool,
|
||||
pub game_binary_exists: bool,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
@ -95,6 +97,35 @@ pub async fn generate_support_package(
|
|||
.kernel_version()
|
||||
.unwrap_or("unknown".to_string());
|
||||
package.launcher_version = app_handle.package_info().version.to_string();
|
||||
if let Some(active_version) = &config_lock.active_version {
|
||||
if cfg!(windows) {
|
||||
package.extractor_binary_exists = install_path
|
||||
.join("versions")
|
||||
.join("official")
|
||||
.join(active_version)
|
||||
.join("extractor.exe")
|
||||
.exists();
|
||||
package.game_binary_exists = install_path
|
||||
.join("versions")
|
||||
.join("official")
|
||||
.join(active_version)
|
||||
.join("gk.exe")
|
||||
.exists();
|
||||
} else {
|
||||
package.extractor_binary_exists = install_path
|
||||
.join("versions")
|
||||
.join("official")
|
||||
.join(active_version)
|
||||
.join("extractor")
|
||||
.exists();
|
||||
package.game_binary_exists = install_path
|
||||
.join("versions")
|
||||
.join("official")
|
||||
.join(active_version)
|
||||
.join("gk")
|
||||
.exists();
|
||||
}
|
||||
}
|
||||
|
||||
for disk in system_info.disks() {
|
||||
package.disk_info.push(format!(
|
||||
|
@ -106,7 +137,6 @@ pub async fn generate_support_package(
|
|||
))
|
||||
}
|
||||
|
||||
// TODO - maybe long-term this can replace glewinfo / support vulkan?
|
||||
let gpu_info_instance = wgpu::Instance::default();
|
||||
for a in gpu_info_instance.enumerate_adapters(wgpu::Backends::all()) {
|
||||
let info = a.get_info();
|
||||
|
|
|
@ -103,8 +103,7 @@
|
|||
<Toast
|
||||
color="green"
|
||||
position="top-right"
|
||||
class="top-20"
|
||||
divClass="w-full max-w-xs p-2 pl-4 z-50"
|
||||
class="w-full max-w-xs p-2 pl-4 z-50 top-20"
|
||||
>
|
||||
{$toastStore.msg}
|
||||
</Toast>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<Accordion class="log-accordian" defaultClass="p-0">
|
||||
<Accordion class="log-accordian p-0 mb-2">
|
||||
<AccordionItem class="bg-slate-900 rounded p-[1rem]">
|
||||
<span slot="header" class="text-sm font-semibold text-white flex gap-2">
|
||||
<IconDocument />
|
||||
|
@ -19,7 +19,7 @@
|
|||
</span>
|
||||
<div
|
||||
slot="default"
|
||||
class="bg-slate-900 px-4 max-h-60 overflow-y-scroll scrollbar"
|
||||
class="bg-slate-900 px-4 max-h-52 overflow-y-scroll scrollbar"
|
||||
>
|
||||
<p class="py-4 text-clip overflow-hidden font-mono log-output">
|
||||
...{$_("setup_logs_truncation")}:
|
||||
|
|
|
@ -64,7 +64,7 @@ export async function launchGame(
|
|||
"launch_game",
|
||||
{ gameName, inDebug },
|
||||
() => {},
|
||||
"Unable to launch game",
|
||||
"_mirror_",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,13 @@ export async function invoke_rpc<T>(
|
|||
} else {
|
||||
exceptionLog(`Error calling '${cmd}'`, e);
|
||||
}
|
||||
const toastMessage = toastOnError ?? "An unexpected error occurred";
|
||||
toastStore.makeToast(toastMessage, "error");
|
||||
// TODO - this is a dumb hack but whatever for now
|
||||
if (toastOnError === "_mirror_") {
|
||||
toastStore.makeToast(e, "error");
|
||||
} else {
|
||||
const toastMessage = toastOnError ?? "An unexpected error occurred";
|
||||
toastStore.makeToast(toastMessage, "error");
|
||||
}
|
||||
return handleError(e);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue