diff options
author | 0neGal <mail@0negal.com> | 2022-04-20 20:07:15 +0200 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-04-20 20:07:15 +0200 |
commit | a2e1b36c558ed32e7a91b28a21a3843cd82217be (patch) | |
tree | 24c4387f1b6b92c7cbb38bec0c8bf58ff01b0562 /src/utils.js | |
parent | b279ce44cb334dafc0f07b92c992742f0fcca53b (diff) | |
download | Viper-a2e1b36c558ed32e7a91b28a21a3843cd82217be.tar.gz Viper-a2e1b36c558ed32e7a91b28a21a3843cd82217be.zip |
find.proton() and more checks
Overall we should now be able to find the latest version of Proton, the
Prefix, and everything a like, all automatically.
Albeit launching is sort of iffy, and seems to work, but with some
issues that seem to be caused mostly by my system.
Diffstat (limited to 'src/utils.js')
-rw-r--r-- | src/utils.js | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/src/utils.js b/src/utils.js index b100cf9..bb5b982 100644 --- a/src/utils.js +++ b/src/utils.js @@ -357,17 +357,35 @@ function updatevp(autoinstall) { // however it'll be added at some point. function launch(version) { let cwd = process.cwd(); - let prefix = settings.wineprefix; + let prefix = { + path: settings.wineprefix, + origin: path.join(settings.wineprefix, "/drive_c/Program Files (x86)/Origin/Origin.exe") + } + process.chdir(settings.gamepath); + let winebin = settings.winebin; + if (process.platform != "win32") { - let foundprefix = find.prefix(); - if (foundprefix) { - prefix = foundprefix; + if (winebin == "/usr/bin/wine64") { + let proton = find.proton(); + if (proton) {winebin = proton} + } + + if (prefix.path == "") { + let foundprefix = find.prefix(); + if (foundprefix) { + prefix = foundprefix; + } else { + winAlert(lang("wine.cantfindprefix")); + return false; + } + } else { + } if (! fs.existsSync(prefix.path)) { - winAlert("invalid wine prefix"); + winAlert(lang("wine.invalidprefix") + "\n\n" + prefix.path); return false; } else { process.env["WINEPREFIX"] = prefix.path; @@ -379,7 +397,7 @@ function launch(version) { console.log(lang("general.launching"), "Vanilla...") if (process.platform != "win32") { - run(settings.winebin, [path.join(settings.gamepath + "/Titanfall2.exe")]) + run(winebin, [path.join(settings.gamepath + "/Titanfall2.exe")]) } else { run(path.join(settings.gamepath + "/Titanfall2.exe")) } @@ -389,10 +407,15 @@ function launch(version) { console.log(lang("general.launching"), "Northstar...") if (process.platform != "win32") { - run(settings.winebin, [prefix.origin]) - run(settings.winebin, [path.join(settings.gamepath + "/NorthstarLauncher.exe")]) + if (! fs.existsSync(prefix.origin)) { + winAlert(lang("wine.originnotfound") + "\n\n" + prefix.origin); + return false; + } + + run(winebin, [prefix.origin]) + run(winebin, [path.join(settings.gamepath + "/NorthstarLauncher.exe")]) } else { - run(path.join(settings.gamepath + "/Titanfall2.exe -northstar")) + run(path.join(settings.gamepath + "/Titanfall2.exe", ["-northstar"])) } break; @@ -824,8 +847,6 @@ setInterval(() => { } }, 1500) -console.log(find.prefix()) - module.exports = { mods, lang, |