blob: 73ce4080e6742516d247ae7c1f40560ed012ec1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
const exec = require("child_process").exec;
const ipcMain = require("electron").ipcMain;
const cli = require("../cli");
const win = require("../win");
const lang = require("../lang");
const settings = require("./settings");
console = require("./console");
ipcMain.on("launch-ns", launch);
ipcMain.on("launch-vanilla", () => {
launch("vanilla");
})
// launches the game
//
// either Northstar or Vanilla. Linux support is not currently a thing,
// however it'll be added at some point.
function launch(game_version) {
// return early, and show error message if on Linux
if (process.platform == "linux") {
win().alert(lang("cli.launch.linux_error"));
console.error(lang("cli.launch.linux_error"));
cli.exit(1);
return;
}
// 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 " + launch_args, {
cwd: settings().gamepath
})
break;
default:
console.info(lang("general.launching"), "Northstar...");
exec("NorthstarLauncher.exe " + launch_args, {
cwd: settings().gamepath
})
break;
}
}
module.exports = launch;
|