From 59aa33289cebd63432904ac69fa7d9f4f2bc1b9c Mon Sep 17 00:00:00 2001 From: 0neGal Date: Tue, 7 Jun 2022 17:23:33 +0200 Subject: minor changes Mostly syntax, but also a few fixes with how the settings system work, and also a change in localization strings. --- src/app/main.js | 1 + src/index.js | 7 +++---- src/lang/en.json | 2 +- src/utils.js | 31 ++++++++++++++++++------------- 4 files changed, 23 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/app/main.js b/src/app/main.js index 647e5cd..9fb3191 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -14,6 +14,7 @@ var settings = { autolang: true, forcedlang: "en", autoupdate: true, + originkill: false, zip: "/northstar.zip", lang: navigator.language, excludes: [ diff --git a/src/index.js b/src/index.js index a566b57..2c03529 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,6 @@ const { app, ipcMain, BrowserWindow, dialog } = require("electron"); const utils = require("./utils"); const cli = require("./cli"); const requests = require("./extras/requests"); -const { settings } = require("./utils"); var log = console.log; @@ -48,7 +47,7 @@ function start() { }; send = win.send; ipcMain.on("exit", () => { - if (settings.originkill) { + if (utils.settings.originkill) { utils.isOriginRunning().then((running) => { if (running) { utils.killOrigin().then(process.exit(0)) @@ -60,8 +59,8 @@ function start() { process.exit(0) } }); - ipcMain.on("minimize", () => { win.minimize() }); - ipcMain.on("relaunch", () => { app.relaunch(); app.exit() }); + ipcMain.on("minimize", () => {win.minimize()}); + ipcMain.on("relaunch", () => {app.relaunch(); app.exit()}); // 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 3ae6ff1..72711b8 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -105,7 +105,7 @@ "gui.settings.excludes.title": "Retain files on update", "gui.settings.excludes.desc": "When Northstar is updated, files specified here will not be overwritten by files from the new Northstar update, unless you know what you're changing, you should probably not change anything here. Each file is separated with a space.", "gui.settings.originkill.title": "Automatically quit Origin", - "gui.settings.originkill.desc": "When Viper exits, automatically quit Origin client too. Mirrors behavior of launching the game through Steam.", + "gui.settings.originkill.desc": "When Viper exits, automatically quit Origin client too.", "gui.update.downloading": "Downloading...", "gui.update.extracting": "Extracting update...", diff --git a/src/utils.js b/src/utils.js index 2fea3ea..6114ef1 100644 --- a/src/utils.js +++ b/src/utils.js @@ -29,6 +29,7 @@ var settings = { autolang: true, forcedlang: "en", autoupdate: true, + originkill: false, nsargs: "-multiple", zip: "/northstar.zip", @@ -37,9 +38,7 @@ var settings = { excludes: [ "ns_startup_args.txt", "ns_startup_args_dedi.txt" - ], - - originkill: false + ] } // Logs into the dev tools of the renderer @@ -103,7 +102,7 @@ async function isGameRunning() { }); } -//Check if origin client is running +// checks if any origin processes are running async function isOriginRunning() { return new Promise(resolve => { let procs = ["Origin.exe", "OriginClientService.exe"]; @@ -126,7 +125,7 @@ async function isOriginRunning() { }); } -//Kill origin client +// kill origin processes async function killOrigin() { return new Promise(resolve => { let proc = "Origin.exe"; //I'm pretty sure we only have to kill this one @@ -138,7 +137,7 @@ async function killOrigin() { })(); exec(cmd, (err, stdout) => { - //just try and fail silently if we don't find it w/e + // just try and fail silently if we don't find it w/e resolve(true); }); }); @@ -879,21 +878,27 @@ setInterval(() => { module.exports = { mods, - lang, winLog, - launch, + update, - setpath, updatevp, - settings, - saveSettings, getNSVersion, getTF2Version, + handleNorthstarUpdating, + + launch, + killOrigin, isGameRunning, isOriginRunning, - killOrigin, + + + settings, + saveSettings, + + setpath, gamepathExists, - handleNorthstarUpdating, + + lang, setlang: (lang) => { settings.lang = lang; saveSettings(); -- cgit v1.2.3