mirror of
https://github.com/OpenFusionProject/Client.git
synced 2024-11-22 13:40:06 +00:00
Revise loader DLL to work under Wine, loading screen beta text, cleanup
This commit is contained in:
parent
d4dc403e90
commit
43f0c8c684
@ -1,3 +1,4 @@
|
|||||||
|
// TODO: path.join in this file, pass in json paths from index.js
|
||||||
var remote = require("remote");
|
var remote = require("remote");
|
||||||
var remotefs = remote.require("fs-extra");
|
var remotefs = remote.require("fs-extra");
|
||||||
var dns = remote.require("dns");
|
var dns = remote.require("dns");
|
||||||
|
Binary file not shown.
54
index.js
54
index.js
@ -1,24 +1,32 @@
|
|||||||
var app = require("app"); // Module to control application life.
|
var app = require("app"); // Module to control application life.
|
||||||
var ipc = require("ipc");
|
|
||||||
var fs = require("fs-extra");
|
|
||||||
var os = require("os");
|
|
||||||
var dialog = require("dialog");
|
var dialog = require("dialog");
|
||||||
var BrowserWindow = require("browser-window");
|
var fs = require("fs-extra");
|
||||||
|
var ipc = require("ipc");
|
||||||
|
var os = require("os");
|
||||||
|
var path = require("path");
|
||||||
|
|
||||||
|
var BrowserWindow = require("browser-window");
|
||||||
var mainWindow = null;
|
var mainWindow = null;
|
||||||
app.commandLine.appendSwitch("enable-npapi");
|
|
||||||
app.commandLine.appendSwitch("no-proxy-server");
|
|
||||||
|
|
||||||
var userData = app.getPath("userData");
|
var userData = app.getPath("userData");
|
||||||
var unityHomeDir = __dirname + "\\..\\..\\WebPlayer";
|
var unityHomeDir = path.join(__dirname, "../../WebPlayer");
|
||||||
|
|
||||||
// if running in non-packaged / development mode, this dir will be slightly different
|
// if running in non-packaged / development mode, this dir will be slightly different
|
||||||
if (process.env.npm_node_execpath) {
|
if (process.env.npm_node_execpath) {
|
||||||
unityHomeDir = app.getAppPath() + "\\build\\WebPlayer";
|
unityHomeDir = path.join(app.getAppPath(), "/build/WebPlayer");
|
||||||
}
|
}
|
||||||
|
|
||||||
process.env["UNITY_HOME_DIR"] = unityHomeDir;
|
process.env["UNITY_HOME_DIR"] = unityHomeDir;
|
||||||
process.env["UNITY_DISABLE_PLUGIN_UPDATES"] = "yes";
|
process.env["UNITY_DISABLE_PLUGIN_UPDATES"] = "yes";
|
||||||
|
|
||||||
|
app.commandLine.appendSwitch("enable-npapi");
|
||||||
|
app.commandLine.appendSwitch("load-plugin", path.join(unityHomeDir, "/loader/npUnity3D32.dll"));
|
||||||
|
app.commandLine.appendSwitch("no-proxy-server");
|
||||||
|
|
||||||
|
var configPath = path.join(userData, "/config.json");
|
||||||
|
var serversPath = path.join(userData, "/servers.json");
|
||||||
|
var versionsPath = path.join(userData, "/versions.json");
|
||||||
|
|
||||||
function initialSetup(firstTime) {
|
function initialSetup(firstTime) {
|
||||||
// Display a small window to inform the user that the app is working
|
// Display a small window to inform the user that the app is working
|
||||||
setupWindow = new BrowserWindow({
|
setupWindow = new BrowserWindow({
|
||||||
@ -32,33 +40,21 @@ function initialSetup(firstTime) {
|
|||||||
// migration from pre-1.4
|
// migration from pre-1.4
|
||||||
// Back everything up, just in case
|
// Back everything up, just in case
|
||||||
setupWindow.loadUrl("file://" + __dirname + "/initial-setup.html");
|
setupWindow.loadUrl("file://" + __dirname + "/initial-setup.html");
|
||||||
fs.copySync(userData + "\\config.json", userData + "\\config.json.bak");
|
fs.copySync(configPath, configPath + ".bak");
|
||||||
fs.copySync(
|
fs.copySync(serversPath, serversPath + ".bak");
|
||||||
userData + "\\servers.json",
|
fs.copySync(versionsPath, versionsPath + ".bak");
|
||||||
userData + "\\servers.json.bak"
|
|
||||||
);
|
|
||||||
fs.copySync(
|
|
||||||
userData + "\\versions.json",
|
|
||||||
userData + "\\versions.json.bak"
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
// first-time setup
|
// first-time setup
|
||||||
// Copy default servers
|
// Copy default servers
|
||||||
fs.copySync(
|
fs.copySync(
|
||||||
__dirname + "\\defaults\\servers.json",
|
path.join(__dirname, "/defaults/servers.json"),
|
||||||
userData + "\\servers.json"
|
serversPath
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy default versions and config
|
// Copy default versions and config
|
||||||
fs.copySync(
|
fs.copySync(path.join(__dirname, "/defaults/versions.json"), versionsPath);
|
||||||
__dirname + "\\defaults\\versions.json",
|
fs.copySync(path.join(__dirname, "/defaults/config.json"), configPath);
|
||||||
userData + "\\versions.json"
|
|
||||||
);
|
|
||||||
fs.copySync(
|
|
||||||
__dirname + "\\defaults\\config.json",
|
|
||||||
userData + "\\config.json"
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log("JSON files copied.");
|
console.log("JSON files copied.");
|
||||||
setupWindow.destroy();
|
setupWindow.destroy();
|
||||||
@ -90,14 +86,12 @@ app.on("ready", function () {
|
|||||||
height: 720,
|
height: 720,
|
||||||
show: false,
|
show: false,
|
||||||
"web-preferences": {
|
"web-preferences": {
|
||||||
plugins: true,
|
plugins: true
|
||||||
"extra-plugin-dirs": [unityHomeDir + "\\loader"],
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
mainWindow.setMinimumSize(640, 480);
|
mainWindow.setMinimumSize(640, 480);
|
||||||
|
|
||||||
// Check for first run
|
// Check for first run
|
||||||
var configPath = userData + "\\config.json";
|
|
||||||
try {
|
try {
|
||||||
if (!fs.existsSync(configPath)) {
|
if (!fs.existsSync(configPath)) {
|
||||||
console.log("Config file not found. Running initial setup.");
|
console.log("Config file not found. Running initial setup.");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "OpenFusionClient",
|
"name": "OpenFusionClient",
|
||||||
"version": "1.4.2",
|
"version": "1.4.3",
|
||||||
"description": "OpenFusionClient",
|
"description": "OpenFusionClient",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
Reference in New Issue
Block a user