mirror of
https://github.com/open-goal/launcher.git
synced 2024-10-20 04:57:38 -04:00
setup: display errors during installation
This commit is contained in:
parent
63f582e650
commit
480dca55ed
|
@ -247,6 +247,7 @@ body {
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
padding: 2em;
|
padding: 2em;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logContainer {
|
.logContainer {
|
||||||
|
@ -290,3 +291,15 @@ ul.no-decoration {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding-left: 2em;
|
padding-left: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-row {
|
||||||
|
background-color: #782323;
|
||||||
|
padding: 1em;
|
||||||
|
border-radius: 0.25em;
|
||||||
|
margin-top: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-row * {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ export async function isOpenGLVersionSupported(version) {
|
||||||
* @param {String} filePath
|
* @param {String} filePath
|
||||||
* @returns {Promise<ChildProcess>}
|
* @returns {Promise<ChildProcess>}
|
||||||
*/
|
*/
|
||||||
export async function extractISO(filePath) {
|
export async function extractAndValidateISO(filePath) {
|
||||||
let command;
|
let command;
|
||||||
if (isInDebugMode()) {
|
if (isInDebugMode()) {
|
||||||
command = Command.sidecar(
|
command = Command.sidecar(
|
||||||
|
@ -74,28 +74,7 @@ export async function extractISO(filePath) {
|
||||||
{ cwd: "bin" }
|
{ cwd: "bin" }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
command = Command.sidecar("bin/extractor", [filePath, "--extract"], {
|
command = Command.sidecar("bin/extractor", [filePath, "--extract", "--validate"], {
|
||||||
cwd: "bin",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return await command.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {String} filePath
|
|
||||||
* @returns {Promise<ChildProcess>}
|
|
||||||
*/
|
|
||||||
export async function validateGameData(filePath) {
|
|
||||||
let command;
|
|
||||||
if (isInDebugMode()) {
|
|
||||||
command = Command.sidecar(
|
|
||||||
"bin/extractor",
|
|
||||||
[filePath, "--validate", "--proj-path", debugPath],
|
|
||||||
{ cwd: "bin" }
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
command = Command.sidecar("bin/extractor", [filePath, "--validate"], {
|
|
||||||
cwd: "bin",
|
cwd: "bin",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
import {
|
import {
|
||||||
compileGame,
|
compileGame,
|
||||||
decompileGameData,
|
decompileGameData,
|
||||||
extractISO,
|
extractAndValidateISO,
|
||||||
validateGameData,
|
|
||||||
isAVXSupported,
|
isAVXSupported,
|
||||||
isOpenGLVersionSupported,
|
isOpenGLVersionSupported,
|
||||||
} from "/src/lib/setup";
|
} from "/src/lib/setup";
|
||||||
|
@ -24,7 +23,7 @@
|
||||||
let requirementChecks = [
|
let requirementChecks = [
|
||||||
{
|
{
|
||||||
status: RequirementStatus.Checking,
|
status: RequirementStatus.Checking,
|
||||||
text: `CPU Supports <a href="https://en.wikipedia.org/wiki/Advanced_Vector_Extensions"><strong>AVX or AVX2</strong></a>`,
|
text: `CPU Supports <a href="https://en.wikipedia.org/wiki/Advanced_Vector_Extensions" target="_blank"><strong>AVX or AVX2</strong></a>`,
|
||||||
check: async () => await isAVXSupported(),
|
check: async () => await isAVXSupported(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -38,13 +37,7 @@
|
||||||
let installSteps = [
|
let installSteps = [
|
||||||
{
|
{
|
||||||
status: InstallationStatus.Pending,
|
status: InstallationStatus.Pending,
|
||||||
text: "Extracting ISO",
|
text: "Extracting and Validate ISO",
|
||||||
logs: "",
|
|
||||||
errorLogs: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
status: InstallationStatus.Pending,
|
|
||||||
text: "Validating Game Data",
|
|
||||||
logs: "",
|
logs: "",
|
||||||
errorLogs: "",
|
errorLogs: "",
|
||||||
},
|
},
|
||||||
|
@ -62,6 +55,8 @@
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
let installErrors = [];
|
||||||
|
|
||||||
// TODO - move this to the enum
|
// TODO - move this to the enum
|
||||||
function statusIndicator(status) {
|
function statusIndicator(status) {
|
||||||
if (
|
if (
|
||||||
|
@ -98,12 +93,71 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleError(output) {
|
||||||
|
if (output.code === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (output.code) {
|
||||||
|
case 4000:
|
||||||
|
installErrors = [
|
||||||
|
...installErrors,
|
||||||
|
{
|
||||||
|
title: `can't locate ELF in ISO's contents`,
|
||||||
|
description: "unable to determine the version of the game",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 4001:
|
||||||
|
installErrors = [
|
||||||
|
...installErrors,
|
||||||
|
{
|
||||||
|
title: `Unsupported serial`,
|
||||||
|
description:
|
||||||
|
"ISO containing an unsupported game serial or version was provided",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 4002:
|
||||||
|
case 4010:
|
||||||
|
case 4011:
|
||||||
|
installErrors = [
|
||||||
|
...installErrors,
|
||||||
|
{
|
||||||
|
title: `Unsupported game version`,
|
||||||
|
description:
|
||||||
|
"ISO contains files that are for an unsupported version, were modified from the original, or is an incomplete dump",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
case 4020:
|
||||||
|
installErrors = [
|
||||||
|
...installErrors,
|
||||||
|
{
|
||||||
|
title: `Unexpected Extraction Result`,
|
||||||
|
description:
|
||||||
|
"The extracted ISO's contents were not as expected, installation cannot proceed",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
installErrors = [
|
||||||
|
...installErrors,
|
||||||
|
{
|
||||||
|
title: `Unexpected Error Code ${output.code}`,
|
||||||
|
description:
|
||||||
|
"An unexpected error occurred during installation, check logs",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function finishStep(output) {
|
function finishStep(output) {
|
||||||
appendLogs(output);
|
appendLogs(output);
|
||||||
installSteps[currStep].status =
|
installSteps[currStep].status =
|
||||||
output.code === 0
|
output.code === 0
|
||||||
? InstallationStatus.Success
|
? InstallationStatus.Success
|
||||||
: InstallationStatus.Failed;
|
: InstallationStatus.Failed;
|
||||||
|
handleError(output);
|
||||||
currStep++;
|
currStep++;
|
||||||
if (currStep < installSteps.length) {
|
if (currStep < installSteps.length) {
|
||||||
installSteps[currStep].status = InstallationStatus.InProgress;
|
installSteps[currStep].status = InstallationStatus.InProgress;
|
||||||
|
@ -128,28 +182,23 @@
|
||||||
await clearInstallLogs(SupportedGame.Jak1);
|
await clearInstallLogs(SupportedGame.Jak1);
|
||||||
setupInProgress = true;
|
setupInProgress = true;
|
||||||
installSteps[currStep].status = InstallationStatus.InProgress;
|
installSteps[currStep].status = InstallationStatus.InProgress;
|
||||||
let output = await extractISO(isoPath);
|
let output = await extractAndValidateISO(isoPath);
|
||||||
finishStep(output);
|
finishStep(output);
|
||||||
if (output.code === 0) {
|
// if (output.code === 0) {
|
||||||
console.log("[OpenGOAL]: Extraction Completed");
|
// console.log("[OpenGOAL]: Extraction and Validation Completed");
|
||||||
output = await validateGameData(isoPath);
|
// output = await decompileGameData(isoPath);
|
||||||
finishStep(output);
|
// finishStep(output);
|
||||||
}
|
// }
|
||||||
if (output.code === 0) {
|
// if (output.code === 0) {
|
||||||
console.log("[OpenGOAL]: Validation Completed");
|
// console.log("[OpenGOAL]: Decompilation Completed");
|
||||||
output = await decompileGameData(isoPath);
|
// output = await compileGame(isoPath);
|
||||||
finishStep(output);
|
// finishStep(output);
|
||||||
}
|
// }
|
||||||
if (output.code === 0) {
|
// if (output.code === 0) {
|
||||||
console.log("[OpenGOAL]: Decompilation Completed");
|
// console.log("[OpenGOAL]: Compilation Completed");
|
||||||
output = await compileGame(isoPath);
|
// await setInstallStatus(SupportedGame.Jak1, true);
|
||||||
finishStep(output);
|
// navigate("/jak1", { replace: true });
|
||||||
}
|
// }
|
||||||
if (output.code === 0) {
|
|
||||||
console.log("[OpenGOAL]: Compilation Completed");
|
|
||||||
await setInstallStatus(SupportedGame.Jak1, true);
|
|
||||||
navigate("/jak1", { replace: true });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
@ -186,7 +235,9 @@
|
||||||
{#if areRequirementsMet(requirementChecks)}
|
{#if areRequirementsMet(requirementChecks)}
|
||||||
<p>Browse for your ISO - Obtained by dumping your own legitimate copy</p>
|
<p>Browse for your ISO - Obtained by dumping your own legitimate copy</p>
|
||||||
<div>
|
<div>
|
||||||
<button class="btn" disabled={setupInProgress} on:click={onClickBrowse}>Browse for ISO</button>
|
<button class="btn" disabled={setupInProgress} on:click={onClickBrowse}
|
||||||
|
>Browse for ISO</button
|
||||||
|
>
|
||||||
{#if isoPath}
|
{#if isoPath}
|
||||||
{isoPath}
|
{isoPath}
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -212,6 +263,12 @@
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
{#each installErrors as err}
|
||||||
|
<div class="error-row">
|
||||||
|
<h3>❌ {err.title}</h3>
|
||||||
|
<p>{err.description}</p>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<details>
|
<details>
|
||||||
<summary>Installation Logs</summary>
|
<summary>Installation Logs</summary>
|
||||||
|
|
Loading…
Reference in a new issue