diff options
author | 0neGal <mail@0negal.com> | 2024-01-12 00:19:20 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2024-01-12 00:19:20 +0100 |
commit | ca466e2b7494d51231df2dd81f69e6abd56fe2b1 (patch) | |
tree | 81124439915348cd2c5e6040bbc06c964e39fbc0 | |
parent | 05ea0cc58c0e6d6ebd1fc7cd4a135cefe2ec7dfc (diff) | |
download | Viper-ca466e2b7494d51231df2dd81f69e6abd56fe2b1.tar.gz Viper-ca466e2b7494d51231df2dd81f69e6abd56fe2b1.zip |
deprecate ns_startup_args.txt
Ideally this has no side effects, however, I've not actually tested if
the launching does properly use the launch arguments, due to not having
a Windows device on hand. This will be tested later...
We still attempt to load launch arguments from `ns_startup_args.txt` if
none is set in the settings. However, this may be removed in the future.
-rw-r--r-- | src/app/main.js | 6 | ||||
-rw-r--r-- | src/modules/launch.js | 12 | ||||
-rw-r--r-- | src/modules/settings.js | 9 |
3 files changed, 14 insertions, 13 deletions
diff --git a/src/app/main.js b/src/app/main.js index 3ee95ce..f5fe19f 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -75,9 +75,9 @@ if (fs.existsSync("viper.json")) { // filepath to Northstar's startup args file let args = path.join(settings.gamepath, "ns_startup_args.txt"); - // check file exists - if (fs.existsSync(args)) { - // load file into `settings` + // check file exists, and that no `nsargs` setting was set + if (! settings.nsargs && fs.existsSync(args)) { + // load arguments from file into `settings` settings.nsargs = fs.readFileSync(args, "utf8"); } } diff --git a/src/modules/launch.js b/src/modules/launch.js index 24ea4b2..9238336 100644 --- a/src/modules/launch.js +++ b/src/modules/launch.js @@ -24,15 +24,23 @@ function launch(game_version) { // change current directory to gamepath process.chdir(settings.gamepath); + let launch_args = settings.nsargs || ""; + // launch the requested game version switch(game_version) { case "vanilla": console.info(lang("general.launching"), "Vanilla..."); - exec("Titanfall2.exe", {cwd: settings.gamepath}); + exec("Titanfall2.exe " + launch_args, { + cwd: settings.gamepath + }) + break; default: console.info(lang("general.launching"), "Northstar..."); - exec("NorthstarLauncher.exe", {cwd: settings.gamepath}); + exec("NorthstarLauncher.exe " + launch_args, { + cwd: settings.gamepath + }) + break; } } diff --git a/src/modules/settings.js b/src/modules/settings.js index 5476404..9d036cf 100644 --- a/src/modules/settings.js +++ b/src/modules/settings.js @@ -45,7 +45,7 @@ if (fs.existsSync("viper.json")) { settings.zip = path.join(app.getPath("cache"), "vipertmp/northstar.zip"); let args = path.join(settings.gamepath, "ns_startup_args.txt"); - if (fs.existsSync(args)) { + if (! settings.nsargs && fs.existsSync(args)) { settings.nsargs = fs.readFileSync(args, "utf8"); } } else { @@ -81,13 +81,6 @@ settings.save = (obj = {}, notify_renderer = true) => { // set the settings obj for the main process settings = settings_content; - - // write Northstar's startup arguments file - if (fs.existsSync(settings.gamepath)) { - fs.writeFileSync(path.join( - settings.gamepath, "ns_startup_args.txt" - ), settings.nsargs || "-multiple"); - } if (notify_renderer) { ipcMain.emit("saved-settings", settings_content); |