aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/index.html21
-rw-r--r--src/app/lang.js12
-rw-r--r--src/app/main.css13
-rw-r--r--src/app/main.js27
4 files changed, 62 insertions, 11 deletions
diff --git a/src/app/index.html b/src/app/index.html
index 67d2e5c..6e31f0c 100644
--- a/src/app/index.html
+++ b/src/app/index.html
@@ -6,22 +6,29 @@
<body>
<div class="lines">
<div class="line">
- <div class="text">Welcome to Viper!</div>
+ <div class="text">
+ <div style="white-space: nowrap;">%%gui.welcome%%</div>
+ <div class="versions">
+ <div id="vpVersion">Viper version: x.x.x</div>
+ <div id="nsVersion">Northstar version: x.x.x</div>
+ </div>
+ </div>
<div class="buttons">
- <button id="exit" onclick="exit()">Exit</button>
- <button id="update" onclick="update()">Update</button>
- <button id="setpath" onclick="setpath()">Game Path</button>
+ <button id="exit" onclick="exit()">%%gui.exit%%</button>
+ <button id="update" onclick="update()">%%gui.update%%</button>
+ <button id="setpath" onclick="setpath()">%%gui.setpath%%</button>
</div>
</div>
<div class="line">
- <div class="text">Launch:</div>
+ <div class="text">%%gui.launch%%:</div>
<div class="buttons">
- <button id="vanilla" onclick="launchVanilla()">Vanilla</button>
- <button id="northstar" onclick="launch()">Northstar</button>
+ <button id="vanilla" onclick="launchVanilla()">%%gui.launchvanilla%%</button>
+ <button id="northstar" onclick="launch()">%%gui.launchnorthstar%%</button>
</div>
</div>
</div>
+ <script src="lang.js"></script>
<script src="main.js"></script>
</body>
</html>
diff --git a/src/app/lang.js b/src/app/lang.js
new file mode 100644
index 0000000..5cc9708
--- /dev/null
+++ b/src/app/lang.js
@@ -0,0 +1,12 @@
+function setlang() {
+ html = document.body.innerHTML.split("%%");
+
+ for (let i = 0; i < html.length; i++) {
+ if (html[i][0] != " " &&
+ html[i][html[i].length - 1] != " ") {
+ html[i] = lang(html[i])
+ }
+ }
+
+ document.body.innerHTML = html.join("");
+}
diff --git a/src/app/main.css b/src/app/main.css
index 854c47a..c86e08d 100644
--- a/src/app/main.css
+++ b/src/app/main.css
@@ -28,16 +28,22 @@ body, button, input {
font-family: "Roboto Mono", monospace;
}
+nobr {white-space: nowrap}
+
.line {
display: flex;
margin-top: 15px;
}
.buttons {
+ text-align: right;
margin-left: auto;
margin-right: 7px;
}
+.text {max-width: 38vw}
+.buttons {max-width: 55vw}
+
button, .text {
border: none;
outline: none;
@@ -47,6 +53,7 @@ button, .text {
}
button {
+ margin-bottom: 10px;
color: var(--btnforeground);
-webkit-app-region: no-drag;
}
@@ -61,3 +68,9 @@ button:active {
#setpath {background: #5E81AC}
#northstar {background: #C7777F}
#vanilla, #exit {background: #656E7F}
+
+.versions {
+ height: 15px;
+ font-size: 12px;
+ color: #afafaf;
+} \ No newline at end of file
diff --git a/src/app/main.js b/src/app/main.js
index 17389b2..ab41af6 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -2,17 +2,25 @@ const fs = require("fs");
const path = require("path");
const { ipcRenderer } = require("electron");
+const lang = require("../lang");
+
var settings = {
gamepath: "",
- file: "viper.json",
zip: "/northstar.zip",
+ lang: navigator.language,
+ excludes: [
+ "ns_startup_args.txt",
+ "ns_startup_args_dedi.txt"
+ ]
}
-if (fs.existsSync(settings.file)) {
- settings = {...settings, ...JSON.parse(fs.readFileSync(settings.file, "utf8"))};
+ipcRenderer.send("setlang", settings.lang);
+
+if (fs.existsSync("viper.json")) {
+ settings = {...settings, ...JSON.parse(fs.readFileSync("viper.json", "utf8"))};
settings.zip = path.join(settings.gamepath + "/northstar.zip");
} else {
- alert("Game path is not set! Please select the path!");
+ alert(lang("gui.missinggamepath"));
setpath();
}
@@ -26,3 +34,14 @@ function launchVanilla() {ipcRenderer.send("launchVanilla")}
ipcRenderer.on("newpath", (event, newpath) => {
settings.gamepath = newpath;
})
+
+ipcRenderer.on('versionInfo', (_, payload) => {
+ document.getElementById('vpVersion').innerText = `Viper version: ${payload.vp}`;
+ document.getElementById('nsVersion').innerText = `Northstar version: ${payload.ns}`;
+});
+ipcRenderer.send('getVersionInfo');
+
+setlang();
+setInterval(() => {
+ ipcRenderer.send("setsize", document.querySelector(".lines").offsetHeight + 20);
+}, 150);