Skip to content
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

installing games from folder #651

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src-tauri/src/commands/binaries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ pub async fn extract_and_validate_iso(
app_handle: tauri::AppHandle,
path_to_iso: String,
game_name: String,
via_folder: bool,
) -> Result<InstallStepOutput, CommandError> {
let config_lock = config.lock().await;
let config_info = common_prelude(&config_lock)?;
Expand Down Expand Up @@ -261,7 +262,7 @@ pub async fn extract_and_validate_iso(
"--proj-path".to_string(),
data_folder.to_string_lossy().into_owned(),
];
if Path::new(&path_to_iso.clone()).is_dir() {
if via_folder {
args.push("--folder".to_string());
}
// Add new --game argument
Expand Down Expand Up @@ -335,6 +336,7 @@ pub async fn run_decompiler(
game_name: String,
truncate_logs: bool,
use_decomp_settings: bool,
via_folder: bool,
) -> Result<InstallStepOutput, CommandError> {
let config_lock = config.lock().await;
let config_info = common_prelude(&config_lock)?;
Expand Down Expand Up @@ -408,6 +410,10 @@ pub async fn run_decompiler(
args.push(game_name.clone());
}

if via_folder {
args.push("--folder".to_string());
}

// TODO NOW - minimum
if !decomp_config_overrides.is_empty() {
args.push("--decomp-config-override".to_string());
Expand Down Expand Up @@ -483,6 +489,7 @@ pub async fn run_compiler(
path_to_iso: String,
game_name: String,
truncate_logs: bool,
via_folder: bool,
) -> Result<InstallStepOutput, CommandError> {
let config_lock = config.lock().await;
let config_info = common_prelude(&config_lock)?;
Expand Down Expand Up @@ -523,6 +530,10 @@ pub async fn run_compiler(
args.push(game_name.clone());
}

if via_folder {
args.push("--folder".to_string());
}

log::info!("Running compiler with args: {:?}", args);

let mut command = Command::new(exec_info.executable_path);
Expand Down
16 changes: 11 additions & 5 deletions src/components/games/setup/GameSetup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
let resp = await extractAndValidateISO(
sourcePath,
getInternalName(activeGame),
viaFolder,
);
if (!resp.success) {
progressTracker.halt();
Expand All @@ -120,14 +121,20 @@
getInternalName(activeGame),
false,
false,
viaFolder,
);
if (!resp.success) {
progressTracker.halt();
installationError = resp.msg;
return;
}
progressTracker.proceed();
resp = await runCompiler(sourcePath, getInternalName(activeGame));
resp = await runCompiler(
sourcePath,
getInternalName(activeGame),
false,
viaFolder,
);
if (!resp.success) {
progressTracker.halt();
installationError = resp.msg;
Expand Down Expand Up @@ -201,11 +208,10 @@
>{$_("setup_button_installViaISO")}</Button
>
<!-- TODO - disabled for now, needs fixes in the extractor -->
<!-- <Button
<Button
class="border-solid border-2 border-slate-900 rounded bg-slate-900 hover:bg-slate-800 text-sm text-white font-semibold px-5 py-2"
on:click={async () => await install(true)}
>Install via Folder</Button
> -->
on:click={async () => await install(true)}>Install via Folder</Button
>
</div>
</div>
{/if}
9 changes: 6 additions & 3 deletions src/lib/rpc/binaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ export async function updateDataDirectory(
export async function extractAndValidateISO(
pathToIso: string,
gameName: string,
viaFolder: boolean = false,
): Promise<InstallationOutput> {
return await invoke_rpc(
"extract_and_validate_iso",
{ pathToIso, gameName },
{ pathToIso, gameName, viaFolder },
() => failed("Failed to extract and validate ISO"),
);
}
Expand All @@ -34,10 +35,11 @@ export async function runDecompiler(
gameName: string,
truncateLogs: boolean = false,
useDecompSettings: boolean = false,
viaFolder: boolean = false,
): Promise<InstallationOutput> {
return await invoke_rpc(
"run_decompiler",
{ pathToIso, gameName, truncateLogs, useDecompSettings },
{ pathToIso, gameName, truncateLogs, useDecompSettings, viaFolder },
() => failed("Failed to run decompiler"),
);
}
Expand All @@ -46,10 +48,11 @@ export async function runCompiler(
pathToIso: string,
gameName: string,
truncateLogs: boolean = false,
viaFolder: boolean = false,
): Promise<InstallationOutput> {
return await invoke_rpc(
"run_compiler",
{ pathToIso, gameName, truncateLogs },
{ pathToIso, gameName, truncateLogs, viaFolder },
() => failed("Failed to run compiler"),
);
}
Expand Down
Loading