aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-09-16 00:27:45 +0200
committer0neGal <mail@0negal.com>2023-09-16 00:27:45 +0200
commitba64cef4fd5738e5744814bf67dddbd3865132f1 (patch)
tree830d6c98d5d6ceb4e14597e80247711d05b4f2f5
parent2fb192c4cb2d40652f642a54499d3b66d6af884d (diff)
downloadViper-ba64cef4fd5738e5744814bf67dddbd3865132f1.tar.gz
Viper-ba64cef4fd5738e5744814bf67dddbd3865132f1.zip
added button to force kill game
-rw-r--r--src/app/main.js10
-rw-r--r--src/index.js4
-rw-r--r--src/lang/en.json1
-rw-r--r--src/modules/kill.js14
4 files changed, 28 insertions, 1 deletions
diff --git a/src/app/main.js b/src/app/main.js
index 4e30cd0..b7058ce 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -312,6 +312,9 @@ ipcRenderer.on("is-running", (event, running) => {
set_playbtns(lang("general.running"));
is_running = running;
+
+ update.setAttribute("onclick", "kill_game()");
+ update.innerHTML = "(" + lang("ns.menu.force_quit") + ")";
return;
}
@@ -320,9 +323,16 @@ ipcRenderer.on("is-running", (event, running) => {
set_playbtns(lang("gui.launch"));
is_running = running;
+
+ update.setAttribute("onclick", "updateNorthstar()");
+ update.innerHTML = "(" + lang("gui.update.check") + ")";
}
})
+function kill_game() {
+ ipcRenderer.send("kill-game");
+}
+
// Updates the installed mods
ipcRenderer.on("mods", (event, mods_obj) => {
modsobj = mods_obj;
diff --git a/src/index.js b/src/index.js
index 301c622..b8a9f97 100644
--- a/src/index.js
+++ b/src/index.js
@@ -79,8 +79,12 @@ function start() {
process.exit(0)
}
});
+
ipcMain.on("minimize", () => {win.minimize()});
ipcMain.on("relaunch", () => {app.relaunch(); app.exit()});
+ ipcMain.on("kill-game", () => {
+ kill.game();
+ });
// passthrough to renderer from main
ipcMain.on("win-log", (event, ...args) => {send("log", ...args)});
diff --git a/src/lang/en.json b/src/lang/en.json
index b3823d7..beeac75 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -159,6 +159,7 @@
"ns.menu.main": "Northstar Launcher",
"ns.menu.mods": "Mods",
"ns.menu.release": "Release Notes",
+ "ns.menu.force_quit": "Force quit game",
"general.autoupdates.gamerunning": "Game is running, refusing to update Northstar",
"general.mods.enabled": "Enabled mods:",
diff --git a/src/modules/kill.js b/src/modules/kill.js
index e0e93fc..3c93f7b 100644
--- a/src/modules/kill.js
+++ b/src/modules/kill.js
@@ -6,7 +6,7 @@ async function kill(process_name) {
let proc = process_name;
let cmd = (() => {
switch (process.platform) {
- case "linux": return "killall " + proc;
+ case "linux": return "killall -9 " + proc;
case "win32": return "taskkill /IM " + proc + " /F";
}
})();
@@ -31,4 +31,16 @@ kill.origin = async () => {
return false;
}
+kill.game = async () => {
+ let tf2 = await kill("Titanfall2.exe");
+ let northstar = await kill("NorthstarLauncher.exe");
+ let tf2_unpacked = await kill("Titanfall2-unpacked.exe");
+
+ if (tf2 || northstar || tf2_unpacked) {
+ return true;
+ }
+
+ return false;
+}
+
module.exports = kill;