diff --git a/data/emu-main.js b/data/emu-main.js
index 683502e..7dcd887 100644
--- a/data/emu-main.js
+++ b/data/emu-main.js
@@ -3460,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;
@@ -3834,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']);
@@ -4961,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;
@@ -4983,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() {
@@ -5964,7 +6328,7 @@ window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
}
return path
}
- this.version = '2.2.9';
+ this.version = '2.3.0';
this.system = '';
this.adUrl = null;
this.gameName = null;
diff --git a/data/emulator.min.js b/data/emulator.min.js
index 4e539a0..f42ce34 100644
--- a/data/emulator.min.js
+++ b/data/emulator.min.js
@@ -1 +1 @@
-var EJS=function(a){window.EJS_MODULES=a;var n={},o=[];function i(e){if(n[e])return n[e].exports;o.push(e);var t=n[e]={i:e,l:!1,exports:{}};return a[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}return window.getUsedModules=function(){return o.sort(function(e,t){return t'+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+=p[e>>>2]+p[63&(e<<4|t>>>4)]+p[63&(t<<2|n>>>6)]+p[63&n];return e=o[i],a+(p[e>>>2]+p[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 Se(e){e.readVLV=xe,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 xe(){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=B("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||(V(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||(V(ee.loading.querySelector(".".concat(w["start-game"])),!0),ee.loading.querySelector(".".concat(w.p3)).innerHTML='Failed to initialize WebGL. ')),window.URL||window.webkitURL),S=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},x=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,V(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&&(V(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)),V(ee.loading.querySelector(".".concat(w["start-game"])),!0),K(ae.defaultCoreOptionsValues.call(h),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"!==h.system&&"fba0.2.97.29"!==h.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=h,"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(h,".".concat(X({ejs__dialogs:!0}))).addEventListener("mousemove",f,!1),q.call(h,".".concat(X({ejs__dialogs:!0}))).addEventListener("mousedown",f,!1),q.call(h,".".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=p[c].length-1;0<=o;--o)p[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)&&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]?(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)&&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),g.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,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()}},h=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=pe,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,V(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 V(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 h.romdb&&(h.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(""),V(this.elements.dialogs.loading,!1)},hideLoading:function(){Ge.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"),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 V(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])}),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));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 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 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),V(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')+(''),!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=he.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=(Y.isIos||G.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=>{G.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()})}),B("div",{class:X({ejs__widget:!0,ejs__widget_controls_toggle:!0})},""));a.innerHTML=' ',q.call(this,".".concat(X({ejs__widgets:!0}))).appendChild(a),G.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=B("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&&(h.FS.syncfs(function(){}),m.saveSavFiles(),h.FS.syncfs(function(){}))},!0),setInterval(function(){a.started&&(console.log("saving save files"),m.saveSavFiles(),h.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"}:{},h.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=h.Module.canvas.captureStream(30),i=setTimeout(function(){s.playing=!0,h.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 h.romdb&&(V(o.elements.dialogs.cache,!1),(n=o.elements.dialogs.cache.querySelector(".".concat(m.classNames["dialog-content"]))).innerHTML=""+o.localization("Loading")+"
",h.romdb.getAll(function(e){var t,c;e?(t=B("table",{style:"width:100%;padding-left:10px;text-align:left"}),c=B("tbody"),0Remove',i.appendChild(s),i.appendChild(r),i.appendChild(l),c.appendChild(i),l.querySelector("a").onclick=function(e){h.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'+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/version.json b/data/version.json
index d7ef7a2..2552db4 100644
--- a/data/version.json
+++ b/data/version.json
@@ -1 +1 @@
-{ "current_version": 2.9 }
+{ "current_version": 3 }