From 5629cd96c0cd32de31b5b6444e7c83d8cb5df19c Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 1 Jun 2022 20:33:20 -0400 Subject: [PATCH 1/4] add a button to mark a game as uninstalled --- src/components/games/Jak1Main.svelte | 18 ++++++++++++++---- src/components/setup/Jak1Setup.svelte | 5 ++--- src/css/style.css | 15 +++++++++++---- src/lib/launch.js | 4 +--- src/lib/setup.js | 3 +-- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/components/games/Jak1Main.svelte b/src/components/games/Jak1Main.svelte index 850309a..b700bf3 100644 --- a/src/components/games/Jak1Main.svelte +++ b/src/components/games/Jak1Main.svelte @@ -1,15 +1,25 @@
- +
+ + +
diff --git a/src/components/setup/Jak1Setup.svelte b/src/components/setup/Jak1Setup.svelte index 038e678..38168e0 100644 --- a/src/components/setup/Jak1Setup.svelte +++ b/src/components/setup/Jak1Setup.svelte @@ -79,11 +79,10 @@ } onMount(async () => { - // TODO - app crashes after checking requirements - // in the future i want to save the requirements met in the settings.json store file so it doesnt need to be run every time + // TODO - in the future i want to save the requirements met in the settings.json store file so it doesnt need to be run every time // then the requirements met function can check against the store data to avoid running the external bins each time // gotta revise this in the future because this will still run the install process even if the user doesnt meet the requirements - // await areRequirementsMet(); + await areRequirementsMet(); await installProcess(); }); diff --git a/src/css/style.css b/src/css/style.css index 90a8300..330259c 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -159,6 +159,10 @@ body { margin: 15px 0; } +.mt-1 { + margin-top: 1em; +} + .btn { text-align: center; background: linear-gradient(to top, #f3b33f, #fbec4f); @@ -174,6 +178,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; @@ -181,10 +192,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); diff --git a/src/lib/launch.js b/src/lib/launch.js index cc141f4..277e69b 100644 --- a/src/lib/launch.js +++ b/src/lib/launch.js @@ -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"; } diff --git a/src/lib/setup.js b/src/lib/setup.js index 2feb754..8d8122d 100644 --- a/src/lib/setup.js +++ b/src/lib/setup.js @@ -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" }; } From 888807c97481c69b4b628b50f5c078028c3b713d Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 1 Jun 2022 21:21:36 -0400 Subject: [PATCH 2/4] tauri: fix .gitignore so changes in `/src-tauri/bin` dont reload the app --- src-tauri/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/.gitignore b/src-tauri/.gitignore index 07ec344..4acfefa 100644 --- a/src-tauri/.gitignore +++ b/src-tauri/.gitignore @@ -3,4 +3,4 @@ /target/ WixTools data/ -bin/* +bin From d18ab4e1eb80716aada5c4c685246460a5d902b4 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 1 Jun 2022 22:27:54 -0400 Subject: [PATCH 3/4] setup: cleanup requirements checking --- src/components/setup/Jak1Setup.svelte | 28 +++++++--------- src/components/setup/Progress.svelte | 48 ++++++++++++++++++++++++++- src/components/setup/progress.css | 43 ------------------------ src/lib/launch.js | 4 +-- 4 files changed, 60 insertions(+), 63 deletions(-) delete mode 100644 src/components/setup/progress.css diff --git a/src/components/setup/Jak1Setup.svelte b/src/components/setup/Jak1Setup.svelte index 38168e0..9e09530 100644 --- a/src/components/setup/Jak1Setup.svelte +++ b/src/components/setup/Jak1Setup.svelte @@ -26,23 +26,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() { diff --git a/src/components/setup/Progress.svelte b/src/components/setup/Progress.svelte index 8d31774..2d511a1 100644 --- a/src/components/setup/Progress.svelte +++ b/src/components/setup/Progress.svelte @@ -1,5 +1,4 @@ @@ -17,3 +16,50 @@ {/if} + + diff --git a/src/components/setup/progress.css b/src/components/setup/progress.css deleted file mode 100644 index 6dabf6b..0000000 --- a/src/components/setup/progress.css +++ /dev/null @@ -1,43 +0,0 @@ -.progress { - display: flex; - overflow: hidden; - height: 30px; - background-color: #ecf0f1; - width: 75%; - margin: 20px auto; -} - -.progress-bar { - overflow: hidden; - text-align: center; - background-color: dodgerblue; -} - -.progress-bar-animated { - position: relative; -} - -.progress-bar-animated::before { - content: ""; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.5)); - transform: translateX(-100%); - animation: progress-bar-shine 2s infinite; -} - -@keyframes progress-bar-shine { - to { - transform: translateX(0); - opacity: 0.1; - } -} - -.status { - justify-content: center; - align-items: center; - text-align: center; -} diff --git a/src/lib/launch.js b/src/lib/launch.js index 277e69b..bab86a7 100644 --- a/src/lib/launch.js +++ b/src/lib/launch.js @@ -27,7 +27,5 @@ export async function launchGame() { cwd: "bin", }); } - let output = await command.execute(); - console.log(output.stdout); - console.log(output.stderr); + command.spawn(); } From 8c3d65171a214b7e946e9f79e28d70b2b5571cdf Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 1 Jun 2022 22:28:13 -0400 Subject: [PATCH 4/4] wire up uninstall button properly --- src/components/games/Jak1Main.svelte | 4 +-- src/components/setup/Progress.svelte | 48 +--------------------------- src/components/setup/progress.css | 43 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 49 deletions(-) create mode 100644 src/components/setup/progress.css diff --git a/src/components/games/Jak1Main.svelte b/src/components/games/Jak1Main.svelte index b700bf3..4ac6f73 100644 --- a/src/components/games/Jak1Main.svelte +++ b/src/components/games/Jak1Main.svelte @@ -1,7 +1,7 @@ diff --git a/src/components/setup/Progress.svelte b/src/components/setup/Progress.svelte index 2d511a1..8d31774 100644 --- a/src/components/setup/Progress.svelte +++ b/src/components/setup/Progress.svelte @@ -1,4 +1,5 @@ @@ -16,50 +17,3 @@ {/if} - - diff --git a/src/components/setup/progress.css b/src/components/setup/progress.css new file mode 100644 index 0000000..6dabf6b --- /dev/null +++ b/src/components/setup/progress.css @@ -0,0 +1,43 @@ +.progress { + display: flex; + overflow: hidden; + height: 30px; + background-color: #ecf0f1; + width: 75%; + margin: 20px auto; +} + +.progress-bar { + overflow: hidden; + text-align: center; + background-color: dodgerblue; +} + +.progress-bar-animated { + position: relative; +} + +.progress-bar-animated::before { + content: ""; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.5)); + transform: translateX(-100%); + animation: progress-bar-shine 2s infinite; +} + +@keyframes progress-bar-shine { + to { + transform: translateX(0); + opacity: 0.1; + } +} + +.status { + justify-content: center; + align-items: center; + text-align: center; +}