diff options
author | 0neGal <mail@0negal.com> | 2021-12-30 19:19:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-30 19:19:16 +0100 |
commit | d2e72c40b251373fd662cab426fc04dcac1eb65a (patch) | |
tree | 6a85ad219a06c9814f00cd15d96d1171b997f623 /src/app/main.js | |
parent | 4a0ce8d918007a3ed39bd15c28fc1c7931080271 (diff) | |
parent | 9d8ceea77b6f172f0c055c0061bc07e6f45c0d2d (diff) | |
download | Viper-d2e72c40b251373fd662cab426fc04dcac1eb65a.tar.gz Viper-d2e72c40b251373fd662cab426fc04dcac1eb65a.zip |
Merge branch 'main' into feat/version-indicator
Diffstat (limited to 'src/app/main.js')
-rw-r--r-- | src/app/main.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/app/main.js b/src/app/main.js index 59b28f2..a33ef72 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -20,7 +20,7 @@ if (fs.existsSync("viper.json")) { settings = {...settings, ...JSON.parse(fs.readFileSync("viper.json", "utf8"))}; settings.zip = path.join(settings.gamepath + "/northstar.zip"); } else { - alert(lang("gui.missinggamepath")); + alert(lang("general.missinggamepath")); setpath(); } @@ -31,15 +31,32 @@ function setpath() {ipcRenderer.send("setpath")} function launch() {ipcRenderer.send("launch")} function launchVanilla() {ipcRenderer.send("launchVanilla")} +function log(msg) { + console.log(msg); + welcome.innerHTML = msg; +} + +function setButtons(state) { + let buttons = document.querySelectorAll("button"); + + for (let i = 0; i < buttons.length; i++) { + buttons[i].disabled = !state; + } +} + +ipcRenderer.on("ns-updated", () => {setButtons(true)}) +ipcRenderer.on("ns-updating", () => {setButtons(false)}) + ipcRenderer.on("newpath", (event, newpath) => { settings.gamepath = newpath; }) +ipcRenderer.on("log", (event, msg) => {log(msg)}) + ipcRenderer.on("version", (event, versions) => { vpversion.innerText = lang("gui.versions.viper") + ": " + versions.vp; nsversion.innerText = lang("gui.versions.northstar") + ": " + versions.ns; -}); -ipcRenderer.send("getversion"); +}); ipcRenderer.send("getversion"); setlang(); setInterval(() => { |