aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/FUNDING.yml2
-rw-r--r--README.md11
-rw-r--r--assets/download.pngbin0 -> 11474 bytes
-rw-r--r--assets/preview.pngbin256849 -> 257265 bytes
-rw-r--r--build/langs.js16
-rw-r--r--package-lock.json9
-rw-r--r--package.json3
-rw-r--r--src/app/icons/viper.pngbin137107 -> 59028 bytes
-rw-r--r--src/app/main.js5
-rw-r--r--src/assets/icons/512x512.pngbin137107 -> 59028 bytes
-rw-r--r--src/assets/icons/icon.icobin201799 -> 194797 bytes
-rw-r--r--src/extras/findgame.js67
-rw-r--r--src/extras/requests.js (renamed from src/requests.js)0
-rw-r--r--src/index.js12
-rw-r--r--src/lang/en.json4
-rw-r--r--src/lang/es.json2
-rw-r--r--src/lang/fr.json4
-rw-r--r--src/lang/maintainers.json13
-rw-r--r--src/utils.js55
19 files changed, 172 insertions, 31 deletions
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 96f466a..8991fb3 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,2 +1,2 @@
liberapay: 0neGal
-custom: ["https://github.com/R2Northstar"]
+custom: ["github.com/R2Northstar"]
diff --git a/README.md b/README.md
index dc9cc73..81ad6d3 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,9 @@
<p align="center">
- <img src="src/assets/icons/512x512.png" width="200px"><br><br>
+ <img src="src/assets/icons/512x512.png" width="200px"><br>
+ <a href="https://github.com/0neGal/viper/releases/download/v1.1.0/Viper-Setup-1.1.0.exe"><img src="assets/download.png" width="300px"></a><br>
<a href="https://github.com/0neGal/viper/projects/1">Overview</a> |
- <a href="https://github.com/0neGal/viper/releases">Releases</a>
-</p><br><br>
+ <a href="https://github.com/0neGal/viper/releases">Releases</a><br>
+</p>
## What is Viper?
@@ -14,9 +15,9 @@ Downloads are available on the [releases page](https://github.com/0neGal/viper/r
Please note that some versions will update themselves automatically when a new release is available (just like Origin or Steam) and some will NOT, so choose it accordingly. Only the AppImage and Windows Setup/Installer can auto-update.
-**Windows:** `Viper Setup [x.y.z].exe` (auto-updates, and is recommanded), `Viper [x.y.z].exe` (single executable, no fuss)
+**Windows:** [`Viper Setup [x.y.z].exe`](https://github.com/0neGal/viper/releases/download/v1.1.0/Viper-Setup-1.1.0.exe) (auto-updates, and is recommanded), [`Viper [x.y.z].exe`](https://github.com/0neGal/viper/releases/download/v1.1.0/Viper-1.1.0.exe) (single executable, no fuss)
-**Linux:** `.AppImage` (auto-updates), `.deb`, `.rpm`, `.snap`, `.tar.gz`
+**Linux:** [`.AppImage`](https://github.com/0neGal/viper/releases/download/v1.1.0/Viper-1.1.0.AppImage) (auto-updates), [`.deb`](https://github.com/0neGal/viper/releases/download/v1.1.0/viper-1.1.0_amd64.deb), [`.rpm`](https://github.com/0neGal/viper/releases/download/v1.1.0/Viper-1.1.0.x86_64.rpm), [`.tar.gz`](https://github.com/0neGal/viper/releases/download/v1.1.0/Viper-1.1.0.tar.gz)
## What can it do specifically?
diff --git a/assets/download.png b/assets/download.png
new file mode 100644
index 0000000..52bef5d
--- /dev/null
+++ b/assets/download.png
Binary files differ
diff --git a/assets/preview.png b/assets/preview.png
index 2602337..572bd04 100644
--- a/assets/preview.png
+++ b/assets/preview.png
Binary files differ
diff --git a/build/langs.js b/build/langs.js
index 0e82022..9e21dff 100644
--- a/build/langs.js
+++ b/build/langs.js
@@ -1,10 +1,14 @@
const fs = require("fs");
let lang = require("../src/lang/en.json");
+let maintainers = require("../src/lang/maintainers.json");
langs = fs.readdirSync("src/lang")
langs.forEach((localefile) => {
+ if (localefile == "maintainers.json") {return}
+
let missing = [];
+ let langmaintainers = maintainers.list[localefile.replace(/\..*$/, "")];
let locale = require("../src/lang/" + localefile)
for (let i in lang) {
if (! locale[i]) {
@@ -13,6 +17,16 @@ langs.forEach((localefile) => {
}
if (missing.length > 0) {
- console.error(`${localefile} is missing: ${missing}`)
+ console.error(`${localefile} is missing:`)
+ for (let i in missing) {
+ console.log(` ${missing[i]}`)
+ }
+
+ console.log()
+
+ console.log("Maintainers of language: ")
+ for (let i in langmaintainers) {
+ console.log(` ${langmaintainers[i]}`)
+ }
}
})
diff --git a/package-lock.json b/package-lock.json
index f3a1e0d..d5a6d72 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -16,6 +16,7 @@
"marked": "^4.0.10",
"marked-man": "^0.7.0",
"recursive-copy": "^2.0.13",
+ "simple-vdf": "^1.1.1"
"unzipper": "^0.10.11"
},
"devDependencies": {
@@ -2903,6 +2904,10 @@
"engines": {
"node": ">=0.10.0"
}
+ "node_modules/simple-vdf": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/simple-vdf/-/simple-vdf-1.1.1.tgz",
+ "integrity": "sha1-B+LE3sBs9hTtb0IRsYzOEjyT/Kk="
},
"node_modules/slice-ansi": {
"version": "3.0.0",
@@ -5683,6 +5688,10 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU="
+ "simple-vdf": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/simple-vdf/-/simple-vdf-1.1.1.tgz",
+ "integrity": "sha1-B+LE3sBs9hTtb0IRsYzOEjyT/Kk="
},
"slice-ansi": {
"version": "3.0.0",
diff --git a/package.json b/package.json
index e1d0c25..fc0381f 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "viper",
"productName": "Viper",
- "version": "1.0.3",
+ "version": "1.1.0",
"description": "Launcher+Updater for TF|2 Northstar",
"main": "src/index.js",
"build": {
@@ -55,6 +55,7 @@
"marked": "^4.0.10",
"marked-man": "^0.7.0",
"recursive-copy": "^2.0.13",
+ "simple-vdf": "^1.1.1",
"unzipper": "^0.10.11"
},
"devDependencies": {
diff --git a/src/app/icons/viper.png b/src/app/icons/viper.png
index 281f3dd..69b1cce 100644
--- a/src/app/icons/viper.png
+++ b/src/app/icons/viper.png
Binary files differ
diff --git a/src/app/main.js b/src/app/main.js
index 08c70c1..169f86f 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -27,13 +27,11 @@ if (fs.existsSync("viper.json")) {
settings.zip = path.join(settings.gamepath + "/northstar.zip");
if (settings.gamepath.length === 0) {
- alert(lang("general.missingpath"));
setpath(false);
} else {
setpath(true);
}
} else {
- alert(lang("general.missingpath"));
setpath();
}
@@ -173,6 +171,7 @@ function installFromURL(url) {
// Frontend part of settings a new game path
ipcRenderer.on("newpath", (event, newpath) => {
settings.gamepath = newpath;
+ ipcRenderer.send("guigetmods");
})
// Continuation of log()
@@ -182,6 +181,8 @@ ipcRenderer.on("alert", (event, msg) => {alert(msg)})
// Updates the installed mods
ipcRenderer.on("mods", (event, mods) => {
modsobj = mods;
+ if (! mods) {return}
+
modcount.innerHTML = `${lang("gui.mods.count")} ${mods.all.length}`;
modsdiv.innerHTML = "";
diff --git a/src/assets/icons/512x512.png b/src/assets/icons/512x512.png
index 281f3dd..69b1cce 100644
--- a/src/assets/icons/512x512.png
+++ b/src/assets/icons/512x512.png
Binary files differ
diff --git a/src/assets/icons/icon.ico b/src/assets/icons/icon.ico
index 32df0c5..06702df 100644
--- a/src/assets/icons/icon.ico
+++ b/src/assets/icons/icon.ico
Binary files differ
diff --git a/src/extras/findgame.js b/src/extras/findgame.js
new file mode 100644
index 0000000..42c9b85
--- /dev/null
+++ b/src/extras/findgame.js
@@ -0,0 +1,67 @@
+const fs = require("fs");
+const path = require("path");
+const vdf = require("simple-vdf");
+const { app } = require("electron");
+
+const util = require("util");
+const exec = util.promisify(require("child_process").exec);
+
+module.exports = async () => {
+ let gamepath = "";
+
+ // Autodetect path
+ // Windows only using powershell and windows registery
+ // Get-Item -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Respawn\Titanfall2\
+ if (process.platform == "win32") {
+ try {
+ const {stdout} = await exec("Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Respawn\\Titanfall2\\ -Name \"Install Dir\"", {"shell":"powershell.exe"});
+
+ const gamepath = stdout.split('\n')
+ .filter(r => r.indexOf("Install Dir") !== -1)[0]
+ .replace(/\s+/g,' ')
+ .trim()
+ .replace("Install Dir : ","");
+
+ if (gamepath) {return gamepath}
+ } catch (err) {}
+ }
+
+ // Detect using Steam VDF
+ function readvdf(data) {
+ // Parse read_data
+ data = vdf.parse(data);
+
+ // `.length - 1` This is because the last value is `contentstatsid`
+ for (let pathIterator = 0; pathIterator < Object.values(data["libraryfolders"]).length - 1; pathIterator++) {
+ let data_array = Object.values(data["libraryfolders"][pathIterator])
+
+ if (fs.existsSync(data_array[0] + "/steamapps/common/Titanfall2/Titanfall2.exe")) {
+ return data_array[0] + "/steamapps/common/Titanfall2";
+ }
+ }
+ }
+
+ let folder = null;
+ switch (process.platform) {
+ case "win32":
+ folder = "C:\\Program Files (x86)\\Steam\\steamapps\\libraryfolders.vdf";
+ break
+ case "linux":
+ case "openbsd":
+ case "freebsd":
+ folder = path.join(app.getPath("home"), "/.steam/steam/steamapps/libraryfolders.vdf");
+ break
+ }
+
+ if (fs.existsSync(folder) && folder) {
+ let data = fs.readFileSync(folder)
+ let read_vdf = readvdf(data.toString())
+ if (read_vdf ) {return read_vdf}
+ }
+
+ if (gamepath) {
+ return gamepath;
+ } else {
+ return false;
+ }
+}
diff --git a/src/requests.js b/src/extras/requests.js
index 16b1330..16b1330 100644
--- a/src/requests.js
+++ b/src/extras/requests.js
diff --git a/src/index.js b/src/index.js
index a0cb4db..a06cf69 100644
--- a/src/index.js
+++ b/src/index.js
@@ -8,7 +8,7 @@ const events = new Emitter();
const utils = require("./utils");
const cli = require("./cli");
-const requests = require("./requests");
+const requests = require("./extras/requests");
// Starts the actual BrowserWindow, which is only run when using the
// GUI, for the CLI this function is never called.
@@ -91,9 +91,13 @@ ipcMain.on("launchVanilla", (event) => {utils.launch("vanilla")})
ipcMain.on("update", (event) => {utils.update()})
ipcMain.on("setpathcli", (event) => {utils.setpath()});
ipcMain.on("setpath", (event, value) => {
- if (!value) {
- utils.setpath(win);
- } else if (!win.isVisible()) {
+ if (! value) {
+ if (! win.isVisible()) {
+ utils.setpath(win);
+ } else {
+ utils.setpath(win, true);
+ }
+ } else if (! win.isVisible()) {
win.show();
}
});
diff --git a/src/lang/en.json b/src/lang/en.json
index c51c843..a9eb47f 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -42,7 +42,7 @@
"gui.versions.northstar": "Northstar version",
"gui.exit": "Exit",
"gui.update": "Update",
- "gui.setpath": "Game Path",
+ "gui.setpath": "Change Game Path",
"gui.update.check": "Check for updates",
"gui.mods": "Mods",
@@ -106,7 +106,7 @@
"general.mods.enabled": "Enabled mods:",
"general.mods.disabled": "Disabled mods:",
"general.mods.installed": "Installed mods:",
- "general.missingpath": "Game path is not set!",
+ "general.missingpath": "Game location could not be found automatically! Please select it manually!",
"general.notinstalled": "Northstar is not installed!",
"general.launching": "Launching"
}
diff --git a/src/lang/es.json b/src/lang/es.json
index 5df53c2..9eac2b0 100644
--- a/src/lang/es.json
+++ b/src/lang/es.json
@@ -109,4 +109,4 @@
"general.missingpath": "¡La ruta del jueno no se ha podido encontrar automaticamente! ¡Por favor, elige la ruta manualmente!",
"general.notinstalled": "¡Northstar no se ha instalado!",
"general.launching": "Ejecutando"
-}
+} \ No newline at end of file
diff --git a/src/lang/fr.json b/src/lang/fr.json
index f518e05..4e6103a 100644
--- a/src/lang/fr.json
+++ b/src/lang/fr.json
@@ -42,7 +42,7 @@
"gui.versions.northstar": "Version de Northstar",
"gui.exit": "Fermer",
"gui.update": "Mise à jour",
- "gui.setpath": "Chemin du jeu",
+ "gui.setpath": "Mettre à jour le chemin du jeu",
"gui.update.check": "Vérifier les mises à jour",
"gui.mods": "Mods",
@@ -106,7 +106,7 @@
"general.mods.enabled": "Mods activés :",
"general.mods.disabled": "Mods désactivés :",
"general.mods.installed": "Mods installés :",
- "general.missingpath": "Le chemin du client n'est pas défini !",
+ "general.missingpath": "Le chemin du client n'a pu être trouvé automatiquement, merci de le sélectionner manuellement.",
"general.notinstalled": "Northstar n'est pas installé !",
"general.launching": "Lancement"
}
diff --git a/src/lang/maintainers.json b/src/lang/maintainers.json
new file mode 100644
index 0000000..094814a
--- /dev/null
+++ b/src/lang/maintainers.json
@@ -0,0 +1,13 @@
+{
+ "explanation": "This file is for storing contact information for the various maintainers of various languages/localizations",
+
+ "list": {
+ "es": [
+ "https://github.com/AA-Delta"
+ ],
+
+ "fr": [
+ "https://github.com/Alystrasz"
+ ]
+ }
+}
diff --git a/src/utils.js b/src/utils.js
index 5016ef6..1887dd1 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -8,7 +8,8 @@ const events = new Emitter();
const cli = require("./cli");
const lang = require("./lang");
-const requests = require("./requests");
+const requests = require("./extras/requests");
+const findgame = require("./extras/findgame");
const unzip = require("unzipper");
const run = require("child_process").spawn;
@@ -115,10 +116,37 @@ northstar_auto_updates: {
//
// If running with CLI it takes in the --setpath argument otherwise it
// open the systems file browser for the user to select a path.
-function setpath(win) {
+async function setpath(win, forcedialog) {
+ function setGamepath(folder) {
+ settings.gamepath = folder;
+ settings.zip = path.join(settings.gamepath + "/northstar.zip");
+ saveSettings();
+ win.webContents.send("newpath", settings.gamepath);
+ ipcMain.emit("newpath", null, settings.gamepath);
+ }
+
if (! win) { // CLI
- settings.gamepath = cli.param("setpath");
+ setGamepath(cli.param("setpath"));
} else { // GUI
+ if (! forcedialog) {
+ function setGamepath(folder, forcedialog) {
+ settings.gamepath = folder;
+ settings.zip = path.join(settings.gamepath + "/northstar.zip");
+ saveSettings();
+ win.webContents.send("newpath", settings.gamepath);
+ ipcMain.emit("newpath", null, settings.gamepath);
+ }
+
+ let gamepath = await findgame();
+ if (gamepath) {
+ setGamepath(gamepath);
+ return;
+ }
+
+ winAlert(lang("general.missingpath"));
+ }
+
+ // Fallback to manual selection
dialog.showOpenDialog({properties: ["openDirectory"]}).then(res => {
if (res.canceled) {
ipcMain.emit("newpath", null, false);
@@ -129,16 +157,12 @@ function setpath(win) {
return;
}
- settings.gamepath = res.filePaths[0];
- settings.zip = path.join(settings.gamepath + "/northstar.zip");
- saveSettings();
- win.webContents.send("newpath", settings.gamepath);
- ipcMain.emit("newpath", null, settings.gamepath);
+ setGamepath(res.filePaths[0])
+
+ cli.exit();
+ return;
}).catch(err => {console.error(err)})
}
-
- saveSettings();
- cli.exit();
}
// As to not have to do the same one liner a million times, this
@@ -315,7 +339,6 @@ function winAlert(msg) {
//
// We can both get list of disabled mods, remove/install/toggle mods and
// other things akin to that, all kinds of mod related stuff
-let modpath = path.join(settings.gamepath, "R2Northstar/mods");
const mods = {
// Returns a list of mods
//
@@ -323,6 +346,8 @@ const mods = {
// combination of the other two, enabled being enabled mods, and you
// guessed it, disabled being disabled mods.
list: () => {
+ let modpath = path.join(settings.gamepath, "R2Northstar/mods");
+
if (getNSVersion() == "unknown") {
winLog(lang("general.notinstalled"))
console.log("error: " + lang("general.notinstalled"))
@@ -399,6 +424,8 @@ const mods = {
// the absolute basics will be provided and we can't know the
// version or similar.
get: (mod) => {
+ let modpath = path.join(settings.gamepath, "R2Northstar/mods");
+
if (getNSVersion() == "unknown") {
winLog(lang("general.notinstalled"))
console.log("error: " + lang("general.notinstalled"))
@@ -580,6 +607,8 @@ const mods = {
// Takes in the names of the mod then removes it, no confirmation,
// that'd be up to the GUI.
remove: (mod) => {
+ let modpath = path.join(settings.gamepath, "R2Northstar/mods");
+
if (getNSVersion() == "unknown") {
winLog(lang("general.notinstalled"))
console.log("error: " + lang("general.notinstalled"))
@@ -639,6 +668,8 @@ const mods = {
// you checked for if a mod is already disable and if not run the
// function. However we currently have no need for that.
toggle: (mod, fork) => {
+ let modpath = path.join(settings.gamepath, "R2Northstar/mods");
+
if (getNSVersion() == "unknown") {
winLog(lang("general.notinstalled"))
console.log("error: " + lang("general.notinstalled"))