Netplay server!!

This commit is contained in:
Ethan O'Brien 2022-01-13 14:13:07 -06:00
parent e3a85fd0b8
commit 076069ce08
4 changed files with 26 additions and 3 deletions

View file

@ -63,6 +63,17 @@ NETPLAY IS DISABLED BY DEFAULT. To enable, add this line to your code
EJS_gameID = 1; // ID in your website, required for netplay.
```
I have successfully rewrote the server side portion of netplay. You can now self host! To do so:
1. Open https://github.com/ethanaobrien/emuserver and download
2. run `npm install`
3. run `node index.js`
4. Add the following line to your code
```
EJS_netplayUrl = 'http://localhost:3000/'; // Url to netplay server (MUST BE AN ABSOLUTE URL)
```
## Supported systems!

View file

@ -2819,7 +2819,10 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
_0x325651 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-5aa765d61d8327de'),
_0x3d0d28 = {};
_0x378b5c.connection = new _0x4a2390.a();
var _0x10d51e = 'wss://ws.emulatorjs.com/';
var _0x10d51e = _0xa88a13.socketUrl;
if (! _0x10d51e.endsWith('/')) {
_0x10d51e += '/';
};
_0x378b5c.connection.socketURL = '/', _0x378b5c.connection.socketURL = _0x10d51e, _0x378b5c.connection.socketMessageEvent = 'emulatorjs-message', _0x378b5c.connection.socketCustomEvent = 'emulatorjs-custom-message';
var _0xda20e9 = _0x59aa33.info();
_0x378b5c.connection.extra = {
@ -3057,8 +3060,12 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
};
_0x378b5c.loadRoomsList = function() {
_0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), true), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), true);
var listUrl = _0x17edbf.listUrl
if (! listUrl.endsWith('/')) {
listUrl += '/';
};
var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])).querySelector('tbody'),
_0x5cf2be = ['htt', 'ps://ws.emulatorjs.com/list?game_id=', _0x17edbf.config.gameId, '&domain=', document.domain].join('');
_0x5cf2be = [listUrl, 'list?game_id=', _0x17edbf.config.gameId, '&domain=', document.domain].join('');
_0x550f17.a.get(_0x5cf2be, {}).then(function(_0x37c60b) {
if (_0x37c60b.data) {
var _0x4782da = [],
@ -5713,6 +5720,8 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
this.gameName = null,
this.loadStateOnStart = false,
this.statesSupported = true,
this.listUrl = 'https://ws.emulatorjs.com/',
this.socketUrl = 'wss://ws.emulatorjs.com/',
this.startOnLoad = false,
this.dataPath = '',
this.customPaths = null,
@ -5738,6 +5747,8 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
this.multitap = this.config.multitap,
this.cheats = this.config.cheats,
this.cheats || (this.cheats = []),
this.listUrl = this.config.netplayUrl || 'https://ws.emulatorjs.com/',
this.socketUrl = this.config.netplayUrl || 'wss://ws.emulatorjs.com/',
this.color = this.config.color,
this.startOnLoad = this.config.startOnLoad || false,
this.statesSupported = this.config.statesSupported || true,

View file

@ -12824,7 +12824,7 @@ var EJS = function(_0x574f5e) {
for (var _0x55216d in _0x45595f) _0x45595f.hasOwnProperty(_0x55216d) && (_0x3efa0b[_0x55216d] = _0x45595f[_0x55216d]);
return _0x3efa0b;
}(this.query);
_0x3efa0b.EIO = _0x423ddf.protocol, _0x3efa0b.transport = _0x148af1;
_0x3efa0b.EIO = 4, _0x3efa0b.transport = _0x148af1;
var _0x55216d = this.transportOptions[_0x148af1] || {};
return this.id && (_0x3efa0b.sid = this.id), new _0x1fdb83[_0x148af1]({
'query': _0x3efa0b,

View file

@ -45,6 +45,7 @@ emu_main.onload = function() {
'undefined' != typeof EJS_gamePatchUrl && (config.gamePatchUrl = EJS_gamePatchUrl)
'undefined' != typeof EJS_AdUrl && (config.adUrl = EJS_AdUrl)
'undefined' != typeof EJS_paths && (config.paths = EJS_paths)
'undefined' != typeof EJS_netplayUrl && (config.netplayUrl = EJS_netplayUrl)
'undefined' != typeof EJS_startOnLoaded && (config.startOnLoad = EJS_startOnLoaded)
'undefined' != typeof EJS_core && (config.system = EJS_core)
'undefined' != typeof EJS_loadStateURL && (config.loadStateOnStart = EJS_loadStateURL)