Skip to content

Commit

Permalink
backend: only use decompiler settings outside of installs/updates (#600)
Browse files Browse the repository at this point in the history
Typically just results in big slow-downs and such, as some users don't
remember they enabled these settings and then leave them on. Only use
them when the users runs "Advanced > Decompiler"
  • Loading branch information
xTVaser authored Oct 19, 2024
1 parent 4b2f704 commit b917791
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
35 changes: 19 additions & 16 deletions src-tauri/src/commands/binaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ pub async fn run_decompiler(
path_to_iso: String,
game_name: String,
truncate_logs: bool,
use_decomp_settings: bool,
) -> Result<InstallStepOutput, CommandError> {
let config_lock = config.lock().await;
let config_info = common_prelude(&config_lock)?;
Expand Down Expand Up @@ -377,25 +378,27 @@ pub async fn run_decompiler(
let mut command = Command::new(exec_info.executable_path);

let mut decomp_config_overrides = vec![];
if let Some(decomp_settings) = &config_lock.decompiler_settings {
if let Some(rip_levels) = decomp_settings.rip_levels_enabled {
if rip_levels {
decomp_config_overrides.push(format!("\"rip_levels\": {rip_levels}"));
if use_decomp_settings {
if let Some(decomp_settings) = &config_lock.decompiler_settings {
if let Some(rip_levels) = decomp_settings.rip_levels_enabled {
if rip_levels {
decomp_config_overrides.push(format!("\"rip_levels\": {rip_levels}"));
}
}
}
if let Some(rip_collision) = decomp_settings.rip_collision_enabled {
if rip_collision {
decomp_config_overrides.push(format!("\"rip_collision\": {rip_collision}"));
if let Some(rip_collision) = decomp_settings.rip_collision_enabled {
if rip_collision {
decomp_config_overrides.push(format!("\"rip_collision\": {rip_collision}"));
}
}
}
if let Some(rip_textures) = decomp_settings.rip_textures_enabled {
if rip_textures {
decomp_config_overrides.push(format!("\"save_texture_pngs\": {rip_textures}"));
if let Some(rip_textures) = decomp_settings.rip_textures_enabled {
if rip_textures {
decomp_config_overrides.push(format!("\"save_texture_pngs\": {rip_textures}"));
}
}
}
if let Some(rip_streamed_audio) = decomp_settings.rip_streamed_audio_enabled {
if rip_streamed_audio {
decomp_config_overrides.push(format!("\"rip_streamed_audio\": {rip_streamed_audio}"));
if let Some(rip_streamed_audio) = decomp_settings.rip_streamed_audio_enabled {
if rip_streamed_audio {
decomp_config_overrides.push(format!("\"rip_streamed_audio\": {rip_streamed_audio}"));
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/games/job/GameJob.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
]);
progressTracker.start();
let resp = await runDecompiler("", getInternalName(activeGame), true);
let resp = await runDecompiler("", getInternalName(activeGame), true, true);
if (!resp.success) {
progressTracker.halt();
installationError = resp.msg;
Expand Down Expand Up @@ -123,7 +123,7 @@
return;
}
progressTracker.proceed();
resp = await runDecompiler("", getInternalName(activeGame), true);
resp = await runDecompiler("", getInternalName(activeGame), true, false);
if (!resp.success) {
progressTracker.halt();
installationError = resp.msg;
Expand Down Expand Up @@ -195,7 +195,7 @@
return;
}
progressTracker.proceed();
resp = await runDecompiler("", getInternalName(activeGame), true);
resp = await runDecompiler("", getInternalName(activeGame), true, false);
if (!resp.success) {
progressTracker.halt();
installationError = resp.msg;
Expand Down
7 changes: 6 additions & 1 deletion src/components/games/setup/GameSetup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@
return;
}
progressTracker.proceed();
resp = await runDecompiler(sourcePath, getInternalName(activeGame));
resp = await runDecompiler(
sourcePath,
getInternalName(activeGame),
false,
false,
);
if (!resp.success) {
progressTracker.halt();
installationError = resp.msg;
Expand Down
3 changes: 2 additions & 1 deletion src/lib/rpc/binaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ export async function runDecompiler(
pathToIso: string,
gameName: string,
truncateLogs: boolean = false,
useDecompSettings: boolean = false,
): Promise<InstallationOutput> {
return await invoke_rpc(
"run_decompiler",
{ pathToIso, gameName, truncateLogs },
{ pathToIso, gameName, truncateLogs, useDecompSettings },
() => failed("Failed to run decompiler"),
);
}
Expand Down

0 comments on commit b917791

Please sign in to comment.