diff options
author | 0neGal <mail@0negal.com> | 2022-04-18 20:14:48 +0200 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-04-18 20:14:48 +0200 |
commit | 15fa312110fc94dcfbef58d1b0bd5f58a4e5f431 (patch) | |
tree | 5c79179d97d21d9d834286089a5b90f50d94e09d /src | |
parent | 9ae7cc35744b3aa032dc20efeb1b4df463ceb7ab (diff) | |
download | Viper-15fa312110fc94dcfbef58d1b0bd5f58a4e5f431.tar.gz Viper-15fa312110fc94dcfbef58d1b0bd5f58a4e5f431.zip |
first draft of Linux launch support
This only has GUI elements, and slight changes to the utils.launch()
function, but none that would result in anything working yet.
Diffstat (limited to 'src')
-rw-r--r-- | src/app/index.html | 23 | ||||
-rw-r--r-- | src/app/main.js | 1 | ||||
-rw-r--r-- | src/app/settings.js | 7 | ||||
-rw-r--r-- | src/lang/en.json | 5 | ||||
-rw-r--r-- | src/lang/es.json | 1 | ||||
-rw-r--r-- | src/lang/fr.json | 1 | ||||
-rw-r--r-- | src/utils.js | 25 |
7 files changed, 56 insertions, 7 deletions
diff --git a/src/app/index.html b/src/app/index.html index 4b3b79f..794e209 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -48,6 +48,29 @@ <input> </div> </div> + <h2 class="linuxopt">%%gui.settings.title.linux%%</h2> + <div class="option linuxopt" name="wineprefix"> + <div class="text"> + %%gui.settings.wineprefix.title%% + <div class="desc"> + %%gui.settings.wineprefix.desc%% + </div> + </div> + <div class="actions"> + <input> + </div> + </div> + <div class="option linuxopt" name="winebin"> + <div class="text"> + %%gui.settings.winebin.title%% + <div class="desc"> + %%gui.settings.winebin.desc%% + </div> + </div> + <div class="actions"> + <input> + </div> + </div> <h2>%%gui.settings.title.language%%</h2> <div class="option" name="autolang"> <div class="text"> diff --git a/src/app/main.js b/src/app/main.js index 70d1b0c..6ec5820 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -16,6 +16,7 @@ var settings = { autoupdate: true, zip: "/northstar.zip", lang: navigator.language, + winebin: "/usr/bin/wine64", excludes: [ "ns_startup_args.txt", "ns_startup_args_dedi.txt" diff --git a/src/app/settings.js b/src/app/settings.js index 23b38c9..96d9379 100644 --- a/src/app/settings.js +++ b/src/app/settings.js @@ -126,6 +126,13 @@ var Settings = { } } + if (process.platform == "win32") { + let linuxopts = document.querySelectorAll(".options .linuxopt"); + for (let i = 0; i < linuxopts.length; i++) { + linuxopts[i].style.display = "none"; + } + } + ipcRenderer.send("can-autoupdate"); ipcRenderer.on("cant-autoupdate", () => { document.querySelector(".option[name=autoupdate]").style.display = "none"; diff --git a/src/lang/en.json b/src/lang/en.json index af388d8..fbd6b0b 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -85,11 +85,16 @@ "gui.settings.save": "Save", "gui.settings.discard": "Discard", + "gui.settings.title.linux": "Linux", "gui.settings.title.ns": "Northstar", "gui.settings.title.language": "Language", "gui.settings.title.updates": "Updates", "gui.settings.nsargs.title": "Launch options", "gui.settings.nsargs.desc": "Here you can add launch options for Northstar/Titanfall.", + "gui.settings.wineprefix.title": "Wine Prefix", + "gui.settings.wineprefix.desc": "The prefix which Wine/Proton will run from, if the game is installed through Steam this should be auto detected.", + "gui.settings.winebin.title": "Wine Executable", + "gui.settings.winebin.desc": "The version of Wine/Proton to use to run the game, this is by default set to \"/usr/bin/wine64\" if Proton can't be found.<br><br>This is unlikely to work properly, and is only a fallback", "gui.settings.autolang.title": "Auto-Detect Language", "gui.settings.autolang.desc": "When enabled, Viper tries to automatically detect your system language, when disabled you can manually change the language below.", "gui.settings.forcedlang.title": "Language", diff --git a/src/lang/es.json b/src/lang/es.json index e3ef4f0..3df55b5 100644 --- a/src/lang/es.json +++ b/src/lang/es.json @@ -86,6 +86,7 @@ "gui.settings.save": "Guardar", "gui.settings.discard": "Descartar", "gui.settings.title.ns": "Northstar", + "gui.settings.title.linux": "Linux", "gui.settings.title.updates": "Actualizaciones", "gui.settings.nsargs.title": "Opciones de lanzamiento", "gui.settings.nsargs.desc": "Aqui puedes añadir opciones de lanzamiento para Northstar/Titanfall.", diff --git a/src/lang/fr.json b/src/lang/fr.json index 81c5ada..69bd557 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -86,6 +86,7 @@ "gui.settings.save": "Sauvegarder", "gui.settings.discard": "Annuler", "gui.settings.title.ns": "Northstar", + "gui.settings.title.linux": "Linux", "gui.settings.title.language": "Langue", "gui.settings.title.updates": "Mises à jour", "gui.settings.nsargs.title": "Options de lancement", diff --git a/src/utils.js b/src/utils.js index 89bcf92..2804322 100644 --- a/src/utils.js +++ b/src/utils.js @@ -28,6 +28,7 @@ var settings = { autoupdate: true, nsargs: "-multiple", zip: "/northstar.zip", + winebin: "/usr/bin/wine64", // These files won't be overwritten when installing/updating // Northstar, useful for config files @@ -354,22 +355,32 @@ function updatevp(autoinstall) { // Either Northstar or Vanilla. Linux support is not currently a thing, // however it'll be added at some point. function launch(version) { - if (process.platform == "linux") { - console.error("error:", lang("cli.launch.linuxerror")) - cli.exit(1); - } - + let cwd = process.cwd(); process.chdir(settings.gamepath); + switch(version) { case "vanilla": console.log(lang("general.launching"), "Vanilla...") - run(path.join(settings.gamepath + "/Titanfall2.exe")) + + if (process.platform == "linux") { + run(settings.winebin, [path.join(settings.gamepath + "/Titanfall2.exe")]) + } else { + run(path.join(settings.gamepath + "/Titanfall2.exe")) + } + break; default: console.log(lang("general.launching"), "Northstar...") - run(path.join(settings.gamepath + "/NorthstarLauncher.exe")) + + if (process.platform == "linux") { + run(settings.winebin, [path.join(settings.gamepath + "/NorthstarLauncher.exe")]) + } else { + run(path.join(settings.gamepath + "/NorthstarLauncher.exe")) + } break; } + + process.chdir(cwd); } // Logs into the dev tools of the renderer |