diff --git a/data/emu-main.js b/data/emu-main.js
index b270355..7dcd887 100644
--- a/data/emu-main.js
+++ b/data/emu-main.js
@@ -225,10 +225,11 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
}
function _0x455c85(_0x4e4b15) {
- var _0x17edbf = arguments.length > 0x1 && void 0x0 !== arguments[0x1] ? arguments[0x1] : '',
- _0x2c1832 = arguments.length > 0x2 ? arguments[0x2] : void 0x0,
- _0x2b8c91 = !(arguments.length > 0x3 && void 0x0 !== arguments[0x3]) || arguments[0x3],
- _0x23e991 = arguments.length > 0x4 && void 0x0 !== arguments[0x4] && arguments[0x4];
+ var _0x17edbf = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : '',
+ _0x2c1832 = arguments.length > 2 ? arguments[2] : void 0,
+ _0x2b8c91 = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3],
+ _0x23e991 = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
+
_0x1ef215.call(this, _0x4e4b15, _0x17edbf, function _0x5127f4() {
_0x20109b(_0x4e4b15, _0x17edbf, _0x5127f4, _0x2b8c91, _0x23e991);
for (var _0x1fe440 = arguments.length, _0x1d3219 = new Array(_0x1fe440), _0x54457c = 0x0; _0x54457c < _0x1fe440; _0x54457c++) _0x1d3219[_0x54457c] = arguments[_0x54457c];
@@ -963,42 +964,14 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
_0x5a641d = _0x2c1832.n(_0xc778fa),
_0x4d7024 = {
'_FS': {
- 'createPath': function(parent, path, canRead, canWrite) {
+ 'createFolder': function(parent, name, canRead, canWrite) {
if (! _0x4d7024.FS) return;
- if (typeof _0x4d7024.FS.mkdir == 'function') {
- _0x4d7024.FS.mkdir(path);
+ if (typeof _0x4d7024.FS.mkdir == 'function' && window.PATH) {
+ var path = PATH.join2(typeof parent === 'string' ? parent : _0x4d7024.FS.getPath(parent), name);
+ var mode = _0x4d7024.FS.getMode(canRead, canWrite);
+ _0x4d7024.FS.mkdir(path, mode);
} else {
- _0x4d7024.FS.createPath(parent, path, canRead, canWrite);
- }
- },
- 'createDataFile': function(parent, name, data, canRead, canWrite, canOwn) {
- if (! _0x4d7024.FS) return;
- if (typeof _0x4d7024.FS.writeFile == 'function') {
- var path = function(parent, name) {
- if (parent.endsWith('/') || name.startsWith('/')) {
- return parent + name;
- } else {
- return parent + '/' + name;
- }
- }(parent, name);
- _0x4d7024.FS.writeFile(path, data);
- } else {
- _0x4d7024.FS.createDataFile(parent, name, data, canRead, canWrite, canOwn);
- }
- },
- 'createFolder': function(parent, name, a, b) {
- if (! _0x4d7024.FS) return;
- if (typeof _0x4d7024.FS.mkdir == 'function') {
- var path = function(parent, name) {
- if (parent.endsWith('/') || name.startsWith('/')) {
- return parent + name;
- } else {
- return parent + '/' + name;
- }
- }(parent, name);
- _0x4d7024.FS.mkdir(path);
- } else {
- _0x4d7024.FS.createFolder(parent, name, a, b);
+ _0x4d7024.FS.createFolder(parent, name, canRead, canWrite);
}
}
},
@@ -1058,8 +1031,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
'arcade': ['zip'],
'fba0.2.97.29': ['zip'],
'mame2003': ['zip'],
- 'mame': ['zip'],
- 'dos': ['zip']
+ 'mame': ['zip']
},
_0x29078e = {
'psx': 'psx',
@@ -1093,8 +1065,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
'arcade': 'arcade',
'fba0.2.97.29': 'fba0.2.97.29',
'jaguar': 'jaguar',
- 'mame2003': 'mame2003',
- 'dos': 'dos'
+ 'mame2003': 'mame2003'
},
_0xc6823 = this,
_0x1143c5 = _0xc6823.system;
@@ -1442,6 +1413,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
var _0x55627a = _0xa88a13,
_0x1cfda7 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)),
_0x429d6b = (_0x1bc287.split('.').pop(), _0x29078e[_0x1143c5]),
+ _0xb0c5d8 = -1,
_0x567713 = '',
_0x567717 = function() {
if (_0x55627a.coreVer === 2) {
@@ -1511,6 +1483,12 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
if (_0xc6823.coreVer === 2) {
_0x4d7024.Module.resumeMainLoop();
_0x4d7024.Module.setCanvasSize(800, 600);
+ var i=0;
+ var j = setInterval(function() { // some cores have a messed up screen size on load (for example - gba)
+ if (i>20) clearInterval(j);
+ i++;
+ _0x4d7024.Module.setCanvasSize(800, 600);
+ }, 100)
}
_0xbae705.call(_0x55627a, _0x55627a.elements.container, 'start-game');
try{_0x567717();}catch(e){}
@@ -1527,16 +1505,12 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
start(_0x55627a.startName);
}
if (2 === _0x52e6f3.data.t) {
- var _0x1c661d = _0x52e6f3.data.file.replace(/\#/g, '');
- try {
- _0x468801 += _0x52e6f3.data.data.length;
- _0x4d7024._FS.createDataFile('/', _0x1c661d, _0x52e6f3.data.data, true, false);
- if (_0x1e0766[_0x429d6b].includes(_0x52e6f3.data.file.split('.').pop())) {
- _0x55627a.startName = _0x52e6f3.data.file;
- }
- } catch (_0x210043) {
- console.log(_0x210043);
- }
+ var _0x25aae3 = _0x52e6f3.data.file.split('/'),
+ _0x1bc287 = _0x25aae3.pop(),
+ _0x1844e3 = _0x1bc287.split('.').pop();
+ _0x1bc287 = _0x1bc287.replace(/\#/g, ''), _0x4d7024.FS.createPath('/', _0x25aae3.join('/'), true, true);
+ for (var _0x36bace = _0x1e0766[_0x429d6b].length - 0x1; _0x36bace >= 0x0; _0x36bace -= 0x1) _0x1e0766[_0x429d6b][_0x36bace] === _0x1844e3.toLowerCase() && _0x36bace > _0xb0c5d8 && (_0xb0c5d8 = _0x36bace, _0x55627a.startName = ['', _0x25aae3.join('/'), _0x1bc287].join('/'), _0x55627a.startName = _0x55627a.startName.replace(/\/+/, '/'));
+ _0x1bc287 && (_0x4d7024.FS.createDataFile('/' .concat(_0x25aae3.join('/')), _0x1bc287, _0x52e6f3.data.data, true, !0x1), _0x468801 += _0x52e6f3.data.data.length), _0x567713 = '/' .concat(_0x25aae3.join('/'), '/').concat(_0x1bc287);
}
if (4 === _0x52e6f3.data.t && _0x52e6f3.data.total > 0) {
var _0x163fc4 = Math.floor(_0x52e6f3.data.current / _0x52e6f3.data.total * 100),
@@ -1575,7 +1549,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
var _0x1c661d = _0x1bc287.replace(/\#/g, '');
try {
_0x468801 += _0x1844e3.length;
- _0x4d7024._FS.createDataFile('/', _0x1c661d, _0x1844e3, true, false);
+ _0x4d7024.FS.createDataFile('/', _0x1c661d, _0x1844e3, true, false);
} catch (_0x210043) {
console.log(_0x210043);
}
@@ -1717,7 +1691,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
var _0x17edbf = _0x36004e.data.file.split('/'),
_0x2c1832 = _0x17edbf.pop(),
_0x2b320e = _0x2c1832.split('.').pop();
- _0x4d7024._FS.createPath('/', _0x17edbf.join('/'), true, true), _0x4d7024._FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x36004e.data.data, true, !0x1), _0x468801 += _0x36004e.data.data.length, ['ips', 'bps', 'ups'].includes(_0x2b320e) && !_0x4d7024.gamePatch && (_0x4d7024.gamePatch = '/' + _0x17edbf.join('/') + '/' + _0x2c1832);
+ _0x4d7024.FS.createPath('/', _0x17edbf.join('/'), true, true), _0x4d7024.FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x36004e.data.data, true, !0x1), _0x468801 += _0x36004e.data.data.length, ['ips', 'bps', 'ups'].includes(_0x2b320e) && !_0x4d7024.gamePatch && (_0x4d7024.gamePatch = '/' + _0x17edbf.join('/') + '/' + _0x2c1832);
}
if (0x4 === _0x36004e.data.t && _0x36004e.data.total > 0x0) {
var _0x1097ca = Math.floor(_0x36004e.data.current / _0x36004e.data.total * 0x64),
@@ -1746,7 +1720,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
} else {
_0x468801 += _0x1097ca.length;
_0x4d7024.gamePatch = '/'+_0xe531f0;
- _0x4d7024._FS.createDataFile('/', _0xe531f0, _0x1097ca, true, false);
+ _0x4d7024.FS.createDataFile('/', _0xe531f0, _0x1097ca, true, false);
_0x5048db();
}
}).catch(function(_0x314293) {
@@ -1810,7 +1784,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
});
var _0x54d79 = _0xa1889f.replace(/\#/g, '');
try {
- _0x468801 += _0x17edbf.length, _0x4d7024._FS.createDataFile('/', _0x54d79, _0x17edbf, true, !0x1), _0x139f68();
+ _0x468801 += _0x17edbf.length, _0x4d7024.FS.createDataFile('/', _0x54d79, _0x17edbf, true, !0x1), _0x139f68();
} catch (_0x125736) {
console.log(_0x125736);
}
@@ -1829,9 +1803,9 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
return _0x1c8a88;
}).length !== _0x6f30ae ? _0x31f098() : (_0x198a02.forEach(function(_0x22b824, _0x16eecf) {
_0x2c1832.set(_0x22b824.data, 0x6400000 * (_0x16eecf + 0x1));
- }), _0x4d7024._FS.createDataFile('/', _0x3e612b.filename, _0x2c1832, true, !0x1), _0x139f68());
+ }), _0x4d7024.FS.createDataFile('/', _0x3e612b.filename, _0x2c1832, true, !0x1), _0x139f68());
}, function() {}, 'sparse');
- } else _0x4d7024._FS.createDataFile('/', _0x3e612b.filename, _0x3e612b.data, true, !0x1), _0x139f68();
+ } else _0x4d7024.FS.createDataFile('/', _0x3e612b.filename, _0x3e612b.data, true, !0x1), _0x139f68();
else _0x31f098();
}) : _0x31f098();
}).catch(function(_0x20f2e3) {
@@ -1853,8 +1827,8 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
var _0x17edbf = _0x1e8643.data.file.split('/'),
_0x2c1832 = _0x17edbf.pop();
_0x2c1832.split('.').pop();
- _0x4d7024._FS.createPath('/', _0x17edbf.join('/'), true, true);
- _0x4d7024._FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x1e8643.data.data, true, false);
+ _0x4d7024.FS.createPath('/', _0x17edbf.join('/'), true, true);
+ _0x4d7024.FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x1e8643.data.data, true, false);
_0x468801 += _0x1e8643.data.data.length;
}
if (4 === _0x1e8643.data.t && _0x1e8643.data.total > 0) {
@@ -1873,7 +1847,8 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
});
} else if (_0x80852b === 'rar') {
extractRar(_0x4ce206).then(function(_0x259be0) {
- _0x259be0.onmessage = _0x19a43e, _0x259be0.postMessage(_0x3cff36);
+ _0x259be0.onmessage = _0x19a43e;
+ _0x259be0.postMessage(_0x3cff36);
});
} else if (_0x80852b === 'zip' && !['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(_0x3ea97.system)) {
extractFile(_0x2c1832).then(function(_0x31c70d) {
@@ -1883,7 +1858,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
} else {
_0x468801 += _0x3cff36.length;
_0x50119.innerHTML = 'BIOS ready';
- _0x4d7024._FS.createDataFile('/', _0x5e7c8b, _0x3cff36, true, false);
+ _0x4d7024.FS.createDataFile('/', _0x5e7c8b, _0x3cff36, true, false);
_0x452592();
}
},
@@ -1927,15 +1902,15 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
var _0x55117c = _0x5dc0c0(_0x36edb7, _0x2593da.storage.get('core-options') || {}),
_0x32dd27 = '';
if (_0x2c1832.coreVer === 2) {
- _0x4d7024._FS.createDataFile('/etc', 'retroarch.cfg', _0x14d39f, true, true);
+ _0x4d7024.FS.createDataFile('/etc', 'retroarch.cfg', _0x14d39f, true, true);
_0x4d7024._FS.createFolder('/home/web_user', 'retroarch', true, true);
_0x4d7024._FS.createFolder('/home/web_user/retroarch', 'userdata', true, true);
- _0x4d7024._FS.createDataFile('/home/web_user/retroarch/userdata', 'retroarch.cfg', _0x32dd27, true, true);
+ _0x4d7024.FS.createDataFile('/home/web_user/retroarch/userdata', 'retroarch.cfg', _0x32dd27, true, true);
} else {
- _0x4d7024._FS.createDataFile('/etc', 'retroarch.cfg', _0x14d39f, true, true);
+ _0x4d7024.FS.createDataFile('/etc', 'retroarch.cfg', _0x14d39f, true, true);
_0x4d7024._FS.createFolder('/home/web_user', '.config', true, true);
_0x4d7024._FS.createFolder('/home/web_user/.config', 'retroarch', true, true);
- _0x4d7024._FS.createDataFile('/home/web_user/.config/retroarch', 'retroarch-core-options.cfg', _0x32dd27, true, true);
+ _0x4d7024.FS.createDataFile('/home/web_user/.config/retroarch', 'retroarch-core-options.cfg', _0x32dd27, true, true);
}
if (_0x55117c && Object.keys(_0x55117c).forEach(function(_0x2950d3) {
if (_0x2c1832.lightgun && 'nes' === _0x2c1832.system && 'system_type' === _0x2950d3) return !0x1;
@@ -2150,7 +2125,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
_0x9a1f1 = Boolean(_0x28ee7f.asmjs),
_0x3e4345 = Boolean(_0x28ee7f.wasm);
var status = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1));
- if (!(_this.config.oldCores && _0x28ee7f.oldCores === 1) && _0x28ee7f.newCores === 1 && (_0x2d904a.wasm || _0x9a1f1) && !(_0x4d7024.isMobileDevice && _0x28ee7f.oldCores === 1)) {
+ if (!(_this.config.oldCores === true && _0x28ee7f.oldCores === 1) && _0x28ee7f.newCores === 1 && (_0x2d904a.wasm || _0x9a1f1) && !(_0x4d7024.isMobileDevice && _0x28ee7f.oldCores === 1)) {
_this.coreVer = 2;
delete Module.readAsync;
Module.INITIAL_MEMORY = Module.TOTAL_MEMORY;
@@ -2934,7 +2909,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
},
'setGamepadDialog': function() {
var _0xa88a13 = this;
- _0xa88a13.elements.dialogs.gamepad.innerHTML = '\n
\n
\n
'+_0xa88a13.localization('Control Settings')+' \n \n \n
\n
\n
\n
\n \n
\n
\n '
+ _0xa88a13.elements.dialogs.gamepad.innerHTML = '\n \n
\n
'+_0xa88a13.localization('Control Settings')+' \n \n \n
\n
\n
\n
\n \n
\n
\n ';
var _0x17edbf = '\n \n
\n
\n
Connected gamepad: n/a
\n
\n
\n
\n
\n
'+_0xa88a13.localization('Gamepad')+'
\n
'+_0xa88a13.localization('Keyboard')+'
\n
\n
\n
\n
\n
'),
_0x2c1832 = '\n ')
@@ -3206,11 +3181,14 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
} catch (_0x101b3e) {}
_0x17edbf && (_0xa88a13.cheats = _0x17edbf);
}
- _0x2c1832.innerHTML = '', _0xa88a13.cheats && Array.isArray(_0xa88a13.cheats) && _0xa88a13.cheats.forEach(function(_0x245035, _0x116996) {
- var _0x4ac35a = _0x245035[0x0];
- _0x245035[0x1];
- _0x2c1832.innerHTML += '\n
\n
').concat(_0x4ac35a, ' \n
× \n
');
- });
+ _0x2c1832.innerHTML = '';
+ if (_0xa88a13.cheats && Array.isArray(_0xa88a13.cheats)) {
+ _0xa88a13.cheats.forEach(function(_0x245035, _0x116996) {
+ var _0x4ac35a = _0x245035[0x0];
+ _0x245035[0x1];
+ _0x2c1832.innerHTML += '\n
\n
').concat(_0x4ac35a, ' \n
× \n
');
+ });
+ }
};
_0x1093f4.call(_0xa88a13, _0x2c1832, 'click', function(_0x576733) {
if (_0x576733.target && _0x576733.target.classList.contains(_0x378b5c.classNames['ejs-delete-cheat']) && _0x576733.target.getAttribute('data-idx')) {
@@ -3229,10 +3207,14 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
}), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x4adb2c) {
return _0x132da7(_0xa88a13.elements.dialogs.cheat, true), _0x4adb2c.stopPropagation(), _0xa88a13.elements.container.focus(), !0x1;
}), _0x1093f4.call(this, _0xa88a13.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-submit'])), 'click', function(_0x5785f6) {
- return _0x378b5c.resetCheat(), _0x2c1832.querySelectorAll('input:checked').forEach(function(_0xeb7426, _0x45b02d) {
+ _0x378b5c.resetCheat();
+ _0x2c1832.querySelectorAll('input:checked').forEach(function(_0xeb7426, _0x45b02d) {
var _0x27e2c1 = _0xa88a13.cheats[_0xeb7426.value];
- _0x27e2c1 && _0x378b5c.setCheat(_0x45b02d, 0x1, _0x27e2c1[0x1]);
- }), _0x132da7(_0xa88a13.elements.dialogs.cheat, true), _0xa88a13.elements.container.focus(), !0x1;
+ _0x27e2c1 && _0x378b5c.setCheat(_0x45b02d, 1, _0x27e2c1[1]);
+ });
+ _0x132da7(_0xa88a13.elements.dialogs.cheat, true);
+ _0xa88a13.elements.container.focus();
+ return false;
}), 'arcade' !== _0xa88a13.system && 'mame' !== _0xa88a13.system && 'mame2003' !== _0xa88a13.system && 'mame2010' !== _0xa88a13.system || (_0x1e2c68.element(_0xa88a13.elements.buttons.cheat) && _0x132da7(_0xa88a13.elements.buttons.cheat, true), _0x378b5c.allowCheat = !0x1), _0x378b5c.setCheat || (_0x132da7(_0xa88a13.elements.buttons.cheat, true), _0x378b5c.allowCheat = !0x1);
}
},
@@ -3297,146 +3279,26 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
'initGamepad': function() {
var _0xa88a13 = this,
_0x17edbf = this,
- _0x2c1832 = this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay)),
- _0x181250 = new _0x4ad1c6.Gamepad();
- _0x378b5c.gamepad = _0x181250;
- if (!_0x181250.init()) {
+ _0x2c1832 = this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay));
+ var gamepad;
+ try {
+ gamepad = new _0x4ad1c6();
+ } catch(e) {
console.warn('gamepad not supported');
return;
}
- _0x181250.bind(_0x4ad1c6.Gamepad.Event.TICK, function(_0x2fe35d) {
- _0x2fe35d.forEach(function(_0x2b21f8) {
- var _0x17edbf;
- if (_0x2b21f8 && _0x2b21f8.axes && _0x2b21f8.axes[9]) {
- (_0x17edbf = _0x2b21f8.axes[9]) < 3.28571 ? 1 == _0x17edbf ? (_0x2b21f8.extra_buttons[12].pressed || (_0x2b21f8.extra_buttons[12] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 12,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })), _0x2b21f8.extra_buttons[14].pressed || (_0x2b21f8.extra_buttons[14] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 14,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- }))) : _0x17edbf <= -0.7142857 && _0x17edbf >= -0.714291 ? (_0x2b21f8.extra_buttons[12].pressed || (_0x2b21f8.extra_buttons[12] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 12,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })), _0x2b21f8.extra_buttons[15].pressed || (_0x2b21f8.extra_buttons[15] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 15,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- }))) : _0x17edbf >= 0.42856 && _0x17edbf <= 0.42858 ? (_0x2b21f8.extra_buttons[13].pressed || (_0x2b21f8.extra_buttons[13] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 13,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })), _0x2b21f8.extra_buttons[14].pressed || (_0x2b21f8.extra_buttons[14] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 14,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- }))) : _0x17edbf >= -0.14287 && _0x17edbf <= -0.14285 ? (_0x2b21f8.extra_buttons[13].pressed || (_0x2b21f8.extra_buttons[13] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 13,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })), _0x2b21f8.extra_buttons[15].pressed || (_0x2b21f8.extra_buttons[15] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 15,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- }))) : _0x17edbf <= -1 && _0x17edbf >= -1.01 ? _0x2b21f8.extra_buttons[12].pressed || (_0x2b21f8.extra_buttons[12] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 12,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })) : _0x17edbf >= 0.142857 && _0x17edbf <= 0.142858 ? _0x2b21f8.extra_buttons[13].pressed || (_0x2b21f8.extra_buttons[13] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 13,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })) : _0x17edbf >= 0.7142857 && _0x17edbf <= 0.7142858 ? _0x2b21f8.extra_buttons[14].pressed || (_0x2b21f8.extra_buttons[14] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 14,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })) : _0x17edbf <= -0.42857 && _0x17edbf >= -0.42858 && (_0x2b21f8.extra_buttons[15].pressed || (_0x2b21f8.extra_buttons[15] = {
- 'pressed': true,
- 'value': 1
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, {
- 'index': 15,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- }))) : (_0x2b21f8.extra_buttons[12].pressed && (_0x2b21f8.extra_buttons[12] = {
- 'pressed': false,
- 'value': 0
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, {
- 'index': 12,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })), _0x2b21f8.extra_buttons[13].pressed && (_0x2b21f8.extra_buttons[13] = {
- 'pressed': false,
- 'value': 0
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, {
- 'index': 13,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })), _0x2b21f8.extra_buttons[14].pressed && (_0x2b21f8.extra_buttons[14] = {
- 'pressed': false,
- 'value': 0
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, {
- 'index': 14,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })), _0x2b21f8.extra_buttons[15].pressed && (_0x2b21f8.extra_buttons[15] = {
- 'pressed': false,
- 'value': 0
- }, _0x181250._fire(_0x4ad1c6.Gamepad.Event.BUTTON_UP, {
- 'index': 15,
- 'gamepad': _0x2b21f8,
- 'gamepadIndex': _0x2b21f8.index
- })));
- }
- });
- });
- _0x181250.bind(_0x4ad1c6.Gamepad.Event.BUTTON_DOWN, function(_0x15761a) {
- console.log(_0x15761a.gamepad)
+ _0x378b5c.gamepad = gamepad;
+ gamepad.on('buttondown', function(event) {
if (!_0xa88a13.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden) {
var _0x387018, _0xdd4205 = parseInt(_0x2c1832.getAttribute('data-index'), 0xa),
_0x1f4ee2 = _0x2c1832.getAttribute('data-id');
- if (_0x15761a.gamepad.index === parseInt(_0xdd4205, 0xa)) {
- for (var _0x211087 = 0x0; _0x211087 < 0x20 && ((_0x387018 = _0x15761a.gamepad.buttons[_0x211087]) || (_0x387018 = _0x15761a.gamepad.extra_buttons[_0x211087]), !_0x387018 || !('number' == typeof _0x387018 && 0x1 === _0x387018 || 'number' == typeof _0x387018.value && 0x1 === _0x387018.value)); _0x211087 += 0x1);
+ if (event.gamepadIndex === parseInt(_0xdd4205, 0xa)) {
var _0x126d2d = null;
- (_0x126d2d = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1f4ee2, '"][data-index="').concat(_0xdd4205, '"][data-type="2"]'))).setAttribute('data-value', _0x15761a.index), _0x126d2d.value = 'button ' .concat(_0x15761a.index + 0x1), _0x132da7(_0x2c1832, true);
+ (_0x126d2d = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1f4ee2, '"][data-index="').concat(_0xdd4205, '"][data-type="2"]'))).setAttribute('data-value', event.index), _0x126d2d.value = 'button ' .concat(event.index + 0x1), _0x132da7(_0x2c1832, true);
}
- } else Object.keys(_0x378b5c.controllers[_0x15761a.gamepad.index.toString()]).forEach(function(_0x3cf4d3) {
- var _0x5cf388 = _0x15761a.gamepad.index.toString();
- if (parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(_0x15761a.index, 0xa) && ['24', '25', '26'].includes(_0x3cf4d3)) {
+ } else Object.keys(_0x378b5c.controllers[event.gamepadIndex.toString()]).forEach(function(_0x3cf4d3) {
+ var _0x5cf388 = event.gamepadIndex.toString();
+ if (parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(event.index, 0xa) && ['24', '25', '26'].includes(_0x3cf4d3)) {
if (_0x3cf4d3 == '24') {//save
_0x378b5c.quickSaveState()
} else if (_0x3cf4d3 == '25') {//load
@@ -3445,29 +3307,31 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
_0x378b5c.changeStateSlot()
}
}
- parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(_0x15761a.index, 0xa) && parseInt(_0x5cf388, 0xa) === parseInt(_0x15761a.gamepad.index, 0xa) && _0x378b5c.simulateInput(_0x5cf388, _0x3cf4d3, 0x1);
+ parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(event.index, 0xa) && parseInt(_0x5cf388, 0xa) === parseInt(event.gamepadIndex, 0xa) && _0x378b5c.simulateInput(_0x5cf388, _0x3cf4d3, 0x1);
});
- }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.BUTTON_UP, function(_0x3220b3) {
+ });
+ gamepad.on('buttonup', function(event) {
Object.keys(_0x378b5c.controllers).forEach(function(_0x302c3e) {
Object.keys(_0x378b5c.controllers[_0x302c3e]).forEach(function(_0x14eb8a) {
- parseInt(_0x378b5c.controllers[_0x302c3e][_0x14eb8a].value2, 0xa) === parseInt(_0x3220b3.index, 0xa) && parseInt(_0x302c3e, 0xa) === parseInt(_0x3220b3.gamepad.index, 0xa) && _0x378b5c.simulateInput(_0x302c3e, _0x14eb8a, 0x0);
+ parseInt(_0x378b5c.controllers[_0x302c3e][_0x14eb8a].value2, 0xa) === parseInt(event.index, 0xa) && parseInt(_0x302c3e, 0xa) === parseInt(event.gamepadIndex, 0xa) && _0x378b5c.simulateInput(_0x302c3e, _0x14eb8a, 0x0);
});
});
- }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.AXIS_CHANGED, function(_0x31f017) {
+ });
+ gamepad.on('axischanged', function(event) {
var value = function(value) {
if (value > 0.5 || value < -0.5) {
return (value > 0) ? 1 : -1;
} else {
return 0;
}
- }(_0x31f017.value);
+ }(event.value);
if (!_0xa88a13.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden) {
if (value !== 0) {
var _0x1f4ee2 = _0x2c1832.getAttribute('data-id'),
_0xdd4205 = parseInt(_0x2c1832.getAttribute('data-index'), 0xa);
var _0x126d2d = _0xa88a13.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1f4ee2, '"][data-index="').concat(_0xdd4205, '"][data-type="2"]'))
- _0x126d2d.setAttribute('data-value', _0x31f017.axis + ':' + value)
- _0x126d2d.value = _0x31f017.axis + ':' + value
+ _0x126d2d.setAttribute('data-value', event.axis + ':' + value)
+ _0x126d2d.value = event.axis + ':' + value
_0x132da7(_0x2c1832, true)
}
} else {
@@ -3475,12 +3339,12 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
_0x378b5c.prevButtons = {}
}
var quit = false
- var _0x5cf388 = _0x31f017.gamepad.index.toString();
+ var _0x5cf388 = event.gamepadIndex.toString();
if (! _0x378b5c.prevButtons[_0x5cf388]) {
_0x378b5c.prevButtons[_0x5cf388] = {}
}
- if (! _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis]) {
- _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis] = 0
+ if (! _0x378b5c.prevButtons[_0x5cf388][event.axis]) {
+ _0x378b5c.prevButtons[_0x5cf388][event.axis] = 0
}
if (! _0x378b5c.prevButtons[_0x5cf388].buttonID) {
_0x378b5c.prevButtons[_0x5cf388].buttonID = 0
@@ -3490,7 +3354,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
if (! _0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2) {
continue
}
- if (_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[0] === _0x31f017.axis && parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[1]) === value && ['24', '25', '26'].includes(_0x3cf4d3)) {
+ if (_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[0] === event.axis && parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[1]) === value && ['24', '25', '26'].includes(_0x3cf4d3)) {
if (_0x3cf4d3 == '24') {//save
quit = true
_0x378b5c.quickSaveState()
@@ -3503,19 +3367,19 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
}
if (value === 0) {
// button up
- if (_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[0] === _0x31f017.axis) {
- _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis] = value
+ if (_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[0] === event.axis) {
+ _0x378b5c.prevButtons[_0x5cf388][event.axis] = value
_0x378b5c.prevButtons[_0x5cf388].buttonID = _0x3cf4d3
_0x378b5c.simulateInput(_0x5cf388, _0x3cf4d3, 0x0)
}
} else {
//button down
- if ((1 === _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis] && value === -1) ||
- (-1 === _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis] && value === 1)) {
+ if ((1 === _0x378b5c.prevButtons[_0x5cf388][event.axis] && value === -1) ||
+ (-1 === _0x378b5c.prevButtons[_0x5cf388][event.axis] && value === 1)) {
_0x378b5c.simulateInput(_0x5cf388, _0x378b5c.prevButtons[_0x5cf388].buttonID, 0x0)
}
- if (_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[0] === _0x31f017.axis && parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[1]) === value) {
- _0x378b5c.prevButtons[_0x5cf388][_0x31f017.axis] = value
+ if (_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[0] === event.axis && parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[1]) === value) {
+ _0x378b5c.prevButtons[_0x5cf388][event.axis] = value
_0x378b5c.prevButtons[_0x5cf388].buttonID = _0x3cf4d3
quit = true
_0x378b5c.simulateInput(_0x5cf388, _0x3cf4d3, 0x1)
@@ -3529,18 +3393,52 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
return
}
}
-
- Math.abs(_0x31f017.value) <= 0.1 && (_0x31f017.value = 0x0);
- var _0x17edbf = _0x31f017.gamepad.index;
- 'LEFT_STICK_X' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x10, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x11, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x11, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x10, 0x0))), 'LEFT_STICK_Y' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x12, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x13, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x13, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x12, 0x0))), 'RIGHT_STICK_X' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x14, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x15, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x15, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x14, 0x0))), 'RIGHT_STICK_Y' === _0x31f017.axis && (_0x31f017.value > 0x0 ? (_0x378b5c.simulateInput(_0x17edbf, 0x16, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x17, 0x0)) : (_0x378b5c.simulateInput(_0x17edbf, 0x17, 0x7fff * _0x31f017.value), _0x378b5c.simulateInput(_0x17edbf, 0x16, 0x0)));
- }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.DISCONNECTED, function(_0x1c996a) {
- [0x0, 0x1, 0x2, 0x3].forEach(function(_0x429f30) {
- var _0x2c1832 = _0x181250.gamepads[_0x429f30];
+ Math.abs(event.value) <= 0.1 && (event.value = 0);
+ var _0x17edbf = event.gamepadIndex;
+ var coreVer = _0xa88a13.coreVer;
+ if (event.axis === 'LEFT_STICK_X') {
+ if (event.value > 0) {
+ _0x378b5c.simulateInput(_0x17edbf, 16, 0x7fff * event.value);
+ _0x378b5c.simulateInput(_0x17edbf, 17, 0);
+ } else {
+ _0x378b5c.simulateInput(_0x17edbf, 17, -0x7fff * event.value);
+ _0x378b5c.simulateInput(_0x17edbf, 16, 0);
+ }
+ } else if (event.axis === 'LEFT_STICK_Y') {
+ if (event.value > 0) {
+ _0x378b5c.simulateInput(_0x17edbf, 18, 0x7fff * event.value);
+ _0x378b5c.simulateInput(_0x17edbf, 19, 0);
+ } else {
+ _0x378b5c.simulateInput(_0x17edbf, 19, -0x7fff * event.value);
+ _0x378b5c.simulateInput(_0x17edbf, 18, 0);
+ }
+ } else if (event.axis === 'RIGHT_STICK_X') {
+ if (event.value > 0) {
+ _0x378b5c.simulateInput(_0x17edbf, 20, 0x7fff * event.value);
+ _0x378b5c.simulateInput(_0x17edbf, 21, 0);
+ } else {
+ _0x378b5c.simulateInput(_0x17edbf, 21, -0x7fff * event.value);
+ _0x378b5c.simulateInput(_0x17edbf, 20, 0);
+ }
+ } else if (event.axis === 'RIGHT_STICK_Y') {
+ if (event.value > 0) {
+ _0x378b5c.simulateInput(_0x17edbf, 22, 0x7fff * event.value);
+ _0x378b5c.simulateInput(_0x17edbf, 23, 0);
+ } else {
+ _0x378b5c.simulateInput(_0x17edbf, 23, 0x7fff * event.value);
+ _0x378b5c.simulateInput(_0x17edbf, 22, 0);
+ }
+ }
+ });
+ gamepad.on('disconnected', function(event) {
+ [0, 1, 2, 3].forEach(function(_0x429f30) {
+ var _0x2c1832 = gamepad.gamepads[_0x429f30];
_0x17edbf.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x429f30, ' .gamepad-name')).innerHTML = _0x2c1832 ? _0x2c1832.id : 'n/a';
});
- }), _0x181250.bind(_0x4ad1c6.Gamepad.Event.CONNECTED, function(_0x748f24) {
- Object.keys(_0x181250.gamepads).forEach(function(_0x327c74) {
- var _0x2c1832 = _0x181250.gamepads[_0x327c74];
+ });
+ gamepad.on('connected', function(event) {
+ Object.keys(gamepad.gamepads).forEach(function(_0x327c74) {
+ var _0x2c1832 = gamepad.gamepads[_0x327c74];
_0x17edbf.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x327c74, ' .gamepad-name')).innerHTML = _0x2c1832 ? _0x2c1832.id : 'n/a';
});
});
@@ -3562,102 +3460,464 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
}
},
'toggleVirtualGamepad': function(_0x1ed80b) {
- var _0xa88a13 = this;
- if (null === _0x378b5c.virtualGamepadContainer) {
- _0x378b5c.virtualGamepadContainer = _0x428003('div', {
- 'class': _0x449eac({
- 'ejs-virtual-gamepad': true
- }),
- 'hidden': ''
- });
- this.elements.container.appendChild(_0x378b5c.virtualGamepadContainer);
- var blockCSS = 'height:31px;text-align:center;border:1px solid #ccc;border-radius:5px;line-height:31px;';
- var html = '';
- if (['snes', 'nds'].includes(_0xa88a13.system)) {
- var elements = {
- order: ['X','Y','A','B'],
- orderCSS: ['left:40px;', 'top:40px;', 'left:81px;top:40px;', 'left:40px;top:80px;'],
- LandR: true
- }
- } else if (['gba', 'gb', 'vb', 'nes'].includes(_0xa88a13.system)) {
- var elements = {
- order: ['B','A'],
- orderCSS: ['left:-10px;top:70px;', 'left:60px;top:70px;'],
- LandR: (_0xa88a13.system === 'gba')
- }
- } else if (['n64'].includes(_0xa88a13.system)) {
- var elements = {
- order: ['B','A'],
- orderCSS: ['left:-10px;top:95px;', 'left:40px;top:150px;'],
- LandR: true
- }
- } else {
- var elements = {
- order: ['Y','X','B','A'],
- orderCSS: ['left:40px;', 'top:40px;', 'left:81px;top:40px;', 'left:40px;top:80px;'],
- LandR: true
- }
- }
- html += '';
-
- html += '
';
- if (elements.LandR === true) {
- if (_0xa88a13.system === 'n64') {
- html += '
L
';
- html += '
Z
';
- html += '
R
';
- } else {
- html += '
L
';
- html += '
R
';
- }
- }
- html += '
';
-
- html += '
';
-
- html += '
';
- if (_0xa88a13.system === 'n64') {
- html += '
'+_0xa88a13.localization('Start')+'
';
- } else {
- html += '
'+_0xa88a13.localization('Start')+'
';
- html += '
'+_0xa88a13.localization('Select')+'
';
- }
- html += '
';
-
- html += '
';
-
- if (_0xa88a13.system === 'n64') {
- html += '
';
- html += '
';
- html += '
';
- html += '
';
- }
-
- for (var i=0; i
'+elements.order[i]+' ';
- }
-
- html += '
';
-
- _0x378b5c.virtualGamepadContainer.innerHTML = html;
+ var _this = this;
+ if (null !== _0x378b5c.virtualGamepadContainer) {
_0x132da7(_0x378b5c.virtualGamepadContainer, !_0x1ed80b);
+ return
+ }
+ _0x378b5c.virtualGamepadContainer = _0x428003('div', {
+ 'class': _0x449eac({
+ 'ejs-virtual-gamepad': true
+ }),
+ 'hidden': ''
+ });
+ this.elements.container.appendChild(_0x378b5c.virtualGamepadContainer);
+ var blockCSS = 'height:31px;text-align:center;border:1px solid #ccc;border-radius:5px;line-height:31px;';
+ var html = '';
+ var info;
+
+ if (_this.config.VirtualGamepadSettings && function(set) {
+ if (!Array.isArray(set)) {
+ console.warn("Vritual gamepad settings is not array! Using default gamepad settings");
+ return false;
+ }
+ if (!set.length) {
+ console.warn("Vritual gamepad settings is empty! Using default gamepad settings");
+ return false;
+ }
+ for (var i=0; i';
+ html += '';
+ for (var i=0; i'+info[i].text+'
';
+ }
+ }
+ html += '';
+ html += '';
+ for (var i=0; i'+info[i].text+'
';
+ }
+ }
+ html += '';
+ html += '';
+ for (var i=0; i'+info[i].text+'
';
+ }
+ }
+ html += '';
+ html += '';
+ for (var i=0; i'+info[i].text+'
';
+ }
+ }
+ html += '';
+ _0x378b5c.virtualGamepadContainer.innerHTML = html;
+ _0x132da7(_0x378b5c.virtualGamepadContainer, !_0x1ed80b);
+
+ var _0x2c1832 = _0x449eac({
+ 'virtual-gamepad': true
+ }),
+ _0x2ec721 = _0x449eac({
+ 'touch': true
+ });
+ if (! _0x59aa33.isIos) {
+ _0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832)), 'touchmove', function(event) {
+ event.stopPropagation();
+ });
+ }
+
+ var zone;
+ for (var i=0; i {
- _0x1093f4.call(this, _0x530042.call(this, '.'.concat(_0x2c1832, ' .').concat(_0x449eac(a.id))),
- 'touchstart touchend', function(e) {
- ['touchend'].includes(e.type) ? (_0x3a8e2f(e.target, _0x2ec721, false), window.setTimeout(function() {
+ keys.push({id: opts, number: value});
+ }
+ keys.forEach((a) => {
+ var element = _0x530042.call(_this, '.'.concat(_0x2c1832, ' .').concat(_0x449eac(a.id)));
+ if (!element) return;
+ _0x1093f4.call(_this, element, 'touchstart touchend', function(e) {
+ if (e.type === 'touchend') {
+ _0x3a8e2f(e.target, _0x2ec721, false);
+ window.setTimeout(function() {
_0x378b5c.syncInput(0, a.number, 0);
- }, 30)) : (_0x3a8e2f(e.target, _0x2ec721, true), _0x378b5c.syncInput(0, a.number, 1)), e.stopPropagation();
- })
- });
- var menuButton = _0x428003('div', {
- 'class': _0x449eac({
- 'ejs__widget': true,
- 'ejs__widget_controls_toggle': true
- })
- }, '');
- menuButton.innerHTML = ' ';
- _0x530042.call(this, ".".concat(_0x449eac({ejs__widgets: true}))).appendChild(menuButton);
- var hideTimeout;
- _0x1093f4.call(this, menuButton, 'mousedown touchstart', function(e) {
- _0x3a8e2f(e.target, _0x2ec721, true);
- clearTimeout(hideTimeout);
- _0x5ab74d.toggleControls.call(_0xa88a13, true);
- hideTimeout = setTimeout(function() {
- _0x5ab74d.toggleControls.call(_0xa88a13, false);
- }, 5000)
- });
- } else _0x132da7(_0x378b5c.virtualGamepadContainer, !_0x1ed80b);
+ }, 30)
+ } else {
+ _0x3a8e2f(e.target, _0x2ec721, true);
+ _0x378b5c.syncInput(0, a.number, 1)
+ }
+ e.stopPropagation();
+ })
+ });
+
+ var menuButton = _0x428003('div', {
+ 'class': _0x449eac({
+ 'ejs__widget': true,
+ 'ejs__widget_controls_toggle': true
+ })
+ }, '');
+ menuButton.innerHTML = ' ';
+ _0x530042.call(this, ".".concat(_0x449eac({ejs__widgets: true}))).appendChild(menuButton);
+ var hideTimeout;
+ _0x1093f4.call(this, menuButton, 'mousedown touchstart', function(e) {
+ _0x3a8e2f(e.target, _0x2ec721, true);
+ clearTimeout(hideTimeout);
+ _0x5ab74d.toggleControls.call(_this, true);
+ hideTimeout = setTimeout(function() {
+ _0x5ab74d.toggleControls.call(_this, false);
+ }, 5000)
+ });
},
'setup': function() {
var _0xa88a13 = this;
@@ -3805,6 +4058,13 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
_0x27f4c4.FS.syncfs(function() {});
}
}, true);
+ setInterval(function() {
+ if (_0xa88a13.started) {
+ console.log('saving save files');
+ _0x378b5c.saveSavFiles();
+ _0x27f4c4.FS.syncfs(false, function() {});
+ }
+ }, 300000)
},
'listeners': function() {
var _0xa88a13 = this;
@@ -3929,12 +4189,10 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
};
}
_0x378b5c.setVariable = _0x27f4c4.Module.cwrap('set_variable', 'null', ['string', 'string']);
- _0x378b5c.simulateInput = _0x27f4c4.Module.cwrap('simulate_input', 'null', ['number', 'number', 'number']);
- /*
_0x378b5c.simulateInputFn = _0x27f4c4.Module.cwrap('simulate_input', 'null', ['number', 'number', 'number']);
_0x378b5c.simulateInput = function(_0x249751, _0x480d05, _0x50f784) {
_0x378b5c.disableInput || _0x378b5c.simulateInputFn(_0x249751, _0x480d05, _0x50f784);
- };*/
+ };
_0x378b5c.syncInput = _0x378b5c.simulateInput;
window.simulateInput = _0x378b5c.simulateInput;
var _0x762355 = _0x27f4c4.Module.cwrap('shader_enable', 'null', ['number']);
@@ -3986,7 +4244,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
try {
_0x27f4c4.FS.unlink('game.state');
} catch(e){}
- _0x27f4c4._FS.createDataFile('/', 'game.state', _0x91cd69, true, true);
+ _0x27f4c4.FS.createDataFile('/', 'game.state', _0x91cd69, true, true);
null === _0x1d4918 && (_0x1d4918 = 0);
if ('arcade' === _0x17edbf) {
setTimeout(function() {
@@ -4028,7 +4286,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
} catch (_0x4b4d4c) {}
try {
var _0x17edbf = await _0x378b5c.saveState();
- _0x27f4c4._FS.createDataFile('/', name, _0x17edbf, true, true);
+ _0x27f4c4.FS.createDataFile('/', name, _0x17edbf, true, true);
_0xa88a13.elements.widgets.stateInfoDiv.innerHTML = 'STATE SAVED TO SLOT ' + slot;
clearTimeout(_0x378b5c.saveMsgTransitions);
_0x378b5c.saveMsgTransitions = setTimeout(function() {
@@ -4710,6 +4968,11 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
}
if (this.coreVer === 2) {
_0xa88a13 = {};
+ _0xa88a13['fps'] = {
+ 'label': this.localization('FPS'),
+ 'options': ["show", "hide"],
+ 'default': "hide"
+ }
}
if (this.statesSupported === true) {
_0xa88a13['save-state-slot'] = {
@@ -5051,16 +5314,24 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
var _0xa88a13 = this,
_0x17edbf = this,
_0x2c1832 = {};
- _0x2c1832.orientation = _0x7f9f36.storage.get('orientation'), _0x2c1832.shader = _0x7f9f36.storage.get('shader'), _0x17edbf.touch ? (_0x2c1832['virtual-gamepad'] = _0x7f9f36.storage.get('virtual-gamepad'), _0x1093f4.call(_0x17edbf, _0x17edbf.elements.container, 'start-game', function() {
+ _0x2c1832.orientation = _0x7f9f36.storage.get('orientation');
+ _0x2c1832.shader = _0x7f9f36.storage.get('shader');
+ _0x17edbf.touch ? (_0x2c1832['virtual-gamepad'] = _0x7f9f36.storage.get('virtual-gamepad'), _0x1093f4.call(_0x17edbf, _0x17edbf.elements.container, 'start-game', function() {
('enabled' === _0x2c1832['virtual-gamepad'] || _0x1e2c68.empty(_0x2c1832['virtual-gamepad'])) && _0xdcec2a.toggleVirtualGamepad.call(_0x17edbf, true);
- })) : delete _0x7f9f36.normalOptions['virtual-gamepad'], _0x7f9f36.setOptionMenuItem.call(this, _0x7f9f36.normalOptions, _0x2c1832), _0x1093f4.call(_0x17edbf, _0x17edbf.elements.container, 'start-game', function() {
+ })) : delete _0x7f9f36.normalOptions['virtual-gamepad'];
+ _0x7f9f36.setOptionMenuItem.call(this, _0x7f9f36.normalOptions, _0x2c1832);
+ _0x1093f4.call(_0x17edbf, _0x17edbf.elements.container, 'start-game', function() {
+ var shader = _0x7f9f36.storage.get('shader');
+ if (shader !== 'disabled') {
+ _0xdcec2a.setShader(shader);
+ }
var _0x2c1832 = _0xa88a13,
_0x42a7b1 = {};
_0xdcec2a.getGameCoreOptions && _0xdcec2a.getGameCoreOptions().split('\n').forEach(function(_0x4a987e, _0x10bd7a) {
var _0x2c1832 = _0x4a987e.split('; '),
- _0x1ddc5f = _0x2c1832[0x0];
- if (0x0 === _0x1ddc5f.indexOf('fba-dipswitch-')/* || _0x17edbf.coreVer === 2*/) {
- var _0xbd808 = _0x2c1832[0x1].split('|'),
+ _0x1ddc5f = _0x2c1832[0];
+ if (0 === _0x1ddc5f.indexOf('fba-dipswitch-') || _0x17edbf.coreVer === 2) {
+ var _0xbd808 = _0x2c1832[1].split('|'),
_0x3c4b1a = _0x1ddc5f.split("|")[0].replace(/_/g, ' ').replace(/.+\-(.+)/, '$1');
_0xbd808.slice(1, -1);
if (_0xbd808.length === 1) return;
@@ -5073,9 +5344,12 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
}
});
var _0x27d859 = _0x7f9f36.storage.get('core-options');
- _0x7f9f36.coreOptionsValues = _0x27d859 || {}, _0x7f9f36.setOptionMenuItem.call(_0x17edbf, _0x42a7b1, _0x7f9f36.coreOptionsValues), Object.keys(_0x7f9f36.coreOptionsValues).forEach(function(_0x51fc4e, _0x4b3613) {
+ _0x7f9f36.coreOptionsValues = _0x27d859 || {};
+ _0x7f9f36.setOptionMenuItem.call(_0x17edbf, _0x42a7b1, _0x7f9f36.coreOptionsValues);
+ Object.keys(_0x7f9f36.coreOptionsValues).forEach(function(_0x51fc4e, _0x4b3613) {
_0x7f9f36.updateCoreOptions.call(_0x2c1832, _0x51fc4e, _0x7f9f36.coreOptionsValues[_0x51fc4e]);
- }), 'nds' == _0x17edbf.system && (_0x27f4c4.Module._fast_forward_2 ? _0x27f4c4.Module._fast_forward_2(0x1) : _0x27f4c4.Module._fast_forward && _0x27f4c4.Module._fast_forward(0x1));
+ });
+ 'nds' == _0x17edbf.system && (_0x27f4c4.Module._fast_forward_2 ? _0x27f4c4.Module._fast_forward_2(1) : _0x27f4c4.Module._fast_forward && _0x27f4c4.Module._fast_forward(1));
});
},
'updateCoreOptionMenuItems': function() {
@@ -5904,17 +6178,16 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
_0xbae705.call(_0x17edbf, _0x17edbf.elements.container, 'savestate-start', false, {});
var _0x31e271 = await _0xdcec2a.saveState(),
_0x2c1832 = _0xdcec2a.getScreenData();
-
+
if (_0x378b5c.saveLoadDB.call(_0x17edbf, 'save')) {
return;
}
- var _0x2c1832 = _0x31e271;
if (_0x1e2c68.function(_0x17edbf.config.onsavestate)) _0x17edbf.config.onsavestate.call(null, {
'screenshot': _0x2c1832,
- 'state': _0x2c1832
+ 'state': _0x31e271
});
else {
- var _0x2b5fc8 = new Blob([_0x2c1832]),
+ var _0x2b5fc8 = new Blob([_0x31e271]),
_0x152605 = _0x17edbf.startName.split('/').pop().split('.'),
_0x51d471 = _0x152605.slice(0x0, _0x152605.length - 0x1).join('.');
if (typeof _0x17edbf.gameName == 'string') {
@@ -6055,7 +6328,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
}
return path
}
- this.version = '2.2.5';
+ this.version = '2.3.0';
this.system = '';
this.adUrl = null;
this.gameName = null;
diff --git a/data/emulator.js b/data/emulator.js
index 906f5c4..fa3440e 100644
--- a/data/emulator.js
+++ b/data/emulator.js
@@ -83,344 +83,114 @@ var EJS = function(_0x574f5e) {
element.innerHTML = ''+_this.localization('Network Error')+' ';
}
}
-}, null, null, null, null, null, function(_0x3982a1, _0x519c5e, _0x21c4c0) {
- ! function(_0x36fa8f) {
- 'use strict';
- var _0x519c5e = function() {},
- _0x21c4c0 = {
- 'getType': function() {
- return 'null';
- },
- 'isSupported': function() {
- return !0x1;
- },
- 'update': _0x519c5e
- },
- _0x51f790 = function(_0x961a83) {
- var _0x21c4c0 = this,
- _0x55f0e2 = window;
- this.update = _0x519c5e, this.requestAnimationFrame = _0x961a83 || _0x55f0e2.requestAnimationFrame || _0x55f0e2.webkitRequestAnimationFrame || _0x55f0e2.mozRequestAnimationFrame, this.tickFunction = function() {
- _0x21c4c0.update(), _0x21c4c0.startTicker();
- }, this.startTicker = function() {
- _0x21c4c0.requestAnimationFrame.apply(_0x55f0e2, [_0x21c4c0.tickFunction]);
- };
- };
- _0x51f790.prototype.start = function(_0x17a8e5) {
- this.update = _0x17a8e5 || _0x519c5e, this.startTicker();
- };
- var _0x594d89 = function() {};
- _0x594d89.prototype.update = _0x519c5e, _0x594d89.prototype.start = function(_0x39fdd2) {
- this.update = _0x39fdd2 || _0x519c5e;
- };
- var _0x2ff982 = function(_0x2b1a98, _0x4f87ba) {
- this.listener = _0x2b1a98, this.gamepadGetter = _0x4f87ba, this.knownGamepads = [];
- };
- _0x2ff982.factory = function(_0xc62323) {
- var _0x519c5e = _0x21c4c0,
- _0x2c02e1 = window && window.navigator;
- return _0x2c02e1 && (void 0x0 !== _0x2c02e1.getGamepads ? _0x519c5e = new _0x2ff982(_0xc62323, function() {
- return _0x2c02e1.getGamepads();
- }) : void 0x0 !== _0x2c02e1.webkitGamepads ? _0x519c5e = new _0x2ff982(_0xc62323, function() {
- return _0x2c02e1.webkitGamepads();
- }) : void 0x0 !== _0x2c02e1.webkitGetGamepads && (_0x519c5e = new _0x2ff982(_0xc62323, function() {
- return _0x2c02e1.webkitGetGamepads();
- }))), _0x519c5e;
- }, _0x2ff982.getType = function() {
- return 'WebKit';
- }, _0x2ff982.prototype.getType = function() {
- return _0x2ff982.getType();
- }, _0x2ff982.prototype.isSupported = function() {
- return true;
- }, _0x2ff982.prototype.update = function() {
- var _0x36fa8f, _0x519c5e, _0x21c4c0 = Array.prototype.slice.call(this.gamepadGetter(), 0x0);
- for (_0x519c5e = this.knownGamepads.length - 0x1; _0x519c5e >= 0x0; _0x519c5e--) _0x36fa8f = this.knownGamepads[_0x519c5e], _0x21c4c0.indexOf(_0x36fa8f) < 0x0 && (this.knownGamepads.splice(_0x519c5e, 0x1), this.listener._disconnect(_0x36fa8f));
- for (_0x519c5e = 0x0; _0x519c5e < _0x21c4c0.length; _0x519c5e++)(_0x36fa8f = _0x21c4c0[_0x519c5e]) && this.knownGamepads.indexOf(_0x36fa8f) < 0x0 && (this.knownGamepads.push(_0x36fa8f), this.listener._connect(_0x36fa8f));
- };
- var _0x2f4e6b = function(_0x3d65fc) {
- this.listener = _0x3d65fc, window.addEventListener('gamepadconnected', function(_0x44ea49) {
- _0x3d65fc._connect(_0x44ea49.gamepad);
- }), window.addEventListener('gamepaddisconnected', function(_0xfb7aa0) {
- _0x3d65fc._disconnect(_0xfb7aa0.gamepad);
- });
- };
- _0x2f4e6b.factory = function(_0x4c832a) {
- var _0x519c5e = _0x21c4c0;
- return window && void 0x0 !== window.addEventListener && (_0x519c5e = new _0x2f4e6b(_0x4c832a)), _0x519c5e;
- }, _0x2f4e6b.getType = function() {
- return 'Firefox';
- }, _0x2f4e6b.prototype.getType = function() {
- return _0x2f4e6b.getType();
- }, _0x2f4e6b.prototype.isSupported = function() {
- return -0x1 !== (window && window.navigator).userAgent.indexOf('Firefox');
- }, _0x2f4e6b.prototype.update = _0x519c5e;
- var _0x5633cb = function(_0x1f6314) {
- this.updateStrategy = _0x1f6314 || new _0x51f790(), this.gamepads = [], this.listeners = {}, this.platform = _0x21c4c0, this.deadzone = 0.03, this.maximizeThreshold = 0.97;
- };
- _0x5633cb.UpdateStrategies = {
- 'AnimFrameUpdateStrategy': _0x51f790,
- 'ManualUpdateStrategy': _0x594d89
- }, _0x5633cb.PlatformFactories = [_0x2f4e6b.factory, _0x2ff982.factory], _0x5633cb.Type = {
- 'N64': 'n64',
- 'PLAYSTATION': 'playstation',
- 'LOGITECH': 'logitech',
- 'XBOX': 'xbox',
- 'ECKA': 'ecka',
- 'UNKNOWN': 'unknown'
- }, _0x5633cb.Event = {
- 'CONNECTED': 'connected',
- 'UNSUPPORTED': 'unsupported',
- 'DISCONNECTED': 'disconnected',
- 'TICK': 'tick',
- 'BUTTON_DOWN': 'button-down',
- 'BUTTON_UP': 'button-up',
- 'AXIS_CHANGED': 'axis-changed'
- }, _0x5633cb.StandardButtons = ['BUTTON_1', 'BUTTON_2', 'BUTTON_3', 'BUTTON_4', 'LEFT_TOP_SHOULDER', 'RIGHT_TOP_SHOULDER', 'LEFT_BOTTOM_SHOULDER', 'RIGHT_BOTTOM_SHOULDER', 'SELECT_BACK', 'START_FORWARD', 'LEFT_STICK', 'RIGHT_STICK', 'DPAD_UP', 'DPAD_DOWN', 'DPAD_LEFT', 'DPAD_RIGHT', 'HOME'], _0x5633cb.StandardAxes = ['LEFT_STICK_X', 'LEFT_STICK_Y', 'RIGHT_STICK_X', 'RIGHT_STICK_Y'];
- var _0x11b15e, _0x1380fc = function(_0x2a091d, _0x396791, _0x49a80e) {
- return _0x396791 < _0x2a091d.length ? _0x2a091d[_0x396791] : _0x49a80e + (_0x396791 - _0x2a091d.length + 0x1);
- };
- _0x5633cb.StandardMapping = {
- 'env': {},
- 'buttons': {
- 'byButton': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
- },
- 'axes': {
- 'byAxis': [0x0, 0x1, 0x2, 0x3]
- }
- }, _0x5633cb.Mappings = [{
- 'env': {
- 'platform': _0x2f4e6b.getType(),
- 'type': _0x5633cb.Type.N64
- },
- 'buttons': {
- 'byButton': [0x2, 0x1, 0x3, 0x0, 0x4, 0x5, -0x1, -0x1, 0x8, 0x9, -0x1, -0x1, 0xc, 0xd, 0xe, 0xf, -0x1]
- },
- 'axes': {
- 'byAxis': [0x1, 0x2, -0x1, -0x1]
- }
- }, {
- 'env': {
- 'platform': _0x2ff982.getType(),
- 'type': _0x5633cb.Type.N64
- },
- 'buttons': {
- 'byButton': [0x2, 0x1, 0x3, 0x0, 0x4, 0x5, -0x1, -0x1, 0x8, 0x9, -0x1, -0x1, 0xc, 0xd, 0xe, 0xf, -0x1]
- },
- 'axes': {
- 'byAxis': [0x0, 0x1, -0x1, -0x1]
- }
- }, {
- 'env': {
- 'platform': _0x2f4e6b.getType(),
- 'type': _0x5633cb.Type.XBOX
- },
- 'buttons': {
- 'byButton': [0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0xf, 0x10, 0x9, 0x8, 0x6, 0x7, 0xb, 0xc, 0xd, 0xe, 0xa]
- },
- 'axes': {
- 'byAxis': [0x0, 0x1, 0x2, 0x3]
- }
- }, {
- 'env': {
- 'platform': _0x2f4e6b.getType(),
- 'type': _0x5633cb.Type.PLAYSTATION
- },
- 'buttons': {
- 'byButton': [0xe, 0xd, 0xf, 0xc, 0xa, 0xb, 0x8, 0x9, 0x0, 0x3, 0x1, 0x2, 0x4, 0x6, 0x7, 0x5, 0x10]
- },
- 'axes': {
- 'byAxis': [0x0, 0x1, 0x2, 0x3]
- }
- }, {
- 'env': {
- 'platform': _0x2ff982.getType(),
- 'type': _0x5633cb.Type.LOGITECH
- },
- 'buttons': {
- 'byButton': [0x1, 0x2, 0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xb, 0xc, 0xd, 0xe, 0xa]
- },
- 'axes': {
- 'byAxis': [0x0, 0x1, 0x2, 0x3]
- }
- }, {
- 'env': {
- 'platform': _0x2f4e6b.getType(),
- 'type': _0x5633cb.Type.LOGITECH
- },
- 'buttons': {
- 'byButton': [0, 1, 2, 3, 4, 5, -1, -1, 6, 7, 8, 9, 11, 12, 13, 14, 10],
- 'byAxis': [-0x1, -0x1, -0x1, -0x1, -0x1, -0x1, [0x2, 0x0, 0x1],
- [0x2, 0x0, -0x1]
- ]
- },
- 'axes': {
- 'byAxis': [0x0, 0x1, 0x3, 0x4]
- }
- }, {
- 'env': {
- 'platform': _0x2ff982.getType(),
- 'type': _0x5633cb.Type.ECKA
- },
- 'buttons': {
- 'byButton': [0x2, 0x1, 0x3, 0x0, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xb, 0xc, 0xd, 0xe, 0xa],
- 'byAxis': [-0x1, -0x1, -0x1, -0x1, -0x1, -0x1, [0x2, 0x0, 0x1],
- [0x2, 0x0, -0x1]
- ]
- },
- 'axes': {
- 'byAxis': [0x0, 0x1, 0x3, 0x4]
- }
- }, {
- 'env': {
- 'platform': _0x2ff982.getType(),
- 'type': _0x5633cb.Type.UNKNOWN
- },
- 'buttons': {
- 'byButton': [0x0, 0x1, 0x2, 0x3, 0x4, 0x5, -0x1, -0x1, 0x6, 0x7, 0x8, 0x9, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0xa]
- },
- 'axes': {
- 'byAxis': [0x0, 0x1, 0x2, 0x5]
- }
- }], _0x5633cb.prototype.init = function() {
- var _0x36fa8f = _0x5633cb.resolvePlatform(this),
- _0x519c5e = this;
- return this.platform = _0x36fa8f, this.updateStrategy.start(function() {
- _0x519c5e._update();
- }), this.buttonState = [], this.extraButtonState = [], _0x36fa8f.isSupported();
- }, _0x5633cb.prototype.bind = function(_0x1ad7a3, _0x381962) {
- return void 0x0 === this.listeners[_0x1ad7a3] && (this.listeners[_0x1ad7a3] = []), this.listeners[_0x1ad7a3].push(_0x381962), this;
- }, _0x5633cb.prototype.unbind = function(_0x1e8e29, _0x14faad) {
- if (void 0x0 !== _0x1e8e29) {
- if (void 0x0 !== _0x14faad) {
- if (void 0x0 === this.listeners[_0x1e8e29]) return !0x1;
- for (var _0x21c4c0 = 0x0; _0x21c4c0 < this.listeners[_0x1e8e29].length; _0x21c4c0++)
- if (this.listeners[_0x1e8e29][_0x21c4c0] === _0x14faad) return this.listeners[_0x1e8e29].splice(_0x21c4c0, 0x1), true;
- return !0x1;
+}, null, null, null, null, null, function(module) {
+ //I wrote this myself -- theres bound to be bugs
+ function Gamepad() {
+ var gp = navigator.getGamepads || navigator.webkitGetGamepads;
+ if (!gp) {
+ throw new Error("get gamepads not found!");
+ }
+ this.rAF = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.requestAnimationFrame;
+ if (!this.rAF) {
+ throw new Error("request animation frame was not found!");
+ }
+ this.loop();
+ }
+ Gamepad.prototype = {
+ gamepads: [],
+ rAF: null,
+ getGamepads: function() {
+ return navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);
+ },
+ loop: async function() {
+ this.updateGamepadState();
+ this.rAF.call(null, this.loop.bind(this));
+ },
+ updateGamepadState: function() {
+ var gamepads = this.getGamepads();
+ for (var i=0; i 0.5,
- _0x1078e7 = _0x2e14e2 > 0.5;
- _0x19541b.state[_0x49f481] = _0x3a8718, _0x11e126 && !_0x1078e7 ? _0x1fe059._fire(_0x5633cb.Event.BUTTON_DOWN, Object.create(_0x2ff716)) : !_0x11e126 && _0x1078e7 ? _0x1fe059._fire(_0x5633cb.Event.BUTTON_UP, Object.create(_0x2ff716)) : _0x1fe059.buttonState[_0x19541b.index][_0x49f481] != _0x3a8718 && _0x1fe059._fire(_0x5633cb.Event.BUTTON_UP, Object.create(_0x2ff716)), 0x0 !== _0x3a8718 && 0x1 !== _0x3a8718 && _0x3a8718 !== _0x2e14e2 && _0x1fe059._fireAxisChangedEvent(_0x19541b, _0x49f481, _0x3a8718), _0x19541b.lastState[_0x49f481] = _0x3a8718, _0x1fe059.buttonState[_0x19541b.index][_0x49f481] = _0x3a8718;
- }, _0x19541b.updater.push(_0x14879d);
- }, _0x5633cb.prototype._addAxisUpdater = function(_0x54e7b0, _0x2a7b73, _0x8f3c6d) {
- var _0x180376, _0x32658f = _0x1380fc(_0x5633cb.StandardAxes, _0x8f3c6d, 'EXTRA_AXIS_'),
- _0x4a1dfc = this._createAxisGetter(_0x54e7b0, _0x2a7b73.axes, _0x8f3c6d),
- _0x11e62a = this;
- _0x54e7b0.state[_0x32658f] = 0x0, _0x54e7b0.lastState[_0x32658f] = 0x0, null == this.buttonState[_0x54e7b0.index][_0x32658f] && (this.buttonState[_0x54e7b0.index][_0x32658f] = 0x0), _0x180376 = function() {
- var _0x2a7b73 = _0x4a1dfc(),
- _0x8f3c6d = _0x11e62a.buttonState[_0x54e7b0.index][_0x32658f];
- _0x54e7b0.state[_0x32658f] = _0x2a7b73, _0x2a7b73 !== _0x8f3c6d && _0x11e62a._fireAxisChangedEvent(_0x54e7b0, _0x32658f, _0x2a7b73), _0x54e7b0.lastState[_0x32658f] = _0x2a7b73, _0x11e62a.buttonState[_0x54e7b0.index][_0x32658f] = _0x2a7b73;
- }, _0x54e7b0.updater.push(_0x180376);
- }, _0x5633cb.prototype._fireAxisChangedEvent = function(_0x1b1af6, _0x297863, _0x310ce0) {
- var _0x181122 = {
- 'gamepad': _0x1b1af6,
- 'axis': _0x297863,
- 'value': _0x310ce0
- };
- this._fire(_0x5633cb.Event.AXIS_CHANGED, _0x181122);
- }, _0x5633cb.prototype._createButtonGetter = (_0x11b15e = function() {
- return 0x0;
- }, function(_0x8afe40, _0x4912fb, _0x78724a) {
- var _0x57e1d5, _0x2126da, _0xbc04b4 = _0x11b15e,
- _0x4f004d = this;
- return -0x1 !== (_0x57e1d5 = _0x4912fb.byButton[_0x78724a]) ? 'number' == typeof _0x57e1d5 && _0x57e1d5 < _0x8afe40.buttons.length && (_0xbc04b4 = function() {
- var _0x4912fb = _0x8afe40.buttons[_0x57e1d5];
- return 'number' == typeof _0x4912fb ? _0x4912fb : 'number' == typeof _0x4912fb.value ? _0x4912fb.value : 0x0;
- }) : _0x4912fb.byAxis && _0x78724a < _0x4912fb.byAxis.length && (_0x57e1d5 = _0x4912fb.byAxis[_0x78724a], _0x2126da = _0x57e1d5, '[object Array]' === Object.prototype.toString.call(_0x2126da) && 0x3 == _0x57e1d5.length && _0x57e1d5[0x0] < _0x8afe40.axes.length && (_0xbc04b4 = function(_0x41d3e7, _0xfe6d41, _0x1c883a) {
- var _0x23be26 = _0x11b15e;
- return _0xfe6d41 < _0x1c883a ? _0x23be26 = function() {
- var _0x5bba97 = _0x1c883a - _0xfe6d41,
- _0x23be85 = _0x41d3e7();
- return (_0x23be85 = (_0x23be85 - _0xfe6d41) / _0x5bba97) < 0x0 ? 0x0 : _0x23be85;
- } : _0x1c883a < _0xfe6d41 && (_0x23be26 = function() {
- var _0xd24650 = _0xfe6d41 - _0x1c883a,
- _0x183f73 = _0x41d3e7();
- return (_0x183f73 = (_0x183f73 - _0x1c883a) / _0xd24650) > 0x1 ? 0x0 : 0x1 - _0x183f73;
- }), _0x23be26;
- }(_0xbc04b4 = function() {
- var _0x4912fb = _0x8afe40.axes[_0x57e1d5[0x0]];
- return _0x4f004d._applyDeadzoneMaximize(_0x4912fb);
- }, _0x57e1d5[0x1], _0x57e1d5[0x2]))), _0xbc04b4;
- }), _0x5633cb.prototype._createAxisGetter = function() {
- var _0x36fa8f = function() {
- return 0x0;
- };
- return function(_0x2d14b3, _0x6afd0e, _0x20eff1) {
- var _0x1b8acf, _0x2b1b0a = _0x36fa8f,
- _0x101060 = this;
- return -0x1 !== (_0x1b8acf = _0x6afd0e.byAxis[_0x20eff1]) && 'number' == typeof _0x1b8acf && _0x1b8acf < _0x2d14b3.axes.length && (_0x2b1b0a = function() {
- var _0x36fa8f = _0x2d14b3.axes[_0x1b8acf];
- return _0x101060._applyDeadzoneMaximize(_0x36fa8f);
- }), _0x2b1b0a;
- };
- }(), _0x5633cb.prototype._disconnect = function(_0x116fb9) {
- var _0x519c5e, _0x21c4c0 = [];
- for (void 0x0 !== this.gamepads[_0x116fb9.index] && delete this.gamepads[_0x116fb9.index], _0x519c5e = 0x0; _0x519c5e < this.gamepads.length; _0x519c5e++) void 0x0 !== this.gamepads[_0x519c5e] && (_0x21c4c0[_0x519c5e] = this.gamepads[_0x519c5e]);
- this.gamepads = _0x21c4c0, this._fire(_0x5633cb.Event.DISCONNECTED, _0x116fb9);
- }, _0x5633cb.prototype._resolveControllerType = function(_0x582727) {
- return -0x1 !== (_0x582727 = _0x582727.toLowerCase().replace(/\s+/g, ' ').replace(/^\s+|\s+$/g, '')).indexOf('playstation') ? _0x5633cb.Type.PLAYSTATION : -0x1 !== _0x582727.indexOf('logitech') || -0x1 !== _0x582727.indexOf('wireless gamepad') ? _0x5633cb.Type.LOGITECH : -0x1 !== _0x582727.indexOf('xbox') || -0x1 !== _0x582727.indexOf('360') ? _0x5633cb.Type.XBOX : -0x1 !== _0x582727.indexOf('79-6-generic') && -0x1 !== _0x582727.indexOf('joystick') || -0x1 !== _0x582727.indexOf('vendor: 0079 product: 0006') && -0x1 !== _0x582727.indexOf('generic usb joystick') ? _0x5633cb.Type.N64 : 'usb joystick (vendor: 0e8f product: 0002)' === _0x582727 ? _0x5633cb.Type.ECKA : _0x5633cb.Type.UNKNOWN;
- }, _0x5633cb.prototype._resolveMapping = function(_0x13e45d) {
- var _0x519c5e, _0x21c4c0, _0x4d3f81 = _0x5633cb.Mappings,
- _0x1d4264 = null,
- _0xebffe5 = {
- 'platform': this.platform.getType(),
- 'type': this._resolveControllerType(_0x13e45d.id)
- };
- for (_0x519c5e = 0x0; !_0x1d4264 && _0x519c5e < _0x4d3f81.length; _0x519c5e++) _0x21c4c0 = _0x4d3f81[_0x519c5e], _0x5633cb.envMatchesFilter(_0x21c4c0.env, _0xebffe5) && (_0x1d4264 = _0x21c4c0);
- return _0x1d4264 || _0x5633cb.StandardMapping;
- }, _0x5633cb.envMatchesFilter = function(_0x26e73d, _0x55c334) {
- var _0x21c4c0, _0x514a3a = true;
- for (_0x21c4c0 in _0x26e73d) _0x26e73d[_0x21c4c0] !== _0x55c334[_0x21c4c0] && (_0x514a3a = !0x1);
- return _0x514a3a;
- }, _0x5633cb.prototype._update = function() {
- this.platform.update(), this.gamepads.forEach(function(_0x415bf6) {
- _0x415bf6 && _0x415bf6.updater.forEach(function(_0x39f57c) {
- _0x39f57c();
- });
- }), this.gamepads.length > 0x0 && this._fire(_0x5633cb.Event.TICK, this.gamepads);
- }, _0x5633cb.prototype._applyDeadzoneMaximize = function(_0x5b561d, _0x55976e, _0x5df97a) {
- return _0x55976e = void 0x0 !== _0x55976e ? _0x55976e : this.deadzone, _0x5df97a = void 0x0 !== _0x5df97a ? _0x5df97a : this.maximizeThreshold, _0x5b561d >= 0x0 ? _0x5b561d < _0x55976e ? _0x5b561d = 0x0 : _0x5b561d > _0x5df97a && (_0x5b561d = 0x1) : _0x5b561d > -_0x55976e ? _0x5b561d = 0x0 : _0x5b561d < -_0x5df97a && (_0x5b561d = -0x1), _0x5b561d;
- }, _0x36fa8f.Gamepad = _0x5633cb;
- }(_0x3982a1.exports || window);
+ for (var j=0; j'+n.localization("CORS Error")+" ":t.innerHTML=''+n.localization("Network Error")+" "}},null,null,null,null,null,function(e,t,n){!function(e){"use strict";function a(){}function t(e){var t=this,n=window;this.update=a,this.requestAnimationFrame=e||n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame,this.tickFunction=function(){t.update(),t.startTicker()},this.startTicker=function(){t.requestAnimationFrame.apply(n,[t.tickFunction])}}function n(){}function o(e,t){this.listener=e,this.gamepadGetter=t,this.knownGamepads=[]}function i(t){this.listener=t,window.addEventListener("gamepadconnected",function(e){t._connect(e.gamepad)}),window.addEventListener("gamepaddisconnected",function(e){t._disconnect(e.gamepad)})}function c(e){this.updateStrategy=e||new t,this.gamepads=[],this.listeners={},this.platform=s,this.deadzone=.03,this.maximizeThreshold=.97}var s={getType:function(){return"null"},isSupported:function(){return!1},update:a};t.prototype.start=function(e){this.update=e||a,this.startTicker()},n.prototype.update=a,n.prototype.start=function(e){this.update=e||a},o.factory=function(e){var t=s,n=window&&window.navigator;return n&&(void 0!==n.getGamepads?t=new o(e,function(){return n.getGamepads()}):void 0!==n.webkitGamepads?t=new o(e,function(){return n.webkitGamepads()}):void 0!==n.webkitGetGamepads&&(t=new o(e,function(){return n.webkitGetGamepads()}))),t},o.getType=function(){return"WebKit"},o.prototype.getType=function(){return o.getType()},o.prototype.isSupported=function(){return!0},o.prototype.update=function(){for(var e,t=Array.prototype.slice.call(this.gamepadGetter(),0),n=this.knownGamepads.length-1;0<=n;n--)e=this.knownGamepads[n],t.indexOf(e)<0&&(this.knownGamepads.splice(n,1),this.listener._disconnect(e));for(n=0;nthis.options.threshold){var r={};for(l in this.direction)this.direction.hasOwnProperty(l)&&(r[l]=this.direction[l]);var l,c={};for(l in this.direction={x:n,y:a,angle:t},e.direction=this.direction,r)r[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return e;c.x&&c.y||this.trigger("plain",e),c.x||this.trigger("plain:"+n,e),c.y||this.trigger("plain:"+a,e),c.angle||this.trigger("dir dir:"+t,e)}return e},a.prototype=new e,(a.constructor=a).id=0,a.prototype.prepareNipples=function(){var e=this,a=e.nipples;a.on=e.on.bind(e),a.off=e.off.bind(e),a.options=e.options,a.destroy=e.destroy.bind(e),a.ids=e.ids,a.id=e.id,a.processOnMove=e.processOnMove.bind(e),a.processOnEnd=e.processOnEnd.bind(e),a.get=function(e){if(void 0===e)return a[0];for(var t=0,n=a.length;t>2]|=e[i]<>6:(a<55296||57344<=a?l[o++]=224|a>>12:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++i)),l[o++]=240|a>>18,l[o++]=128|a>>12&63),l[o++]=128|a>>6&63),l[o++]=128|63&a);else for(o=this.start;i>2]|=a<>2]|=(192|a>>6)<>2]|=(224|a>>12)<>2]|=(240|a>>18)<>2]|=(128|a>>12&63)<>2]|=(128|a>>6&63)<>2]|=(128|63&a)<>2]|=u[3&t],56<=t&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash())},g.prototype.hash=function(){var e,t,n,a,o,i=this.blocks,s=this.first?((s=((e=((e=i[0]-680876937)<<7|e>>>25)-271733879<<0)^(t=((t=(-271733879^(n=((n=(-1732584194^2004318071&e)+i[1]-117830708)<<12|n>>>20)+e<<0)&(-271733879^e))+i[2]-1126478375)<<17|t>>>15)+n<<0)&(n^e))+i[3]-1316259209)<<22|s>>>10)+t<<0:(e=this.h0,s=this.h1,t=this.h2,((s+=((e=((e+=((n=this.h3)^s&(t^n))+i[0]-680876936)<<7|e>>>25)+s<<0)^(t=((t+=(s^(n=((n+=(t^e&(s^t))+i[1]-389564586)<<12|n>>>20)+e<<0)&(e^s))+i[2]+606105819)<<17|t>>>15)+n<<0)&(n^e))+i[3]-1044525330)<<22|s>>>10)+t<<0);s=((s+=((e=((e+=(n^s&(t^n))+i[4]-176418897)<<7|e>>>25)+s<<0)^(t=((t+=(s^(n=((n+=(t^e&(s^t))+i[5]+1200080426)<<12|n>>>20)+e<<0)&(e^s))+i[6]-1473231341)<<17|t>>>15)+n<<0)&(n^e))+i[7]-45705983)<<22|s>>>10)+t<<0,s=((s+=((e=((e+=(n^s&(t^n))+i[8]+1770035416)<<7|e>>>25)+s<<0)^(t=((t+=(s^(n=((n+=(t^e&(s^t))+i[9]-1958414417)<<12|n>>>20)+e<<0)&(e^s))+i[10]-42063)<<17|t>>>15)+n<<0)&(n^e))+i[11]-1990404162)<<22|s>>>10)+t<<0,s=((s+=((e=((e+=(n^s&(t^n))+i[12]+1804603682)<<7|e>>>25)+s<<0)^(t=((t+=(s^(n=((n+=(t^e&(s^t))+i[13]-40341101)<<12|n>>>20)+e<<0)&(e^s))+i[14]-1502002290)<<17|t>>>15)+n<<0)&(n^e))+i[15]+1236535329)<<22|s>>>10)+t<<0,s=((s+=((n=((n+=(s^t&((e=((e+=(t^n&(s^t))+i[1]-165796510)<<5|e>>>27)+s<<0)^s))+i[6]-1069501632)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^s&(n^e))+i[11]+643717713)<<14|t>>>18)+n<<0)^n))+i[0]-373897302)<<20|s>>>12)+t<<0,s=((s+=((n=((n+=(s^t&((e=((e+=(t^n&(s^t))+i[5]-701558691)<<5|e>>>27)+s<<0)^s))+i[10]+38016083)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^s&(n^e))+i[15]-660478335)<<14|t>>>18)+n<<0)^n))+i[4]-405537848)<<20|s>>>12)+t<<0,s=((s+=((n=((n+=(s^t&((e=((e+=(t^n&(s^t))+i[9]+568446438)<<5|e>>>27)+s<<0)^s))+i[14]-1019803690)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^s&(n^e))+i[3]-187363961)<<14|t>>>18)+n<<0)^n))+i[8]+1163531501)<<20|s>>>12)+t<<0,s=((s+=((n=((n+=(s^t&((e=((e+=(t^n&(s^t))+i[13]-1444681467)<<5|e>>>27)+s<<0)^s))+i[2]-51403784)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^s&(n^e))+i[7]+1735328473)<<14|t>>>18)+n<<0)^n))+i[12]-1926607734)<<20|s>>>12)+t<<0,s=((s+=((o=(n=((n+=((a=s^t)^(e=((e+=(a^n)+i[5]-378558)<<4|e>>>28)+s<<0))+i[8]-2022574463)<<11|n>>>21)+e<<0)^e)^(t=((t+=(o^s)+i[11]+1839030562)<<16|t>>>16)+n<<0))+i[14]-35309556)<<23|s>>>9)+t<<0,s=((s+=((o=(n=((n+=((a=s^t)^(e=((e+=(a^n)+i[1]-1530992060)<<4|e>>>28)+s<<0))+i[4]+1272893353)<<11|n>>>21)+e<<0)^e)^(t=((t+=(o^s)+i[7]-155497632)<<16|t>>>16)+n<<0))+i[10]-1094730640)<<23|s>>>9)+t<<0,s=((s+=((o=(n=((n+=((a=s^t)^(e=((e+=(a^n)+i[13]+681279174)<<4|e>>>28)+s<<0))+i[0]-358537222)<<11|n>>>21)+e<<0)^e)^(t=((t+=(o^s)+i[3]-722521979)<<16|t>>>16)+n<<0))+i[6]+76029189)<<23|s>>>9)+t<<0,s=((s+=((o=(n=((n+=((a=s^t)^(e=((e+=(a^n)+i[9]-640364487)<<4|e>>>28)+s<<0))+i[12]-421815835)<<11|n>>>21)+e<<0)^e)^(t=((t+=(o^s)+i[15]+530742520)<<16|t>>>16)+n<<0))+i[2]-995338651)<<23|s>>>9)+t<<0,s=((s+=((n=((n+=(s^((e=((e+=(t^(s|~n))+i[0]-198630844)<<6|e>>>26)+s<<0)|~t))+i[7]+1126891415)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~s))+i[14]-1416354905)<<15|t>>>17)+n<<0)|~e))+i[5]-57434055)<<21|s>>>11)+t<<0,s=((s+=((n=((n+=(s^((e=((e+=(t^(s|~n))+i[12]+1700485571)<<6|e>>>26)+s<<0)|~t))+i[3]-1894986606)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~s))+i[10]-1051523)<<15|t>>>17)+n<<0)|~e))+i[1]-2054922799)<<21|s>>>11)+t<<0,s=((s+=((n=((n+=(s^((e=((e+=(t^(s|~n))+i[8]+1873313359)<<6|e>>>26)+s<<0)|~t))+i[15]-30611744)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~s))+i[6]-1560198380)<<15|t>>>17)+n<<0)|~e))+i[13]+1309151649)<<21|s>>>11)+t<<0,s=((s+=((n=((n+=(s^((e=((e+=(t^(s|~n))+i[4]-145523070)<<6|e>>>26)+s<<0)|~t))+i[11]-1120210379)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~s))+i[2]+718787259)<<15|t>>>17)+n<<0)|~e))+i[9]-343485551)<<21|s>>>11)+t<<0,this.first?(this.h0=e+1732584193<<0,this.h1=s-271733879<<0,this.h2=t-1732584194<<0,this.h3=n+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+s<<0,this.h2=this.h2+t<<0,this.h3=this.h3+n<<0)},g.prototype.toString=g.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,a=this.h3;return l[e>>4&15]+l[15&e]+l[e>>12&15]+l[e>>8&15]+l[e>>20&15]+l[e>>16&15]+l[e>>28&15]+l[e>>24&15]+l[t>>4&15]+l[15&t]+l[t>>12&15]+l[t>>8&15]+l[t>>20&15]+l[t>>16&15]+l[t>>28&15]+l[t>>24&15]+l[n>>4&15]+l[15&n]+l[n>>12&15]+l[n>>8&15]+l[n>>20&15]+l[n>>16&15]+l[n>>28&15]+l[n>>24&15]+l[a>>4&15]+l[15&a]+l[a>>12&15]+l[a>>8&15]+l[a>>20&15]+l[a>>16&15]+l[a>>28&15]+l[a>>24&15]},g.prototype.array=g.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,a=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&a,a>>8&255,a>>16&255,a>>24&255]},g.prototype.buffer=g.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},g.prototype.base64=function(){for(var e,t,n,a="",o=this.array(),i=0;i<15;)e=o[i++],t=o[i++],n=o[i++],a+=h[e>>>2]+h[63&(e<<4|t>>>4)]+h[63&(t<<2|n>>>6)]+h[63&n];return e=o[i],a+(h[e>>>2]+h[e<<4&63]+"==")};var v=function(){var t=a("hex");(t=s?o(t):t).create=function(){return new g},t.update=function(e){return t.create().update(e)};for(var e=0;e= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 dx = vec2(x, 0.0);\nvec2 dy = vec2(0.0, y);\nt1 = vec4(vTexCoord - dg1, vTexCoord - dy);\nt2 = vec4(vTexCoord - dg2, vTexCoord + dx);\nt3 = vec4(vTexCoord + dg1, vTexCoord + dy);\nt4 = vec4(vTexCoord + dg2, vTexCoord - dx);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 0.325; // start smoothing wt.\nfloat k = -0.250; // wt. decrease factor\nfloat max_w = 0.25; // max filter weight\nfloat min_w =-0.05; // min filter weight\nfloat lum_add = 0.25; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c00 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 c10 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 c20 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 c01 = COMPAT_TEXTURE(Source, t4.zw).xyz; \nvec3 c11 = COMPAT_TEXTURE(Source, vTexCoord).xyz; \nvec3 c21 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 c02 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 c12 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 c22 = COMPAT_TEXTURE(Source, t3.xy).xyz; \n\nfloat md1 = dot(abs(c00 - c22), dt);\nfloat md2 = dot(abs(c02 - c20), dt);\n\nfloat w1 = dot(abs(c22 - c11), dt) * md2;\nfloat w2 = dot(abs(c02 - c11), dt) * md1;\nfloat w3 = dot(abs(c00 - c11), dt) * md2;\nfloat w4 = dot(abs(c20 - c11), dt) * md1;\n\nfloat t1 = w1 + w3;\nfloat t2 = w2 + w4;\nfloat ww = max(t1, t2) + 0.0001;\n\nc11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww);\n\nfloat lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add);\nfloat lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add);\n\nw1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w);\nw2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w);\nw3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w);\nw4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w);\nFragColor = vec4(w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11, 1.0);\n} \n#endif\n","4xScaleHQ.glsl":"/*\n4xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 sd1 = dg1 * 0.5;\nvec2 sd2 = dg2 * 0.5;\nvec2 ddx = vec2(x, 0.0);\nvec2 ddy = vec2(0.0, y);\nt1 = vec4(vTexCoord - sd1, vTexCoord - ddy);\nt2 = vec4(vTexCoord - sd2, vTexCoord + ddx);\nt3 = vec4(vTexCoord + sd1, vTexCoord + ddy);\nt4 = vec4(vTexCoord + sd2, vTexCoord - ddx);\nt5 = vec4(vTexCoord - dg1, vTexCoord - dg2);\nt6 = vec4(vTexCoord + dg1, vTexCoord + dg2);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 1.0; // start smoothing wt.\nfloat k = -1.10; // wt. decrease factor\nfloat max_w = 0.75; // max filter weight\nfloat min_w = 0.03; // min filter weight\nfloat lum_add = 0.33; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c = COMPAT_TEXTURE(Source, vTexCoord).xyz;\nvec3 i1 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 i2 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 i3 = COMPAT_TEXTURE(Source, t3.xy).xyz; \nvec3 i4 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 o1 = COMPAT_TEXTURE(Source, t5.xy).xyz; \nvec3 o3 = COMPAT_TEXTURE(Source, t6.xy).xyz; \nvec3 o2 = COMPAT_TEXTURE(Source, t5.zw).xyz;\nvec3 o4 = COMPAT_TEXTURE(Source, t6.zw).xyz;\nvec3 s1 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 s2 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 s3 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 s4 = COMPAT_TEXTURE(Source, t4.zw).xyz; \n\nfloat ko1=dot(abs(o1-c),dt);\nfloat ko2=dot(abs(o2-c),dt);\nfloat ko3=dot(abs(o3-c),dt);\nfloat ko4=dot(abs(o4-c),dt);\n\nfloat k1=min(dot(abs(i1-i3),dt),max(ko1,ko3));\nfloat k2=min(dot(abs(i2-i4),dt),max(ko2,ko4));\n\nfloat w1 = k2; if(ko3= 130\n #define COMPAT_VARYING out\n #define COMPAT_ATTRIBUTE in\n #define COMPAT_TEXTURE texture\n #else\n #define COMPAT_VARYING varying\n #define COMPAT_ATTRIBUTE attribute\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _oPosition1;\n vec4 _r0005;\n COMPAT_ATTRIBUTE vec4 VertexCoord;\n COMPAT_ATTRIBUTE vec4 TexCoord;\n COMPAT_VARYING vec4 TEX0;\n \n uniform mat4 MVPMatrix;\n uniform int FrameDirection;\n uniform int FrameCount;\n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _oTex;\n _r0005 = VertexCoord.x*MVPMatrix[0];\n _r0005 = _r0005 + VertexCoord.y*MVPMatrix[1];\n _r0005 = _r0005 + VertexCoord.z*MVPMatrix[2];\n _r0005 = _r0005 + VertexCoord.w*MVPMatrix[3];\n _oPosition1 = _r0005;\n _oTex = TexCoord.xy;\n gl_Position = _r0005;\n TEX0.xy = TexCoord.xy;\n }\n #elif defined(FRAGMENT)\n \n #if __VERSION__ >= 130\n #define COMPAT_VARYING in\n #define COMPAT_TEXTURE texture\n out vec4 FragColor;\n #else\n #define COMPAT_VARYING varying\n #define FragColor gl_FragColor\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _ret_0;\n float _TMP30;\n float _TMP29;\n float _TMP28;\n float _TMP13;\n float _TMP32;\n float _TMP11;\n float _TMP10;\n float _TMP31;\n float _TMP9;\n float _TMP8;\n float _TMP15;\n float _TMP14;\n float _TMP33;\n vec4 _TMP34;\n vec4 _TMP27;\n vec4 _TMP25;\n vec4 _TMP23;\n vec4 _TMP21;\n vec4 _TMP26;\n vec4 _TMP24;\n vec4 _TMP22;\n vec4 _TMP20;\n float _TMP4;\n vec4 _TMP3;\n vec4 _TMP2;\n float _TMP19;\n float _TMP18;\n float _TMP17;\n float _TMP16;\n vec4 _TMP1;\n vec2 _TMP0;\n uniform sampler2D Texture;\n input_dummy _IN1;\n float _TMP43;\n float _x_step0044;\n float _curve0044;\n float _a0048;\n float _val0052;\n float _a0052;\n vec4 _TMP57;\n vec4 _x0072;\n vec2 _c0086;\n vec4 _x0088;\n vec4 _x0094;\n vec2 _c0098;\n vec4 _x0100;\n vec2 _c0104;\n vec4 _x0106;\n vec4 _sample_min0110;\n vec4 _sample_max0110;\n vec4 _r0112;\n vec4 _TMP117;\n vec2 _co0124;\n vec2 _c0126;\n vec4 _x0128;\n vec4 _x0134;\n vec2 _c0138;\n vec4 _x0140;\n vec2 _c0144;\n vec4 _x0146;\n vec4 _sample_min0150;\n vec4 _sample_max0150;\n vec4 _r0152;\n vec4 _TMP157;\n float _TMP163;\n float _x_step0164;\n float _curve0164;\n float _a0168;\n float _val0172;\n float _a0172;\n float _TMP183;\n float _TMP189;\n float _x0190;\n float _a0196;\n float _x0198;\n vec2 _x0200;\n float _x0208;\n COMPAT_VARYING vec4 TEX0;\n \n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _dx1;\n vec2 _dy;\n vec2 _pix_co;\n vec2 _tex_co;\n vec2 _dist;\n vec3 _col2;\n vec3 _col21;\n vec4 _coeffs1;\n float _luma;\n float _bright;\n float _scan_weight;\n vec2 _mod_fac;\n int _dot_no;\n vec3 _mask_weight;\n vec3 _TMP37;\n _dx1 = vec2(1.00000000E+00/TextureSize.x, 0.00000000E+00);\n _dy = vec2(0.00000000E+00, 1.00000000E+00/TextureSize.y);\n _pix_co = TEX0.xy*TextureSize - vec2( 5.00000000E-01, 5.00000000E-01);\n _TMP0 = floor(_pix_co);\n _tex_co = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/TextureSize;\n _dist = fract(_pix_co);\n _x_step0044 = float((_dist.x >= 5.00000000E-01));\n _a0048 = 2.50000000E-01 - (_dist.x - _x_step0044)*(_dist.x - _x_step0044);\n _TMP33 = inversesqrt(_a0048);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0052 = 5.00000000E-01 - _dist.x;\n _val0052 = float((_a0052 > 0.00000000E+00));\n _TMP15 = _val0052 - float((_a0052 < 0.00000000E+00));\n _curve0044 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP43 = _dist.x + 2.50000000E-01*(_curve0044 - _dist.x);\n _coeffs1 = 3.14159274E+00*vec4(1.00000000E+00 + _TMP43, _TMP43, 1.00000000E+00 - _TMP43, 2.00000000E+00 - _TMP43);\n _TMP1 = abs(_coeffs1);\n _TMP57 = max(_TMP1, vec4( 9.99999975E-06, 9.99999975E-06, 9.99999975E-06, 9.99999975E-06));\n _TMP16 = sin(_TMP57.x);\n _TMP17 = sin(_TMP57.y);\n _TMP18 = sin(_TMP57.z);\n _TMP19 = sin(_TMP57.w);\n _TMP2 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _x0072 = _TMP57/2.00000000E+00;\n _TMP16 = sin(_x0072.x);\n _TMP17 = sin(_x0072.y);\n _TMP18 = sin(_x0072.z);\n _TMP19 = sin(_x0072.w);\n _TMP3 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _coeffs1 = ((2.00000000E+00*_TMP2)*_TMP3)/(_TMP57*_TMP57);\n _TMP4 = dot(_coeffs1, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _coeffs1 = _coeffs1/_TMP4;\n _c0086 = _tex_co - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0086);\n _x0088 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0088;\n _TMP22 = COMPAT_TEXTURE(Texture, _tex_co);\n _x0094 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0094;\n _c0098 = _tex_co + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0098);\n _x0100 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0100;\n _c0104 = _tex_co + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0104);\n _x0106 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0106;\n _r0112 = _coeffs1.x*_TMP21;\n _r0112 = _r0112 + _coeffs1.y*_TMP23;\n _r0112 = _r0112 + _coeffs1.z*_TMP25;\n _r0112 = _r0112 + _coeffs1.w*_TMP27;\n _sample_min0110 = min(_TMP23, _TMP25);\n _sample_max0110 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0110, _r0112);\n _TMP117 = max(_sample_min0110, _TMP34);\n _co0124 = _tex_co + _dy;\n _c0126 = _co0124 - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0126);\n _x0128 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0128;\n _TMP22 = COMPAT_TEXTURE(Texture, _co0124);\n _x0134 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0134;\n _c0138 = _co0124 + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0138);\n _x0140 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0140;\n _c0144 = _co0124 + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0144);\n _x0146 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0146;\n _r0152 = _coeffs1.x*_TMP21;\n _r0152 = _r0152 + _coeffs1.y*_TMP23;\n _r0152 = _r0152 + _coeffs1.z*_TMP25;\n _r0152 = _r0152 + _coeffs1.w*_TMP27;\n _sample_min0150 = min(_TMP23, _TMP25);\n _sample_max0150 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0150, _r0152);\n _TMP157 = max(_sample_min0150, _TMP34);\n _x_step0164 = float((_dist.y >= 5.00000000E-01));\n _a0168 = 2.50000000E-01 - (_dist.y - _x_step0164)*(_dist.y - _x_step0164);\n _TMP33 = inversesqrt(_a0168);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0172 = 5.00000000E-01 - _dist.y;\n _val0172 = float((_a0172 > 0.00000000E+00));\n _TMP15 = _val0172 - float((_a0172 < 0.00000000E+00));\n _curve0164 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP163 = _dist.y + (_curve0164 - _dist.y);\n _col2 = _TMP117.xyz + _TMP163*(_TMP157.xyz - _TMP117.xyz);\n _luma = dot(vec3( 2.12599993E-01, 7.15200007E-01, 7.22000003E-02), _col2);\n _TMP8 = max(_col2.y, _col2.z);\n _TMP9 = max(_col2.x, _TMP8);\n _bright = (_TMP9 + _luma)/2.00000000E+00;\n _TMP31 = min(6.49999976E-01, _bright);\n _TMP183 = max(3.49999994E-01, _TMP31);\n _x0190 = _bright*1.50000000E+00;\n _TMP31 = min(1.50000000E+00, _x0190);\n _TMP189 = max(1.50000000E+00, _TMP31);\n _a0196 = TEX0.y*2.00000000E+00*3.14159274E+00*TextureSize.y;\n _TMP10 = cos(_a0196);\n _x0198 = _TMP10*5.00000000E-01 + 5.00000000E-01;\n _TMP11 = pow(_x0198, _TMP189);\n _scan_weight = 1.00000000E+00 - _TMP11;\n _x0200 = (TEX0.xy*OutputSize*TextureSize)/InputSize;\n _mod_fac = floor(_x0200);\n _x0208 = _mod_fac.x/3.00000000E+00;\n _TMP32 = floor(_x0208);\n _TMP13 = _mod_fac.x - 3.00000000E+00*_TMP32;\n _dot_no = int(_TMP13);\n if (_dot_no == 0) {\n _mask_weight = vec3( 1.00000000E+00, 6.99999988E-01, 6.99999988E-01);\n } else {\n if (_dot_no == 1) {\n _mask_weight = vec3( 6.99999988E-01, 1.00000000E+00, 6.99999988E-01);\n } else {\n _mask_weight = vec3( 6.99999988E-01, 6.99999988E-01, 1.00000000E+00);\n }\n }\n if (InputSize.y >= 4.00000000E+02) {\n _scan_weight = 1.00000000E+00;\n }\n _col21 = _col2.xyz;\n _col2 = _col2*vec3(_scan_weight, _scan_weight, _scan_weight);\n _col2 = _col2 + _TMP183*(_col21 - _col2);\n _col2 = _col2*_mask_weight;\n _TMP28 = pow(_col2.x, 5.55555582E-01);\n _TMP29 = pow(_col2.y, 5.55555582E-01);\n _TMP30 = pow(_col2.z, 5.55555582E-01);\n _col2 = vec3(_TMP28, _TMP29, _TMP30);\n _TMP37 = _col2*1.20000005E+00;\n _ret_0 = vec4(_TMP37.x, _TMP37.y, _TMP37.z, 1.00000000E+00);\n FragColor = _ret_0;\n return;\n }\n #endif\n","crt-aperture.glsl":'\n/*\nCRT Shader by EasyMode\nLicense: GPL\n*/\n/*\n#pragma parameter SHARPNESS_IMAGE "Sharpness Image" 1.0 1.0 5.0 1.0\n#pragma parameter SHARPNESS_EDGES "Sharpness Edges" 3.0 1.0 5.0 1.0\n#pragma parameter GLOW_WIDTH "Glow Width" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HEIGHT "Glow Height" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HALATION "Glow Halation" 0.1 0.0 1.0 0.01\n#pragma parameter GLOW_DIFFUSION "Glow Diffusion" 0.05 0.0 1.0 0.01\n#pragma parameter MASK_COLORS "Mask Colors" 2.0 2.0 3.0 1.0\n#pragma parameter MASK_STRENGTH "Mask Strength" 0.3 0.0 1.0 0.05\n#pragma parameter MASK_SIZE "Mask Size" 1.0 1.0 9.0 1.0\n#pragma parameter SCANLINE_SIZE_MIN "Scanline Size Min." 0.5 0.5 1.5 0.05\n#pragma parameter SCANLINE_SIZE_MAX "Scanline Size Max." 1.5 0.5 1.5 0.05\n#pragma parameter GAMMA_INPUT "Gamma Input" 2.4 1.0 5.0 0.1\n#pragma parameter GAMMA_OUTPUT "Gamma Output" 2.4 1.0 5.0 0.1\n#pragma parameter BRIGHTNESS "Brightness" 1.5 0.0 2.0 0.05\n* */\n\n#define Coord TEX0\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define OUT out\n#define IN in\n#define tex2D texture\n#else\n#define OUT varying \n#define IN attribute \n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nIN vec4 VertexCoord;\nIN vec4 Color;\nIN vec2 TexCoord;\nOUT vec4 color;\nOUT vec2 Coord;\n\nuniform mat4 MVPMatrix;\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\ncolor = Color;\nCoord = TexCoord;\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define IN in\n#define tex2D texture\nout vec4 FragColor;\n#else\n#define IN varying\n#define FragColor gl_FragColor\n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nIN vec2 Coord;\n\n#ifdef PARAMETER_UNIFORM\nuniform PRECISION float SHARPNESS_IMAGE;\nuniform PRECISION float SHARPNESS_EDGES;\nuniform PRECISION float GLOW_WIDTH;\nuniform PRECISION float GLOW_HEIGHT;\nuniform PRECISION float GLOW_HALATION;\nuniform PRECISION float GLOW_DIFFUSION;\nuniform PRECISION float MASK_COLORS;\nuniform PRECISION float MASK_STRENGTH;\nuniform PRECISION float MASK_SIZE;\nuniform PRECISION float SCANLINE_SIZE_MIN;\nuniform PRECISION float SCANLINE_SIZE_MAX;\nuniform PRECISION float GAMMA_INPUT;\nuniform PRECISION float GAMMA_OUTPUT;\nuniform PRECISION float BRIGHTNESS;\n#else\n#define SHARPNESS_IMAGE 1.0\n#define SHARPNESS_EDGES 3.0\n#define GLOW_WIDTH 0.5\n#define GLOW_HEIGHT 0.5\n#define GLOW_HALATION 0.1\n#define GLOW_DIFFUSION 0.05\n#define MASK_COLORS 2.0\n#define MASK_STRENGTH 0.3\n#define MASK_SIZE 1.0\n#define SCANLINE_SIZE_MIN 0.5\n#define SCANLINE_SIZE_MAX 1.5\n#define GAMMA_INPUT 2.4\n#define GAMMA_OUTPUT 2.4\n#define BRIGHTNESS 1.5\n#endif\n\n#define FIX(c) max(abs(c), 1e-5)\n#define PI 3.141592653589\n#define saturate(c) clamp(c, 0.0, 1.0)\n#define TEX2D(c) pow(tex2D(tex, c).rgb, vec3(GAMMA_INPUT))\n\nmat3 get_color_matrix(sampler2D tex, vec2 co, vec2 dx)\n{\nreturn mat3(TEX2D(co - dx), TEX2D(co), TEX2D(co + dx));\n}\n\nvec3 blur(mat3 m, float dist, float rad)\n{\nvec3 x = vec3(dist - 1.0, dist, dist + 1.0) / rad;\nvec3 w = exp2(x * x * -1.0);\n\nreturn (m[0] * w.x + m[1] * w.y + m[2] * w.z) / (w.x + w.y + w.z);\n}\n\nvec3 filter_gaussian(sampler2D tex, vec2 co, vec2 tex_size)\n{\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 dy = vec2(0.0, 1.0 / tex_size.y);\nvec2 pix_co = co * tex_size;\nvec2 tex_co = (floor(pix_co) + 0.5) / tex_size;\nvec2 dist = (fract(pix_co) - 0.5) * -1.0;\n\nmat3 line0 = get_color_matrix(tex, tex_co - dy, dx);\nmat3 line1 = get_color_matrix(tex, tex_co, dx);\nmat3 line2 = get_color_matrix(tex, tex_co + dy, dx);\nmat3 column = mat3(blur(line0, dist.x, GLOW_WIDTH),\n blur(line1, dist.x, GLOW_WIDTH),\n blur(line2, dist.x, GLOW_WIDTH));\n\nreturn blur(column, dist.y, GLOW_HEIGHT);\n}\n\nvec3 filter_lanczos(sampler2D tex, vec2 co, vec2 tex_size, float sharp)\n{\ntex_size.x *= sharp;\n\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 pix_co = co * tex_size - vec2(0.5, 0.0);\nvec2 tex_co = (floor(pix_co) + vec2(0.5, 0.0)) / tex_size;\nvec2 dist = fract(pix_co);\nvec4 coef = PI * vec4(dist.x + 1.0, dist.x, dist.x - 1.0, dist.x - 2.0);\n\ncoef = FIX(coef);\ncoef = 2.0 * sin(coef) * sin(coef / 2.0) / (coef * coef);\ncoef /= dot(coef, vec4(1.0));\n\nvec4 col1 = vec4(TEX2D(tex_co), 1.0);\nvec4 col2 = vec4(TEX2D(tex_co + dx), 1.0);\n\nreturn (mat4(col1, col1, col2, col2) * coef).rgb;\n}\n\nvec3 get_scanline_weight(float x, vec3 col)\n{\nvec3 beam = mix(vec3(SCANLINE_SIZE_MIN), vec3(SCANLINE_SIZE_MAX), col);\nvec3 x_mul = 2.0 / beam;\nvec3 x_offset = x_mul * 0.5;\n\nreturn smoothstep(0.0, 1.0, 1.0 - abs(x * x_mul - x_offset)) * x_offset;\n}\n\nvec3 get_mask_weight(float x)\n{\nfloat i = mod(floor(x * OutputSize.x * TextureSize.x / (InputSize.x * MASK_SIZE)), MASK_COLORS);\n\nif (i == 0.0) return mix(vec3(1.0, 0.0, 1.0), vec3(1.0, 0.0, 0.0), MASK_COLORS - 2.0);\nelse if (i == 1.0) return vec3(0.0, 1.0, 0.0);\nelse return vec3(0.0, 0.0, 1.0);\n}\n\nvoid main()\n{\nvec3 col_glow = filter_gaussian(Texture, Coord, TextureSize);\nvec3 col_soft = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_IMAGE);\nvec3 col_sharp = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_EDGES);\nvec3 col = sqrt(col_sharp * col_soft);\n\ncol *= get_scanline_weight(fract(Coord.y * TextureSize.y), col_soft);\ncol_glow = saturate(col_glow - col);\ncol += col_glow * col_glow * GLOW_HALATION;\ncol = mix(col, col * get_mask_weight(Coord.x) * MASK_COLORS, MASK_STRENGTH);\ncol += col_glow * GLOW_DIFFUSION;\ncol = pow(col * BRIGHTNESS, vec3(1.0 / GAMMA_OUTPUT));\n\nFragColor = vec4(col, 1.0);\n}\n\n#endif\n',"crt-geom.glsl":'\n/*\nCRT-interlaced\n\nCopyright (C) 2010-2012 cgwg, Themaister and DOLLS\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2 of the License, or (at your option)\nany later version.\n\n(cgwg gave their consent to have the original version of this shader\ndistributed under the GPL in this message:\n\nhttp://board.byuu.org/viewtopic.php?p=26075#p26075\n\n"Feel free to distribute my shaders under the GPL. After all, the\nbarrel distortion code was taken from the Curvature shader, which is\nunder the GPL."\n)\nThis shader variant is pre-configured with screen curvature\n*/\n/*\n#pragma parameter CRTgamma "CRTGeom Target Gamma" 2.4 0.1 5.0 0.1\n#pragma parameter monitorgamma "CRTGeom Monitor Gamma" 2.2 0.1 5.0 0.1\n#pragma parameter d "CRTGeom Distance" 1.6 0.1 3.0 0.1\n#pragma parameter CURVATURE "CRTGeom Curvature Toggle" 1.0 0.0 1.0 1.0\n#pragma parameter R "CRTGeom Curvature Radius" 2.0 0.1 10.0 0.1\n#pragma parameter cornersize "CRTGeom Corner Size" 0.03 0.001 1.0 0.005\n#pragma parameter cornersmooth "CRTGeom Corner Smoothness" 1000.0 80.0 2000.0 100.0\n#pragma parameter x_tilt "CRTGeom Horizontal Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter y_tilt "CRTGeom Vertical Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter overscan_x "CRTGeom Horiz. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter overscan_y "CRTGeom Vert. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter DOTMASK "CRTGeom Dot Mask Toggle" 0.3 0.0 0.3 0.3\n#pragma parameter SHARPER "CRTGeom Sharpness" 1.0 1.0 3.0 1.0\n#pragma parameter scanline_weight "CRTGeom Scanline Weight" 0.3 0.1 0.5 0.05\n*/\n\n#ifndef PARAMETER_UNIFORM\n#define CRTgamma 2.4\n#define monitorgamma 2.2\n#define d 1.6\n#define CURVATURE 1.0\n#define R 2.0\n#define cornersize 0.03\n#define cornersmooth 1000.0\n#define x_tilt 0.0\n#define y_tilt 0.0\n#define overscan_x 100.0\n#define overscan_y 100.0\n#define DOTMASK 0.3\n#define SHARPER 1.0\n#define scanline_weight 0.3\n#endif\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\n#define FIX(c) max(abs(c), 1e-5);\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = R*acos(a);\nreturn uv*r/sin(r/R);\n}\n\nvec2 fwtrans(vec2 uv)\n{\nfloat r = FIX(sqrt(dot(uv,uv)));\nuv *= sin(r/R)/r;\nfloat x = 1.0-cos(r/R);\nfloat D = d/R + x*cosangle.x*cosangle.y+dot(uv,sinangle);\nreturn d*(uv*cosangle-x*sinangle)/D;\n}\n\nvec3 maxscale()\n{\nvec2 c = bkwtrans(-R * sinangle / (1.0 + R/d*cosangle.x*cosangle.y));\nvec2 a = vec2(0.5,0.5)*aspect;\nvec2 lo = vec2(fwtrans(vec2(-a.x,c.y)).x, fwtrans(vec2(c.x,-a.y)).y)/aspect;\nvec2 hi = vec2(fwtrans(vec2(+a.x,c.y)).x, fwtrans(vec2(c.x,+a.y)).y)/aspect;\nreturn vec3((hi+lo)*aspect*0.5,max(hi.x-lo.x,hi.y-lo.y));\n}\n\nvoid main()\n{\n// START of parameters\n\n// gamma of simulated CRT\n//\tCRTgamma = 1.8;\n// gamma of display monitor (typically 2.2 is correct)\n//\tmonitorgamma = 2.2;\n// overscan (e.g. 1.02 for 2% overscan)\noverscan = vec2(1.00,1.00);\n// aspect ratio\naspect = vec2(1.0, 0.75);\n// lengths are measured in units of (approximately) the width\n// of the monitor simulated distance from viewer to monitor\n//\td = 2.0;\n// radius of curvature\n//\tR = 1.5;\n// tilt angle in radians\n// (behavior might be a bit wrong if both components are\n// nonzero)\nconst vec2 angle = vec2(0.0,0.0);\n// size of curved corners\n//\tcornersize = 0.03;\n// border smoothness parameter\n// decrease if borders are too aliased\n//\tcornersmooth = 1000.0;\n\n// END of parameters\n\nvec4 _oColor;\nvec2 _otexCoord;\ngl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];\n_oPosition1 = gl_Position;\n_oColor = COLOR;\n_otexCoord = TexCoord.xy;\nCOL0 = COLOR;\nTEX0.xy = TexCoord.xy;\n\n// Precalculate a bunch of useful values we\'ll need in the fragment\n// shader.\nsinangle = sin(vec2(x_tilt, y_tilt)) + vec2(0.001);//sin(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\ncosangle = cos(vec2(x_tilt, y_tilt)) + vec2(0.001);//cos(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\nstretch = maxscale();\n\nilfac = vec2(1.0,clamp(floor(InputSize.y/200.0), 1.0, 2.0));\n\n// The size of one texel, in texture-coordinates.\nvec2 sharpTextureSize = vec2(SHARPER * TextureSize.x, TextureSize.y);\none = ilfac / sharpTextureSize;\n\n// Resulting X pixel-coordinate of the pixel we\'re drawing.\nmod_factor = TexCoord.x * TextureSize.x * OutputSize.x / InputSize.x;\n\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nstruct output_dummy {\nvec4 _color;\n};\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\n\n// Comment the next line to disable interpolation in linear gamma (and\n// gain speed).\n#define LINEAR_PROCESSING\n\n// Enable screen curvature.\n// #define CURVATURE\n\n// Enable 3x oversampling of the beam profile\n#define OVERSAMPLE\n\n// Use the older, purely gaussian beam profile\n//#define USEGAUSSIAN\n\n// Macros.\n#define FIX(c) max(abs(c), 1e-5);\n#define PI 3.141592653589\n\n#ifdef LINEAR_PROCESSING\n# define TEX2D(c) pow(COMPAT_TEXTURE(Texture, (c)), vec4(CRTgamma))\n#else\n# define TEX2D(c) COMPAT_TEXTURE(Texture, (c))\n#endif\n\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = FIX(R*acos(a));\nreturn uv*r/sin(r/R);\n}\n\nvec2 transform(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord-vec2(0.5))*aspect*stretch.z+stretch.xy;\nreturn (bkwtrans(coord)/vec2(overscan_x / 100.0, overscan_y / 100.0)/aspect+vec2(0.5)) * InputSize / TextureSize;\n}\n\nfloat corner(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord - vec2(0.5)) * vec2(overscan_x / 100.0, overscan_y / 100.0) + vec2(0.5);\ncoord = min(coord, vec2(1.0)-coord) * aspect;\nvec2 cdist = vec2(cornersize);\ncoord = (cdist - min(coord,cdist));\nfloat dist = sqrt(dot(coord,coord));\nreturn clamp((cdist.x-dist)*cornersmooth,0.0, 1.0);\n}\n\n// Calculate the influence of a scanline on the current pixel.\n//\n// \'distance\' is the distance in texture coordinates from the current\n// pixel to the scanline in question.\n// \'color\' is the colour of the scanline at the horizontal location of\n// the current pixel.\nvec4 scanlineWeights(float distance, vec4 color)\n{\n// "wid" controls the width of the scanline beam, for each RGB\n// channel The "weights" lines basically specify the formula\n// that gives you the profile of the beam, i.e. the intensity as\n// a function of distance from the vertical center of the\n// scanline. In this case, it is gaussian if width=2, and\n// becomes nongaussian for larger widths. Ideally this should\n// be normalized so that the integral across the beam is\n// independent of its width. That is, for a narrower beam\n// "weights" should have a higher peak at the center of the\n// scanline than for a wider beam.\n#ifdef USEGAUSSIAN\nvec4 wid = 0.3 + 0.1 * pow(color, vec4(3.0));\nvec4 weights = vec4(distance / wid);\nreturn 0.4 * exp(-weights * weights) / wid;\n#else\nvec4 wid = 2.0 + 2.0 * pow(color, vec4(4.0));\nvec4 weights = vec4(distance / scanline_weight);\nreturn 1.4 * exp(-pow(weights * inversesqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);\n#endif\n}\n\nvoid main()\n{\n// Here\'s a helpful diagram to keep in mind while trying to\n// understand the code:\n//\n// | | | | |\n// -------------------------------\n// | | | | |\n// | 01 | 11 | 21 | 31 | <-- current scanline\n// | | @ | | |\n// -------------------------------\n// | | | | |\n// | 02 | 12 | 22 | 32 | <-- next scanline\n// | | | | |\n// -------------------------------\n// | | | | |\n//\n// Each character-cell represents a pixel on the output\n// surface, "@" represents the current pixel (always somewhere\n// in the bottom half of the current scan-line, or the top-half\n// of the next scanline). The grid of lines represents the\n// edges of the texels of the underlying texture.\n\n// Texture coordinates of the texel containing the active pixel.\nvec2 xy = (CURVATURE > 0.5) ? transform(TEX0.xy) : TEX0.xy;\n\nfloat cval = corner(xy);\n\n// Of all the pixels that are mapped onto the texel we are\n// currently rendering, which pixel are we currently rendering?\nvec2 ilvec = vec2(0.0,ilfac.y > 1.5 ? mod(float(FrameCount),2.0) : 0.0);\nvec2 ratio_scale = (xy * TextureSize - vec2(0.5) + ilvec)/ilfac;\n#ifdef OVERSAMPLE\nfloat filter_ = InputSize.y/OutputSize.y;//fwidth(ratio_scale.y);\n#endif\nvec2 uv_ratio = fract(ratio_scale);\n\n// Snap to the center of the underlying texel.\nxy = (floor(ratio_scale)*ilfac + vec2(0.5) - ilvec) / TextureSize;\n\n// Calculate Lanczos scaling coefficients describing the effect\n// of various neighbour texels in a scanline on the current\n// pixel.\nvec4 coeffs = PI * vec4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);\n\n// Prevent division by zero.\ncoeffs = FIX(coeffs);\n\n// Lanczos2 kernel.\ncoeffs = 2.0 * sin(coeffs) * sin(coeffs / 2.0) / (coeffs * coeffs);\n\n// Normalize.\ncoeffs /= dot(coeffs, vec4(1.0));\n\n// Calculate the effective colour of the current and next\n// scanlines at the horizontal location of the current pixel,\n// using the Lanczos coefficients above.\nvec4 col = clamp(mat4(\n TEX2D(xy + vec2(-one.x, 0.0)),\n TEX2D(xy),\n TEX2D(xy + vec2(one.x, 0.0)),\n TEX2D(xy + vec2(2.0 * one.x, 0.0))) * coeffs,\n 0.0, 1.0);\nvec4 col2 = clamp(mat4(\n TEX2D(xy + vec2(-one.x, one.y)),\n TEX2D(xy + vec2(0.0, one.y)),\n TEX2D(xy + one),\n TEX2D(xy + vec2(2.0 * one.x, one.y))) * coeffs,\n 0.0, 1.0);\n\n#ifndef LINEAR_PROCESSING\ncol = pow(col , vec4(CRTgamma));\ncol2 = pow(col2, vec4(CRTgamma));\n#endif\n\n// Calculate the influence of the current and next scanlines on\n// the current pixel.\nvec4 weights = scanlineWeights(uv_ratio.y, col);\nvec4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2);\n#ifdef OVERSAMPLE\nuv_ratio.y =uv_ratio.y+1.0/3.0*filter_;\nweights = (weights+scanlineWeights(uv_ratio.y, col))/3.0;\nweights2=(weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2))/3.0;\nuv_ratio.y =uv_ratio.y-2.0/3.0*filter_;\nweights=weights+scanlineWeights(abs(uv_ratio.y), col)/3.0;\nweights2=weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2)/3.0;\n#endif\n\nvec3 mul_res = (col * weights + col2 * weights2).rgb * vec3(cval);\n\n// dot-mask emulation:\n// Output pixels are alternately tinted green and magenta.\nvec3 dotMaskWeights = mix(\nvec3(1.0, 1.0 - DOTMASK, 1.0),\nvec3(1.0 - DOTMASK, 1.0, 1.0 - DOTMASK),\nfloor(mod(mod_factor, 2.0))\n);\n\nmul_res *= dotMaskWeights;\n\n// Convert the image gamma for display on our output device.\nmul_res = pow(mul_res, vec3(1.0 / monitorgamma));\n\n// Color the texel.\noutput_dummy _OUT;\n_OUT._color = vec4(mul_res, 1.0);\nFragColor = _OUT._color;\nreturn;\n} \n#endif\n\n'},me=e(57),J=e(11),Q={addStyleHook:function(){H(this.elements.container,this.config.selectors.container.replace(".",""),!0),H(this.elements.container,this.config.classNames.uiSupported,!0),H(this.elements.container,this.config.classNames.hideControls,!0)},build:function(){this.listeners.media(),F.element(this.elements.controls)||(ae.inject.call(this),this.listeners.controls()),this.volume=null,this.muted=null,ae.updateVolume.call(this),H(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0},toggleControls:function(e){var n,t,a=this.elements.controls;a&&(n=0,t=r.call(this,".".concat(X({ejs__dialogs:!0})," > .").concat(X({ejs__dialog:!0}))),Array.from(t).forEach(function(e,t){!0!==e.hidden&&(n+=1)}),0>>0},i.prototype.readU24=function(){return this.littleEndian?this._lastRead=this._u8array[this.offset]+(this._u8array[this.offset+1]<<8)+(this._u8array[this.offset+2]<<16):this._lastRead=(this._u8array[this.offset]<<16)+(this._u8array[this.offset+1]<<8)+this._u8array[this.offset+2],this.offset+=3,this._lastRead>>>0},i.prototype.readU32=function(){return this.littleEndian?this._lastRead=this._u8array[this.offset]+(this._u8array[this.offset+1]<<8)+(this._u8array[this.offset+2]<<16)+(this._u8array[this.offset+3]<<24):this._lastRead=(this._u8array[this.offset]<<24)+(this._u8array[this.offset+1]<<16)+(this._u8array[this.offset+2]<<8)+this._u8array[this.offset+3],this.offset+=4,this._lastRead>>>0},i.prototype.readBytes=function(e){this._lastRead=new Array(e);for(var t=0;t>8):(this._u8array[this.offset]=e>>8,this._u8array[this.offset+1]=255&e),this.offset+=2},i.prototype.writeU24=function(e){this.littleEndian?(this._u8array[this.offset]=255&e,this._u8array[this.offset+1]=(65280&e)>>8,this._u8array[this.offset+2]=(16711680&e)>>16):(this._u8array[this.offset]=(16711680&e)>>16,this._u8array[this.offset+1]=(65280&e)>>8,this._u8array[this.offset+2]=255&e),this.offset+=3},i.prototype.writeU32=function(e){this.littleEndian?(this._u8array[this.offset]=255&e,this._u8array[this.offset+1]=(65280&e)>>8,this._u8array[this.offset+2]=(16711680&e)>>16,this._u8array[this.offset+3]=(4278190080&e)>>24):(this._u8array[this.offset]=(4278190080&e)>>24,this._u8array[this.offset+1]=(16711680&e)>>16,this._u8array[this.offset+2]=(65280&e)>>8,this._u8array[this.offset+3]=255&e),this.offset+=4},i.prototype.writeBytes=function(e){for(var t=0;tn&&(n=o.offset+o.length):o.offset+o.data.length>n&&(n=o.offset+o.data.length)}n===e.fileSize?t=e.slice(0,e.fileSize):(t=new Z(n),e.copyToFile(t,0))}for(e.seek(0),a=0;a>>1:n>>>1;e[t]=n}return e}();function $(e,t,n){for(var a=t?new Uint8Array(e._u8array.buffer,t):e._u8array,o=-1,i=n?a.length-4:a.length,s=0;s>>8^ye[255&(o^a[s])];return(-1^o)>>>0}var be=1,_e=2,Te=3;function xe(){this.sourceSize=0,this.targetSize=0,this.metaData="",this.actions=[],this.sourceChecksum=0,this.targetChecksum=0,this.patchChecksum=0}function Se(e){e.readVLV=we,e.littleEndian=!0;var t=new xe,n=(e.seek(4),t.sourceSize=e.readVLV(),t.targetSize=e.readVLV(),e.readVLV());n&&(t.metaData=e.readString(n));for(var a=e.fileSize-12;e.offset>2)};i.type===be?i.bytes=e.readBytes(i.length):i.type!==_e&&i.type!==Te||(o=e.readVLV(),i.relativeOffset=(1&o?-1:1)*(o>>1)),t.actions.push(i)}if(t.sourceChecksum=e.readU32(),t.targetChecksum=e.readU32(),t.patchChecksum=e.readU32(),t.patchChecksum!==$(e,0,!0))throw new Error("error_crc_patch");return t}function we(){for(var e=0,t=1;;){var n=this.readU8();if(e+=(127&n)*t,128&n)break;e+=t<<=7}return this._lastRead=e}function Ee(e){for(;;){var t=127&e;if(0==(e>>=7)){this.writeU8(128|t);break}this.writeU8(t),e--}}function Ce(e){for(var t=0;;){if(0==(e>>=7)){t++;break}t++,e--}return t}xe.prototype.toString=function(){var e="Source size: "+this.sourceSize;return(e=(e+="\nTarget size: "+this.targetSize)+("\nMetadata: "+this.metaData))+("\n#Actions: "+this.actions.length)},xe.prototype.validateSource=function(e,t){return this.sourceChecksum===$(e,t)},xe.prototype.apply=function(e,t){if(t&&!this.validateSource(e))throw new Error("error_crc_input");for(var n=new Z(this.targetSize),a=0,o=0,i=0;i>=7)){this.writeU8(128|t);break}this.writeU8(t),--e}}function Ae(){for(var e=0,t=1;;){var n=this.readU8();if(-1==n)throw new Error("Can't read UPS VLV at 0x"+(this.offset-1).toString(16));if(e+=(127&n)*t,0!=(128&n))break;e+=t<<=7}return e}function Pe(e){for(var t=0;t++,0!=(e>>=7);)--e;return t}function Ie(e){var t=new d;for(e.readVLV=Ae,e.seek(Me.length),t.sizeInput=e.readVLV(),t.sizeOutput=e.readVLV();e.offset\n \n \n \n ",e=U("iframe",{src:m.adUrl,scrolling:"no",frameborder:"no",style:"width:300px !important;height:250px !important;display: block !important;"}),ee.loading.querySelector(".".concat(T.ad)).removeChild(ee.loading.querySelector(".".concat(T.ad," iframe"))),ee.loading.querySelector(".".concat(T.ad)).appendChild(e),Y.webgl.DETECTED||(V(ee.loading.querySelector(".".concat(T["start-game"])),!0),ee.loading.querySelector(".".concat(T.p3)).innerHTML='Failed to initialize WebGL. '),ee.loading.querySelector(".".concat(T.ad," iframe")).style.setProperty("display","block","important"),ee.loading.querySelector(".".concat(T.ad," iframe")).style.setProperty("visibility","visible","important"),ee.loading.querySelector(".".concat(T.ad)).style.setProperty("display","block","important"),ee.loading.querySelector(".".concat(T.ad)).style.setProperty("visibility","visible","important")):(ee.loading.innerHTML='\n "),Y.webgl.DETECTED||(V(ee.loading.querySelector(".".concat(T["start-game"])),!0),ee.loading.querySelector(".".concat(T.p3)).innerHTML='Failed to initialize WebGL. ')),window.URL||window.webkitURL),x=function(e){return 80===e[0]&&75===e[1]&&(3===e[2]&&4===e[3]||5===e[2]&&6===e[3]||7===e[2]&&8===e[3])?"zip":55===e[0]&&122===e[1]&&188===e[2]&&175===e[3]&&39===e[4]&&28===e[5]?"7z":82===e[0]&&97===e[1]&&114===e[2]&&33===e[3]&&26===e[4]&&7===e[5]&&(0===e[6]||1===e[6]&&0==e[7])?"rar":void 0},S=async function(e){e=await(await fetch(e)).text(),e=new Blob([e],{type:"application/javascript"}),e=window.URL.createObjectURL(e);return new Worker(e)},w=async function(e){var t=await(await fetch(e)).text(),e=new Blob(["\nvar dataToPass = [];\nModule = {\n monitorRunDependencies: function(left) {\n if (left == 0) {\n setTimeout(function() {\n unrar(dataToPass, null);\n }, 100);\n }\n },\n onRuntimeInitialized: function() {\n },\n locateFile: function(file) {\n return '"+e+".mem';\n }\n};\n"+t+'\nvar unrar = function(data, password) {\n var cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n var rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n var rec = function(entry) {\n if (entry.type === \'file\') {\n postMessage({"t":2,"file":entry.fullFileName,"size":entry.fileSize,"data":entry.fileContent});\n } else if (entry.type === \'dir\') {\n Object.keys(entry.ls).forEach(function(k) {\n rec(entry.ls[k]);\n })\n } else {\n throw "Unknown type";\n }\n }\n rec(rarContent);\n postMessage({"t":1});\n return rarContent;\n};\nonmessage = function(data) {\n dataToPass.push({name: \'test.rar\', content: data.data});\n};\n '],{type:"application/javascript"}),t=window.URL.createObjectURL(e);return new Worker(t)},E=null,C=null,l=null,M=null;try{E=new me({dbVersion:1,storePrefix:"ejs-",storeName:"system",keyPath:null,autoIncrement:!1,onStoreReady:function(){n=!0},onError:function(){n=!0}}),C=new me({dbVersion:1,storePrefix:"ejs-",storeName:"roms",keyPath:null,autoIncrement:!1,onStoreReady:function(){a=!0},onError:function(){a=!0}}),l=new me({dbVersion:1,storePrefix:"ejs-",storeName:"bios",keyPath:null,autoIncrement:!1,onStoreReady:function(){o=!0},onError:function(){o=!0}}),M=new me({dbVersion:1,storePrefix:"ejs-",storeName:"romsdata",keyPath:null,autoIncrement:!1,onStoreReady:function(){},onError:function(){}})}catch(e){o=a=n=!0,console.log(e)}B.call(m,m.elements.container,"start-game",function(e){m.started=!0,m.playing=!0,V(ee.loading.querySelector(".".concat(T["loading-info"])),!0),!te||"undefined"!=te.virtualGamepadContainer&&null!==te.virtualGamepadContainer||Q.toggleControls.call(m,!0);var t,n,a,o,i,s,r,l,c=X({"ejs__tooltip--visible":!0}),d=m.elements.buttons.gamepad.querySelector(".".concat(X({ejs__tooltip:!0}))),u=(H(d,c,!0),setTimeout(function(){H(d,c,!1)},5e3),"string"==typeof m.adUrl&&(V(ee.loading.querySelector(".".concat(T["close-ad"])),!1),!0!==m.config.noAutoAdClose&&setTimeout(function(){m.started&&ee.loading.querySelector(".".concat(T.ad))&&ee.loading.querySelector(".".concat(T.ad)).parentNode.removeChild(ee.loading.querySelector(".".concat(T.ad)))},1e4)),V(ee.loading.querySelector(".".concat(T["start-game"])),!0),K(ae.defaultCoreOptionsValues.call(p),ae.storage.get("core-options")||{})),f=("n64"===m.system&&u&&Object.keys(u).forEach(function(e){"glupen64-aspect"===e&&"16:9"===u[e]&&(_.height=_.width/16*9,ee.aspectRatio=16/9)}),"arcade"!==p.system&&"fba0.2.97.29"!==p.system||u&&Object.keys(u).forEach(function(e){"fba-aspect"===e&&"PAR"===u[e]&&(_.height=_.width/16*9,ee.aspectRatio=16/9)}),"gba"===m.system&&(_.height=_.width/1.5,ee.aspectRatio=1.5),window.setTimeout(function(){},150),f=p,"undefined"!=typeof RI?(document.removeEventListener("mousemove",RI.eventHandler,!1),_.removeEventListener("mousedown",RI.canvasEventHandler,!1),_.removeEventListener("mouseup",RI.canvasEventHandler,!1),f.elements.container.addEventListener("mousemove",function(e){var t=0,n=0,a=e.offsetX-ee.Module.canvas.offsetLeft,o=e.offsetY-ee.Module.canvas.offsetTop;if("mousemove"===e.type){t=a<0?(a=0,-ee.Module.canvas.offsetWidth):a>ee.Module.canvas.offsetWidth?(a=ee.Module.canvas.offsetWidth,ee.Module.canvas.offsetWidth):a-RI.currentX,n=o<0?(o=0,-ee.Module.canvas.offsetHeight):o>ee.Module.canvas.offsetHeight?(o=ee.Module.canvas.offsetHeight,ee.Module.canvas.offsetHeight):o-RI.currentY,RI.currentX=a,RI.currentY=o;for(var i=0;i>2]=t,HEAP32[RI.contexts[i].state+36>>2]=n}},!1),f.elements.container.addEventListener("mousedown",RI.canvasEventHandler,!1),f.elements.container.addEventListener("mouseup",RI.canvasEventHandler,!1),f.elements.container.addEventListener("touchstart",t=function(e){if(e.targetTouches[0]){var t,n=0,a=0,o=e.target.getBoundingClientRect(),i=e.targetTouches[0].clientX-o.left,o=e.targetTouches[0].clientY-o.top,n=i<0?(i=0,-ee.Module.canvas.offsetWidth):i>ee.Module.canvas.offsetWidth?(i=ee.Module.canvas.offsetWidth,ee.Module.canvas.offsetWidth):i-RI.currentX,a=o<0?(o=0,-ee.Module.canvas.offsetHeight):o>ee.Module.canvas.offsetHeight?(o=ee.Module.canvas.offsetHeight,ee.Module.canvas.offsetHeight):o-RI.currentY;RI.currentX=i,RI.currentY=o;for(var s=0;s>2]=n,HEAP32[RI.contexts[s].state+36>>2]=a;switch(e.type){case"touchend":case"touchstart":if(0===e.button)t=40;else{if(2!==e.button)break;t=41}for(var r="touchend"===e.type?0:1,l=0;l>0]=r}}},!1),f.elements.container.addEventListener("touchend",t,!1)):(f=function(e){e=new MouseEvent(e.type,e);ee.Module.canvas.dispatchEvent(e)},q.call(p,".".concat(X({ejs__dialogs:!0}))).addEventListener("mousemove",f,!1),q.call(p,".".concat(X({ejs__dialogs:!0}))).addEventListener("mousedown",f,!1),q.call(p,".".concat(X({ejs__dialogs:!0}))).addEventListener("mouseup",f,!1)),"msx"===m.system&&"undefined"!=typeof RI&&(document.removeEventListener("keydown",RI.eventHandler,!1),document.removeEventListener("keyup",RI.eventHandler,!1),t=function(e){var t=e.keyCode,n=t>>3,a=1<<(7&t);switch(e.type){case"keyup":case"keydown":if(32<=n)throw"key code error! bad code: "+t;for(var o=0;o>0];"keyup"===e.type?i&=~a:i|=a,HEAP8[RI.contexts[o].state+n>>0]=i}}},document.addEventListener("keydown",t,!1),document.addEventListener("keyup",t,!1)),setTimeout(function(){var o=W.info();null===te.setVolume&&"undefined"!=typeof RA?(RA.queueAudio=function(){var e=m.volume,t=RA.bufIndex,n=RA.bufIndex?RA.buffers[RA.bufIndex-1].endTime:RA.context.currentTime,a=(RA.buffers[t].endTime=n+RA.buffers[t].duration,RA.context.createBufferSource());a.buffer=RA.buffers[t],1===(e=m.muted?0:e)?a.connect(RA.context.destination):(t=RA.context.createGain(),a.connect(t),t.connect(RA.context.destination),W.isEdge||"chrome"===o.name&&parseInt(o.version,10)<=60||"firefox"===o.name&&parseInt(o.version,10)<=56||"opera"===o.name&&parseInt(o.version,10)<=44?t.gain.value=e:"firefox"===o.name?t.gain.setValueAtTime(e,RA.context.currentTime):t.gain.setValueAtTime(e,RA.context.currentTime,0)),a.start(n),RA.bufIndex+=1,RA.bufOffset=0},W.isIos&&window.addEventListener("touchstart",function(){var e;RA.context&&(RA.context.resume(),(e=RA.context.createBufferSource()).connect(RA.context.destination),e.start())},!1)):te.setVolume()},500),setTimeout(function(){m.elements.container.focus()},30),void 0===window.addRunDependency&&(window.Module=void 0),ee.FS.readFile(m.startName));f.length<=33554432&&".cue"!=m.startName.substr(-4)&&(a="snes"===m.system||["snes2002","snes2005","snes2010"].includes(m.system)?(n=f.length%1024,new Z(n?f.slice?f.slice(n):f.subarray(n):f)):new Z(f),o=Re.a.create(),i=new FileReader,s=0,r=a._u8array.length,l=function(){var e;sDoesn\'t look like your browser is supported'}else i.innerHTML='Invalid Rom '}function a(e){if(e.data){if(1===e.data.t&&(o.startName,e.target.terminate(),n(o.startName)),2===e.data.t){var t=e.data.file.replace(/\#/g,"");try{d+=e.data.data.length,ee._FS.createDataFile("/",t,e.data.data,!0,!1),f[s].includes(e.data.file.split(".").pop())&&(o.startName=e.data.file)}catch(e){console.log(e)}}4===e.data.t&&0'+z.localization("Missing mame config")+"");r=r.split("|");ee.coreFileName="".concat(z.system,"-").concat(r[0]),a="1"===r[1],F.element(z.elements.buttons.saveState)&&V(z.elements.buttons.saveState,!a),F.element(z.elements.buttons.loadState)&&V(z.elements.buttons.loadState,!a),V(ae.contextMenu.querySelectorAll("ul li").item(2),!a),V(ae.contextMenu.querySelectorAll("ul li").item(3),!a),c=2===z.coreVer?"":z.system.concat("-old-").concat(r[0],"-wasm.data"),r[0]?(Y.wasm&&i?u=!0:(s.innerHTML=''+z.localization("Webassembly support is not detected in this browser")+" ",c=""),c&&(E.db?E.get(c,function(e){e&&e.version===n?2===m.coreVer?k(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),k(e)):d(c,n)}):d(c,n))):s.innerHTML=''+z.localization("Unsupported Game")+" "}else{var l,c=!1;if(Y.wasm&&i?(l="wasm",c=!0,"n64"!==z.system||e||2===z.coreVer||(l="legacy-wasm"),u=!0):o&&(c=!0,l="asmjs","n64"!==z.system||e||2===z.coreVer||(l="legacy-asmjs")),!0!==(c="undefined"!=typeof EJS_CUSTOM_COREFILE?EJS_CUSTOM_COREFILE:c))return void(s.innerHTML=''+z.localization("Please upgrade your browser to the latest version")+" ");c=2===z.coreVer?t+"-"+l+".data":t+"-old-"+l+".data","undefined"!=typeof EJS_CUSTOM_COREFILE&&(c=EJS_CUSTOM_COREFILE),E.db?E.get(c,function(e){!e||e.version!==n||"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX?d(c,n):2===m.coreVer?k(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),k(e))}):d(c,n)}F.element(z.elements.buttons.saveState)&&V(z.elements.buttons.saveState,!a),F.element(z.elements.buttons.loadState)&&V(z.elements.buttons.loadState,!a),V(ae.contextMenu.querySelectorAll("ul li").item(2),!a),V(ae.contextMenu.querySelectorAll("ul li").item(3),!a),m.setStatesSupported(a),z.config.buttons&&(!1===z.config.buttons.playPause&&F.element(z.elements.buttons.play[0])&&V(z.elements.buttons.play[0],!0),!1===z.config.buttons.restart&&F.element(z.elements.buttons.restart)&&V(z.elements.buttons.restart,!0),!1===z.config.buttons.mute&&F.element(z.elements.buttons.mute)&&V(z.elements.buttons.mute,!0),!1===z.config.buttons.settings&&F.element(z.elements.buttons.settings)&&V(z.elements.buttons.settings,!0),!1===z.config.buttons.fullscreen&&F.element(z.elements.buttons.fullscreen)&&V(z.elements.buttons.fullscreen,!0),!1===z.config.buttons.saveState&&F.element(z.elements.buttons.saveState)&&V(z.elements.buttons.saveState,!0),!1===z.config.buttons.loadState&&F.element(z.elements.buttons.loadState)&&V(z.elements.buttons.loadState,!0),!1===z.config.buttons.screenRecord&&F.element(z.elements.buttons.screenRecord)&&V(z.elements.buttons.screenRecord,!0),!1===z.config.buttons.gamepad&&F.element(z.elements.buttons.gamepad)&&V(z.elements.buttons.gamepad,!0),!1===z.config.buttons.cheat&&F.element(z.elements.buttons.cheat)&&V(z.elements.buttons.cheat,!0),!1===z.config.buttons.volume&&F.element(z.elements.inputs.volume)&&V(z.elements.inputs.volume,!0),!1===z.config.buttons.screenshot&&V(ae.contextMenu.querySelectorAll("ul li").item(0),!0),!0===z.config.buttons.cacheManage&&V(ae.contextMenu.querySelectorAll("ul li").item(1),!1),!1===z.config.buttons.quickSave&&V(ae.contextMenu.querySelectorAll("ul li").item(2),!0),!1===z.config.buttons.quickLoad&&V(ae.contextMenu.querySelectorAll("ul li").item(3),!0))}else s.innerHTML=''+z.localization("Invalid System")+" "}).catch(function(e){D(e,t,m)}),ee.romdb=C,!1;setTimeout(L,50)}};oe(ee.loading.querySelector(".".concat(T["start-game"])),"click touchstart",L),!0===m.startOnLoad&&ee.loading.querySelector(".".concat(T["start-game"])).click()}},p=ee;function Ne(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t ')),!t)return!0;for(var n in t)De(n);return!0}),playerName:"",players:[],waitingList:{},roomMaster:null,inputsData:{},coreOptionData:{},currentFrame:0,wait:!(De=function(e){if(!document.getElementById(e))return!1}),progressHelper:{},icons:{lock:' '},disableInput:!1,disableControl:function(e){if(e){for(var t=0;t<24;t+=1)m.simulateInputFn(0,t,0),m.simulateInputFn(1,t,0),m.simulateInputFn(2,t,0),m.simulateInputFn(3,t,0);m.disableInput=!0}else m.disableInput=!1},isPaused:null,setVolume:null,setVariable:null,simulateInput:null,simulateInputFn:null,toggleShader:null,saveState:null,screenRecord:null,loadState:null,quickSaveState:null,quickLoadState:null,changeStateSlot:null,getScreenData:null,getStateInfo:null,setCheat:null,resetCheat:null,getGameCoreOptions:null,classNames:{"dialog-container":X({"dialog-container":!0}),tabs:X({tabs:!0}),"dialog-title":X({"dialog-title":!0}),"dialog-content":X({"dialog-content":!0}),"dialog-buttons":X({"dialog-buttons":!0}),overlay:X({overlay:!0}),"key-setting-popup":X({"key-setting-popup":!0}),"tabs-panel":X({"tabs-panel":!0}),"tabs-content":X({"tabs-content":!0}),"button-container":X({"button-container":!0}),set:X({set:!0}),active:X({active:!0}),"btn-cancel":X({"btn-cancel":!0}),"btn-reset":X({"btn-reset":!0}),"btn-clear":X({"btn-clear":!0}),"btn-create":X({"btn-create":!0}),"btn-submit":X({"btn-submit":!0}),"btn-join-room":X({"btn-join-room":!0}),"btn-quit":X({"btn-quit":!0}),"btn-create-room":X({"btn-create-room":!0}),modal:X({modal:!0}),modal__overlay:X({modal__overlay:!0}),modal__container:X({modal__container:!0}),modal__header:X({modal__header:!0}),modal__title:X({modal__title:!0}),modal__close:X({modal__close:!0}),modal__content:X({modal__content:!0}),modal__btn:X({modal__btn:!0}),"modal__btn-primary":X({"modal__btn-primary":!0}),"micromodal-slide":X({"micromodal-slide":!0}),modal__errmsg:X({modal__errmsg:!0}),modal__footer:X({modal__footer:!0}),"cheats-add":X({"cheats-add":!0}),"cheats-list":X({"cheats-list":!0}),"cheat-code-input":X({"cheat-code-input":!0}),"cheat-name-input":X({"cheat-name-input":!0}),"ejs-switch":X({"ejs-switch":!0}),"ejs-delete-cheat":X({"ejs-delete-cheat":!0})},initShaders:function(){for(var e,t=he,n=Object.keys(t),a=0;a\n \n
'+r.localization("Control Settings")+' \n \n \n \n \n \n \n
\n
[Select] \n
'+r.localization("Press keyboard or gamepad")+"
\n
\n
\n \n ",'\n \n
\n
\n
Connected gamepad: n/a
\n
\n
\n
\n
\n
'+r.localization("Gamepad")+'
\n
'+r.localization("Keyboard")+'
\n
\n
\n
\n
\n
')),n='\n \n
\n {label}: \n
\n
\n
\n
\n
');"nes"===r.system?i={0:"B",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")}:"snes"===r.system?i={0:"B",1:"Y",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",9:"X",10:"L",11:"R",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")}:"n64"===r.system?(i={0:"B",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",10:"L",11:"R",12:"Z",19:"L STICK UP",18:"L STICK DOWN",17:"L STICK LEFT",16:"L STICK RIGHT",23:"R STICK UP",22:"R STICK DOWN",21:"R STICK LEFT",20:"R STICK RIGHT",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")},2===r.coreVer&&(i[0]="A",i[1]="B",delete i[8])):i="nds"===r.system?{0:"B",1:"Y",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",9:"X",10:"L",11:"R",14:"Microphone",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")}:{0:"B",1:"Y",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",9:"X",10:"L",11:"R",12:"L2",13:"R2",14:"L3",15:"R3",19:"L STICK UP",18:"L STICK DOWN",17:"L STICK LEFT",16:"L STICK RIGHT",23:"R STICK UP",22:"R STICK DOWN",21:"R STICK LEFT",20:"R STICK RIGHT",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")},["arcade","mame"].includes(r.system)&&(i[2]=r.localization("INSERT COIN")),!1===r.statesSupported&&(delete i[24],delete i[25],delete i[26]);for(var a=[2,3,4,5,6,7,8,0,9,1,10,11,12,13,14,15,19,18,17,16,23,22,21,20,24,25,26],t=0;t<=3;t+=1)!function(t){r.elements.dialogs.gamepad.querySelector(".".concat(m.classNames["tabs-content"])).innerHTML+=e.replace(/{index}/g,t),a.forEach(function(e){i[e]&&(r.elements.dialogs.gamepad.querySelector("#controls-".concat(t)).innerHTML+=n.replace(/{index}/g,t).replace(/{id}/g,e).replace(/{label}/g,i[e]))}),r.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc")}(t);Object.keys(m.controllers).forEach(function(a){m.controllers[a]&&Object.keys(m.controllers[a]).forEach(function(e){var t=r.elements.dialogs.gamepad.querySelector('[data-id="'.concat(e,'"][data-index="').concat(a,'"][data-type="1"]')),n=r.elements.dialogs.gamepad.querySelector('[data-id="'.concat(e,'"][data-index="').concat(a,'"][data-type="2"]'));if(!t||!n)return!1;e=m.controllers[a][e];e&&(e.type&&1!==parseInt(e.type,10)?n.value="":e.value&&(t.value=m.keyMap[e.value]||"",t.setAttribute("data-value",e.value)),e.value2&&(n.value=isNaN(e.value2)?e.value2:"button ".concat(parseInt(e.value2,10)+1),n.setAttribute("data-value",e.value2)))})}),B.call(this,r.elements.dialogs.gamepad.querySelector(".".concat(m.classNames["btn-submit"])),"click",function(e){var t=r.elements.dialogs.gamepad.querySelectorAll("input"),o={};return Array.from(t).forEach(function(e){var t,n=e.getAttribute("data-index"),a=e.getAttribute("data-value"),e=(2===parseInt(e.getAttribute("data-type"),10)&&(t=e.getAttribute("data-value")),e.getAttribute("data-id"));o[n]||(o[n]={}),o[n][e]||(o[n][e]={}),a&&(o[n][e].value=a),t&&(o[n][e].value2=t)}),ae.storage.set({controllers:o}),m.controllers=o,V(r.elements.dialogs.gamepad,!0),r.elements.container.focus(),e.stopPropagation(),!1}),B.call(this,r.elements.dialogs.gamepad.querySelector(".".concat(m.classNames["btn-reset"])),"click",function(e){m.controllers=JSON.parse(JSON.stringify(m.defaultControllers)),localStorage.removeItem(ae.storage.key);for(var t=r.elements.dialogs.gamepad.querySelectorAll("input"),n=0;nGamepad:'.concat(m.gamepad.gamepads[a].id," "+r.localization("Press keyboard or gamepad")+" "+r.localization("Press escape (esc) to clear")):t+=" Press keyboard "+r.localization("Press escape (esc) to clear"),s.querySelector(".".concat(m.classNames["key-setting-popup"])).innerHTML=t,e.stopPropagation()})})},setCacheDialog:function(){var t=this;t.elements.dialogs.cache.innerHTML='\n \n
\n
'+t.localization("Cache Manager")+' \n \n
\n\n
\n
\n
\n "),B.call(this,t.elements.dialogs.cache.querySelector(".".concat(m.classNames["btn-cancel"])),"click",function(e){return V(t.elements.dialogs.cache,!0),t.elements.container.focus(),e.stopPropagation(),!1}),B.call(this,t.elements.dialogs.cache.querySelector(".".concat(m.classNames["dialog-title"]," a")),"click",function(e){return p.romdb&&(p.romdb.clear(),t.elements.dialogs.cache.querySelector(".".concat(m.classNames["dialog-content"])).innerHTML=''+t.localization("Empty")+"
"),e.stopPropagation(),!1})},showLoading:function(e){Be.show("modal-6ed698f3d04061f5",{closeByEsckey:!1}),e&&console.log(""),V(this.elements.dialogs.loading,!1)},hideLoading:function(){Be.close(),V(this.elements.dialogs.loading,!0)},setLoadingDialog:function(){this.elements.dialogs.loading&&(this.elements.dialogs.loading.innerHTML='\n \n
\n
\n '+this.localization("Loading")+"...\n
\n
\n
"))},setCheatDialog:function(){var i,s,a,r=this;r.elements.dialogs.cheat&&(r.elements.dialogs.cheat.innerHTML='\n \n\n \n\n \n
\n
\n \n
\n\n
\n '+r.localization("Code")+' \n \n '+r.localization("Description")+' \n \n\n \n \n
\n
\n
\n "),i=r.elements.dialogs.cheat.querySelector("#modal-85cd7a1c543a484b"),B.call(this,r.elements.dialogs.cheat.querySelector(".".concat(m.classNames["cheats-add"])),"click",function(e){return Be.show("modal-85cd7a1c543a484b",{closeTrigger:"data-modal-close"}),!1}),s=r.elements.dialogs.cheat.querySelector(".".concat(m.classNames["cheats-list"])),B.call(this,i.querySelector(".".concat(m.classNames["modal__btn-primary"])),"click",function(e){var t,n,a=i.querySelector(".".concat(m.classNames["cheat-name-input"])).value,o=i.querySelector(".".concat(m.classNames["cheat-code-input"])).value;return a&&o&&(t=s.querySelectorAll("input:checked"),i.querySelector(".".concat(m.classNames["cheat-name-input"])).value="",i.querySelector(".".concat(m.classNames["cheat-code-input"])).value="",Be.close(),n=r.cheats.length,r.cheats.push([a,o]),s.innerHTML+='\n
\n
').concat(a,' \n
× \n
'),t.forEach(function(e,t){s.querySelector("#ejs-cheat-switch-".concat(t)).setAttribute("checked","checked")})),"localStorage"in window&&localStorage.setItem("".concat(r.system,"-").concat(r.startName,"-cheats"),JSON.stringify(r.cheats)),e.stopPropagation(),!1}),a=function(){if("localStorage"in window){var e=localStorage.getItem("".concat(r.system,"-").concat(r.startName,"-cheats"));try{e=JSON.parse(e)}catch(e){}e&&(r.cheats=e)}s.innerHTML="",r.cheats&&Array.isArray(r.cheats)&&r.cheats.forEach(function(e,t){var n=e[0];e[1],s.innerHTML+='\n
\n
').concat(n,' \n
× \n
')})},B.call(r,s,"click",function(e){var t,n;return e.target&&e.target.classList.contains(m.classNames["ejs-delete-cheat"])&&e.target.getAttribute("data-idx")&&(t=e.target.getAttribute("data-idx"),r.cheats.splice(t,1),"localStorage"in window&&localStorage.setItem("".concat(r.system,"-").concat(r.startName,"-cheats"),JSON.stringify(r.cheats)),n=[],s.querySelectorAll("input").forEach(function(e,t){n[t]=!!s.querySelector("#ejs-cheat-switch-".concat(t,":checked"))}),n.splice(t,1),a(),n.forEach(function(e,t){e&&s.querySelector("#ejs-cheat-switch-".concat(t)).setAttribute("checked","checked")})),e.stopPropagation(),!1}),B.call(r,r.elements.container,"start-game",function(e){a()}),B.call(this,r.elements.dialogs.cheat.querySelector(".".concat(m.classNames["btn-cancel"])),"click",function(e){return V(r.elements.dialogs.cheat,!0),e.stopPropagation(),r.elements.container.focus(),!1}),B.call(this,r.elements.dialogs.cheat.querySelector(".".concat(m.classNames["btn-submit"])),"click",function(e){return m.resetCheat(),s.querySelectorAll("input:checked").forEach(function(e,t){e=r.cheats[e.value];e&&m.setCheat(t,1,e[1])}),V(r.elements.dialogs.cheat,!0),r.elements.container.focus(),!1}),"arcade"!==r.system&&"mame"!==r.system&&"mame2003"!==r.system&&"mame2010"!==r.system||(F.element(r.elements.buttons.cheat)&&V(r.elements.buttons.cheat,!0),m.allowCheat=!1),m.setCheat||(V(r.elements.buttons.cheat,!0),m.allowCheat=!1))},initKeyboard:function(){var i=this,s=this,r=this.elements.dialogs.gamepad.querySelector(".".concat(m.classNames.overlay));B.call(this,document.body,"keydown keyup",function(n){if(!(112<=n.which&&n.which<=123)){var e=!i.elements.dialogs.gamepad.hidden&&!r.hidden,a="keydown"===n.type;if(a&&e){var e=r.getAttribute("data-index"),t=r.getAttribute("data-id"),o=null;if(n.key&&"escape"===m.keyMap[n.keyCode])return(o=s.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="1"]'))).setAttribute("data-value",""),o.value=""(o=s.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="2"]'))).setAttribute("data-value",""),o.value="",void V(r,!0);e=r.getAttribute("data-index"),t=r.getAttribute("data-id"),o=null;n.key&&((o=s.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="1"]'))).setAttribute("data-value",n.keyCode),o.value=m.keyMap[n.keyCode]),V(r,!0)}else Object.keys(m.controllers).forEach(function(t){Object.keys(m.controllers[t]).forEach(function(e){parseInt(m.controllers[t][e].value,10)===n.keyCode&&["24","25","26"].includes(e)&&"keydown"==n.type&&!n.repeat&&("24"==e?m.quickSaveState():"25"==e?m.quickLoadState():"26"==e&&m.changeStateSlot()),parseInt(m.controllers[t][e].value,10)===n.keyCode&&(a?16<=e&&e<=23?m.simulateInput(t,e,32767):m.simulateInput(t,e,1):m.simulateInput(t,e,0))})})}}),document.body.addEventListener("keydown",function(e){var t=e.keyCode||e.which;[32,37,38,39,40,112,113,114,115,116,117,118,119,120,121,122,123].includes(t)&&e.srcElement===s.elements.container&&e.preventDefault(),e.srcElement.className.split(/ +/).includes(m.classNames.set)&&e.preventDefault()})},initGamepad:function(){var l=this,s=this,c=this.elements.dialogs.gamepad.querySelector(".".concat(m.classNames.overlay)),n=new o.Gamepad;(m.gamepad=n).init()?(n.bind(o.Gamepad.Event.TICK,function(e){e.forEach(function(e){var t;e&&e.axes&&e.axes[9]&&((t=e.axes[9])<3.28571?1==t?(e.extra_buttons[12].pressed||(e.extra_buttons[12]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:12,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[14].pressed||(e.extra_buttons[14]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:14,gamepad:e,gamepadIndex:e.index}))):t<=-.7142857&&-.714291<=t?(e.extra_buttons[12].pressed||(e.extra_buttons[12]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:12,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[15].pressed||(e.extra_buttons[15]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:15,gamepad:e,gamepadIndex:e.index}))):.42856<=t&&t<=.42858?(e.extra_buttons[13].pressed||(e.extra_buttons[13]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:13,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[14].pressed||(e.extra_buttons[14]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:14,gamepad:e,gamepadIndex:e.index}))):-.14287<=t&&t<=-.14285?(e.extra_buttons[13].pressed||(e.extra_buttons[13]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:13,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[15].pressed||(e.extra_buttons[15]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:15,gamepad:e,gamepadIndex:e.index}))):t<=-1&&-1.01<=t?e.extra_buttons[12].pressed||(e.extra_buttons[12]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:12,gamepad:e,gamepadIndex:e.index})):.142857<=t&&t<=.142858?e.extra_buttons[13].pressed||(e.extra_buttons[13]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:13,gamepad:e,gamepadIndex:e.index})):.7142857<=t&&t<=.7142858?e.extra_buttons[14].pressed||(e.extra_buttons[14]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:14,gamepad:e,gamepadIndex:e.index})):t<=-.42857&&-.42858<=t&&(e.extra_buttons[15].pressed||(e.extra_buttons[15]={pressed:!0,value:1},n._fire(o.Gamepad.Event.BUTTON_DOWN,{index:15,gamepad:e,gamepadIndex:e.index}))):(e.extra_buttons[12].pressed&&(e.extra_buttons[12]={pressed:!1,value:0},n._fire(o.Gamepad.Event.BUTTON_UP,{index:12,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[13].pressed&&(e.extra_buttons[13]={pressed:!1,value:0},n._fire(o.Gamepad.Event.BUTTON_UP,{index:13,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[14].pressed&&(e.extra_buttons[14]={pressed:!1,value:0},n._fire(o.Gamepad.Event.BUTTON_UP,{index:14,gamepad:e,gamepadIndex:e.index})),e.extra_buttons[15].pressed&&(e.extra_buttons[15]={pressed:!1,value:0},n._fire(o.Gamepad.Event.BUTTON_UP,{index:15,gamepad:e,gamepadIndex:e.index}))))})}),n.bind(o.Gamepad.Event.BUTTON_DOWN,function(n){if(console.log(n.gamepad),l.elements.dialogs.gamepad.hidden||c.hidden)Object.keys(m.controllers[n.gamepad.index.toString()]).forEach(function(e){var t=n.gamepad.index.toString();parseInt(m.controllers[t][e].value2,10)===parseInt(n.index,10)&&["24","25","26"].includes(e)&&("24"==e?m.quickSaveState():"25"==e?m.quickLoadState():"26"==e&&m.changeStateSlot()),parseInt(m.controllers[t][e].value2,10)===parseInt(n.index,10)&&parseInt(t,10)===parseInt(n.gamepad.index,10)&&m.simulateInput(t,e,1)});else{var e,t=parseInt(c.getAttribute("data-index"),10),a=c.getAttribute("data-id");if(n.gamepad.index===parseInt(t,10)){for(var o=0;o<32&&(!(e=(e=n.gamepad.buttons[o])?e:n.gamepad.extra_buttons[o])||!("number"==typeof e&&1===e||"number"==typeof e.value&&1===e.value));o+=1);var i=null;(i=s.elements.dialogs.gamepad.querySelector('[data-id="'.concat(a,'"][data-index="').concat(t,'"][data-type="2"]'))).setAttribute("data-value",n.index),i.value="button ".concat(n.index+1),V(c,!0)}}}),n.bind(o.Gamepad.Event.BUTTON_UP,function(n){Object.keys(m.controllers).forEach(function(t){Object.keys(m.controllers[t]).forEach(function(e){parseInt(m.controllers[t][e].value2,10)===parseInt(n.index,10)&&parseInt(t,10)===parseInt(n.gamepad.index,10)&&m.simulateInput(t,e,0)})})}),n.bind(o.Gamepad.Event.AXIS_CHANGED,function(e){var t,n=.5<(t=e.value)||t<-.5?0')+(''),!0===n.LandR&&(o="n64"===t.system?(o=(o+='
L
')+'
Z
')+'
R
':(o+='
L
')+'
R
'),o=(o=(o+="
")+('
'))+(''),"n64"===t.system?o+='
'+t.localization("Start")+"
":o=(o+='
'+t.localization("Start")+"
")+'
'+t.localization("Select")+"
",o=(o+="
")+(''),"n64"===t.system&&(o=(o=(o=(o+='
')+'
')+'
')+'
');for(var i=0;i
'+n.order[i]+" "}m.virtualGamepadContainer.innerHTML=o+="",V(m.virtualGamepadContainer,!e);a=pe.a.create({zone:q.call(this,".".concat(X({"ejs-virtual-gamepad":!0})," .").concat(X({left:!0}))),mode:"static",position:{left:"50%",top:"50%"},color:"red"});function r(){var e;return"n64"!==t.system||"d-pad"===(e=ae&&"function"==typeof ae.getCoreOptionsValues?ae.getCoreOptionsValues()["joystick-input"]:e)?{downVal:1,4:4,5:5,6:6,7:7}:{downVal:32767,4:19,5:18,6:17,7:16}}a.on("end",function(e,t){m.syncInput(0,r()[4],0),m.syncInput(0,r()[5],0),m.syncInput(0,r()[6],0),m.syncInput(0,r()[7],0)}),a.on("move",function(e,t){t=t.angle.degree;30<=t&&t<150?m.syncInput(0,r()[4],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[4],0)},30),210<=t&&t<330?m.syncInput(0,r()[5],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[5],0)},30),120<=t&&t<240?m.syncInput(0,r()[6],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[6],0)},30),300<=t||0<=t&&t<60?m.syncInput(0,r()[7],r().downVal):window.setTimeout(function(){m.syncInput(0,r()[7],0)},30)});var l,c=X({"virtual-gamepad":!0}),d=X({touch:!0}),a=(W.isIos||B.call(this,q.call(this,".".concat(c)),"touchmove",function(e){e.stopPropagation()}),[{id:{b_a:!0},number:8},{id:{b_b:!0},number:0},{id:{b_x:!0},number:9},{id:{b_y:!0},number:1},{id:{b_l:!0},number:10},{id:{b_z:!0},number:12},{id:{b_r:!0},number:11},{id:{b_start:!0},number:3},{id:{b_select:!0},number:2},{id:{b_cu:!0},number:23},{id:{b_cd:!0},number:22},{id:{b_cl:!0},number:21},{id:{b_cr:!0},number:20}]),a=("n64"===t.system&&(a[0].number=0,a[1].number=1),a.forEach(t=>{B.call(this,q.call(this,".".concat(c," .").concat(X(t.id))),"touchstart touchend",function(e){["touchend"].includes(e.type)?(H(e.target,d,!1),window.setTimeout(function(){m.syncInput(0,t.number,0)},30)):(H(e.target,d,!0),m.syncInput(0,t.number,1)),e.stopPropagation()})}),U("div",{class:X({ejs__widget:!0,ejs__widget_controls_toggle:!0})},""));a.innerHTML=' ',q.call(this,".".concat(X({ejs__widgets:!0}))).appendChild(a),B.call(this,a,"mousedown touchstart",function(e){H(e.target,d,!0),clearTimeout(l),Q.toggleControls.call(t,!0),l=setTimeout(function(){Q.toggleControls.call(t,!1)},5e3)})}else V(m.virtualGamepadContainer,!e)},setup:function(){var e,t,n,a=this;this.game?(m.playerName=a.config.playerName,H(this.elements.container,this.config.classNames.type,!0),this.elements.container.setAttribute("tabindex","0"),this.color&&(e=function(e){var t=e.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){for(var n="#",a=1;a<4;a+=1)n+=t.slice(a,a+1).concat(t.slice(a,a+1));t=n}for(var o=[],i=1;i<7;i+=2)o.push(parseInt("0x".concat(t.slice(i,i+2)),16));return o}return null}(this.color))&&this.elements.container.setAttribute("style","--ejs-primary-color: ".concat(e[0],", ").concat(e[1],", ").concat(e[2])),this.elements.wrapper=U("div",{class:this.config.classNames.video}),I(this.game,this.elements.wrapper),"video"!==a.game.tagName.toLocaleLowerCase()&&(t=this.config.volume,Object.defineProperty(a.game,"volume",{get:function(){return t},set:function(e){t=e,G.call(a,a.game,"volumechange")}}),n=a.storage.get("muted"),Object.defineProperty(a.game,"muted",{get:function(){return n},set:function(e){e=!!F.boolean(e)&&e;n=e,G.call(a,a.game,"volumechange")}})),window.addEventListener("beforeunload",function(e){a.started&&(p.FS.syncfs(function(){}),m.saveSavFiles(),p.FS.syncfs(function(){}))},!0)):console.warn("No game element found!")},listeners:function(){var s=this;s.elements.buttons.restart&&B.call(s,s.elements.buttons.restart,"click",function(e){m.restartGame(),m.inputsData={}}),s.elements.buttons.screenRecord&&B.call(s,s.elements.buttons.screenRecord,"click",function(e){var a,o,i;s.recordData||(s.recordData={started:!1,data:[],stopped:!1}),s.recordData.started?s.recordData.started&&(s.recordData.recorder.stop(),s.recordData.stopped=!0):(a=MediaRecorder.isTypeSupported("video/webm; codecs=h264")?{mimeType:"video/webm; codecs=h264"}:MediaRecorder.isTypeSupported("video/webm; codecs=H264")?{mimeType:"video/webm; codecs=H264"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp9")?{mimeType:"video/webm; codecs=vp9"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp8")?{mimeType:"video/webm; codecs=vp8"}:MediaRecorder.isTypeSupported("video/webm; codecs=avc1")?{mimeType:"video/webm; codecs=avc1"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp9.0")?{mimeType:"video/webm; codecs=vp9.0"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp8.0")?{mimeType:"video/webm; codecs=vp8.0"}:{},p.Module.pauseMainLoop(),s.playing=!1,alert('please check "share system audio" to have audio in the recording. We only need the audio stream so your entire screen will not be recorded'),o=p.Module.canvas.captureStream(30),i=setTimeout(function(){s.playing=!0,p.Module.resumeMainLoop()},2e4),navigator.mediaDevices.getDisplayMedia({audio:!0,video:{mediaSource:"screen"}}).then(function(e){try{clearTimeout(i)}catch(e){}for(var t=e.getAudioTracks(),n=0;n>0;if(0>0,o=0;o".concat(this.icons[e],"");for(var a=t.childNodes[0].childNodes,o=0;o",""]),i=[];function n(e,t,n){"function"==typeof n?i.push(n):i.push(function(){});n=a.length-1;t?a.splice(n,0,''+e+" "):a.splice(n,0,''+e+" ")}n(o.localization("Take Screenshot"),!1,function(e){var t=m.getScreenData(),n=(n="string"==typeof o.gameName?o.gameName:n)?"".concat(n,"-screenshot.png"):"game.png",a=document.createElement("a");return a.href=URL.createObjectURL(new Blob([t])),a.download=n,a.click(),setTimeout(function(){URL.revokeObjectURL(a.src)}),!1}),n(o.localization("Cache Manage"),!0,function(e){var n;return p.romdb&&(V(o.elements.dialogs.cache,!1),(n=o.elements.dialogs.cache.querySelector(".".concat(m.classNames["dialog-content"]))).innerHTML=""+o.localization("Loading")+"
",p.romdb.getAll(function(e){var t,c;e?(t=U("table",{style:"width:100%;padding-left:10px;text-align:left"}),c=U("tbody"),0Remove',i.appendChild(s),i.appendChild(r),i.appendChild(l),c.appendChild(i),l.querySelector("a").onclick=function(e){p.romdb.removeBatch(a);try{c.removeChild(i)}catch(e){}return e.stopPropagation(),!1}}}),t.appendChild(c),n.appendChild(t)):n.innerHTML=''+o.localization("Empty")+"
"):n.innerHTML=''+o.localization("Empty")+"
"},function(){})),!1}),n(o.localization("Quick Save")+" (F2)",!1,function(e){m.quickSaveState(),ae.contextMenu.style.display="none"}),n(o.localization("Quick Load")+" (F4)",!1,function(e){m.quickLoadState(),ae.contextMenu.style.display="none"}),ne.contextMenu.innerHTML=a.join("");for(var s=ne.contextMenu.getElementsByTagName("li"),r=0;r ',"exit-fullscreen":' ',gamepad:' ',"load-state":' ',muted:' ',pause:' ',play:' ',restart:' ',"save-state":' ',"screen-record":' ',settings:' ',volume:' \n \n ',cheat:' '},this.id=Math.floor(1e4*Math.random()),null),t=(this.elements.controls=null,{id:this.id}),a=!0;F.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this.props)),this.config.controls||(this.config.controls=[]),F.element(this.config.controls)||F.string(this.config.controls)?e=this.config.controls:(e=ne.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality}),a=!1);function o(e){var n=e;return Object.entries(t).forEach(function(e){t=2;var e=function(e){if(Array.isArray(e))return e}(e=e)||function(e,t){var n=[],a=!0,o=!1,i=void 0;try{for(var s,r=e[Symbol.iterator]();!(a=(s=r.next()).done)&&(n.push(s.value),!t||n.length!==t);a=!0);}catch(e){o=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}(),t=e[0],e=e[1];n=le(n,"{".concat(t,"}"),e)}),n}var i,s;a&&(F.string(this.config.controls)?e=o(e):F.element(e)&&(e.innerHTML=o(e.innerHTML))),F.string(this.config.selectors.controls.container)&&(i=document.querySelector(this.config.selectors.controls.container)),(i=F.element(i)?i:this.elements.container)[F.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),F.element(this.elements.controls)||ne.findElements.call(this),F.empty(this.elements.buttons)||(s=function(e){var t=n.config.classNames.controlPressed;Object.defineProperty(e,"pressed",{enumerable:!0,get:function(){return k(e,t)},set:function(){H(e,t,0Math.abs(n)?a:n),n=(i.increaseVolume(a/50),i.game.volume);(1===a&&n<1||-1===a&&0'+n.localization("CORS Error")+" ":t.innerHTML=''+n.localization("Network Error")+" "}},null,null,null,null,null,function(e){function t(){if(!(navigator.getGamepads||navigator.webkitGetGamepads))throw new Error("get gamepads not found!");if(this.rAF=window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.requestAnimationFrame,!this.rAF)throw new Error("request animation frame was not found!");this.loop()}t.prototype={gamepads:[],rAF:null,getGamepads:function(){return navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[]},loop:async function(){this.updateGamepadState(),this.rAF.call(null,this.loop.bind(this))},updateGamepadState:function(){for(var n=this.getGamepads(),a=0;athis.options.threshold){var r={};for(l in this.direction)this.direction.hasOwnProperty(l)&&(r[l]=this.direction[l]);var l,c={};for(l in this.direction={x:n,y:a,angle:t},e.direction=this.direction,r)r[l]===this.direction[l]&&(c[l]=!0);if(c.x&&c.y&&c.angle)return e;c.x&&c.y||this.trigger("plain",e),c.x||this.trigger("plain:"+n,e),c.y||this.trigger("plain:"+a,e),c.angle||this.trigger("dir dir:"+t,e)}return e},a.prototype=new e,(a.constructor=a).id=0,a.prototype.prepareNipples=function(){var e=this,a=e.nipples;a.on=e.on.bind(e),a.off=e.off.bind(e),a.options=e.options,a.destroy=e.destroy.bind(e),a.ids=e.ids,a.id=e.id,a.processOnMove=e.processOnMove.bind(e),a.processOnEnd=e.processOnEnd.bind(e),a.get=function(e){if(void 0===e)return a[0];for(var t=0,n=a.length;t>2]|=e[i]<>6:(a<55296||57344<=a?l[o++]=224|a>>12:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++i)),l[o++]=240|a>>18,l[o++]=128|a>>12&63),l[o++]=128|a>>6&63),l[o++]=128|63&a);else for(o=this.start;i>2]|=a<>2]|=(192|a>>6)<>2]|=(224|a>>12)<>2]|=(240|a>>18)<>2]|=(128|a>>12&63)<>2]|=(128|a>>6&63)<>2]|=(128|63&a)<>2]|=u[3&t],56<=t&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash())},g.prototype.hash=function(){var e,t,n,a,o,i=this.blocks,s=this.first?((s=((e=((e=i[0]-680876937)<<7|e>>>25)-271733879<<0)^(t=((t=(-271733879^(n=((n=(-1732584194^2004318071&e)+i[1]-117830708)<<12|n>>>20)+e<<0)&(-271733879^e))+i[2]-1126478375)<<17|t>>>15)+n<<0)&(n^e))+i[3]-1316259209)<<22|s>>>10)+t<<0:(e=this.h0,s=this.h1,t=this.h2,((s+=((e=((e+=((n=this.h3)^s&(t^n))+i[0]-680876936)<<7|e>>>25)+s<<0)^(t=((t+=(s^(n=((n+=(t^e&(s^t))+i[1]-389564586)<<12|n>>>20)+e<<0)&(e^s))+i[2]+606105819)<<17|t>>>15)+n<<0)&(n^e))+i[3]-1044525330)<<22|s>>>10)+t<<0);s=((s+=((e=((e+=(n^s&(t^n))+i[4]-176418897)<<7|e>>>25)+s<<0)^(t=((t+=(s^(n=((n+=(t^e&(s^t))+i[5]+1200080426)<<12|n>>>20)+e<<0)&(e^s))+i[6]-1473231341)<<17|t>>>15)+n<<0)&(n^e))+i[7]-45705983)<<22|s>>>10)+t<<0,s=((s+=((e=((e+=(n^s&(t^n))+i[8]+1770035416)<<7|e>>>25)+s<<0)^(t=((t+=(s^(n=((n+=(t^e&(s^t))+i[9]-1958414417)<<12|n>>>20)+e<<0)&(e^s))+i[10]-42063)<<17|t>>>15)+n<<0)&(n^e))+i[11]-1990404162)<<22|s>>>10)+t<<0,s=((s+=((e=((e+=(n^s&(t^n))+i[12]+1804603682)<<7|e>>>25)+s<<0)^(t=((t+=(s^(n=((n+=(t^e&(s^t))+i[13]-40341101)<<12|n>>>20)+e<<0)&(e^s))+i[14]-1502002290)<<17|t>>>15)+n<<0)&(n^e))+i[15]+1236535329)<<22|s>>>10)+t<<0,s=((s+=((n=((n+=(s^t&((e=((e+=(t^n&(s^t))+i[1]-165796510)<<5|e>>>27)+s<<0)^s))+i[6]-1069501632)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^s&(n^e))+i[11]+643717713)<<14|t>>>18)+n<<0)^n))+i[0]-373897302)<<20|s>>>12)+t<<0,s=((s+=((n=((n+=(s^t&((e=((e+=(t^n&(s^t))+i[5]-701558691)<<5|e>>>27)+s<<0)^s))+i[10]+38016083)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^s&(n^e))+i[15]-660478335)<<14|t>>>18)+n<<0)^n))+i[4]-405537848)<<20|s>>>12)+t<<0,s=((s+=((n=((n+=(s^t&((e=((e+=(t^n&(s^t))+i[9]+568446438)<<5|e>>>27)+s<<0)^s))+i[14]-1019803690)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^s&(n^e))+i[3]-187363961)<<14|t>>>18)+n<<0)^n))+i[8]+1163531501)<<20|s>>>12)+t<<0,s=((s+=((n=((n+=(s^t&((e=((e+=(t^n&(s^t))+i[13]-1444681467)<<5|e>>>27)+s<<0)^s))+i[2]-51403784)<<9|n>>>23)+e<<0)^e&((t=((t+=(e^s&(n^e))+i[7]+1735328473)<<14|t>>>18)+n<<0)^n))+i[12]-1926607734)<<20|s>>>12)+t<<0,s=((s+=((o=(n=((n+=((a=s^t)^(e=((e+=(a^n)+i[5]-378558)<<4|e>>>28)+s<<0))+i[8]-2022574463)<<11|n>>>21)+e<<0)^e)^(t=((t+=(o^s)+i[11]+1839030562)<<16|t>>>16)+n<<0))+i[14]-35309556)<<23|s>>>9)+t<<0,s=((s+=((o=(n=((n+=((a=s^t)^(e=((e+=(a^n)+i[1]-1530992060)<<4|e>>>28)+s<<0))+i[4]+1272893353)<<11|n>>>21)+e<<0)^e)^(t=((t+=(o^s)+i[7]-155497632)<<16|t>>>16)+n<<0))+i[10]-1094730640)<<23|s>>>9)+t<<0,s=((s+=((o=(n=((n+=((a=s^t)^(e=((e+=(a^n)+i[13]+681279174)<<4|e>>>28)+s<<0))+i[0]-358537222)<<11|n>>>21)+e<<0)^e)^(t=((t+=(o^s)+i[3]-722521979)<<16|t>>>16)+n<<0))+i[6]+76029189)<<23|s>>>9)+t<<0,s=((s+=((o=(n=((n+=((a=s^t)^(e=((e+=(a^n)+i[9]-640364487)<<4|e>>>28)+s<<0))+i[12]-421815835)<<11|n>>>21)+e<<0)^e)^(t=((t+=(o^s)+i[15]+530742520)<<16|t>>>16)+n<<0))+i[2]-995338651)<<23|s>>>9)+t<<0,s=((s+=((n=((n+=(s^((e=((e+=(t^(s|~n))+i[0]-198630844)<<6|e>>>26)+s<<0)|~t))+i[7]+1126891415)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~s))+i[14]-1416354905)<<15|t>>>17)+n<<0)|~e))+i[5]-57434055)<<21|s>>>11)+t<<0,s=((s+=((n=((n+=(s^((e=((e+=(t^(s|~n))+i[12]+1700485571)<<6|e>>>26)+s<<0)|~t))+i[3]-1894986606)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~s))+i[10]-1051523)<<15|t>>>17)+n<<0)|~e))+i[1]-2054922799)<<21|s>>>11)+t<<0,s=((s+=((n=((n+=(s^((e=((e+=(t^(s|~n))+i[8]+1873313359)<<6|e>>>26)+s<<0)|~t))+i[15]-30611744)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~s))+i[6]-1560198380)<<15|t>>>17)+n<<0)|~e))+i[13]+1309151649)<<21|s>>>11)+t<<0,s=((s+=((n=((n+=(s^((e=((e+=(t^(s|~n))+i[4]-145523070)<<6|e>>>26)+s<<0)|~t))+i[11]-1120210379)<<10|n>>>22)+e<<0)^((t=((t+=(e^(n|~s))+i[2]+718787259)<<15|t>>>17)+n<<0)|~e))+i[9]-343485551)<<21|s>>>11)+t<<0,this.first?(this.h0=e+1732584193<<0,this.h1=s-271733879<<0,this.h2=t-1732584194<<0,this.h3=n+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+s<<0,this.h2=this.h2+t<<0,this.h3=this.h3+n<<0)},g.prototype.toString=g.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,a=this.h3;return l[e>>4&15]+l[15&e]+l[e>>12&15]+l[e>>8&15]+l[e>>20&15]+l[e>>16&15]+l[e>>28&15]+l[e>>24&15]+l[t>>4&15]+l[15&t]+l[t>>12&15]+l[t>>8&15]+l[t>>20&15]+l[t>>16&15]+l[t>>28&15]+l[t>>24&15]+l[n>>4&15]+l[15&n]+l[n>>12&15]+l[n>>8&15]+l[n>>20&15]+l[n>>16&15]+l[n>>28&15]+l[n>>24&15]+l[a>>4&15]+l[15&a]+l[a>>12&15]+l[a>>8&15]+l[a>>20&15]+l[a>>16&15]+l[a>>28&15]+l[a>>24&15]},g.prototype.array=g.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,a=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&a,a>>8&255,a>>16&255,a>>24&255]},g.prototype.buffer=g.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},g.prototype.base64=function(){for(var e,t,n,a="",o=this.array(),i=0;i<15;)e=o[i++],t=o[i++],n=o[i++],a+=h[e>>>2]+h[63&(e<<4|t>>>4)]+h[63&(t<<2|n>>>6)]+h[63&n];return e=o[i],a+(h[e>>>2]+h[e<<4&63]+"==")};var v=function(){var t=a("hex");(t=s?o(t):t).create=function(){return new g},t.update=function(e){return t.create().update(e)};for(var e=0;e= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 dx = vec2(x, 0.0);\nvec2 dy = vec2(0.0, y);\nt1 = vec4(vTexCoord - dg1, vTexCoord - dy);\nt2 = vec4(vTexCoord - dg2, vTexCoord + dx);\nt3 = vec4(vTexCoord + dg1, vTexCoord + dy);\nt4 = vec4(vTexCoord + dg2, vTexCoord - dx);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 0.325; // start smoothing wt.\nfloat k = -0.250; // wt. decrease factor\nfloat max_w = 0.25; // max filter weight\nfloat min_w =-0.05; // min filter weight\nfloat lum_add = 0.25; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c00 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 c10 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 c20 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 c01 = COMPAT_TEXTURE(Source, t4.zw).xyz; \nvec3 c11 = COMPAT_TEXTURE(Source, vTexCoord).xyz; \nvec3 c21 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 c02 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 c12 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 c22 = COMPAT_TEXTURE(Source, t3.xy).xyz; \n\nfloat md1 = dot(abs(c00 - c22), dt);\nfloat md2 = dot(abs(c02 - c20), dt);\n\nfloat w1 = dot(abs(c22 - c11), dt) * md2;\nfloat w2 = dot(abs(c02 - c11), dt) * md1;\nfloat w3 = dot(abs(c00 - c11), dt) * md2;\nfloat w4 = dot(abs(c20 - c11), dt) * md1;\n\nfloat t1 = w1 + w3;\nfloat t2 = w2 + w4;\nfloat ww = max(t1, t2) + 0.0001;\n\nc11 = (w1 * c00 + w2 * c20 + w3 * c22 + w4 * c02 + ww * c11) / (t1 + t2 + ww);\n\nfloat lc1 = k / (0.12 * dot(c10 + c12 + c11, dt) + lum_add);\nfloat lc2 = k / (0.12 * dot(c01 + c21 + c11, dt) + lum_add);\n\nw1 = clamp(lc1 * dot(abs(c11 - c10), dt) + mx, min_w, max_w);\nw2 = clamp(lc2 * dot(abs(c11 - c21), dt) + mx, min_w, max_w);\nw3 = clamp(lc1 * dot(abs(c11 - c12), dt) + mx, min_w, max_w);\nw4 = clamp(lc2 * dot(abs(c11 - c01), dt) + mx, min_w, max_w);\nFragColor = vec4(w1 * c10 + w2 * c21 + w3 * c12 + w4 * c01 + (1.0 - w1 - w2 - w3 - w4) * c11, 1.0);\n} \n#endif\n","4xScaleHQ.glsl":"/*\n4xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - guest.r@gmail.com\n\nThis program is free software; you can redistribute it and/or\nmodify it under the terms of the GNU General Public License\nas published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; if not, write to the Free Software\nFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n*/\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\n// compatibility #defines\n#define vTexCoord TEX0.xy\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\nTEX0.xy = TexCoord.xy;\nfloat x = 0.5 * SourceSize.z;\nfloat y = 0.5 * SourceSize.w;\nvec2 dg1 = vec2( x, y);\nvec2 dg2 = vec2(-x, y);\nvec2 sd1 = dg1 * 0.5;\nvec2 sd2 = dg2 * 0.5;\nvec2 ddx = vec2(x, 0.0);\nvec2 ddy = vec2(0.0, y);\nt1 = vec4(vTexCoord - sd1, vTexCoord - ddy);\nt2 = vec4(vTexCoord - sd2, vTexCoord + ddx);\nt3 = vec4(vTexCoord + sd1, vTexCoord + ddy);\nt4 = vec4(vTexCoord + sd2, vTexCoord - ddx);\nt5 = vec4(vTexCoord - dg1, vTexCoord - dg2);\nt6 = vec4(vTexCoord + dg1, vTexCoord + dg2);\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\nCOMPAT_VARYING vec4 t1;\nCOMPAT_VARYING vec4 t2;\nCOMPAT_VARYING vec4 t3;\nCOMPAT_VARYING vec4 t4;\nCOMPAT_VARYING vec4 t5;\nCOMPAT_VARYING vec4 t6;\n\n// compatibility #defines\n#define Source Texture\n#define vTexCoord TEX0.xy\n\n#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize\n#define OutSize vec4(OutputSize, 1.0 / OutputSize)\n\nfloat mx = 1.0; // start smoothing wt.\nfloat k = -1.10; // wt. decrease factor\nfloat max_w = 0.75; // max filter weight\nfloat min_w = 0.03; // min filter weight\nfloat lum_add = 0.33; // affects smoothing\nvec3 dt = vec3(1.0);\n\nvoid main()\n{\nvec3 c = COMPAT_TEXTURE(Source, vTexCoord).xyz;\nvec3 i1 = COMPAT_TEXTURE(Source, t1.xy).xyz; \nvec3 i2 = COMPAT_TEXTURE(Source, t2.xy).xyz; \nvec3 i3 = COMPAT_TEXTURE(Source, t3.xy).xyz; \nvec3 i4 = COMPAT_TEXTURE(Source, t4.xy).xyz; \nvec3 o1 = COMPAT_TEXTURE(Source, t5.xy).xyz; \nvec3 o3 = COMPAT_TEXTURE(Source, t6.xy).xyz; \nvec3 o2 = COMPAT_TEXTURE(Source, t5.zw).xyz;\nvec3 o4 = COMPAT_TEXTURE(Source, t6.zw).xyz;\nvec3 s1 = COMPAT_TEXTURE(Source, t1.zw).xyz; \nvec3 s2 = COMPAT_TEXTURE(Source, t2.zw).xyz; \nvec3 s3 = COMPAT_TEXTURE(Source, t3.zw).xyz; \nvec3 s4 = COMPAT_TEXTURE(Source, t4.zw).xyz; \n\nfloat ko1=dot(abs(o1-c),dt);\nfloat ko2=dot(abs(o2-c),dt);\nfloat ko3=dot(abs(o3-c),dt);\nfloat ko4=dot(abs(o4-c),dt);\n\nfloat k1=min(dot(abs(i1-i3),dt),max(ko1,ko3));\nfloat k2=min(dot(abs(i2-i4),dt),max(ko2,ko4));\n\nfloat w1 = k2; if(ko3= 130\n #define COMPAT_VARYING out\n #define COMPAT_ATTRIBUTE in\n #define COMPAT_TEXTURE texture\n #else\n #define COMPAT_VARYING varying\n #define COMPAT_ATTRIBUTE attribute\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _oPosition1;\n vec4 _r0005;\n COMPAT_ATTRIBUTE vec4 VertexCoord;\n COMPAT_ATTRIBUTE vec4 TexCoord;\n COMPAT_VARYING vec4 TEX0;\n \n uniform mat4 MVPMatrix;\n uniform int FrameDirection;\n uniform int FrameCount;\n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _oTex;\n _r0005 = VertexCoord.x*MVPMatrix[0];\n _r0005 = _r0005 + VertexCoord.y*MVPMatrix[1];\n _r0005 = _r0005 + VertexCoord.z*MVPMatrix[2];\n _r0005 = _r0005 + VertexCoord.w*MVPMatrix[3];\n _oPosition1 = _r0005;\n _oTex = TexCoord.xy;\n gl_Position = _r0005;\n TEX0.xy = TexCoord.xy;\n }\n #elif defined(FRAGMENT)\n \n #if __VERSION__ >= 130\n #define COMPAT_VARYING in\n #define COMPAT_TEXTURE texture\n out vec4 FragColor;\n #else\n #define COMPAT_VARYING varying\n #define FragColor gl_FragColor\n #define COMPAT_TEXTURE texture2D\n #endif\n \n #ifdef GL_ES\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n #else\n precision mediump float;\n #endif\n #define COMPAT_PRECISION mediump\n #else\n #define COMPAT_PRECISION\n #endif\n COMPAT_VARYING float _frame_rotation;\n struct input_dummy {\n vec2 _video_size;\n vec2 _texture_size;\n vec2 _output_dummy_size;\n float _frame_count;\n float _frame_direction;\n float _frame_rotation;\n };\n vec4 _ret_0;\n float _TMP30;\n float _TMP29;\n float _TMP28;\n float _TMP13;\n float _TMP32;\n float _TMP11;\n float _TMP10;\n float _TMP31;\n float _TMP9;\n float _TMP8;\n float _TMP15;\n float _TMP14;\n float _TMP33;\n vec4 _TMP34;\n vec4 _TMP27;\n vec4 _TMP25;\n vec4 _TMP23;\n vec4 _TMP21;\n vec4 _TMP26;\n vec4 _TMP24;\n vec4 _TMP22;\n vec4 _TMP20;\n float _TMP4;\n vec4 _TMP3;\n vec4 _TMP2;\n float _TMP19;\n float _TMP18;\n float _TMP17;\n float _TMP16;\n vec4 _TMP1;\n vec2 _TMP0;\n uniform sampler2D Texture;\n input_dummy _IN1;\n float _TMP43;\n float _x_step0044;\n float _curve0044;\n float _a0048;\n float _val0052;\n float _a0052;\n vec4 _TMP57;\n vec4 _x0072;\n vec2 _c0086;\n vec4 _x0088;\n vec4 _x0094;\n vec2 _c0098;\n vec4 _x0100;\n vec2 _c0104;\n vec4 _x0106;\n vec4 _sample_min0110;\n vec4 _sample_max0110;\n vec4 _r0112;\n vec4 _TMP117;\n vec2 _co0124;\n vec2 _c0126;\n vec4 _x0128;\n vec4 _x0134;\n vec2 _c0138;\n vec4 _x0140;\n vec2 _c0144;\n vec4 _x0146;\n vec4 _sample_min0150;\n vec4 _sample_max0150;\n vec4 _r0152;\n vec4 _TMP157;\n float _TMP163;\n float _x_step0164;\n float _curve0164;\n float _a0168;\n float _val0172;\n float _a0172;\n float _TMP183;\n float _TMP189;\n float _x0190;\n float _a0196;\n float _x0198;\n vec2 _x0200;\n float _x0208;\n COMPAT_VARYING vec4 TEX0;\n \n uniform COMPAT_PRECISION vec2 OutputSize;\n uniform COMPAT_PRECISION vec2 TextureSize;\n uniform COMPAT_PRECISION vec2 InputSize;\n void main()\n {\n vec2 _dx1;\n vec2 _dy;\n vec2 _pix_co;\n vec2 _tex_co;\n vec2 _dist;\n vec3 _col2;\n vec3 _col21;\n vec4 _coeffs1;\n float _luma;\n float _bright;\n float _scan_weight;\n vec2 _mod_fac;\n int _dot_no;\n vec3 _mask_weight;\n vec3 _TMP37;\n _dx1 = vec2(1.00000000E+00/TextureSize.x, 0.00000000E+00);\n _dy = vec2(0.00000000E+00, 1.00000000E+00/TextureSize.y);\n _pix_co = TEX0.xy*TextureSize - vec2( 5.00000000E-01, 5.00000000E-01);\n _TMP0 = floor(_pix_co);\n _tex_co = (_TMP0 + vec2( 5.00000000E-01, 5.00000000E-01))/TextureSize;\n _dist = fract(_pix_co);\n _x_step0044 = float((_dist.x >= 5.00000000E-01));\n _a0048 = 2.50000000E-01 - (_dist.x - _x_step0044)*(_dist.x - _x_step0044);\n _TMP33 = inversesqrt(_a0048);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0052 = 5.00000000E-01 - _dist.x;\n _val0052 = float((_a0052 > 0.00000000E+00));\n _TMP15 = _val0052 - float((_a0052 < 0.00000000E+00));\n _curve0044 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP43 = _dist.x + 2.50000000E-01*(_curve0044 - _dist.x);\n _coeffs1 = 3.14159274E+00*vec4(1.00000000E+00 + _TMP43, _TMP43, 1.00000000E+00 - _TMP43, 2.00000000E+00 - _TMP43);\n _TMP1 = abs(_coeffs1);\n _TMP57 = max(_TMP1, vec4( 9.99999975E-06, 9.99999975E-06, 9.99999975E-06, 9.99999975E-06));\n _TMP16 = sin(_TMP57.x);\n _TMP17 = sin(_TMP57.y);\n _TMP18 = sin(_TMP57.z);\n _TMP19 = sin(_TMP57.w);\n _TMP2 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _x0072 = _TMP57/2.00000000E+00;\n _TMP16 = sin(_x0072.x);\n _TMP17 = sin(_x0072.y);\n _TMP18 = sin(_x0072.z);\n _TMP19 = sin(_x0072.w);\n _TMP3 = vec4(_TMP16, _TMP17, _TMP18, _TMP19);\n _coeffs1 = ((2.00000000E+00*_TMP2)*_TMP3)/(_TMP57*_TMP57);\n _TMP4 = dot(_coeffs1, vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _coeffs1 = _coeffs1/_TMP4;\n _c0086 = _tex_co - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0086);\n _x0088 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0088;\n _TMP22 = COMPAT_TEXTURE(Texture, _tex_co);\n _x0094 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0094;\n _c0098 = _tex_co + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0098);\n _x0100 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0100;\n _c0104 = _tex_co + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0104);\n _x0106 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0106;\n _r0112 = _coeffs1.x*_TMP21;\n _r0112 = _r0112 + _coeffs1.y*_TMP23;\n _r0112 = _r0112 + _coeffs1.z*_TMP25;\n _r0112 = _r0112 + _coeffs1.w*_TMP27;\n _sample_min0110 = min(_TMP23, _TMP25);\n _sample_max0110 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0110, _r0112);\n _TMP117 = max(_sample_min0110, _TMP34);\n _co0124 = _tex_co + _dy;\n _c0126 = _co0124 - _dx1;\n _TMP20 = COMPAT_TEXTURE(Texture, _c0126);\n _x0128 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP20 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP21 = _TMP20*_x0128;\n _TMP22 = COMPAT_TEXTURE(Texture, _co0124);\n _x0134 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP22 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP23 = _TMP22*_x0134;\n _c0138 = _co0124 + _dx1;\n _TMP24 = COMPAT_TEXTURE(Texture, _c0138);\n _x0140 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP24 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP25 = _TMP24*_x0140;\n _c0144 = _co0124 + 2.00000000E+00*_dx1;\n _TMP26 = COMPAT_TEXTURE(Texture, _c0144);\n _x0146 = vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00) + (_TMP26 - vec4( 1.00000000E+00, 1.00000000E+00, 1.00000000E+00, 1.00000000E+00));\n _TMP27 = _TMP26*_x0146;\n _r0152 = _coeffs1.x*_TMP21;\n _r0152 = _r0152 + _coeffs1.y*_TMP23;\n _r0152 = _r0152 + _coeffs1.z*_TMP25;\n _r0152 = _r0152 + _coeffs1.w*_TMP27;\n _sample_min0150 = min(_TMP23, _TMP25);\n _sample_max0150 = max(_TMP23, _TMP25);\n _TMP34 = min(_sample_max0150, _r0152);\n _TMP157 = max(_sample_min0150, _TMP34);\n _x_step0164 = float((_dist.y >= 5.00000000E-01));\n _a0168 = 2.50000000E-01 - (_dist.y - _x_step0164)*(_dist.y - _x_step0164);\n _TMP33 = inversesqrt(_a0168);\n _TMP14 = 1.00000000E+00/_TMP33;\n _a0172 = 5.00000000E-01 - _dist.y;\n _val0172 = float((_a0172 > 0.00000000E+00));\n _TMP15 = _val0172 - float((_a0172 < 0.00000000E+00));\n _curve0164 = 5.00000000E-01 - _TMP14*_TMP15;\n _TMP163 = _dist.y + (_curve0164 - _dist.y);\n _col2 = _TMP117.xyz + _TMP163*(_TMP157.xyz - _TMP117.xyz);\n _luma = dot(vec3( 2.12599993E-01, 7.15200007E-01, 7.22000003E-02), _col2);\n _TMP8 = max(_col2.y, _col2.z);\n _TMP9 = max(_col2.x, _TMP8);\n _bright = (_TMP9 + _luma)/2.00000000E+00;\n _TMP31 = min(6.49999976E-01, _bright);\n _TMP183 = max(3.49999994E-01, _TMP31);\n _x0190 = _bright*1.50000000E+00;\n _TMP31 = min(1.50000000E+00, _x0190);\n _TMP189 = max(1.50000000E+00, _TMP31);\n _a0196 = TEX0.y*2.00000000E+00*3.14159274E+00*TextureSize.y;\n _TMP10 = cos(_a0196);\n _x0198 = _TMP10*5.00000000E-01 + 5.00000000E-01;\n _TMP11 = pow(_x0198, _TMP189);\n _scan_weight = 1.00000000E+00 - _TMP11;\n _x0200 = (TEX0.xy*OutputSize*TextureSize)/InputSize;\n _mod_fac = floor(_x0200);\n _x0208 = _mod_fac.x/3.00000000E+00;\n _TMP32 = floor(_x0208);\n _TMP13 = _mod_fac.x - 3.00000000E+00*_TMP32;\n _dot_no = int(_TMP13);\n if (_dot_no == 0) {\n _mask_weight = vec3( 1.00000000E+00, 6.99999988E-01, 6.99999988E-01);\n } else {\n if (_dot_no == 1) {\n _mask_weight = vec3( 6.99999988E-01, 1.00000000E+00, 6.99999988E-01);\n } else {\n _mask_weight = vec3( 6.99999988E-01, 6.99999988E-01, 1.00000000E+00);\n }\n }\n if (InputSize.y >= 4.00000000E+02) {\n _scan_weight = 1.00000000E+00;\n }\n _col21 = _col2.xyz;\n _col2 = _col2*vec3(_scan_weight, _scan_weight, _scan_weight);\n _col2 = _col2 + _TMP183*(_col21 - _col2);\n _col2 = _col2*_mask_weight;\n _TMP28 = pow(_col2.x, 5.55555582E-01);\n _TMP29 = pow(_col2.y, 5.55555582E-01);\n _TMP30 = pow(_col2.z, 5.55555582E-01);\n _col2 = vec3(_TMP28, _TMP29, _TMP30);\n _TMP37 = _col2*1.20000005E+00;\n _ret_0 = vec4(_TMP37.x, _TMP37.y, _TMP37.z, 1.00000000E+00);\n FragColor = _ret_0;\n return;\n }\n #endif\n","crt-aperture.glsl":'\n/*\nCRT Shader by EasyMode\nLicense: GPL\n*/\n/*\n#pragma parameter SHARPNESS_IMAGE "Sharpness Image" 1.0 1.0 5.0 1.0\n#pragma parameter SHARPNESS_EDGES "Sharpness Edges" 3.0 1.0 5.0 1.0\n#pragma parameter GLOW_WIDTH "Glow Width" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HEIGHT "Glow Height" 0.5 0.05 0.65 0.05\n#pragma parameter GLOW_HALATION "Glow Halation" 0.1 0.0 1.0 0.01\n#pragma parameter GLOW_DIFFUSION "Glow Diffusion" 0.05 0.0 1.0 0.01\n#pragma parameter MASK_COLORS "Mask Colors" 2.0 2.0 3.0 1.0\n#pragma parameter MASK_STRENGTH "Mask Strength" 0.3 0.0 1.0 0.05\n#pragma parameter MASK_SIZE "Mask Size" 1.0 1.0 9.0 1.0\n#pragma parameter SCANLINE_SIZE_MIN "Scanline Size Min." 0.5 0.5 1.5 0.05\n#pragma parameter SCANLINE_SIZE_MAX "Scanline Size Max." 1.5 0.5 1.5 0.05\n#pragma parameter GAMMA_INPUT "Gamma Input" 2.4 1.0 5.0 0.1\n#pragma parameter GAMMA_OUTPUT "Gamma Output" 2.4 1.0 5.0 0.1\n#pragma parameter BRIGHTNESS "Brightness" 1.5 0.0 2.0 0.05\n* */\n\n#define Coord TEX0\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define OUT out\n#define IN in\n#define tex2D texture\n#else\n#define OUT varying \n#define IN attribute \n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nIN vec4 VertexCoord;\nIN vec4 Color;\nIN vec2 TexCoord;\nOUT vec4 color;\nOUT vec2 Coord;\n\nuniform mat4 MVPMatrix;\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\n\nvoid main()\n{\ngl_Position = MVPMatrix * VertexCoord;\ncolor = Color;\nCoord = TexCoord;\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define IN in\n#define tex2D texture\nout vec4 FragColor;\n#else\n#define IN varying\n#define FragColor gl_FragColor\n#define tex2D texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define PRECISION mediump\n#else\n#define PRECISION\n#endif\n\nuniform PRECISION int FrameDirection;\nuniform PRECISION int FrameCount;\nuniform PRECISION vec2 OutputSize;\nuniform PRECISION vec2 TextureSize;\nuniform PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nIN vec2 Coord;\n\n#ifdef PARAMETER_UNIFORM\nuniform PRECISION float SHARPNESS_IMAGE;\nuniform PRECISION float SHARPNESS_EDGES;\nuniform PRECISION float GLOW_WIDTH;\nuniform PRECISION float GLOW_HEIGHT;\nuniform PRECISION float GLOW_HALATION;\nuniform PRECISION float GLOW_DIFFUSION;\nuniform PRECISION float MASK_COLORS;\nuniform PRECISION float MASK_STRENGTH;\nuniform PRECISION float MASK_SIZE;\nuniform PRECISION float SCANLINE_SIZE_MIN;\nuniform PRECISION float SCANLINE_SIZE_MAX;\nuniform PRECISION float GAMMA_INPUT;\nuniform PRECISION float GAMMA_OUTPUT;\nuniform PRECISION float BRIGHTNESS;\n#else\n#define SHARPNESS_IMAGE 1.0\n#define SHARPNESS_EDGES 3.0\n#define GLOW_WIDTH 0.5\n#define GLOW_HEIGHT 0.5\n#define GLOW_HALATION 0.1\n#define GLOW_DIFFUSION 0.05\n#define MASK_COLORS 2.0\n#define MASK_STRENGTH 0.3\n#define MASK_SIZE 1.0\n#define SCANLINE_SIZE_MIN 0.5\n#define SCANLINE_SIZE_MAX 1.5\n#define GAMMA_INPUT 2.4\n#define GAMMA_OUTPUT 2.4\n#define BRIGHTNESS 1.5\n#endif\n\n#define FIX(c) max(abs(c), 1e-5)\n#define PI 3.141592653589\n#define saturate(c) clamp(c, 0.0, 1.0)\n#define TEX2D(c) pow(tex2D(tex, c).rgb, vec3(GAMMA_INPUT))\n\nmat3 get_color_matrix(sampler2D tex, vec2 co, vec2 dx)\n{\nreturn mat3(TEX2D(co - dx), TEX2D(co), TEX2D(co + dx));\n}\n\nvec3 blur(mat3 m, float dist, float rad)\n{\nvec3 x = vec3(dist - 1.0, dist, dist + 1.0) / rad;\nvec3 w = exp2(x * x * -1.0);\n\nreturn (m[0] * w.x + m[1] * w.y + m[2] * w.z) / (w.x + w.y + w.z);\n}\n\nvec3 filter_gaussian(sampler2D tex, vec2 co, vec2 tex_size)\n{\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 dy = vec2(0.0, 1.0 / tex_size.y);\nvec2 pix_co = co * tex_size;\nvec2 tex_co = (floor(pix_co) + 0.5) / tex_size;\nvec2 dist = (fract(pix_co) - 0.5) * -1.0;\n\nmat3 line0 = get_color_matrix(tex, tex_co - dy, dx);\nmat3 line1 = get_color_matrix(tex, tex_co, dx);\nmat3 line2 = get_color_matrix(tex, tex_co + dy, dx);\nmat3 column = mat3(blur(line0, dist.x, GLOW_WIDTH),\n blur(line1, dist.x, GLOW_WIDTH),\n blur(line2, dist.x, GLOW_WIDTH));\n\nreturn blur(column, dist.y, GLOW_HEIGHT);\n}\n\nvec3 filter_lanczos(sampler2D tex, vec2 co, vec2 tex_size, float sharp)\n{\ntex_size.x *= sharp;\n\nvec2 dx = vec2(1.0 / tex_size.x, 0.0);\nvec2 pix_co = co * tex_size - vec2(0.5, 0.0);\nvec2 tex_co = (floor(pix_co) + vec2(0.5, 0.0)) / tex_size;\nvec2 dist = fract(pix_co);\nvec4 coef = PI * vec4(dist.x + 1.0, dist.x, dist.x - 1.0, dist.x - 2.0);\n\ncoef = FIX(coef);\ncoef = 2.0 * sin(coef) * sin(coef / 2.0) / (coef * coef);\ncoef /= dot(coef, vec4(1.0));\n\nvec4 col1 = vec4(TEX2D(tex_co), 1.0);\nvec4 col2 = vec4(TEX2D(tex_co + dx), 1.0);\n\nreturn (mat4(col1, col1, col2, col2) * coef).rgb;\n}\n\nvec3 get_scanline_weight(float x, vec3 col)\n{\nvec3 beam = mix(vec3(SCANLINE_SIZE_MIN), vec3(SCANLINE_SIZE_MAX), col);\nvec3 x_mul = 2.0 / beam;\nvec3 x_offset = x_mul * 0.5;\n\nreturn smoothstep(0.0, 1.0, 1.0 - abs(x * x_mul - x_offset)) * x_offset;\n}\n\nvec3 get_mask_weight(float x)\n{\nfloat i = mod(floor(x * OutputSize.x * TextureSize.x / (InputSize.x * MASK_SIZE)), MASK_COLORS);\n\nif (i == 0.0) return mix(vec3(1.0, 0.0, 1.0), vec3(1.0, 0.0, 0.0), MASK_COLORS - 2.0);\nelse if (i == 1.0) return vec3(0.0, 1.0, 0.0);\nelse return vec3(0.0, 0.0, 1.0);\n}\n\nvoid main()\n{\nvec3 col_glow = filter_gaussian(Texture, Coord, TextureSize);\nvec3 col_soft = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_IMAGE);\nvec3 col_sharp = filter_lanczos(Texture, Coord, TextureSize, SHARPNESS_EDGES);\nvec3 col = sqrt(col_sharp * col_soft);\n\ncol *= get_scanline_weight(fract(Coord.y * TextureSize.y), col_soft);\ncol_glow = saturate(col_glow - col);\ncol += col_glow * col_glow * GLOW_HALATION;\ncol = mix(col, col * get_mask_weight(Coord.x) * MASK_COLORS, MASK_STRENGTH);\ncol += col_glow * GLOW_DIFFUSION;\ncol = pow(col * BRIGHTNESS, vec3(1.0 / GAMMA_OUTPUT));\n\nFragColor = vec4(col, 1.0);\n}\n\n#endif\n',"crt-geom.glsl":'\n/*\nCRT-interlaced\n\nCopyright (C) 2010-2012 cgwg, Themaister and DOLLS\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2 of the License, or (at your option)\nany later version.\n\n(cgwg gave their consent to have the original version of this shader\ndistributed under the GPL in this message:\n\nhttp://board.byuu.org/viewtopic.php?p=26075#p26075\n\n"Feel free to distribute my shaders under the GPL. After all, the\nbarrel distortion code was taken from the Curvature shader, which is\nunder the GPL."\n)\nThis shader variant is pre-configured with screen curvature\n*/\n/*\n#pragma parameter CRTgamma "CRTGeom Target Gamma" 2.4 0.1 5.0 0.1\n#pragma parameter monitorgamma "CRTGeom Monitor Gamma" 2.2 0.1 5.0 0.1\n#pragma parameter d "CRTGeom Distance" 1.6 0.1 3.0 0.1\n#pragma parameter CURVATURE "CRTGeom Curvature Toggle" 1.0 0.0 1.0 1.0\n#pragma parameter R "CRTGeom Curvature Radius" 2.0 0.1 10.0 0.1\n#pragma parameter cornersize "CRTGeom Corner Size" 0.03 0.001 1.0 0.005\n#pragma parameter cornersmooth "CRTGeom Corner Smoothness" 1000.0 80.0 2000.0 100.0\n#pragma parameter x_tilt "CRTGeom Horizontal Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter y_tilt "CRTGeom Vertical Tilt" 0.0 -0.5 0.5 0.05\n#pragma parameter overscan_x "CRTGeom Horiz. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter overscan_y "CRTGeom Vert. Overscan %" 100.0 -125.0 125.0 1.0\n#pragma parameter DOTMASK "CRTGeom Dot Mask Toggle" 0.3 0.0 0.3 0.3\n#pragma parameter SHARPER "CRTGeom Sharpness" 1.0 1.0 3.0 1.0\n#pragma parameter scanline_weight "CRTGeom Scanline Weight" 0.3 0.1 0.5 0.05\n*/\n\n#ifndef PARAMETER_UNIFORM\n#define CRTgamma 2.4\n#define monitorgamma 2.2\n#define d 1.6\n#define CURVATURE 1.0\n#define R 2.0\n#define cornersize 0.03\n#define cornersmooth 1000.0\n#define x_tilt 0.0\n#define y_tilt 0.0\n#define overscan_x 100.0\n#define overscan_y 100.0\n#define DOTMASK 0.3\n#define SHARPER 1.0\n#define scanline_weight 0.3\n#endif\n\n#if defined(VERTEX)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING out\n#define COMPAT_ATTRIBUTE in\n#define COMPAT_TEXTURE texture\n#else\n#define COMPAT_VARYING varying \n#define COMPAT_ATTRIBUTE attribute \n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nCOMPAT_ATTRIBUTE vec4 VertexCoord;\nCOMPAT_ATTRIBUTE vec4 COLOR;\nCOMPAT_ATTRIBUTE vec4 TexCoord;\nCOMPAT_VARYING vec4 COL0;\nCOMPAT_VARYING vec4 TEX0;\n\nvec4 _oPosition1; \nuniform mat4 MVPMatrix;\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\n\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\n#define FIX(c) max(abs(c), 1e-5);\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = R*acos(a);\nreturn uv*r/sin(r/R);\n}\n\nvec2 fwtrans(vec2 uv)\n{\nfloat r = FIX(sqrt(dot(uv,uv)));\nuv *= sin(r/R)/r;\nfloat x = 1.0-cos(r/R);\nfloat D = d/R + x*cosangle.x*cosangle.y+dot(uv,sinangle);\nreturn d*(uv*cosangle-x*sinangle)/D;\n}\n\nvec3 maxscale()\n{\nvec2 c = bkwtrans(-R * sinangle / (1.0 + R/d*cosangle.x*cosangle.y));\nvec2 a = vec2(0.5,0.5)*aspect;\nvec2 lo = vec2(fwtrans(vec2(-a.x,c.y)).x, fwtrans(vec2(c.x,-a.y)).y)/aspect;\nvec2 hi = vec2(fwtrans(vec2(+a.x,c.y)).x, fwtrans(vec2(c.x,+a.y)).y)/aspect;\nreturn vec3((hi+lo)*aspect*0.5,max(hi.x-lo.x,hi.y-lo.y));\n}\n\nvoid main()\n{\n// START of parameters\n\n// gamma of simulated CRT\n//\tCRTgamma = 1.8;\n// gamma of display monitor (typically 2.2 is correct)\n//\tmonitorgamma = 2.2;\n// overscan (e.g. 1.02 for 2% overscan)\noverscan = vec2(1.00,1.00);\n// aspect ratio\naspect = vec2(1.0, 0.75);\n// lengths are measured in units of (approximately) the width\n// of the monitor simulated distance from viewer to monitor\n//\td = 2.0;\n// radius of curvature\n//\tR = 1.5;\n// tilt angle in radians\n// (behavior might be a bit wrong if both components are\n// nonzero)\nconst vec2 angle = vec2(0.0,0.0);\n// size of curved corners\n//\tcornersize = 0.03;\n// border smoothness parameter\n// decrease if borders are too aliased\n//\tcornersmooth = 1000.0;\n\n// END of parameters\n\nvec4 _oColor;\nvec2 _otexCoord;\ngl_Position = VertexCoord.x * MVPMatrix[0] + VertexCoord.y * MVPMatrix[1] + VertexCoord.z * MVPMatrix[2] + VertexCoord.w * MVPMatrix[3];\n_oPosition1 = gl_Position;\n_oColor = COLOR;\n_otexCoord = TexCoord.xy;\nCOL0 = COLOR;\nTEX0.xy = TexCoord.xy;\n\n// Precalculate a bunch of useful values we\'ll need in the fragment\n// shader.\nsinangle = sin(vec2(x_tilt, y_tilt)) + vec2(0.001);//sin(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\ncosangle = cos(vec2(x_tilt, y_tilt)) + vec2(0.001);//cos(vec2(max(abs(x_tilt), 1e-3), max(abs(y_tilt), 1e-3)));\nstretch = maxscale();\n\nilfac = vec2(1.0,clamp(floor(InputSize.y/200.0), 1.0, 2.0));\n\n// The size of one texel, in texture-coordinates.\nvec2 sharpTextureSize = vec2(SHARPER * TextureSize.x, TextureSize.y);\none = ilfac / sharpTextureSize;\n\n// Resulting X pixel-coordinate of the pixel we\'re drawing.\nmod_factor = TexCoord.x * TextureSize.x * OutputSize.x / InputSize.x;\n\n}\n\n#elif defined(FRAGMENT)\n\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\n#endif\n\n#ifdef GL_ES\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#define COMPAT_PRECISION mediump\n#else\n#define COMPAT_PRECISION\n#endif\n\nstruct output_dummy {\nvec4 _color;\n};\n\nuniform COMPAT_PRECISION int FrameDirection;\nuniform COMPAT_PRECISION int FrameCount;\nuniform COMPAT_PRECISION vec2 OutputSize;\nuniform COMPAT_PRECISION vec2 TextureSize;\nuniform COMPAT_PRECISION vec2 InputSize;\nuniform sampler2D Texture;\nCOMPAT_VARYING vec4 TEX0;\n\n// Comment the next line to disable interpolation in linear gamma (and\n// gain speed).\n#define LINEAR_PROCESSING\n\n// Enable screen curvature.\n// #define CURVATURE\n\n// Enable 3x oversampling of the beam profile\n#define OVERSAMPLE\n\n// Use the older, purely gaussian beam profile\n//#define USEGAUSSIAN\n\n// Macros.\n#define FIX(c) max(abs(c), 1e-5);\n#define PI 3.141592653589\n\n#ifdef LINEAR_PROCESSING\n# define TEX2D(c) pow(COMPAT_TEXTURE(Texture, (c)), vec4(CRTgamma))\n#else\n# define TEX2D(c) COMPAT_TEXTURE(Texture, (c))\n#endif\n\nCOMPAT_VARYING vec2 one;\nCOMPAT_VARYING float mod_factor;\nCOMPAT_VARYING vec2 ilfac;\nCOMPAT_VARYING vec2 overscan;\nCOMPAT_VARYING vec2 aspect;\nCOMPAT_VARYING vec3 stretch;\nCOMPAT_VARYING vec2 sinangle;\nCOMPAT_VARYING vec2 cosangle;\n\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CRTgamma;\nuniform COMPAT_PRECISION float monitorgamma;\nuniform COMPAT_PRECISION float d;\nuniform COMPAT_PRECISION float CURVATURE;\nuniform COMPAT_PRECISION float R;\nuniform COMPAT_PRECISION float cornersize;\nuniform COMPAT_PRECISION float cornersmooth;\nuniform COMPAT_PRECISION float x_tilt;\nuniform COMPAT_PRECISION float y_tilt;\nuniform COMPAT_PRECISION float overscan_x;\nuniform COMPAT_PRECISION float overscan_y;\nuniform COMPAT_PRECISION float DOTMASK;\nuniform COMPAT_PRECISION float SHARPER;\nuniform COMPAT_PRECISION float scanline_weight;\n#endif\n\nfloat intersect(vec2 xy)\n{\nfloat A = dot(xy,xy)+d*d;\nfloat B = 2.0*(R*(dot(xy,sinangle)-d*cosangle.x*cosangle.y)-d*d);\nfloat C = d*d + 2.0*R*d*cosangle.x*cosangle.y;\nreturn (-B-sqrt(B*B-4.0*A*C))/(2.0*A);\n}\n\nvec2 bkwtrans(vec2 xy)\n{\nfloat c = intersect(xy);\nvec2 point = vec2(c)*xy;\npoint -= vec2(-R)*sinangle;\npoint /= vec2(R);\nvec2 tang = sinangle/cosangle;\nvec2 poc = point/cosangle;\nfloat A = dot(tang,tang)+1.0;\nfloat B = -2.0*dot(poc,tang);\nfloat C = dot(poc,poc)-1.0;\nfloat a = (-B+sqrt(B*B-4.0*A*C))/(2.0*A);\nvec2 uv = (point-a*sinangle)/cosangle;\nfloat r = FIX(R*acos(a));\nreturn uv*r/sin(r/R);\n}\n\nvec2 transform(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord-vec2(0.5))*aspect*stretch.z+stretch.xy;\nreturn (bkwtrans(coord)/vec2(overscan_x / 100.0, overscan_y / 100.0)/aspect+vec2(0.5)) * InputSize / TextureSize;\n}\n\nfloat corner(vec2 coord)\n{\ncoord *= TextureSize / InputSize;\ncoord = (coord - vec2(0.5)) * vec2(overscan_x / 100.0, overscan_y / 100.0) + vec2(0.5);\ncoord = min(coord, vec2(1.0)-coord) * aspect;\nvec2 cdist = vec2(cornersize);\ncoord = (cdist - min(coord,cdist));\nfloat dist = sqrt(dot(coord,coord));\nreturn clamp((cdist.x-dist)*cornersmooth,0.0, 1.0);\n}\n\n// Calculate the influence of a scanline on the current pixel.\n//\n// \'distance\' is the distance in texture coordinates from the current\n// pixel to the scanline in question.\n// \'color\' is the colour of the scanline at the horizontal location of\n// the current pixel.\nvec4 scanlineWeights(float distance, vec4 color)\n{\n// "wid" controls the width of the scanline beam, for each RGB\n// channel The "weights" lines basically specify the formula\n// that gives you the profile of the beam, i.e. the intensity as\n// a function of distance from the vertical center of the\n// scanline. In this case, it is gaussian if width=2, and\n// becomes nongaussian for larger widths. Ideally this should\n// be normalized so that the integral across the beam is\n// independent of its width. That is, for a narrower beam\n// "weights" should have a higher peak at the center of the\n// scanline than for a wider beam.\n#ifdef USEGAUSSIAN\nvec4 wid = 0.3 + 0.1 * pow(color, vec4(3.0));\nvec4 weights = vec4(distance / wid);\nreturn 0.4 * exp(-weights * weights) / wid;\n#else\nvec4 wid = 2.0 + 2.0 * pow(color, vec4(4.0));\nvec4 weights = vec4(distance / scanline_weight);\nreturn 1.4 * exp(-pow(weights * inversesqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);\n#endif\n}\n\nvoid main()\n{\n// Here\'s a helpful diagram to keep in mind while trying to\n// understand the code:\n//\n// | | | | |\n// -------------------------------\n// | | | | |\n// | 01 | 11 | 21 | 31 | <-- current scanline\n// | | @ | | |\n// -------------------------------\n// | | | | |\n// | 02 | 12 | 22 | 32 | <-- next scanline\n// | | | | |\n// -------------------------------\n// | | | | |\n//\n// Each character-cell represents a pixel on the output\n// surface, "@" represents the current pixel (always somewhere\n// in the bottom half of the current scan-line, or the top-half\n// of the next scanline). The grid of lines represents the\n// edges of the texels of the underlying texture.\n\n// Texture coordinates of the texel containing the active pixel.\nvec2 xy = (CURVATURE > 0.5) ? transform(TEX0.xy) : TEX0.xy;\n\nfloat cval = corner(xy);\n\n// Of all the pixels that are mapped onto the texel we are\n// currently rendering, which pixel are we currently rendering?\nvec2 ilvec = vec2(0.0,ilfac.y > 1.5 ? mod(float(FrameCount),2.0) : 0.0);\nvec2 ratio_scale = (xy * TextureSize - vec2(0.5) + ilvec)/ilfac;\n#ifdef OVERSAMPLE\nfloat filter_ = InputSize.y/OutputSize.y;//fwidth(ratio_scale.y);\n#endif\nvec2 uv_ratio = fract(ratio_scale);\n\n// Snap to the center of the underlying texel.\nxy = (floor(ratio_scale)*ilfac + vec2(0.5) - ilvec) / TextureSize;\n\n// Calculate Lanczos scaling coefficients describing the effect\n// of various neighbour texels in a scanline on the current\n// pixel.\nvec4 coeffs = PI * vec4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);\n\n// Prevent division by zero.\ncoeffs = FIX(coeffs);\n\n// Lanczos2 kernel.\ncoeffs = 2.0 * sin(coeffs) * sin(coeffs / 2.0) / (coeffs * coeffs);\n\n// Normalize.\ncoeffs /= dot(coeffs, vec4(1.0));\n\n// Calculate the effective colour of the current and next\n// scanlines at the horizontal location of the current pixel,\n// using the Lanczos coefficients above.\nvec4 col = clamp(mat4(\n TEX2D(xy + vec2(-one.x, 0.0)),\n TEX2D(xy),\n TEX2D(xy + vec2(one.x, 0.0)),\n TEX2D(xy + vec2(2.0 * one.x, 0.0))) * coeffs,\n 0.0, 1.0);\nvec4 col2 = clamp(mat4(\n TEX2D(xy + vec2(-one.x, one.y)),\n TEX2D(xy + vec2(0.0, one.y)),\n TEX2D(xy + one),\n TEX2D(xy + vec2(2.0 * one.x, one.y))) * coeffs,\n 0.0, 1.0);\n\n#ifndef LINEAR_PROCESSING\ncol = pow(col , vec4(CRTgamma));\ncol2 = pow(col2, vec4(CRTgamma));\n#endif\n\n// Calculate the influence of the current and next scanlines on\n// the current pixel.\nvec4 weights = scanlineWeights(uv_ratio.y, col);\nvec4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2);\n#ifdef OVERSAMPLE\nuv_ratio.y =uv_ratio.y+1.0/3.0*filter_;\nweights = (weights+scanlineWeights(uv_ratio.y, col))/3.0;\nweights2=(weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2))/3.0;\nuv_ratio.y =uv_ratio.y-2.0/3.0*filter_;\nweights=weights+scanlineWeights(abs(uv_ratio.y), col)/3.0;\nweights2=weights2+scanlineWeights(abs(1.0-uv_ratio.y), col2)/3.0;\n#endif\n\nvec3 mul_res = (col * weights + col2 * weights2).rgb * vec3(cval);\n\n// dot-mask emulation:\n// Output pixels are alternately tinted green and magenta.\nvec3 dotMaskWeights = mix(\nvec3(1.0, 1.0 - DOTMASK, 1.0),\nvec3(1.0 - DOTMASK, 1.0, 1.0 - DOTMASK),\nfloor(mod(mod_factor, 2.0))\n);\n\nmul_res *= dotMaskWeights;\n\n// Convert the image gamma for display on our output device.\nmul_res = pow(mul_res, vec3(1.0 / monitorgamma));\n\n// Color the texel.\noutput_dummy _OUT;\n_OUT._color = vec4(mul_res, 1.0);\nFragColor = _OUT._color;\nreturn;\n} \n#endif\n\n'},me=e(57),J=e(11),Q={addStyleHook:function(){H(this.elements.container,this.config.selectors.container.replace(".",""),!0),H(this.elements.container,this.config.classNames.uiSupported,!0),H(this.elements.container,this.config.classNames.hideControls,!0)},build:function(){this.listeners.media(),F.element(this.elements.controls)||(ae.inject.call(this),this.listeners.controls()),this.volume=null,this.muted=null,ae.updateVolume.call(this),H(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0},toggleControls:function(e){var n,t,a=this.elements.controls;a&&(n=0,t=r.call(this,".".concat(X({ejs__dialogs:!0})," > .").concat(X({ejs__dialog:!0}))),Array.from(t).forEach(function(e,t){!0!==e.hidden&&(n+=1)}),0>>0},o.prototype.readU24=function(){return this.littleEndian?this._lastRead=this._u8array[this.offset]+(this._u8array[this.offset+1]<<8)+(this._u8array[this.offset+2]<<16):this._lastRead=(this._u8array[this.offset]<<16)+(this._u8array[this.offset+1]<<8)+this._u8array[this.offset+2],this.offset+=3,this._lastRead>>>0},o.prototype.readU32=function(){return this.littleEndian?this._lastRead=this._u8array[this.offset]+(this._u8array[this.offset+1]<<8)+(this._u8array[this.offset+2]<<16)+(this._u8array[this.offset+3]<<24):this._lastRead=(this._u8array[this.offset]<<24)+(this._u8array[this.offset+1]<<16)+(this._u8array[this.offset+2]<<8)+this._u8array[this.offset+3],this.offset+=4,this._lastRead>>>0},o.prototype.readBytes=function(e){this._lastRead=new Array(e);for(var t=0;t>8):(this._u8array[this.offset]=e>>8,this._u8array[this.offset+1]=255&e),this.offset+=2},o.prototype.writeU24=function(e){this.littleEndian?(this._u8array[this.offset]=255&e,this._u8array[this.offset+1]=(65280&e)>>8,this._u8array[this.offset+2]=(16711680&e)>>16):(this._u8array[this.offset]=(16711680&e)>>16,this._u8array[this.offset+1]=(65280&e)>>8,this._u8array[this.offset+2]=255&e),this.offset+=3},o.prototype.writeU32=function(e){this.littleEndian?(this._u8array[this.offset]=255&e,this._u8array[this.offset+1]=(65280&e)>>8,this._u8array[this.offset+2]=(16711680&e)>>16,this._u8array[this.offset+3]=(4278190080&e)>>24):(this._u8array[this.offset]=(4278190080&e)>>24,this._u8array[this.offset+1]=(16711680&e)>>16,this._u8array[this.offset+2]=(65280&e)>>8,this._u8array[this.offset+3]=255&e),this.offset+=4},o.prototype.writeBytes=function(e){for(var t=0;tn&&(n=o.offset+o.length):o.offset+o.data.length>n&&(n=o.offset+o.data.length)}n===e.fileSize?t=e.slice(0,e.fileSize):(t=new Z(n),e.copyToFile(t,0))}for(e.seek(0),a=0;a>>1:n>>>1;e[t]=n}return e}();function $(e,t,n){for(var a=t?new Uint8Array(e._u8array.buffer,t):e._u8array,o=-1,i=n?a.length-4:a.length,s=0;s>>8^ye[255&(o^a[s])];return(-1^o)>>>0}var be=1,_e=2,Te=3;function we(){this.sourceSize=0,this.targetSize=0,this.metaData="",this.actions=[],this.sourceChecksum=0,this.targetChecksum=0,this.patchChecksum=0}function xe(e){e.readVLV=Se,e.littleEndian=!0;var t=new we,n=(e.seek(4),t.sourceSize=e.readVLV(),t.targetSize=e.readVLV(),e.readVLV());n&&(t.metaData=e.readString(n));for(var a=e.fileSize-12;e.offset>2)};i.type===be?i.bytes=e.readBytes(i.length):i.type!==_e&&i.type!==Te||(o=e.readVLV(),i.relativeOffset=(1&o?-1:1)*(o>>1)),t.actions.push(i)}if(t.sourceChecksum=e.readU32(),t.targetChecksum=e.readU32(),t.patchChecksum=e.readU32(),t.patchChecksum!==$(e,0,!0))throw new Error("error_crc_patch");return t}function Se(){for(var e=0,t=1;;){var n=this.readU8();if(e+=(127&n)*t,128&n)break;e+=t<<=7}return this._lastRead=e}function Ee(e){for(;;){var t=127&e;if(0==(e>>=7)){this.writeU8(128|t);break}this.writeU8(t),e--}}function Me(e){for(var t=0;;){if(0==(e>>=7)){t++;break}t++,e--}return t}we.prototype.toString=function(){var e="Source size: "+this.sourceSize;return(e=(e+="\nTarget size: "+this.targetSize)+("\nMetadata: "+this.metaData))+("\n#Actions: "+this.actions.length)},we.prototype.validateSource=function(e,t){return this.sourceChecksum===$(e,t)},we.prototype.apply=function(e,t){if(t&&!this.validateSource(e))throw new Error("error_crc_input");for(var n=new Z(this.targetSize),a=0,o=0,i=0;i>=7)){this.writeU8(128|t);break}this.writeU8(t),--e}}function Pe(){for(var e=0,t=1;;){var n=this.readU8();if(-1==n)throw new Error("Can't read UPS VLV at 0x"+(this.offset-1).toString(16));if(e+=(127&n)*t,0!=(128&n))break;e+=t<<=7}return e}function Ie(e){for(var t=0;t++,0!=(e>>=7);)--e;return t}function Oe(e){var t=new l;for(e.readVLV=Pe,e.seek(Ce.length),t.sizeInput=e.readVLV(),t.sizeOutput=e.readVLV();e.offset\n \n \n \n ",e=V("iframe",{src:g.adUrl,scrolling:"no",frameborder:"no",style:"width:300px !important;height:250px !important;display: block !important;"}),ee.loading.querySelector(".".concat(w.ad)).removeChild(ee.loading.querySelector(".".concat(w.ad," iframe"))),ee.loading.querySelector(".".concat(w.ad)).appendChild(e),W.webgl.DETECTED||(B(ee.loading.querySelector(".".concat(w["start-game"])),!0),ee.loading.querySelector(".".concat(w.p3)).innerHTML='Failed to initialize WebGL. '),ee.loading.querySelector(".".concat(w.ad," iframe")).style.setProperty("display","block","important"),ee.loading.querySelector(".".concat(w.ad," iframe")).style.setProperty("visibility","visible","important"),ee.loading.querySelector(".".concat(w.ad)).style.setProperty("display","block","important"),ee.loading.querySelector(".".concat(w.ad)).style.setProperty("visibility","visible","important")):(ee.loading.innerHTML='\n "),W.webgl.DETECTED||(B(ee.loading.querySelector(".".concat(w["start-game"])),!0),ee.loading.querySelector(".".concat(w.p3)).innerHTML='Failed to initialize WebGL. ')),window.URL||window.webkitURL),x=function(e){return 80===e[0]&&75===e[1]&&(3===e[2]&&4===e[3]||5===e[2]&&6===e[3]||7===e[2]&&8===e[3])?"zip":55===e[0]&&122===e[1]&&188===e[2]&&175===e[3]&&39===e[4]&&28===e[5]?"7z":82===e[0]&&97===e[1]&&114===e[2]&&33===e[3]&&26===e[4]&&7===e[5]&&(0===e[6]||1===e[6]&&0==e[7])?"rar":void 0},S=async function(e){e=await(await fetch(e)).text(),e=new Blob([e],{type:"application/javascript"}),e=window.URL.createObjectURL(e);return new Worker(e)},E=async function(e){var t=await(await fetch(e)).text(),e=new Blob(["\nvar dataToPass = [];\nModule = {\n monitorRunDependencies: function(left) {\n if (left == 0) {\n setTimeout(function() {\n unrar(dataToPass, null);\n }, 100);\n }\n },\n onRuntimeInitialized: function() {\n },\n locateFile: function(file) {\n return '"+e+".mem';\n }\n};\n"+t+'\nvar unrar = function(data, password) {\n var cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n var rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n var rec = function(entry) {\n if (entry.type === \'file\') {\n postMessage({"t":2,"file":entry.fullFileName,"size":entry.fileSize,"data":entry.fileContent});\n } else if (entry.type === \'dir\') {\n Object.keys(entry.ls).forEach(function(k) {\n rec(entry.ls[k]);\n })\n } else {\n throw "Unknown type";\n }\n }\n rec(rarContent);\n postMessage({"t":1});\n return rarContent;\n};\nonmessage = function(data) {\n dataToPass.push({name: \'test.rar\', content: data.data});\n};\n '],{type:"application/javascript"}),t=window.URL.createObjectURL(e);return new Worker(t)},M=null,C=null,l=null,d=null;try{M=new me({dbVersion:1,storePrefix:"ejs-",storeName:"system",keyPath:null,autoIncrement:!1,onStoreReady:function(){n=!0},onError:function(){n=!0}}),C=new me({dbVersion:1,storePrefix:"ejs-",storeName:"roms",keyPath:null,autoIncrement:!1,onStoreReady:function(){a=!0},onError:function(){a=!0}}),l=new me({dbVersion:1,storePrefix:"ejs-",storeName:"bios",keyPath:null,autoIncrement:!1,onStoreReady:function(){o=!0},onError:function(){o=!0}}),d=new me({dbVersion:1,storePrefix:"ejs-",storeName:"romsdata",keyPath:null,autoIncrement:!1,onStoreReady:function(){},onError:function(){}})}catch(e){o=a=n=!0,console.log(e)}G.call(g,g.elements.container,"start-game",function(e){g.started=!0,g.playing=!0,B(ee.loading.querySelector(".".concat(w["loading-info"])),!0),!te||"undefined"!=te.virtualGamepadContainer&&null!==te.virtualGamepadContainer||Q.toggleControls.call(g,!0);var t,n,a,o,i,s,r,l,c=X({"ejs__tooltip--visible":!0}),d=g.elements.buttons.gamepad.querySelector(".".concat(X({ejs__tooltip:!0}))),u=(H(d,c,!0),setTimeout(function(){H(d,c,!1)},5e3),"string"==typeof g.adUrl&&(B(ee.loading.querySelector(".".concat(w["close-ad"])),!1),!0!==g.config.noAutoAdClose&&setTimeout(function(){g.started&&ee.loading.querySelector(".".concat(w.ad))&&ee.loading.querySelector(".".concat(w.ad)).parentNode.removeChild(ee.loading.querySelector(".".concat(w.ad)))},1e4)),B(ee.loading.querySelector(".".concat(w["start-game"])),!0),K(ae.defaultCoreOptionsValues.call(p),ae.storage.get("core-options")||{})),f=("n64"===g.system&&u&&Object.keys(u).forEach(function(e){"glupen64-aspect"===e&&"16:9"===u[e]&&(T.height=T.width/16*9,ee.aspectRatio=16/9)}),"arcade"!==p.system&&"fba0.2.97.29"!==p.system||u&&Object.keys(u).forEach(function(e){"fba-aspect"===e&&"PAR"===u[e]&&(T.height=T.width/16*9,ee.aspectRatio=16/9)}),"gba"===g.system&&(T.height=T.width/1.5,ee.aspectRatio=1.5),window.setTimeout(function(){},150),f=p,"undefined"!=typeof RI?(document.removeEventListener("mousemove",RI.eventHandler,!1),T.removeEventListener("mousedown",RI.canvasEventHandler,!1),T.removeEventListener("mouseup",RI.canvasEventHandler,!1),f.elements.container.addEventListener("mousemove",function(e){var t=0,n=0,a=e.offsetX-ee.Module.canvas.offsetLeft,o=e.offsetY-ee.Module.canvas.offsetTop;if("mousemove"===e.type){t=a<0?(a=0,-ee.Module.canvas.offsetWidth):a>ee.Module.canvas.offsetWidth?(a=ee.Module.canvas.offsetWidth,ee.Module.canvas.offsetWidth):a-RI.currentX,n=o<0?(o=0,-ee.Module.canvas.offsetHeight):o>ee.Module.canvas.offsetHeight?(o=ee.Module.canvas.offsetHeight,ee.Module.canvas.offsetHeight):o-RI.currentY,RI.currentX=a,RI.currentY=o;for(var i=0;i>2]=t,HEAP32[RI.contexts[i].state+36>>2]=n}},!1),f.elements.container.addEventListener("mousedown",RI.canvasEventHandler,!1),f.elements.container.addEventListener("mouseup",RI.canvasEventHandler,!1),f.elements.container.addEventListener("touchstart",t=function(e){if(e.targetTouches[0]){var t,n=0,a=0,o=e.target.getBoundingClientRect(),i=e.targetTouches[0].clientX-o.left,o=e.targetTouches[0].clientY-o.top,n=i<0?(i=0,-ee.Module.canvas.offsetWidth):i>ee.Module.canvas.offsetWidth?(i=ee.Module.canvas.offsetWidth,ee.Module.canvas.offsetWidth):i-RI.currentX,a=o<0?(o=0,-ee.Module.canvas.offsetHeight):o>ee.Module.canvas.offsetHeight?(o=ee.Module.canvas.offsetHeight,ee.Module.canvas.offsetHeight):o-RI.currentY;RI.currentX=i,RI.currentY=o;for(var s=0;s>2]=n,HEAP32[RI.contexts[s].state+36>>2]=a;switch(e.type){case"touchend":case"touchstart":if(0===e.button)t=40;else{if(2!==e.button)break;t=41}for(var r="touchend"===e.type?0:1,l=0;l>0]=r}}},!1),f.elements.container.addEventListener("touchend",t,!1)):(f=function(e){e=new MouseEvent(e.type,e);ee.Module.canvas.dispatchEvent(e)},q.call(p,".".concat(X({ejs__dialogs:!0}))).addEventListener("mousemove",f,!1),q.call(p,".".concat(X({ejs__dialogs:!0}))).addEventListener("mousedown",f,!1),q.call(p,".".concat(X({ejs__dialogs:!0}))).addEventListener("mouseup",f,!1)),"msx"===g.system&&"undefined"!=typeof RI&&(document.removeEventListener("keydown",RI.eventHandler,!1),document.removeEventListener("keyup",RI.eventHandler,!1),t=function(e){var t=e.keyCode,n=t>>3,a=1<<(7&t);switch(e.type){case"keyup":case"keydown":if(32<=n)throw"key code error! bad code: "+t;for(var o=0;o>0];"keyup"===e.type?i&=~a:i|=a,HEAP8[RI.contexts[o].state+n>>0]=i}}},document.addEventListener("keydown",t,!1),document.addEventListener("keyup",t,!1)),setTimeout(function(){var o=Y.info();null===te.setVolume&&"undefined"!=typeof RA?(RA.queueAudio=function(){var e=g.volume,t=RA.bufIndex,n=RA.bufIndex?RA.buffers[RA.bufIndex-1].endTime:RA.context.currentTime,a=(RA.buffers[t].endTime=n+RA.buffers[t].duration,RA.context.createBufferSource());a.buffer=RA.buffers[t],1===(e=g.muted?0:e)?a.connect(RA.context.destination):(t=RA.context.createGain(),a.connect(t),t.connect(RA.context.destination),Y.isEdge||"chrome"===o.name&&parseInt(o.version,10)<=60||"firefox"===o.name&&parseInt(o.version,10)<=56||"opera"===o.name&&parseInt(o.version,10)<=44?t.gain.value=e:"firefox"===o.name?t.gain.setValueAtTime(e,RA.context.currentTime):t.gain.setValueAtTime(e,RA.context.currentTime,0)),a.start(n),RA.bufIndex+=1,RA.bufOffset=0},Y.isIos&&window.addEventListener("touchstart",function(){var e;RA.context&&(RA.context.resume(),(e=RA.context.createBufferSource()).connect(RA.context.destination),e.start())},!1)):te.setVolume()},500),setTimeout(function(){g.elements.container.focus()},30),void 0===window.addRunDependency&&(window.Module=void 0),ee.FS.readFile(g.startName));f.length<=33554432&&".cue"!=g.startName.substr(-4)&&(a="snes"===g.system||["snes2002","snes2005","snes2010"].includes(g.system)?(n=f.length%1024,new Z(n?f.slice?f.slice(n):f.subarray(n):f)):new Z(f),o=Re.a.create(),i=new FileReader,s=0,r=a._u8array.length,l=function(){var e;sDoesn\'t look like your browser is supported'}else l.innerHTML='Invalid Rom '}function n(e){if(e.data){if(1===e.data.t&&(!r.startName&&u&&(r.startName=u),e.target.terminate(),s(r.startName)),2===e.data.t){var t=e.data.file.split("/"),n=(a=t.pop()).split(".").pop(),a=a.replace(/\#/g,"");ee.FS.createPath("/",t.join("/"),!0,!0);for(var o=h[c].length-1;0<=o;--o)h[c][o]===n.toLowerCase()&&d'+z.localization("Missing mame config")+"");r=r.split("|");ee.coreFileName="".concat(z.system,"-").concat(r[0]),a="1"===r[1],F.element(z.elements.buttons.saveState)&&B(z.elements.buttons.saveState,!a),F.element(z.elements.buttons.loadState)&&B(z.elements.buttons.loadState,!a),B(ae.contextMenu.querySelectorAll("ul li").item(2),!a),B(ae.contextMenu.querySelectorAll("ul li").item(3),!a),c=2===z.coreVer?"":z.system.concat("-old-").concat(r[0],"-wasm.data"),r[0]?(W.wasm&&i?u=!0:(s.innerHTML=''+z.localization("Webassembly support is not detected in this browser")+" ",c=""),c&&(M.db?M.get(c,function(e){e&&e.version===n?2===g.coreVer?k(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),k(e)):d(c,n)}):d(c,n))):s.innerHTML=''+z.localization("Unsupported Game")+" "}else{var l,c=!1;if(W.wasm&&i?(l="wasm",c=!0,"n64"!==z.system||e||2===z.coreVer||(l="legacy-wasm"),u=!0):o&&(c=!0,l="asmjs","n64"!==z.system||e||2===z.coreVer||(l="legacy-asmjs")),!0!==(c="undefined"!=typeof EJS_CUSTOM_COREFILE?EJS_CUSTOM_COREFILE:c))return void(s.innerHTML=''+z.localization("Please upgrade your browser to the latest version")+" ");c=2===z.coreVer?t+"-"+l+".data":t+"-old-"+l+".data","undefined"!=typeof EJS_CUSTOM_COREFILE&&(c=EJS_CUSTOM_COREFILE),M.db?M.get(c,function(e){!e||e.version!==n||"undefined"!=typeof EJS_DEBUG_XX&&!0===EJS_DEBUG_XX?d(c,n):2===g.coreVer?k(e.data):((e=e.data.slice?e.data.slice(12):e.data.subarray(12)).set([55,122,188,175,39,28,0,3],0),k(e))}):d(c,n)}F.element(z.elements.buttons.saveState)&&B(z.elements.buttons.saveState,!a),F.element(z.elements.buttons.loadState)&&B(z.elements.buttons.loadState,!a),B(ae.contextMenu.querySelectorAll("ul li").item(2),!a),B(ae.contextMenu.querySelectorAll("ul li").item(3),!a),g.setStatesSupported(a),z.config.buttons&&(!1===z.config.buttons.playPause&&F.element(z.elements.buttons.play[0])&&B(z.elements.buttons.play[0],!0),!1===z.config.buttons.restart&&F.element(z.elements.buttons.restart)&&B(z.elements.buttons.restart,!0),!1===z.config.buttons.mute&&F.element(z.elements.buttons.mute)&&B(z.elements.buttons.mute,!0),!1===z.config.buttons.settings&&F.element(z.elements.buttons.settings)&&B(z.elements.buttons.settings,!0),!1===z.config.buttons.fullscreen&&F.element(z.elements.buttons.fullscreen)&&B(z.elements.buttons.fullscreen,!0),!1===z.config.buttons.saveState&&F.element(z.elements.buttons.saveState)&&B(z.elements.buttons.saveState,!0),!1===z.config.buttons.loadState&&F.element(z.elements.buttons.loadState)&&B(z.elements.buttons.loadState,!0),!1===z.config.buttons.screenRecord&&F.element(z.elements.buttons.screenRecord)&&B(z.elements.buttons.screenRecord,!0),!1===z.config.buttons.gamepad&&F.element(z.elements.buttons.gamepad)&&B(z.elements.buttons.gamepad,!0),!1===z.config.buttons.cheat&&F.element(z.elements.buttons.cheat)&&B(z.elements.buttons.cheat,!0),!1===z.config.buttons.volume&&F.element(z.elements.inputs.volume)&&B(z.elements.inputs.volume,!0),!1===z.config.buttons.screenshot&&B(ae.contextMenu.querySelectorAll("ul li").item(0),!0),!0===z.config.buttons.cacheManage&&B(ae.contextMenu.querySelectorAll("ul li").item(1),!1),!1===z.config.buttons.quickSave&&B(ae.contextMenu.querySelectorAll("ul li").item(2),!0),!1===z.config.buttons.quickLoad&&B(ae.contextMenu.querySelectorAll("ul li").item(3),!0))}else s.innerHTML=''+z.localization("Invalid System")+" "}).catch(function(e){D(e,t,g)}),ee.romdb=C,!1;setTimeout(L,50)}};oe(ee.loading.querySelector(".".concat(w["start-game"])),"click touchstart",L),!0===g.startOnLoad&&ee.loading.querySelector(".".concat(w["start-game"])).click()}},p=ee;function Ne(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t ')),!t)return!0;for(var n in t)De(n);return!0}),playerName:"",players:[],waitingList:{},roomMaster:null,inputsData:{},coreOptionData:{},currentFrame:0,wait:!(De=function(e){if(!document.getElementById(e))return!1}),progressHelper:{},icons:{lock:' '},disableInput:!1,disableControl:function(e){if(e){for(var t=0;t<24;t+=1)m.simulateInputFn(0,t,0),m.simulateInputFn(1,t,0),m.simulateInputFn(2,t,0),m.simulateInputFn(3,t,0);m.disableInput=!0}else m.disableInput=!1},isPaused:null,setVolume:null,setVariable:null,simulateInput:null,simulateInputFn:null,toggleShader:null,saveState:null,screenRecord:null,loadState:null,quickSaveState:null,quickLoadState:null,changeStateSlot:null,getScreenData:null,getStateInfo:null,setCheat:null,resetCheat:null,getGameCoreOptions:null,classNames:{"dialog-container":X({"dialog-container":!0}),tabs:X({tabs:!0}),"dialog-title":X({"dialog-title":!0}),"dialog-content":X({"dialog-content":!0}),"dialog-buttons":X({"dialog-buttons":!0}),overlay:X({overlay:!0}),"key-setting-popup":X({"key-setting-popup":!0}),"tabs-panel":X({"tabs-panel":!0}),"tabs-content":X({"tabs-content":!0}),"button-container":X({"button-container":!0}),set:X({set:!0}),active:X({active:!0}),"btn-cancel":X({"btn-cancel":!0}),"btn-reset":X({"btn-reset":!0}),"btn-clear":X({"btn-clear":!0}),"btn-create":X({"btn-create":!0}),"btn-submit":X({"btn-submit":!0}),"btn-join-room":X({"btn-join-room":!0}),"btn-quit":X({"btn-quit":!0}),"btn-create-room":X({"btn-create-room":!0}),modal:X({modal:!0}),modal__overlay:X({modal__overlay:!0}),modal__container:X({modal__container:!0}),modal__header:X({modal__header:!0}),modal__title:X({modal__title:!0}),modal__close:X({modal__close:!0}),modal__content:X({modal__content:!0}),modal__btn:X({modal__btn:!0}),"modal__btn-primary":X({"modal__btn-primary":!0}),"micromodal-slide":X({"micromodal-slide":!0}),modal__errmsg:X({modal__errmsg:!0}),modal__footer:X({modal__footer:!0}),"cheats-add":X({"cheats-add":!0}),"cheats-list":X({"cheats-list":!0}),"cheat-code-input":X({"cheat-code-input":!0}),"cheat-name-input":X({"cheat-name-input":!0}),"ejs-switch":X({"ejs-switch":!0}),"ejs-delete-cheat":X({"ejs-delete-cheat":!0})},initShaders:function(){for(var e,t=he,n=Object.keys(t),a=0;a\n \n
'+r.localization("Control Settings")+' \n \n \n \n \n \n \n
\n
[Select] \n
'+r.localization("Press keyboard or gamepad")+"
\n
\n
\n \n ",'\n \n
\n
\n
Connected gamepad: n/a
\n
\n
\n
\n
\n
'+r.localization("Gamepad")+'
\n
'+r.localization("Keyboard")+'
\n
\n
\n
\n
\n
')),n='\n \n
\n {label}: \n
\n
\n
\n
\n
');"nes"===r.system?i={0:"B",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")}:"snes"===r.system?i={0:"B",1:"Y",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",9:"X",10:"L",11:"R",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")}:"n64"===r.system?(i={0:"B",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",10:"L",11:"R",12:"Z",19:"L STICK UP",18:"L STICK DOWN",17:"L STICK LEFT",16:"L STICK RIGHT",23:"R STICK UP",22:"R STICK DOWN",21:"R STICK LEFT",20:"R STICK RIGHT",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")},2===r.coreVer&&(i[0]="A",i[1]="B",delete i[8])):i="nds"===r.system?{0:"B",1:"Y",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",9:"X",10:"L",11:"R",14:"Microphone",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")}:{0:"B",1:"Y",2:"SELECT",3:"START",4:"UP",5:"DOWN",6:"LEFT",7:"RIGHT",8:"A",9:"X",10:"L",11:"R",12:"L2",13:"R2",14:"L3",15:"R3",19:"L STICK UP",18:"L STICK DOWN",17:"L STICK LEFT",16:"L STICK RIGHT",23:"R STICK UP",22:"R STICK DOWN",21:"R STICK LEFT",20:"R STICK RIGHT",24:r.localization("QUICK SAVE STATE"),25:r.localization("QUICK LOAD STATE"),26:r.localization("CHANGE STATE SLOT")},["arcade","mame"].includes(r.system)&&(i[2]=r.localization("INSERT COIN")),!1===r.statesSupported&&(delete i[24],delete i[25],delete i[26]);for(var a=[2,3,4,5,6,7,8,0,9,1,10,11,12,13,14,15,19,18,17,16,23,22,21,20,24,25,26],t=0;t<=3;t+=1)!function(t){r.elements.dialogs.gamepad.querySelector(".".concat(m.classNames["tabs-content"])).innerHTML+=e.replace(/{index}/g,t),a.forEach(function(e){i[e]&&(r.elements.dialogs.gamepad.querySelector("#controls-".concat(t)).innerHTML+=n.replace(/{index}/g,t).replace(/{id}/g,e).replace(/{label}/g,i[e]))}),r.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc"),r.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="'.concat(t,'"][data-type="2"]'))&&(r.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="'.concat(t,'"][data-type="2"]')).style.backgroundColor="#ccc")}(t);Object.keys(m.controllers).forEach(function(a){m.controllers[a]&&Object.keys(m.controllers[a]).forEach(function(e){var t=r.elements.dialogs.gamepad.querySelector('[data-id="'.concat(e,'"][data-index="').concat(a,'"][data-type="1"]')),n=r.elements.dialogs.gamepad.querySelector('[data-id="'.concat(e,'"][data-index="').concat(a,'"][data-type="2"]'));if(!t||!n)return!1;e=m.controllers[a][e];e&&(e.type&&1!==parseInt(e.type,10)?n.value="":e.value&&(t.value=m.keyMap[e.value]||"",t.setAttribute("data-value",e.value)),e.value2&&(n.value=isNaN(e.value2)?e.value2:"button ".concat(parseInt(e.value2,10)+1),n.setAttribute("data-value",e.value2)))})}),G.call(this,r.elements.dialogs.gamepad.querySelector(".".concat(m.classNames["btn-submit"])),"click",function(e){var t=r.elements.dialogs.gamepad.querySelectorAll("input"),o={};return Array.from(t).forEach(function(e){var t,n=e.getAttribute("data-index"),a=e.getAttribute("data-value"),e=(2===parseInt(e.getAttribute("data-type"),10)&&(t=e.getAttribute("data-value")),e.getAttribute("data-id"));o[n]||(o[n]={}),o[n][e]||(o[n][e]={}),a&&(o[n][e].value=a),t&&(o[n][e].value2=t)}),ae.storage.set({controllers:o}),m.controllers=o,B(r.elements.dialogs.gamepad,!0),r.elements.container.focus(),e.stopPropagation(),!1}),G.call(this,r.elements.dialogs.gamepad.querySelector(".".concat(m.classNames["btn-reset"])),"click",function(e){m.controllers=JSON.parse(JSON.stringify(m.defaultControllers)),localStorage.removeItem(ae.storage.key);for(var t=r.elements.dialogs.gamepad.querySelectorAll("input"),n=0;nGamepad:'.concat(m.gamepad.gamepads[a].id," "+r.localization("Press keyboard or gamepad")+" "+r.localization("Press escape (esc) to clear")):t+=" Press keyboard "+r.localization("Press escape (esc) to clear"),s.querySelector(".".concat(m.classNames["key-setting-popup"])).innerHTML=t,e.stopPropagation()})})},setCacheDialog:function(){var t=this;t.elements.dialogs.cache.innerHTML='\n \n
\n
'+t.localization("Cache Manager")+' \n \n
\n\n
\n
\n
\n "),G.call(this,t.elements.dialogs.cache.querySelector(".".concat(m.classNames["btn-cancel"])),"click",function(e){return B(t.elements.dialogs.cache,!0),t.elements.container.focus(),e.stopPropagation(),!1}),G.call(this,t.elements.dialogs.cache.querySelector(".".concat(m.classNames["dialog-title"]," a")),"click",function(e){return p.romdb&&(p.romdb.clear(),t.elements.dialogs.cache.querySelector(".".concat(m.classNames["dialog-content"])).innerHTML=''+t.localization("Empty")+"
"),e.stopPropagation(),!1})},showLoading:function(e){Ge.show("modal-6ed698f3d04061f5",{closeByEsckey:!1}),e&&console.log(""),B(this.elements.dialogs.loading,!1)},hideLoading:function(){Ge.close(),B(this.elements.dialogs.loading,!0)},setLoadingDialog:function(){this.elements.dialogs.loading&&(this.elements.dialogs.loading.innerHTML='\n \n
\n
\n '+this.localization("Loading")+"...\n
\n
\n
"))},setCheatDialog:function(){var i,s,a,r=this;r.elements.dialogs.cheat&&(r.elements.dialogs.cheat.innerHTML='\n \n\n \n\n \n
\n
\n \n
\n\n
\n '+r.localization("Code")+' \n \n '+r.localization("Description")+' \n \n\n \n \n
\n
\n
\n "),i=r.elements.dialogs.cheat.querySelector("#modal-85cd7a1c543a484b"),G.call(this,r.elements.dialogs.cheat.querySelector(".".concat(m.classNames["cheats-add"])),"click",function(e){return Ge.show("modal-85cd7a1c543a484b",{closeTrigger:"data-modal-close"}),!1}),s=r.elements.dialogs.cheat.querySelector(".".concat(m.classNames["cheats-list"])),G.call(this,i.querySelector(".".concat(m.classNames["modal__btn-primary"])),"click",function(e){var t,n,a=i.querySelector(".".concat(m.classNames["cheat-name-input"])).value,o=i.querySelector(".".concat(m.classNames["cheat-code-input"])).value;return a&&o&&(t=s.querySelectorAll("input:checked"),i.querySelector(".".concat(m.classNames["cheat-name-input"])).value="",i.querySelector(".".concat(m.classNames["cheat-code-input"])).value="",Ge.close(),n=r.cheats.length,r.cheats.push([a,o]),s.innerHTML+='\n
\n
').concat(a,' \n
× \n
'),t.forEach(function(e,t){s.querySelector("#ejs-cheat-switch-".concat(t)).setAttribute("checked","checked")})),"localStorage"in window&&localStorage.setItem("".concat(r.system,"-").concat(r.startName,"-cheats"),JSON.stringify(r.cheats)),e.stopPropagation(),!1}),a=function(){if("localStorage"in window){var e=localStorage.getItem("".concat(r.system,"-").concat(r.startName,"-cheats"));try{e=JSON.parse(e)}catch(e){}e&&(r.cheats=e)}s.innerHTML="",r.cheats&&Array.isArray(r.cheats)&&r.cheats.forEach(function(e,t){var n=e[0];e[1],s.innerHTML+='\n
\n
').concat(n,' \n
× \n
')})},G.call(r,s,"click",function(e){var t,n;return e.target&&e.target.classList.contains(m.classNames["ejs-delete-cheat"])&&e.target.getAttribute("data-idx")&&(t=e.target.getAttribute("data-idx"),r.cheats.splice(t,1),"localStorage"in window&&localStorage.setItem("".concat(r.system,"-").concat(r.startName,"-cheats"),JSON.stringify(r.cheats)),n=[],s.querySelectorAll("input").forEach(function(e,t){n[t]=!!s.querySelector("#ejs-cheat-switch-".concat(t,":checked"))}),n.splice(t,1),a(),n.forEach(function(e,t){e&&s.querySelector("#ejs-cheat-switch-".concat(t)).setAttribute("checked","checked")})),e.stopPropagation(),!1}),G.call(r,r.elements.container,"start-game",function(e){a()}),G.call(this,r.elements.dialogs.cheat.querySelector(".".concat(m.classNames["btn-cancel"])),"click",function(e){return B(r.elements.dialogs.cheat,!0),e.stopPropagation(),r.elements.container.focus(),!1}),G.call(this,r.elements.dialogs.cheat.querySelector(".".concat(m.classNames["btn-submit"])),"click",function(e){return m.resetCheat(),s.querySelectorAll("input:checked").forEach(function(e,t){e=r.cheats[e.value];e&&m.setCheat(t,1,e[1])}),B(r.elements.dialogs.cheat,!0),r.elements.container.focus(),!1}),"arcade"!==r.system&&"mame"!==r.system&&"mame2003"!==r.system&&"mame2010"!==r.system||(F.element(r.elements.buttons.cheat)&&B(r.elements.buttons.cheat,!0),m.allowCheat=!1),m.setCheat||(B(r.elements.buttons.cheat,!0),m.allowCheat=!1))},initKeyboard:function(){var i=this,s=this,r=this.elements.dialogs.gamepad.querySelector(".".concat(m.classNames.overlay));G.call(this,document.body,"keydown keyup",function(n){if(!(112<=n.which&&n.which<=123)){var e=!i.elements.dialogs.gamepad.hidden&&!r.hidden,a="keydown"===n.type;if(a&&e){var e=r.getAttribute("data-index"),t=r.getAttribute("data-id"),o=null;if(n.key&&"escape"===m.keyMap[n.keyCode])return(o=s.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="1"]'))).setAttribute("data-value",""),o.value=""(o=s.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="2"]'))).setAttribute("data-value",""),o.value="",void B(r,!0);e=r.getAttribute("data-index"),t=r.getAttribute("data-id"),o=null;n.key&&((o=s.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="1"]'))).setAttribute("data-value",n.keyCode),o.value=m.keyMap[n.keyCode]),B(r,!0)}else Object.keys(m.controllers).forEach(function(t){Object.keys(m.controllers[t]).forEach(function(e){parseInt(m.controllers[t][e].value,10)===n.keyCode&&["24","25","26"].includes(e)&&"keydown"==n.type&&!n.repeat&&("24"==e?m.quickSaveState():"25"==e?m.quickLoadState():"26"==e&&m.changeStateSlot()),parseInt(m.controllers[t][e].value,10)===n.keyCode&&(a?16<=e&&e<=23?m.simulateInput(t,e,32767):m.simulateInput(t,e,1):m.simulateInput(t,e,0))})})}}),document.body.addEventListener("keydown",function(e){var t=e.keyCode||e.which;[32,37,38,39,40,112,113,114,115,116,117,118,119,120,121,122,123].includes(t)&&e.srcElement===s.elements.container&&e.preventDefault(),e.srcElement.className.split(/ +/).includes(m.classNames.set)&&e.preventDefault()})},initGamepad:function(){var n,l=this,o=this,c=this.elements.dialogs.gamepad.querySelector(".".concat(m.classNames.overlay));try{n=new fe}catch(e){return void console.warn("gamepad not supported")}(m.gamepad=n).on("buttondown",function(n){var e,t,a;l.elements.dialogs.gamepad.hidden||c.hidden?Object.keys(m.controllers[n.gamepadIndex.toString()]).forEach(function(e){var t=n.gamepadIndex.toString();parseInt(m.controllers[t][e].value2,10)===parseInt(n.index,10)&&["24","25","26"].includes(e)&&("24"==e?m.quickSaveState():"25"==e?m.quickLoadState():"26"==e&&m.changeStateSlot()),parseInt(m.controllers[t][e].value2,10)===parseInt(n.index,10)&&parseInt(t,10)===parseInt(n.gamepadIndex,10)&&m.simulateInput(t,e,1)}):(e=parseInt(c.getAttribute("data-index"),10),t=c.getAttribute("data-id"),n.gamepadIndex===parseInt(e,10)&&(a=null,(a=o.elements.dialogs.gamepad.querySelector('[data-id="'.concat(t,'"][data-index="').concat(e,'"][data-type="2"]'))).setAttribute("data-value",n.index),a.value="button ".concat(n.index+1),B(c,!0)))}),n.on("buttonup",function(n){Object.keys(m.controllers).forEach(function(t){Object.keys(m.controllers[t]).forEach(function(e){parseInt(m.controllers[t][e].value2,10)===parseInt(n.index,10)&&parseInt(t,10)===parseInt(n.gamepadIndex,10)&&m.simulateInput(t,e,0)})})}),n.on("axischanged",function(e){var t,n=.5<(t=e.value)||t<-.5?0')+(''),i=0;i'+t[i].text+"
");o=(o+="")+('');for(i=0;i'+t[i].text+"
");o=(o+="")+('');for(i=0;i'+t[i].text+"
");o=(o+="")+('');for(var s,i=0;i'+t[i].text+"
");m.virtualGamepadContainer.innerHTML=o+="",B(m.virtualGamepadContainer,!e);var r,l=X({"virtual-gamepad":!0}),c=X({touch:!0});Y.isIos||G.call(this,q.call(this,".".concat(l)),"touchmove",function(e){e.stopPropagation()});for(i=0;i{var e=q.call(n,".".concat(l," .").concat(X(t.id)));e&&G.call(n,e,"touchstart touchend",function(e){"touchend"===e.type?(H(e.target,c,!1),window.setTimeout(function(){m.syncInput(0,t.number,0)},30)):(H(e.target,c,!0),m.syncInput(0,t.number,1)),e.stopPropagation()})});var p,e=V("div",{class:X({ejs__widget:!0,ejs__widget_controls_toggle:!0})},"");e.innerHTML=' ',q.call(this,".".concat(X({ejs__widgets:!0}))).appendChild(e),G.call(this,e,"mousedown touchstart",function(e){H(e.target,c,!0),clearTimeout(p),Q.toggleControls.call(n,!0),p=setTimeout(function(){Q.toggleControls.call(n,!1)},5e3)})}function h(){var e;return"n64"!==n.system||"d-pad"===(e=ae&&"function"==typeof ae.getCoreOptionsValues?ae.getCoreOptionsValues()["joystick-input"]:e)?{downVal:1,4:4,5:5,6:6,7:7}:{downVal:32767,4:19,5:18,6:17,7:16}}},setup:function(){var e,t,n,a=this;this.game?(m.playerName=a.config.playerName,H(this.elements.container,this.config.classNames.type,!0),this.elements.container.setAttribute("tabindex","0"),this.color&&(e=function(e){var t=e.toLowerCase();if(t&&/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)){if(4===t.length){for(var n="#",a=1;a<4;a+=1)n+=t.slice(a,a+1).concat(t.slice(a,a+1));t=n}for(var o=[],i=1;i<7;i+=2)o.push(parseInt("0x".concat(t.slice(i,i+2)),16));return o}return null}(this.color))&&this.elements.container.setAttribute("style","--ejs-primary-color: ".concat(e[0],", ").concat(e[1],", ").concat(e[2])),this.elements.wrapper=V("div",{class:this.config.classNames.video}),O(this.game,this.elements.wrapper),"video"!==a.game.tagName.toLocaleLowerCase()&&(t=this.config.volume,Object.defineProperty(a.game,"volume",{get:function(){return t},set:function(e){t=e,U.call(a,a.game,"volumechange")}}),n=a.storage.get("muted"),Object.defineProperty(a.game,"muted",{get:function(){return n},set:function(e){e=!!F.boolean(e)&&e;n=e,U.call(a,a.game,"volumechange")}})),window.addEventListener("beforeunload",function(e){a.started&&(p.FS.syncfs(function(){}),m.saveSavFiles(),p.FS.syncfs(function(){}))},!0),setInterval(function(){a.started&&(console.log("saving save files"),m.saveSavFiles(),p.FS.syncfs(!1,function(){}))},3e5)):console.warn("No game element found!")},listeners:function(){var s=this;s.elements.buttons.restart&&G.call(s,s.elements.buttons.restart,"click",function(e){m.restartGame(),m.inputsData={}}),s.elements.buttons.screenRecord&&G.call(s,s.elements.buttons.screenRecord,"click",function(e){var a,o,i;s.recordData||(s.recordData={started:!1,data:[],stopped:!1}),s.recordData.started?s.recordData.started&&(s.recordData.recorder.stop(),s.recordData.stopped=!0):(a=MediaRecorder.isTypeSupported("video/webm; codecs=h264")?{mimeType:"video/webm; codecs=h264"}:MediaRecorder.isTypeSupported("video/webm; codecs=H264")?{mimeType:"video/webm; codecs=H264"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp9")?{mimeType:"video/webm; codecs=vp9"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp8")?{mimeType:"video/webm; codecs=vp8"}:MediaRecorder.isTypeSupported("video/webm; codecs=avc1")?{mimeType:"video/webm; codecs=avc1"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp9.0")?{mimeType:"video/webm; codecs=vp9.0"}:MediaRecorder.isTypeSupported("video/webm; codecs=vp8.0")?{mimeType:"video/webm; codecs=vp8.0"}:{},p.Module.pauseMainLoop(),s.playing=!1,alert('please check "share system audio" to have audio in the recording. We only need the audio stream so your entire screen will not be recorded'),o=p.Module.canvas.captureStream(30),i=setTimeout(function(){s.playing=!0,p.Module.resumeMainLoop()},2e4),navigator.mediaDevices.getDisplayMedia({audio:!0,video:{mediaSource:"screen"}}).then(function(e){try{clearTimeout(i)}catch(e){}for(var t=e.getAudioTracks(),n=0;n>0;if(0>0,o=0;o".concat(this.icons[e],"");for(var a=t.childNodes[0].childNodes,o=0;o",""]),i=[];function n(e,t,n){"function"==typeof n?i.push(n):i.push(function(){});n=a.length-1;t?a.splice(n,0,''+e+" "):a.splice(n,0,''+e+" ")}n(o.localization("Take Screenshot"),!1,function(e){var t=m.getScreenData(),n=(n="string"==typeof o.gameName?o.gameName:n)?"".concat(n,"-screenshot.png"):"game.png",a=document.createElement("a");return a.href=URL.createObjectURL(new Blob([t])),a.download=n,a.click(),setTimeout(function(){URL.revokeObjectURL(a.src)}),!1}),n(o.localization("Cache Manage"),!0,function(e){var n;return p.romdb&&(B(o.elements.dialogs.cache,!1),(n=o.elements.dialogs.cache.querySelector(".".concat(m.classNames["dialog-content"]))).innerHTML=""+o.localization("Loading")+"
",p.romdb.getAll(function(e){var t,c;e?(t=V("table",{style:"width:100%;padding-left:10px;text-align:left"}),c=V("tbody"),0Remove',i.appendChild(s),i.appendChild(r),i.appendChild(l),c.appendChild(i),l.querySelector("a").onclick=function(e){p.romdb.removeBatch(a);try{c.removeChild(i)}catch(e){}return e.stopPropagation(),!1}}}),t.appendChild(c),n.appendChild(t)):n.innerHTML=''+o.localization("Empty")+"
"):n.innerHTML=''+o.localization("Empty")+"
"},function(){})),!1}),n(o.localization("Quick Save")+" (F2)",!1,function(e){m.quickSaveState(),ae.contextMenu.style.display="none"}),n(o.localization("Quick Load")+" (F4)",!1,function(e){m.quickLoadState(),ae.contextMenu.style.display="none"}),ne.contextMenu.innerHTML=a.join("");for(var s=ne.contextMenu.getElementsByTagName("li"),r=0;r ',"exit-fullscreen":' ',gamepad:' ',"load-state":' ',muted:' ',pause:' ',play:' ',restart:' ',"save-state":' ',"screen-record":' ',settings:' ',volume:' \n \n ',cheat:' '},this.id=Math.floor(1e4*Math.random()),null),t=(this.elements.controls=null,{id:this.id}),a=!0;F.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this.props)),this.config.controls||(this.config.controls=[]),F.element(this.config.controls)||F.string(this.config.controls)?e=this.config.controls:(e=ne.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality}),a=!1);function o(e){var n=e;return Object.entries(t).forEach(function(e){t=2;var e=function(e){if(Array.isArray(e))return e}(e=e)||function(e,t){var n=[],a=!0,o=!1,i=void 0;try{for(var s,r=e[Symbol.iterator]();!(a=(s=r.next()).done)&&(n.push(s.value),!t||n.length!==t);a=!0);}catch(e){o=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}(),t=e[0],e=e[1];n=d(n,"{".concat(t,"}"),e)}),n}var i,s;a&&(F.string(this.config.controls)?e=o(e):F.element(e)&&(e.innerHTML=o(e.innerHTML))),F.string(this.config.selectors.controls.container)&&(i=document.querySelector(this.config.selectors.controls.container)),(i=F.element(i)?i:this.elements.container)[F.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),F.element(this.elements.controls)||ne.findElements.call(this),F.empty(this.elements.buttons)||(s=function(e){var t=n.config.classNames.controlPressed;Object.defineProperty(e,"pressed",{enumerable:!0,get:function(){return k(e,t)},set:function(){H(e,t,0Math.abs(n)?a:n),n=(i.increaseVolume(a/50),i.game.volume);(1===a&&n<1||-1===a&&0 {
@@ -73,6 +73,7 @@
'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_VirtualGamepadSettings && (config.VirtualGamepadSettings = EJS_VirtualGamepadSettings);
'undefined' != typeof EJS_oldEJSNetplayServer && (config.oldNetplayServer = EJS_oldEJSNetplayServer);
'undefined' != typeof EJS_Buttons && (config.buttons = EJS_Buttons);
'undefined' != typeof EJS_Settings && (config.settings = EJS_Settings);
diff --git a/data/v.json b/data/v.json
index 95ded38..80974f3 100644
--- a/data/v.json
+++ b/data/v.json
@@ -1,6 +1,6 @@
{
"nes": {
- "version":"21",
+ "version":"23",
"netplay": 1,
"old": {"wasm":1, "asmjs":1 },
"state": 1,
@@ -10,7 +10,7 @@
"oldCores": 1
},
"snes": {
- "version":"18",
+ "version":"20",
"netplay": 1,
"old": {"wasm":1, "asmjs":1 },
"state": 1,
@@ -119,7 +119,7 @@
"oldCores": 1
},
"vb": {
- "version":"4",
+ "version":"6",
"netplay": 0,
"old": {"wasm":1, "asmjs":1 },
"state": 1,
@@ -138,7 +138,7 @@
"oldCores": 1
},
"atari5200": {
- "version":"2",
+ "version":"3",
"netplay": 1,
"state": 1,
"asmjs": 1,
@@ -183,7 +183,7 @@
"oldCores": 1
},
"gb": {
- "version":"9",
+ "version":"11",
"netplay": 0,
"state": 1,
"old": {"wasm":0, "asmjs":1 },
@@ -202,12 +202,13 @@
"oldCores": 1
},
"gba": {
- "version":"7",
+ "version":"9",
"netplay": 0,
"state": 1,
+ "old": {"wasm":0, "asmjs":1 },
"asmjs": 1,
- "wasm": 0,
- "newCores": 0,
+ "wasm": 1,
+ "newCores": 1,
"oldCores": 1
},
"segaGG": {
@@ -265,7 +266,7 @@
"oldCores": 1
},
"n64": {
- "version":"10",
+ "version":"12",
"netplay": 1,
"state": 1,
"asmjs": 0,
@@ -275,7 +276,7 @@
"oldCores": 1
},
"nds": {
- "version":"13",
+ "version":"15",
"old": {"wasm":1, "asmjs":1 },
"netplay": 0,
"state": 1,
@@ -303,8 +304,8 @@
"oldCores": 1
},
"mame2003": {
- "version":"2",
- "old": {"wasm":1, "asmjs":1 },
+ "version":"4",
+ "old": {"wasm":0, "asmjs":1 },
"netplay": 1,
"state": 1,
"asmjs": 0,
@@ -329,14 +330,5 @@
"wasm": 1,
"newCores": 0,
"oldCores": 1
- },
- "dos": {
- "version":"1",
- "netplay": 0,
- "state": 0,
- "asmjs": 0,
- "wasm": 1,
- "newCores": 1,
- "oldCores": 0
}
}
diff --git a/data/version.json b/data/version.json
index 9fc2a93..2552db4 100644
--- a/data/version.json
+++ b/data/version.json
@@ -1 +1 @@
-{ "current_version": 2.4 }
+{ "current_version": 3 }