Compare commits

..

No commits in common. "d4dc403e90b58e65be3672618c58aa55f6809546" and "043bf219e724d3eb9630a0a322de703ad3573aa8" have entirely different histories.

37 changed files with 140 additions and 99 deletions

View File

@ -61,7 +61,7 @@ function launchGame() {
object.setAttribute("height", "661");
var embed = document.createElement("embed");
embed.setAttribute("type", "application/vnd.ffuwp");
embed.setAttribute("type", "application/vnd.unity");
embed.setAttribute(
"pluginspage",
"http://www.unity3d.com/unity-web-player-2.x"
@ -80,6 +80,14 @@ function launchGame() {
"progressframeimage",
"assets/img/unity-loadingframe.png"
);
embed.setAttribute(
"autoupdateurlsignature",
"42180ee5edc4e3d4dd706bcc17cedd8d6ec7b7ac463071fd34ab97fe181f1a78df31db5feb4526677e4f69ef53acaff44471591e68b87f041c80fd54765f0d5725b08aa28f5acf7716ffb2a04e971269f35925c7e38d57dd78f6a206530caaa3da7e32f07f19810efc0ebf29a4eae976a925ad9cc5beb4dd51564c67dc489033"
);
embed.setAttribute(
"autoupdateurl",
"http://wp-cartoonnetwork.unity3d.com/ff/big/beta-20111013/autodownload_webplugin_beta"
);
var div = document.getElementById("client");
object.appendChild(embed);

View File

@ -280,10 +280,10 @@ function setGameInfo(serverUUID) {
// DNS resolution. there is no synchronous version for some stupid reason
if (!address.match(/^[0-9.]+$/))
dns.lookup(address, family=4, function (err, resolvedAddress) {
dns.resolve4(address, function (err, res) {
if (!err) {
console.log("Resolved " + address + " to " + resolvedAddress);
address = resolvedAddress;
console.log("Resolved " + address + " to " + res[0]);
address = res[0];
} else {
console.log("Err: " + err.code);
}

View File

@ -1,8 +0,0 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">
<activeCodePage>UTF-8</activeCodePage>
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,8 +2,8 @@
<plist>
<dict>
<key>CFBundleVersion</key>
<string>2.5.5b4</string>
<string>3.5.2f2</string>
<key>UnityBuildNumber</key>
<string>50</string>
<string>4c6ee796dacc</string>
</dict>
</plist>

Binary file not shown.

Binary file not shown.

View File

@ -2,10 +2,6 @@
<html>
<head>
<meta charset="utf-8" />
<meta
http-equiv="Content-Type"
contentType="text/html; charset=UTF-8"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OpenFusion: Server Selector</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />

View File

@ -6,18 +6,60 @@ var dialog = require("dialog");
var BrowserWindow = require("browser-window");
var mainWindow = null;
app.commandLine.appendSwitch("enable-npapi");
app.commandLine.appendSwitch("no-proxy-server");
var userData = app.getPath("userData");
var unityHomeDir = __dirname + "\\..\\..\\WebPlayer";
// if running in non-packaged / development mode, this dir will be slightly different
if (process.env.npm_node_execpath) {
unityHomeDir = app.getAppPath() + "\\build\\WebPlayer";
app.commandLine.appendSwitch("enable-npapi");
function verifyMD5Hash(file, hash) {
if (fs.existsSync(file)) {
var buffer = fs.readFileSync(file);
var computedHash = require("crypto")
.createHash("md5")
.update(buffer)
.digest("hex");
if (hash == computedHash) {
return true;
}
}
return false;
}
process.env["UNITY_HOME_DIR"] = unityHomeDir;
process.env["UNITY_DISABLE_PLUGIN_UPDATES"] = "yes";
function verifyUnity() {
var loaderPath =
app.getPath("appData") +
"\\..\\LocalLow\\Unity\\WebPlayer\\loader\\npUnity3D32.dll";
var playerPath =
app.getPath("appData") +
"\\..\\LocalLow\\Unity\\WebPlayer\\player\\fusion-2.x.x\\webplayer_win.dll";
return (
verifyMD5Hash(loaderPath, "dbbac62d8379d2d870479b04b8157b99") &&
verifyMD5Hash(playerPath, "e5028405b4483de9e5e5fe9cd5f1e98f")
);
}
function installUnity(callback) {
var utilsDir = __dirname + "\\..\\..\\utils";
// if running in non-packaged / development mode, this dir will be slightly different
if (process.env.npm_node_execpath) {
utilsDir = app.getAppPath() + "\\build\\utils";
}
// run the installer silently
var child = require("child_process").spawn(
utilsDir + "\\UnityWebPlayer.exe",
["/quiet", "/S"]
);
child.on("exit", function () {
// overwrite 3.5.2 loader/player with FF's custom version
var dest = app.getPath("appData") + "\\..\\LocalLow\\Unity\\WebPlayer";
fs.copySync(utilsDir + "\\WebPlayer", dest, { clobber: true });
// avoids error reporter popping up when closing Electron
fs.removeSync(dest + "\\UnityBugReporter.exe");
console.log("Unity Web Player installed successfully.");
callback();
});
}
function initialSetup(firstTime) {
// Display a small window to inform the user that the app is working
@ -28,41 +70,46 @@ function initialSetup(firstTime) {
center: true,
frame: false,
});
setupWindow.loadUrl("file://" + __dirname + "/initial-setup.html");
installUnity(function () {
if (!firstTime) {
// migration from pre-1.4
// Back everything up, just in case
setupWindow.loadUrl("file://" + __dirname + "/initial-setup.html");
fs.copySync(userData + "\\config.json", userData + "\\config.json.bak");
fs.copySync(
userData + "\\servers.json",
userData + "\\servers.json.bak"
app.getPath("userData") + "\\config.json",
app.getPath("userData") + "\\config.json.bak"
);
fs.copySync(
userData + "\\versions.json",
userData + "\\versions.json.bak"
app.getPath("userData") + "\\servers.json",
app.getPath("userData") + "\\servers.json.bak"
);
fs.copySync(
app.getPath("userData") + "\\versions.json",
app.getPath("userData") + "\\versions.json.bak"
);
} else {
// first-time setup
// Copy default servers
fs.copySync(
__dirname + "\\defaults\\servers.json",
userData + "\\servers.json"
app.getPath("userData") + "\\servers.json"
);
}
// Copy default versions and config
fs.copySync(
__dirname + "\\defaults\\versions.json",
userData + "\\versions.json"
app.getPath("userData") + "\\versions.json"
);
fs.copySync(
__dirname + "\\defaults\\config.json",
userData + "\\config.json"
app.getPath("userData") + "\\config.json"
);
console.log("JSON files copied.");
setupWindow.destroy();
showMainWindow();
});
}
ipc.on("exit", function (id) {
@ -84,20 +131,18 @@ app.on("ready", function () {
dialog.showErrorBox("Error!", errorMessage);
return;
}
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1280,
height: 720,
show: false,
"web-preferences": {
plugins: true,
"extra-plugin-dirs": [unityHomeDir + "\\loader"],
},
"web-preferences": { plugins: true },
});
mainWindow.setMinimumSize(640, 480);
// Check for first run
var configPath = userData + "\\config.json";
var configPath = app.getPath("userData") + "\\config.json";
try {
if (!fs.existsSync(configPath)) {
console.log("Config file not found. Running initial setup.");
@ -108,7 +153,11 @@ app.on("ready", function () {
console.log("Pre-1.4 config detected. Running migration.");
initialSetup(false);
} else {
if (verifyUnity()) {
showMainWindow();
} else {
installUnity(showMainWindow);
}
}
}
} catch (ex) {

View File

@ -1,6 +1,6 @@
{
"name": "OpenFusionClient",
"version": "1.4.2",
"version": "1.4.1",
"description": "OpenFusionClient",
"main": "index.js",
"scripts": {
@ -63,12 +63,8 @@
"extraFiles": [
"LICENSE.md",
{
"from": "build/OpenFusionClient.exe.manifest",
"to": "OpenFusionClient.exe.manifest"
},
{
"from": "build/WebPlayer",
"to": "WebPlayer"
"from": "build/utils",
"to": "utils"
}
],
"afterPack": "./build/after-pack.js"