frontend: support folder installs but disabled due to issue upstream

This commit is contained in:
Tyler Wilding 2023-02-19 13:44:30 -05:00
parent 4435296c42
commit d2a91a4f46
No known key found for this signature in database
GPG key ID: 77CB07796494137E
7 changed files with 30 additions and 125 deletions

View file

@ -21,14 +21,18 @@ pub async fn extract_and_validate_iso(
let binary_dir = install_path.join("versions/official/v0.1.32/");
let data_folder = install_path.join("active/jak1/data");
let executable_location = binary_dir.join("extractor.exe");
let output = Command::new(&executable_location)
.args([
path_to_iso,
let mut args = vec![
path_to_iso.clone(),
"--extract".to_string(),
"--validate".to_string(),
"--proj-path".to_string(),
data_folder.to_string_lossy().into_owned(),
])
];
if Path::new(&path_to_iso.clone()).is_dir() {
args.push("--folder".to_string());
}
let output = Command::new(&executable_location)
.args(args)
.current_dir(binary_dir)
.output()
.expect("failed to execute process");

View file

@ -7,7 +7,6 @@
import Sidebar from "./components/sidebar/Sidebar.svelte";
import Background from "./components/background/Background.svelte";
import { appWindow } from "@tauri-apps/api/window";
import { isInstalling } from "./lib/stores/AppStore";
import { log } from "$lib/utils/log";
import Header from "./components/header/Header.svelte";
import Faq from "./routes/FAQ.svelte";
@ -24,15 +23,7 @@
// - need to make an issue
// For now, we'll just handle all close events ourselves
await appWindow.listen("tauri://close-requested", async () => {
if ($isInstalling) {
const confirmed = await confirm(
"Installation still in progress, are you sure you want to exit?"
);
if (confirmed) {
await appWindow.close();
}
return;
}
// TODO - confirm during an install
await appWindow.close();
});
});

View file

@ -96,11 +96,14 @@
<div class="flex flex-row gap-2">
<Button
btnClass="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 installViaISO()}>Install via ISO</Button
><Button
btnClass="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"
>Install via Folder</Button
on:click={async () => await install(false)}>Install via ISO</Button
>
<!-- TODO - disabled for now, needs fixes in the extractor -->
<!-- <Button
btnClass="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
> -->
</div>
</div>
{/if}

View file

@ -1,12 +0,0 @@
<script>
import { Alert } from "flowbite-svelte";
</script>
<Alert dismissable color="red" rounded={false} accent>
<span class="font-medium text-2xl">Notice:</span>
<ul slot="extra" class="mt-0 ml-8 list-disc list-inside text-lg">
<li>Game installed with a previous version of OpenGOAL</li>
<li>The game must be updated before you can proceed</li>
<li>Save files and settings will not be modified</li>
</ul>
</Alert>

View file

@ -1,50 +0,0 @@
import { Command } from "@tauri-apps/api/shell";
import { appDir, resourceDir } from "@tauri-apps/api/path";
function isInDebugMode() {
return process.env.NODE_ENV === "development";
}
// NOTE - this is kind of a total hack - likely windows only currently
let debugPath: string;
if (isInDebugMode()) {
let path = await resourceDir();
debugPath = path.split("launcher")[0].split("?\\")[1];
debugPath += "launcher\\src-tauri\\data";
}
export async function launchGame() {
let command: Command;
const appDirPath = await appDir();
command = Command.sidecar("bin/gk", [
"-boot",
"-fakeiso",
"-proj-path",
`${appDirPath}data`,
]);
command.spawn();
}
export async function openREPL() {
const appDirPath = await appDir();
let command: Command = Command.sidecar("bin/goalc", [
"--startup-cmd",
"(mi)",
"--proj-path",
`${appDirPath}data`,
]);
command.spawn();
}
export async function launchGameInDebug() {
let command: Command;
const appDirPath = await appDir();
command = Command.sidecar("bin/gk", [
"-boot",
"-fakeiso",
"-debug",
"-proj-path",
`${appDirPath}data`,
]);
command.spawn();
}

View file

@ -1,35 +1,17 @@
import { Command } from "@tauri-apps/api/shell";
import { appDir, join } from "@tauri-apps/api/path";
import { os } from "@tauri-apps/api";
import { getHighestSimd } from "$lib/rpc/commands";
import { isInstalling } from "../stores/AppStore";
import { getInternalName, SupportedGame } from "$lib/constants";
import { resolveErrorCode } from "./setup_errors";
import { installLog, log } from "$lib/utils/log";
import { removeDir } from "@tauri-apps/api/fs";
export interface InstallationStatus {}
export async function isAVXSupported() {
const highestSIMD = await getHighestSimd();
if (highestSIMD === undefined) {
return true;
}
if (highestSIMD.toLowerCase().startsWith("avx")) {
return true;
}
return false;
}
/**
* @param {String} version
* @returns {Promise<Boolean>}
*/
// We'll leave this check here since it's the only thing still using a sidecar
//
// TODO - longterm, we should build this validation checking into the `extractor`
// because other things like Vulkan don't have a glewinfo equivalent
export async function isOpenGLVersionSupported(
version: string
): Promise<boolean> {
if ((await os.platform()) === "darwin") {
// TODO - log!
console.log("[OG]: MacOS isn't supported, OpenGL won't work here!");
return false;
}
// Otherwise, query for the version
@ -47,23 +29,11 @@ export async function isOpenGLVersionSupported(
return false;
}
export async function checkRequirements(): Promise<void> {
try {
const isAVX = await isAVXSupported();
const isOpenGL = await isOpenGLVersionSupported("4.3");
console.log(`avx - ${isAVX} opengl - ${isOpenGL}`);
// TODO - fix
// await launcherConfig.setRequirementsMet(isAVX, isOpenGL);
} catch (err) {
// await launcherConfig.setRequirementsMet(false, false);
}
}
async function handleErrorCode(code: number, stepName: string) {
isInstalling.update(() => false);
const explaination = await resolveErrorCode(code);
if (explaination === undefined) {
throw new Error(`${stepName} exited with unexpected code: ${code}`);
}
throw new Error(explaination);
// isInstalling.update(() => false);
// const explaination = await resolveErrorCode(code);
// if (explaination === undefined) {
// throw new Error(`${stepName} exited with unexpected code: ${code}`);
// }
// throw new Error(explaination);
}

View file

@ -1,6 +1,5 @@
import { open } from "@tauri-apps/api/dialog";
import { readDir, readTextFile } from "@tauri-apps/api/fs";
import { title } from "process";
export async function fileExists(path: string): Promise<boolean> {
try {