mirror of
https://github.com/OpenFusionProject/Client.git
synced 2025-10-15 12:10:13 +00:00
Compare commits
6 Commits
e19098a13e
...
1.4.2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d4dc403e90 | ||
![]() |
ab5de9488d | ||
![]() |
dabb8bf484 | ||
![]() |
043bf219e7 | ||
![]() |
7131026b2f | ||
7dd018e336 |
17
README.md
17
README.md
@@ -1,45 +1,52 @@
|
||||
# OpenFusionClient
|
||||
|
||||
[](https://github.com/OpenFusionProject/OpenFusionClient/releases/latest) [](https://discord.gg/DYavckB)[](https://github.com/OpenFusionProject/OpenFusionClient/blob/master/LICENSE.md)
|
||||
|
||||
An Electron app that allows you to easily join FusionFall servers.
|
||||
An Electron app that allows you to easily join FusionFall servers.
|
||||
|
||||
It automatically installs FF's custom build of Unity Web Player, manages text files such as `assetInfo.php`/`loginInfo.php`, and embeds the game, all in a few clicks!
|
||||
It automatically installs FF's custom build of Unity Web Player, manages text files such as `assetInfo.php`/`loginInfo.php`, and embeds the game, all in a few clicks!
|
||||
|
||||
For an overview of how the game client worked originally, please see [this section in the OpenFusion README](https://github.com/OpenFusionProject/OpenFusion#architecture ).
|
||||
For an overview of how the game client worked originally, please see [this section in the OpenFusion README](https://github.com/OpenFusionProject/OpenFusion#architecture).
|
||||
|
||||
## Disclaimer
|
||||
|
||||
This repository does not contain any code from the actual FusionFall game client. **Think of it more as a launcher:** it abstracts away having to use a NPAPI plugin capable web browser, along with having to host a HTTP server for it to connect to.
|
||||
This repository does not contain any code from the actual FusionFall game client. **Think of it more as a launcher:** it abstracts away having to use a NPAPI plugin capable web browser, along with having to host a HTTP server for it to connect to.
|
||||
|
||||
In addition, if you are interested in contributing: do note that **this project likely cannot utilize more modern Javascript techniques**. In order to use NPAPI plugins, a very old version of Electron was needed (0.31.0). This limits the project to only a portion of ES5 in non-strict mode, and a reduced subset of Node/Electron APIs.
|
||||
In addition, if you are interested in contributing: do note that **this project likely cannot utilize more modern Javascript techniques**. In order to use NPAPI plugins, a very old version of Electron was needed (0.31.0). This limits the project to only a portion of ES5 in non-strict mode, and a reduced subset of Node/Electron APIs.
|
||||
|
||||
## Usage
|
||||
|
||||
Provided that you have npm installed, clone the repository, then run install like so:
|
||||
|
||||
```
|
||||
git clone https://github.com/OpenFusionProject/OpenFusionClient.git
|
||||
npm install
|
||||
```
|
||||
|
||||
After that has completed you can then test OpenFusionClient:
|
||||
|
||||
```
|
||||
npm run start
|
||||
```
|
||||
|
||||
If you would like to package it as a standalone win32 application:
|
||||
|
||||
```
|
||||
npm run pack
|
||||
```
|
||||
|
||||
You can then compress the application directory into a zip file and installer for distribution:
|
||||
|
||||
```
|
||||
npm run dist
|
||||
```
|
||||
|
||||
Before opening a PR or running pack/dist, please do a code formatting pass:
|
||||
|
||||
```
|
||||
npm run prettier
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT unless specified otherwise
|
||||
|
12
assets/bootstrap/css/bootstrap.min.css
vendored
12
assets/bootstrap/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
30
assets/css/bootstrap.min.css
vendored
Normal file
30
assets/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -47,6 +47,11 @@ img {
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
clear: both;
|
||||
user-select: none;
|
||||
background-color: #000;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||
@@ -129,3 +134,12 @@ button > i {
|
||||
#server-table .server-listing-entry {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#client {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #000;
|
||||
clear: both;
|
||||
}
|
||||
|
BIN
assets/fonts/KFOlCnqEu92Fr1MmWUlvAw.ttf
Normal file
BIN
assets/fonts/KFOlCnqEu92Fr1MmWUlvAw.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/KFOmCnqEu92Fr1Me5Q.ttf
Normal file
BIN
assets/fonts/KFOmCnqEu92Fr1Me5Q.ttf
Normal file
Binary file not shown.
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 176 B |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
@@ -5,7 +5,7 @@ var gameRunning = false;
|
||||
|
||||
// Uncomment and enter credentials to skip login screen
|
||||
function authDoCallback(param) {
|
||||
/*var unity = document.getElementById('Unity_embed');
|
||||
/*var unity = document.getElementById('unityEmbed');
|
||||
unity.SendMessage("GlobalManager", "SetTEGid", "player");
|
||||
unity.SendMessage("GlobalManager", "SetAuthid", "0");
|
||||
unity.SendMessage("GlobalManager", "DoAuth", 0);*/
|
||||
@@ -33,7 +33,7 @@ function PayPage(param) {
|
||||
|
||||
function onResize() {
|
||||
if (gameRunning == true) {
|
||||
var unity = document.getElementById("Unity_embed");
|
||||
var unity = document.getElementById("unityEmbed");
|
||||
unity.style.width = window.innerWidth + "px";
|
||||
unity.style.height = window.innerHeight + "px";
|
||||
}
|
||||
@@ -56,38 +56,29 @@ function launchGame() {
|
||||
"codebase",
|
||||
"undefined/UnityWebPlayer.cab#version=2,0,0,0"
|
||||
);
|
||||
object.setAttribute("id", "Unity_object");
|
||||
object.setAttribute("id", "unityObject");
|
||||
object.setAttribute("width", "1264");
|
||||
object.setAttribute("height", "661");
|
||||
|
||||
var embed = document.createElement("embed");
|
||||
embed.setAttribute("type", "application/vnd.unity");
|
||||
embed.setAttribute("type", "application/vnd.ffuwp");
|
||||
embed.setAttribute(
|
||||
"pluginspage",
|
||||
"http://www.unity3d.com/unity-web-player-2.x"
|
||||
);
|
||||
embed.setAttribute("id", "Unity_embed");
|
||||
embed.setAttribute("id", "unityEmbed");
|
||||
embed.setAttribute("width", "1280");
|
||||
embed.setAttribute("height", "680");
|
||||
embed.setAttribute("src", window.asseturl + "main.unity3d");
|
||||
embed.setAttribute("disablecontdparaextmenu", "true");
|
||||
embed.setAttribute("src", window.assetUrl + "main.unity3d");
|
||||
embed.setAttribute("bordercolor", "000000");
|
||||
embed.setAttribute("backgroundcolor", "000000");
|
||||
embed.setAttribute("disableContextMenu", true);
|
||||
embed.setAttribute("textcolor", "ccffff");
|
||||
embed.setAttribute("logoimage", "assets/img/unity_dexlabs.png");
|
||||
embed.setAttribute("progressbarimage", "assets/img/unity_loadingbar.png");
|
||||
embed.setAttribute("logoimage", "assets/img/unity-dexlabs.png");
|
||||
embed.setAttribute("progressbarimage", "assets/img/unity-loadingbar.png");
|
||||
embed.setAttribute(
|
||||
"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"
|
||||
"assets/img/unity-loadingframe.png"
|
||||
);
|
||||
|
||||
var div = document.getElementById("client");
|
@@ -2,9 +2,9 @@ var remote = require("remote");
|
||||
var remotefs = remote.require("fs-extra");
|
||||
var dns = remote.require("dns");
|
||||
|
||||
var userdir = remote.require("app").getPath("userData");
|
||||
var versionarray;
|
||||
var serverarray;
|
||||
var userDir = remote.require("app").getPath("userData");
|
||||
var versionArray;
|
||||
var serverArray;
|
||||
var config;
|
||||
|
||||
function enableServerListButtons() {
|
||||
@@ -26,14 +26,14 @@ function disableServerListButtons() {
|
||||
}
|
||||
|
||||
function getAppVersion() {
|
||||
appversion = remote.require("app").getVersion();
|
||||
appVersion = remote.require("app").getVersion();
|
||||
|
||||
// simplify version, ex. 1.4.0 -> 1.4,
|
||||
// but only if a revision number isn't present
|
||||
if (appversion.endsWith(".0")) {
|
||||
return appversion.substr(0, appversion.length - 2);
|
||||
if (appVersion.endsWith(".0")) {
|
||||
return appVersion.substr(0, appVersion.length - 2);
|
||||
} else {
|
||||
return appversion;
|
||||
return appVersion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ function setAppVersionText() {
|
||||
}
|
||||
|
||||
function addServer() {
|
||||
var jsontomodify = JSON.parse(
|
||||
remotefs.readFileSync(userdir + "\\servers.json")
|
||||
var jsonToModify = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
);
|
||||
|
||||
var server = {};
|
||||
@@ -60,20 +60,20 @@ function addServer() {
|
||||
server["version"] = $("#addserver-versionselect option:selected").text();
|
||||
//server['endpoint'] =
|
||||
|
||||
jsontomodify["servers"].push(server);
|
||||
jsonToModify["servers"].push(server);
|
||||
|
||||
remotefs.writeFileSync(
|
||||
userdir + "\\servers.json",
|
||||
JSON.stringify(jsontomodify, null, 4)
|
||||
userDir + "\\servers.json",
|
||||
JSON.stringify(jsonToModify, null, 4)
|
||||
);
|
||||
loadServerList();
|
||||
}
|
||||
|
||||
function editServer() {
|
||||
var jsontomodify = JSON.parse(
|
||||
remotefs.readFileSync(userdir + "\\servers.json")
|
||||
var jsonToModify = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
);
|
||||
$.each(jsontomodify["servers"], function (key, value) {
|
||||
$.each(jsonToModify["servers"], function (key, value) {
|
||||
if (value["uuid"] == getSelectedServer()) {
|
||||
value["description"] =
|
||||
$("#editserver-descinput").val().length == 0
|
||||
@@ -90,27 +90,27 @@ function editServer() {
|
||||
});
|
||||
|
||||
remotefs.writeFileSync(
|
||||
userdir + "\\servers.json",
|
||||
JSON.stringify(jsontomodify, null, 4)
|
||||
userDir + "\\servers.json",
|
||||
JSON.stringify(jsonToModify, null, 4)
|
||||
);
|
||||
loadServerList();
|
||||
}
|
||||
|
||||
function deleteServer() {
|
||||
var jsontomodify = JSON.parse(
|
||||
remotefs.readFileSync(userdir + "\\servers.json")
|
||||
var jsonToModify = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
);
|
||||
var result = jsontomodify["servers"].filter(function (obj) {
|
||||
var result = jsonToModify["servers"].filter(function (obj) {
|
||||
return obj.uuid === getSelectedServer();
|
||||
})[0];
|
||||
|
||||
var resultindex = jsontomodify["servers"].indexOf(result);
|
||||
var resultindex = jsonToModify["servers"].indexOf(result);
|
||||
|
||||
jsontomodify["servers"].splice(resultindex, 1);
|
||||
jsonToModify["servers"].splice(resultindex, 1);
|
||||
|
||||
remotefs.writeFileSync(
|
||||
userdir + "\\servers.json",
|
||||
JSON.stringify(jsontomodify, null, 4)
|
||||
userDir + "\\servers.json",
|
||||
JSON.stringify(jsonToModify, null, 4)
|
||||
);
|
||||
loadServerList();
|
||||
}
|
||||
@@ -118,17 +118,17 @@ function deleteServer() {
|
||||
function restoreDefaultServers() {
|
||||
remotefs.copySync(
|
||||
__dirname + "\\defaults\\servers.json",
|
||||
userdir + "\\servers.json"
|
||||
userDir + "\\servers.json"
|
||||
);
|
||||
loadServerList();
|
||||
}
|
||||
|
||||
function loadGameVersions() {
|
||||
var versionjson = JSON.parse(
|
||||
remotefs.readFileSync(userdir + "\\versions.json")
|
||||
var versionJson = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\versions.json")
|
||||
);
|
||||
versionarray = versionjson["versions"];
|
||||
$.each(versionarray, function (key, value) {
|
||||
versionArray = versionJson["versions"];
|
||||
$.each(versionArray, function (key, value) {
|
||||
$(new Option(value.name, "val")).appendTo("#addserver-versionselect");
|
||||
$(new Option(value.name, "val")).appendTo("#editserver-versionselect");
|
||||
});
|
||||
@@ -136,22 +136,22 @@ function loadGameVersions() {
|
||||
|
||||
function loadConfig() {
|
||||
// load config object globally
|
||||
config = JSON.parse(remotefs.readFileSync(userdir + "\\config.json"));
|
||||
config = JSON.parse(remotefs.readFileSync(userDir + "\\config.json"));
|
||||
}
|
||||
|
||||
function loadServerList() {
|
||||
var serverjson = JSON.parse(
|
||||
remotefs.readFileSync(userdir + "\\servers.json")
|
||||
var serverJson = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
);
|
||||
serverarray = serverjson["servers"];
|
||||
serverArray = serverJson["servers"];
|
||||
|
||||
$(".server-listing-entry").remove(); // Clear out old stuff, if any
|
||||
disableServerListButtons(); // Disable buttons until another server is selected
|
||||
|
||||
if (serverarray.length > 0) {
|
||||
if (serverArray.length > 0) {
|
||||
// Servers were found in the JSON
|
||||
$("#server-listing-placeholder").attr("hidden", true);
|
||||
$.each(serverarray, function (key, value) {
|
||||
$.each(serverArray, function (key, value) {
|
||||
// Create the row, and populate the cells
|
||||
var row = document.createElement("tr");
|
||||
row.className = "server-listing-entry";
|
||||
@@ -172,25 +172,25 @@ function loadServerList() {
|
||||
}
|
||||
}
|
||||
|
||||
function performCacheSwap(newversion) {
|
||||
var cacheroot = userdir + "\\..\\..\\LocalLow\\Unity\\Web Player\\Cache";
|
||||
var currentcache = cacheroot + "\\Fusionfall";
|
||||
var newcache = cacheroot + "\\" + newversion;
|
||||
var record = userdir + "\\.lastver";
|
||||
function performCacheSwap(newVersion) {
|
||||
var cacheRoot = userDir + "\\..\\..\\LocalLow\\Unity\\Web Player\\Cache";
|
||||
var currentCache = cacheRoot + "\\Fusionfall";
|
||||
var newCache = cacheRoot + "\\" + newVersion;
|
||||
var record = userDir + "\\.lastver";
|
||||
|
||||
// if cache renaming would result in a no-op (ex. launching the same version
|
||||
// two times), then skip it. this avoids permissions errors with multiple clients
|
||||
// (file/folder is already open in another process)
|
||||
var skip = false;
|
||||
|
||||
if (remotefs.existsSync(currentcache)) {
|
||||
if (remotefs.existsSync(currentCache)) {
|
||||
// cache already exists, find out what version it belongs to
|
||||
if (remotefs.existsSync(record)) {
|
||||
lastversion = remotefs.readFileSync(record);
|
||||
if (lastversion != newversion) {
|
||||
lastVersion = remotefs.readFileSync(record);
|
||||
if (lastVersion != newVersion) {
|
||||
remotefs.renameSync(
|
||||
currentcache,
|
||||
cacheroot + "\\" + lastversion
|
||||
currentCache,
|
||||
cacheRoot + "\\" + lastVersion
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
@@ -198,7 +198,7 @@ function performCacheSwap(newversion) {
|
||||
);
|
||||
skip = true;
|
||||
}
|
||||
console.log("Current cache is " + lastversion);
|
||||
console.log("Current cache is " + lastVersion);
|
||||
} else {
|
||||
console.log(
|
||||
"Couldn't find last version record; cache may get overwritten"
|
||||
@@ -206,29 +206,29 @@ function performCacheSwap(newversion) {
|
||||
}
|
||||
}
|
||||
|
||||
if (remotefs.existsSync(newcache) || !skip) {
|
||||
if (remotefs.existsSync(newCache) || !skip) {
|
||||
// rename saved cache to FusionFall
|
||||
remotefs.renameSync(newcache, currentcache);
|
||||
console.log("Current cache swapped to " + newversion);
|
||||
remotefs.renameSync(newCache, currentCache);
|
||||
console.log("Current cache swapped to " + newVersion);
|
||||
}
|
||||
|
||||
// make note of what version we are launching for next launch
|
||||
remotefs.writeFileSync(record, newversion);
|
||||
remotefs.writeFileSync(record, newVersion);
|
||||
}
|
||||
|
||||
// For writing loginInfo.php, assetInfo.php, etc.
|
||||
function setGameInfo(serverUUID) {
|
||||
var result = serverarray.filter(function (obj) {
|
||||
var result = serverArray.filter(function (obj) {
|
||||
return obj.uuid === serverUUID;
|
||||
})[0];
|
||||
var gameversion = versionarray.filter(function (obj) {
|
||||
var gameVersion = versionArray.filter(function (obj) {
|
||||
return obj.name === result.version;
|
||||
})[0];
|
||||
|
||||
// if cache swapping property exists AND is `true`, run cache swapping logic
|
||||
if (config["cache-swapping"]) {
|
||||
try {
|
||||
performCacheSwap(gameversion.name);
|
||||
performCacheSwap(gameVersion.name);
|
||||
} catch (ex) {
|
||||
console.log(
|
||||
"Error when swapping cache, it may get overwritten:\n" + ex
|
||||
@@ -236,23 +236,23 @@ function setGameInfo(serverUUID) {
|
||||
}
|
||||
}
|
||||
|
||||
window.asseturl = gameversion.url; // gameclient.js needs to access this
|
||||
window.assetUrl = gameVersion.url; // game-client.js needs to access this
|
||||
|
||||
remotefs.writeFileSync(__dirname + "\\assetInfo.php", asseturl);
|
||||
remotefs.writeFileSync(__dirname + "\\assetInfo.php", assetUrl);
|
||||
if (result.hasOwnProperty("endpoint")) {
|
||||
var httpendpoint = result.endpoint.replace("https://", "http://");
|
||||
var httpEndpoint = result.endpoint.replace("https://", "http://");
|
||||
remotefs.writeFileSync(
|
||||
__dirname + "\\rankurl.txt",
|
||||
httpendpoint + "getranks"
|
||||
httpEndpoint + "getranks"
|
||||
);
|
||||
// Write these out too
|
||||
remotefs.writeFileSync(
|
||||
__dirname + "\\sponsor.php",
|
||||
httpendpoint + "upsell/sponsor.png"
|
||||
httpEndpoint + "upsell/sponsor.png"
|
||||
);
|
||||
remotefs.writeFileSync(
|
||||
__dirname + "\\images.php",
|
||||
httpendpoint + "upsell/"
|
||||
httpEndpoint + "upsell/"
|
||||
);
|
||||
} else {
|
||||
// Remove/default the endpoint related stuff, this server won't be using it
|
||||
@@ -280,10 +280,10 @@ function setGameInfo(serverUUID) {
|
||||
|
||||
// DNS resolution. there is no synchronous version for some stupid reason
|
||||
if (!address.match(/^[0-9.]+$/))
|
||||
dns.resolve4(address, function (err, res) {
|
||||
dns.lookup(address, family=4, function (err, resolvedAddress) {
|
||||
if (!err) {
|
||||
console.log("Resolved " + address + " to " + res[0]);
|
||||
address = res[0];
|
||||
console.log("Resolved " + address + " to " + resolvedAddress);
|
||||
address = resolvedAddress;
|
||||
} else {
|
||||
console.log("Err: " + err.code);
|
||||
}
|
||||
@@ -341,10 +341,10 @@ $("#server-table").on("dblclick", ".server-listing-entry", function (event) {
|
||||
});
|
||||
|
||||
$("#of-editservermodal").on("show.bs.modal", function (e) {
|
||||
var jsontomodify = JSON.parse(
|
||||
remotefs.readFileSync(userdir + "\\servers.json")
|
||||
var jsonToModify = JSON.parse(
|
||||
remotefs.readFileSync(userDir + "\\servers.json")
|
||||
);
|
||||
$.each(jsontomodify["servers"], function (key, value) {
|
||||
$.each(jsonToModify["servers"], function (key, value) {
|
||||
if (value["uuid"] == getSelectedServer()) {
|
||||
$("#editserver-descinput")[0].value = value["description"];
|
||||
$("#editserver-ipinput")[0].value = value["ip"];
|
||||
@@ -361,7 +361,7 @@ $("#of-editservermodal").on("show.bs.modal", function (e) {
|
||||
});
|
||||
|
||||
$("#of-deleteservermodal").on("show.bs.modal", function (e) {
|
||||
var result = serverarray.filter(function (obj) {
|
||||
var result = serverArray.filter(function (obj) {
|
||||
return obj.uuid === getSelectedServer();
|
||||
})[0];
|
||||
$("#deleteserver-servername").html(result.description);
|
8
build/OpenFusionClient.exe.manifest
Normal file
8
build/OpenFusionClient.exe.manifest
Normal file
@@ -0,0 +1,8 @@
|
||||
<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>
|
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
</dict>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.5.2f2</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>4c6ee796dacc</string>
|
||||
</dict>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
</dict>
|
||||
</plist>
|
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
<key>monoVersion</key>
|
||||
<string>fusion-2.x.x</string>
|
||||
<key>monoMinimumRevision</key>
|
||||
<string>2.0.0f6</string>
|
||||
</dict>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist>
|
||||
<dict>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5.5b4</string>
|
||||
<key>UnityBuildNumber</key>
|
||||
<string>50</string>
|
||||
<key>monoVersion</key>
|
||||
<string>fusion-2.x.x</string>
|
||||
<key>monoMinimumRevision</key>
|
||||
<string>2.0.0f6</string>
|
||||
</dict>
|
||||
</plist>
|
@@ -1,16 +1,16 @@
|
||||
const fs = require('fs');
|
||||
const defaultdir = './dist/win-ia32-unpacked/resources/default_app'
|
||||
const exefile = './dist/win-ia32-unpacked/OpenFusionClient.exe'
|
||||
const defaultDir = './dist/win-ia32-unpacked/resources/default_app'
|
||||
const exeFile = './dist/win-ia32-unpacked/OpenFusionClient.exe'
|
||||
|
||||
exports.default = function() {
|
||||
// remove leftover files from default electron app
|
||||
fs.rm(defaultdir, { recursive: true }, (err) => {
|
||||
fs.rm(defaultDir, { recursive: true }, (err) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
// patch executable for large address awareness
|
||||
fs.open(exefile, "r+", (err, fd) => {
|
||||
fs.open(exeFile, "r+", (err, fd) => {
|
||||
if(!err) {
|
||||
fs.write(
|
||||
fd, new Uint8Array([0x22]), 0, 1, 0x166,
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
39
index.html
39
index.html
@@ -3,27 +3,18 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, shrink-to-fit=no"
|
||||
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/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="assets/fonts/fontawesome-all.min.css" />
|
||||
<link rel="stylesheet" href="assets/css/openfusion.css" />
|
||||
<link rel="stylesheet" href="assets/css/styles.css" />
|
||||
</head>
|
||||
|
||||
<body
|
||||
style="
|
||||
background: rgb(0, 0, 0);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
clear: both;
|
||||
"
|
||||
onresize="onResize()"
|
||||
>
|
||||
<body onresize="onResize()">
|
||||
<section id="of-serverselector">
|
||||
<div class="container" id="serverselector-container">
|
||||
<div class="row text-center mt-3" id="of-logoheader">
|
||||
@@ -464,28 +455,18 @@
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<div
|
||||
id="client"
|
||||
style="
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #000;
|
||||
clear: both;
|
||||
"
|
||||
></div>
|
||||
<div id="client"></div>
|
||||
</section>
|
||||
<script
|
||||
src="assets/js/jquery.min.js"
|
||||
onload="window.$ = window.jQuery = module.exports;"
|
||||
></script>
|
||||
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="assets/js/bootstrap.min.js"></script>
|
||||
<script src="assets/js/bs-init.js"></script>
|
||||
<script src="assets/js/uuidv4.min.js"></script>
|
||||
<script src="assets/js/serverselector.js"></script>
|
||||
<script src="assets/js/gameclient.js"></script>
|
||||
<script src="assets/js/server-selector.js"></script>
|
||||
<script src="assets/js/game-client.js"></script>
|
||||
<script src="assets/js/snowflakes.min.js"></script>
|
||||
<script src="assets/js/eastereggs.js"></script>
|
||||
<script src="assets/js/easter-eggs.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
165
index.js
165
index.js
@@ -6,51 +6,18 @@ var dialog = require("dialog");
|
||||
var BrowserWindow = require("browser-window");
|
||||
|
||||
var mainWindow = null;
|
||||
app.commandLine.appendSwitch("enable-npapi");
|
||||
app.commandLine.appendSwitch("no-proxy-server");
|
||||
|
||||
app.commandLine.appendSwitch("--enable-npapi");
|
||||
|
||||
function verifyUnity() {
|
||||
var dllpath =
|
||||
app.getPath("appData") +
|
||||
"\\..\\LocalLow\\Unity\\WebPlayer\\player\\fusion-2.x.x\\webplayer_win.dll";
|
||||
|
||||
if (fs.existsSync(dllpath)) {
|
||||
var buff = fs.readFileSync(dllpath);
|
||||
var hash = require("crypto")
|
||||
.createHash("md5")
|
||||
.update(buff)
|
||||
.digest("hex");
|
||||
if (hash == "e5028405b4483de9e5e5fe9cd5f1e98f") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
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";
|
||||
}
|
||||
|
||||
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 dstfolder =
|
||||
app.getPath("appData") + "\\..\\LocalLow\\Unity\\WebPlayer";
|
||||
fs.copySync(utilsdir + "\\WebPlayer", dstfolder, { clobber: true });
|
||||
// avoids error reporter popping up when closing Electron
|
||||
fs.removeSync(dstfolder + "\\UnityBugReporter.exe");
|
||||
console.log("Unity Web Player installed successfully.");
|
||||
callback();
|
||||
});
|
||||
}
|
||||
process.env["UNITY_HOME_DIR"] = unityHomeDir;
|
||||
process.env["UNITY_DISABLE_PLUGIN_UPDATES"] = "yes";
|
||||
|
||||
function initialSetup(firstTime) {
|
||||
// Display a small window to inform the user that the app is working
|
||||
@@ -61,46 +28,41 @@ function initialSetup(firstTime) {
|
||||
center: true,
|
||||
frame: false,
|
||||
});
|
||||
setupWindow.loadUrl("file://" + __dirname + "/initialsetup.html");
|
||||
installUnity(function () {
|
||||
if (!firstTime) {
|
||||
// migration from pre-1.4
|
||||
// Back everything up, just in case
|
||||
fs.copySync(
|
||||
app.getPath("userData") + "\\config.json",
|
||||
app.getPath("userData") + "\\config.json.bak"
|
||||
);
|
||||
fs.copySync(
|
||||
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",
|
||||
app.getPath("userData") + "\\servers.json"
|
||||
);
|
||||
}
|
||||
|
||||
// Copy default versions and config
|
||||
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(
|
||||
__dirname + "\\defaults\\versions.json",
|
||||
app.getPath("userData") + "\\versions.json"
|
||||
userData + "\\servers.json",
|
||||
userData + "\\servers.json.bak"
|
||||
);
|
||||
fs.copySync(
|
||||
__dirname + "\\defaults\\config.json",
|
||||
app.getPath("userData") + "\\config.json"
|
||||
userData + "\\versions.json",
|
||||
userData + "\\versions.json.bak"
|
||||
);
|
||||
} else {
|
||||
// first-time setup
|
||||
// Copy default servers
|
||||
fs.copySync(
|
||||
__dirname + "\\defaults\\servers.json",
|
||||
userData + "\\servers.json"
|
||||
);
|
||||
}
|
||||
|
||||
console.log("JSON files copied.");
|
||||
setupWindow.destroy();
|
||||
showMainWindow();
|
||||
});
|
||||
// Copy default versions and config
|
||||
fs.copySync(
|
||||
__dirname + "\\defaults\\versions.json",
|
||||
userData + "\\versions.json"
|
||||
);
|
||||
fs.copySync(
|
||||
__dirname + "\\defaults\\config.json",
|
||||
userData + "\\config.json"
|
||||
);
|
||||
|
||||
console.log("JSON files copied.");
|
||||
setupWindow.destroy();
|
||||
showMainWindow();
|
||||
}
|
||||
|
||||
ipc.on("exit", function (id) {
|
||||
@@ -114,26 +76,28 @@ app.on("window-all-closed", function () {
|
||||
|
||||
app.on("ready", function () {
|
||||
// Check just in case the user forgot to extract the zip.
|
||||
zip_check = app.getPath("exe").includes(os.tmpdir());
|
||||
if (zip_check) {
|
||||
errormsg =
|
||||
zipCheck = app.getPath("exe").includes(os.tmpdir());
|
||||
if (zipCheck) {
|
||||
var errorMessage =
|
||||
"It has been detected that OpenFusionClient is running from the TEMP folder.\n\n" +
|
||||
"Please extract the entire Client folder to a location of your choice before starting OpenFusionClient.";
|
||||
dialog.showErrorBox("Error!", errormsg);
|
||||
dialog.showErrorBox("Error!", errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 1280,
|
||||
height: 720,
|
||||
show: false,
|
||||
"web-preferences": { plugins: true },
|
||||
"web-preferences": {
|
||||
plugins: true,
|
||||
"extra-plugin-dirs": [unityHomeDir + "\\loader"],
|
||||
},
|
||||
});
|
||||
mainWindow.setMinimumSize(640, 480);
|
||||
|
||||
// Check for first run
|
||||
var configPath = app.getPath("userData") + "\\config.json";
|
||||
var configPath = userData + "\\config.json";
|
||||
try {
|
||||
if (!fs.existsSync(configPath)) {
|
||||
console.log("Config file not found. Running initial setup.");
|
||||
@@ -144,20 +108,20 @@ app.on("ready", function () {
|
||||
console.log("Pre-1.4 config detected. Running migration.");
|
||||
initialSetup(false);
|
||||
} else {
|
||||
if (verifyUnity()) {
|
||||
showMainWindow();
|
||||
} else {
|
||||
installUnity(showMainWindow);
|
||||
}
|
||||
showMainWindow();
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
console.log("An error occurred while checking for the config");
|
||||
dialog.showErrorBox(
|
||||
"Error!",
|
||||
"An error occurred while checking for the config. Make sure you have sufficent permissions."
|
||||
);
|
||||
app.quit();
|
||||
}
|
||||
|
||||
// Makes it so external links are opened in the system browser, not Electron
|
||||
mainWindow.webContents.on("new-window", function (e, url) {
|
||||
e.preventDefault();
|
||||
mainWindow.webContents.on("new-window", function (event, url) {
|
||||
event.preventDefault();
|
||||
require("shell").openExternal(url);
|
||||
});
|
||||
|
||||
@@ -181,19 +145,24 @@ function showMainWindow() {
|
||||
});
|
||||
|
||||
mainWindow.webContents.on("plugin-crashed", function () {
|
||||
console.log("Unity Web Player crashed.");
|
||||
var errorMessage =
|
||||
"Unity Web Player has crashed - please re-open the application.\n" +
|
||||
"If this error persists, please read the FAQ or ask for support in our Discord server.";
|
||||
dialog.showErrorBox("Error!", errorMessage);
|
||||
mainWindow.destroy();
|
||||
app.quit();
|
||||
});
|
||||
|
||||
mainWindow.webContents.on("will-navigate", function (evt, url) {
|
||||
evt.preventDefault();
|
||||
mainWindow.webContents.on("will-navigate", function (event, url) {
|
||||
event.preventDefault();
|
||||
// TODO: showMessageBox rather than showErrorBox?
|
||||
switch (url) {
|
||||
case "https://audience.fusionfall.com/ff/regWizard.do?_flowId=fusionfall-registration-flow":
|
||||
errormsg =
|
||||
var errorMessage =
|
||||
"The register page is currently unimplemented.\n\n" +
|
||||
'You can still create an account: type your desired username and password into the provided boxes and click "Log In". ' +
|
||||
"Your account will then be automatically created on the server. \nBe sure to remember these details!";
|
||||
dialog.showErrorBox("Sorry!", errormsg);
|
||||
dialog.showErrorBox("Sorry!", errorMessage);
|
||||
break;
|
||||
case "https://audience.fusionfall.com/ff/login.do":
|
||||
dialog.showErrorBox(
|
||||
@@ -205,7 +174,7 @@ function showMainWindow() {
|
||||
require("shell").openExternal("https://discord.gg/DYavckB");
|
||||
break;
|
||||
default:
|
||||
mainWindow.loadURL(url);
|
||||
mainWindow.loadUrl(url);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "OpenFusionClient",
|
||||
"version": "1.4.1",
|
||||
"version": "1.4.2",
|
||||
"description": "OpenFusionClient",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -63,11 +63,15 @@
|
||||
"extraFiles": [
|
||||
"LICENSE.md",
|
||||
{
|
||||
"from": "build/utils",
|
||||
"to": "utils"
|
||||
"from": "build/OpenFusionClient.exe.manifest",
|
||||
"to": "OpenFusionClient.exe.manifest"
|
||||
},
|
||||
{
|
||||
"from": "build/WebPlayer",
|
||||
"to": "WebPlayer"
|
||||
}
|
||||
],
|
||||
"afterPack": "./build/afterpack.js"
|
||||
"afterPack": "./build/after-pack.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-extra": "2.0.0"
|
||||
|
Reference in New Issue
Block a user