aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/app/main.js14
-rw-r--r--src/index.js3
-rw-r--r--src/lang/en.json1
-rw-r--r--src/utils.js8
4 files changed, 25 insertions, 1 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 8894d3f..4918777 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -91,6 +91,20 @@ function setButtons(state) {
}
ipcRenderer.on("setbuttons", (event, state) => {setButtons(state)})
+
+ipcRenderer.on("gamestate", (event, state) => {
+ setButtons(! state);
+
+ let string = lang("gui.launch");
+ if (state) {
+ string = lang("gui.running");
+ }
+
+ let btns = document.querySelectorAll(".playBtnContainer .playBtn");
+ btns[0].innerHTML = string;
+ btns[1].innerHTML = string;
+})
+
ipcRenderer.on("gamepathlost", (event, state) => {
page(0);
setButtons(false);
diff --git a/src/index.js b/src/index.js
index b38b65d..d854ce8 100644
--- a/src/index.js
+++ b/src/index.js
@@ -53,6 +53,9 @@ function start() {
ipcMain.on("installedmod", (event, modname) => {win.webContents.send("installedmod", modname)});
ipcMain.on("guigetmods", (event, ...args) => {win.webContents.send("mods", utils.mods.list())});
+ ipcMain.on("gamestarted", (event) => {win.webContents.send("gamestate", true)});
+ ipcMain.on("gamestopped", (event) => {win.webContents.send("gamestate", false)});
+
let gamepathlost = false;
ipcMain.on("gamepathlost", (event, ...args) => {
if (! gamepathlost) {
diff --git a/src/lang/en.json b/src/lang/en.json
index 92aab31..9f2ac40 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -116,6 +116,7 @@
"gui.nsupdate.gaming.body": "An update for Northstar is available.\nYou can force its installation after closing the game.",
"gui.launch": "Launch",
+ "gui.running": "Running",
"gui.launchvanilla": "Vanilla",
"gui.launchnorthstar": "Northstar",
"gui.installnorthstar": "Install",
diff --git a/src/utils.js b/src/utils.js
index bb5b982..1b880bb 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -835,7 +835,7 @@ const mods = {
}
};
-setInterval(() => {
+setInterval(async () => {
if (gamepathExists()) {
ipcMain.emit("guigetmods");
} else {
@@ -845,6 +845,12 @@ setInterval(() => {
}
}
}
+
+ if (await isGameRunning()) {
+ ipcMain.emit("gamestarted");
+ } else {
+ ipcMain.emit("gamestopped");
+ }
}, 1500)
module.exports = {