mirror of
https://github.com/open-goal/launcher.git
synced 2024-10-20 04:57:38 -04:00
setup logic planning
This commit is contained in:
commit
c69e5ee5a0
2
src-tauri/.gitignore
vendored
2
src-tauri/.gitignore
vendored
|
@ -3,4 +3,4 @@
|
|||
/target/
|
||||
WixTools
|
||||
data/
|
||||
bin/*
|
||||
bin
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
<script>
|
||||
import { setInstallStatus } from "$lib/config";
|
||||
import { SUPPORTED_GAME } from "$lib/constants";
|
||||
import { navigate } from "svelte-routing";
|
||||
import { launchGame } from "$lib/launch";
|
||||
|
||||
function onClickConfig() {
|
||||
alert("TODO");
|
||||
}
|
||||
function onClickConfig() {}
|
||||
|
||||
function onClickPlay() {
|
||||
launchGame();
|
||||
}
|
||||
|
||||
async function onClickUninstall() {
|
||||
await setInstallStatus(SUPPORTED_GAME.Jak1, false);
|
||||
navigate("/jak1", { replace: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="launcherControls">
|
||||
<button class="btn lg" on:click={onClickConfig} disabled>Config</button>
|
||||
<button class="btn lg" on:click={onClickPlay}>Play</button>
|
||||
<div class="mt-1">
|
||||
<button class="btn md" on:click={onClickConfig} disabled>Config</button>
|
||||
<button class="btn md" on:click={onClickUninstall}>Uninstall</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script>
|
||||
import { Link, navigate } from "svelte-routing";
|
||||
import { onMount } from "svelte";
|
||||
import { navigate } from "svelte-routing";
|
||||
import { filePrompt } from "$lib/utils/file";
|
||||
import { setInstallStatus } from "$lib/config";
|
||||
import { clearInstallLogs } from "$lib/utils/file";
|
||||
|
@ -24,23 +25,19 @@
|
|||
let currentStatus = {};
|
||||
const setStatus = (status) => (currentStatus = status);
|
||||
|
||||
async function areRequirementsMet() {
|
||||
const res = await Promise.resolve()
|
||||
.then(async () => {
|
||||
setStatus(SETUP_SUCCESS.checkCompatible);
|
||||
await isAVXSupported();
|
||||
setStatus(SETUP_SUCCESS.avxSupported);
|
||||
})
|
||||
.then(async () => {
|
||||
await isOpenGLVersionSupported("4.3");
|
||||
setStatus(SETUP_SUCCESS.openGLSupported);
|
||||
})
|
||||
.catch((err) => {
|
||||
setStatus({ status: err.message, percent: -1 });
|
||||
console.error(err);
|
||||
});
|
||||
let installInProgress = false;
|
||||
|
||||
return res;
|
||||
async function areRequirementsMet() {
|
||||
try {
|
||||
setStatus(SETUP_SUCCESS.checkCompatible);
|
||||
await isAVXSupported();
|
||||
setStatus(SETUP_SUCCESS.avxSupported);
|
||||
await isOpenGLVersionSupported("4.3");
|
||||
setStatus(SETUP_SUCCESS.openGLSupported);
|
||||
} catch (err) {
|
||||
// TODO - if they aren't met, it would be nice to display which ones aren't
|
||||
setStatus({ status: err.message, percent: -1 });
|
||||
}
|
||||
}
|
||||
|
||||
async function installProcess() {
|
||||
|
@ -74,6 +71,14 @@
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
// TODO - use (requirements met) conditional rendering below
|
||||
// if requirements met: show setup button
|
||||
// else: display which requirement isn't met (AVX/OpenGL/Both)
|
||||
// await areRequirementsMet();
|
||||
// await installProcess();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="content">
|
||||
|
@ -85,8 +90,5 @@
|
|||
Setup
|
||||
</button>
|
||||
{/if}
|
||||
<!-- <Link to="/jak1">
|
||||
<button class="btn">Cancel</button>
|
||||
</Link> -->
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -67,6 +67,10 @@ body {
|
|||
margin: 15px 0;
|
||||
}
|
||||
|
||||
.mt-1 {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.btn {
|
||||
text-align: center;
|
||||
background: linear-gradient(to top, #f3b33f, #fbec4f);
|
||||
|
@ -82,6 +86,13 @@ body {
|
|||
color: black;
|
||||
}
|
||||
|
||||
.btn.md {
|
||||
min-width: 100px;
|
||||
padding: 10px 0;
|
||||
font-weight: bold;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.btn.lg {
|
||||
min-width: 200px;
|
||||
padding: 10px 0;
|
||||
|
@ -89,10 +100,6 @@ body {
|
|||
font-size: x-large;
|
||||
}
|
||||
|
||||
.btn:not(:last-child) {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
.btn:enabled:active {
|
||||
transform: scale(0.9);
|
||||
box-shadow: 0px 0px 20px rgba(0, 0, 0, 1);
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
import { Command } from "@tauri-apps/api/shell";
|
||||
import { resourceDir } from "@tauri-apps/api/path";
|
||||
|
||||
// TODO - is this set to `production` properly in release mode?
|
||||
function isInDebugMode() {
|
||||
return process.env.NODE_ENV === "development";
|
||||
}
|
||||
|
||||
// TODO - this is kind of a total hack - likely windows only currently
|
||||
// NOTE - this is kind of a total hack - likely windows only currently
|
||||
let debugPath;
|
||||
if (isInDebugMode()) {
|
||||
let path = await resourceDir();
|
||||
debugPath = path.split("launcher")[0].split("?\\")[1];
|
||||
// debugPath += "launcher\\bundle-test\\data";
|
||||
debugPath += "launcher\\src-tauri\\data";
|
||||
}
|
||||
|
||||
|
@ -29,7 +27,5 @@ export async function launchGame() {
|
|||
cwd: "bin",
|
||||
});
|
||||
}
|
||||
let output = await command.execute();
|
||||
console.log(output.stdout);
|
||||
console.log(output.stderr);
|
||||
command.spawn();
|
||||
}
|
||||
|
|
|
@ -11,10 +11,9 @@ export function isInDebugMode() {
|
|||
}
|
||||
|
||||
if (isInDebugMode()) {
|
||||
// TODO - this is kind of a total hack
|
||||
// NOTE - this is kind of a total hack
|
||||
let path = await resourceDir();
|
||||
debugPath = path.split("launcher")[0].split("?\\")[1];
|
||||
// debugPath += "launcher\\bundle-test\\data";
|
||||
debugPath += "launcher\\src-tauri\\data\\";
|
||||
sidecarOptions = { cwd: "bin" };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue