mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-20 10:56:30 +00:00
lots of stuff
This commit is contained in:
parent
63e5603f9f
commit
fa153ba767
17 changed files with 1854 additions and 374 deletions
|
@ -6,3 +6,47 @@ This is a note, All core files (files that end with `.data`) are compiled versio
|
|||
Changes from the original software can be viewed [here](https://github.com/ethanaobrien/RetroArch).
|
||||
|
||||
All core files are licensed with the GNU General Public License version 3.0
|
||||
|
||||
|
||||
### compiling the cores
|
||||
|
||||
I have only ever gotten this to work on ubuntu.
|
||||
|
||||
|
||||
First, install dependencies
|
||||
|
||||
```
|
||||
sudo apt install -y binutils-mips-linux-gnu build-essential git pkgconf python3
|
||||
```
|
||||
|
||||
To build wasm:
|
||||
|
||||
clone the repository
|
||||
|
||||
```
|
||||
git clone https://github.com/ethanaobrien/RetroArch.git
|
||||
```
|
||||
|
||||
then, navigate to the `/dist-scripts/` direcotry, then, from here run
|
||||
|
||||
```
|
||||
emmake ./dist-cores.sh emscripten
|
||||
```
|
||||
|
||||
to build files to build the wasm:
|
||||
|
||||
clone the repository
|
||||
|
||||
```
|
||||
git clone https://github.com/libretro/libretro-fceumm.git
|
||||
```
|
||||
|
||||
then, enter whatever directory the Makefile.libretro is located in (there may not be a Makefile.libretro). In this case it is the base directory
|
||||
|
||||
then, run
|
||||
```
|
||||
emmake make -f Makefile.libretro platform=emscripten
|
||||
```
|
||||
if there is no Makefile.libretro file, then remove `-f Makefile.libretro`
|
||||
|
||||
Then, copy the `.bc` file to the dist-cores directory (see above)
|
||||
|
|
1566
data/emu-css.css
Normal file
1566
data/emu-css.css
Normal file
File diff suppressed because it is too large
Load diff
1
data/emu-css.min.css
vendored
Normal file
1
data/emu-css.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -602,8 +602,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
|
|||
},
|
||||
_0x5bb4c9 = _0x2c1832(0x39),
|
||||
_0x50f370 = _0x2c1832.n(_0x5bb4c9),
|
||||
_0x246d02 = _0x2c1832(0xb),
|
||||
_0x550f17 = _0x2c1832.n(_0x246d02).a,
|
||||
_0x550f17 = _0x2c1832(0xb),
|
||||
_0x5ab74d = {
|
||||
'addStyleHook': function() {
|
||||
_0x3a8e2f(this.elements.container, this.config.selectors.container.replace('.', ''), true), _0x3a8e2f(this.elements.container, this.config.classNames.uiSupported, true), _0x3a8e2f(this.elements.container, this.config.classNames.hideControls, true);
|
||||
|
@ -626,39 +625,6 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
|
|||
}
|
||||
}
|
||||
};
|
||||
_0x550f17.a.get = function(oldGet) {
|
||||
return function(url, set) {
|
||||
if (url.startsWith('blob:')) {
|
||||
return new Promise(async function(resolve, reject) {
|
||||
var a = await fetch(url);
|
||||
if (set && set.responseType && set.responseType.toLowerCase() === 'arraybuffer') {
|
||||
a = await a.arrayBuffer();
|
||||
} else {
|
||||
a = await a.text();
|
||||
try {
|
||||
a = JSON.parse(a);
|
||||
} catch(e) {}
|
||||
}
|
||||
resolve({data:a});
|
||||
})
|
||||
} else {
|
||||
return oldGet.apply(null, arguments);
|
||||
}
|
||||
}
|
||||
}(_0x550f17.a.get);
|
||||
_0x550f17.a.head = function(oldHead) {
|
||||
return function(url) {
|
||||
if (url.startsWith('blob:')) {
|
||||
return new Promise(async function(resolve, reject) {
|
||||
var a = await fetch(url);
|
||||
a = await a.arrayBuffer();
|
||||
resolve({headers:{'content-length': a.size}});
|
||||
})
|
||||
} else {
|
||||
return oldHead.apply(null, arguments);
|
||||
}
|
||||
}
|
||||
}(_0x550f17.a.head);
|
||||
|
||||
function _0x5272a8(_0x4d422a) {
|
||||
return (_0x5272a8 = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function(_0x241239) {
|
||||
|
@ -1187,11 +1153,6 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
|
|||
}
|
||||
}
|
||||
var _0x18a437 = window.URL || window.webkitURL;
|
||||
_0x550f17.a.interceptors.request.use(function(_0x1cd992) {
|
||||
return _0x1cd992.headers['Content-Type'] = 'application/x-www-form-urlencoded', 'options' === _0x1cd992.method.toLowerCase() && (_0x1cd992.method = 'get'), _0x1cd992;
|
||||
}, function(_0x5150c8) {
|
||||
return Promise.reject(_0x5150c8);
|
||||
});
|
||||
var _0x394c59 = function(_0x571737) {
|
||||
var _0x17edbf;
|
||||
return 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x3 === _0x571737[0x2] && 0x4 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x5 === _0x571737[0x2] && 0x6 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x50 === _0x571737[0x0] && 0x4b === _0x571737[0x1] && 0x7 === _0x571737[0x2] && 0x8 === _0x571737[0x3] ? _0x17edbf = 'zip' : 0x37 === _0x571737[0x0] && 0x7a === _0x571737[0x1] && 0xbc === _0x571737[0x2] && 0xaf === _0x571737[0x3] && 0x27 === _0x571737[0x4] && 0x1c === _0x571737[0x5] ? _0x17edbf = '7z' : 0x52 === _0x571737[0x0] && 0x61 === _0x571737[0x1] && 0x72 === _0x571737[0x2] && 0x21 === _0x571737[0x3] && 0x1a === _0x571737[0x4] && 0x7 === _0x571737[0x5] && 0x0 == _0x571737[0x6] && (_0x17edbf = 'rar'), _0x17edbf;
|
||||
|
@ -1285,9 +1246,12 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
|
|||
_0x3a8e2f(_0x10efa5, _0x2c1832, !0x1);
|
||||
}, 0x1388)
|
||||
if (typeof _0xc6823.adUrl === 'string') {
|
||||
_0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['close-ad'])), !0x1), setTimeout(function() {
|
||||
_0xc6823.started && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)) && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).parentNode.removeChild(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)));
|
||||
}, 0x2710)
|
||||
_0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['close-ad'])), !0x1);
|
||||
if (_0xc6823.config.noAutoAdClose !== true) {
|
||||
setTimeout(function() {
|
||||
_0xc6823.started && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)) && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).parentNode.removeChild(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)));
|
||||
}, 0x2710)
|
||||
}
|
||||
}
|
||||
_0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true);
|
||||
var _0x30fd44 = _0x5dc0c0(_0x2593da.defaultCoreOptionsValues.call(_0xa88a13), _0x2593da.storage.get('core-options') || {});
|
||||
|
@ -2043,7 +2007,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
|
|||
var _0xa88a13, _0x1dedcd = Math.ceil(new Date().valueOf() / 0x3e8);
|
||||
var _0xa88a13 = (_0xc6823.customPaths && typeof _0xc6823.customPaths['v.json'] == 'string') ? _0xc6823.customPaths['v.json'] : (_0xc6823.dataPath + 'v.json?t='+_0x1dedcd);
|
||||
var _0x3641d6 = function(_0x16049b, _0x55a075) {
|
||||
var path = (_0xc6823.customPaths && typeof _0xc6823.customPaths[_0x16049b] == 'string') ? _0xc6823.customPaths[_0x16049b] : ((_0xc6823.coreVer === 2) ? (_0xc6823.dataPath+_0x16049b+'?v='+_0x55a075) : (_0xc6823.dataPath+'old/'+_0x16049b+'?v='+_0x55a075));
|
||||
var path = (_0xc6823.customPaths && typeof _0xc6823.customPaths[_0x16049b] == 'string') ? _0xc6823.customPaths[_0x16049b] : ((_0xc6823.coreVer === 2) ? (_0xc6823.dataPath+'cores/'+_0x16049b+'?v='+_0x55a075) : (_0xc6823.dataPath+'old/'+_0x16049b+'?v='+_0x55a075));
|
||||
_0x550f17.a.get(path, {
|
||||
'onDownloadProgress': function(_0x117e6b) {
|
||||
var _0x55a075 = _0x117e6b.total ? '' .concat(Math.floor(_0x117e6b.loaded / _0x117e6b.total * 0x64), '%') : '';
|
||||
|
|
1
data/emu-min.js
vendored
1
data/emu-min.js
vendored
File diff suppressed because one or more lines are too long
505
data/emulator.js
505
data/emulator.js
File diff suppressed because one or more lines are too long
1
data/emulator.min.js
vendored
Normal file
1
data/emulator.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -14,6 +14,24 @@
|
|||
})
|
||||
}
|
||||
var scriptTag = document.getElementsByTagName('script')[0];
|
||||
function loadStyle(file) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var css = document.createElement('link');
|
||||
css.rel = 'stylesheet';
|
||||
css.href = function() {
|
||||
if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] == 'string') {
|
||||
return EJS_paths[file];
|
||||
} else if ('undefined' != typeof EJS_pathtodata) {
|
||||
if (!EJS_pathtodata.endsWith('/')) EJS_pathtodata+='/';
|
||||
return EJS_pathtodata+file+'?v='+VERSION;
|
||||
} else {
|
||||
return file+'?v='+VERSION;
|
||||
}
|
||||
}();
|
||||
css.onload = resolve;
|
||||
document.head.appendChild(css);
|
||||
})
|
||||
}
|
||||
function loadScript(file) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var script = document.createElement('script');
|
||||
|
@ -21,22 +39,24 @@
|
|||
if ('undefined' != typeof EJS_paths && typeof EJS_paths[file] == 'string') {
|
||||
return EJS_paths[file];
|
||||
} else if ('undefined' != typeof EJS_pathtodata) {
|
||||
if (!EJS_pathtodata.endsWith('/')) EJS_pathtodata+='/';
|
||||
return EJS_pathtodata+file+'?v='+VERSION;
|
||||
} else {
|
||||
return file+'?v='+VERSION;
|
||||
}
|
||||
}();
|
||||
scriptTag.parentNode.insertBefore(script, scriptTag);
|
||||
script.onload = function() {
|
||||
resolve();
|
||||
}
|
||||
script.onload = resolve;
|
||||
})
|
||||
}
|
||||
window.onerror = function(e) {alert(e)}
|
||||
if ('undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX) {
|
||||
await loadStyle('emu-css.css');
|
||||
await loadScript('emu-main.js');
|
||||
await loadScript('emulator.js');
|
||||
} else {
|
||||
await loadScript('emu-min.js');
|
||||
await loadStyle('emu-css.min.css');
|
||||
await loadScript('emulator.min.js');
|
||||
}
|
||||
var config = {};
|
||||
config.gameUrl = EJS_gameUrl;
|
||||
|
@ -52,6 +72,7 @@
|
|||
'undefined' != typeof EJS_core && (config.system = EJS_core);
|
||||
'undefined' != typeof EJS_loadStateURL && (config.loadStateOnStart = EJS_loadStateURL);
|
||||
'undefined' != typeof EJS_language && (config.lang = EJS_language);
|
||||
'undefined' != typeof EJS_noAutoCloseAd && (config.noAutoAdClose = EJS_noAutoCloseAd);
|
||||
'undefined' != typeof EJS_oldEJSNetplayServer && (config.oldNetplayServer = EJS_oldEJSNetplayServer);
|
||||
'undefined' != typeof EJS_BETA && (config.useBeta = EJS_BETA);
|
||||
config.onsavestate = null;
|
||||
|
|
1
data/minify/.gitignore
vendored
Normal file
1
data/minify/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
node_modules/
|
|
@ -1,5 +1,6 @@
|
|||
const UglifyJS = require("uglify-js");
|
||||
const fs = require('fs');
|
||||
const uglifycss = require('uglifycss');
|
||||
|
||||
if (!String.prototype.replaceAll) {
|
||||
String.prototype.replaceAll = function(a, b) {
|
||||
|
@ -14,8 +15,10 @@ function minify(source){
|
|||
var ast = UglifyJS.parse(source);
|
||||
return UglifyJS.minify(ast).code;
|
||||
}
|
||||
console.log('minifying')
|
||||
console.log('minifying');
|
||||
var css = fs.readFileSync('../emu-css.css', 'utf8');
|
||||
fs.writeFileSync('../emu-css.min.css', uglifycss.processString(css));
|
||||
var min = minify(code);
|
||||
console.log('done!')
|
||||
console.log('done!');
|
||||
|
||||
fs.writeFileSync('../emu-min.js', min);
|
||||
fs.writeFileSync('../emulator.min.js', min);
|
||||
|
|
5
data/minify/package-lock.json
generated
5
data/minify/package-lock.json
generated
|
@ -8,6 +8,11 @@
|
|||
"version": "3.15.4",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.4.tgz",
|
||||
"integrity": "sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA=="
|
||||
},
|
||||
"uglifycss": {
|
||||
"version": "0.0.29",
|
||||
"resolved": "https://registry.npmjs.org/uglifycss/-/uglifycss-0.0.29.tgz",
|
||||
"integrity": "sha512-J2SQ2QLjiknNGbNdScaNZsXgmMGI0kYNrXaDlr4obnPW9ni1jljb1NeEVWAiTgZ8z+EBWP2ozfT9vpy03rjlMQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/ethanaobrien/emulatorjs#readme",
|
||||
"dependencies": {
|
||||
"uglify-js": "^3.15.3"
|
||||
"uglify-js": "^3.15.3",
|
||||
"uglifycss": "0.0.29"
|
||||
}
|
||||
}
|
||||
|
|
11
data/minify/readme.md
Normal file
11
data/minify/readme.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
## Minifying
|
||||
|
||||
It is recommended to minify the javascript files before putting them on your server for production. This will make the emulator load faster (and use less bandwidth)
|
||||
|
||||
to minify, first, if you do not have nodejs, please install it from [here](https://nodejs.org/en/download/)
|
||||
|
||||
then, open a terminal window and navigate to the minify directory
|
||||
|
||||
then, run `npm i`
|
||||
|
||||
then, run `node index.js`
|
Loading…
Reference in a new issue