Small GUI and warning in README.md
This commit is contained in:
parent
3aaa74372e
commit
89d3834154
@ -1,3 +1,5 @@
|
||||
# open-plutonium-launcher
|
||||
|
||||
Open-source launcher for Plutonium
|
||||
Open-source launcher for Plutonium, inspired by [LanLauncher](https://github.com/JugAndDoubleTap/LanLauncher)
|
||||
|
||||
Please note this launcher is not functional yet and a lot needs to be done.
|
||||
|
15
package.json
Normal file
15
package.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "open-plutonium-launcher",
|
||||
"version": "0.0.1",
|
||||
"description": "Open-source Plutonium launcher",
|
||||
"main": "src/index.js",
|
||||
"repository": "https://gitea.x3f200c.net/X3F200C/open-plutonium-launcher",
|
||||
"author": "X3F200C",
|
||||
"license": "GPL-3.0",
|
||||
"scripts": {
|
||||
"start": "qode src/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nodegui/nodegui": "http://master-release.nodegui.org"
|
||||
}
|
||||
}
|
131
src/index.js
Normal file
131
src/index.js
Normal file
@ -0,0 +1,131 @@
|
||||
const path = require("node:path");
|
||||
const fs = require("node:fs");
|
||||
const nodeGUI = require("@nodegui/nodegui");
|
||||
|
||||
var configFile = path.join(process.env["APPDATA"], "open-plutonium-launcher.json");
|
||||
const defaultConfig = {
|
||||
"username": "",
|
||||
"directories": {
|
||||
"plutonium": path.join(process.env["LOCALAPPDATA"], "Plutonium"),
|
||||
"iw5": path.join(process.env["PROGRAMFILES(X86)"], "Steam", "steamapps", "common", "Call of Duty Modern Warfare 3"),
|
||||
"t4": path.join(process.env["PROGRAMFILES(X86)"], "Steam", "steamapps", "common", "Call of Duty World at War"),
|
||||
"t5": path.join(process.env["PROGRAMFILES(X86)"], "Steam", "steamapps", "common", "Call of Duty Black Ops"),
|
||||
"t6": path.join(process.env["PROGRAMFILES(X86)"], "Steam", "steamapps", "common", "Call of Duty Black Ops II")
|
||||
}
|
||||
};
|
||||
|
||||
let config = {};
|
||||
|
||||
const games = [
|
||||
{
|
||||
"id": "iw5",
|
||||
"name": "Call of Duty Modern Warfare 3",
|
||||
"modes": [
|
||||
{
|
||||
"id": "mp",
|
||||
"name": "Multiplayer"
|
||||
},
|
||||
{
|
||||
"id": "sp",
|
||||
"name": "Co-Op/Zombies"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "t4",
|
||||
"name": "Call of Duty World at War",
|
||||
"modes": [
|
||||
{
|
||||
"id": "mp",
|
||||
"name": "Multiplayer"
|
||||
},
|
||||
{
|
||||
"id": "sp",
|
||||
"name": "Co-Op/Zombies"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "t5",
|
||||
"name": "Call of Duty Black Ops",
|
||||
"modes": [
|
||||
{
|
||||
"id": "mp",
|
||||
"name": "Multiplayer"
|
||||
},
|
||||
{
|
||||
"id": "sp",
|
||||
"name": "Co-Op/Zombies"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "t6",
|
||||
"name": "Call of Duty Black Ops II",
|
||||
"modes": [
|
||||
{
|
||||
"id": "mp",
|
||||
"name": "Multiplayer"
|
||||
},
|
||||
{
|
||||
"id": "zm",
|
||||
"name": "Co-Op/Zombies"
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
var gameSelections = [];
|
||||
var selectedGame = 0;
|
||||
|
||||
function readConfig() {
|
||||
config = JSON.parse(fs.readFileSync(configFile, "utf-8"));
|
||||
}
|
||||
|
||||
function writeConfig(asDefault = false) {
|
||||
fs.writeFileSync(configFile, JSON.stringify((asDefault ? defaultConfig : config)));
|
||||
}
|
||||
|
||||
if (!fs.existsSync(configFile)) {
|
||||
writeConfig(true);
|
||||
}
|
||||
readConfig();
|
||||
|
||||
var mainWindow = new nodeGUI.QMainWindow();
|
||||
|
||||
var mainWidget = new nodeGUI.QWidget();
|
||||
mainWidget.setObjectName("root");
|
||||
|
||||
var rootLayout = new nodeGUI.FlexLayout();
|
||||
mainWidget.setLayout(rootLayout);
|
||||
|
||||
var gameSelectionBox = new nodeGUI.QComboBox();
|
||||
for (let g = 0; g < games.length; g++) {
|
||||
var game = games[g];
|
||||
|
||||
for (let m = 0; m < game.modes.length; m++) {
|
||||
var mode = game.modes[m];
|
||||
|
||||
gameSelections.push([
|
||||
game.id,
|
||||
mode.id
|
||||
]);
|
||||
gameSelectionBox.addItem(undefined, game.name + " " + mode.name);
|
||||
}
|
||||
}
|
||||
gameSelectionBox.addEventListener("currentIndexChanged", function (index) {
|
||||
selectedGame = index;
|
||||
});
|
||||
rootLayout.addWidget(gameSelectionBox);
|
||||
|
||||
mainWindow.setCentralWidget(mainWidget);
|
||||
mainWindow.setStyleSheet(`
|
||||
#root {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
`);
|
||||
mainWindow.setWindowTitle("Open Plutonium launcher");
|
||||
mainWindow.resize(854, 480);
|
||||
mainWindow.show();
|
||||
global.mainWindow = mainWindow;
|
Loading…
Reference in New Issue
Block a user