aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-05-06 23:08:10 +0200
committer0neGal <mail@0negal.com>2023-05-06 23:08:10 +0200
commitcfec36cbdf00b181e6560be15c6b341842894e00 (patch)
tree79695f247fdd886874617adf78015bccc7508bca
parent4e60274bbefa1ddf17cb5b7589b6915254063bbe (diff)
downloadViper-cfec36cbdf00b181e6560be15c6b341842894e00.tar.gz
Viper-cfec36cbdf00b181e6560be15c6b341842894e00.zip
change launch button text if game is running
This should've already been a thing, and was a thing for when the game was currently launching, but this functionality seems to have been broken at some point.
-rw-r--r--src/app/main.js25
-rw-r--r--src/index.js4
-rw-r--r--src/lang/en.json1
3 files changed, 30 insertions, 0 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 72e0e09..1dbff40 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -242,6 +242,31 @@ ipcRenderer.on("confirm", (event, data) => {
ipcRenderer.send("confirm-closed-" + data.id, confirmed);
})
+let is_running = false;
+ipcRenderer.on("is-running", (event, running) => {
+ let set_playbtns = (text) => {
+ let playbtns = document.querySelectorAll(".playBtn");
+ for (let i = 0; i < playbtns.length; i++) {
+ playbtns[i].innerHTML = text;
+ }
+ }
+
+ if (running && is_running != running) {
+ setButtons(false);
+ set_playbtns(lang("general.running"));
+
+ is_running = running;
+ return;
+ }
+
+ if (is_running != running) {
+ setButtons(true);
+ set_playbtns(lang("gui.launch"));
+
+ is_running = running;
+ }
+})
+
// Updates the installed mods
ipcRenderer.on("mods", (event, mods_obj) => {
modsobj = mods_obj;
diff --git a/src/index.js b/src/index.js
index c6179e0..3d2f65b 100644
--- a/src/index.js
+++ b/src/index.js
@@ -156,6 +156,10 @@ function start() {
ipcMain.on("update-now", () => {
autoUpdater.quitAndInstall();
})
+
+ setInterval(async () => {
+ send("is-running", await is_running.game());
+ }, 1000)
}
ipcMain.on("install-mod", () => {
diff --git a/src/lang/en.json b/src/lang/en.json
index 4eabbbd..4f90f32 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -164,6 +164,7 @@
"general.mods.installed": "Installed mods:",
"general.missingpath": "Game location could not be found automatically! Please select it manually!",
"general.notinstalled": "Northstar is not installed!",
+ "general.running": "Running",
"general.launching": "Launching",
"general.invalidconfig": "Your config file is improperly formatted, if it's been manually edited, please validate that everything is typed correctly.\n\nIf you did not manually edit the config file, it is recommended to simply reset the config.\n\nTo reset your config file simply click \"Ok\" below.\n\nMore details:\n",