Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
OutRed
GitHub Repository: OutRed/artclass
Path: blob/main/static/emulatorjs/EmulatorJS-main/emujs_data/emu-main.js
595 views
1
window.EJS_main = function(_0xa88a13, _0x17edbf, _0x2c1832) {
2
'use strict';
3
window.EJS_RESET_VARS = [];
4
for (let k in window) {
5
window.EJS_RESET_VARS.push(k);
6
}
7
const _0x470424 = _0x2c1832(1);
8
_0x2c1832.r(_0x17edbf);
9
let _0x39ca5e = {
10
'volume': 0.5,
11
'muted': false,
12
'i18n': {
13
'restart': 'Restart',
14
'play': 'Play',
15
'pause': 'Pause',
16
'played': 'Played',
17
'volume': 'Volume',
18
'mute': 'Mute (F9)',
19
'unmute': 'Unmute (F9)',
20
'enterFullscreen': 'Enter fullscreen',
21
'exitFullscreen': 'Exit fullscreen',
22
'settings': 'Settings',
23
'saveState': 'Save State (Shift + F2)',
24
'loadState': 'Load State (Shift + F4)',
25
'screenRecord': 'Start Screen Recording',
26
'cacheManager': 'Cache Manager',
27
'netplay': 'Netplay',
28
'gamepad': 'Control Settings',
29
'cheat': 'Cheats',
30
'menuBack': 'Go back to previous menu',
31
'normal': 'Normal',
32
'all': 'All',
33
'reset': 'Reset',
34
'disabled': 'Disabled',
35
'enabled': 'Enabled',
36
'playNow': 'Start Game'
37
},
38
'listeners': {
39
'play': null,
40
'pause': null,
41
'restart': null,
42
'rewind': null,
43
'mute': null,
44
'volume': null,
45
'fullscreen': null
46
},
47
'events': ['ready'],
48
'selectors': {
49
'editable': 'input, textarea, select, [contenteditable]',
50
'container': '.ejs',
51
'controls': {
52
'container': null,
53
'wrapper': '.jes__controls'
54
},
55
'buttons': {
56
'play': '[data-btn="play"]',
57
'pause': '[data-btn="pause"]',
58
'mute': '[data-btn="mute"]',
59
'fullscreen': '[data-btn="fullscreen"]',
60
'settings': '[data-btn="settings"]',
61
'saveState': '[data-btn="save-state"]',
62
'loadState': '[data-btn="load-state"]',
63
'screenRecord': '[data-btn="screen-record"]',
64
'cacheManager': '[data-btn="cache-manager"]',
65
'gamepad': '[data-btn="gamepad"]',
66
'netplay': '[data-btn="netplay"]',
67
'cheat': '[data-btn="cheat"]'
68
},
69
'inputs': {
70
'volume': '[data-range="volume"]'
71
}
72
},
73
'classNames': {
74
'type': 'ejs--video',
75
'video': 'ejs__video-wrapper',
76
'poster': 'ejs__poster',
77
'posterEnabled': 'ejs__poster-enabled',
78
'control': 'ejs__control',
79
'controlPressed': 'ejs__control--pressed',
80
'playing': 'ejs--playing',
81
'paused': 'ejs--paused',
82
'stopped': 'ejs--stopped',
83
'loading': 'ejs--loading',
84
'hover': 'ejs--hover',
85
'tooltip': 'ejs__tooltip',
86
'hidden': 'ejs__sr-only',
87
'hideControls': 'ejs--hide-controls',
88
'isIos': 'ejs--is-ios',
89
'isTouch': 'ejs--is-touch',
90
'uiSupported': 'ejs--full-ui',
91
'noTransition': 'ejs--no-transition',
92
'menu': {
93
'value': 'ejs__menu__value',
94
'badge': 'ejs__badge',
95
'open': 'ejs--menu-open'
96
},
97
'fullscreen': {
98
'enabled': 'ejs--fullscreen-enabled',
99
'fallback': 'ejs--fullscreen-fallback'
100
},
101
'tabFocus': 'ejs__tab-focus'
102
}
103
},
104
renderErrorPage = _0x2c1832(0),
105
_0x5127f4 = _0x2c1832(0x9d),
106
_0x48e5ff = _0x2c1832.n(_0x5127f4),
107
_0x406e79 = function(_0x2aa74f) {
108
return null != _0x2aa74f ? _0x2aa74f.constructor : null;
109
},
110
_0x1b0c2c = function(_0x8ec039, _0x1cb5ff) {
111
return Boolean(_0x8ec039 && _0x1cb5ff && _0x8ec039 instanceof _0x1cb5ff);
112
},
113
_0x19f739 = function(_0x3e8e1f) {
114
return null == _0x3e8e1f;
115
},
116
_0x4fc5a1 = function(_0x37a418) {
117
return _0x406e79(_0x37a418) === Object;
118
},
119
_0x34f3e8 = function(_0x2d2e5c) {
120
return _0x406e79(_0x2d2e5c) === String;
121
},
122
_0x1ca546 = function(_0x4d698f) {
123
return Array.isArray(_0x4d698f);
124
},
125
_0x37cc52 = function(_0x3a8b14) {
126
return _0x1b0c2c(_0x3a8b14, NodeList);
127
},
128
_0x555ee8 = function(_0x1fde53) {
129
return _0x19f739(_0x1fde53) || (_0x34f3e8(_0x1fde53) || _0x1ca546(_0x1fde53) || _0x37cc52(_0x1fde53)) && !_0x1fde53.length || _0x4fc5a1(_0x1fde53) && !Object.keys(_0x1fde53).length;
130
},
131
_0x1e2c68 = {
132
'nullOrUndefined': _0x19f739,
133
'object': _0x4fc5a1,
134
'number': function(_0x1d08d4) {
135
return _0x406e79(_0x1d08d4) === Number && !Number.isNaN(_0x1d08d4);
136
},
137
'string': _0x34f3e8,
138
'boolean': function(_0x340d71) {
139
return _0x406e79(_0x340d71) === Boolean;
140
},
141
'function': function(_0x10f562) {
142
return _0x406e79(_0x10f562) === Function;
143
},
144
'array': _0x1ca546,
145
'weakMap': function(_0x70b79f) {
146
return _0x1b0c2c(_0x70b79f, WeakMap);
147
},
148
'nodeList': _0x37cc52,
149
'element': function(_0xc21062) {
150
return _0x1b0c2c(_0xc21062, Element);
151
},
152
'textNode': function(_0x3e6b67) {
153
return _0x406e79(_0x3e6b67) === Text;
154
},
155
'event': function(_0x247601) {
156
return _0x1b0c2c(_0x247601, Event);
157
},
158
'keyboardEvent': function(_0x2b3224) {
159
return _0x1b0c2c(_0x2b3224, KeyboardEvent);
160
},
161
'cue': function(_0x57ee67) {
162
return _0x1b0c2c(_0x57ee67, window.TextTrackCue) || _0x1b0c2c(_0x57ee67, window.VTTCue);
163
},
164
'track': function(_0x23318b) {
165
return _0x1b0c2c(_0x23318b, TextTrack) || !_0x19f739(_0x23318b) && _0x34f3e8(_0x23318b.kind);
166
},
167
'url': function(_0xd61cf4) {
168
if (_0x1b0c2c(_0xd61cf4, window.URL)) return true;
169
let _0x17edbf = _0xd61cf4;
170
_0xd61cf4.startsWith('http://') && _0xd61cf4.startsWith('https://') || (_0x17edbf = 'http://' .concat(_0xd61cf4));
171
try {
172
return !_0x555ee8(new URL(_0x17edbf).hostname);
173
} catch (_0x5e6cd2) {
174
return false;
175
}
176
},
177
'empty': _0x555ee8
178
},
179
_0x168698 = function() {
180
let _0xa88a13 = false;
181
try {
182
let _0x17edbf = Object.defineProperty({}, 'passive', {
183
'get': function() {
184
return _0xa88a13 = true, null;
185
}
186
});
187
window.addEventListener('test', null, _0x17edbf), window.removeEventListener('test', null, _0x17edbf);
188
} catch (_0x1db3b5) {}
189
return _0xa88a13;
190
}();
191
192
function _0x1ef215(_0xa482e6, _0x474854, _0xc30d6e) {
193
let _0x57056f = this,
194
_0x3f468e = arguments.length > 3 && void 0 !== arguments[3] && arguments[3],
195
_0x79ce58 = !(arguments.length > 4 && void 0 !== arguments[4]) || arguments[4],
196
_0x23848b = arguments.length > 5 && void 0 !== arguments[5] && arguments[5];
197
if (_0xa482e6 && 'addEventListener' in _0xa482e6 && !_0x1e2c68.empty(_0x474854) && _0x1e2c68.function(_0xc30d6e)) {
198
let _0x4a2da0 = _0x474854.split(' '),
199
_0x40de8d = _0x23848b;
200
_0x168698 && (_0x40de8d = {
201
'passive': _0x79ce58,
202
'capture': _0x23848b
203
}), _0x4a2da0.forEach(function(_0x487d3c) {
204
_0x57056f && _0x57056f.eventListeners && _0x3f468e && _0x57056f.eventListeners.push({
205
'element': _0xa482e6,
206
'type': _0x487d3c,
207
'callback': _0xc30d6e,
208
'options': _0x40de8d
209
}), _0xa482e6[_0x3f468e ? 'addEventListener' : 'removeEventListener'](_0x487d3c, _0xc30d6e);
210
});
211
}
212
}
213
214
function _0x1093f4(_0x4d8d94) {
215
let _0x17edbf = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : '',
216
_0x2c1832 = arguments.length > 2 ? arguments[2] : undefined,
217
_0x4adcdf = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3],
218
_0x2f85bc = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
219
_0x1ef215.call(this, _0x4d8d94, _0x17edbf, _0x2c1832, true, _0x4adcdf, _0x2f85bc);
220
}
221
222
function _0x20109b(_0x550b1a) {
223
let _0x17edbf = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : '',
224
_0x2c1832 = arguments.length > 2 ? arguments[2] : undefined,
225
_0x5e10a2 = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3],
226
_0x5c9512 = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
227
_0x1ef215.call(this, _0x550b1a, _0x17edbf, _0x2c1832, false, _0x5e10a2, _0x5c9512);
228
}
229
230
function _0x455c85(_0x4e4b15) {
231
let _0x17edbf = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : '',
232
_0x2c1832 = arguments.length > 2 ? arguments[2] : void 0,
233
_0x2b8c91 = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3],
234
_0x23e991 = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
235
236
_0x1ef215.call(this, _0x4e4b15, _0x17edbf, function _0x5127f4() {
237
_0x20109b(_0x4e4b15, _0x17edbf, _0x5127f4, _0x2b8c91, _0x23e991);
238
let _0x1fe440 = arguments.length,
239
_0x1d3219 = new Array(_0x1fe440);
240
for (let _0x54457c = 0; _0x54457c < _0x1fe440; _0x54457c++) _0x1d3219[_0x54457c] = arguments[_0x54457c];
241
_0x2c1832.apply(this, _0x1d3219);
242
}, true, _0x2b8c91, _0x23e991);
243
}
244
245
function _0xbae705(_0x975ccc) {
246
let _0x17edbf = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : '',
247
_0x2c1832 = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
248
_0x57297b = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
249
if (_0x1e2c68.element(_0x975ccc) && !_0x1e2c68.empty(_0x17edbf)) {
250
let _0x4f631e = new CustomEvent(_0x17edbf, {
251
'bubbles': _0x2c1832,
252
'detail': Object.assign({}, _0x57297b, {
253
'emulator': this
254
})
255
});
256
_0x975ccc.dispatchEvent(_0x4f631e);
257
}
258
}
259
let _0x55349e = _0x2c1832(0x9e),
260
_0x42870c = _0x2c1832.n(_0x55349e);
261
262
function _0x30f85e(_0x3ed035, _0xd96db3) {
263
return function(_0x18bbf3) {
264
if (Array.isArray(_0x18bbf3)) return _0x18bbf3;
265
}(_0x3ed035) || function(_0x2bb2ab, _0x4993ee) {
266
let _0x2c1832 = [],
267
_0x629f39 = true,
268
_0xde5653 = false,
269
_0x346a0d = undefined;
270
try {
271
for (let _0x57d79d, _0x557ef0 = _0x2bb2ab[Symbol.iterator](); !(_0x629f39 = (_0x57d79d = _0x557ef0.next()).done) && (_0x2c1832.push(_0x57d79d.value), !_0x4993ee || _0x2c1832.length !== _0x4993ee); _0x629f39 = true);
272
} catch (_0x54a546) {
273
_0xde5653 = true, _0x346a0d = _0x54a546;
274
} finally {
275
try {
276
_0x629f39 || null == _0x557ef0.return || _0x557ef0.return();
277
} finally {
278
if (_0xde5653) throw _0x346a0d;
279
}
280
}
281
return _0x2c1832;
282
}(_0x3ed035, _0xd96db3) || function() {
283
throw new TypeError('Invalid attempt to destructure non-iterable instance');
284
}();
285
}
286
287
function _0x580edd(_0x39eb34, _0x86c3db) {
288
let _0x2c1832 = _0x39eb34.length ? _0x39eb34 : [_0x39eb34];
289
Array.from(_0x2c1832).reverse().forEach(function(_0x35fc48, _0x79e6bf) {
290
let _0x1510e4 = _0x79e6bf > 0 ? _0x86c3db.cloneNode(true) : _0x86c3db,
291
_0x247f26 = _0x35fc48.parentNode,
292
_0x3a5422 = _0x35fc48.nextSibling;
293
_0x1510e4.appendChild(_0x35fc48), _0x3a5422 ? _0x247f26.insertBefore(_0x1510e4, _0x3a5422) : _0x247f26.appendChild(_0x1510e4);
294
});
295
}
296
297
function _0x154f99(_0x5e4eb3, _0x1acdad) {
298
_0x1e2c68.element(_0x5e4eb3) && !_0x1e2c68.empty(_0x1acdad) && Object.entries(_0x1acdad).filter(function(_0x37e04b) {
299
let _0x1acdad = _0x30f85e(_0x37e04b, 2)[1];
300
return !_0x1e2c68.nullOrUndefined(_0x1acdad);
301
}).forEach(function(_0x4993dd) {
302
let _0x2c1832 = _0x30f85e(_0x4993dd, 2),
303
_0x24704f = _0x2c1832[0],
304
_0x52ac21 = _0x2c1832[1];
305
return _0x5e4eb3.setAttribute(_0x24704f, _0x52ac21);
306
});
307
}
308
309
function _0x428003(_0x1397c4, _0x1ec8c9, _0x1a02af) {
310
let _0xca6ad9 = document.createElement(_0x1397c4);
311
return _0x1e2c68.object(_0x1ec8c9) && _0x154f99(_0xca6ad9, _0x1ec8c9), _0x1e2c68.string(_0x1a02af) && (_0xca6ad9.innerText = _0x1a02af), _0xca6ad9;
312
}
313
314
function _0x12a55d(_0x27d9d8) {
315
_0x1e2c68.nodeList(_0x27d9d8) || _0x1e2c68.array(_0x27d9d8) ? Array.from(_0x27d9d8).forEach(_0x12a55d) : _0x1e2c68.element(_0x27d9d8) && _0x1e2c68.element(_0x27d9d8.parentNode) && _0x27d9d8.parentNode.removeChild(_0x27d9d8);
316
}
317
318
function _0xa949a8(_0x3bc809, _0x215e7f) {
319
if (!_0x1e2c68.string(_0x3bc809) || _0x1e2c68.empty(_0x3bc809)) return {};
320
let _0x2c1832 = {},
321
_0x3ab896 = _0x215e7f;
322
return _0x3bc809.split(',').forEach(function(_0x2b6c5b) {
323
let _0x215e7f = _0x2b6c5b.trim(),
324
_0x2b2f76 = _0x215e7f.replace('.', ''),
325
_0x499377 = _0x215e7f.replace(/[[\]]/g, '').split('='),
326
_0x1db3b8 = _0x499377[0],
327
_0x520bcf = _0x499377.length > 1 ? _0x499377[1].replace(/["']/g, '') : '';
328
switch (_0x215e7f.charAt(0)) {
329
case '.':
330
_0x1e2c68.object(_0x3ab896) && _0x1e2c68.string(_0x3ab896.class) && (_0x3ab896.class += ' ' .concat(_0x2b2f76)), _0x2c1832.class = _0x2b2f76;
331
break;
332
case '#':
333
_0x2c1832.id = _0x215e7f.replace('#', '');
334
break;
335
case '[':
336
_0x2c1832[_0x1db3b8] = _0x520bcf;
337
}
338
}), _0x2c1832;
339
}
340
341
function _0x132da7(_0x275729, _0x511d6f) {
342
if (_0x1e2c68.element(_0x275729)) {
343
let _0x2c1832 = _0x511d6f;
344
_0x1e2c68.boolean(_0x2c1832) || (_0x2c1832 = !_0x275729.hidden), _0x2c1832 ? _0x275729.setAttribute('hidden', '') : _0x275729.removeAttribute('hidden');
345
}
346
}
347
348
function _0x3a8e2f(_0x2bf197, _0x46e2bb, _0x3b6b0b) {
349
if (_0x1e2c68.nodeList(_0x2bf197)) return Array.from(_0x2bf197).map(function(_0x543362) {
350
return _0x3a8e2f(_0x543362, _0x46e2bb, _0x3b6b0b);
351
});
352
if (_0x1e2c68.element(_0x2bf197)) {
353
let _0x34f25e = 'toggle';
354
return void 0 !== _0x3b6b0b && (_0x34f25e = _0x3b6b0b ? 'add' : 'remove'), _0x2bf197.classList[_0x34f25e](_0x46e2bb), _0x2bf197.classList.contains(_0x46e2bb);
355
}
356
return false;
357
}
358
359
function _0x350d73(_0x273517, _0x36ffc8) {
360
return _0x1e2c68.element(_0x273517) && _0x273517.classList.contains(_0x36ffc8);
361
}
362
363
function _0x13f491(_0x11bf98, _0x674fa2) {
364
let _0x2c1832 = {
365
'Element': Element
366
};
367
return (_0x2c1832.matches || _0x2c1832.webkitMatchesSelector || _0x2c1832.mozMatchesSelector || _0x2c1832.msMatchesSelector || function() {
368
return Array.from(document.querySelectorAll(_0x674fa2)).includes(this);
369
}).call(_0x11bf98, _0x674fa2);
370
}
371
372
function _0x23ffa1(_0x16eec8) {
373
return this.elements.container.querySelectorAll(_0x16eec8);
374
}
375
376
function _0x530042(_0xbc0da2) {
377
return this.elements.container.querySelector(_0xbc0da2);
378
}
379
380
function _0x5e0c7d() {
381
let _0xa88a13 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null,
382
_0x17edbf = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
383
if (_0x1e2c68.element(_0xa88a13)) {
384
let _0x2c1832 = _0x23ffa1.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]'),
385
_0x1c6631 = _0x2c1832[0],
386
_0x52c9df = _0x2c1832[_0x2c1832.length - 1];
387
_0x1ef215.call(this, this.elements.container, 'keydown', function(_0x1bba02) {
388
if ('Tab' === _0x1bba02.key && 0x9 === _0x1bba02.keyCode) {
389
let _0x17edbf = document.activeElement;
390
_0x17edbf !== _0x52c9df || _0x1bba02.shiftKey ? _0x17edbf === _0x1c6631 && _0x1bba02.shiftKey && (_0x52c9df.focus(), _0x1bba02.preventDefault()) : (_0x1c6631.focus(), _0x1bba02.preventDefault());
391
}
392
}, _0x17edbf, false);
393
}
394
}
395
396
function _0x31cc23() {
397
let _0xa88a13 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null,
398
_0x17edbf = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
399
_0x1e2c68.element(_0xa88a13) && (_0xa88a13.focus(), _0x17edbf && _0x3a8e2f(_0xa88a13, this.config.classNames.tabFocus));
400
}
401
402
function getClass(_0x589e98) {
403
return _0x48e5ff.a.bind(_0x42870c.a)(_0x589e98);
404
}
405
let _0x32d193, _0x5f365a, _0x820caf, _0x5a2767 = (_0x32d193 = document.createElement('span'), _0x5f365a = {
406
'WebkitTransition': 'webkitTransitionEnd',
407
'MozTransition': 'transitionend',
408
'OTransition': 'oTransitionEnd otransitionend',
409
'transition': 'transitionend'
410
}, _0x820caf = Object.keys(_0x5f365a).find(function(_0x5bdb45) {
411
return void 0 !== _0x32d193.style[_0x5bdb45];
412
}), !!_0x1e2c68.string(_0x820caf) && _0x5f365a[_0x820caf]);
413
414
function _0x2b30e0(_0x1fb76b) {
415
setTimeout(function() {
416
try {
417
_0x132da7(_0x1fb76b, true), _0x1fb76b.offsetHeight, _0x132da7(_0x1fb76b, false);
418
} catch (_0x517747) {}
419
}, 0);
420
}
421
let _0x296fa9, _0x59aa33 = {
422
'isEdge': 'Netscape' === navigator.appName && navigator.appVersion.indexOf('Edge') > -1,
423
'isIE': !!document.documentMode,
424
'isWebkit': 'WebkitAppearance' in document.documentElement.style && !/Edge/ .test(navigator.userAgent),
425
'isIPhone': /(iPhone|iPod)/gi .test(navigator.platform),
426
'isIos': (/(iPad|iPhone|iPod)/gi .test(navigator.userAgent) || (/Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints && navigator.maxTouchPoints > 1)),
427
'info': function() {
428
let _0xa88a13 = /(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d\.apre]+)/ .exec(navigator.userAgent);
429
return {
430
'name': _0xa88a13[1].toLowerCase(),
431
'version': _0xa88a13[2]
432
};
433
}
434
},
435
_0x2d904a = {
436
'rangeInput': (_0x296fa9 = document.createElement('input'), _0x296fa9.type = 'range', 'range' === _0x296fa9.type),
437
'touch': 'ontouchstart' in document.documentElement,
438
'transitions': false !== _0x5a2767,
439
'reducedMotion': 'matchMedia' in window && window.matchMedia('(prefers-reduced-motion)').matches,
440
'webgl': function() {
441
let _0xa88a13 = {
442
'DETECTED': false
443
};
444
if (!_0xa88a13.DETECTED) {
445
let _0x17edbf = document.createElement('canvas');
446
if (_0x17edbf && _0x17edbf.getContext)
447
for (let _0x2c1832 = ['webgl2', 'experimental-webgl2', 'webgl', 'experimental-webgl'], _0x44cd27 = 0, _0x12b7b8 = _0x2c1832.length; _0x44cd27 < _0x12b7b8; ++_0x44cd27) {
448
let _0x11cb40 = _0x2c1832[_0x44cd27],
449
_0x26b3b2 = _0x17edbf.getContext(_0x11cb40);
450
if (_0x26b3b2) {
451
_0xa88a13.WEBGL_CONTEXT = _0x11cb40, _0xa88a13.WEBGL_VERSION = _0x26b3b2.getParameter(_0x26b3b2.VERSION), _0xa88a13.WEBGL_VENDOR = _0x26b3b2.getParameter(_0x26b3b2.VENDOR), _0xa88a13.WEBGL_SL_VERSION = _0x26b3b2.getParameter(_0x26b3b2.SHADING_LANGUAGE_VERSION), _0xa88a13.MAX_TEXTURE_SIZE = _0x26b3b2.getParameter(_0x26b3b2.MAX_TEXTURE_SIZE);
452
let _0x40c8fc = _0x26b3b2.getExtension('WEBGL_debug_renderer_info');
453
_0x40c8fc && (_0xa88a13.WEBGL_VENDOR = _0x26b3b2.getParameter(_0x40c8fc.UNMASKED_VENDOR_WEBGL), _0xa88a13.WEBGL_RENDERER = _0x26b3b2.getParameter(_0x40c8fc.UNMASKED_RENDERER_WEBGL)), _0xa88a13.DETECTED = true;
454
break;
455
}
456
}
457
}
458
return _0xa88a13;
459
}(),
460
'wasm': 'undefined' != typeof WebAssembly && _0x1e2c68.object(WebAssembly),
461
'audioContext': 'undefined' != typeof AudioContext
462
};
463
464
function _0x55cbbe(_0x43ca9d, _0x1fbf80, _0x332d13) {
465
return _0x1fbf80 in _0x43ca9d ? Object.defineProperty(_0x43ca9d, _0x1fbf80, {
466
'value': _0x332d13,
467
'enumerable': true,
468
'configurable': true,
469
'writable': true
470
}) : _0x43ca9d[_0x1fbf80] = _0x332d13, _0x43ca9d;
471
}
472
473
function _0x344e81(_0xa095b0, _0x3d8795) {
474
return _0x3d8795.split('.').reduce(function(_0x1a1fcd, _0x5112cd) {
475
return _0x1a1fcd && _0x1a1fcd[_0x5112cd];
476
}, _0xa095b0);
477
}
478
479
function _0x5dc0c0() {
480
let _0xa88a13 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
481
_0x2c1832 = new Array(_0x17edbf > 1 ? _0x17edbf - 1 : 0);
482
for (let _0x17edbf = arguments.length, _0x189546 = 1; _0x189546 < _0x17edbf; _0x189546++) _0x2c1832[_0x189546 - 1] = arguments[_0x189546];
483
if (!_0x2c1832.length) return _0xa88a13;
484
let _0x279e54 = _0x2c1832.shift();
485
return _0x1e2c68.object(_0x279e54) ? (Object.keys(_0x279e54).forEach(function(_0x53b45a) {
486
_0x1e2c68.object(_0x279e54[_0x53b45a]) ? (Object.keys(_0xa88a13).includes(_0x53b45a) || Object.assign(_0xa88a13, _0x55cbbe({}, _0x53b45a, {})), _0x5dc0c0(_0xa88a13[_0x53b45a], _0x279e54[_0x53b45a])) : Object.assign(_0xa88a13, _0x55cbbe({}, _0x53b45a, _0x279e54[_0x53b45a]));
487
}), _0x5dc0c0.apply(undefined, [_0xa88a13].concat(_0x2c1832))) : _0xa88a13;
488
}
489
490
function _0x1a0e98() {
491
let _0xa88a13 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '',
492
_0x17edbf = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : '',
493
_0x2c1832 = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : '';
494
return _0xa88a13.replace(new RegExp(_0x17edbf.toString().replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\x5c$1'), 'g'), _0x2c1832.toString());
495
}
496
497
function _0x9fdcea() {
498
let _0xa88a13 = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '').toString();
499
return (_0xa88a13 = function() {
500
let _0xa88a13 = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '').toString();
501
return _0xa88a13 = _0x1a0e98(_0xa88a13, '-', ' '), _0xa88a13 = _0x1a0e98(_0xa88a13, '_', ' '), _0x1a0e98(_0xa88a13 = function() {
502
return (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '').toString().replace(/\w\S*/g, function(_0x5b5cba) {
503
return _0x5b5cba.charAt(0).toUpperCase() + _0x5b5cba.substr(1).toLowerCase();
504
});
505
}(_0xa88a13), ' ', '');
506
}(_0xa88a13)).charAt(0).toLowerCase() + _0xa88a13.slice(1);
507
}
508
509
function _0x419e30(_0x3614ce, _0x5196ee) {
510
return function(_0x38f65b) {
511
if (Array.isArray(_0x38f65b)) return _0x38f65b;
512
}(_0x3614ce) || function(_0x20a132, _0x481bd0) {
513
let _0x2c1832 = [],
514
_0x930e75 = true,
515
_0x40863e = false,
516
_0xf7a5cf = undefined;
517
try {
518
for (let _0x9d4c5a, _0x2f59ed = _0x20a132[Symbol.iterator](); !(_0x930e75 = (_0x9d4c5a = _0x2f59ed.next()).done) && (_0x2c1832.push(_0x9d4c5a.value), !_0x481bd0 || _0x2c1832.length !== _0x481bd0); _0x930e75 = true);
519
} catch (_0x383181) {
520
_0x40863e = true, _0xf7a5cf = _0x383181;
521
} finally {
522
try {
523
_0x930e75 || null == _0x2f59ed.return || _0x2f59ed.return();
524
} finally {
525
if (_0x40863e) throw _0xf7a5cf;
526
}
527
}
528
return _0x2c1832;
529
}(_0x3614ce, _0x5196ee) || function() {
530
throw new TypeError('Invalid attempt to destructure non-iterable instance');
531
}();
532
}
533
let _0xb9b2ff = {
534
'get': function() {
535
let _0xa88a13 = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '',
536
_0x17edbf = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
537
if (_0x1e2c68.empty(_0xa88a13) || _0x1e2c68.empty(_0x17edbf)) return '';
538
let _0x2c1832 = _0x344e81(_0x17edbf.i18n, _0xa88a13);
539
if (_0x1e2c68.empty(_0x2c1832)) return '';
540
let _0x54bf45 = {
541
'{seektime}': _0x17edbf.seekTime,
542
'{title}': _0x17edbf.title
543
};
544
return Object.entries(_0x54bf45).forEach(function(_0x34ee43) {
545
let _0x17edbf = _0x419e30(_0x34ee43, 2),
546
_0x473ebb = _0x17edbf[0],
547
_0x56ec0 = _0x17edbf[1];
548
_0x2c1832 = _0x1a0e98(_0x2c1832, _0x473ebb, _0x56ec0);
549
}), _0x2c1832;
550
}
551
};
552
553
function _0x4c97b0(_0xb3d5fd, _0x2cda5d) {
554
for (let _0x2c1832 = 0; _0x2c1832 < _0x2cda5d.length; _0x2c1832++) {
555
let _0x3f3944 = _0x2cda5d[_0x2c1832];
556
_0x3f3944.enumerable = _0x3f3944.enumerable || false, _0x3f3944.configurable = true, 'value' in _0x3f3944 && (_0x3f3944.writable = true), Object.defineProperty(_0xb3d5fd, _0x3f3944.key, _0x3f3944);
557
}
558
}
559
let _0x2f61ba = function() {
560
function _0x566dbe(_0x3a7165, _0x3d2e3a) {
561
! function(_0x48c5c0, _0x2b027d) {
562
if (!(_0x48c5c0 instanceof _0x2b027d)) throw new TypeError('Cannot call a class as a function');
563
}(this, _0x566dbe), this.enabled = true, this.key = _0x3d2e3a;
564
}
565
let _0x17edbf, _0x2c1832, _0x4496fc;
566
return _0x17edbf = _0x566dbe, _0x4496fc = [{
567
'key': 'supported',
568
'get': function() {
569
try {
570
return 'localStorage' in window && (window.localStorage.getItem('___test') || window.localStorage.setItem('___test', '___test'), true);
571
} catch (_0x42cafd) {
572
return false;
573
}
574
}
575
}], (_0x2c1832 = [{
576
'key': 'get',
577
'value': function(_0x4ed865) {
578
if (!_0x566dbe.supported || !this.enabled) return null;
579
let _0x2c1832 = window.localStorage.getItem(this.key);
580
if (_0x1e2c68.empty(_0x2c1832)) return null;
581
let _0x57ebf7 = JSON.parse(_0x2c1832);
582
return _0x1e2c68.string(_0x4ed865) && _0x4ed865.length ? _0x57ebf7[_0x4ed865] : _0x57ebf7;
583
}
584
}, {
585
'key': 'set',
586
'value': function(_0x443e7a) {
587
if (_0x566dbe.supported && this.enabled && _0x1e2c68.object(_0x443e7a)) {
588
let _0x2c1832 = this.get();
589
_0x1e2c68.empty(_0x2c1832) && (_0x2c1832 = {}), _0x5dc0c0(_0x2c1832, _0x443e7a), window.localStorage.setItem(this.key, JSON.stringify(_0x2c1832));
590
}
591
}
592
}]) && _0x4c97b0(_0x17edbf.prototype, _0x2c1832), _0x4496fc && _0x4c97b0(_0x17edbf, _0x4496fc), _0x566dbe;
593
}();
594
let _0x13fb79,
595
_0x4ad1c6 = _0x2c1832(6),
596
_0x4704b1 = _0x2c1832(159),
597
_0x3a58c8 = _0x2c1832.n(_0x4704b1),
598
shaders = {
599
"2xScaleHQ.glslp": "shaders = 1\n\nshader0 = \"2xScaleHQ.glsl\"\nfilter_linear0 = false\nscale_type_0 = source\n",
600
"4xScaleHQ.glslp": "shaders = 1\n\nshader0 = \"4xScaleHQ.glsl\"\nfilter_linear0 = false\nscale_type_0 = source\n",
601
"crt-easymode.glslp": "shaders = 1\n\nshader0 = crt-easymode.glsl\nfilter_linear0 = false\nscale_type_0 = source\n",
602
"crt-aperture.glslp": "shaders = 1\n\nshader0 = crt-aperture.glsl\nfilter_linear0 = false\n",
603
"crt-geom.glslp": "shaders = 1\n\nshader0 = crt-geom.glsl\nfilter_linear0 = false\nscale_type_0 = source\n",
604
"crt-mattias.glslp": "\nshaders = 1\nshader0 = crt-mattias.glsl\nfilter_linear0 = false\n",
605
"2xScaleHQ.glsl": "/*\n2xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - [email protected]\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;\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",
606
"4xScaleHQ.glsl": "/*\n4xGLSLHqFilter shader\n\nCopyright (C) 2005 guest(r) - [email protected]\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<ko1) w1*=ko3/ko1;\nfloat w2 = k1; if(ko4<ko2) w2*=ko4/ko2;\nfloat w3 = k2; if(ko1<ko3) w3*=ko1/ko3;\nfloat w4 = k1; if(ko2<ko4) w4*=ko2/ko4;\n\nc=(w1*o1+w2*o2+w3*o3+w4*o4+0.001*c)/(w1+w2+w3+w4+0.001);\nw1 = k*dot(abs(i1-c)+abs(i3-c),dt)/(0.125*dot(i1+i3,dt)+lum_add);\nw2 = k*dot(abs(i2-c)+abs(i4-c),dt)/(0.125*dot(i2+i4,dt)+lum_add);\nw3 = k*dot(abs(s1-c)+abs(s3-c),dt)/(0.125*dot(s1+s3,dt)+lum_add);\nw4 = k*dot(abs(s2-c)+abs(s4-c),dt)/(0.125*dot(s2+s4,dt)+lum_add);\n\nw1 = clamp(w1+mx,min_w,max_w); \nw2 = clamp(w2+mx,min_w,max_w);\nw3 = clamp(w3+mx,min_w,max_w); \nw4 = clamp(w4+mx,min_w,max_w);\n\nFragColor = vec4((w1*(i1+i3)+w2*(i2+i4)+w3*(s1+s3)+w4*(s2+s4)+c)/(2.0*(w1+w2+w3+w4)+1.0), 1.0);\n} \n#endif\n",
607
"crt-easymode.glsl": "#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 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",
608
"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",
609
"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",
610
"crt-mattias.glsl": "\n#pragma parameter CURVATURE \"Curvature\" 0.5 0.0 1.0 0.05\n#pragma parameter SCANSPEED \"Scanline Crawl Speed\" 1.0 0.0 10.0 0.5\n#if defined(VERTEX)\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\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{\n gl_Position = MVPMatrix * VertexCoord;\n TEX0.xy = TexCoord.xy;\n}\n\n#elif defined(FRAGMENT)\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\n#if __VERSION__ >= 130\n#define COMPAT_VARYING in\n#define COMPAT_TEXTURE texture\nout COMPAT_PRECISION vec4 FragColor;\n#else\n#define COMPAT_VARYING varying\n#define FragColor gl_FragColor\n#define COMPAT_TEXTURE texture2D\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;\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\n#ifdef PARAMETER_UNIFORM\nuniform COMPAT_PRECISION float CURVATURE, SCANSPEED;\n#else\n#define CURVATURE 0.5\n#define SCANSPEED 1.0\n#endif\n\n#define iChannel0 Texture\n#define iTime (float(FrameCount) / 60.0)\n#define iResolution OutputSize.xy\n#define fragCoord gl_FragCoord.xy\n\nvec3 sample_( sampler2D tex, vec2 tc )\n{\n vec3 s = pow(COMPAT_TEXTURE(tex,tc).rgb, vec3(2.2));\n return s;\n}\n\nvec3 blur(sampler2D tex, vec2 tc, float offs)\n{\n vec4 xoffs = offs * vec4(-2.0, -1.0, 1.0, 2.0) / (iResolution.x * TextureSize.x / InputSize.x);\n vec4 yoffs = offs * vec4(-2.0, -1.0, 1.0, 2.0) / (iResolution.y * TextureSize.y / InputSize.y);\n tc = tc * InputSize / TextureSize;\n \n vec3 color = vec3(0.0, 0.0, 0.0);\n color += sample_(tex,tc + vec2(xoffs.x, yoffs.x)) * 0.00366;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.x)) * 0.01465;\n color += sample_(tex,tc + vec2( 0.0, yoffs.x)) * 0.02564;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.x)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.x)) * 0.00366;\n \n color += sample_(tex,tc + vec2(xoffs.x, yoffs.y)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.y)) * 0.05861;\n color += sample_(tex,tc + vec2( 0.0, yoffs.y)) * 0.09524;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.y)) * 0.05861;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.y)) * 0.01465;\n \n color += sample_(tex,tc + vec2(xoffs.x, 0.0)) * 0.02564;\n color += sample_(tex,tc + vec2(xoffs.y, 0.0)) * 0.09524;\n color += sample_(tex,tc + vec2( 0.0, 0.0)) * 0.15018;\n color += sample_(tex,tc + vec2(xoffs.z, 0.0)) * 0.09524;\n color += sample_(tex,tc + vec2(xoffs.w, 0.0)) * 0.02564;\n \n color += sample_(tex,tc + vec2(xoffs.x, yoffs.z)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.z)) * 0.05861;\n color += sample_(tex,tc + vec2( 0.0, yoffs.z)) * 0.09524;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.z)) * 0.05861;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.z)) * 0.01465;\n \n color += sample_(tex,tc + vec2(xoffs.x, yoffs.w)) * 0.00366;\n color += sample_(tex,tc + vec2(xoffs.y, yoffs.w)) * 0.01465;\n color += sample_(tex,tc + vec2( 0.0, yoffs.w)) * 0.02564;\n color += sample_(tex,tc + vec2(xoffs.z, yoffs.w)) * 0.01465;\n color += sample_(tex,tc + vec2(xoffs.w, yoffs.w)) * 0.00366;\n\n return color;\n}\n\nfloat rand(vec2 co)\n{\n float a = 12.9898;\n float b = 78.233;\n float c = 43758.5453;\n float dt= dot(co.xy ,vec2(a,b));\n float sn= mod(dt,3.14);\n return fract(sin(sn) * c);\n}\n\nvec2 curve(vec2 uv)\n{\n uv = (uv - 0.5) * 2.0;\n uv *= 1.1;\t\n uv.x *= 1.0 + pow((abs(uv.y) / 5.0), 2.0);\n uv.y *= 1.0 + pow((abs(uv.x) / 4.0), 2.0);\n uv = (uv / 2.0) + 0.5;\n uv = uv *0.92 + 0.04;\n return uv;\n}\n\nvoid main()\n{\n vec2 q = (vTexCoord.xy * TextureSize.xy / InputSize.xy);//fragCoord.xy / iResolution.xy;\n vec2 uv = q;\n uv = mix( uv, curve( uv ), CURVATURE ) * InputSize.xy / TextureSize.xy;\n vec3 col;\n float x = sin(0.1*iTime+uv.y*21.0)*sin(0.23*iTime+uv.y*29.0)*sin(0.3+0.11*iTime+uv.y*31.0)*0.0017;\n float o =2.0*mod(fragCoord.y,2.0)/iResolution.x;\n x+=o;\n uv = uv * TextureSize / InputSize;\n col.r = 1.0*blur(iChannel0,vec2(uv.x+0.0009,uv.y+0.0009),1.2).x+0.005;\n col.g = 1.0*blur(iChannel0,vec2(uv.x+0.000,uv.y-0.0015),1.2).y+0.005;\n col.b = 1.0*blur(iChannel0,vec2(uv.x-0.0015,uv.y+0.000),1.2).z+0.005;\n col.r += 0.2*blur(iChannel0,vec2(uv.x+0.0009,uv.y+0.0009),2.25).x-0.005;\n col.g += 0.2*blur(iChannel0,vec2(uv.x+0.000,uv.y-0.0015),1.75).y-0.005;\n col.b += 0.2*blur(iChannel0,vec2(uv.x-0.0015,uv.y+0.000),1.25).z-0.005;\n float ghs = 0.05;\n col.r += ghs*(1.0-0.299)*blur(iChannel0,0.75*vec2(0.01, -0.027)+vec2(uv.x+0.001,uv.y+0.001),7.0).x;\n col.g += ghs*(1.0-0.587)*blur(iChannel0,0.75*vec2(-0.022, -0.02)+vec2(uv.x+0.000,uv.y-0.002),5.0).y;\n col.b += ghs*(1.0-0.114)*blur(iChannel0,0.75*vec2(-0.02, -0.0)+vec2(uv.x-0.002,uv.y+0.000),3.0).z;\n \n \n\n col = clamp(col*0.4+0.6*col*col*1.0,0.0,1.0);\n float vig = (0.0 + 1.0*16.0*uv.x*uv.y*(1.0-uv.x)*(1.0-uv.y));\n vig = pow(vig,0.3);\n col *= vec3(vig);\n\n col *= vec3(0.95,1.05,0.95);\n col = mix( col, col * col, 0.3) * 3.8;\n\n float scans = clamp( 0.35+0.15*sin(3.5*(iTime * SCANSPEED)+uv.y*iResolution.y*1.5), 0.0, 1.0);\n \n float s = pow(scans,0.9);\n col = col*vec3( s) ;\n\n col *= 1.0+0.0015*sin(300.0*iTime);\n \n col*=1.0-0.15*vec3(clamp((mod(fragCoord.x+o, 2.0)-1.0)*2.0,0.0,1.0));\n col *= vec3( 1.0 ) - 0.25*vec3( rand( uv+0.0001*iTime), rand( uv+0.0001*iTime + 0.3 ), rand( uv+0.0001*iTime+ 0.5 ) );\n col = pow(col, vec3(0.45));\n\n if (uv.x < 0.0 || uv.x > 1.0)\n col *= 0.0;\n if (uv.y < 0.0 || uv.y > 1.0)\n col *= 0.0;\n \n\n float comp = smoothstep( 0.1, 0.9, sin(iTime) );\n\n FragColor = vec4(col,1.0);\n} \n#endif\n"
611
},
612
IDBStore = _0x2c1832(0x39),
613
_0x550f17 = _0x2c1832(0xb),
614
_0x5ab74d = {
615
'addStyleHook': function() {
616
_0x3a8e2f(this.elements.container, this.config.selectors.container.replace('.', ''), true), _0x3a8e2f(this.elements.container, this.config.classNames.uiSupported, true), _0x3a8e2f(this.elements.container, this.config.classNames.hideControls, true);
617
},
618
'build': function() {
619
this.listeners.media(), _0x1e2c68.element(this.elements.controls) || (_0x2593da.inject.call(this), this.listeners.controls()), this.volume = null, this.muted = null, _0x2593da.updateVolume.call(this), _0x3a8e2f(this.elements.container, this.config.classNames.isTouch, this.touch), this.ready = true;
620
},
621
'toggleControls': function(_0x4dbb7a) {
622
let _0x17edbf = this.elements.controls;
623
if (_0x17edbf) {
624
let _0x2c1832 = 0,
625
_0x4b4cd5 = _0x23ffa1.call(this, '.' .concat(getClass({
626
'ejs__dialogs': true
627
}), ' > .').concat(getClass({
628
'ejs__dialog': true
629
})));
630
Array.from(_0x4b4cd5).forEach(function(_0x208a40, _0xd7fcf0) {
631
true !== _0x208a40.hidden && (_0x2c1832 += 1);
632
}), _0x2c1832 > 0 ? this.toggleControls(false) : this.toggleControls(Boolean(_0x4dbb7a || this.paused || _0x17edbf.pressed || _0x17edbf.hover));
633
}
634
}
635
};
636
637
function _0x5272a8(_0x4d422a) {
638
return (_0x5272a8 = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function(_0x241239) {
639
return typeof _0x241239;
640
} : function(_0x39f252) {
641
return _0x39f252 && 'function' == typeof Symbol && _0x39f252.constructor === Symbol && _0x39f252 !== Symbol.prototype ? 'symbol' : typeof _0x39f252;
642
})(_0x4d422a);
643
}
644
645
function _0x3189ba(_0x4380c5, _0x3c0d58) {
646
if ('object' === _0x5272a8(_0x4380c5) && _0x4380c5.files && (_0x4380c5 = _0x4380c5.files[0]), this.littleEndian = false, this.offset = 0, this._lastRead = null, 'object' === _0x5272a8(_0x4380c5) && _0x4380c5.name && _0x4380c5.size) {
647
if ('function' != typeof window.FileReader) throw new Error('Incompatible Browser');
648
this.fileName = _0x4380c5.name, this.fileType = _0x4380c5.type, this.fileSize = _0x4380c5.size, this._fileReader = new FileReader(), this._fileReader.marcFile = this, this._fileReader.addEventListener('load', function() {
649
this.marcFile._u8array = new Uint8Array(this.result), this.marcFile._dataView = new DataView(this.result), _0x3c0d58 && _0x3c0d58.call();
650
}, false), this._fileReader.readAsArrayBuffer(_0x4380c5);
651
} else if ('object' === _0x5272a8(_0x4380c5) && 'string' == typeof _0x4380c5.fileName && 'boolean' == typeof _0x4380c5.littleEndian) {
652
this.fileName = _0x4380c5.fileName, this.fileType = _0x4380c5.fileType, this.fileSize = _0x4380c5.fileSize;
653
let _0x2c1832 = new ArrayBuffer(_0x4380c5);
654
this._u8array = new Uint8Array(this.fileType), this._dataView = new DataView(this.fileType), _0x4380c5.copyToFile(this, 0), _0x3c0d58 && _0x3c0d58.call();
655
} else if ('object' === _0x5272a8(_0x4380c5) && 'number' == typeof _0x4380c5.byteLength) this.fileName = 'file.bin', this.fileType = 'application/octet-stream', this.fileSize = _0x4380c5.byteLength, void 0 !== _0x4380c5.buffer && (_0x4380c5 = _0x4380c5.buffer), this._u8array = new Uint8Array(_0x4380c5), this._dataView = new DataView(_0x4380c5), _0x3c0d58 && _0x3c0d58.call();
656
else {
657
if ('number' != typeof _0x4380c5) throw new Error('Invalid source');
658
this.fileName = 'file.bin', this.fileType = 'application/octet-stream', this.fileSize = _0x4380c5;
659
_0x2c1832 = new ArrayBuffer(_0x4380c5);
660
this._u8array = new Uint8Array(_0x2c1832), this._dataView = new DataView(_0x2c1832), _0x3c0d58 && _0x3c0d58.call();
661
}
662
}
663
_0x3189ba.IS_MACHINE_LITTLE_ENDIAN = (_0x13fb79 = new ArrayBuffer(2), new DataView(_0x13fb79).setInt16(0, 0x100, true), 0x100 === new Int16Array(_0x13fb79)[0]), _0x3189ba.prototype.seek = function(_0x13e235) {
664
this.offset = _0x13e235;
665
}, _0x3189ba.prototype.skip = function(_0xfa033c) {
666
this.offset += _0xfa033c;
667
}, _0x3189ba.prototype.isEOF = function() {
668
return !(this.offset < this.fileSize);
669
}, _0x3189ba.prototype.slice = function(_0x2bfcbb, _0x8026e) {
670
let _0x2c1832;
671
return _0x8026e = _0x8026e || this.fileSize - _0x2bfcbb, void 0 !== this._u8array.buffer.slice ? ((_0x2c1832 = new _0x3189ba(0)).fileSize = _0x8026e, _0x2c1832._u8array = new Uint8Array(this._u8array.buffer.slice(_0x2bfcbb, _0x2bfcbb + _0x8026e))) : (_0x2c1832 = new _0x3189ba(_0x8026e), this.copyToFile(_0x2c1832, _0x2bfcbb, _0x8026e, 0)), _0x2c1832.fileName = this.fileName, _0x2c1832.fileType = this.fileType, _0x2c1832.littleEndian = this.littleEndian, _0x2c1832;
672
}, _0x3189ba.prototype.copyToFile = function(_0x51f9b5, _0x1ada3e, _0x3997cd, _0x38ae1a) {
673
void 0 === _0x38ae1a && (_0x38ae1a = _0x1ada3e), _0x3997cd = _0x3997cd || this.fileSize - _0x1ada3e;
674
for (let _0x3bc3d8 = 0; _0x3bc3d8 < _0x3997cd; _0x3bc3d8++) _0x51f9b5._u8array[_0x38ae1a + _0x3bc3d8] = this._u8array[_0x1ada3e + _0x3bc3d8];
675
}, _0x3189ba.prototype.save = function() {
676
let _0xa88a13;
677
try {
678
_0xa88a13 = new Blob([this._u8array], {
679
'type': this.fileType
680
});
681
} catch (_0x1dfb06) {
682
if (window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, 'InvalidStateError' !== _0x1dfb06.name || !window.BlobBuilder) throw new Error('Incompatible Browser');
683
let _0x17edbf = new BlobBuilder();
684
_0x17edbf.append(this._u8array.buffer), _0xa88a13 = _0x17edbf.getBlob(this.fileType);
685
}
686
saveAs(_0xa88a13, this.fileName);
687
}, _0x3189ba.prototype.readU8 = function() {
688
return this._lastRead = this._u8array[this.offset], this.offset++, this._lastRead;
689
}, _0x3189ba.prototype.readU16 = function() {
690
return this.littleEndian ? this._lastRead = this._u8array[this.offset] + (this._u8array[this.offset + 1] << 0x8) : this._lastRead = (this._u8array[this.offset] << 0x8) + this._u8array[this.offset + 1], this.offset += 2, this._lastRead >>> 0;
691
}, _0x3189ba.prototype.readU24 = function() {
692
return this.littleEndian ? this._lastRead = this._u8array[this.offset] + (this._u8array[this.offset + 1] << 0x8) + (this._u8array[this.offset + 2] << 0x10) : this._lastRead = (this._u8array[this.offset] << 0x10) + (this._u8array[this.offset + 1] << 0x8) + this._u8array[this.offset + 2], this.offset += 3, this._lastRead >>> 0;
693
}, _0x3189ba.prototype.readU32 = function() {
694
return this.littleEndian ? this._lastRead = this._u8array[this.offset] + (this._u8array[this.offset + 1] << 0x8) + (this._u8array[this.offset + 2] << 0x10) + (this._u8array[this.offset + 3] << 0x18) : this._lastRead = (this._u8array[this.offset] << 0x18) + (this._u8array[this.offset + 1] << 0x10) + (this._u8array[this.offset + 2] << 0x8) + this._u8array[this.offset + 3], this.offset += 4, this._lastRead >>> 0;
695
}, _0x3189ba.prototype.readBytes = function(_0x455cfd) {
696
this._lastRead = new Array(_0x455cfd);
697
for (let _0x17edbf = 0; _0x17edbf < _0x455cfd; _0x17edbf++) this._lastRead[_0x17edbf] = this._u8array[this.offset + _0x17edbf];
698
return this.offset += _0x455cfd, this._lastRead;
699
}, _0x3189ba.prototype.readString = function(_0x4fe914) {
700
this._lastRead = '';
701
for (let _0x17edbf = 0; _0x17edbf < _0x4fe914 && this.offset + _0x17edbf < this.fileSize && this._u8array[this.offset + _0x17edbf] > 0; _0x17edbf++) this._lastRead = this._lastRead + String.fromCharCode(this._u8array[this.offset + _0x17edbf]);
702
return this.offset += _0x4fe914, this._lastRead;
703
}, _0x3189ba.prototype.writeU8 = function(_0x276206) {
704
this._u8array[this.offset] = _0x276206, this.offset++;
705
}, _0x3189ba.prototype.writeU16 = function(_0x1bfd8f) {
706
this.littleEndian ? (this._u8array[this.offset] = 0xff & _0x1bfd8f, this._u8array[this.offset + 1] = _0x1bfd8f >> 0x8) : (this._u8array[this.offset] = _0x1bfd8f >> 0x8, this._u8array[this.offset + 1] = 0xff & _0x1bfd8f), this.offset += 2;
707
}, _0x3189ba.prototype.writeU24 = function(_0x3d6067) {
708
this.littleEndian ? (this._u8array[this.offset] = 0xff & _0x3d6067, this._u8array[this.offset + 1] = (0xff00 & _0x3d6067) >> 0x8, this._u8array[this.offset + 2] = (0xff0000 & _0x3d6067) >> 0x10) : (this._u8array[this.offset] = (0xff0000 & _0x3d6067) >> 0x10, this._u8array[this.offset + 1] = (0xff00 & _0x3d6067) >> 0x8, this._u8array[this.offset + 2] = 0xff & _0x3d6067), this.offset += 3;
709
}, _0x3189ba.prototype.writeU32 = function(_0xa4dd26) {
710
this.littleEndian ? (this._u8array[this.offset] = 0xff & _0xa4dd26, this._u8array[this.offset + 1] = (0xff00 & _0xa4dd26) >> 0x8, this._u8array[this.offset + 2] = (0xff0000 & _0xa4dd26) >> 0x10, this._u8array[this.offset + 3] = (0xff000000 & _0xa4dd26) >> 0x18) : (this._u8array[this.offset] = (0xff000000 & _0xa4dd26) >> 0x18, this._u8array[this.offset + 1] = (0xff0000 & _0xa4dd26) >> 0x10, this._u8array[this.offset + 2] = (0xff00 & _0xa4dd26) >> 0x8, this._u8array[this.offset + 3] = 0xff & _0xa4dd26), this.offset += 0x4;
711
}, _0x3189ba.prototype.writeBytes = function(_0x5ad6b9) {
712
for (let _0x17edbf = 0; _0x17edbf < _0x5ad6b9.length; _0x17edbf++) this._u8array[this.offset + _0x17edbf] = _0x5ad6b9[_0x17edbf];
713
this.offset += _0x5ad6b9.length;
714
}, _0x3189ba.prototype.writeString = function(_0x58c146, _0x23e582) {
715
_0x23e582 = _0x23e582 || _0x58c146.length;
716
for (let _0x2c1832 = 0; _0x2c1832 < _0x58c146.length && _0x2c1832 < _0x23e582; _0x2c1832++) this._u8array[this.offset + _0x2c1832] = _0x58c146.charCodeAt(_0x2c1832);
717
for (; _0x2c1832 < _0x23e582; _0x2c1832++) this._u8array[this.offset + _0x2c1832] = 0;
718
this.offset += _0x23e582;
719
};
720
let _0x863031 = _0x3189ba,
721
_0x34e7cf = 0;
722
723
function _0x454881() {
724
this.records = [], this.truncate = false;
725
}
726
727
function _0x288092(_0x1ab789) {
728
let _0x17edbf = new _0x454881();
729
_0x1ab789.seek(0x5);
730
for (let _0x2c1832 = 0, _0x195f00 = 0; !_0x1ab789.isEOF();) {
731
if (0x454f46 === (_0x2c1832 = _0x1ab789.readU24())) {
732
if (_0x1ab789.isEOF()) break;
733
if (_0x1ab789.offset + 3 === _0x1ab789.fileSize) {
734
_0x17edbf.truncate = _0x1ab789.readU24();
735
break;
736
}
737
}(_0x195f00 = _0x1ab789.readU16()) === _0x34e7cf ? _0x17edbf.addRLERecord(_0x2c1832, _0x1ab789.readU16(), _0x1ab789.readU8()) : _0x17edbf.addSimpleRecord(_0x2c1832, _0x1ab789.readBytes(_0x195f00));
738
}
739
return _0x17edbf;
740
}
741
_0x454881.prototype.addSimpleRecord = function(_0x37166f, _0x2e61e0) {
742
this.records.push({
743
'offset': _0x37166f,
744
'type': 1,
745
'length': _0x2e61e0.length,
746
'data': _0x2e61e0
747
});
748
}, _0x454881.prototype.addRLERecord = function(_0x4ae2fb, _0x507845, _0x92bb02) {
749
this.records.push({
750
'offset': _0x4ae2fb,
751
'type': _0x34e7cf,
752
'length': _0x507845,
753
'byte': _0x92bb02
754
});
755
}, _0x454881.prototype.toString = function() {
756
nSimpleRecords = 0, nRLERecords = 0;
757
for (let _0xa88a13 = 0; _0xa88a13 < this.records.length; _0xa88a13++) this.records[_0xa88a13].type === _0x34e7cf ? nRLERecords++ : nSimpleRecords++;
758
let _0x17edbf = 'Simple records: ' + nSimpleRecords;
759
return _0x17edbf += '\nRLE records: ' + nRLERecords, _0x17edbf += '\nTotal records: ' + this.records.length, this.truncate && (_0x17edbf += '\nTruncate at: 0x' + this.truncate.toString(0x10)), _0x17edbf;
760
}, _0x454881.prototype.export = function(_0x4d18dc) {
761
for (let _0x17edbf = 5, _0x2c1832 = 0; _0x2c1832 < this.records.length; _0x2c1832++) this.records[_0x2c1832].type === _0x34e7cf ? _0x17edbf += 0x8 : _0x17edbf += 5 + this.records[_0x2c1832].data.length;
762
_0x17edbf += 3, this.truncate && (_0x17edbf += 3), tempFile = new _0x863031(_0x17edbf), tempFile.fileName = _0x4d18dc + '.ips', tempFile.writeString('PATCH');
763
for (_0x2c1832 = 0; _0x2c1832 < this.records.length; _0x2c1832++) {
764
let _0x512785 = this.records[_0x2c1832];
765
tempFile.writeU24(_0x512785.offset), _0x512785.type === _0x34e7cf ? (tempFile.writeU16(0), tempFile.writeU16(_0x512785.length), tempFile.writeU8(_0x512785.byte)) : (tempFile.writeU16(_0x512785.data.length), tempFile.writeBytes(_0x512785.data));
766
}
767
return tempFile.writeString('EOF'), _0x512785.truncate && tempFile.writeU24(_0x512785.truncate), tempFile;
768
}, _0x454881.prototype.apply = function(_0xefa71d) {
769
let _0x17edbf;
770
if (this.truncate) _0x17edbf = _0xefa71d.slice(0, this.truncate);
771
else {
772
for (let _0x2c1832 = _0xefa71d.fileSize, _0x5a0a71 = 0; _0x5a0a71 < this.records.length; _0x5a0a71++) {
773
let _0x105576 = this.records[_0x5a0a71];
774
_0x105576.type === _0x34e7cf ? _0x105576.offset + _0x105576.length > _0x2c1832 && (_0x2c1832 = _0x105576.offset + _0x105576.length) : _0x105576.offset + _0x105576.data.length > _0x2c1832 && (_0x2c1832 = _0x105576.offset + _0x105576.data.length);
775
}
776
_0x2c1832 === _0xefa71d.fileSize ? _0x17edbf = _0xefa71d.slice(0, _0xefa71d.fileSize) : (_0x17edbf = new _0x863031(_0x2c1832), _0xefa71d.copyToFile(_0x17edbf, 0));
777
}
778
_0xefa71d.seek(0);
779
for (_0x5a0a71 = 0; _0x5a0a71 < this.records.length; _0x5a0a71++)
780
if (_0x17edbf.seek(this.records[_0x5a0a71].offset), this.records[_0x5a0a71].type === _0x34e7cf)
781
for (let _0x729105 = 0; _0x729105 < this.records[_0x5a0a71].length; _0x729105++) _0x17edbf.writeU8(this.records[_0x5a0a71].byte);
782
else _0x17edbf.writeBytes(this.records[_0x5a0a71].data);
783
return _0x17edbf;
784
};
785
'0123456789abcdef' .split('');
786
let _0x1aa7ba = function() {
787
for (let _0xa88a13, _0x17edbf = [], _0x2c1832 = 0; _0x2c1832 < 0x100; _0x2c1832++) {
788
_0xa88a13 = _0x2c1832;
789
for (let _0x32bcf1 = 0; _0x32bcf1 < 0x8; _0x32bcf1++) _0xa88a13 = 1 & _0xa88a13 ? 0xedb88320 ^ _0xa88a13 >>> 1 : _0xa88a13 >>> 1;
790
_0x17edbf[_0x2c1832] = _0xa88a13;
791
}
792
return _0x17edbf;
793
}();
794
795
function _0x2d78e9(_0x509ecf, _0x4219e1, _0xd66d2b) {
796
for (let _0x185f93 = _0x4219e1 ? new Uint8Array(_0x509ecf._u8array.buffer, _0x4219e1) : _0x509ecf._u8array, _0x20e2c1 = -1, _0x3d100a = _0xd66d2b ? _0x185f93.length - 4 : _0x185f93.length, _0x56a6e6 = 0; _0x56a6e6 < _0x3d100a; _0x56a6e6++) _0x20e2c1 = _0x20e2c1 >>> 0x8 ^ _0x1aa7ba[0xff & (_0x20e2c1 ^ _0x185f93[_0x56a6e6])];
797
return (-0x1 ^ _0x20e2c1) >>> 0;
798
}
799
let _0x37eff4 = 0,
800
_0x34d681 = 1,
801
_0x4c50e7 = 2,
802
_0xf9eeea = 3;
803
804
function _0x5b02d3() {
805
this.sourceSize = 0, this.targetSize = 0, this.metaData = '', this.actions = [], this.sourceChecksum = 0, this.targetChecksum = 0, this.patchChecksum = 0;
806
}
807
808
function _0x356089(_0x1bf770) {
809
_0x1bf770.readVLV = _0x45da2c, _0x1bf770.littleEndian = true;
810
let _0x17edbf = new _0x5b02d3();
811
_0x1bf770.seek(0x4), _0x17edbf.sourceSize = _0x1bf770.readVLV(), _0x17edbf.targetSize = _0x1bf770.readVLV();
812
let _0x2c1832 = _0x1bf770.readVLV();
813
_0x2c1832 && (_0x17edbf.metaData = _0x1bf770.readString(_0x2c1832));
814
for (let _0x157bba = _0x1bf770.fileSize - 0xc; _0x1bf770.offset < _0x157bba;) {
815
let _0x31dcc2 = _0x1bf770.readVLV(),
816
_0x21bafe = {
817
'type': 3 & _0x31dcc2,
818
'length': 1 + (_0x31dcc2 >> 2)
819
};
820
if (_0x21bafe.type === _0x34d681) _0x21bafe.bytes = _0x1bf770.readBytes(_0x21bafe.length);
821
else if (_0x21bafe.type === _0x4c50e7 || _0x21bafe.type === _0xf9eeea) {
822
let _0x4c6327 = _0x1bf770.readVLV();
823
_0x21bafe.relativeOffset = (0x1 & _0x4c6327 ? -0x1 : 1) * (_0x4c6327 >> 1);
824
}
825
_0x17edbf.actions.push(_0x21bafe);
826
}
827
if (_0x17edbf.sourceChecksum = _0x1bf770.readU32(), _0x17edbf.targetChecksum = _0x1bf770.readU32(), _0x17edbf.patchChecksum = _0x1bf770.readU32(), _0x17edbf.patchChecksum !== _0x2d78e9(_0x1bf770, 0, true)) throw new Error('error_crc_patch');
828
return _0x17edbf;
829
}
830
831
function _0x45da2c() {
832
for (let _0xa88a13 = 0, _0x17edbf = 1;;) {
833
let _0x2c1832 = this.readU8();
834
if (_0xa88a13 += (0x7f & _0x2c1832) * _0x17edbf, 0x80 & _0x2c1832) break;
835
_0xa88a13 += _0x17edbf <<= 0x7;
836
}
837
return this._lastRead = _0xa88a13, _0xa88a13;
838
}
839
840
function _0x152a53(_0x33f58d) {
841
for (;;) {
842
let _0x17edbf = 0x7f & _0x33f58d;
843
if (0x0 === (_0x33f58d >>= 0x7)) {
844
this.writeU8(0x80 | _0x17edbf);
845
break;
846
}
847
this.writeU8(_0x17edbf), _0x33f58d--;
848
}
849
}
850
851
function _0x5a4975(_0x221175) {
852
for (let _0x17edbf = 0;;) {
853
if (0x0 === (_0x221175 >>= 0x7)) {
854
_0x17edbf++;
855
break;
856
}
857
_0x17edbf++, _0x221175--;
858
}
859
return _0x17edbf;
860
}
861
862
function _0x562e68() {
863
this.offset = 0, this.next = null;
864
}
865
_0x5b02d3.prototype.toString = function() {
866
let _0xa88a13 = 'Source size: ' + this.sourceSize;
867
return _0xa88a13 += '\nTarget size: ' + this.targetSize, _0xa88a13 += '\nMetadata: ' + this.metaData, _0xa88a13 += '\n#Actions: ' + this.actions.length;
868
}, _0x5b02d3.prototype.validateSource = function(_0x48d2df, _0x3c15dd) {
869
return this.sourceChecksum === _0x2d78e9(_0x48d2df, _0x3c15dd);
870
}, _0x5b02d3.prototype.apply = function(_0x393f39, _0x76e509) {
871
if (_0x76e509 && !this.validateSource(_0x393f39)) throw new Error('error_crc_input');
872
for (let _0x2c1832 = new _0x863031(this.targetSize), _0x4df6ae = 0, _0xad0fa9 = 0, _0x38240a = 0; _0x38240a < this.actions.length; _0x38240a++) {
873
let _0x4b1026 = this.actions[_0x38240a];
874
if (_0x4b1026.type === _0x37eff4) _0x393f39.copyToFile(_0x2c1832, _0x2c1832.offset, _0x4b1026.length), _0x2c1832.skip(_0x4b1026.length);
875
else if (_0x4b1026.type === _0x34d681) _0x2c1832.writeBytes(_0x4b1026.bytes);
876
else if (_0x4b1026.type === _0x4c50e7) {
877
_0x4df6ae += _0x4b1026.relativeOffset;
878
for (let _0x5c2263 = _0x4b1026.length; _0x5c2263--;) _0x2c1832.writeU8(_0x393f39._u8array[_0x4df6ae]), _0x4df6ae++;
879
} else if (_0x4b1026.type === _0xf9eeea) {
880
_0xad0fa9 += _0x4b1026.relativeOffset;
881
for (_0x5c2263 = _0x4b1026.length; _0x5c2263--;) _0x2c1832.writeU8(_0x2c1832._u8array[_0xad0fa9]), _0xad0fa9++;
882
}
883
}
884
if (_0x76e509 && this.targetChecksum !== _0x2d78e9(_0x2c1832)) throw new Error('error_crc_output');
885
return _0x2c1832;
886
}, _0x5b02d3.prototype.export = function(_0x3e1e58) {
887
let _0x17edbf = 'BPS1' .length;
888
_0x17edbf += _0x5a4975(this.sourceSize), _0x17edbf += _0x5a4975(this.targetSize), _0x17edbf += _0x5a4975(this.metaData.length), _0x17edbf += this.metaData.length;
889
for (let _0x2c1832 = 0; _0x2c1832 < this.actions.length; _0x2c1832++) {
890
_0x17edbf += _0x5a4975(((_0x38dad6 = this.actions[_0x2c1832]).length - 1 << 2) + _0x38dad6.type), _0x38dad6.type === _0x34d681 ? _0x17edbf += _0x38dad6.length : _0x38dad6.type !== _0x4c50e7 && _0x38dad6.type !== _0xf9eeea || (_0x17edbf += _0x5a4975((Math.abs(_0x38dad6.relativeOffset) << 1) + (_0x38dad6.relativeOffset < 0 ? 1 : 0)));
891
}
892
let _0x2d1555 = new _0x863031(_0x17edbf += 0xc);
893
_0x2d1555.fileName = _0x3e1e58 + '.bps', _0x2d1555.littleEndian = true, _0x2d1555.writeVLV = _0x152a53, _0x2d1555.writeString('BPS1'), _0x2d1555.writeVLV(this.sourceSize), _0x2d1555.writeVLV(this.targetSize), _0x2d1555.writeVLV(this.metaData.length), _0x2d1555.writeString(this.metaData, this.metaData.length);
894
for (_0x2c1832 = 0; _0x2c1832 < this.actions.length; _0x2c1832++) {
895
let _0x38dad6 = this.actions[_0x2c1832];
896
_0x2d1555.writeVLV((_0x38dad6.length - 1 << 2) + _0x38dad6.type), _0x38dad6.type === _0x34d681 ? _0x2d1555.writeBytes(_0x38dad6.bytes) : _0x38dad6.type !== _0x4c50e7 && _0x38dad6.type !== _0xf9eeea || _0x2d1555.writeVLV((Math.abs(_0x38dad6.relativeOffset) << 1) + (_0x38dad6.relativeOffset < 0 ? 1 : 0));
897
}
898
return _0x2d1555.writeU32(this.sourceChecksum), _0x2d1555.writeU32(this.targetChecksum), _0x2d1555.writeU32(this.patchChecksum), _0x2d1555;
899
}, _0x562e68.prototype.delete = function() {
900
this.next && delete this.next;
901
};
902
let _0x7a6485 = 'UPS1';
903
904
function _0x42cd9e() {
905
this.records = [], this.sizeInput = 0, this.sizeOutput = 0, this.checksumInput = 0, this.checksumOutput = 0;
906
}
907
908
function _0x10dc1d(_0x5d0c48) {
909
for (;;) {
910
let _0x17edbf = 0x7f & _0x5d0c48;
911
if (0x0 === (_0x5d0c48 >>= 0x7)) {
912
this.writeU8(0x80 | _0x17edbf);
913
break;
914
}
915
this.writeU8(_0x17edbf), _0x5d0c48 -= 1;
916
}
917
}
918
919
function _0x454043() {
920
for (let _0xa88a13 = 0, _0x17edbf = 1;;) {
921
let _0x2c1832 = this.readU8();
922
if (-0x1 == _0x2c1832) throw new Error('Can\'t read UPS VLV at 0x' + (this.offset - 1).toString(0x10));
923
if (_0xa88a13 += (0x7f & _0x2c1832) * _0x17edbf, 0 != (0x80 & _0x2c1832)) break;
924
_0xa88a13 += _0x17edbf <<= 0x7;
925
}
926
return _0xa88a13;
927
}
928
929
function _0xca245c(_0x459173) {
930
for (let _0x17edbf = 0;;) {
931
if (_0x17edbf++, 0 === (_0x459173 >>= 0x7)) break;
932
_0x459173 -= 1;
933
}
934
return _0x17edbf;
935
}
936
937
function _0xd2202f(_0x5abb5e) {
938
let _0x17edbf = new _0x42cd9e();
939
_0x5abb5e.readVLV = _0x454043, _0x5abb5e.seek(_0x7a6485.length), _0x17edbf.sizeInput = _0x5abb5e.readVLV(), _0x17edbf.sizeOutput = _0x5abb5e.readVLV();
940
for (; _0x5abb5e.offset < _0x5abb5e.fileSize - 0xc;) {
941
for (let _0x2c1832 = _0x5abb5e.readVLV(), _0x3bca86 = []; _0x5abb5e.readU8();) _0x3bca86.push(_0x5abb5e._lastRead);
942
_0x17edbf.addRecord(_0x2c1832, _0x3bca86);
943
}
944
return _0x5abb5e.littleEndian = true, _0x17edbf.checksumInput = _0x5abb5e.readU32(), _0x17edbf.checksumOutput = _0x5abb5e.readU32(), _0x5abb5e.littleEndian = false, _0x17edbf;
945
}
946
_0x42cd9e.prototype.addRecord = function(_0x162ca5, _0x39594d) {
947
this.records.push({
948
'offset': _0x162ca5,
949
'XORdata': _0x39594d
950
});
951
}, _0x42cd9e.prototype.toString = function() {
952
let _0xa88a13 = 'Records: ' + (undefined).records.length;
953
return _0xa88a13 += '\nInput file size: ' + (undefined).sizeInput, _0xa88a13 += '\nOutput file size: ' + (undefined).sizeOutput, _0xa88a13 += '\nInput file checksum: ' + padZeroes((undefined).checksumInput, 4), _0xa88a13 += '\nOutput file checksum: ' + padZeroes((undefined).checksumOutput, 4);
954
}, _0x42cd9e.prototype.export = function(_0x1a3e8b) {
955
let _0x17edbf = _0x7a6485.length;
956
_0x17edbf += _0xca245c(this.sizeInput), _0x17edbf += _0xca245c(this.sizeOutput);
957
for (let _0x2c1832 = 0; _0x2c1832 < this.records.length; _0x2c1832++) _0x17edbf += _0xca245c(this.records[_0x2c1832].offset), _0x17edbf += this.records[_0x2c1832].XORdata.length + 1;
958
_0x17edbf += 0xc, tempFile = new _0x863031(_0x17edbf), tempFile.writeVLV = _0x10dc1d, tempFile.fileName = _0x1a3e8b + '.ups', tempFile.writeString(_0x7a6485), tempFile.writeVLV(this.sizeInput), tempFile.writeVLV(this.sizeOutput);
959
for (_0x2c1832 = 0; _0x2c1832 < this.records.length; _0x2c1832++) tempFile.writeVLV(this.records[_0x2c1832].offset), tempFile.writeBytes(this.records[_0x2c1832].XORdata), tempFile.writeU8(0);
960
return tempFile.littleEndian = true, tempFile.writeU32(this.checksumInput), tempFile.writeU32(this.checksumOutput), tempFile.writeU32(_0x2d78e9(tempFile, 0, true)), tempFile;
961
}, _0x42cd9e.prototype.validateSource = function(_0x25cb26, _0xd0163c) {
962
return _0x2d78e9(_0x25cb26, _0xd0163c) === this.checksumInput;
963
}, _0x42cd9e.prototype.apply = function(_0x21d682, _0x41bbac) {
964
_0x41bbac && this.validateSource(_0x21d682), tempFile = new _0x863031(this.sizeOutput), _0x21d682.copyToFile(tempFile, 0, this.sizeInput), _0x21d682.seek(0);
965
for (let _0x2c1832 = 0; _0x2c1832 < this.records.length; _0x2c1832++) {
966
let _0x5ed6c9 = this.records[_0x2c1832];
967
tempFile.skip(_0x5ed6c9.offset), _0x21d682.skip(_0x5ed6c9.offset);
968
for (let _0x3faf05 = 0; _0x3faf05 < _0x5ed6c9.XORdata.length; _0x3faf05++) tempFile.writeU8((_0x21d682.isEOF() ? 0 : _0x21d682.readU8()) ^ _0x5ed6c9.XORdata[_0x3faf05]);
969
tempFile.skip(1), _0x21d682.skip(1);
970
}
971
return _0x41bbac && (_0x2d78e9(tempFile), this.checksumOutput), tempFile;
972
};
973
var _0x4d7024 = {
974
'_FS': {
975
'createFolder': function(parent, name, canRead, canWrite) {
976
if (! _0x4d7024.FS) return;
977
if (typeof _0x4d7024.FS.mkdir == 'function' && window.PATH) {
978
let path = PATH.join2(typeof parent === 'string' ? parent : _0x4d7024.FS.getPath(parent), name);
979
let mode = _0x4d7024.FS.getMode(canRead, canWrite);
980
_0x4d7024.FS.mkdir(path, mode);
981
} else {
982
_0x4d7024.FS.createFolder(parent, name, canRead, canWrite);
983
}
984
}
985
},
986
'romdb': null,
987
'supportBatterySave': false,
988
'hash': '2b35cacf70ae',
989
'hash2': 'f5cbb3f38c0bb20e4',
990
'hash3': '88cc8ad0c350400499a0',
991
'loading': null,
992
'gamePatch': null,
993
'saveFilenames': [],
994
'FS': null,
995
'Module': null,
996
'aspectRatio': 4 / 3,
997
'memData': null,
998
'wasmData': null,
999
'coreFileData': {},
1000
'coreFileName': '',
1001
'coreFileVersion': '',
1002
'isMobileDevice': !!/Android|webOS|iPhone|iPad|iPod|BB10|BlackBerry|IEMobile|Opera Mini|Mobile|mobile/i .test(navigator.userAgent || ''),
1003
'create': function() {
1004
let _this = this;
1005
window.URL = window.URL || window.webkitURL;
1006
let _0x17edbf,
1007
_0x2c1832,
1008
_0x4ce206,
1009
_0x528f2b = false,
1010
_0x547484 = false,
1011
_0x5e24fa = false,
1012
_0x468801 = 0,
1013
_0x31a5b3 = false,
1014
_0x1e0766 = {
1015
oldCores: {
1016
'psx': ['bin', 'iso', 'cue', 'img', 'mdf', 'pbp', 'toc', 'cbn', 'm3u'],
1017
'nds': ['nds', 'bin'],
1018
'nes': ['fds', 'nes', 'unif', 'unf'],
1019
'snes': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'],
1020
'snes2002': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'],
1021
'snes2005': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'],
1022
'snes2010': ['smc', 'fig', 'sfc', 'gd3', 'gd7', 'dx2', 'bsx', 'swc'],
1023
'gb': ['gb', 'gbc', 'dmg'],
1024
'gba': ['gb', 'gbc', 'gba'],
1025
'vbanext': ['gba'],
1026
'vb': ['vb', 'vboy', 'bin'],
1027
'3do': ['iso', 'bin', 'cue'],
1028
'lynx': ['lnx'],
1029
'jaguar': ['j64', 'jag', 'rom', 'abs', 'cof', 'bin', 'prg'],
1030
'a7800': ['a78', 'bin'],
1031
'a2600': ['a26', 'bin'],
1032
'ngp': ['ngp', 'ngc'],
1033
'n64': ['n64', 'v64', 'z64', 'bin', 'u1', 'ndd'],
1034
'pce': ['pce', 'bin', 'iso', 'cue', 'ccd', 'img', 'chd'],
1035
'sega': ['mdx', 'md', 'smd', 'gen', 'bin', 'iso', 'cue', 'sms', 'gg', 'sg', '68k', 'chd'],
1036
'segacd': ['mdx', 'md', 'smd', 'gen', 'bin', 'iso', 'cue', 'sms', 'gg', 'sg', '68k', 'chd'],
1037
'32x': ['32x', 'bin', 'gen', 'smd', 'md', 'cue', 'iso', 'sms'],
1038
'saturn': ['bin', 'cue', 'iso'],
1039
'msx': ['rom', 'mx1', 'mx2', 'dsk', 'cas'],
1040
'bluemsx': ['rom', 'ri', 'mx1', 'mx2', 'col', 'dsk', 'cas', 'sg', 'sc', 'm3u'],
1041
'ws': ['ws', 'wsc'],
1042
'arcade': ['zip'],
1043
'fba0.2.97.29': ['zip'],
1044
'mame2003': ['zip'],
1045
'mame': ['zip']
1046
},
1047
newCores: {
1048
'fceumm': ['fds', 'nes', 'unif', 'unf'],
1049
'snes9x': ['smc', 'sfc', 'swc', 'fig', 'bs', 'st'],
1050
'a5200': ['a52', 'bin'],
1051
'gambatte': ['gb', 'gbc', 'dmg'],
1052
'mgba': ['gb', 'gbc', 'gba'],
1053
'beetle_vb': ['vb', 'vboy', 'bin'],
1054
'mupen64plus_next': ['n64', 'v64', 'z64', 'bin', 'u1', 'ndd', 'gb'],
1055
'fbalpha2012_cps1': ['zip'],
1056
'fbalpha2012_cps2': ['zip'],
1057
'mame2003': ['zip'],
1058
'desmume2015': ['nds', 'bin'],
1059
'melonds': ['nds'],
1060
'mednafen_psx': ['cue', 'toc', 'm3u', 'ccd', 'exe', 'pbp', 'chd'],
1061
'mednafen_psx_hw': ['cue', 'toc', 'm3u', 'ccd', 'exe', 'pbp', 'chd'],
1062
'nestopia': ['fds', 'nes', 'unif', 'unf'],
1063
'opera': ['iso', 'bin', 'chd', 'cue']
1064
}
1065
},
1066
_0x29078e = {
1067
oldCores: {
1068
'psx': 'psx',
1069
'nds': 'nds',
1070
'nes': 'nes',
1071
'snes': 'snes',
1072
'snes2002': 'snes2002',
1073
'snes2005': 'snes2005',
1074
'snes2010': 'snes2010',
1075
'gb': 'gb',
1076
'gbc': 'gb',
1077
'gba': 'gba',
1078
'vbanext': 'vbanext',
1079
'vb': 'vb',
1080
'n64': 'n64',
1081
'3do': '3do',
1082
'segaMS': 'sega',
1083
'segaGG': 'sega',
1084
'segaMD': 'sega',
1085
'segaCD': 'segacd',
1086
'sega32x': '32x',
1087
'segaSaturn': 'saturn',
1088
'ngp': 'ngp',
1089
'pce': 'pce',
1090
'msx': 'bluemsx',
1091
'atari2600': 'a2600',
1092
'atari7800': 'a7800',
1093
'atari5200': 'a5200',
1094
'lynx': 'lynx',
1095
'ws': 'ws',
1096
'arcade': 'arcade',
1097
'fba0.2.97.29': 'fba0.2.97.29',
1098
'jaguar': 'jaguar',
1099
'mame2003': 'mame2003'
1100
},
1101
newCores: {
1102
// The default core to use for each system
1103
'nes': 'fceumm',
1104
'snes': 'snes9x',
1105
'atari5200': 'a5200',
1106
'gb': 'gambatte',
1107
'gba': 'mgba',
1108
'vb': 'beetle_vb',
1109
'n64': 'mupen64plus_next',
1110
'nds': 'desmume2015',
1111
'mame2003': 'mame2003',
1112
'arcade': 'fbalpha2012_cps1', // I need to find a more compatible arcade core
1113
'psx': 'mednafen_psx_hw',
1114
'3do': 'opera'
1115
}
1116
},
1117
newCoreTypes = {
1118
'fceumm': 'nes',
1119
'snes9x': 'snes',
1120
'a5200': 'atari5200',
1121
'gambatte': 'gb',
1122
'mgba': 'gba',
1123
'beetle_vb': 'vb',
1124
'mupen64plus_next': 'n64',
1125
'desmume2015': 'nds',
1126
'mame2003': 'mame2003',
1127
'fbalpha2012_cps1': 'arcade',
1128
'fbalpha2012_cps2': 'arcade',
1129
'mednafen_psx': 'psx',
1130
'mednafen_psx_hw': 'psx',
1131
'melonds': 'nds',
1132
'nestopia': 'nes',
1133
'opera': '3do'
1134
},
1135
getSystem = function(core, notRetroarch) {
1136
if (notRetroarch === true) {
1137
return newCoreTypes[core] || core;
1138
} else if (notRetroarch === 1) {
1139
return _0x29078e.oldCores[core]; // For when core is set to version 1.
1140
}
1141
return _0x29078e.newCores[core] || core;
1142
},
1143
_0xc6823 = this,
1144
_0x1143c5 = _0xc6823.system;
1145
window.getSystem = getSystem;
1146
window._0x29078e = _0x29078e;
1147
window._0x1e0766 = _0x1e0766;
1148
_0x17edbf = (_0xc6823.customPaths && typeof _0xc6823.customPaths['extract7z.js'] == 'string') ? _0xc6823.customPaths['extract7z.js'] : (_0xc6823.dataPath + 'extract7z.js');
1149
_0x2c1832 = (_0xc6823.customPaths && typeof _0xc6823.customPaths['extractzip.js'] == 'string') ? _0xc6823.customPaths['extractzip.js'] : (_0xc6823.dataPath + 'extractzip.js?v=1');
1150
_0x4ce206 = (_0xc6823.customPaths && typeof _0xc6823.customPaths['libunrar.js'] == 'string') ? _0xc6823.customPaths['libunrar.js'] : (_0xc6823.dataPath + 'libunrar.js');
1151
let _0xb2be2a = _0x428003('canvas', {});
1152
this.game.appendChild(_0xb2be2a), _0x4d7024.loading = _0x428003('div', {
1153
'class': this.config.classNames.loading
1154
}), this.elements.container.appendChild(_0x4d7024.loading);
1155
let _0x4fce24 = {
1156
'loading-info': getClass({
1157
'loading-info': true
1158
}),
1159
'ad': getClass({
1160
'ad': true
1161
}),
1162
'close-ad': getClass({
1163
'close-ad': true
1164
}),
1165
'start-game': getClass({
1166
'start-game': true
1167
}),
1168
'on': getClass({
1169
'on': true
1170
}),
1171
'p1': getClass({
1172
'p1': true
1173
}),
1174
'p2': getClass({
1175
'p2': true
1176
}),
1177
'p3': getClass({
1178
'p3': true
1179
}),
1180
'p4': getClass({
1181
'p4': true
1182
})
1183
},
1184
_0x4e198f = '';
1185
if (typeof _0xc6823.adUrl === 'string') {
1186
_0x4d7024.loading.innerHTML = '\n <div>\n <div class="'+_0x4fce24.ad+'" style="display:block !important;width:300px !important">\n <div class="'+_0x4fce24['close-ad']+'" hidden><a href="#" onclick="return false"></a></div>\n <iframe scrolling="no" frameborder="no" style="width:300px !important;height:250px !important;display: block !important;" src="'+_0xc6823.adUrl+'"></iframe>\n </div>\n <div class="'+_0x4fce24['loading-info']+'" style="position: absolute;bottom: 20px;left: 50%;transform: translateX(-50%);">\n <div class="'+_0x4fce24.p1+'"></div>\n <div class="'+_0x4fce24.p2+'"></div>\n <div class="'+_0x4fce24.p3+'"></div>\n </div>\n <div style="position: absolute;bottom: 20px;left: 50%;transform: translateX(-50%);">\n <a href="#" onclick="return false" class="'+_0x4fce24['start-game']+'">'+(_0xb9b2ff.get('playNow', _0xc6823.config))+'</a>\n </div>\n </div>';
1187
let _0x2e2264 = _0x428003('iframe', {
1188
'src': _0xc6823.adUrl,
1189
'scrolling': 'no',
1190
'frameborder': 'no',
1191
'style': 'width:300px !important;height:250px !important;display: block !important;'
1192
});
1193
(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).removeChild(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad, ' iframe'))), _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).appendChild(_0x2e2264), _0x2d904a.webgl.DETECTED) || (_0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true), _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)).innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">Failed to initialize WebGL.</strong>');
1194
_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad, ' iframe')).style.setProperty('display', 'block', 'important'), _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad, ' iframe')).style.setProperty('visibility', 'visible', 'important'), _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).style.setProperty('display', 'block', 'important'), _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).style.setProperty('visibility', 'visible', 'important')
1195
} else {
1196
_0x4d7024.loading.innerHTML = '\n <div>\n <div class="'.concat(_0x4fce24['loading-info'], '" style="position: absolute;bottom: 20px;left: 50%;transform: translateX(-50%);">\n <div class="').concat(_0x4fce24.p1, '"></div>\n <div class="').concat(_0x4fce24.p2, '"></div>\n <div class="').concat(_0x4fce24.p3, '"></div>\n </div>\n <div style="position: absolute;bottom: 20px;left: 50%;transform: translateX(-50%);">\n <a href="#" onclick="return false" class="').concat(_0x4fce24['start-game'], '">').concat(_0xb9b2ff.get('playNow', _0xc6823.config), '</a>\n </div>\n </div>');
1197
if (! _0x2d904a.webgl.DETECTED) {
1198
_0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true), _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)).innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">Failed to initialize WebGL.</strong>';
1199
}
1200
}
1201
let _0x18a437 = window.URL || window.webkitURL;
1202
let isCompressed = function(data) { //https://www.garykessler.net/library/file_sigs.html
1203
if ((data[0] === 80 && data[1] === 75) && ((data[2] === 3 && data[3] === 4) || (data[2] === 5 && data[3] === 6) || (data[2] === 7 && data[3] === 8))) {
1204
return 'zip';
1205
} else if (data[0] === 55 && data[1] === 122 && data[2] === 188 && data[3] === 175 && data[4] === 39 && data[5] === 28) {
1206
return '7z';
1207
} else if ((data[0] === 82 && data[1] === 97 && data[2] === 114 && data[3] === 33 && data[4] === 26 && data[5] === 7) && ((data[6] === 0) || (data[6] === 1 && data[7] == 0))) {
1208
return 'rar';
1209
}
1210
},
1211
extractFile = async function(url) {
1212
let fileData = await (await fetch(url)).text(),
1213
_0x2c1832 = new Blob([fileData], {
1214
'type': 'application/javascript'
1215
}),
1216
_0x501a8e = window.URL.createObjectURL(_0x2c1832);
1217
return new Worker(_0x501a8e);
1218
},
1219
extractRar = async function(url) {
1220
let fileData = await (await fetch(url)).text();
1221
let _0x2c1832 = '\nlet 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 \''+url+'.mem\';\n }\n};\n'+fileData+'\nlet unrar = function(data, password) {\n let cb = function(fileName, fileSize, progress) {\n postMessage({"t":4,"current":progress,"total":fileSize, "name": fileName});\n };\n\n let rarContent = readRARContent(data.map(function(d) {\n return {\n name: d.name,\n content: new Uint8Array(d.content)\n }\n }), password, cb)\n let 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 ';
1222
let _0x22326b = new Blob([_0x2c1832], {
1223
'type': 'application/javascript'
1224
}),
1225
_0x3635b1 = window.URL.createObjectURL(_0x22326b);
1226
return new Worker(_0x3635b1);
1227
},
1228
_0x24de8d = null,
1229
_0x4e171c = null,
1230
_0xa884ea = null;
1231
try {
1232
_0x24de8d = new IDBStore({
1233
'dbVersion': 1,
1234
'storePrefix': 'ejs-',
1235
'storeName': 'system',
1236
'keyPath': null,
1237
'autoIncrement': false,
1238
'onStoreReady': function() {
1239
_0x528f2b = true;
1240
},
1241
'onError': function() {
1242
_0x528f2b = true;
1243
}
1244
});
1245
_0x4e171c = new IDBStore({
1246
'dbVersion': 1,
1247
'storePrefix': 'ejs-',
1248
'storeName': 'roms',
1249
'keyPath': null,
1250
'autoIncrement': false,
1251
'onStoreReady': function() {
1252
_0x547484 = true;
1253
},
1254
'onError': function() {
1255
_0x547484 = true;
1256
}
1257
});
1258
_0xa884ea = new IDBStore({
1259
'dbVersion': 1,
1260
'storePrefix': 'ejs-',
1261
'storeName': 'bios',
1262
'keyPath': null,
1263
'autoIncrement': false,
1264
'onStoreReady': function() {
1265
_0x5e24fa = true;
1266
},
1267
'onError': function() {
1268
_0x5e24fa = true;
1269
}
1270
});
1271
} catch (_0x4fc9b6) {
1272
_0x528f2b = true;
1273
_0x547484 = true;
1274
_0x5e24fa = true;
1275
console.log(_0x4fc9b6);
1276
}
1277
_0x1093f4.call(_0xc6823, _0xc6823.elements.container, 'start-game', function(_0x3d9f57) {
1278
_0xc6823.started = true, _0xc6823.playing = true, _0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['loading-info'])), true);
1279
if (_0xdcec2a && (_0xdcec2a.virtualGamepadContainer == 'undefined' || _0xdcec2a.virtualGamepadContainer === null)) {
1280
_0x5ab74d.toggleControls.call(_0xc6823, true);
1281
}
1282
let _0x2c1832 = getClass({
1283
'ejs__tooltip--visible': true
1284
}),
1285
_0x10efa5 = _0xc6823.elements.buttons.gamepad.querySelector('.' .concat(getClass({
1286
'ejs__tooltip': true
1287
})));
1288
_0x3a8e2f(_0x10efa5, _0x2c1832, true), setTimeout(function() {
1289
_0x3a8e2f(_0x10efa5, _0x2c1832, false);
1290
}, 0x1388)
1291
if (typeof _0xc6823.adUrl === 'string') {
1292
_0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['close-ad'])), false);
1293
if (_0xc6823.config.noAutoAdClose !== true) {
1294
setTimeout(function() {
1295
_0xc6823.started && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)) && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).parentNode.removeChild(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)));
1296
}, 0x2710)
1297
}
1298
}
1299
_0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true);
1300
let _0x30fd44 = _0x5dc0c0(_0x2593da.defaultCoreOptionsValues.call(_this), _0x2593da.storage.get('core-options') || {});
1301
'n64' === getSystem(_0xc6823.system, true) && _0x30fd44 && Object.keys(_0x30fd44).forEach(function(_0x3015d2) {
1302
'glupen64-aspect' === _0x3015d2 && '16:9' === _0x30fd44[_0x3015d2] && (_0xb2be2a.height = _0xb2be2a.width / 0x10 * 0x9, _0x4d7024.aspectRatio = 0x10 / 0x9);
1303
});
1304
'arcade' !== getSystem(_this.system, true) && 'fba0.2.97.29' !== getSystem(_this.system, true) || _0x30fd44 && Object.keys(_0x30fd44).forEach(function(_0x490c06) {
1305
'fba-aspect' === _0x490c06 && 'PAR' === _0x30fd44[_0x490c06] && (_0xb2be2a.height = _0xb2be2a.width / 0x10 * 0x9, _0x4d7024.aspectRatio = 0x10 / 0x9);
1306
});
1307
'gba' === getSystem(_0xc6823.system, true) && (_0xb2be2a.height = _0xb2be2a.width / 1.5, _0x4d7024.aspectRatio = 1.5);
1308
(function() {
1309
let _0x3d9f57 = _this;
1310
if ('undefined' != typeof RI) {
1311
document.removeEventListener('mousemove', RI.eventHandler, false), _0xb2be2a.removeEventListener('mousedown', RI.canvasEventHandler, false), _0xb2be2a.removeEventListener('mouseup', RI.canvasEventHandler, false);
1312
_0x3d9f57.elements.container.addEventListener('mousemove', function(_0x44f409) {
1313
let _0x3d9f57 = 0,
1314
_0x2c1832 = 0,
1315
_0x2cc8a1 = _0x44f409.offsetX - _0x4d7024.Module.canvas.offsetLeft,
1316
_0x5744ed = _0x44f409.offsetY - _0x4d7024.Module.canvas.offsetTop;
1317
switch (_0x44f409.type) {
1318
case 'mousemove':
1319
_0x2cc8a1 < 0 ? (_0x2cc8a1 = 0, _0x3d9f57 = -_0x4d7024.Module.canvas.offsetWidth) : _0x2cc8a1 > _0x4d7024.Module.canvas.offsetWidth ? (_0x2cc8a1 = _0x4d7024.Module.canvas.offsetWidth, _0x3d9f57 = _0x4d7024.Module.canvas.offsetWidth) : _0x3d9f57 = _0x2cc8a1 - RI.currentX, _0x5744ed < 0 ? (_0x5744ed = 0, _0x2c1832 = -_0x4d7024.Module.canvas.offsetHeight) : _0x5744ed > _0x4d7024.Module.canvas.offsetHeight ? (_0x5744ed = _0x4d7024.Module.canvas.offsetHeight, _0x2c1832 = _0x4d7024.Module.canvas.offsetHeight) : _0x2c1832 = _0x5744ed - RI.currentY, RI.currentX = _0x2cc8a1, RI.currentY = _0x5744ed;
1320
for (let _0x3e03cb = 0; _0x3e03cb < RI.contexts.length; _0x3e03cb += 1) HEAP32[RI.contexts[_0x3e03cb].state + 0x20 >> 2] = _0x3d9f57, HEAP32[RI.contexts[_0x3e03cb].state + 0x24 >> 2] = _0x2c1832;
1321
}
1322
}, false), _0x3d9f57.elements.container.addEventListener('mousedown', RI.canvasEventHandler, false), _0x3d9f57.elements.container.addEventListener('mouseup', RI.canvasEventHandler, false);
1323
let _0x2c1832 = function(_0x5d0cbb) {
1324
if (_0x5d0cbb.targetTouches[0]) {
1325
let _0x3d9f57, _0x2c1832, _0x19a4e0 = 0,
1326
_0x2b7b61 = 0,
1327
_0x1e0f64 = _0x5d0cbb.target.getBoundingClientRect(),
1328
_0x2c55b8 = _0x5d0cbb.targetTouches[0].clientX - _0x1e0f64.left,
1329
_0x3a7025 = _0x5d0cbb.targetTouches[0].clientY - _0x1e0f64.top;
1330
_0x2c55b8 < 0 ? (_0x2c55b8 = 0, _0x19a4e0 = -_0x4d7024.Module.canvas.offsetWidth) : _0x2c55b8 > _0x4d7024.Module.canvas.offsetWidth ? (_0x2c55b8 = _0x4d7024.Module.canvas.offsetWidth, _0x19a4e0 = _0x4d7024.Module.canvas.offsetWidth) : _0x19a4e0 = _0x2c55b8 - RI.currentX, _0x3a7025 < 0 ? (_0x3a7025 = 0, _0x2b7b61 = -_0x4d7024.Module.canvas.offsetHeight) : _0x3a7025 > _0x4d7024.Module.canvas.offsetHeight ? (_0x3a7025 = _0x4d7024.Module.canvas.offsetHeight, _0x2b7b61 = _0x4d7024.Module.canvas.offsetHeight) : _0x2b7b61 = _0x3a7025 - RI.currentY, RI.currentX = _0x2c55b8, RI.currentY = _0x3a7025;
1331
for (let _0x43b670 = 0; _0x43b670 < RI.contexts.length; _0x43b670 += 1) HEAP32[RI.contexts[_0x43b670].state + 0x20 >> 2] = _0x19a4e0, HEAP32[RI.contexts[_0x43b670].state + 0x24 >> 2] = _0x2b7b61;
1332
switch (_0x5d0cbb.type) {
1333
case 'touchend':
1334
case 'touchstart':
1335
if (0x0 === _0x5d0cbb.button) _0x2c1832 = 0x28;
1336
else {
1337
if (0x2 !== _0x5d0cbb.button) break;
1338
_0x2c1832 = 0x29;
1339
}
1340
_0x3d9f57 = 'touchend' === _0x5d0cbb.type ? 0 : 1;
1341
for (let _0x443e8b = 0; _0x443e8b < RI.contexts.length; _0x443e8b += 1) HEAP8[RI.contexts[_0x443e8b].state + _0x2c1832 >> 0x0] = _0x3d9f57;
1342
}
1343
}
1344
};
1345
_0x3d9f57.elements.container.addEventListener('touchstart', _0x2c1832, false), _0x3d9f57.elements.container.addEventListener('touchend', _0x2c1832, false);
1346
} else {
1347
let _0x518e5a = function(_0x45d640) {
1348
let _0x3d9f57 = new MouseEvent(_0x45d640.type, _0x45d640);
1349
_0x4d7024.Module.canvas.dispatchEvent(_0x3d9f57);
1350
};
1351
_0x530042.call(_this, '.' .concat(getClass({
1352
'ejs__dialogs': true
1353
}))).addEventListener('mousemove', _0x518e5a, false), _0x530042.call(_this, '.' .concat(getClass({
1354
'ejs__dialogs': true
1355
}))).addEventListener('mousedown', _0x518e5a, false), _0x530042.call(_this, '.' .concat(getClass({
1356
'ejs__dialogs': true
1357
}))).addEventListener('mouseup', _0x518e5a, false);
1358
}
1359
})();
1360
'msx' === getSystem(_0xc6823.system, true) && function(_0x3c016a) {
1361
if ('undefined' != typeof RI) {
1362
document.removeEventListener('keydown', RI.eventHandler, false), document.removeEventListener('keyup', RI.eventHandler, false);
1363
let _0x3d9f57 = function(_0x97e67b) {
1364
let _0x3d9f57 = _0x97e67b.keyCode,
1365
_0x2c1832 = _0x3d9f57 >> 3,
1366
_0x3340c0 = 1 << (0x7 & _0x3d9f57);
1367
switch (_0x97e67b.type) {
1368
case 'keyup':
1369
case 'keydown':
1370
if (_0x2c1832 >= 0x20) throw 'key code error! bad code: ' + _0x3d9f57;
1371
for (let _0x126f58 = 0; _0x126f58 < RI.contexts.length; _0x126f58++) {
1372
let _0x4ca77a = HEAP8[RI.contexts[_0x126f58].state + _0x2c1832 >> 0x0];
1373
'keyup' === _0x97e67b.type ? _0x4ca77a &= ~_0x3340c0 : _0x4ca77a |= _0x3340c0, HEAP8[RI.contexts[_0x126f58].state + _0x2c1832 >> 0x0] = _0x4ca77a;
1374
}
1375
}
1376
};
1377
document.addEventListener('keydown', _0x3d9f57, false), document.addEventListener('keyup', _0x3d9f57, false);
1378
}
1379
}();
1380
setTimeout(function() {
1381
let _0xa88a13;
1382
_0xa88a13 = _0x59aa33.info(), null === _0xdcec2a.setVolume && 'undefined' != typeof RA ? (RA.queueAudio = function() {
1383
let _0x3d9f57, _0x2c1832 = _0xc6823.volume,
1384
_0x2cbc4 = RA.bufIndex;
1385
_0x3d9f57 = RA.bufIndex ? RA.buffers[RA.bufIndex - 1].endTime : RA.context.currentTime, RA.buffers[_0x2cbc4].endTime = _0x3d9f57 + RA.buffers[_0x2cbc4].duration;
1386
let _0x4e7320 = RA.context.createBufferSource();
1387
if (_0x4e7320.buffer = RA.buffers[_0x2cbc4], _0xc6823.muted && (_0x2c1832 = 0), 1 === _0x2c1832) _0x4e7320.connect(RA.context.destination);
1388
else {
1389
let _0x3da8fc = RA.context.createGain();
1390
_0x4e7320.connect(_0x3da8fc), _0x3da8fc.connect(RA.context.destination), _0x59aa33.isEdge || 'chrome' === _0xa88a13.name && parseInt(_0xa88a13.version, 0xa) <= 0x3c || 'firefox' === _0xa88a13.name && parseInt(_0xa88a13.version, 0xa) <= 0x38 || 'opera' === _0xa88a13.name && parseInt(_0xa88a13.version, 0xa) <= 0x2c ? _0x3da8fc.gain.value = _0x2c1832 : 'firefox' === _0xa88a13.name ? _0x3da8fc.gain.setValueAtTime(_0x2c1832, RA.context.currentTime) : _0x3da8fc.gain.setValueAtTime(_0x2c1832, RA.context.currentTime, 0);
1391
}
1392
_0x4e7320.start(_0x3d9f57), RA.bufIndex += 1, RA.bufOffset = 0;
1393
}, _0x59aa33.isIos && window.addEventListener('touchstart', function() {
1394
if (RA.context) {
1395
RA.context.resume();
1396
let _0xa88a13 = RA.context.createBufferSource();
1397
_0xa88a13.connect(RA.context.destination), _0xa88a13.start();
1398
}
1399
}, false)) : _0xdcec2a.setVolume();
1400
}, 0x1f4);
1401
setTimeout(function() {
1402
_0xc6823.elements.container.focus();
1403
}, 0x1e);
1404
void 0 === window.addRunDependency && (window.Module = undefined);
1405
})
1406
if (typeof _0xc6823.adUrl === 'string') {
1407
_0x1093f4.call(_0xc6823, _0x4d7024.loading.querySelector('.' .concat(_0x4fce24['close-ad'])), 'click', function(_0x96b13f) {
1408
_0x96b13f instanceof MouseEvent && _0xc6823.started && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)) && _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad)).parentNode.removeChild(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.ad))), _0xc6823.elements.container.focus();
1409
});
1410
}
1411
let _0x5f3757 = function(_0x2bd107) {
1412
if (_0x4d7024.gamePatch) {
1413
let startName = _0x4d7024.getStartName(true);
1414
let _0x17edbf = startName.split('/'),
1415
_0x2c1832 = _0x17edbf.pop().split('.').pop(),
1416
_0x11dc72 = (_0x4d7024.gamePatch.split('.').pop(), _0x4d7024.gamePatch.split('/').pop().split('.').shift()),
1417
_0x453ec0 = '' .concat(_0x17edbf.join('/'), '/').concat(_0x11dc72, '.').concat(_0x2c1832);
1418
_0x453ec0 = _0x453ec0.replace(/\#/g, '');
1419
if (_0x4d7024.gamePatch.startsWith('blob:')) {
1420
_0x453ec0 = startName;
1421
}
1422
let _0x5438db = _0x4d7024.gamePatch;
1423
_0x4d7024.FS.rename(startName, _0x453ec0);
1424
_0x2bd107.startName = _0x453ec0;
1425
startName = _0x4d7024.getStartName(true);
1426
if ('snes' === getSystem(_0x2bd107.system, true) || ['snes2002', 'snes2005', 'snes2010'].includes(getSystem(_0x2bd107.system, true))) {
1427
let _0x4758bc, _0x4b4000, _0x4aa31e, _0x2d9175 = new _0x863031(_0x4d7024.FS.readFile(startName)),
1428
_0x567355 = _0x2d78e9(_0x2d9175),
1429
_0x3d2ad0 = new _0x863031(_0x4d7024.FS.readFile(_0x5438db)),
1430
_0x4a229b = _0x3d2ad0.readString(0x6),
1431
_0x20786d = _0x2d9175._u8array.length % 0x400;
1432
_0x4a229b.startsWith('PATCH') ? (_0x4758bc = _0x288092(_0x3d2ad0), 0 === _0x20786d && 'B19ED489' === _0x567355.toString(0x10).toUpperCase() && ((_0x4b4000 = new Uint8Array(_0x2d9175._u8array.length + 0x200)).set(new Uint8Array(0x200), 0), _0x4b4000.set(_0x2d9175._u8array, 0x200), _0x2d9175 = new _0x863031(_0x4b4000))) : _0x4a229b.startsWith(_0x7a6485) ? _0x4758bc = _0xd2202f(_0x3d2ad0) : _0x4a229b.startsWith('BPS1') && (_0x4758bc = _0x356089(_0x3d2ad0), _0x20786d > 0 && 'A31BEAD4' === _0x567355.toString(0x10).toUpperCase() && (_0x4b4000 = _0x2d9175._u8array.slice ? _0x2d9175._u8array.slice(_0x20786d) : _0x2d9175._u8array.subarray(_0x20786d), _0x2d9175 = new _0x863031(_0x4b4000)));
1433
try {
1434
if (_0x4aa31e = _0x4758bc.apply(_0x2d9175, false)) {
1435
let _0x1ffde3 = _0x4aa31e._u8array.length % 0x400;
1436
_0x1ffde3 > 0 && (_0x4b4000 = _0x4aa31e._u8array.slice ? _0x4aa31e._u8array.slice(_0x1ffde3) : _0x4aa31e._u8array.subarray(_0x1ffde3), _0x4aa31e = new _0x863031(_0x4b4000)), _0x4d7024.FS.unlink(_0x5438db), _0x4d7024.FS.unlink(startName), _0x4d7024.FS.writeFile(startName, _0x4aa31e._u8array);
1437
}
1438
} catch (_0x2ef20f) {}
1439
} else {
1440
let _0x4108d8, _0x5e086b, _0x454a20 = new _0x863031(_0x4d7024.FS.readFile(startName)),
1441
_0x4991ea = new _0x863031(_0x4d7024.FS.readFile(_0x5438db)),
1442
_0x130f1f = _0x4991ea.readString(0x6);
1443
_0x130f1f.startsWith('PATCH') ? _0x4108d8 = _0x288092(_0x4991ea) : _0x130f1f.startsWith(_0x7a6485) ? _0x4108d8 = _0xd2202f(_0x4991ea) : _0x130f1f.startsWith('BPS1') && (_0x4108d8 = _0x356089(_0x4991ea));
1444
try {
1445
(_0x5e086b = _0x4108d8.apply(_0x454a20, false)) && (_0x4d7024.FS.unlink(_0x5438db), _0x4d7024.FS.unlink(startName), _0x4d7024.FS.writeFile(startName, _0x5e086b._u8array));
1446
} catch (_0x3ed519) {}
1447
}
1448
}
1449
},
1450
_0x4bd781 = function() {
1451
let key = (_this.coreVer===2)?"INITIAL_MEMORY":"TOTAL_MEMORY"
1452
const system = getSystem(_this.system, true);
1453
_0x31a5b3 ? (window.Module[key] = 0x10000000, ['jaguar'].includes(system) && (window.Module[key] = 0x10000000), ['nds', 'nes', 'snes', 'arcade', 'mame'].includes(system) && (window.Module[key] = 0), ['snes2002', 'snes2005', 'snes2010'].includes(system) && (window.Module[key] = 0), 'gba' == system && (window.Module[key] = 0), '3do' == system && (window.Module[key] = 0), 'n64' == system && (window.Module[key] = 0)) : ('nes' === system && (window.Module[key] = 0x8000000), window.Module[key] = _0x468801 + 0x4000000, ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(system) && (window.Module[key] = _0x468801 + 0x10000000, _0x4d7024.isMobileDevice && (window.Module[key] = 0x12c00000)), ['n64', 'nds', 'jaguar'].includes(system) && (window.Module[key] = _0x468801 + 0x10000000, _0x4d7024.isMobileDevice && (window.Module[key] = 0x12c00000)), 'gba' == system && (window.Module[key] = 0x10000000)), 'undefined' != typeof EJS_MEMORY && (window.Module[key] = EJS_MEMORY);
1454
},
1455
_0x3512e9 = function(_0x1bc287, _0x1844e3) {
1456
let _0x55627a = _this,
1457
_0x1cfda7 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)),
1458
_0xb0c5d8 = -1,
1459
_0x429d6b = getSystem(_0x1143c5, _this.coreVer),
1460
_0x567717 = function() {
1461
if (_0x55627a.coreVer === 2) {
1462
_0x55627a.elements.settings.panels.home.querySelector('[role="menu"]').innerHTML = "";
1463
_0x7f9f36.setNormalOptionsMenu.call(_0x55627a);
1464
_0x7f9f36.setCoreOptionsMenu.call(_0x55627a);
1465
let mainLoop = _0x4d7024.Module.cwrap('toggleMainLoop', 'null', ['number']);
1466
_0x4d7024.Module.resumeMainLoop = function() {
1467
mainLoop(1);
1468
}
1469
_0x4d7024.Module.pauseMainLoop = function() {
1470
mainLoop(0);
1471
}
1472
}
1473
1474
if (typeof _0x55627a.loadStateOnStart == 'string') {
1475
fetch(_0x55627a.loadStateOnStart).then(function(response) {
1476
response.arrayBuffer().then(function(ab) {
1477
let a = new Uint8Array(ab);
1478
EJS_loadState(a);
1479
})
1480
})
1481
}
1482
};
1483
window.EJS_terminate = function() {
1484
_0x4d7024.Module.pauseMainLoop();
1485
if (_0x55627a && _0x55627a.eventListeners) {
1486
for (let k in _0x55627a) {
1487
for (let i=0; i<_0x55627a.eventListeners.length; i++) {
1488
let a = _0x55627a.eventListeners[i];
1489
a.element.removeEventListener(a.type, a.callback, a.capture);
1490
}
1491
}
1492
}
1493
if (window.EJS_RESET_VARS) {
1494
let a = [];
1495
let b = [];
1496
for (let k in window) {
1497
a.push(k);
1498
}
1499
for (let i=0; i<a.length; i++) {
1500
if (! window.EJS_RESET_VARS.includes(a[i])) {
1501
b.push(a[i]);
1502
}
1503
}
1504
for (let i=0; i<b.length; i++) {
1505
if (window[b[i]]) {
1506
delete window[b[i]];
1507
}
1508
}
1509
}
1510
}
1511
let start = function(startName) {
1512
_0x1cfda7.innerHTML = 'Game Data ready';
1513
if (!startName) {
1514
_0x1cfda7.innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">Invalid Rom</strong>';
1515
return;
1516
}
1517
try {
1518
_0x4bd781();
1519
_0x5f3757(_0x55627a);
1520
let _0x2c1832 = [startName,
1521
[_0x4d7024.hash, _0x4d7024.hash2, _0x4d7024.hash3].join('')
1522
];
1523
'undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX && _0x2c1832.unshift('-v');
1524
_0x4d7024.Module.callMain(_0x2c1832);
1525
if (_0xc6823.coreVer === 2) {
1526
_0x4d7024.Module.resumeMainLoop();
1527
_0x4d7024.Module.setCanvasSize(800, 600);
1528
let i=0;
1529
let j = setInterval(function() { // some cores have a messed up screen size on load (for example - gba)
1530
if (i>20) clearInterval(j);
1531
i++;
1532
_0x4d7024.Module.setCanvasSize(800, 600);
1533
}, 100)
1534
}
1535
_0xbae705.call(_0x55627a, _0x55627a.elements.container, 'start-game');
1536
try{_0x567717();}catch(e){}
1537
} catch (e) {
1538
console.log(e);
1539
_0x1cfda7.innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">Failed to start game</strong>';
1540
}
1541
}
1542
let _0x567713 = '';
1543
let _0x99321 = function(_0x52e6f3) {
1544
if (_0x52e6f3.data) {
1545
if (1 === _0x52e6f3.data.t) {
1546
!_0x55627a.startName && _0x567713 && (_0x55627a.startName = _0x567713);
1547
_0x52e6f3.target.terminate();
1548
start(_0x55627a.startName);
1549
}
1550
if (2 === _0x52e6f3.data.t) {
1551
const extensions = (_0x55627a.coreVer === 2) ? _0x1e0766.newCores[_0x429d6b.toLowerCase()] : _0x1e0766.oldCores[_0x429d6b.toLowerCase()];
1552
let _0x25aae3 = _0x52e6f3.data.file.split('/'),
1553
_0x1bc287 = _0x25aae3.pop(),
1554
_0x1844e3 = _0x1bc287.split('.').pop();
1555
_0x1bc287 = _0x1bc287.replace(/\#/g, ''), _0x4d7024.FS.createPath('/', _0x25aae3.join('/'), true, true);
1556
for (let _0x36bace = extensions.length - 1; _0x36bace >= 0; _0x36bace -= 1) extensions[_0x36bace] === _0x1844e3.toLowerCase() && _0x36bace > _0xb0c5d8 && (_0xb0c5d8 = _0x36bace, _0x55627a.startName = ['', _0x25aae3.join('/'), _0x1bc287].join('/'), _0x55627a.startName = _0x55627a.startName.replace(/\/+/, '/'));
1557
_0x1bc287 && (_0x4d7024.FS.createDataFile('/' .concat(_0x25aae3.join('/')), _0x1bc287, _0x52e6f3.data.data, true, false), _0x468801 += _0x52e6f3.data.data.length), _0x567713 = '/' .concat(_0x25aae3.join('/'), '/').concat(_0x1bc287);
1558
}
1559
if (4 === _0x52e6f3.data.t && _0x52e6f3.data.total > 0) {
1560
let _0x163fc4 = Math.floor(_0x52e6f3.data.current / _0x52e6f3.data.total * 100),
1561
_0x5448a3 = _0x52e6f3.data.name || '';
1562
if (_0x163fc4 <= 100 && _0x163fc4 > 0) {
1563
_0x1cfda7.innerHTML = _this.localization('Decompress Game Data')+_0x5448a3+' '+_0x163fc4+'%';
1564
}
1565
}
1566
}
1567
},
1568
_0x1e67c4 = false;
1569
if (!['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(getSystem(_0x55627a.system, true))) {
1570
let _0x20a78c = _0x1844e3.slice ? _0x1844e3.slice(0, 10) : _0x1844e3.subarray(0, 10),
1571
_0x1761cf = isCompressed(_0x20a78c);
1572
if (_0x1761cf === "7z") {
1573
extractFile(_0x17edbf).then(function(_0xea623e) {
1574
_0xea623e.onmessage = _0x99321;
1575
_0xea623e.postMessage(_0x1844e3);
1576
})
1577
_0x1e67c4 = true;
1578
} else if (_0x1761cf === 'zip') {
1579
extractFile(_0x2c1832).then(function(_0x5a81e4) {
1580
_0x5a81e4.onmessage = _0x99321;
1581
_0x5a81e4.postMessage(_0x1844e3);
1582
})
1583
_0x1e67c4 = true;
1584
} else if (_0x1761cf === 'rar') {
1585
extractRar(_0x4ce206).then(function(_0x5f204f) {
1586
_0x5f204f.onmessage = _0x99321;
1587
_0x5f204f.postMessage(_0x1844e3);
1588
})
1589
_0x1e67c4 = true;
1590
}
1591
}
1592
if (!_0x1e67c4) {
1593
_0x55627a.startName = _0x55627a.getStartName();
1594
if (!_0x55627a.startName) {
1595
_0x55627a.startName = 'rom';
1596
}
1597
try {
1598
_0x468801 += _0x1844e3.length;
1599
_0x4d7024.FS.createDataFile('/', _0x55627a.startName, _0x1844e3, true, false);
1600
} catch (_0x210043) {
1601
console.log(_0x210043);
1602
}
1603
start(_0x55627a.startName);
1604
}
1605
},
1606
_0x5048db = function() {
1607
let _0x17edbf = _this,
1608
_0x2c1832 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)),
1609
_0x50eb85 = _this.config,
1610
_0x3cf3cf = _0x50eb85.gameUrl,
1611
_0x594488 = _0x50eb85.system;
1612
'vbanext' == _0x594488 && (_0x594488 = 'gba');
1613
let _0x154dc5 = (typeof _0x3cf3cf == 'string') ? _0x3cf3cf.split('/') : "ga.me",
1614
_0x139f1c = _0x154dc5[_0x154dc5.length - 1];
1615
_0x139f1c.indexOf('?') > -0x1 && (_0x139f1c = _0x139f1c.substr(0, _0x139f1c.indexOf('?')));
1616
_0x139f1c.split('.').pop();
1617
_0x2c1832.innerHTML = _this.localization('Download Game Data');
1618
if (['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(getSystem(_0x17edbf.system, true)) && _0x17edbf.config.gameParentUrl) {
1619
_0x2c1832.innerHTML += ' (2/2)';
1620
}
1621
if (_0x17edbf.config.gamePatchUrl) {
1622
_0x2c1832.innerHTML += ' (2/2)';
1623
}
1624
if (typeof _0x3cf3cf != 'string') {
1625
if (_0x3cf3cf.toString() === "[object Blob]") {
1626
_0x3cf3cf.arrayBuffer().then(function(data) {
1627
_0x3512e9(_0x139f1c, new Uint8Array(data));
1628
})
1629
} else if (_0x3cf3cf.toString() === "[object ArrayBuffer]") {
1630
_0x3512e9(_0x139f1c, new Uint8Array(_0x3cf3cf));
1631
} else {
1632
_0x3512e9(_0x139f1c, Uint8Array.from(_0x3cf3cf));
1633
}
1634
return;
1635
}
1636
_0x550f17.a.head(_0x3cf3cf, {}).then(function(_0x3d703e) {
1637
let _0x21b526 = _0x3d703e.headers['content-length'],
1638
_0x7e8d4c = _0x3d703e.headers['content-type'],
1639
_0x107e8a = ('' .concat(_0x594488, '-').concat(_0x139f1c)),
1640
_0x43a689 = function() {
1641
_0x550f17.a.get(_0x3cf3cf, {
1642
'onDownloadProgress': function(e) {
1643
const progress = e.total ? ' '+Math.floor(e.loaded / e.total * 100).toString()+'%' : ' '+(e.loaded/1048576).toFixed(2)+'MB';
1644
if (['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(getSystem(_0x17edbf.system, true)) && _0x17edbf.config.gameParentUrl) {
1645
_0x2c1832.innerHTML = _this.localization('Download Game Data')+' (2/2)'+progress;
1646
} else if (_0x17edbf.config.gamePatchUrl) {
1647
_0x2c1832.innerHTML = _this.localization('Download Game Data')+' (2/2)'+progress;
1648
} else {
1649
_0x2c1832.innerHTML = _this.localization('Download Game Data')+progress;
1650
}
1651
},
1652
'responseType': 'arraybuffer'
1653
}).then(function(_0x22a1f4) {
1654
let _0x17edbf = new Uint8Array(_0x22a1f4.data);
1655
if (typeof _this.config.gameUrl != 'string' || (typeof _this.config.gameUrl == 'string' && (_this.config.gameUrl.startsWith('blob:') || _this.config.gameUrl.startsWith('file:') || _this.config.gameUrl.startsWith('chrome-extension:') || window.location.protocol === 'file:' || window.location.protocol === 'chrome-extension:'))) {
1656
_0x3512e9(_0x139f1c, _0x17edbf);
1657
return;
1658
};
1659
if ((_this.cacheLimit && _this.cacheLimit < _0x17edbf.byteLength) ||
1660
(!_this.cacheLimit && 1073741824 < _0x17edbf.byteLength)) {
1661
_0x3512e9(_0x139f1c, _0x17edbf);
1662
return;
1663
}
1664
if (_0x107e8a && _0x4e171c.db)
1665
_0x4d7024.saveFilenames.push(_0x107e8a), _0x4e171c.put(_0x107e8a, {
1666
'filename': _0x139f1c,
1667
'filesize': _0x17edbf.length,
1668
'filetype': _0x7e8d4c,
1669
'key': _0x107e8a,
1670
'lastaccess': new Date().valueOf()
1671
});
1672
_0x4e171c.db && _0x4e171c.put(_0x107e8a, {
1673
'filename': _0x139f1c,
1674
'filesize': _0x17edbf.length,
1675
'filetype': _0x7e8d4c,
1676
'key': _0x107e8a,
1677
'data': _0x17edbf
1678
});
1679
_0x3512e9(_0x139f1c, _0x17edbf);
1680
}).catch(function(_0x2e4d62) {
1681
renderErrorPage(_0x2e4d62, _0x2c1832, _this);
1682
});
1683
};
1684
_0x4e171c.db ? _0x4e171c.get(_0x107e8a, function(_0x5afc4a) {
1685
if (_0x5afc4a && _0x5afc4a.filename === _0x139f1c && _0x5afc4a.filesize - _0x21b526 == 0 && _0x5afc4a.filetype === _0x7e8d4c && _0x5afc4a.key)
1686
_0x3512e9(_0x5afc4a.filename, _0x5afc4a.data);
1687
else _0x43a689();
1688
}) : _0x43a689();
1689
}).catch(function(_0x5ec6be) {
1690
renderErrorPage(_0x5ec6be, _0x2c1832, _this);
1691
});
1692
},
1693
_0x139f68 = function() {
1694
let _0x2591d9 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)),
1695
_0x5c896f = _this.config.gamePatchUrl;
1696
if (_0x5c896f) {
1697
let _0x227b23 = _0x5c896f.split('/'),
1698
_0x179b43 = _0x227b23[_0x227b23.length - 1];
1699
_0x179b43.indexOf('?') > -0x1 && (_0x179b43 = _0x179b43.substr(0, _0x179b43.indexOf('?')));
1700
_0x179b43.split('.').pop();
1701
_0x2591d9.innerHTML = _this.localization('Download Game Data')+' (1/2)';
1702
_0x550f17.a.get(_0x5c896f, {
1703
'onDownloadProgress': function(e) {
1704
let progress = e.total ? ' '+Math.floor(e.loaded / e.total * 100).toString()+'%' : ' '+(e.loaded/1048576).toFixed(2)+'MB';
1705
_0x2591d9.innerHTML = _this.localization('Download Game Data')+' (1/2)'+progress;
1706
},
1707
'responseType': 'arraybuffer'
1708
}).then(function(_0x159ae9) {
1709
let _0x1097ca = new Uint8Array(_0x159ae9.data),
1710
_0xe531f0 = _0x179b43.split('.').pop(),
1711
_0xf6806b = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)),
1712
_0x59c7c1 = function(_0x36004e) {
1713
if (_0x36004e.data) {
1714
if (0x1 === _0x36004e.data.t && (_0x36004e.target.terminate(), _0x5048db()), 2 === _0x36004e.data.t) {
1715
let _0x17edbf = _0x36004e.data.file.split('/'),
1716
_0x2c1832 = _0x17edbf.pop(),
1717
_0x2b320e = _0x2c1832.split('.').pop();
1718
_0x4d7024.FS.createPath('/', _0x17edbf.join('/'), true, true), _0x4d7024.FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x36004e.data.data, true, false), _0x468801 += _0x36004e.data.data.length, ['ips', 'bps', 'ups'].includes(_0x2b320e) && !_0x4d7024.gamePatch && (_0x4d7024.gamePatch = '/' + _0x17edbf.join('/') + '/' + _0x2c1832);
1719
}
1720
if (0x4 === _0x36004e.data.t && _0x36004e.data.total > 0) {
1721
let _0x1097ca = Math.floor(_0x36004e.data.current / _0x36004e.data.total * 0x64),
1722
_0x95ac83 = _0x36004e.data.name || '';
1723
_0x1097ca <= 0x64 && _0x1097ca > 0 && (_0xf6806b.innerHTML = _this.localization('Decompress Game Patch')+' ' .concat(_0x95ac83, ' ').concat(_0x1097ca, '%'));
1724
}
1725
}
1726
},
1727
_0x3de3e4 = _0x1097ca.slice ? _0x1097ca.slice(0, 10) : _0x1097ca.subarray(0, 10),
1728
_0x17f736 = isCompressed(_0x3de3e4);
1729
if (_0x17f736 === '7z') {
1730
extractFile(_0x17edbf).then(function(_0x20601d) {
1731
_0x20601d.onmessage = _0x59c7c1;
1732
_0x20601d.postMessage(_0x1097ca);
1733
})
1734
} else if (_0x17f736 === 'zip') {
1735
extractFile(_0x2c1832).then(function(_0x46622d) {
1736
_0x46622d.onmessage = _0x59c7c1;
1737
_0x46622d.postMessage(_0x1097ca);
1738
})
1739
} else if (_0x17f736 === 'rar') {
1740
extractRar(_0x4ce206).then(function(_0x2ecd24) {
1741
_0x2ecd24.onmessage = _0x59c7c1;
1742
_0x2ecd24.postMessage(_0x1097ca);
1743
})
1744
} else {
1745
_0x468801 += _0x1097ca.length;
1746
_0x4d7024.gamePatch = '/'+_0xe531f0;
1747
_0x4d7024.FS.createDataFile('/', _0xe531f0, _0x1097ca, true, false);
1748
_0x5048db();
1749
}
1750
}).catch(function(_0x314293) {
1751
renderErrorPage(_0x314293, _0x2c1832, _this);
1752
});
1753
} else _0x5048db();
1754
},
1755
_0x452592 = function() {
1756
let _0x17edbf = _this,
1757
_0x2c1832 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p3)),
1758
_0x5a21f7 = _this.config.gameParentUrl;
1759
if (_0x5a21f7 && ['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(getSystem(_0x17edbf.system, true))) {
1760
let _0x71bb4d = _0x5a21f7.split('/'),
1761
_0xa1889f = _0x71bb4d[_0x71bb4d.length - 1];
1762
_0xa1889f.indexOf('?') > -0x1 && (_0xa1889f = _0xa1889f.substr(0, _0xa1889f.indexOf('?')));
1763
_0xa1889f.split('.').pop();
1764
_0x2c1832.innerHTML = _this.localization('Download Game Data')+' (1/2)', _0x17edbf.config.gamePatchUrl && (_0x2c1832.innerHTML = _this.localization('Download Game Data')+' (1/3)'), _0x550f17.a.head(_0x5a21f7, {}).then(function(_0x35c23a) {
1765
let _0x17edbf = _0x35c23a.headers['content-length'],
1766
_0x500ba1 = _0x35c23a.headers['content-type'],
1767
_0x316472 = (_0x35c23a.headers['last-modified'], '' .concat(_0x1143c5, '-').concat(_0xa1889f)),
1768
_0x31f098 = function() {
1769
_0x550f17.a.get(_0x5a21f7, {
1770
'onDownloadProgress': function(e) {
1771
let progress = e.total ? ' '+Math.floor(e.loaded / e.total * 100).toString()+'%' : ' '+(e.loaded/1048576).toFixed(2)+'MB';
1772
_0x2c1832.innerHTML = _this.localization('Download Game Data')+' (1/2)'+progress;
1773
},
1774
'responseType': 'arraybuffer'
1775
}).then(function(_0x191007) {
1776
let _0x17edbf = new Uint8Array(_0x191007.data);
1777
if (_0x316472 && _0x4e171c.db) {
1778
_0x4d7024.saveFilenames.push(_0x316472);
1779
_0x4e171c.put(_0x316472, {
1780
'filename': _0xa1889f,
1781
'filesize': _0x17edbf.length,
1782
'filetype': _0x500ba1,
1783
'key': _0x316472,
1784
'lastaccess': new Date().valueOf()
1785
}), _0x4e171c.db && _0x4e171c.put(_0x316472, {
1786
'filename': _0xa1889f,
1787
'filesize': _0x17edbf.length,
1788
'filetype': _0x500ba1,
1789
'key': _0x316472,
1790
'data': _0x17edbf
1791
});
1792
}
1793
let _0x54d79 = _0xa1889f.replace(/\#/g, '');
1794
try {
1795
_0x468801 += _0x17edbf.length, _0x4d7024.FS.createDataFile('/', _0x54d79, _0x17edbf, true, false);
1796
_0x139f68();
1797
} catch (_0x125736) {
1798
console.log(_0x125736);
1799
}
1800
}).catch(function(_0x516cc3) {
1801
renderErrorPage(_0x516cc3, _0x2c1832, _this);
1802
});
1803
};
1804
_0x4e171c.db ? _0x4e171c.get(_0x316472, function(_0x3e612b) {
1805
if (_0x3e612b && _0x3e612b.filename === _0xa1889f && _0x3e612b.filesize - _0x17edbf == 0 && _0x3e612b.filetype === _0x500ba1 && _0x3e612b.key) {
1806
_0x4d7024.FS.createDataFile('/', _0x3e612b.filename, _0x3e612b.data, true, false);
1807
_0x139f68();
1808
} else _0x31f098();
1809
}) : _0x31f098();
1810
}).catch(function(_0x20f2e3) {
1811
renderErrorPage(_0x20f2e3, _0x2c1832, _this);
1812
});
1813
} else _0x139f68();
1814
},
1815
_0x57d85d = function(_0x5e7c8b, _0x3cff36) {
1816
let _0x3ea97 = _this,
1817
_0x50119 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p2)),
1818
_0x19a43e = (_0x5e7c8b.split('.').pop(), function(_0x1e8643) {
1819
if (_0x1e8643.data) {
1820
if (1 === _0x1e8643.data.t) {
1821
_0x50119.innerHTML = 'BIOS ready';
1822
_0x1e8643.target.terminate();
1823
_0x452592();
1824
}
1825
if (2 === _0x1e8643.data.t) {
1826
let _0x17edbf = _0x1e8643.data.file.split('/'),
1827
_0x2c1832 = _0x17edbf.pop();
1828
_0x2c1832.split('.').pop();
1829
_0x4d7024.FS.createPath('/', _0x17edbf.join('/'), true, true);
1830
_0x4d7024.FS.createDataFile('/' + _0x17edbf.join('/'), _0x2c1832, _0x1e8643.data.data, true, false);
1831
_0x468801 += _0x1e8643.data.data.length;
1832
}
1833
if (4 === _0x1e8643.data.t && _0x1e8643.data.total > 0) {
1834
let _0x149f09 = Math.floor(_0x1e8643.data.current / _0x1e8643.data.total * 0x64),
1835
_0x5e7c8b = _0x1e8643.data.name || '';
1836
_0x149f09 <= 0x64 && _0x149f09 > 0 && (_0x50119.innerHTML = 'Decompress BIOS ' .concat(_0x5e7c8b, ' ').concat(_0x149f09, '%'));
1837
}
1838
}
1839
}),
1840
_0x12e229 = _0x3cff36.slice ? _0x3cff36.slice(0, 0xa) : _0x3cff36.subarray(0, 0xa),
1841
_0x80852b = isCompressed(_0x12e229);
1842
if (_0x80852b === '7z') {
1843
extractFile(_0x17edbf).then(function(_0x1b6a80) {
1844
_0x1b6a80.onmessage = _0x19a43e;
1845
_0x1b6a80.postMessage(_0x3cff36);
1846
});
1847
} else if (_0x80852b === 'rar') {
1848
extractRar(_0x4ce206).then(function(_0x259be0) {
1849
_0x259be0.onmessage = _0x19a43e;
1850
_0x259be0.postMessage(_0x3cff36);
1851
});
1852
} else if (_0x80852b === 'zip' && !['arcade', 'mame', 'mame2003', 'fba0.2.97.29'].includes(getSystem(_0x3ea97.system, true))) {
1853
extractFile(_0x2c1832).then(function(_0x31c70d) {
1854
_0x31c70d.onmessage = _0x19a43e;
1855
_0x31c70d.postMessage(_0x3cff36);
1856
});
1857
} else {
1858
_0x468801 += _0x3cff36.length;
1859
_0x50119.innerHTML = 'BIOS ready';
1860
_0x4d7024.FS.createDataFile('/', _0x5e7c8b, _0x3cff36, true, false);
1861
_0x452592();
1862
}
1863
},
1864
_0x10b71a = function() {
1865
_0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)).innerHTML = 'Game Core ready';
1866
_0x4d7024.Module._supports_states && (_0x378b5c.statesSupported = _0x4d7024.Module.cwrap('supports_states', 'number', []));
1867
if (_0x378b5c.statesSupported) {
1868
try {
1869
_this.statesSupported = !!_0x378b5c.statesSupported();
1870
_0x1e2c68.element(_this.elements.buttons.netplay) && _0x132da7(_this.elements.buttons.netplay, !_0x7f9f36.supportNetPlay.call(_this));
1871
_0x1e2c68.element(_this.elements.buttons.saveState) && _0x132da7(_this.elements.buttons.saveState, !_this.statesSupported);
1872
_0x1e2c68.element(_this.elements.buttons.loadState) && _0x132da7(_this.elements.buttons.loadState, !_this.statesSupported);
1873
_0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(2), !_this.statesSupported);
1874
_0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(3), !_this.statesSupported);
1875
}catch(e){}
1876
}
1877
let _0x17edbf = _this.config.biosUrl;
1878
_0xdcec2a.bindFunction.call(_this);
1879
_0xdcec2a.setGamepadDialog.call(_this);
1880
_0xdcec2a.setMessageDialog.call(_this);
1881
_0xdcec2a.setCacheDialog.call(_this);
1882
_0xdcec2a.setLoadingDialog.call(_this);
1883
_0xdcec2a.setNetplayDialog.call(_this);
1884
_0xdcec2a.setCheatDialog.call(_this);
1885
_0xdcec2a.initGamepad.call(_this);
1886
_0xdcec2a.initKeyboard.call(_this);
1887
_0xdcec2a.listeners.call(_this);
1888
_0x4d7024._FS.createFolder('/', 'etc', true, true);
1889
_0x4d7024.FS.mkdir('/data');
1890
_0x4d7024.FS.mkdir('/data/saves');
1891
'undefined' != typeof IDBFS ? _0x4d7024.FS.mount(IDBFS, {}, '/data/saves') : _0x4d7024.FS.mount(_0x4d7024.FS.filesystems.IDBFS, {}, '/data/saves');
1892
_0x4d7024.FS.mkdir('/shader');
1893
_0x4d7024.FS.syncfs(true, function(_0x1a8f12) {});
1894
_0xdcec2a.initShaders();
1895
let _0x14d39f = '';
1896
_0x14d39f += 'savefile_directory = /data/saves\n';
1897
_0x14d39f += 'video_vsync = true\n';
1898
_0x14d39f += 'screenshot_directory = /\n';
1899
_0x14d39f += 'video_shader = /shader/shader.glslp\n';
1900
_0x14d39f += 'video_shader_enable = true\n';
1901
_0x14d39f += 'video_font_enable = false\n';
1902
_0x14d39f += 'video_scale = 1.0\n';
1903
_0x14d39f += 'video_gpu_screenshot = false\n';
1904
_0x14d39f += 'audio_latency = 96\n';
1905
const system = getSystem(_this.system, true);
1906
let _0x36edb7 = _0x2593da.defaultCoreOptionsValues.call(_this);
1907
_this.lightgun && ('nes' === system && (_0x14d39f += 'input_libretro_device_p2 = "258"\n'), 'segaMS' !== system && 'segaMD' !== system && 'segaCD' !== system || (_0x36edb7.genesis_plus_gx_gun_cursor = 'yes', _0x36edb7.genesis_plus_gx_invert_mouse = 'yes', _0x36edb7.genesis_plus_gx_bram = 'per game', _0x14d39f += 'input_libretro_device_p2 = "260"\n'), 'snes' === system && (_0x14d39f += 'input_libretro_device_p2 = "260"\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(system) && (_0x14d39f += 'input_libretro_device_p2 = "260"\n'));
1908
_this.mouse && ('snes' === system && (_0x14d39f += 'input_libretro_device_p1 = 2\n'), ['snes2002', 'snes2005', 'snes2010', 'snesnext'].includes(system) && (_0x14d39f += 'input_libretro_device_p1 = 2\n'));
1909
_this.multitap && (['snes2002', 'snes2005', 'snes2010', 'snesnext', 'snes'].includes(system) && (_0x14d39f += 'input_libretro_device_p2 = 257\n'));
1910
'n64' === system && (_0x14d39f += 'input_libretro_device_p1 = 5\n');
1911
_0x14d39f += 'fastforward_ratio = 1.0\n';
1912
_0x14d39f += 'video_smooth = false\n';
1913
let _0x55117c = _0x5dc0c0(_0x36edb7, _0x2593da.storage.get('core-options') || {}),
1914
_0x32dd27 = '';
1915
if (_this.coreVer === 2) {
1916
_0x4d7024.FS.createDataFile('/etc', 'retroarch.cfg', _0x14d39f, true, true);
1917
_0x4d7024._FS.createFolder('/home/web_user', 'retroarch', true, true);
1918
_0x4d7024._FS.createFolder('/home/web_user/retroarch', 'userdata', true, true);
1919
_0x4d7024.FS.createDataFile('/home/web_user/retroarch/userdata', 'retroarch.cfg', _0x32dd27, true, true);
1920
} else {
1921
_0x4d7024.FS.createDataFile('/etc', 'retroarch.cfg', _0x14d39f, true, true);
1922
_0x4d7024._FS.createFolder('/home/web_user', '.config', true, true);
1923
_0x4d7024._FS.createFolder('/home/web_user/.config', 'retroarch', true, true);
1924
_0x4d7024.FS.createDataFile('/home/web_user/.config/retroarch', 'retroarch-core-options.cfg', _0x32dd27, true, true);
1925
}
1926
if (_0x55117c && Object.keys(_0x55117c).forEach(function(_0x2950d3) {
1927
if (_this.lightgun && 'nes' === getSystem(_this.system, true) && 'system_type' === _0x2950d3) return false;
1928
_0x32dd27 += '' .concat(_0x2950d3, ' = "').concat(_0x55117c[_0x2950d3], '"\n'), _0x1093f4.call(_this, _this.elements.container, 'start-game', function(_0x362c5c) {
1929
_0xdcec2a.setVariable(_0x2950d3, _0x55117c[_0x2950d3]);
1930
});
1931
}), _0x17edbf) {
1932
let _0x12e137 = _0x17edbf.split('/'),
1933
_0x103241 = _0x12e137[_0x12e137.length - 1];
1934
_0x103241.indexOf('?') > -0x1 && (_0x103241 = _0x103241.substr(0, _0x103241.indexOf('?')));
1935
_0x103241.split('.').pop();
1936
let _0x1f8424 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p2));
1937
_0x550f17.a.head(_0x17edbf, {}).then(function(_0x4bd3bd) {
1938
let _0x8e30bf = _0x4bd3bd.headers['content-length'],
1939
_0x14309b = _0x4bd3bd.headers['content-type'],
1940
_0x51bfef = (_0x4bd3bd.headers['last-modified'], _this.system),
1941
_0x574747 = function() {
1942
_0x550f17.a.get(_0x17edbf, {
1943
'onDownloadProgress': function(e) {
1944
let progress = e.total ? ' '+Math.floor(e.loaded / e.total * 100).toString()+'%' : ' '+(e.loaded/1048576).toFixed(2)+'MB';
1945
_0x1f8424.innerHTML = _this.localization('Download BIOS')+progress;
1946
},
1947
'responseType': 'arraybuffer'
1948
}).then(function(_0x4b0c1d) {
1949
let _0x17edbf = new Uint8Array(_0x4b0c1d.data);
1950
_0xa884ea.db && _0xa884ea.put(_0x1143c5, {
1951
'filename': _0x103241,
1952
'filesize': _0x17edbf.length,
1953
'filetype': _0x14309b,
1954
'data': _0x17edbf
1955
}), _0x57d85d(_0x103241, _0x17edbf);
1956
}).catch(function(_0x58e374) {
1957
renderErrorPage(_0x58e374, _0x1f8424, _this);
1958
});
1959
};
1960
_0xa884ea.db ? _0xa884ea.get(_0x51bfef, function(_0x5cac21) {
1961
_0x5cac21 && _0x5cac21.filename === _0x103241 && _0x5cac21.filesize - _0x8e30bf == 0 && _0x5cac21.filetype === _0x14309b ? _0x57d85d(_0x5cac21.filename, _0x5cac21.data) : _0x574747();
1962
}) : _0x574747();
1963
}).catch(function(_0x4f39c1) {
1964
renderErrorPage(_0x4f39c1, _0x1f8424, _this);
1965
});
1966
} else _0x452592();
1967
},
1968
_0x29b999 = function(_0x172278) {
1969
let _0x17edbf;
1970
_0x17edbf = _0x172278.byteLength ? new Uint8Array(_0x172278) : _0x172278, 'undefined' != typeof GLOBAL_BASE ? _0x4d7024.Module.HEAPU8.set(_0x17edbf, GLOBAL_BASE) : 'undefined' != typeof Runtime && Runtime.GLOBAL_BASE ? _0x4d7024.Module.HEAPU8.set(_0x17edbf, Runtime.GLOBAL_BASE) : _0x4d7024.Module.HEAPU8.set(_0x17edbf, 0x8);
1971
},
1972
_0x4f0fcc = function(_0x18cb26) {
1973
let _0x2c1832 = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1)),
1974
_0x247459 = '',
1975
_0x54d695 = function() {
1976
null !== _0x4d7024.wasmData ? (window.Module.wasmBinary = _0x4d7024.wasmData, _0x4bd781(), window.Module.monitorRunDependencies = function(_0x59580a) {
1977
0 === _0x59580a && _0x10b71a();
1978
}, window.Module.onRuntimeInitialized = function() {}) : (_0x4bd781(), window.Module.monitorRunDependencies = function(_0x55a24a) {
1979
console.log('monitorRunDependencies, ', _0x55a24a);
1980
}, window.Module.onRuntimeInitialized = function() {
1981
_0x4d7024.Module || (_0x4d7024.Module = window.Module), _0x4d7024.Module && _0x4d7024.Module.FS ? _0x4d7024.FS = _0x4d7024.Module.FS : _0x4d7024.FS = window.FS, console.log('onRuntimeInitialized'), _0x10b71a();
1982
});
1983
let _0x18cb26 = window.Module;
1984
if (null !== _0x4d7024.wasmData && (_0x18cb26.wasmBinary = _0x4d7024.wasmData), _0x59aa33.isIos && null !== _0x4d7024.wasmData) {
1985
let _0x17edbf = new Blob([_0x247459], {
1986
'type': 'text/javascript'
1987
}),
1988
_0x2c1832 = _0x428003('script', {
1989
'src': _0x18a437.createObjectURL(_0x17edbf)
1990
});
1991
document.body.appendChild(_0x2c1832), _0x2c1832.onload = function() {
1992
void 0 === window.addRunDependency && 'undefined' != typeof EmulatorJS && (_0x4d7024.Module = EmulatorJS(_0x18cb26), EmulatorJS = undefined);
1993
null !== _0x4d7024.memData && (_0xc6823.coreVer !== 2) && _0x29b999(_0x4d7024.memData);
1994
_0x4d7024.Module || (_0x4d7024.Module = window.Module);
1995
_0x4d7024.Module && _0x4d7024.Module.FS ? _0x4d7024.FS = _0x4d7024.Module.FS : _0x4d7024.FS = window.FS;
1996
};
1997
} else {
1998
_0x247459 = function(_0x3df03e) {
1999
let _0x17edbf = [];
2000
for (let _0x2c1832 = 0; _0x2c1832 < _0x3df03e.length; _0x2c1832 += 1) {
2001
let _0xcf0289 = _0x3df03e[_0x2c1832];
2002
_0xcf0289 > 0xff && (_0xcf0289 &= 0xff), _0x17edbf.push(String.fromCharCode(_0xcf0289));
2003
}
2004
return _0x17edbf.join('');
2005
}(_0x247459);
2006
window.eval(_0x247459);
2007
void 0 === window.addRunDependency && 'undefined' != typeof EmulatorJS && (_0x4d7024.Module = EmulatorJS(_0x18cb26), EmulatorJS = undefined);
2008
null !== _0x4d7024.memData && (_0xc6823.coreVer !== 2) && _0x29b999(_0x4d7024.memData);
2009
_0x4d7024.Module || (_0x4d7024.Module = window.Module);
2010
_0x4d7024.Module && _0x4d7024.Module.FS ? _0x4d7024.FS = _0x4d7024.Module.FS : _0x4d7024.FS = window.FS;
2011
window.EJS_MODULE = _0x4d7024.Module;
2012
window.ejs_loader = _0x4d7024;
2013
window.ejs_media = _0xdcec2a;
2014
}
2015
_0x247459 = null;
2016
};
2017
_0x1093f4.call(_0xc6823, _0xc6823.elements.container, 'script-loaded', function(_0x467eee) {
2018
_0x54d695();
2019
});
2020
let _0x21d6a1 = function(_0x3f49ec) {
2021
if (_0x3f49ec.data) {
2022
if (0x1 === _0x3f49ec.data.t && (_0xbae705.call(_0xc6823, _0xc6823.elements.container, 'script-loaded'), _0x3f49ec.target.terminate()), 2 === _0x3f49ec.data.t) {
2023
let _0x17edbf = _0x3f49ec.data.file.split('/').pop(),
2024
_0x58b5a7 = _0x17edbf.split('.').pop();
2025
_0x4d7024.coreFileData[_0x17edbf] = _0x3f49ec.data.data, 'js' !== _0x58b5a7 || _0x17edbf.includes('.worker.js') || (_0x247459 = _0x3f49ec.data.data), 'mem' === _0x58b5a7 && (_0x4d7024.memData = _0x3f49ec.data.data), 'wasm' === _0x58b5a7 && (_0x4d7024.wasmData = _0x3f49ec.data.data);
2026
}
2027
4 === _0x3f49ec.data.t && _0x3f49ec.data.total > 0 && (_0x2c1832.innerHTML = _this.localization('Decompress Game Core')+' ' .concat(Math.floor(_0x3f49ec.data.current / _0x3f49ec.data.total * 0x64), '%'));
2028
}
2029
};
2030
extractFile(_0x17edbf).then(function(_0x48c633) {
2031
_0x48c633.onmessage = _0x21d6a1;
2032
_0x48c633.postMessage(_0x18cb26);
2033
});
2034
},
2035
_0x26d6a1 = function(_0x3787ba) {
2036
_0x132da7(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), true);
2037
let status = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1));
2038
status.innerHTML = _this.localization('Loading')+'...';
2039
2040
if (!(true === _0x528f2b && true === _0x547484 && true === _0x5e24fa)) {
2041
setTimeout(_0x26d6a1, 50);
2042
return;
2043
}
2044
window.Module = {
2045
'TOTAL_MEMORY': 0x10000000,
2046
'noInitialRun': true,
2047
'arguments': [],
2048
'preRun': [],
2049
'postRun': [],
2050
'canvas': _0xb2be2a,
2051
'print': function(msg) {
2052
if (window.EJS_DEBUG_XX === true) {
2053
console.log(msg);
2054
}
2055
},
2056
'printErr': function(msg) {
2057
if (window.EJS_DEBUG_XX === true) {
2058
console.log(msg);
2059
}
2060
},
2061
'totalDependencies': 0,
2062
'monitorRunDependencies': function(_0x5d4b07) {},
2063
'locateFile': function(_0x3fe7ca) {
2064
let _0x3787ba = null;
2065
if (_0x3fe7ca.includes('.worker.js')) {
2066
Object.keys(_0x4d7024.coreFileData).includes(_0x3fe7ca) && (_0x3787ba = _0x4d7024.coreFileData[_0x3fe7ca]);
2067
let _0x2c1832 = new Blob([''], {
2068
'type': 'application/javascript'
2069
});
2070
return window.URL.createObjectURL(_0x2c1832);
2071
}
2072
if (_0x3fe7ca.includes('.js.mem') && Object.keys(_0x4d7024.coreFileData).includes(_0x3fe7ca)) {
2073
_0x3787ba = _0x4d7024.coreFileData[_0x3fe7ca];
2074
return URL.createObjectURL(new Blob([_0x3787ba.buffer]));
2075
}
2076
return null;
2077
},
2078
'readAsync': function(_0x20d016, _0x9d2de4, _0x1425ee) {
2079
if (_0x20d016 instanceof ArrayBuffer) setTimeout(function() {
2080
_0x9d2de4(_0x20d016);
2081
}, 500);
2082
else {
2083
let _0x164012 = new XMLHttpRequest();
2084
_0x164012.open('GET', _0x20d016, true);
2085
_0x164012.responseType = 'arraybuffer';
2086
_0x164012.onload = function() {
2087
if (200 == _0x164012.status || 0 == _0x164012.status && _0x164012.response) {
2088
_0x9d2de4(_0x164012.response);
2089
} else {
2090
_0x1425ee();
2091
}
2092
};
2093
_0x164012.onerror = _0x1425ee;
2094
_0x164012.send();
2095
}
2096
}
2097
};
2098
let _0x3641d6 = function(_0x16049b, _0x55a075) {
2099
let path = (_this.customPaths && typeof _this.customPaths[_0x16049b] == 'string') ? _this.customPaths[_0x16049b] : ((_this.coreVer === 2) ? (_this.dataPath+'cores/'+_0x16049b+'?v='+_0x55a075) : (_this.dataPath+'old/'+_0x16049b+'?v='+_0x55a075));
2100
_0x550f17.a.get(path, {
2101
'onDownloadProgress': function(e) {
2102
let progress = e.total ? ' '+Math.floor(e.loaded / e.total * 100).toString()+'%' : ' '+(e.loaded/1048576).toFixed(2)+'MB';
2103
status.innerHTML = _this.localization('Download Game Core')+progress;
2104
},
2105
'responseType': 'arraybuffer'
2106
}).then(function(e) {
2107
let data = new Uint8Array(e.data);
2108
_0x24de8d.db && _0x24de8d.put(_0x16049b, {
2109
'version': _0x55a075,
2110
'data': data
2111
});
2112
if (_this.coreVer === 2) {
2113
_0x4f0fcc(data);
2114
} else {
2115
let data1 = data.slice ? data.slice(12) : data.subarray(12);
2116
data1.set([55, 122, 188, 175, 39, 28, 0, 3], 0);
2117
data = null;
2118
_0x4f0fcc(data1);
2119
}
2120
2121
}).catch(function(e) {
2122
renderErrorPage(e, status, _this);
2123
});
2124
};
2125
let vJson = (_this.customPaths && typeof _this.customPaths['v.json'] == 'string') ? _this.customPaths['v.json'] : (_this.dataPath + 'v.json');
2126
_0x550f17.a.get(vJson, {}).then(function(e) {
2127
let _0x2458d5,
2128
_0x5d075f = _0x29078e,
2129
_0x28ee7f = e.data;
2130
2131
let status = _0x4d7024.loading.querySelector('.' .concat(_0x4fce24.p1));
2132
if (!(_this.config.oldCores === true && _0x28ee7f.oldCores[_this.system]) && _0x28ee7f.newCores[getSystem(_this.system)] && (_0x2d904a.wasm || Boolean(_0x28ee7f.newCores[getSystem(_this.system)].asmjs)) && !_0x59aa33.isIos) {
2133
_this.coreVer = 2;
2134
delete Module.readAsync;
2135
Module.INITIAL_MEMORY = Module.TOTAL_MEMORY;
2136
delete Module.TOTAL_MEMORY;
2137
_this.elements.settings.panels.home.querySelector('[role="menu"]').innerHTML = "";
2138
_0x7f9f36.setNormalOptionsMenu.call(_this);
2139
_0x7f9f36.setCoreOptionsMenu.call(_this);
2140
_0x28ee7f = _0x28ee7f.newCores[getSystem(_this.system)];
2141
_0x5d075f = getSystem(_this.system);
2142
} else {
2143
_0x28ee7f = _0x28ee7f.oldCores[_this.system];
2144
_0x5d075f = _0x5d075f.oldCores[_this.system];
2145
}
2146
if (!_0x28ee7f) {
2147
status.innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+_this.localization('Invalid System')+'</strong>';
2148
return;
2149
}
2150
2151
let _0x124167 = _0x28ee7f.version ? _0x28ee7f.version : 1,
2152
_0x254bc2 = Boolean(_0x28ee7f.netplay),
2153
_0x5b1dcd = Boolean(_0x28ee7f.state),
2154
_0x9a1f1 = Boolean(_0x28ee7f.asmjs),
2155
_0x3e4345 = Boolean(_0x28ee7f.wasm);
2156
2157
if ('nds' === _this.system && !_0x2d904a.wasm && _this.coreVer !== 2) {
2158
_0x5b1dcd = false;
2159
};
2160
if (_this.statesSupported === false) {
2161
_0x5b1dcd = false;
2162
};
2163
_0x4d7024.coreFileVersion = _0x124167;
2164
_0x4d7024.coreFileName = _0x5d075f;
2165
let _0x2eb141 = false;
2166
['webgl2', 'experimental-webgl2'].includes(_0x2d904a.webgl.WEBGL_CONTEXT) && (_0x2eb141 = true);
2167
'undefined' != typeof EJS_N64_LEGACY && 1 == EJS_N64_LEGACY && (_0x2eb141 = false);
2168
if ('mame' == _this.system) {
2169
let data = _this.mameCore;
2170
if (! data || data === null || data.split('|').length !== 2) {
2171
status.innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+_this.localization('Missing mame config')+'</strong>';
2172
return;
2173
}
2174
let _0x3787ba = data.split('|');
2175
_0x4d7024.coreFileName = ''.concat(_this.system, '-').concat(_0x3787ba[0]);
2176
_0x5b1dcd = '1' === _0x3787ba[1];
2177
_0x1e2c68.element(_this.elements.buttons.saveState) && _0x132da7(_this.elements.buttons.saveState, !_0x5b1dcd);
2178
_0x1e2c68.element(_this.elements.buttons.loadState) && _0x132da7(_this.elements.buttons.loadState, !_0x5b1dcd);
2179
_0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(2), !_0x5b1dcd);
2180
_0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(3), !_0x5b1dcd);
2181
if (_this.coreVer === 2) {
2182
_0x2458d5 = '';
2183
} else {
2184
_0x2458d5 = _this.system.concat('-old-').concat(_0x3787ba[0], '-wasm.data');
2185
}
2186
_0x3787ba[0] ? (_0x2d904a.wasm && _0x3e4345 ? (_0x31a5b3 = true) : (status.innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+_this.localization('Webassembly support is not detected in this browser')+'</strong>', _0x2458d5 = ''), _0x2458d5 && (_0x24de8d.db ? _0x24de8d.get(_0x2458d5, function(_0x655c87) {
2187
if (_0x655c87 && _0x655c87.version === _0x124167) {
2188
if (_0xc6823.coreVer === 2) {
2189
_0x4f0fcc(_0x655c87.data);
2190
} else {
2191
let _0x3787ba = _0x655c87.data.slice ? _0x655c87.data.slice(0xc) : _0x655c87.data.subarray(0xc);
2192
_0x3787ba.set([55, 122, 188, 175, 39, 28, 0, 3], 0);
2193
_0x4f0fcc(_0x3787ba);
2194
}
2195
} else _0x3641d6(_0x2458d5, _0x124167);
2196
}) : _0x3641d6(_0x2458d5, _0x124167))) : status.innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+_this.localization('Unsupported Game')+'</strong>';
2197
} else {
2198
_0x2458d5 = false;
2199
let type;
2200
if (_0x2d904a.wasm && _0x3e4345) {
2201
type = 'wasm';
2202
_0x2458d5 = true;
2203
if ('n64' === _this.system && !_0x2eb141 && _this.coreVer !== 2) {
2204
type = 'legacy-wasm';
2205
}
2206
_0x31a5b3 = true;
2207
} else if (_0x9a1f1) {
2208
_0x2458d5 = true;
2209
type = 'asmjs';
2210
if ('n64' === _this.system && !_0x2eb141 && _this.coreVer !== 2) {
2211
type = 'legacy-asmjs';
2212
}
2213
}
2214
if (_0x2458d5 !== true) {
2215
status.innerHTML = '<strong style="color:#f00;text-shadow: 0px 0px 3px;">'+_this.localization('Please upgrade your browser to the latest version')+'</strong>';
2216
return;
2217
}
2218
if (_this.coreVer === 2) {
2219
_0x2458d5 = _0x5d075f + '-' + type + '.data';
2220
} else {
2221
_0x2458d5 = _0x5d075f + '-old-' + type + '.data';
2222
}
2223
'undefined' != typeof EJS_CUSTOM_COREFILE && (_0x2458d5 = EJS_CUSTOM_COREFILE);
2224
_0x24de8d.db ? _0x24de8d.get(_0x2458d5, function(_0x47a6fd) {
2225
if (_0x47a6fd && _0x47a6fd.version === _0x124167 && !('undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX)) {
2226
if (_0xc6823.coreVer === 2) {
2227
_0x4f0fcc(_0x47a6fd.data);
2228
} else {
2229
let _0x3787ba = _0x47a6fd.data.slice ? _0x47a6fd.data.slice(12) : _0x47a6fd.data.subarray(12);
2230
_0x3787ba.set([55, 122, 188, 175, 39, 28, 0, 3], 0);
2231
_0x4f0fcc(_0x3787ba);
2232
}
2233
} else _0x3641d6(_0x2458d5, _0x124167);
2234
}) : _0x3641d6(_0x2458d5, _0x124167);
2235
}
2236
_0x254bc2 || _0x1e2c68.element(_this.elements.buttons.netplay) && _0x132da7(_this.elements.buttons.netplay, true);
2237
_0x1e2c68.element(_this.elements.buttons.saveState) && _0x132da7(_this.elements.buttons.saveState, !_0x5b1dcd);
2238
_0x1e2c68.element(_this.elements.buttons.loadState) && _0x132da7(_this.elements.buttons.loadState, !_0x5b1dcd);
2239
_0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(2), !_0x5b1dcd);
2240
_0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(3), !_0x5b1dcd);
2241
_this.statesSupported = _0x5b1dcd;
2242
if (window.innerWidth < 400) {
2243
_0x1e2c68.element(_this.elements.inputs.volume) && _0x132da7(_this.elements.inputs.volume, true);
2244
_0x1e2c68.element(_this.elements.buttons.mute) && _0x132da7(_this.elements.buttons.mute, true);
2245
_0x1e2c68.element(_this.elements.buttons.cheat) && _0x132da7(_this.elements.buttons.cheat, true);
2246
}
2247
2248
if (_this.config.buttons) {
2249
if (_this.config.buttons.playPause === false) {
2250
_0x1e2c68.element(_this.elements.buttons.play[0]) && _0x132da7(_this.elements.buttons.play[0], true);
2251
}
2252
if (_this.config.buttons.restart === false) {
2253
_0x1e2c68.element(_this.elements.buttons.restart) && _0x132da7(_this.elements.buttons.restart, true);
2254
}
2255
if (_this.config.buttons.mute === false) {
2256
_0x1e2c68.element(_this.elements.buttons.mute) && _0x132da7(_this.elements.buttons.mute, true);
2257
}
2258
if (_this.config.buttons.settings === false) {
2259
_0x1e2c68.element(_this.elements.buttons.settings) && _0x132da7(_this.elements.buttons.settings, true);
2260
}
2261
if (_this.config.buttons.fullscreen === false) {
2262
_0x1e2c68.element(_this.elements.buttons.fullscreen) && _0x132da7(_this.elements.buttons.fullscreen, true);
2263
}
2264
if (_this.config.buttons.saveState === false) {
2265
_0x1e2c68.element(_this.elements.buttons.saveState) && _0x132da7(_this.elements.buttons.saveState, true);
2266
}
2267
if (_this.config.buttons.loadState === false) {
2268
_0x1e2c68.element(_this.elements.buttons.loadState) && _0x132da7(_this.elements.buttons.loadState, true);
2269
}
2270
if (_this.config.buttons.screenRecord === false) {
2271
_0x1e2c68.element(_this.elements.buttons.screenRecord) && _0x132da7(_this.elements.buttons.screenRecord, true);
2272
}
2273
if (_this.config.buttons.cacheManager === false) {
2274
_0x1e2c68.element(_this.elements.buttons.cacheManager) && _0x132da7(_this.elements.buttons.cacheManager, true);
2275
}
2276
if (_this.config.buttons.gamepad === false) {
2277
_0x1e2c68.element(_this.elements.buttons.gamepad) && _0x132da7(_this.elements.buttons.gamepad, true);
2278
}
2279
if (_this.config.buttons.cheat === false) {
2280
_0x1e2c68.element(_this.elements.buttons.cheat) && _0x132da7(_this.elements.buttons.cheat, true);
2281
}
2282
if (_this.config.buttons.volume === false) {
2283
_0x1e2c68.element(_this.elements.inputs.volume) && _0x132da7(_this.elements.inputs.volume, true);
2284
}
2285
if (_this.config.buttons.screenshot === false) {
2286
_0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0), true);
2287
}
2288
if (_this.config.buttons.quickSave === false) {
2289
_0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(2), true);
2290
}
2291
if (_this.config.buttons.quickLoad === false) {
2292
_0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(3), true);
2293
}
2294
}
2295
}).catch(function(e) {
2296
renderErrorPage(e, _0x3787ba, _0xc6823);
2297
});
2298
_0x4d7024.romdb = _0x4e171c;
2299
return false;
2300
};
2301
_0x455c85(_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])), 'click touchstart', _0x26d6a1);
2302
if (_0xc6823.startOnLoad === true) {
2303
_0x4d7024.loading.querySelector('.' .concat(_0x4fce24['start-game'])).click();
2304
}
2305
}
2306
}
2307
let _0x27f4c4 = _0x4d7024;
2308
const _0x4a2390 = _0x2c1832(0xa1);
2309
2310
function _0x3c0613(_0x3eef01) {
2311
return function(_0x3d9b1e) {
2312
if (Array.isArray(_0x3d9b1e)) {
2313
for (let _0x17edbf = 0, _0x2c1832 = new Array(_0x3d9b1e.length); _0x17edbf < _0x3d9b1e.length; _0x17edbf++) _0x2c1832[_0x17edbf] = _0x3d9b1e[_0x17edbf];
2314
return _0x2c1832;
2315
}
2316
}(_0x3eef01) || function(_0x425c1a) {
2317
if (Symbol.iterator in Object(_0x425c1a) || '[object Arguments]' === Object.prototype.toString.call(_0x425c1a)) return Array.from(_0x425c1a);
2318
}(_0x3eef01) || function() {
2319
throw new TypeError('Invalid attempt to spread non-iterable instance');
2320
}();
2321
}
2322
2323
function _0xa08ac0(_0x514af5, _0x4089be) {
2324
for (let _0x2c1832 = 0; _0x2c1832 < _0x4089be.length; _0x2c1832++) {
2325
let _0x3347c8 = _0x4089be[_0x2c1832];
2326
_0x3347c8.enumerable = _0x3347c8.enumerable || false, _0x3347c8.configurable = true, 'value' in _0x3347c8 && (_0x3347c8.writable = true), Object.defineProperty(_0x514af5, _0x3347c8.key, _0x3347c8);
2327
}
2328
}
2329
let _0x1eda08, _0x4fc27f, _0xf43a92, _0x214f42, _0x3a9bfc, _0x4d8495 = (_0x1eda08 = ['a[href]', 'area[href]', 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', 'select:not([disabled]):not([aria-hidden])', 'textarea:not([disabled]):not([aria-hidden])', 'button:not([disabled]):not([aria-hidden])', 'iframe', 'object', 'embed', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'], _0x4fc27f = function() {
2330
function _0x5566a2(_0x1fcb21) {
2331
let _0x2c1832 = _0x1fcb21.targetModal,
2332
_0x29e6ab = _0x1fcb21.triggers,
2333
_0x114128 = void 0 === _0x29e6ab ? [] : _0x29e6ab,
2334
_0x5211ae = _0x1fcb21.onShow,
2335
_0x402faa = void 0 === _0x5211ae ? function() {} : _0x5211ae,
2336
_0x120cc3 = _0x1fcb21.onClose,
2337
_0x48ad1c = void 0 === _0x120cc3 ? function() {} : _0x120cc3,
2338
_0x6a1522 = _0x1fcb21.openTrigger,
2339
_0x306932 = void 0 === _0x6a1522 ? 'data-micromodal-trigger' : _0x6a1522,
2340
_0x446302 = _0x1fcb21.closeTrigger,
2341
_0x2f0676 = void 0 === _0x446302 ? 'data-micromodal-close' : _0x446302,
2342
_0x2a4c0e = _0x1fcb21.disableScroll,
2343
_0x2297fa = void 0 !== _0x2a4c0e && _0x2a4c0e,
2344
_0x5a3f47 = _0x1fcb21.disableFocus,
2345
_0x4a8131 = void 0 !== _0x5a3f47 && _0x5a3f47,
2346
_0x42179f = _0x1fcb21.awaitCloseAnimation,
2347
_0x27da4d = void 0 !== _0x42179f && _0x42179f,
2348
_0x1b535e = _0x1fcb21.debugMode,
2349
_0x33d8ca = void 0 !== _0x1b535e && _0x1b535e,
2350
_0xee6cb0 = _0x1fcb21.closeByEsckey,
2351
_0x54de6a = void 0 === _0xee6cb0 || _0xee6cb0;
2352
! function(_0x27e736, _0x56010c) {
2353
if (!(_0x27e736 instanceof _0x56010c)) throw new TypeError('Cannot call a class as a function');
2354
}(this, _0x5566a2), this.modal = document.getElementById(_0x2c1832), this.config = {
2355
'debugMode': _0x33d8ca,
2356
'disableScroll': _0x2297fa,
2357
'openTrigger': _0x306932,
2358
'closeTrigger': _0x2f0676,
2359
'onShow': _0x402faa,
2360
'onClose': _0x48ad1c,
2361
'awaitCloseAnimation': _0x27da4d,
2362
'disableFocus': _0x4a8131,
2363
'closeByEsckey': _0x54de6a
2364
}, _0x114128.length > 0 && this.registerTriggers.apply(this, _0x3c0613(_0x114128)), this.onClick = this.onClick.bind(this), this.onKeydown = this.onKeydown.bind(this);
2365
}
2366
let _0x17edbf, _0x2c1832, _0x5021cc;
2367
return _0x17edbf = _0x5566a2, (_0x2c1832 = [{
2368
'key': 'registerTriggers',
2369
'value': function() {
2370
for (let _0x5566a2 = this, _0x17edbf = arguments.length, _0x2c1832 = new Array(_0x17edbf), _0x4e24fa = 0; _0x4e24fa < _0x17edbf; _0x4e24fa++) _0x2c1832[_0x4e24fa] = arguments[_0x4e24fa];
2371
_0x2c1832.forEach(function(_0x511ded) {
2372
_0x511ded.addEventListener('click', function() {
2373
return _0x5566a2.showModal();
2374
});
2375
});
2376
}
2377
}, {
2378
'key': 'showModal',
2379
'value': function() {
2380
this.activeElement = document.activeElement, this.modal.setAttribute('aria-hidden', 'false'), this.modal.classList.add(getClass({
2381
'is-open': true
2382
})), this.setFocusToFirstNode(), this.addEventListeners(), this.config.onShow(this.modal);
2383
}
2384
}, {
2385
'key': 'closeModal',
2386
'value': function() {
2387
let _0x5566a2 = this.modal;
2388
this.modal.setAttribute('aria-hidden', 'true'), this.removeEventListeners(), this.config.onClose(this.modal), this.config.awaitCloseAnimation ? this.modal.addEventListener('animationend', function _0x17edbf() {
2389
_0x5566a2.classList.remove(getClass({
2390
'is-open': true
2391
})), _0x5566a2.removeEventListener('animationend', _0x17edbf, false);
2392
}, false) : _0x5566a2.classList.remove(getClass({
2393
'is-open': true
2394
}));
2395
}
2396
}, {
2397
'key': 'addEventListeners',
2398
'value': function() {
2399
this.modal.addEventListener('touchstart', this.onClick), this.modal.addEventListener('click', this.onClick), document.addEventListener('keydown', this.onKeydown);
2400
}
2401
}, {
2402
'key': 'removeEventListeners',
2403
'value': function() {
2404
this.modal.removeEventListener('touchstart', this.onClick), this.modal.removeEventListener('click', this.onClick), document.removeEventListener('keydown', this.onKeydown);
2405
}
2406
}, {
2407
'key': 'onClick',
2408
'value': function(_0x6c9df3) {
2409
_0x6c9df3.target.hasAttribute(this.config.closeTrigger) && (this.closeModal(), _0x6c9df3.preventDefault());
2410
}
2411
}, {
2412
'key': 'onKeydown',
2413
'value': function(_0xe2d057) {
2414
this.config.closeByEsckey && 0x1b === _0xe2d057.keyCode && this.closeModal(_0xe2d057), 0x9 === _0xe2d057.keyCode && this.maintainFocus(_0xe2d057);
2415
}
2416
}, {
2417
'key': 'getFocusableNodes',
2418
'value': function() {
2419
let _0x5566a2 = this.modal.querySelectorAll(_0x1eda08);
2420
return Object.keys(_0x5566a2).map(function(_0x1bd160) {
2421
return _0x5566a2[_0x1bd160];
2422
});
2423
}
2424
}, {
2425
'key': 'setFocusToFirstNode',
2426
'value': function() {
2427
if (!this.config.disableFocus) {
2428
let _0x5566a2 = this.getFocusableNodes();
2429
_0x5566a2.length && _0x5566a2[0].focus();
2430
}
2431
}
2432
}, {
2433
'key': 'maintainFocus',
2434
'value': function(_0x15092b) {
2435
let _0x17edbf = this.getFocusableNodes();
2436
if (this.modal.contains(document.activeElement)) {
2437
let _0x2c1832 = _0x17edbf.indexOf(document.activeElement);
2438
_0x15092b.shiftKey && 0 === _0x2c1832 && (_0x17edbf[_0x17edbf.length - 1].focus(), _0x15092b.preventDefault()), _0x15092b.shiftKey || _0x2c1832 !== _0x17edbf.length - 1 || (_0x17edbf[0].focus(), _0x15092b.preventDefault());
2439
} else _0x17edbf[0].focus();
2440
}
2441
}]) && _0xa08ac0(_0x17edbf.prototype, _0x2c1832), _0x5021cc && _0xa08ac0(_0x17edbf, _0x5021cc), _0x5566a2;
2442
}(), _0xf43a92 = null, _0x214f42 = function(_0x31caa5) {
2443
if (!document.getElementById(_0x31caa5)) return false;
2444
}, _0x3a9bfc = function(_0x48c135, _0x61240d) {
2445
if (function(_0x28b4fb) {
2446
_0x28b4fb.length <= 0 && (console.warn('MicroModal v' .concat(version, ': ❗Please specify at least one %c\'micromodal-trigger\''), 'background-color: #f8f9fa;color: #50596c;font-weight: bold;', 'data attribute.'), console.warn('%cExample:', 'background-color: #f8f9fa;color: #50596c;font-weight: bold;', '<a href="#" data-micromodal-trigger="my-modal"></a>'));
2447
}(_0x48c135), !_0x61240d) return true;
2448
for (let _0x2c1832 in _0x61240d) _0x214f42(_0x2c1832);
2449
return true;
2450
}, {
2451
'init': function(_0x3f1b32) {
2452
let _0x17edbf = Object.assign({}, {
2453
'openTrigger': 'data-micromodal-trigger'
2454
}, _0x3f1b32),
2455
_0x2c1832 = _0x3c0613(document.querySelectorAll('[' .concat(_0x17edbf.openTrigger, ']'))),
2456
_0x537e55 = function(_0x5e363a, _0x9390ce) {
2457
let _0x2c1832 = [];
2458
return _0x5e363a.forEach(function(_0x305145) {
2459
let _0x13d441 = _0x305145.attributes[_0x9390ce].value;
2460
void 0 === _0x2c1832[_0x13d441] && (_0x2c1832[_0x13d441] = []), _0x2c1832[_0x13d441].push(_0x305145);
2461
}), _0x2c1832;
2462
}(_0x2c1832, _0x17edbf.openTrigger);
2463
if (true !== _0x17edbf.debugMode || false !== _0x3a9bfc(_0x2c1832, _0x537e55))
2464
for (let _0x383dff in _0x537e55) {
2465
let _0x34a8e0 = _0x537e55[_0x383dff];
2466
_0x17edbf.targetModal = _0x383dff, _0x17edbf.triggers = _0x3c0613(_0x34a8e0), new _0x4fc27f(_0x17edbf);
2467
}
2468
},
2469
'show': function(_0x2a3fcf, _0x472cd6) {
2470
let _0x2c1832 = _0x472cd6 || {};
2471
return _0x2c1832.targetModal = _0x2a3fcf, true === _0x2c1832.debugMode && false === _0x214f42(_0x2a3fcf) ? _0xf43a92 = null : (_0xf43a92 = new _0x4fc27f(_0x2c1832)).showModal(), _0xf43a92;
2472
},
2473
'close': function() {
2474
_0xf43a92.closeModal();
2475
}
2476
});
2477
const _0x378b5c = {
2478
'defaultControllers': {
2479
0: {
2480
0: {
2481
'value': '88'
2482
},
2483
1: {
2484
'value': '83'
2485
},
2486
2: {
2487
'value': '16'
2488
},
2489
3: {
2490
'value': '13'
2491
},
2492
4: {
2493
'value': '38'
2494
},
2495
5: {
2496
'value': '40'
2497
},
2498
6: {
2499
'value': '37'
2500
},
2501
7: {
2502
'value': '39'
2503
},
2504
8: {
2505
'value': '90'
2506
},
2507
9: {
2508
'value': '65'
2509
},
2510
10: {
2511
'value': '81'
2512
},
2513
11: {
2514
'value': '69'
2515
},
2516
12: {
2517
'value': '82'
2518
},
2519
13: {
2520
'value': '87'
2521
},
2522
14: {},
2523
15: {},
2524
16: {
2525
'value': '72'
2526
},
2527
17: {
2528
'value': '70'
2529
},
2530
18: {
2531
'value': '71'
2532
},
2533
19: {
2534
'value': '84'
2535
},
2536
20: {'value': '76'},
2537
21: {'value': '74'},
2538
22: {'value': '75'},
2539
23: {'value': '73'},
2540
24: {},
2541
25: {},
2542
26: {}
2543
},
2544
1: {},
2545
2: {},
2546
3: {}
2547
},
2548
'controllers': {},
2549
'virtualGamepadContainer': null,
2550
'keyMap': {
2551
8: 'backspace',
2552
9: 'tab',
2553
13: 'enter',
2554
16: 'shift',
2555
17: 'ctrl',
2556
18: 'alt',
2557
19: 'pause/break',
2558
20: 'caps lock',
2559
27: 'escape',
2560
32: 'space',
2561
33: 'page up',
2562
34: 'page down',
2563
35: 'end',
2564
36: 'home',
2565
37: 'left arrow',
2566
38: 'up arrow',
2567
39: 'right arrow',
2568
40: 'down arrow',
2569
45: 'insert',
2570
46: 'delete',
2571
48: '0',
2572
49: '1',
2573
50: '2',
2574
51: '3',
2575
52: '4',
2576
53: '5',
2577
54: '6',
2578
55: '7',
2579
56: '8',
2580
57: '9',
2581
65: 'a',
2582
66: 'b',
2583
67: 'c',
2584
68: 'd',
2585
69: 'e',
2586
70: 'f',
2587
71: 'g',
2588
72: 'h',
2589
73: 'i',
2590
74: 'j',
2591
75: 'k',
2592
76: 'l',
2593
77: 'm',
2594
78: 'n',
2595
79: 'o',
2596
80: 'p',
2597
81: 'q',
2598
82: 'r',
2599
83: 's',
2600
84: 't',
2601
85: 'u',
2602
86: 'v',
2603
87: 'w',
2604
88: 'x',
2605
89: 'y',
2606
90: 'z',
2607
91: 'left window key',
2608
92: 'right window key',
2609
93: 'select key',
2610
96: 'numpad 0',
2611
97: 'numpad 1',
2612
98: 'numpad 2',
2613
99: 'numpad 3',
2614
100: 'numpad 4',
2615
101: 'numpad 5',
2616
102: 'numpad 6',
2617
103: 'numpad 7',
2618
104: 'numpad 8',
2619
105: 'numpad 9',
2620
106: 'multiply',
2621
107: 'add',
2622
109: 'subtract',
2623
110: 'decimal point',
2624
111: 'divide',
2625
112: 'f1',
2626
113: 'f2',
2627
114: 'f3',
2628
115: 'f4',
2629
116: 'f5',
2630
117: 'f6',
2631
118: 'f7',
2632
119: 'f8',
2633
120: 'f9',
2634
121: 'f10',
2635
122: 'f11',
2636
123: 'f12',
2637
144: 'num lock',
2638
145: 'scroll lock',
2639
186: 'semi-colon',
2640
187: 'equal sign',
2641
188: 'comma',
2642
189: 'dash',
2643
190: 'period',
2644
191: 'forward slash',
2645
192: 'grave accent',
2646
219: 'open bracket',
2647
220: 'back slash',
2648
221: 'close braket',
2649
222: 'single quote'
2650
},
2651
'saveLoaddbDB': function() {
2652
try {
2653
return new IDBStore({
2654
'dbVersion': 1,
2655
'storePrefix': 'ejs-',
2656
'storeName': 'states',
2657
'keyPath': null,
2658
'autoIncrement': false,
2659
'onStoreReady': function() {},
2660
'onError': function() {}
2661
});
2662
} catch(e) {
2663
console.log(e);
2664
}
2665
}(),
2666
'saveLoadDB': function(type) {
2667
try {
2668
if (!_0x378b5c.saveLoaddbDB.db) return false;
2669
if (_0x2593da && typeof _0x2593da.getCoreOptionsValue === 'function') {
2670
let location = _0x2593da.getCoreOptionsValue('save-state-location');
2671
if (!location || location === 'download') {
2672
return false;
2673
}
2674
if (!this.getStartName()) return false;
2675
let slot = _0x2593da.getCoreOptionsValue('save-state-slot');
2676
if (!slot) return false;
2677
let game = this.getStartName();
2678
let key = game + '-' + slot;
2679
(async function() {
2680
if (type === 'save') {
2681
try {
2682
let data = await _0x378b5c.saveState();
2683
_0x378b5c.saveLoaddbDB.put(key, data);
2684
} catch(e) {return false;};
2685
} else {
2686
_0x378b5c.saveLoaddbDB.get(key, function(data) {
2687
EJS_loadState(data);
2688
});
2689
}
2690
})();
2691
return true;
2692
} else {
2693
return false;
2694
}
2695
} catch(e) {
2696
return false;
2697
}
2698
},
2699
'disableInput': false,
2700
'disableControl': function(control) {
2701
if (control) {
2702
for (var _0x17edbf = 0x0; _0x17edbf < 0x18; _0x17edbf += 0x1) _0x378b5c.simulateInputFn(0x0, _0x17edbf, 0x0), _0x378b5c.simulateInputFn(0x1, _0x17edbf, 0x0), _0x378b5c.simulateInputFn(0x2, _0x17edbf, 0x0), _0x378b5c.simulateInputFn(0x3, _0x17edbf, 0x0);
2703
_0x378b5c.disableInput = true;
2704
} else _0x378b5c.disableInput = false;
2705
},
2706
'loadRoomsListTimer': null,
2707
'loadRoomsList': function() {},
2708
'stopLoadRooms': function() {
2709
_0x378b5c.loadRoomsListTimer && clearTimeout(_0x378b5c.loadRoomsListTimer);
2710
},
2711
'openRoom': function() {},
2712
'gamepad': null,
2713
'allowCheat': true,
2714
'connection': null,
2715
'connected': false,
2716
'playerName': '',
2717
'players': [],
2718
'waitingList': {},
2719
'roomMaster': null,
2720
'inputsData': {},
2721
'coreOptionData': {},
2722
'currentFrame': 0,
2723
'wait': false,
2724
'progressHelper': {},
2725
'icons': {
2726
'lock': '<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="lock" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="svg-inline--fa fa-lock fa-w-14 fa-3x"><path fill="currentColor" d="M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z" class=""></path></svg>'
2727
},
2728
'isPaused': null,
2729
'setVolume': null,
2730
'setVariable': null,
2731
'simulateInput': null,
2732
'simulateInputFn': null,
2733
'toggleShader': null,
2734
'saveState': null,
2735
'screenRecord': null,
2736
'cacheManager': null,
2737
'loadState': null,
2738
'quickSaveState': null,
2739
'quickLoadState': null,
2740
'changeStateSlot': null,
2741
'getScreenData': null,
2742
'getStateInfo': null,
2743
'setCheat': null,
2744
'resetCheat': null,
2745
'getGameCoreOptions': null,
2746
'classNames': {
2747
'dialog-container': getClass({
2748
'dialog-container': true
2749
}),
2750
'tabs': getClass({
2751
'tabs': true
2752
}),
2753
'dialog-title': getClass({
2754
'dialog-title': true
2755
}),
2756
'dialog-content': getClass({
2757
'dialog-content': true
2758
}),
2759
'dialog-buttons': getClass({
2760
'dialog-buttons': true
2761
}),
2762
'overlay': getClass({
2763
'overlay': true
2764
}),
2765
'key-setting-popup': getClass({
2766
'key-setting-popup': true
2767
}),
2768
'tabs-panel': getClass({
2769
'tabs-panel': true
2770
}),
2771
'tabs-content': getClass({
2772
'tabs-content': true
2773
}),
2774
'button-container': getClass({
2775
'button-container': true
2776
}),
2777
'set': getClass({
2778
'set': true
2779
}),
2780
'active': getClass({
2781
'active': true
2782
}),
2783
'btn-cancel': getClass({
2784
'btn-cancel': true
2785
}),
2786
'btn-reset': getClass({
2787
'btn-reset': true
2788
}),
2789
'btn-clear': getClass({
2790
'btn-clear': true
2791
}),
2792
'btn-create': getClass({
2793
'btn-create': true
2794
}),
2795
'btn-submit': getClass({
2796
'btn-submit': true
2797
}),
2798
'btn-join-room': getClass({
2799
'btn-join-room': true
2800
}),
2801
'btn-quit': getClass({
2802
'btn-quit': true
2803
}),
2804
'btn-create-room': getClass({
2805
'btn-create-room': true
2806
}),
2807
'netplay-player-name': getClass({
2808
'netplay-player-name': true
2809
}),
2810
'netplay-roomlist': getClass({
2811
'netplay-roomlist': true
2812
}),
2813
'netplay-room-name-input': getClass({
2814
'netplay-room-name-input': true
2815
}),
2816
'netplay-room-password-input': getClass({
2817
'netplay-room-password-input': true
2818
}),
2819
'netplay-create-room-set': getClass({
2820
'netplay-create-room-set': true
2821
}),
2822
'netplay-room': getClass({
2823
'netplay-room': true
2824
}),
2825
'modal': getClass({
2826
'modal': true
2827
}),
2828
'modal__overlay': getClass({
2829
'modal__overlay': true
2830
}),
2831
'modal__container': getClass({
2832
'modal__container': true
2833
}),
2834
'modal__header': getClass({
2835
'modal__header': true
2836
}),
2837
'modal__title': getClass({
2838
'modal__title': true
2839
}),
2840
'modal__close': getClass({
2841
'modal__close': true
2842
}),
2843
'modal__content': getClass({
2844
'modal__content': true
2845
}),
2846
'modal__btn': getClass({
2847
'modal__btn': true
2848
}),
2849
'modal__btn-primary': getClass({
2850
'modal__btn-primary': true
2851
}),
2852
'micromodal-slide': getClass({
2853
'micromodal-slide': true
2854
}),
2855
'modal__errmsg': getClass({
2856
'modal__errmsg': true
2857
}),
2858
'modal__footer': getClass({
2859
'modal__footer': true
2860
}),
2861
'cheats-add': getClass({
2862
'cheats-add': true
2863
}),
2864
'cheats-list': getClass({
2865
'cheats-list': true
2866
}),
2867
'cheat-code-input': getClass({
2868
'cheat-code-input': true
2869
}),
2870
'cheat-name-input': getClass({
2871
'cheat-name-input': true
2872
}),
2873
'ejs-switch': getClass({
2874
'ejs-switch': true
2875
}),
2876
'ejs-delete-cheat': getClass({
2877
'ejs-delete-cheat': true
2878
})
2879
},
2880
'initShaders': function() {
2881
const _0xa88a13 = shaders;
2882
for (let _0x17edbf = Object.keys(_0xa88a13), _0x2c1832 = '', _0x26fb6a = 0; _0x26fb6a < _0x17edbf.length; _0x26fb6a += 1) _0x2c1832 = _0xa88a13[_0x17edbf[_0x26fb6a]], _0x27f4c4.FS.writeFile('/shader/' .concat(_0x17edbf[_0x26fb6a]), _0x2c1832), _0x2593da.storage.get('shader') === _0x17edbf[_0x26fb6a] && _0x27f4c4.FS.writeFile('/shader/shader.glslp', _0x2c1832);
2883
},
2884
'setMessageDialog': function() {
2885
this.elements.dialogs.message.innerHTML = '<div class="' + _0x378b5c.classNames['dialog-container'] + '"><div class="' + _0x378b5c.classNames['dialog-title'] + '"><h2>'+this.localization('Drop to load save state')+'</h2></div></div>';
2886
},
2887
'setGamepadDialog': function() {
2888
let _this = this;
2889
_this.elements.dialogs.gamepad.innerHTML = '\n <div class="' + _0x378b5c.classNames['dialog-container'] + '">\n <div class="' + _0x378b5c.classNames['dialog-title'] + '">\n <h4>'+_this.localization('Control Settings')+'</h4>\n </div>\n \n <ul class="' + _0x378b5c.classNames.tabs + '" id="controls-tabs">\n <li class="tabs-title" role="presentation"><a href="#" onclick="return false" role="tab" aria-controls="controls-0" aria-selected="false" id="controls-0-label">'+_this.localization('Player 1')+'</a></li>\n <li class="tabs-title" role="presentation"><a href="#" onclick="return false" role="tab" aria-controls="controls-1" aria-selected="false" id="controls-1-label">'+_this.localization('Player 2')+'</a></li>\n <li class="tabs-title" role="presentation"><a href="#" onclick="return false" role="tab" aria-controls="controls-2" aria-selected="false" id="controls-2-label">'+_this.localization('Player 3')+'</a></li>\n <li class="tabs-title" role="presentation"><a href="#" onclick="return false" role="tab" aria-controls="controls-3" aria-selected="false" id="controls-3-label">'+_this.localization('Player 4')+'</a></li>\n </ul>\n <div class="' + _0x378b5c.classNames['dialog-content'] + '">\n <div class="' + _0x378b5c.classNames['tabs-content'] + ' controls">\n \n </div>\n </div>\n <div class="' + _0x378b5c.classNames['dialog-buttons'] + '">\n <a href="#" onclick="return false" class="' + _0x378b5c.classNames['btn-reset'] + '">'+_this.localization('Reset')+'</a>\n <a href="#" onclick="return false" class="' + _0x378b5c.classNames['btn-clear'] + '">'+_this.localization('Clear')+'</a>\n <a href="#" onclick="return false" style="background-color:#929292;" class="' + _0x378b5c.classNames['btn-close'] + '">'+_this.localization('Close')+'</a>\n </div>\n <div class="' + _0x378b5c.classNames.overlay + '" hidden>\n <div class="' + _0x378b5c.classNames['key-setting-popup'] + '">\n <span>[Select]</span><br />\n <div style="color:#fff !important">'+_this.localization('Press keyboard or gamepad')+'</div>\n </div>\n </div>\n </div>\n ';
2890
2891
let _0x17edbf = '\n <div class="' .concat(_0x378b5c.classNames['tabs-panel'], '" id="controls-{index}" hidden>\n <div>\n <div style="">\n <div class="gamepad" style="font-size:12px">Connected gamepad: <span class="gamepad-name">n/a</span></div>\n </div>\n <div style="width:25%;float:left">&nbsp;</div>\n <div style="font-size:12px;width:50%;float:left">\n <div class="row">\n <div style="text-align:center;width:50%;float:left">'+_this.localization('Gamepad')+'</div>\n <div style="text-align:center;width:50%;float:left">'+_this.localization('Keyboard')+'</div>\n </div>\n </div>\n <div style="clear:both"></div>\n </div>\n </div>'),
2892
_0x2c1832 = '\n <div class="' .concat(_0x378b5c.classNames['button-container'], '" data-id="{id}" data-index="{index}" data-label="{label}" style="margin-bottom:10px">\n <div style="width:25%;float:left;font-size:12px">\n <label>{label}:</label>\n </div>\n <div style="width:50%;float:left">\n <div>\n <div style="width:50%;float:left;padding: 0 5px;">\n <input style="text-align:center;height:25px;width: 100%;" type="text" data-id="{id}" data-value="" data-type="2" data-index="{index}" readonly="" placeholder="">\n </div>\n <div style="width:50%;float:left;padding: 0 5px;">\n <input style="text-align:center;height:25px;width: 100%;" type="text" data-id="{id}" data-value="" data-type="1" data-index="{index}" readonly="" placeholder="">\n </div>\n <div style="clear:both"></div>\n </div>\n </div>\n <div style="width:25%;float:left">\n <a class="').concat(_0x378b5c.classNames.set, '" href="#" onclick="return false">'+_this.localization('Set')+'</a>\n </div>\n <div style="clear:both"></div>\n </div>')
2893
let _0x48ee51;
2894
if ('nes' === getSystem(_this.system, true)) {
2895
_0x48ee51 = {
2896
0: 'B',
2897
2: 'SELECT',
2898
3: 'START',
2899
4: 'UP',
2900
5: 'DOWN',
2901
6: 'LEFT',
2902
7: 'RIGHT',
2903
8: 'A',
2904
24: _this.localization('QUICK SAVE STATE'),
2905
25: _this.localization('QUICK LOAD STATE'),
2906
26: _this.localization('CHANGE STATE SLOT')
2907
}
2908
} else if ('snes' === getSystem(_this.system, true)) {
2909
_0x48ee51 = {
2910
0: 'B',
2911
1: 'Y',
2912
2: 'SELECT',
2913
3: 'START',
2914
4: 'UP',
2915
5: 'DOWN',
2916
6: 'LEFT',
2917
7: 'RIGHT',
2918
8: 'A',
2919
9: 'X',
2920
10: 'L',
2921
11: 'R',
2922
24: _this.localization('QUICK SAVE STATE'),
2923
25: _this.localization('QUICK LOAD STATE'),
2924
26: _this.localization('CHANGE STATE SLOT')
2925
};
2926
} else if ('n64' === getSystem(_this.system, true)) {
2927
_0x48ee51 = {
2928
0: 'B',
2929
3: 'START',
2930
4: 'UP',
2931
5: 'DOWN',
2932
6: 'LEFT',
2933
7: 'RIGHT',
2934
8: 'A',
2935
10: 'L',
2936
11: 'R',
2937
12: 'Z',
2938
19: 'L STICK UP',
2939
18: 'L STICK DOWN',
2940
17: 'L STICK LEFT',
2941
16: 'L STICK RIGHT',
2942
23: 'R STICK UP',
2943
22: 'R STICK DOWN',
2944
21: 'R STICK LEFT',
2945
20: 'R STICK RIGHT',
2946
24: _this.localization('QUICK SAVE STATE'),
2947
25: _this.localization('QUICK LOAD STATE'),
2948
26: _this.localization('CHANGE STATE SLOT')
2949
};
2950
// The new nintendo 64 core has new default buttons
2951
if (_this.coreVer === 2) {
2952
_0x48ee51[0] = 'A';
2953
_0x48ee51[1] = 'B';
2954
delete _0x48ee51[8];
2955
}
2956
} else if ('nds' === getSystem(_this.system, true)) {
2957
_0x48ee51 = {
2958
0: 'B',
2959
1: 'Y',
2960
2: 'SELECT',
2961
3: 'START',
2962
4: 'UP',
2963
5: 'DOWN',
2964
6: 'LEFT',
2965
7: 'RIGHT',
2966
8: 'A',
2967
9: 'X',
2968
10: 'L',
2969
11: 'R',
2970
14: 'Microphone',
2971
24: _this.localization('QUICK SAVE STATE'),
2972
25: _this.localization('QUICK LOAD STATE'),
2973
26: _this.localization('CHANGE STATE SLOT')
2974
};
2975
} else {
2976
_0x48ee51 = {
2977
0: 'B',
2978
1: 'Y',
2979
2: 'SELECT',
2980
3: 'START',
2981
4: 'UP',
2982
5: 'DOWN',
2983
6: 'LEFT',
2984
7: 'RIGHT',
2985
8: 'A',
2986
9: 'X',
2987
10: 'L',
2988
11: 'R',
2989
12: 'L2',
2990
13: 'R2',
2991
14: 'L3',
2992
15: 'R3',
2993
19: 'L STICK UP',
2994
18: 'L STICK DOWN',
2995
17: 'L STICK LEFT',
2996
16: 'L STICK RIGHT',
2997
23: 'R STICK UP',
2998
22: 'R STICK DOWN',
2999
21: 'R STICK LEFT',
3000
20: 'R STICK RIGHT',
3001
24: _this.localization('QUICK SAVE STATE'),
3002
25: _this.localization('QUICK LOAD STATE'),
3003
26: _this.localization('CHANGE STATE SLOT')
3004
};
3005
}
3006
if (['arcade', 'mame'].includes(getSystem(_this.system, true))) {
3007
_0x48ee51[2] = _this.localization('INSERT COIN');
3008
}
3009
if (_this.statesSupported === false) {
3010
delete _0x48ee51[24];
3011
delete _0x48ee51[25];
3012
delete _0x48ee51[26];
3013
}
3014
3015
for (let _0x501790 = [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], _0x50fd12 = function(_0x88827f) {
3016
_this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['tabs-content'])).innerHTML += _0x17edbf.replace(/{index}/g, _0x88827f), _0x501790.forEach(function(_0x1bf162) {
3017
_0x48ee51[_0x1bf162] && (_this.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x88827f)).innerHTML += _0x2c1832.replace(/{index}/g, _0x88827f).replace(/{id}/g, _0x1bf162).replace(/{label}/g, _0x48ee51[_0x1bf162]));
3018
}), _this.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_this.elements.dialogs.gamepad.querySelector('[data-id="16"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _this.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_this.elements.dialogs.gamepad.querySelector('[data-id="17"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _this.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_this.elements.dialogs.gamepad.querySelector('[data-id="18"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _this.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_this.elements.dialogs.gamepad.querySelector('[data-id="19"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _this.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_this.elements.dialogs.gamepad.querySelector('[data-id="20"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _this.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_this.elements.dialogs.gamepad.querySelector('[data-id="21"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _this.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_this.elements.dialogs.gamepad.querySelector('[data-id="22"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc'), _this.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="' .concat(_0x88827f, '"][data-type="2"]')) && (_this.elements.dialogs.gamepad.querySelector('[data-id="23"][data-index="' .concat(_0x88827f, '"][data-type="2"]')).style.backgroundColor = '#ccc');
3019
}, _0x3f0824 = 0; _0x3f0824 <= 3; _0x3f0824 += 1) _0x50fd12(_0x3f0824);
3020
Object.keys(_0x378b5c.controllers).forEach(function(_0x23d419) {
3021
_0x378b5c.controllers[_0x23d419] && Object.keys(_0x378b5c.controllers[_0x23d419]).forEach(function(_0x21e62d) {
3022
let _0x294e35 = _this.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x21e62d, '"][data-index="').concat(_0x23d419, '"][data-type="1"]')),
3023
_0x1849bc = _this.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x21e62d, '"][data-index="').concat(_0x23d419, '"][data-type="2"]'));
3024
if (!_0x294e35 || !_0x1849bc) return false;
3025
let _0x19d43b = _0x378b5c.controllers[_0x23d419][_0x21e62d];
3026
_0x19d43b && (_0x19d43b.type && 1 !== parseInt(_0x19d43b.type, 0xa) ? _0x1849bc.value = '' : _0x19d43b.value && (_0x294e35.value = _0x378b5c.keyMap[_0x19d43b.value] || '', _0x294e35.setAttribute('data-value', _0x19d43b.value)), _0x19d43b.value2 && (_0x1849bc.value = isNaN(_0x19d43b.value2) ? (_0x19d43b.value2) : ('button ' .concat(parseInt(_0x19d43b.value2, 0xa) + 1)), _0x1849bc.setAttribute('data-value', _0x19d43b.value2)));
3027
});
3028
}), _0x1093f4.call(this, _this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-close'])), 'click', function(_0x5f19bd) {
3029
let _0x2c1832 = _this.elements.dialogs.gamepad.querySelectorAll('input'),
3030
_0x2844f7 = {};
3031
return Array.from(_0x2c1832).forEach(function(_0x33c024) {
3032
let _0x5f19bd, _0x2c1832 = _0x33c024.getAttribute('data-index'),
3033
_0x124d0a = _0x33c024.getAttribute('data-value');
3034
2 === parseInt(_0x33c024.getAttribute('data-type'), 0xa) && (_0x5f19bd = _0x33c024.getAttribute('data-value'));
3035
let _0x54b9af = _0x33c024.getAttribute('data-id');
3036
_0x2844f7[_0x2c1832] || (_0x2844f7[_0x2c1832] = {}), _0x2844f7[_0x2c1832][_0x54b9af] || (_0x2844f7[_0x2c1832][_0x54b9af] = {}), _0x124d0a && (_0x2844f7[_0x2c1832][_0x54b9af].value = _0x124d0a), _0x5f19bd && (_0x2844f7[_0x2c1832][_0x54b9af].value2 = _0x5f19bd);
3037
}), _0x2593da.storage.set({
3038
'controllers': _0x2844f7
3039
}), _0x378b5c.controllers = _0x2844f7, _0x132da7(_this.elements.dialogs.gamepad, true), _this.elements.container.focus(), _0x5f19bd.stopPropagation(), false;
3040
}), _0x1093f4.call(this, _this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-reset'])), 'click', function(_0x5f19bd) {
3041
_0x378b5c.controllers = JSON.parse(JSON.stringify(_0x378b5c.defaultControllers))
3042
localStorage.removeItem(_0x2593da.storage.key)
3043
let _0x2c1832 = _this.elements.dialogs.gamepad.querySelectorAll('input')
3044
for (let i=0; i<_0x2c1832.length; i++) {
3045
let player = _0x2c1832[i].getAttribute('data-index')
3046
let controlOrGamepad = _0x2c1832[i].getAttribute('data-type')
3047
let buttonId = _0x2c1832[i].getAttribute('data-id')
3048
let a = (controlOrGamepad == 1) ? 'value' : 'value2'
3049
if (_0x378b5c.defaultControllers[player] && _0x378b5c.defaultControllers[player][buttonId] && _0x378b5c.defaultControllers[player][buttonId][a]) {
3050
if (controlOrGamepad == 1) {
3051
_0x2c1832[i].value = _0x378b5c.keyMap[_0x378b5c.defaultControllers[player][buttonId][a]]
3052
} else {
3053
_0x2c1832[i].value = 'button ' + (parseInt(_0x378b5c.defaultControllers[player][buttonId][a])+1)
3054
}
3055
_0x2c1832[i].setAttribute('data-value', _0x378b5c.defaultControllers[player][buttonId][a])
3056
} else {
3057
_0x2c1832[i].value = ''
3058
_0x2c1832[i].setAttribute('data-value', '')
3059
}
3060
}
3061
}), _0x1093f4.call(this, _this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['btn-clear'])), 'click', function(_0x5f19bd) {
3062
let c = {0:{}, 1:{}, 2:{}, 3:{}};
3063
for (let k in _0x48ee51) {
3064
c[0][k] = {};
3065
c[1][k] = {};
3066
c[2][k] = {};
3067
c[3][k] = {};
3068
}
3069
_0x378b5c.controllers = c
3070
localStorage.setItem(_0x2593da.storage.key, JSON.stringify({controllers: _0x378b5c.controllers}))
3071
let _0x2c1832 = _this.elements.dialogs.gamepad.querySelectorAll('input')
3072
for (let i=0; i<_0x2c1832.length; i++) {
3073
_0x2c1832[i].value = '';
3074
_0x2c1832[i].setAttribute('data-value', '');
3075
}
3076
}), Array.from(_this.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames.tabs, ' li'))).forEach(function(_0x523f7b) {
3077
_0x1093f4.call(_this, _0x523f7b, 'mousedown', function(_0xa99a78) {
3078
_0x3a8e2f(_this.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames.tabs, ' li')), _0x378b5c.classNames.active, false);
3079
_0x3a8e2f(_0x523f7b, _0x378b5c.classNames.active, true);
3080
let _0xb8a227 = _0x523f7b.querySelector('a').getAttribute('aria-controls');
3081
Array.from(_this.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames['tabs-content'], ' .').concat(_0x378b5c.classNames['tabs-panel']))).forEach(function(_0x1c29a4) {
3082
_0x132da7(_0x1c29a4, true);
3083
});
3084
_0x132da7(_this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames['tabs-content'], ' #').concat(_0xb8a227)), false);
3085
_0xa99a78.stopPropagation();
3086
return false;
3087
});
3088
}), _0xbae705.call(_this, _this.elements.dialogs.gamepad.querySelector('[aria-controls="controls-0"]').parentNode, 'mousedown');
3089
let _0x11b11a = _this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay));
3090
_0x1093f4.call(_this, _0x11b11a, 'mousedown', function(_0x15c7de) {
3091
_0x132da7(_0x11b11a, true), _0x15c7de.stopPropagation();
3092
}), Array.from(_this.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames['button-container']))).forEach(function(_0x16f092) {
3093
_0x1093f4.call(_this, _0x16f092, 'mousedown', function(_0xdb1c93) {
3094
_0xbae705.call(_this, _0x16f092.querySelector('a.' .concat(_0x378b5c.classNames.set)), _0xdb1c93.type, true, {});
3095
});
3096
}), Array.from(_this.elements.dialogs.gamepad.querySelectorAll('.' .concat(_0x378b5c.classNames['tabs-panel'], ' a.').concat(_0x378b5c.classNames.set))).forEach(function(_0x397818) {
3097
_0x1093f4.call(_this, _0x397818, 'mousedown', function(_0x1e1d79) {
3098
let _0x2c1832 = _0x397818.parentNode.parentNode,
3099
_0x4e649c = _0x2c1832.getAttribute('data-id'),
3100
_0x431719 = _0x2c1832.getAttribute('data-index'),
3101
_0x4a6f6f = _0x2c1832.getAttribute('data-label');
3102
_0x132da7(_0x11b11a, false), _0x11b11a.setAttribute('data-id', _0x4e649c);
3103
_0x11b11a.setAttribute('data-index', _0x431719);
3104
let _0x179623 = '[ ' .concat(_0x4a6f6f, ' ]');
3105
_0x378b5c.gamepad.gamepads[_0x431719] && _0x4e649c < 16 ? _0x179623 += '<br /><span style="font-size:12px">Gamepad:' .concat(_0x378b5c.gamepad.gamepads[_0x431719].id, '</span><br />'+_this.localization('Press keyboard or gamepad')+'<br/>'+_this.localization('Press escape (esc) to clear')) : _0x179623 += '<br />Press keyboard<br/>'+_this.localization('Press escape (esc) to clear'), _0x11b11a.querySelector('.' .concat(_0x378b5c.classNames['key-setting-popup'])).innerHTML = _0x179623, _0x1e1d79.stopPropagation();
3106
});
3107
});
3108
},
3109
'setCacheDialog': function() {
3110
let _this = this;
3111
_this.elements.dialogs.cache.innerHTML = '\n <div class="'+_0x378b5c.classNames['dialog-container']+'">\n <div class="'+_0x378b5c.classNames['dialog-title']+'">\n <h4>'+_this.localization('Cache Manager')+'</h4>\n </div>\n <div class="'+_0x378b5c.classNames['dialog-content']+'">\n\n </div>\n <div class="'+_0x378b5c.classNames['dialog-buttons']+'">\n <a href="#" onclick="return false" class="'+_0x378b5c.classNames['btn-clear-all']+'">'+_this.localization('Clear All')+'</a>\n <a href="#" onclick="return false" class="'+_0x378b5c.classNames['btn-cancel']+'">'+_this.localization('Close')+'</a>\n </div>\n </div>\n ';
3112
3113
_0x1093f4.call(this, _this.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x5d6721) {
3114
return _0x132da7(_this.elements.dialogs.cache, true), _this.elements.container.focus(), _0x5d6721.stopPropagation(), false;
3115
})
3116
_0x1093f4.call(this, _this.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['btn-clear-all'])), 'click', function(_0x5d6721) {
3117
return _0x27f4c4.romdb && (_0x27f4c4.romdb.clear(), _this.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-content'])).innerHTML = '<div style="text-align:center">'+_this.localization('Empty')+'</div>'), _0x46992d.stopPropagation(), false;
3118
})
3119
_0x1093f4.call(this, _this.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-title'], ' a')), 'click', function(_0x46992d) {
3120
return _0x27f4c4.romdb && (_0x27f4c4.romdb.clear(), _this.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-content'])).innerHTML = '<div style="text-align:center">'+_this.localization('Empty')+'</div>'), _0x46992d.stopPropagation(), false;
3121
})
3122
},
3123
'showLoading': function(_0x108b55) {
3124
_0x4d8495.show('modal-6ed698f3d04061f5', {
3125
'closeByEsckey': false
3126
}), _0x108b55 && console.log(''), _0x132da7(this.elements.dialogs.loading, false);
3127
},
3128
'hideLoading': function() {
3129
_0x4d8495.close(), _0x132da7(this.elements.dialogs.loading, true);
3130
},
3131
'setLoadingDialog': function() {
3132
this.elements.dialogs.loading && (this.elements.dialogs.loading.innerHTML = '\n <div class="' .concat(_0x378b5c.classNames.modal, ' ').concat(_0x378b5c.classNames['micromodal-slide'], '" id="modal-6ed698f3d04061f5" aria-hidden="true">\n <div class="').concat(_0x378b5c.classNames.modal__overlay, '" tabindex="-1">\n <div class="').concat(_0x378b5c.classNames.modal__container, '" role="dialog" aria-modal="true" aria-labelledby="modal-6ed698f3d04061f5-title">\n '+this.localization('Loading')+'...\n </div>\n </div>\n </div>'));
3133
},
3134
'setCheatDialog': function() {
3135
let _this = this;
3136
if (_this.elements.dialogs.cheat) {
3137
_this.elements.dialogs.cheat.innerHTML = '\n <div class="' .concat(_0x378b5c.classNames['dialog-container'], '">\n <div class="').concat(_0x378b5c.classNames['dialog-title'], '">\n <h4>Cheats</h4>\n </div>\n <div class="').concat(_0x378b5c.classNames['dialog-content'], '">\n <div class="').concat(_0x378b5c.classNames['cheats-list'], '">\n \n </div>\n </div>\n <div class="').concat(_0x378b5c.classNames['dialog-buttons'], '">\n <a href="#" onclick="return false" class="').concat(_0x378b5c.classNames['cheats-add'], '">'+_this.localization('Add Cheat')+'</a>\n <a href="#" onclick="return false" class="').concat(_0x378b5c.classNames['btn-cancel'], '">Close</a>\n </div>\n </div>\n\n \n\n <div class="').concat(_0x378b5c.classNames.modal, ' ').concat(_0x378b5c.classNames['micromodal-slide'], '" id="modal-85cd7a1c543a484b" aria-hidden="true">\n <div class="').concat(_0x378b5c.classNames.modal__overlay, '" tabindex="-1" data-modal-close>\n <div class="').concat(_0x378b5c.classNames.modal__container, '" style="width:100%" role="dialog" aria-modal="true" aria-labelledby="modal-85cd7a1c543a484b-title">\n <div class="').concat(_0x378b5c.classNames.modal__header, '">\n <h2 class="').concat(_0x378b5c.classNames.modal__title, '" id="modal-85cd7a1c543a484b-title">\n '+_this.localization('Add Cheat Code')+'\n </h2>\n <button class="').concat(_0x378b5c.classNames.modal__close, '" aria-label="Close modal" data-modal-close></button>\n </div>\n <main class="').concat(_0x378b5c.classNames.modal__content, '" id="modal-85cd7a1c543a484b-content">\n\n <div class="').concat(_0x378b5c.classNames.modal__errmsg, '"></div>\n <strong>'+_this.localization('Code')+'</strong><br />\n <textarea style="width:100%;height:80px;" class="').concat(_0x378b5c.classNames['cheat-code-input'], '"></textarea><br />\n <strong>'+_this.localization('Description')+'</strong><br />\n <input type="text" class="').concat(_0x378b5c.classNames['cheat-name-input'], '" /><br />\n\n </main>\n <footer class="').concat(_0x378b5c.classNames.modal__footer, '">\n <button class="').concat(_0x378b5c.classNames.modal__btn, ' ').concat(_0x378b5c.classNames['modal__btn-primary'], '">'+_this.localization('Submit')+'</button>\n <button class="').concat(_0x378b5c.classNames.modal__btn, '" data-modal-close aria-label="Close">'+_this.localization('Close')+'</button>\n </footer>\n </div>\n </div>\n </div>\n ');
3138
let _0x17edbf = _this.elements.dialogs.cheat.querySelector('#modal-85cd7a1c543a484b');
3139
_0x1093f4.call(this, _this.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['cheats-add'])), 'click', function(_0x2a74b5) {
3140
return _0x4d8495.show('modal-85cd7a1c543a484b', {
3141
'closeTrigger': 'data-modal-close'
3142
}), false;
3143
});
3144
let _0x2c1832 = _this.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['cheats-list']));
3145
_0x1093f4.call(this, _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x1c01ce) {
3146
let _0x184e2c = _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-name-input'])).value,
3147
_0x15ccbb = _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-code-input'])).value;
3148
if (_0x184e2c && _0x15ccbb) {
3149
let _0x2c3108 = _0x2c1832.querySelectorAll('input:checked');
3150
_0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-name-input'])).value = '', _0x17edbf.querySelector('.' .concat(_0x378b5c.classNames['cheat-code-input'])).value = '', _0x4d8495.close();
3151
let _0x5b2cff = _this.cheats.length;
3152
_this.cheats.push([_0x184e2c, _0x15ccbb]), _0x2c1832.innerHTML += '<div class="' .concat(_0x378b5c.classNames['ejs-switch'], '">\n <input type="checkbox" value="').concat(_0x5b2cff, '" id="ejs-cheat-switch-').concat(_0x5b2cff, '">\n <label for="ejs-cheat-switch-').concat(_0x5b2cff, '">').concat(_0x184e2c, '</label>\n <a href="#" data-idx="').concat(_0x5b2cff, '" onclick="return false" class="').concat(_0x378b5c.classNames['ejs-delete-cheat'], '">&times;</a>\n </div>'), _0x2c3108.forEach(function(_0x1fb248, _0x7bb84b) {
3153
_0x2c1832.querySelector('#ejs-cheat-switch-' .concat(_0x7bb84b)).setAttribute('checked', 'checked');
3154
});
3155
}
3156
if ('localStorage' in window && _this.getStartName()) {
3157
localStorage.setItem('' .concat(_this.system, '-').concat(_this.getStartName(), '-cheats'), JSON.stringify(_this.cheats));
3158
_0x1c01ce.stopPropagation();
3159
}
3160
return false;
3161
});
3162
let _0x257001 = function() {
3163
if ('localStorage' in window && _this.getStartName()) {
3164
let _0x17edbf = localStorage.getItem('' .concat(_this.system, '-').concat(_this.getStartName(), '-cheats'));
3165
try {
3166
_0x17edbf = JSON.parse(_0x17edbf);
3167
} catch (_0x101b3e) {}
3168
_0x17edbf && (_this.cheats = _0x17edbf);
3169
}
3170
_0x2c1832.innerHTML = '';
3171
if (_this.cheats && Array.isArray(_this.cheats)) {
3172
_this.cheats.forEach(function(_0x245035, _0x116996) {
3173
let _0x4ac35a = _0x245035[0];
3174
_0x245035[1];
3175
_0x2c1832.innerHTML += '<div class="' .concat(_0x378b5c.classNames['ejs-switch'], '">\n <input type="checkbox" value="').concat(_0x116996, '" id="ejs-cheat-switch-').concat(_0x116996, '">\n <label for="ejs-cheat-switch-').concat(_0x116996, '">').concat(_0x4ac35a, '</label>\n <a href="#" data-idx="').concat(_0x116996, '" onclick="return false" class="').concat(_0x378b5c.classNames['ejs-delete-cheat'], '">&times;</a>\n </div>');
3176
});
3177
}
3178
};
3179
_0x1093f4.call(_this, _0x2c1832, 'click', function(_0x576733) {
3180
if (_0x576733.target && _0x576733.target.classList.contains(_0x378b5c.classNames['ejs-delete-cheat']) && _0x576733.target.getAttribute('data-idx')) {
3181
let _0x5b10b7 = _0x576733.target.getAttribute('data-idx');
3182
_this.cheats.splice(_0x5b10b7, 1);
3183
if ('localStorage' in window && _this.getStartName()) {
3184
localStorage.setItem('' .concat(_this.system, '-').concat(_this.getStartName(), '-cheats'), JSON.stringify(_this.cheats));
3185
}
3186
let _0x557895 = [];
3187
_0x2c1832.querySelectorAll('input').forEach(function(_0xab0ba8, _0x1f3597) {
3188
_0x557895[_0x1f3597] = !!_0x2c1832.querySelector('#ejs-cheat-switch-' .concat(_0x1f3597, ':checked'));
3189
}), _0x557895.splice(_0x5b10b7, 1), _0x257001(), _0x557895.forEach(function(_0x2e22be, _0x2247c4) {
3190
_0x2e22be && _0x2c1832.querySelector('#ejs-cheat-switch-' .concat(_0x2247c4)).setAttribute('checked', 'checked');
3191
});
3192
}
3193
return _0x576733.stopPropagation(), false;
3194
}), _0x1093f4.call(_this, _this.elements.container, 'start-game', function(_0x4c266e) {
3195
_0x257001();
3196
}), _0x1093f4.call(this, _this.elements.dialogs.cheat.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x5785f6) {
3197
_0x378b5c.resetCheat();
3198
_0x2c1832.querySelectorAll('input:checked').forEach(function(_0xeb7426, _0x45b02d) {
3199
let _0x27e2c1 = _this.cheats[_0xeb7426.value];
3200
_0x27e2c1 && _0x378b5c.setCheat(_0x45b02d, 1, _0x27e2c1[1]);
3201
});
3202
_0x132da7(_this.elements.dialogs.cheat, true);
3203
_this.elements.container.focus();
3204
return false;
3205
}), 'arcade' !== getSystem(_this.system, true) && 'mame' !== getSystem(_this.system, true) && 'mame2003' !== getSystem(_this.system, true) && 'mame2010' !== getSystem(_this.system, true) || (_0x1e2c68.element(_this.elements.buttons.cheat) && _0x132da7(_this.elements.buttons.cheat, true), _0x378b5c.allowCheat = false), _0x378b5c.setCheat || (_0x132da7(_this.elements.buttons.cheat, true), _0x378b5c.allowCheat = false);
3206
}
3207
},
3208
'setNetplayDialog': function() {
3209
var _0xa88a13 = this,
3210
_0x17edbf = this;
3211
if (_0x17edbf.elements.dialogs.netplay) {
3212
_0x17edbf.elements.dialogs.netplay.innerHTML = '\n <div class="' .concat(_0x378b5c.classNames['dialog-container'], '">\n <div class="').concat(_0x378b5c.classNames['dialog-title'], '">\n <h4>'+_0x17edbf.localization('Netplay')+'</h4>\n </div>\n <div class="').concat(_0x378b5c.classNames['dialog-content'], '">\n <div class="').concat(_0x378b5c.classNames['netplay-roomlist'], '" hidden>\n <strong>'+_0x17edbf.localization('Rooms')+'</strong>\n <table style="width:100%" cellspacing=0>\n <thead>\n <tr>\n <td>'+_0x17edbf.localization('Room Name')+'</td>\n <td>'+_0x17edbf.localization('Players')+'</td>\n <td></td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td></td>\n <td></td>\n <td></td>\n </tr>\n </tbody>\n </table>\n </div>\n\n <div class="').concat(_0x378b5c.classNames['netplay-room'], '" hidden>\n <strong>'+_0x17edbf.localization('Room Name')+'</strong>\n <div data-room-password>'+_0x17edbf.localization('Password')+': <span></span></div>\n <table style="width:100%" cellspacing="0">\n <thead>\n <tr>\n <td>'+_0x17edbf.localization('Player')+'</td>\n <td>'+_0x17edbf.localization('Name')+'</td>\n <td></td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>1</td>\n <td>'+_0x17edbf.localization('Name')+' 1</td>\n <td></td>\n </tr>\n <tr>\n <td>2</td>\n <td>'+_0x17edbf.localization('Name')+' 2</td>\n <td></td>\n </tr>\n <tr>\n <td>3</td>\n <td>'+_0x17edbf.localization('Name')+' 3</td>\n <td></td>\n </tr>\n <tr>\n <td>4</td>\n <td>'+_0x17edbf.localization('Name')+' 4</td>\n <td></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n <div class="').concat(_0x378b5c.classNames['dialog-buttons'], '">\n <a href="#" onclick="return false" class="').concat(_0x378b5c.classNames['btn-quit'], '">'+_0x17edbf.localization('Quit Room')+'</a>\n <a href="#" onclick="return false" class="').concat(_0x378b5c.classNames['btn-create-room'], '">'+_0x17edbf.localization('Create a Room')+'</a>\n <a href="#" onclick="return false" class="').concat(_0x378b5c.classNames['btn-cancel'], '">'+_0x17edbf.localization('Close')+'</a>\n </div>\n </div>\n\n \n <div class="').concat(_0x378b5c.classNames.modal, ' ').concat(_0x378b5c.classNames['micromodal-slide'], '" id="modal-9de6c4e9ce2b9361" aria-hidden="true">\n <div class="').concat(_0x378b5c.classNames.modal__overlay, '" tabindex="-1">\n <div class="').concat(_0x378b5c.classNames.modal__container, '" role="dialog" aria-modal="true" aria-labelledby="modal-9de6c4e9ce2b9361-title">\n <div class="').concat(_0x378b5c.classNames.modal__header, '">\n <h2 class="').concat(_0x378b5c.classNames.modal__title, '" id="modal-9de6c4e9ce2b9361-title">\n '+_0x17edbf.localization('Set Player Name')+'\n </h2>\n </div>\n <main class="').concat(_0x378b5c.classNames.modal__content, '" id="modal-9de6c4e9ce2b9361-content">\n\n <div class="').concat(_0x378b5c.classNames.modal__errmsg, '"></div>\n <strong>'+_0x17edbf.localization('Player Name')+'</strong><br />\n <input type="text" maxlength="10" class="').concat(_0x378b5c.classNames['netplay-player-name'], '" /><br />\n\n </main>\n <footer class="').concat(_0x378b5c.classNames.modal__footer, '">\n <button class="').concat(_0x378b5c.classNames.modal__btn, ' ').concat(_0x378b5c.classNames['modal__btn-primary'], '">'+_0x17edbf.localization('Submit')+'</button>\n </footer>\n </div>\n </div>\n </div>\n \n <div class="').concat(_0x378b5c.classNames.modal, ' ').concat(_0x378b5c.classNames['micromodal-slide'], '" id="modal-85cd7a1c543a484a" aria-hidden="true">\n <div class="').concat(_0x378b5c.classNames.modal__overlay, '" tabindex="-1" data-modal-close>\n <div class="').concat(_0x378b5c.classNames.modal__container, '" role="dialog" aria-modal="true" aria-labelledby="modal-85cd7a1c543a484a-title">\n <div class="').concat(_0x378b5c.classNames.modal__header, '">\n <h2 class="').concat(_0x378b5c.classNames.modal__title, '" id="modal-85cd7a1c543a484a-title">\n '+_0x17edbf.localization('Create a Room')+'\n </h2>\n <button class="').concat(_0x378b5c.classNames.modal__close, '" aria-label="Close modal" data-modal-close></button>\n </div>\n <main class="').concat(_0x378b5c.classNames.modal__content, '" id="modal-85cd7a1c543a484a-content">\n\n <div class="').concat(_0x378b5c.classNames.modal__errmsg, '"></div>\n <strong>'+_0x17edbf.localization('Room Name')+'</strong><br />\n <input type="text" maxlength="10" class="').concat(_0x378b5c.classNames['netplay-room-name-input'], '" /><br />\n <strong>Max Players</strong><br />\n <select data-max-players>\n <option value="2">2</option>\n <option value="3">3</option>\n <option value="4">4</option>\n </select>\n <br />\n <strong>'+_0x17edbf.localization('Password (optional)')+'</strong><br />\n <input type="text" maxlength="10" class="').concat(_0x378b5c.classNames['netplay-room-password-input'], '" /><br />\n\n </main>\n <footer class="').concat(_0x378b5c.classNames.modal__footer, '">\n <button class="').concat(_0x378b5c.classNames.modal__btn, ' ').concat(_0x378b5c.classNames['modal__btn-primary'], '">'+_0x17edbf.localization('Submit')+'</button>\n <button class="').concat(_0x378b5c.classNames.modal__btn, '" data-modal-close aria-label="Close">'+_0x17edbf.localization('Close')+'</button>\n </footer>\n </div>\n </div>\n </div>\n \n <div class="').concat(_0x378b5c.classNames.modal, ' ').concat(_0x378b5c.classNames['micromodal-slide'], '" id="modal-5aa765d61d8327de" aria-hidden="true">\n <div class="').concat(_0x378b5c.classNames.modal__overlay, '" tabindex="-1" data-modal-close>\n <div class="').concat(_0x378b5c.classNames.modal__container, '" role="dialog" aria-modal="true" aria-labelledby="modal-5aa765d61d8327de-title">\n <div class="').concat(_0x378b5c.classNames.modal__header, '">\n <h2 class="').concat(_0x378b5c.classNames.modal__title, '" id="modal-5aa765d61d8327de-title">\n '+_0x17edbf.localization('Password')+'\n </h2>\n <button class="').concat(_0x378b5c.classNames.modal__close, '" aria-label="Close modal" data-modal-close></button>\n </div>\n <main class="').concat(_0x378b5c.classNames.modal__content, '" id="modal-5aa765d61d8327de-content">\n\n <div class="').concat(_0x378b5c.classNames.modal__errmsg, '"></div>\n <input type="text" maxlength="10" class="').concat(_0x378b5c.classNames['netplay-room-password-input'], '" /><br />\n\n </main>\n <footer class="').concat(_0x378b5c.classNames.modal__footer, '">\n <button class="').concat(_0x378b5c.classNames.modal__btn, ' ').concat(_0x378b5c.classNames['modal__btn-primary'], '">'+_0x17edbf.localization('Submit')+'</button>\n <button class="').concat(_0x378b5c.classNames.modal__btn, '" data-modal-close aria-label="Close">'+_0x17edbf.localization('Close')+'</button>\n </footer>\n </div>\n </div>\n </div>\n \n \n <div class="').concat(_0x378b5c.classNames.modal, ' ').concat(_0x378b5c.classNames['micromodal-slide'], '" id="modal-7d8fd50ed642340b" aria-hidden="true">\n <div class="').concat(_0x378b5c.classNames.modal__overlay, '" tabindex="-1" data-modal-close>\n <div class="').concat(_0x378b5c.classNames.modal__container, '" role="dialog" aria-modal="true" aria-labelledby="modal-7d8fd50ed642340b-title">\n <div class="').concat(_0x378b5c.classNames.modal__header, '">\n <h2 class="').concat(_0x378b5c.classNames.modal__title, '" id="modal-7d8fd50ed642340b-title"></h2>\n <button class="').concat(_0x378b5c.classNames.modal__close, '" aria-label="Close modal" data-modal-close></button>\n </div>\n <main class="').concat(_0x378b5c.classNames.modal__content, '" id="modal-7d8fd50ed642340b-content">\n \n </main>\n <footer class="').concat(_0x378b5c.classNames.modal__footer, '">\n <button class="').concat(_0x378b5c.classNames.modal__btn, ' ').concat(_0x378b5c.classNames['modal__btn-primary'], '" data-modal-close>OK</button>\n </footer>\n </div>\n </div>\n </div>\n \n '), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-cancel'])), 'click', function(_0x3d4554) {
3213
return _0x132da7(_0x17edbf.elements.dialogs.netplay, true), _0x378b5c.disableControl(!0x1), _0x378b5c.stopLoadRooms(), _0x3d4554.stopPropagation(), _0x17edbf.elements.container.focus(), !0x1;
3214
}), window.setInterval(function() {
3215
var _0xa88a13 = '<ul>';
3216
_0x378b5c.players.forEach(function(_0x20c45e, _0x14d0b2) {
3217
var _0x57ec9c = null;
3218
_0x20c45e ? (_0x378b5c.connection.peers[_0x20c45e] ? _0x57ec9c = _0x378b5c.connection.peers[_0x20c45e].extra : _0x378b5c.connection.userid === _0x20c45e && (_0x57ec9c = _0x378b5c.connection.extra), _0xa88a13 += '<li>' .concat(_0x14d0b2 + 0x1, '. ').concat(_0x57ec9c.name, '</li>')) : _0xa88a13 += '<li>' .concat(_0x14d0b2 + 0x1, '. </li>');
3219
}), _0xa88a13 += '</ul>', _0x17edbf.elements.widgets.netplay.innerHTML = _0xa88a13;
3220
}, 0x1f4);
3221
var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-9de6c4e9ce2b9361'),
3222
_0x36bde0 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-85cd7a1c543a484a'),
3223
_0x5289c1 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-7d8fd50ed642340b'),
3224
_0x325651 = _0x17edbf.elements.dialogs.netplay.querySelector('#modal-5aa765d61d8327de'),
3225
_0x3d0d28 = {};
3226
3227
_0x378b5c.connection = new _0x4a2390.a();
3228
var _0x10d51e = _0xa88a13.socketUrl;
3229
if (! _0x10d51e.endsWith('/')) {
3230
_0x10d51e += '/';
3231
};
3232
_0x378b5c.connection.socketURL = '/', _0x378b5c.connection.socketURL = _0x10d51e, _0x378b5c.connection.socketMessageEvent = 'emulatorjs-message', _0x378b5c.connection.socketCustomEvent = 'emulatorjs-custom-message';
3233
var _0xda20e9 = _0x59aa33.info();
3234
_0x378b5c.connection.extra = {
3235
'name': _0x378b5c.playerName,
3236
'game_id': _0x17edbf.config.gameId,
3237
'browser_name': _0xda20e9.name,
3238
'room_name': ' ',
3239
'domain': document.domain
3240
}
3241
_0x378b5c.connection.socketMessageEvent = 'netplay';
3242
_0x378b5c.connection.enableFileSharing = true;
3243
_0x378b5c.connection.enableLogs = true;
3244
_0x378b5c.connection.session = {
3245
'data': true
3246
};
3247
_0x378b5c.connection.coreVer = _0x17edbf.coreVer;
3248
_0x378b5c.connection.sdpConstraints.mandatory = {
3249
'OfferToReceiveAudio': false,
3250
'OfferToReceiveVideo': false
3251
}
3252
_0x378b5c.connection.onclose = function() {};
3253
3254
_0x378b5c.connection.iceServers = window.EJS_TURN_URLS;
3255
_0x378b5c.connection.maxParticipantsAllowed = 4;
3256
_0x378b5c.netPlayInitFrame = 0;
3257
var _0x1eb137 = 0,
3258
_0x52eb7d = false;
3259
Module.postMainLoop = function() {
3260
var _0xa88a13;
3261
if (_0x378b5c.currentFrame = parseInt(_0x378b5c.currentFrameNum(), 0xa), _0x378b5c.connected) {
3262
if (_0x1eb137 += 0x1, _0x378b5c.connection.isInitiator) _0x1eb137 >= 0x1 && function() {
3263
for (var _0xa88a13 = [], _0x17edbf = _0x378b5c.currentFrame - 0x1; _0x17edbf < _0x378b5c.currentFrame; _0x17edbf += 0x1) _0x378b5c.inputsData[_0x17edbf] ? _0x378b5c.inputsData[_0x17edbf].forEach(function(_0x2a02da, _0x1b2066) {
3264
_0xa88a13.push('' .concat(_0x2a02da.index, '|').concat(_0x2a02da.key, '|').concat(_0x2a02da.status, '|').concat(_0x2a02da.frame));
3265
}) : _0xa88a13.push('-1|||' .concat(_0x17edbf));
3266
_0x378b5c.connection.send(JSON.stringify({
3267
'act': 'sync-control',
3268
'value': _0xa88a13
3269
})), _0x1eb137 = 0x0, _0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3125e4, _0x31ea67) {
3270
_0x3125e4 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3125e4] = null, delete _0x378b5c.inputsData[_0x3125e4]);
3271
});
3272
}();
3273
else {
3274
if (_0x378b5c.coreOptionData[_0x378b5c.currentFrame]) {
3275
var _0x2c1832 = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].key,
3276
_0x4fd0cc = _0x378b5c.coreOptionData[_0x378b5c.currentFrame].value;
3277
_0x2593da.updateCoreOptions.call(_0x17edbf, _0x2c1832, _0x4fd0cc), delete _0x378b5c.coreOptionData[_0x378b5c.currentFrame];
3278
}
3279
if (_0x378b5c.currentFrame <= 0x0 || _0x378b5c.inputsData[_0x378b5c.currentFrame]) _0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0xa88a13 = _0x378b5c.inputsData[_0x378b5c.currentFrame], _0x378b5c.inputsData[_0x378b5c.currentFrame] = null, delete _0x378b5c.inputsData[_0x378b5c.currentFrame], _0xa88a13 || (_0xa88a13 = []), _0xa88a13.forEach(function(_0x4bb42f, _0x28928a) {
3280
_0x4bb42f.index >= 0x0 && _0x378b5c.simulateInputFn(_0x4bb42f.index, _0x4bb42f.key, _0x4bb42f.status);
3281
});
3282
else {
3283
_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop();
3284
var _0x3a10d1 = !0x1,
3285
_0x42763c = Object.keys(_0x378b5c.inputsData);
3286
0x0 == _0x42763c.length && (_0x3a10d1 = true);
3287
for (var _0x58af15 = 0x0; _0x58af15 < _0x42763c.length; _0x58af15 += 0x1) {
3288
if (_0x42763c[_0x58af15] > _0x378b5c.currentFrame) {
3289
console.log('lost', _0x378b5c.currentFrame), _0x3a10d1 = true;
3290
break;
3291
}
3292
}
3293
_0x3a10d1 ? _0x378b5c.wait || (!_0x52eb7d || _0x52eb7d < new Date().valueOf() - 0xbb8) && (_0x378b5c.inputsData = {}, _0x52eb7d = new Date().valueOf(), _0x378b5c.connection.send(JSON.stringify({
3294
'act': 'sync-mem',
3295
'value': _0x378b5c.connection.userid
3296
}), _0x378b5c.roomMaster)) : (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop());
3297
}
3298
_0x378b5c.currentFrame % 0x64 == 0x0 && Object.keys(_0x378b5c.inputsData).forEach(function(_0x3aa393, _0x3a7829) {
3299
_0x3aa393 < _0x378b5c.currentFrame - 0x32 && (_0x378b5c.inputsData[_0x3aa393] = null, delete _0x378b5c.inputsData[_0x3aa393]);
3300
});
3301
}
3302
}
3303
}
3304
_0x378b5c.connection.onopen = function(_0x4b10d6) {
3305
_0x378b5c.connected = true, _0x378b5c.connection.isInitiator && (-0x1 === _0x378b5c.players.indexOf(_0x4b10d6.userid) && (_0x378b5c.players.filter(function(_0x3eafb3, _0xabd7b7) {
3306
return null == _0x3eafb3;
3307
}).length > 0x0 ? _0x378b5c.players.forEach(function(_0xbf0f19, _0xa9d540) {
3308
null != _0xbf0f19 || _0x378b5c.players.includes(_0x4b10d6.userid) || (_0x378b5c.players[_0xa9d540] = _0x4b10d6.userid);
3309
}) : _0x378b5c.players.push(_0x4b10d6.userid)), _0x378b5c.connection.send(JSON.stringify({
3310
'act': 'get-players-result',
3311
'value': _0x378b5c.players,
3312
'coreOptions': _0x2593da.coreOptionsValues,
3313
'newuser': _0x4b10d6.userid,
3314
'master': _0x378b5c.connection.userid
3315
}))), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf);
3316
}
3317
_0x378b5c.connection.onFileStart = function(_0x50eb3a) {
3318
var _0x2c1832 = _0x50eb3a.name.split('-');
3319
'reset' !== _0x2c1832[0x0] && 0x0 != _0x2c1832[0x0] || (_0x378b5c.inputsData = {}, _0x378b5c.disableControl(true)), _0x378b5c.progressHelper[_0x50eb3a.remoteUserId] = {}, _0x378b5c.progressHelper[_0x50eb3a.remoteUserId].max = _0x50eb3a.maxChunks, _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.isInitiator ? (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop()) : _0x378b5c.inputsData = {};
3320
}
3321
_0x378b5c.connection.onFileProgress = function(_0x44a04b) {
3322
var _0x17edbf = _0x378b5c.progressHelper[_0x44a04b.remoteUserId];
3323
_0x17edbf.current = _0x44a04b.currentPosition || _0x44a04b.maxChunks || _0x17edbf.max;
3324
}
3325
_0x378b5c.connection.onFileEnd = function(_0x45d454) {
3326
_0x378b5c.hideLoading.call(_0x17edbf);
3327
var _0x2c1832 = _0x45d454.name.split('-'),
3328
_0x3795d9 = _0x2c1832[0x0] >> 0x0;
3329
'reset' === _0x2c1832[0x0] ? (_0x3795d9 = 0x0, _0x378b5c.connection.isInitiator ? (_0x378b5c.systemPause(0x0), _0x378b5c.disableControl(!0x1), _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop()) : _0x550f17.a.get(_0x45d454.url, {
3330
'responseType': 'arraybuffer'
3331
}).then(function(_0x37db4c) {
3332
_0x378b5c.inputsData = {};
3333
var _0x2c1832 = new Uint8Array(_0x37db4c.data);
3334
_0x378b5c.loadState(_0x2c1832, _0x3795d9), _0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1, _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop();
3335
})) : 'game.state' === _0x2c1832[0x1] && (_0x378b5c.connection.isInitiator ? (_0x378b5c.openRoom(_0x17edbf), _0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop()) : (_0x378b5c.netPlayInitFrame = _0x3795d9, _0x550f17.a.get(_0x45d454.url, {
3336
'responseType': 'arraybuffer'
3337
}).then(function(_0x4d241b) {
3338
var _0x2c1832 = new Uint8Array(_0x4d241b.data);
3339
_0x378b5c.loadState(_0x2c1832, _0x3795d9), _0x378b5c.wait = !0x1, _0x378b5c.disableInput = !0x1, _0x378b5c.connection.send(JSON.stringify({
3340
'act': 'wait-end',
3341
'value': _0x378b5c.connection.userid
3342
})), _0x378b5c.hideLoading.call(_0x17edbf), _0x17edbf.playing = true, _0x27f4c4.Module.resumeMainLoop();
3343
}))), _0x378b5c.connection.isInitiator || console.log('recv mem end', _0x378b5c.currentFrame, _0x45d454.name);
3344
};
3345
var _0x3bdb35 = !0x1;
3346
_0x378b5c.connection.onmessage = function(_0x32e81a) {
3347
var _0x2c1832, _0x2dca58 = _0x32e81a.data || _0x32e81a;
3348
try {
3349
_0x2c1832 = JSON.parse(_0x2dca58);
3350
} catch (_0x3fb9cc) {
3351
_0x2c1832 = null;
3352
}
3353
if (_0x2c1832) {
3354
if ('room-master' === _0x2c1832.act && (_0x378b5c.roomMaster = _0x2c1832.value), _0x2c1832.act, 'short-pause' === _0x2c1832.act && (_0x3bdb35 || (_0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x3bdb35 = true, _0x378b5c.wait = true, setTimeout(function() {
3355
_0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1;
3356
}, 0x30))), 'sync-control' === _0x2c1832.act) {
3357
var _0xb051c1 = _0x2c1832.value;
3358
_0x17edbf.playing || _0x378b5c.wait;
3359
var _0x2ef644 = _0x378b5c.connection.userid;
3360
_0x378b5c.players.indexOf(_0x2ef644);
3361
_0x378b5c.connection.isInitiator, _0xb051c1.forEach(function(_0x308105, _0x383237) {
3362
var _0x2c1832 = _0x308105.split('|'),
3363
_0x25a5c4 = _0x2c1832[0x0] >> 0x0,
3364
_0x2b3afd = _0x2c1832[0x1] >> 0x0,
3365
_0x4f5761 = _0x2c1832[0x2] >> 0x0,
3366
_0x249303 = _0x2c1832[0x3] >> 0x0,
3367
_0x54e0fd = _0x378b5c.currentFrame;
3368
_0x378b5c.inputsData[_0x249303] || (_0x378b5c.inputsData[_0x249303] = []), -0x1 !== _0x25a5c4 && _0x249303 === _0x54e0fd && _0x378b5c.simulateInputFn(_0x25a5c4, _0x2b3afd, _0x4f5761), _0x378b5c.connection.isInitiator ? _0x25a5c4 >= 0x0 && (_0x378b5c.inputsData[_0x54e0fd] || (_0x378b5c.inputsData[_0x54e0fd] = []), -0x2 != _0x2b3afd && (_0x378b5c.inputsData[_0x54e0fd].push({
3369
'index': _0x25a5c4,
3370
'key': _0x2b3afd,
3371
'status': _0x4f5761,
3372
'frame': _0x54e0fd
3373
}), _0x378b5c.simulateInputFn(_0x25a5c4, _0x2b3afd, _0x4f5761)), _0x3bdb35 || _0x54e0fd - 0xa >= _0x249303 && (_0x378b5c.systemPause(0x1), _0x27f4c4.Module.pauseMainLoop(), _0x3bdb35 = true, _0x378b5c.wait = true, setTimeout(function() {
3374
_0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x378b5c.wait = !0x1, _0x3bdb35 = !0x1;
3375
}, 0x30))) : ('' !== _0x25a5c4 && _0x378b5c.inputsData[_0x249303].push({
3376
'index': _0x25a5c4,
3377
'key': _0x2b3afd,
3378
'status': _0x4f5761,
3379
'frame': _0x249303
3380
}), _0x378b5c.inputsData[_0x378b5c.currentFrame] && _0x27f4c4.Module.resumeMainLoop(), _0x54e0fd + 0xa <= _0x249303 && _0x249303 > _0x378b5c.netPlayInitFrame + 0x64 && _0x378b5c.connection.send(JSON.stringify({
3381
'act': 'short-pause',
3382
'value': _0x2ef644
3383
}), _0x378b5c.roomMaster));
3384
});
3385
}
3386
if (_0x2c1832.act, _0x2c1832.act, 'update-core-option' === _0x2c1832.act && (_0x378b5c.connection.isInitiator || (_0x378b5c.coreOptionData[_0x2c1832.frame] = {
3387
'key': _0x2c1832.key,
3388
'value': _0x2c1832.value
3389
})), 'restart-game' === _0x2c1832.act && (_0x378b5c.inputsData = {}, _0x378b5c.connection.send(JSON.stringify({
3390
'act': 'sync-mem',
3391
'value': _0x378b5c.connection.userid
3392
}), _0x378b5c.roomMaster)), 'pause' === _0x2c1832.act && _0x27f4c4.Module.pauseMainLoop(), 'resume' === _0x2c1832.act && _0x27f4c4.Module.resumeMainLoop(), 'wait' === _0x2c1832.act && (_0x378b5c.wait = true, _0x378b5c.systemPause(0x1), _0x2c1832.value !== _0x378b5c.connection.userid && (_0x378b5c.waitingList[_0x2c1832.value] = 0x1), _0x378b5c.disableControl(true)), 'wait-end' === _0x2c1832.act && (_0x378b5c.waitingList[_0x2c1832.value] && delete _0x378b5c.waitingList[_0x2c1832.value], 0x0 === Object.keys(_0x378b5c.waitingList).length && (_0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1)), 'sync-mem' === _0x2c1832.act) {
3393
_0x378b5c.wait = true, _0x378b5c.systemPause(0x1);
3394
var _0x2a5bce = _0x2c1832.value;
3395
_0x378b5c.disableControl(true), _0x378b5c.connection.send(JSON.stringify({
3396
'act': 'wait',
3397
'value': _0x2a5bce
3398
}));
3399
(async () => {
3400
const state = await _0x378b5c.saveState();
3401
_0x27f4c4.FS.createDataFile('/', 'game.state', state, true, true);
3402
_0x27f4c4.Module.cwrap('load_state', 'number', ['string', 'number'])('game.state', 0);
3403
//_0x27f4c4.FS.unlink('game.state');
3404
_0x378b5c.inputsData = {};
3405
const file = new File([state], '0-game.state', {
3406
'type': '',
3407
'lastModified': new Date()
3408
});
3409
_0x378b5c.connection.shareFile(file, _0x2a5bce);
3410
})()
3411
}
3412
if (_0x2c1832.act, 'get-players-result' === _0x2c1832.act && (_0x378b5c.players = _0x2c1832.value, _0x378b5c.roomMaster = _0x2c1832.master, _0x2c1832.newuser === _0x378b5c.connection.userid)) {
3413
var _0x418ccb = _0x2593da.coreOptionsValues;
3414
_0x2c1832.coreOptions && Object.keys(_0x2c1832.coreOptions).forEach(function(_0x3f4c8f) {
3415
_0x418ccb[_0x3f4c8f] !== _0x2c1832.coreOptions[_0x3f4c8f] && _0x2593da.updateCoreOptions.call(_0x17edbf, _0x3f4c8f, _0x2c1832.coreOptions[_0x3f4c8f]);
3416
}), _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.disableControl(true), setTimeout(function() {
3417
_0x378b5c.connection.send(JSON.stringify({
3418
'act': 'sync-mem',
3419
'value': _0x378b5c.connection.userid
3420
}), _0x378b5c.roomMaster);
3421
}, 0x1), _0x378b5c.roomMaster && _0x378b5c.connection.peers[_0x378b5c.roomMaster] && (_0x378b5c.connection.extra.room_name = _0x378b5c.connection.peers[_0x378b5c.roomMaster].extra.room_name, _0x378b5c.connection.updateExtraData()), _0x378b5c.connection.peers[_0x378b5c.roomMaster] && (_0x3d0d28 = _0x378b5c.connection.peers[_0x378b5c.roomMaster].extra), _0x378b5c.openRoom(_0x17edbf);
3422
}
3423
}
3424
}, _0x378b5c.connection.onUserStatusChanged = function(_0x4188ba) {
3425
if ('offline' === _0x4188ba.status) {
3426
var _0x17edbf = _0x378b5c.players.indexOf(_0x4188ba.userid);
3427
_0x17edbf >= 0x0 && (_0x378b5c.players[_0x17edbf] = null);
3428
}
3429
_0x4188ba.status;
3430
}, _0x378b5c.connection.onExtraDataUpdated = function(_0x20ce61) {
3431
_0x20ce61.userid === _0x378b5c.connection.userid && (_0x378b5c.connection.extra = _0x20ce61.extra);
3432
}, _0x378b5c.connection.onleave = function(_0x30ebc6) {
3433
if (_0x30ebc6.userid) {
3434
var _0x2c1832 = _0x378b5c.players.indexOf(_0x30ebc6.userid);
3435
_0x2c1832 >= 0x0 && (_0x378b5c.players[_0x2c1832] = null);
3436
}
3437
_0x378b5c.waitingList[_0x30ebc6.userid] && delete _0x378b5c.waitingList[_0x30ebc6.userid], _0x378b5c.connection.isInitiator && 0x0 === Object.keys(_0x378b5c.waitingList).length && _0x378b5c.wait && (_0x378b5c.wait = !0x1, _0x378b5c.systemPause(0x0), _0x378b5c.disableInput = !0x1, _0x378b5c.connection.send(JSON.stringify({
3438
'act': 'wait-end',
3439
'value': _0x378b5c.connection.userid
3440
}))), _0x378b5c.openRoom(_0x17edbf), _0x378b5c.inputsData = {}, _0x378b5c.hideLoading.call(_0x17edbf);
3441
};
3442
var _0x2fba43 = function() {
3443
try {
3444
_0x378b5c.connection.onbeforeunload();
3445
} catch (_0xac619d) {}
3446
_0x378b5c.connected = !0x1, _0x378b5c.connection.password = null, _0x378b5c.players = [], _0x378b5c.connection.peersBackup = [], _0x378b5c.waitingList = {}, _0x378b5c.inputsData = {}, _0x378b5c.hideLoading.call(_0x17edbf), _0x132da7(_0x17edbf.elements.buttons.restart, !0x1), _0x132da7(_0x17edbf.elements.buttons.loadState, !0x1), _0x132da7(_0x17edbf.elements.buttons.saveState, !0x1), _0x378b5c.allowCheat && _0x132da7(_0x17edbf.elements.buttons.cheat, !0x1), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), !0x1), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), !0x1), Array.from(_0x17edbf.elements.buttons.play).forEach(function(_0x3d296d) {
3447
_0x132da7(_0x3d296d, !0x1);
3448
}), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf);
3449
};
3450
_0x378b5c.connection.close = _0x2fba43, _0x378b5c.connection.disconnect = _0x2fba43, _0x378b5c.connection.leave = _0x2fba43;
3451
var _0x3f9c57, _0x10c0ad = function(_0x42ff74, _0x306f0b, _0x345d4d) {
3452
_0x378b5c.hideLoading.call(_0x17edbf), _0x42ff74 ? (_0x378b5c.stopLoadRooms(), _0x132da7(_0x17edbf.elements.buttons.restart, true), _0x132da7(_0x17edbf.elements.buttons.loadState, true), _0x132da7(_0x17edbf.elements.buttons.saveState, true), _0x378b5c.resetCheat(), _0x132da7(_0x17edbf.elements.buttons.cheat, true), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), true), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), true), Array.from(_0x17edbf.elements.buttons.play).forEach(function(_0x2911fb) {
3453
_0x132da7(_0x2911fb, true);
3454
}), _0x378b5c.connection.socket && _0x378b5c.connection.socket.on('set-isInitiator-true', function(_0x31da46) {
3455
_0x31da46 === _0x378b5c.connection.sessionid && (_0x378b5c.connection.socket.emit('extra-data-updated', _0x378b5c.connection.extra), _0x378b5c.connection.send(JSON.stringify({
3456
'act': 'room-master',
3457
'value': _0x378b5c.connection.userid
3458
})), _0x378b5c.roomMaster = _0x378b5c.connection.userid, _0x378b5c.systemPause(0x0), _0x27f4c4.Module.resumeMainLoop(), _0x2593da.updateCoreOptionMenuItems.call(_0x17edbf), _0x132da7(_0x17edbf.elements.buttons.restart, !0x1), _0x132da7(_0x17edbf.elements.buttons.loadState, !0x1), _0x132da7(_0x17edbf.elements.buttons.saveState, !0x1), Array.from(_0x17edbf.elements.buttons.play).forEach(function(_0x132034) {
3459
_0x132da7(_0x132034, !0x1);
3460
}));
3461
})) : (_0x4d8495.close(), _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = _0x345d4d, _0x4d8495.show('modal-7d8fd50ed642340b', {
3462
'closeTrigger': 'data-modal-close'
3463
}));
3464
},
3465
_0x1e0cdb = function(_0x5b3f13) {
3466
if (window.EJS_TURN_URLS === null || !window.EJS_TURN_URLS || window.EJS_TURN_URLS.length === 0) {
3467
_0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = (window.EJS_TURN_URLS === null || window.EJS_TURN_URLS.length === 0) ? 'Netplay Currently Unavailable' : 'Netplay initializing';
3468
_0x4d8495.show('modal-7d8fd50ed642340b', {
3469
'closeTrigger': 'data-modal-close'
3470
});
3471
return;
3472
}
3473
_0x378b5c.connection.iceServers = window.EJS_TURN_URLS;
3474
var _0x2c1832 = _0x5b3f13.target.getAttribute('data-id');
3475
if ('Y' === _0x5b3f13.target.getAttribute('data-password')) _0x4d8495.show('modal-5aa765d61d8327de', {
3476
'closeTrigger': 'data-modal-close'
3477
}), _0x325651.setAttribute('data-id', _0x2c1832);
3478
else {
3479
_0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.userid = _0x378b5c.connection.token();
3480
try {
3481
_0x378b5c.connection.join(_0x2c1832, _0x10c0ad);
3482
} catch (_0x2767b9) {
3483
_0x378b5c.hideLoading.call(_0x17edbf), _0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = 'Error', _0x4d8495.show('modal-7d8fd50ed642340b', {
3484
'closeTrigger': 'data-modal-close'
3485
});
3486
}
3487
}
3488
return _0x5b3f13.stopPropagation(), !0x1;
3489
};
3490
_0x378b5c.loadRoomsList = function() {
3491
_0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), true), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), !0x1), _0x132da7(_0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), true);
3492
var listUrl = _0x17edbf.listUrl
3493
if (! listUrl.endsWith('/')) {
3494
listUrl += '/';
3495
};
3496
var _0x2c1832 = _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])).querySelector('tbody'),
3497
_0x5cf2be = [listUrl, 'list?game_id=', _0x17edbf.config.gameId, '&domain=', window.location.hostname, '&coreVer=', _0x17edbf.coreVer].join('');
3498
_0x550f17.a.get(_0x5cf2be, {}).then(function(_0x37c60b) {
3499
if (_0x37c60b.data) {
3500
var _0x4782da = [],
3501
_0x28e87d = [];
3502
_0x2c1832.querySelectorAll('tr').forEach(function(_0x1e5a22) {
3503
_0x28e87d.push(_0x1e5a22.getAttribute('id'));
3504
}), Object.keys(_0x37c60b.data).forEach(function(_0x47ae0e) {
3505
var _0x4a8f4c = _0x37c60b.data[_0x47ae0e];
3506
if (_0x4782da.push(_0x47ae0e), _0x28e87d.includes(_0x47ae0e)) {
3507
var _0x2d672f = _0x2c1832.querySelector('tr[id="' .concat(_0x47ae0e, '"]'));
3508
_0x2c1832.removeChild(_0x2d672f);
3509
}
3510
var _0x295f41 = document.createElement('tr');
3511
_0x295f41.setAttribute('id', _0x47ae0e);
3512
var _0xa2ea61 = _0x4a8f4c.password ? _0x378b5c.icons.lock : '',
3513
_0x5452b6 = _0x4a8f4c.password ? 'Y' : 'N',
3514
_0xb3121d = _0x4a8f4c.current < _0x4a8f4c.max ? '<span data-id="' .concat(_0x47ae0e, '" data-password="').concat(_0x5452b6, '" class="').concat(_0x378b5c.classNames['btn-join-room'], '">Join</span>') : '',
3515
_0x5c8146 = _0x4a8f4c.country ? _0x4a8f4c.country : '?';
3516
_0x295f41.innerHTML = '<td>[' .concat(_0x5c8146, '] ').concat(_0xa2ea61, ' ').concat(_0x4a8f4c.room_name, '</td><td>').concat(_0x4a8f4c.current, '/').concat(_0x4a8f4c.max, '</td><td>').concat(_0xb3121d, '</td>'), _0x1093f4.call(_0xa88a13, _0x295f41.querySelector('.' .concat(_0x378b5c.classNames['btn-join-room'])), 'click', _0x1e0cdb), _0x2c1832.appendChild(_0x295f41);
3517
}), _0x2c1832.querySelectorAll('tr').forEach(function(_0x24dcf7) {
3518
_0x4782da.includes(_0x24dcf7.id) || _0x2c1832.removeChild(_0x24dcf7);
3519
});
3520
}
3521
_0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0);
3522
}).catch(function(_0x227055) {
3523
console.log('Network Error', _0x227055), _0x378b5c.loadRoomsListTimer = setTimeout(_0x378b5c.loadRoomsList, 0x7d0);
3524
});
3525
}, _0x378b5c.openRoom = function(_0x10625f) {
3526
_0x378b5c.stopLoadRooms();
3527
_0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-roomlist'])), true);
3528
_0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])), !0x1);
3529
_0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), true);
3530
_0x132da7(_0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), !0x1);
3531
_0x378b5c.resetCheat();
3532
_0x132da7(_0x10625f.elements.buttons.cheat, true);
3533
var _0x17edbf = _0x10625f.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['netplay-room'])),
3534
_0x2c1832 = _0x17edbf.querySelector('[data-room-password]');
3535
null === _0x378b5c.connection.password ? _0x132da7(_0x2c1832, true) : (_0x132da7(_0x2c1832, !0x1), _0x2c1832.querySelector('span').innerText = _0x378b5c.connection.password);
3536
var _0x18c1cb = _0x17edbf.querySelector('tbody');
3537
_0x18c1cb.innerHTML = '', _0x17edbf.querySelector('strong').innerText = _0x3d0d28.room_name, _0x378b5c.players.forEach(function(_0x938d55, _0xf3d39a) {
3538
var _0x2c1832 = null;
3539
if (_0x938d55 && (_0x378b5c.connection.peers[_0x938d55] ? _0x2c1832 = _0x378b5c.connection.peers[_0x938d55].extra : _0x378b5c.connection.userid === _0x938d55 && (_0x2c1832 = _0x378b5c.connection.extra), _0x2c1832 && _0x2c1832.name)) {
3540
var _0x564064 = document.createElement('tr');
3541
_0x564064.innerHTML = '<td>' .concat(_0xf3d39a + 0x1, '</td><td>').concat(_0x2c1832.name, '</td><td></td>'), _0x18c1cb.appendChild(_0x564064);
3542
}
3543
});
3544
}, _0x1093f4.call(this, _0x325651.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x9ac969) {
3545
var _0x2c1832 = _0x325651.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value;
3546
_0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.password = _0x2c1832;
3547
var _0xcf7207 = _0x325651.getAttribute('data-id');
3548
_0x378b5c.connection.join(_0xcf7207, function(_0x1a0deb, _0x1ef6c8, _0x1ad18e) {
3549
_0x10c0ad(_0x1a0deb, 0x0, _0x1ad18e), _0x1a0deb && _0x325651.classList.remove(_0x449eac({
3550
'is-open': true
3551
}));
3552
}), _0x9ac969.stopPropagation();
3553
}), _0x1093f4.call(this, _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x43f795) {
3554
var _0x17edbf = _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames['netplay-player-name'])).value;
3555
_0x17edbf = _0x17edbf.replace(/<|>/g, ''), _0x2c1832.querySelector('.' .concat(_0x378b5c.classNames.modal__errmsg)).innerHTML = '', _0x17edbf.trim() && (_0x378b5c.playerName = _0x17edbf.trim(), _0x378b5c.connection.extra.name = _0x17edbf.trim(), _0x4d8495.close()), _0x43f795.stopPropagation();
3556
}), _0x1093f4.call(this, _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['modal__btn-primary'])), 'click', function(_0x202cf6) {
3557
var _0x2c1832 = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-name-input'])).value;
3558
_0x2c1832 = _0x2c1832.replace(/<|>/g, '');
3559
var _0x3510ed = _0x36bde0.querySelector('select[data-max-players] option:checked').value;
3560
_0x3510ed < 0x2 && (_0x3510ed = 0x2), _0x3510ed > 0x4 && (_0x3510ed = 0x4);
3561
for (var _0x1264b2 = 0x0; _0x1264b2 < _0x3510ed; _0x1264b2++) _0x378b5c.players[_0x1264b2] = null;
3562
_0x378b5c.connection.maxParticipantsAllowed = _0x3510ed;
3563
var _0x140bcf = _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames['netplay-room-password-input'])).value;
3564
_0x36bde0.querySelector('.' .concat(_0x378b5c.classNames.modal__errmsg)).innerHTML = '', _0x2c1832.trim() ? (_0x378b5c.connection.extra.room_name = _0x2c1832.trim(), '' !== _0x140bcf.trim() && (_0x378b5c.connection.password = _0x140bcf.trim()), _0x378b5c.showLoading.call(_0x17edbf), _0x378b5c.connection.open(_0x378b5c.connection.token(), function(_0x3c6c26, _0x203288, _0x210547) {
3565
_0x378b5c.hideLoading.call(_0x17edbf), _0x3c6c26 ? (_0x378b5c.players[0x0] = _0x378b5c.connection.userid, _0x378b5c.roomMaster = _0x378b5c.connection.userid, _0x3f9c57.closeModal(), _0x378b5c.stopLoadRooms(), _0x3d0d28 = _0x378b5c.connection.extra, _0x378b5c.openRoom(_0x17edbf), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x2), true), _0x132da7(_0x2593da.contextMenu.querySelectorAll('ul li').item(0x3), true)) : _0x36bde0.querySelector('.' .concat(_0x378b5c.classNames.modal__errmsg)).innerHTML = _0x210547;
3566
})) : _0x3f9c57.closeModal(), _0x202cf6.stopPropagation();
3567
}), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-create-room'])), 'click', function(_0x48cb26) {
3568
if (window.EJS_TURN_URLS === null || !window.EJS_TURN_URLS || window.EJS_TURN_URLS.length === 0) {
3569
_0x5289c1.querySelector('#modal-7d8fd50ed642340b-content').innerHTML = (window.EJS_TURN_URLS === null || window.EJS_TURN_URLS.length === 0) ? 'Netplay Currently Unavailable' : 'Netplay initializing';
3570
_0x4d8495.show('modal-7d8fd50ed642340b', {
3571
'closeTrigger': 'data-modal-close'
3572
});
3573
return;
3574
}
3575
_0x378b5c.connection.iceServers = window.EJS_TURN_URLS;
3576
return _0x3f9c57 = _0x4d8495.show('modal-85cd7a1c543a484a', {
3577
'closeTrigger': 'data-modal-close',
3578
'onClose': function() {
3579
_0x17edbf.elements.container.focus();
3580
}
3581
}), _0x48cb26.stopPropagation(), !0x1;
3582
}), _0x1093f4.call(this, _0x17edbf.elements.dialogs.netplay.querySelector('.' .concat(_0x378b5c.classNames['btn-quit'])), 'click', function(_0x68459d) {
3583
return _0x378b5c.connection.close(), _0x378b5c.stopLoadRooms(), _0x378b5c.loadRoomsList(), _0x378b5c.inputsData = {}, _0x68459d.stopPropagation(), !0x1;
3584
});
3585
}
3586
window._0x378b5c = _0x378b5c;
3587
},
3588
'initKeyboard': function() {
3589
let _this = this,
3590
_0x17edbf = this,
3591
_0x2c1832 = this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay));
3592
_0x1093f4.call(this, document.body, 'keydown keyup', function(_0x459b32) {
3593
if (_0x459b32.which >= 0x70 && _0x459b32.which <= 0x7b);
3594
else {
3595
let _0x335c01 = !_this.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden,
3596
_0x2eb03e = 'keydown' === _0x459b32.type;
3597
if (_0x2eb03e && _0x335c01) {
3598
let _0x1a3a47 = _0x2c1832.getAttribute('data-index'),
3599
_0x1394cb = _0x2c1832.getAttribute('data-id'),
3600
_0x2c8fd1 = null;
3601
if (_0x459b32.key && _0x378b5c.keyMap[_0x459b32.keyCode] === 'escape') {
3602
(_0x2c8fd1 = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1394cb, '"][data-index="').concat(_0x1a3a47, '"][data-type="1"]'))).setAttribute('data-value', '')
3603
_0x2c8fd1.value = ''
3604
(_0x2c8fd1 = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1394cb, '"][data-index="').concat(_0x1a3a47, '"][data-type="2"]'))).setAttribute('data-value', '')
3605
_0x2c8fd1.value = ''
3606
_0x132da7(_0x2c1832, true);
3607
return;
3608
};
3609
_0x1a3a47 = _0x2c1832.getAttribute('data-index');
3610
_0x1394cb = _0x2c1832.getAttribute('data-id');
3611
_0x2c8fd1 = null;
3612
_0x459b32.key && ((_0x2c8fd1 = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1394cb, '"][data-index="').concat(_0x1a3a47, '"][data-type="1"]'))).setAttribute('data-value', _0x459b32.keyCode), _0x2c8fd1.value = _0x378b5c.keyMap[_0x459b32.keyCode]), _0x132da7(_0x2c1832, true);
3613
} else Object.keys(_0x378b5c.controllers).forEach(function(_0x3863d2) {
3614
Object.keys(_0x378b5c.controllers[_0x3863d2]).forEach(function(_0x509939) {
3615
if (parseInt(_0x378b5c.controllers[_0x3863d2][_0x509939].value, 0xa) === _0x459b32.keyCode && ['24', '25', '26'].includes(_0x509939) && _0x459b32.type == 'keydown' && ! _0x459b32.repeat) {
3616
if (_0x509939 == '24') {//save
3617
_0x378b5c.quickSaveState()
3618
} else if (_0x509939 == '25') {//load
3619
_0x378b5c.quickLoadState()
3620
} else if (_0x509939 == '26') {//load
3621
_0x378b5c.changeStateSlot()
3622
}
3623
// quick save/load button
3624
}
3625
parseInt(_0x378b5c.controllers[_0x3863d2][_0x509939].value, 0xa) === _0x459b32.keyCode && (_0x2eb03e ? _0x509939 >= 0x10 && _0x509939 <= 0x17 ? _0x378b5c.simulateInput(_0x3863d2, _0x509939, 0x7fff) : _0x378b5c.simulateInput(_0x3863d2, _0x509939, 1) : _0x378b5c.simulateInput(_0x3863d2, _0x509939, 0));
3626
});
3627
});
3628
}
3629
}), document.body.addEventListener('keydown', function(_0x14d612) {
3630
let _0x2c1832 = _0x14d612.keyCode ? _0x14d612.keyCode : _0x14d612.which;
3631
[0x20, 0x25, 0x26, 0x27, 0x28, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b].includes(_0x2c1832) && _0x14d612.srcElement === _0x17edbf.elements.container && _0x14d612.preventDefault(), _0x14d612.srcElement.className.split(/ +/).includes(_0x378b5c.classNames.set) && _0x14d612.preventDefault();
3632
});
3633
},
3634
'initGamepad': function() {
3635
let _this = this,
3636
_0x17edbf = this,
3637
_0x2c1832 = this.elements.dialogs.gamepad.querySelector('.' .concat(_0x378b5c.classNames.overlay));
3638
let gamepad;
3639
try {
3640
gamepad = new _0x4ad1c6();
3641
} catch(e) {
3642
console.warn('gamepad not supported');
3643
return;
3644
}
3645
_0x378b5c.gamepad = gamepad;
3646
gamepad.on('buttondown', function(event) {
3647
if (!_this.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden) {
3648
let _0x387018, _0xdd4205 = parseInt(_0x2c1832.getAttribute('data-index'), 0xa),
3649
_0x1f4ee2 = _0x2c1832.getAttribute('data-id');
3650
if (event.gamepadIndex === parseInt(_0xdd4205, 0xa)) {
3651
let _0x126d2d = null;
3652
(_0x126d2d = _0x17edbf.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1f4ee2, '"][data-index="').concat(_0xdd4205, '"][data-type="2"]'))).setAttribute('data-value', event.index), _0x126d2d.value = 'button ' .concat(event.index + 1), _0x132da7(_0x2c1832, true);
3653
}
3654
} else Object.keys(_0x378b5c.controllers[event.gamepadIndex.toString()]).forEach(function(_0x3cf4d3) {
3655
let _0x5cf388 = event.gamepadIndex.toString();
3656
if (parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(event.index, 0xa) && ['24', '25', '26'].includes(_0x3cf4d3)) {
3657
if (_0x3cf4d3 == '24') {//save
3658
_0x378b5c.quickSaveState()
3659
} else if (_0x3cf4d3 == '25') {//load
3660
_0x378b5c.quickLoadState()
3661
} else if (_0x3cf4d3 == '26') {//load
3662
_0x378b5c.changeStateSlot()
3663
}
3664
}
3665
parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2, 0xa) === parseInt(event.index, 0xa) && parseInt(_0x5cf388, 0xa) === parseInt(event.gamepadIndex, 0xa) && _0x378b5c.simulateInput(_0x5cf388, _0x3cf4d3, 1);
3666
});
3667
});
3668
gamepad.on('buttonup', function(event) {
3669
Object.keys(_0x378b5c.controllers).forEach(function(_0x302c3e) {
3670
Object.keys(_0x378b5c.controllers[_0x302c3e]).forEach(function(_0x14eb8a) {
3671
parseInt(_0x378b5c.controllers[_0x302c3e][_0x14eb8a].value2, 0xa) === parseInt(event.index, 0xa) && parseInt(_0x302c3e, 0xa) === parseInt(event.gamepadIndex, 0xa) && _0x378b5c.simulateInput(_0x302c3e, _0x14eb8a, 0);
3672
});
3673
});
3674
});
3675
gamepad.on('axischanged', function(event) {
3676
let value = function(value) {
3677
if (value > 0.5 || value < -0.5) {
3678
return (value > 0) ? 1 : -1;
3679
} else {
3680
return 0;
3681
}
3682
}(event.value);
3683
if (!_this.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden) {
3684
if (value !== 0) {
3685
let _0x1f4ee2 = _0x2c1832.getAttribute('data-id'),
3686
_0xdd4205 = parseInt(_0x2c1832.getAttribute('data-index'), 0xa);
3687
let _0x126d2d = _this.elements.dialogs.gamepad.querySelector('[data-id="' .concat(_0x1f4ee2, '"][data-index="').concat(_0xdd4205, '"][data-type="2"]'))
3688
_0x126d2d.setAttribute('data-value', event.axis + ':' + value)
3689
_0x126d2d.value = event.axis + ':' + value
3690
_0x132da7(_0x2c1832, true)
3691
}
3692
} else {
3693
if (! _0x378b5c.prevButtons) {
3694
_0x378b5c.prevButtons = {}
3695
}
3696
let quit = false
3697
let _0x5cf388 = event.gamepadIndex.toString();
3698
if (! _0x378b5c.prevButtons[_0x5cf388]) {
3699
_0x378b5c.prevButtons[_0x5cf388] = {}
3700
}
3701
if (! _0x378b5c.prevButtons[_0x5cf388][event.axis]) {
3702
_0x378b5c.prevButtons[_0x5cf388][event.axis] = 0
3703
}
3704
if (! _0x378b5c.prevButtons[_0x5cf388].buttonID) {
3705
_0x378b5c.prevButtons[_0x5cf388].buttonID = 0
3706
}
3707
for (let w=0; w<Object.keys(_0x378b5c.controllers[_0x5cf388]).length; w++) {
3708
let _0x3cf4d3 = Object.keys(_0x378b5c.controllers[_0x5cf388])[w]
3709
if (! _0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2) {
3710
continue
3711
}
3712
if (_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[0] === event.axis && parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[1]) === value && ['24', '25', '26'].includes(_0x3cf4d3)) {
3713
if (_0x3cf4d3 == '24') {//save
3714
quit = true
3715
_0x378b5c.quickSaveState()
3716
} else if (_0x3cf4d3 == '25') {//load
3717
quit = true
3718
_0x378b5c.quickLoadState()
3719
} else if (_0x3cf4d3 == '26') {//load
3720
_0x378b5c.changeStateSlot()
3721
}
3722
}
3723
if (value === 0) {
3724
// button up
3725
if (_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[0] === event.axis) {
3726
_0x378b5c.prevButtons[_0x5cf388][event.axis] = value
3727
_0x378b5c.prevButtons[_0x5cf388].buttonID = _0x3cf4d3
3728
_0x378b5c.simulateInput(_0x5cf388, _0x3cf4d3, 0)
3729
}
3730
} else {
3731
//button down
3732
if ((1 === _0x378b5c.prevButtons[_0x5cf388][event.axis] && value === -1) ||
3733
(-1 === _0x378b5c.prevButtons[_0x5cf388][event.axis] && value === 1)) {
3734
_0x378b5c.simulateInput(_0x5cf388, _0x378b5c.prevButtons[_0x5cf388].buttonID, 0)
3735
}
3736
if (_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[0] === event.axis && parseInt(_0x378b5c.controllers[_0x5cf388][_0x3cf4d3].value2.split(':')[1]) === value) {
3737
_0x378b5c.prevButtons[_0x5cf388][event.axis] = value
3738
_0x378b5c.prevButtons[_0x5cf388].buttonID = _0x3cf4d3
3739
quit = true
3740
_0x378b5c.simulateInput(_0x5cf388, _0x3cf4d3, 1)
3741
}
3742
}
3743
};
3744
if (quit) {
3745
return
3746
}
3747
if (! _this.elements.dialogs.gamepad.hidden && !_0x2c1832.hidden) {
3748
return
3749
}
3750
}
3751
Math.abs(event.value) <= 0.1 && (event.value = 0);
3752
let _0x17edbf = event.gamepadIndex;
3753
let coreVer = _this.coreVer;
3754
if (event.axis === 'LEFT_STICK_X') {
3755
if (event.value > 0) {
3756
_0x378b5c.simulateInput(_0x17edbf, 16, 0x7fff * event.value);
3757
_0x378b5c.simulateInput(_0x17edbf, 17, 0);
3758
} else {
3759
_0x378b5c.simulateInput(_0x17edbf, 17, -0x7fff * event.value);
3760
_0x378b5c.simulateInput(_0x17edbf, 16, 0);
3761
}
3762
} else if (event.axis === 'LEFT_STICK_Y') {
3763
if (event.value > 0) {
3764
_0x378b5c.simulateInput(_0x17edbf, 18, 0x7fff * event.value);
3765
_0x378b5c.simulateInput(_0x17edbf, 19, 0);
3766
} else {
3767
_0x378b5c.simulateInput(_0x17edbf, 19, -0x7fff * event.value);
3768
_0x378b5c.simulateInput(_0x17edbf, 18, 0);
3769
}
3770
} else if (event.axis === 'RIGHT_STICK_X') {
3771
if (event.value > 0) {
3772
_0x378b5c.simulateInput(_0x17edbf, 20, 0x7fff * event.value);
3773
_0x378b5c.simulateInput(_0x17edbf, 21, 0);
3774
} else {
3775
_0x378b5c.simulateInput(_0x17edbf, 21, -0x7fff * event.value);
3776
_0x378b5c.simulateInput(_0x17edbf, 20, 0);
3777
}
3778
} else if (event.axis === 'RIGHT_STICK_Y') {
3779
if (event.value > 0) {
3780
_0x378b5c.simulateInput(_0x17edbf, 22, 0x7fff * event.value);
3781
_0x378b5c.simulateInput(_0x17edbf, 23, 0);
3782
} else {
3783
_0x378b5c.simulateInput(_0x17edbf, 23, 0x7fff * event.value);
3784
_0x378b5c.simulateInput(_0x17edbf, 22, 0);
3785
}
3786
}
3787
});
3788
gamepad.on('disconnected', function(event) {
3789
[0, 1, 2, 3].forEach(function(_0x429f30) {
3790
let _0x2c1832 = gamepad.gamepads[_0x429f30];
3791
_0x17edbf.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x429f30, ' .gamepad-name')).innerHTML = _0x2c1832 ? _0x2c1832.id : 'n/a';
3792
});
3793
});
3794
gamepad.on('connected', function(event) {
3795
Object.keys(gamepad.gamepads).forEach(function(_0x327c74) {
3796
let _0x2c1832 = gamepad.gamepads[_0x327c74];
3797
_0x17edbf.elements.dialogs.gamepad.querySelector('#controls-' .concat(_0x327c74, ' .gamepad-name')).innerHTML = _0x2c1832 ? _0x2c1832.id : 'n/a';
3798
});
3799
});
3800
},
3801
'setShader': function(_0x4cbec3) {
3802
if ('disabled' === _0x4cbec3) _0x27f4c4.FS.unlink('/shader/shader.glslp', ''), _0x378b5c.toggleShader && _0x378b5c.toggleShader(0);
3803
else {
3804
_0x378b5c.toggleShader && _0x378b5c.toggleShader(0);
3805
let _0x17edbf = '/shader/' .concat(_0x4cbec3);
3806
_0x27f4c4.FS.writeFile('/shader/shader.glslp', _0x27f4c4.FS.readFile(_0x17edbf));
3807
_0x378b5c.toggleShader && _0x378b5c.toggleShader(1);
3808
}
3809
},
3810
'toggleVirtualGamepad': function(_0x1ed80b, forceUpdateHTML) {
3811
let _this = this;
3812
if (_0x378b5c.virtualGamepadContainer && !forceUpdateHTML) {
3813
_0x132da7(_0x378b5c.virtualGamepadContainer, !_0x1ed80b);
3814
return
3815
}
3816
if (!_0x378b5c.virtualGamepadContainer) {
3817
_0x378b5c.virtualGamepadContainer = _0x428003('div', {
3818
'class': getClass({
3819
'ejs-virtual-gamepad': true
3820
}),
3821
'hidden': ''
3822
});
3823
this.elements.container.appendChild(_0x378b5c.virtualGamepadContainer);
3824
}
3825
let blockCSS = 'height:31px;text-align:center;border:1px solid #ccc;border-radius:5px;line-height:31px;';
3826
let html = '';
3827
let info;
3828
3829
if (_this.config.VirtualGamepadSettings && function(set) {
3830
if (!Array.isArray(set)) {
3831
console.warn("Vritual gamepad settings is not array! Using default gamepad settings");
3832
return false;
3833
}
3834
if (!set.length) {
3835
console.warn("Vritual gamepad settings is empty! Using default gamepad settings");
3836
return false;
3837
}
3838
for (let i=0; i<set.length; i++) {
3839
if (!set[i].type) continue;
3840
try {
3841
if (set[i].type === 'zone' || set[i].type === 'dpad') {
3842
if (!set[i].location) {
3843
console.warn("Missing location value for "+set[i].type+"! Using default gamepad settings");
3844
return false;
3845
} else if (!set[i].inputValues) {
3846
console.warn("Missing inputValues for "+set[i].type+"! Using default gamepad settings");
3847
return false;
3848
}
3849
continue;
3850
}
3851
if (!set[i].location) {
3852
console.warn("Missing location value for button "+set[i].text+"! Using default gamepad settings");
3853
return false;
3854
} else if (!set[i].type) {
3855
console.warn("Missing type value for button "+set[i].text+"! Using default gamepad settings");
3856
return false;
3857
} else if (!set[i].id.toString()) {
3858
console.warn("Missing id value for button "+set[i].text+"! Using default gamepad settings");
3859
return false;
3860
} else if (!set[i].input_value.toString()) {
3861
console.warn("Missing input_value for button "+set[i].text+"! Using default gamepad settings");
3862
return false;
3863
}
3864
} catch(e) {
3865
console.warn("Error checking values! Using default gamepad settings");
3866
return false;
3867
}
3868
}
3869
return true;
3870
}(_this.config.VirtualGamepadSettings)) {
3871
info = _this.config.VirtualGamepadSettings;
3872
} else if (['gba', 'gb', 'vb', 'nes'].includes(getSystem(_this.system, true))) {
3873
info = [{"type":"button","text":"B","id":"b","location":"right","right":-10,"top":70,"bold":true,"input_value":0},{"type":"button","text":"A","id":"a","location":"right","right":60,"top":70,"bold":true,"input_value":8},{"type":"dpad","location":"left","left":"50%","right":"50%","joystickInput":false,"inputValues":[4,5,6,7]},{"type":"button","text":"Start","id":"start","location":"center","left":60,"fontSize":15,"block":true,"input_value":3},{"type":"button","text":"Select","id":"select","location":"center","left":-5,"fontSize":15,"block":true,"input_value":2}];
3874
if (getSystem(_this.system, true) === 'gba') {
3875
info.push({"type":"button","text":"L","id":"l","block":true,"location":"top","left":10,"top":-40,"bold":true,"input_value":10});
3876
info.push({"type":"button","text":"R","id":"r","block":true,"location":"top","right":10,"top":-40,"bold":true,"input_value":11});
3877
}
3878
} else if (getSystem(_this.system, true) === 'n64') {
3879
info = [{"type":"button","text":"B","id":"b","location":"right","left":-10,"top":95,"input_value":0,"bold":true,"input_new_cores":1},{"type":"button","text":"A","id":"a","location":"right","left":40,"top":150,"input_value":8,"bold":true,"input_new_cores":0},{"type":"zone","location":"left","left":"50%","top":"100%","joystickInput":true,"inputValues":[16, 17, 18, 19]},{"type":"zone","location":"left","left":"50%","top":"0%","joystickInput":false,"inputValues":[4,5,6,7]},{"type":"button","text":"Start","id":"start","location":"center","left":30,"top":-10,"fontSize":15,"block":true,"input_value":3},{"type":"button","text":"L","id":"l","block":true,"location":"top","left":10,"top":-40,"bold":true,"input_value":10},{"type":"button","text":"R","id":"r","block":true,"location":"top","right":10,"top":-40,"bold":true,"input_value":11},{"type":"button","text":"Z","id":"z","block":true,"location":"top","left":10,"bold":true,"input_value":12},{"fontSize":20,"type":"button","text":"CU","id":"cu","location":"right","left":25,"top":-65,"input_value":23},{"fontSize":20,"type":"button","text":"CD","id":"cd","location":"right","left":25,"top":15,"input_value":22},{"fontSize":20,"type":"button","text":"CL","id":"cl","location":"right","left":-15,"top":-25,"input_value":21},{"fontSize":20,"type":"button","text":"CR","id":"cr","location":"right","left":65,"top":-25,"input_value":20}];
3880
} else if (['snes', 'nds'].includes(getSystem(_this.system, true))) {
3881
info = [{"type":"button","text":"X","id":"x","location":"right","left":40,"bold":true,"input_value":9},{"type":"button","text":"Y","id":"y","location":"right","top":40,"bold":true,"input_value":1},{"type":"button","text":"A","id":"a","location":"right","left":81,"top":40,"bold":true,"input_value":8},{"type":"button","text":"B","id":"b","location":"right","left":40,"top":80,"bold":true,"input_value":0},{"type":"zone","location":"left","left":"50%","top":"50%","joystickInput":false,"inputValues":[4,5,6,7]},{"type":"button","text":"Start","id":"start","location":"center","left":60,"fontSize":15,"block":true,"input_value":3},{"type":"button","text":"Select","id":"select","location":"center","left":-5,"fontSize":15,"block":true,"input_value":2}];
3882
} else {
3883
info = [{"type":"button","text":"Y","id":"y","location":"right","left":40,"bold":true,"input_value":9},{"type":"button","text":"X","id":"X","location":"right","top":40,"bold":true,"input_value":1},{"type":"button","text":"B","id":"b","location":"right","left":81,"top":40,"bold":true,"input_value":8},{"type":"button","text":"A","id":"a","location":"right","left":40,"top":80,"bold":true,"input_value":0},{"type":"zone","location":"left","left":"50%","top":"50%","joystickInput":false,"inputValues":[4,5,6,7]},{"type":"button","text":"Start","id":"start","location":"center","left":60,"fontSize":15,"block":true,"input_value":3},{"type":"button","text":"Select","id":"select","location":"center","left":-5,"fontSize":15,"block":true,"input_value":2}];
3884
}
3885
info = JSON.parse(JSON.stringify(info));
3886
3887
3888
let dataHTML = {
3889
top: '',
3890
left: '',
3891
center: '',
3892
right: ''
3893
}
3894
let leftHandedMode = false;
3895
if (_0x2593da && typeof _0x2593da.getCoreOptionsValue === 'function') {
3896
leftHandedMode = _0x2593da.getCoreOptionsValue('left-handed-mode')==='on';
3897
}
3898
for (let i=0; i<info.length; i++) {
3899
if (info[i].type !== 'button') continue;
3900
let opts = {'buttons': true};
3901
if (leftHandedMode && ['left', 'right'].includes(info[i].location)) {
3902
info[i].location = (info[i].location==='left') ? 'right' : 'left';
3903
const amnt = JSON.parse(JSON.stringify(info[i]));
3904
if (amnt.left) {
3905
info[i].right = amnt.left;
3906
}
3907
if (amnt.right) {
3908
info[i].left = amnt.right;
3909
}
3910
}
3911
opts['b_'+info[i].id.toLowerCase()] = true;
3912
let style = '';
3913
if (info[i].left) {
3914
style += 'left:'+info[i].left+(typeof info[i].left === 'number'?'px':'')+';';
3915
}
3916
if (info[i].right) {
3917
style += 'right:'+info[i].right+(typeof info[i].right === 'number'?'px':'')+';';
3918
}
3919
if (info[i].top) {
3920
style += 'top:'+info[i].top+(typeof info[i].top === 'number'?'px':'')+';';
3921
}
3922
if (!info[i].bold) {
3923
style += 'font-weight:normal;';
3924
} else if (info[i].bold) {
3925
style += 'font-weight:bold;';
3926
}
3927
info[i].fontSize = info[i].fontSize || 30;
3928
style += 'font-size:'+info[i].fontSize+'px;';
3929
if (info[i].block) {
3930
style += blockCSS;
3931
}
3932
if (['top', 'center', 'left', 'right'].includes(info[i].location)) {
3933
dataHTML[info[i].location] += '<div class="'+getClass(opts)+'" style="'+style+'">'+info[i].text+'</div>';
3934
}
3935
}
3936
html += '<div class="'+getClass({'virtual-gamepad': true})+'" style="display: block;">';
3937
html += '<div class="'+getClass({'top': true})+'">';
3938
html += dataHTML.top;
3939
html += '</div>';
3940
html += '<div class="'+getClass({'left': true})+'">';
3941
html += dataHTML.left;
3942
html += '</div>';
3943
html += '<div class="'+getClass({'center': true})+'">';
3944
html += dataHTML.center;
3945
html += '</div>';
3946
html += '<div class="'+getClass({'right': true})+'">';
3947
html += dataHTML.right;
3948
html += '</div></div>';
3949
_0x378b5c.virtualGamepadContainer.innerHTML = html;
3950
_0x132da7(_0x378b5c.virtualGamepadContainer, !_0x1ed80b);
3951
3952
let _0x2c1832 = getClass({
3953
'virtual-gamepad': true
3954
}),
3955
_0x2ec721 = getClass({
3956
'touch': true
3957
});
3958
if (! _0x59aa33.isIos) {
3959
_0x1093f4.call(this, _0x530042.call(this, '.' .concat(_0x2c1832)), 'touchmove', function(event) {
3960
event.stopPropagation();
3961
});
3962
}
3963
function createDPad(config) {
3964
let _0xb30294 = config.container,
3965
_0x46ee07 = config.event;
3966
if (typeof _0x46ee07 !== 'function') (_0x46ee07 = function () {});
3967
let _0x2af034 = _0x428003('div', {class: getClass({"dpad-bg": true})}),
3968
_0x573eda = _0x428003('div', {class: getClass({"dpad-front": true})});
3969
3970
function _0x12b76b(event) {
3971
let _0x243fd0 = event.targetTouches[0];
3972
if (_0x243fd0) {
3973
let _0x30ad4f = _0x573eda.getBoundingClientRect(),
3974
_0x3f2d89 = _0x243fd0.clientX - _0x30ad4f.left - _0x573eda.clientWidth / 2,
3975
_0x23d024 = _0x243fd0.clientY - _0x30ad4f.top - _0x573eda.clientHeight / 2,
3976
_0x10098e = 0,
3977
_0x419bd0 = 0,
3978
_0x21a1ad = 0,
3979
_0x1f5439 = 0,
3980
_0x4fda8c = Math.atan(_0x3f2d89 / _0x23d024) / (Math.PI / 180);
3981
3982
_0x23d024 <= -10 && (_0x10098e = 1);
3983
_0x23d024 >= 10 && (_0x419bd0 = 1);
3984
_0x3f2d89 >= 10 && (_0x1f5439 = 1, _0x21a1ad = 0, (_0x4fda8c < 0 && _0x4fda8c >= -35 || _0x4fda8c > 0 && _0x4fda8c <= 35) && (_0x1f5439 = 0), _0x10098e = _0x4fda8c < 0 && _0x4fda8c >= -55 ? 1 : 0, _0x419bd0 = _0x4fda8c > 0 && _0x4fda8c <= 55 ? 1 : 0);
3985
_0x3f2d89 <= -10 && (_0x1f5439 = 0, _0x21a1ad = 1, (_0x4fda8c < 0 && _0x4fda8c >= -35 || _0x4fda8c > 0 && _0x4fda8c <= 35) && (_0x21a1ad = 0), _0x10098e = _0x4fda8c > 0 && _0x4fda8c <= 55 ? 1 : 0, _0x419bd0 = _0x4fda8c < 0 && _0x4fda8c >= -55 ? 1 : 0);
3986
_0x2af034.classList.toggle(getClass({"dpad-right": true}), _0x1f5439);
3987
_0x2af034.classList.toggle(getClass({"dpad-left": true}), _0x21a1ad);
3988
_0x2af034.classList.toggle(getClass({"dpad-up": true}), _0x10098e);
3989
_0x2af034.classList.toggle(getClass({"dpad-down": true}), _0x419bd0);
3990
_0x46ee07(_0x10098e, _0x419bd0, _0x21a1ad, _0x1f5439);
3991
}
3992
event.stopPropagation();
3993
}
3994
function _0x320749(event) {
3995
_0x46ee07(0, 0, 0, 0);
3996
_0x2af034.classList.toggle(getClass({"dpad-up": true}), false);
3997
_0x2af034.classList.toggle(getClass({"dpad-down": true}), false);
3998
_0x2af034.classList.toggle(getClass({"dpad-right": true}), false);
3999
_0x2af034.classList.toggle(getClass({"dpad-left": true}), false);
4000
event.stopPropagation();
4001
}
4002
4003
_0x2af034.innerHTML = '<div class="'.concat(getClass({"dpad-1": true}), '"><div class="').concat(getClass({"dpad-1-bg": true}), '"></div></div>\n <div class="').concat(getClass({"dpad-2": true}), '"><div class="').concat(getClass({"dpad-2-bg": true}), '"></div></div>');
4004
_0xb30294.append(_0x2af034);
4005
_0xb30294.append(_0x573eda);
4006
_0x1093f4.call(_this, _0x573eda, 'touchstart touchmove', _0x12b76b);
4007
_0x1093f4.call(_this, _0x573eda, 'touchend touchcancel', _0x320749);
4008
}
4009
info.forEach((dpad, index) => {
4010
if (dpad.type !== 'dpad') return;
4011
let opts = {};
4012
if (leftHandedMode && ['left', 'right'].includes(dpad.location)) {
4013
dpad.location = (dpad.location==='left') ? 'right' : 'left';
4014
const amnt = JSON.parse(JSON.stringify(dpad));
4015
if (amnt.left) {
4016
dpad.right = amnt.left;
4017
}
4018
if (amnt.right) {
4019
dpad.left = amnt.right;
4020
}
4021
}
4022
opts[dpad.location.toLowerCase()] = true;
4023
const parent = _0x530042.call(this, '.'.concat(getClass({
4024
'ejs-virtual-gamepad': true
4025
}), ' .').concat(getClass(opts)));
4026
opts['dpad_'+index] = true;
4027
const elem = _0x428003('div', {
4028
'class': '.'.concat(getClass({
4029
'ejs-virtual-gamepad': true,
4030
'dpad-container': true
4031
}), ' .').concat(getClass(opts))
4032
});
4033
let style = '';
4034
if (dpad.left) {
4035
style += 'left:'+dpad.left+';';
4036
}
4037
if (dpad.right) {
4038
style += 'right:'+dpad.right+';';
4039
}
4040
if (dpad.top) {
4041
style += 'top:'+dpad.top+';';
4042
}
4043
elem.style = style;
4044
parent.appendChild(elem);
4045
createDPad({container: elem, event: function(up, down, left, right) {
4046
if (dpad.joystickInput) {
4047
if (up === 1) up=0x7fff;
4048
if (down === 1) up=0x7fff;
4049
if (left === 1) up=0x7fff;
4050
if (right === 1) up=0x7fff;
4051
}
4052
_0x378b5c.syncInput(0, dpad.inputValues[0], up);
4053
_0x378b5c.syncInput(0, dpad.inputValues[1], down);
4054
_0x378b5c.syncInput(0, dpad.inputValues[2], left);
4055
_0x378b5c.syncInput(0, dpad.inputValues[3], right);
4056
}});
4057
})
4058
4059
4060
if (this.zoneObj) {
4061
this.zoneObj.forEach((zone) => {
4062
zone.destroy();
4063
})
4064
}
4065
this.zoneObj = [];
4066
let zone;
4067
info.forEach((zone, index) => {
4068
if (zone.type !== 'zone') return;
4069
let opts = {};
4070
if (leftHandedMode && ['left', 'right'].includes(zone.location)) {
4071
zone.location = (zone.location==='left') ? 'right' : 'left';
4072
const amnt = JSON.parse(JSON.stringify(zone));
4073
if (amnt.left) {
4074
zone.right = amnt.left;
4075
}
4076
if (amnt.right) {
4077
zone.left = amnt.right;
4078
}
4079
}
4080
opts[zone.location.toLowerCase()] = true;
4081
const parent = _0x530042.call(this, '.'.concat(getClass({
4082
'ejs-virtual-gamepad': true,
4083
}), ' .').concat(getClass(opts)));
4084
opts['zone_'+index] = true;
4085
const elem = _0x428003('div', {
4086
'class': '.'.concat(getClass({
4087
'ejs-virtual-gamepad': true,
4088
}), ' .').concat(getClass(opts))
4089
});
4090
parent.appendChild(elem);
4091
const zoneObj = _0x3a58c8.a.create({
4092
'zone': elem,
4093
'mode': 'static',
4094
'position': {
4095
'left': zone.left,
4096
'top': zone.top
4097
},
4098
'color': 'red'
4099
});
4100
zoneObj.on('end', function(_0x27f006, _0x1fb527) {
4101
_0x378b5c.syncInput(0, zone.inputValues[0], 0);
4102
_0x378b5c.syncInput(0, zone.inputValues[1], 0);
4103
_0x378b5c.syncInput(0, zone.inputValues[2], 0);
4104
_0x378b5c.syncInput(0, zone.inputValues[3], 0);
4105
});
4106
zoneObj.on('move', function(_0x1b060e, _0x4ae7d6) {
4107
const degree = _0x4ae7d6.angle.degree;
4108
const distance = _0x4ae7d6.distance;
4109
if (zone.joystickInput === true) {
4110
let _0x4773fe = 0, _0x4c3bc7 = 0;
4111
if (degree > 0 && degree <= 45) {
4112
_0x4773fe = distance / 50;
4113
_0x4c3bc7 = -0.022222222222222223 * degree * distance / 50;
4114
}
4115
if (degree > 45 && degree <= 90) {
4116
_0x4773fe = 0.022222222222222223 * (90 - degree) * distance / 50;
4117
_0x4c3bc7 = -distance / 50;
4118
}
4119
if (degree > 90 && degree <= 135) {
4120
_0x4773fe = 0.022222222222222223 * (90 - degree) * distance / 50;
4121
_0x4c3bc7 = -distance / 50;
4122
}
4123
if (degree > 135 && degree <= 180) {
4124
_0x4773fe = -distance / 50;
4125
_0x4c3bc7 = -0.022222222222222223 * (180 - degree) * distance / 50;
4126
}
4127
if (degree > 135 && degree <= 225) {
4128
_0x4773fe = -distance / 50;
4129
_0x4c3bc7 = -0.022222222222222223 * (180 - degree) * distance / 50;
4130
}
4131
if (degree > 225 && degree <= 270) {
4132
_0x4773fe = -0.022222222222222223 * (270 - degree) * distance / 50;
4133
_0x4c3bc7 = distance / 50;
4134
}
4135
if (degree > 270 && degree <= 315) {
4136
_0x4773fe = -0.022222222222222223 * (270 - degree) * distance / 50;
4137
_0x4c3bc7 = distance / 50;
4138
}
4139
if (degree > 315 && degree <= 359.9) {
4140
_0x4773fe = distance / 50;
4141
_0x4c3bc7 = 0.022222222222222223 * (360 - degree) * distance / 50;
4142
}
4143
if (_0x4773fe > 0) {
4144
_0x378b5c.syncInput(0, zone.inputValues[0], 0x7fff * _0x4773fe);
4145
_0x378b5c.syncInput(0, zone.inputValues[1], 0);
4146
} else {
4147
_0x378b5c.syncInput(0, zone.inputValues[1], 0x7fff * -_0x4773fe);
4148
_0x378b5c.syncInput(0, zone.inputValues[0], 0);
4149
}
4150
if (_0x4c3bc7 > 0) {
4151
_0x378b5c.syncInput(0, zone.inputValues[2], 0x7fff * _0x4c3bc7);
4152
_0x378b5c.syncInput(0, zone.inputValues[3], 0);
4153
} else {
4154
_0x378b5c.syncInput(0, zone.inputValues[3], 0x7fff * -_0x4c3bc7);
4155
_0x378b5c.syncInput(0, zone.inputValues[2], 0);
4156
}
4157
4158
} else {
4159
if (degree >= 30 && degree < 150) {
4160
_0x378b5c.syncInput(0, zone.inputValues[0], 1);
4161
} else {
4162
window.setTimeout(function() {
4163
_0x378b5c.syncInput(0, zone.inputValues[0], 0);
4164
}, 30);
4165
}
4166
if (degree >= 210 && degree < 330) {
4167
_0x378b5c.syncInput(0, zone.inputValues[1], 1);
4168
} else {
4169
window.setTimeout(function() {
4170
_0x378b5c.syncInput(0, zone.inputValues[1], 0);
4171
}, 30);
4172
}
4173
if (degree >= 120 && degree < 240) {
4174
_0x378b5c.syncInput(0, zone.inputValues[2], 1);
4175
} else {
4176
window.setTimeout(function() {
4177
_0x378b5c.syncInput(0, zone.inputValues[2], 0);
4178
}, 30);
4179
}
4180
if (degree >= 300 || degree >= 0 && degree < 60) {
4181
_0x378b5c.syncInput(0, zone.inputValues[3], 1);
4182
} else {
4183
window.setTimeout(function() {
4184
_0x378b5c.syncInput(0, zone.inputValues[3], 0);
4185
}, 30);
4186
}
4187
}
4188
});
4189
this.zoneObj.push(zoneObj);
4190
})
4191
4192
let keys = [];
4193
for (let i=0; i<info.length; i++) {
4194
if (info[i].type !== 'button') continue;
4195
let opts = {};
4196
opts['b_'+info[i].id.toLowerCase()] = true;
4197
let value;
4198
if (_this.newCores === 2 && info[i].input_new_cores) {
4199
value = info[i].input_new_cores;
4200
} else {
4201
value = info[i].input_value;
4202
}
4203
keys.push({id: opts, number: value});
4204
}
4205
keys.forEach((a) => {
4206
let element = _0x530042.call(_this, '.'.concat(_0x2c1832, ' .').concat(getClass(a.id)));
4207
if (!element) return;
4208
_0x1093f4.call(_this, element, 'touchstart touchend touchcancel', function(e) {
4209
if (e.type === 'touchend' || e.type === 'touchcancel') {
4210
_0x3a8e2f(e.target, _0x2ec721, false);
4211
window.setTimeout(function() {
4212
_0x378b5c.syncInput(0, a.number, 0);
4213
}, 30)
4214
} else {
4215
_0x3a8e2f(e.target, _0x2ec721, true);
4216
_0x378b5c.syncInput(0, a.number, 1)
4217
}
4218
e.preventDefault();
4219
})
4220
});
4221
4222
if (!forceUpdateHTML) {
4223
const menuButton = _0x428003('div', {
4224
'class': getClass({
4225
'ejs__widget': true,
4226
'ejs__widget_controls_toggle': true
4227
})
4228
}, '');
4229
menuButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96zM0 256C0 238.3 14.33 224 32 224H416C433.7 224 448 238.3 448 256C448 273.7 433.7 288 416 288H32C14.33 288 0 273.7 0 256zM416 448H32C14.33 448 0 433.7 0 416C0 398.3 14.33 384 32 384H416C433.7 384 448 398.3 448 416C448 433.7 433.7 448 416 448z"/></svg>';
4230
_0x530042.call(this, ".".concat(getClass({ejs__widgets: true}))).appendChild(menuButton);
4231
let hideTimeout;
4232
_0x1093f4.call(this, menuButton, 'mousedown touchstart', function(e) {
4233
_0x3a8e2f(e.target, _0x2ec721, true);
4234
clearTimeout(hideTimeout);
4235
_0x5ab74d.toggleControls.call(_this, true);
4236
hideTimeout = setTimeout(function() {
4237
_0x5ab74d.toggleControls.call(_this, false);
4238
}, 5000)
4239
});
4240
}
4241
},
4242
'setup': function() {
4243
let _this = this;
4244
if (!this.game) {
4245
console.warn('No game element found!');
4246
return;
4247
}
4248
_0x378b5c.playerName = _this.config.playerName;
4249
_0x3a8e2f(this.elements.container, this.config.classNames.type, true);
4250
this.elements.container.setAttribute('tabindex', '0');
4251
if (this.color) {
4252
let _0x17edbf = function(_0x175d8e) {
4253
let _0x17edbf = _0x175d8e.toLowerCase();
4254
if (_0x17edbf && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/ .test(_0x17edbf)) {
4255
if (0x4 === _0x17edbf.length) {
4256
for (let _0x2c1832 = '#', _0x4c881f = 1; _0x4c881f < 0x4; _0x4c881f += 1) _0x2c1832 += _0x17edbf.slice(_0x4c881f, _0x4c881f + 1).concat(_0x17edbf.slice(_0x4c881f, _0x4c881f + 1));
4257
_0x17edbf = _0x2c1832;
4258
}
4259
let _0x5ac4ff = [];
4260
for (let _0x324169 = 1; _0x324169 < 0x7; _0x324169 += 2) _0x5ac4ff.push(parseInt('0x' .concat(_0x17edbf.slice(_0x324169, _0x324169 + 2)), 0x10));
4261
return _0x5ac4ff;
4262
}
4263
return null;
4264
}(this.color);
4265
_0x17edbf && this.elements.container.setAttribute('style', '--ejs-primary-color: ' .concat(_0x17edbf[0], ', ').concat(_0x17edbf[1], ', ').concat(_0x17edbf[2]));
4266
}
4267
this.elements.wrapper = _0x428003('div', {
4268
'class': this.config.classNames.video
4269
});
4270
_0x580edd(this.game, this.elements.wrapper);
4271
if ('video' !== _this.game.tagName.toLocaleLowerCase()) {
4272
let _0x2c1832 = this.config.volume;
4273
Object.defineProperty(_this.game, 'volume', {
4274
'get': function() {
4275
return _0x2c1832;
4276
},
4277
'set': function(_0x4cca18) {
4278
_0x2c1832 = _0x4cca18, _0xbae705.call(_this, _this.game, 'volumechange');
4279
}
4280
});
4281
let _0x541fe1 = _this.storage.get('muted');
4282
Object.defineProperty(_this.game, 'muted', {
4283
'get': function() {
4284
return _0x541fe1;
4285
},
4286
'set': function(_0x54b6e0) {
4287
let _0x2c1832 = !!_0x1e2c68.boolean(_0x54b6e0) && _0x54b6e0;
4288
_0x541fe1 = _0x2c1832, _0xbae705.call(_this, _this.game, 'volumechange');
4289
}
4290
});
4291
}
4292
window.addEventListener('beforeunload', function(_0x34b11a) {
4293
if (_this.started && _this.getStartName()) {
4294
_0x27f4c4.FS.syncfs(function() {});
4295
_0x378b5c.saveSavFiles();
4296
_0x27f4c4.FS.syncfs(function() {});
4297
}
4298
}, true);
4299
//Wille save savefiles to indexeddb
4300
window.saveSaveFiles = function() {
4301
if (!_this.getStartName()) return;
4302
console.log('saving save files');
4303
_0x378b5c.saveSavFiles();
4304
_0x27f4c4.FS.syncfs(false, function() {});
4305
}
4306
setInterval(function() {
4307
if (_this.started) {
4308
saveSaveFiles();
4309
}
4310
}, 60000) //60000 = 1 minute
4311
},
4312
'listeners': function() {
4313
let _this = this;
4314
const elem = _0x530042.call(_this, '.' .concat(getClass({
4315
'ejs__dialogs': true
4316
})));
4317
let counter = 0;
4318
_0x1093f4.call(_this, elem, 'dragenter', function(e) {
4319
e.preventDefault();
4320
counter++;
4321
_0x132da7(_this.elements.dialogs.message, false);
4322
});
4323
_0x1093f4.call(_this, elem, 'dragover', function(e) {
4324
e.preventDefault();
4325
});
4326
_0x1093f4.call(_this, elem, 'dragleave', function(e) {
4327
e.preventDefault();
4328
counter--;
4329
if (counter === 0) {
4330
_0x132da7(_this.elements.dialogs.message, true);
4331
}
4332
});
4333
_0x1093f4.call(_this, elem, 'dragend', function(e) {
4334
e.preventDefault();
4335
counter = 0;
4336
_0x132da7(_this.elements.dialogs.message, true);
4337
});
4338
_0x1093f4.call(_this, elem, 'drop', function(e) {
4339
e.preventDefault();
4340
_0x132da7(_this.elements.dialogs.message, true);
4341
counter = 0;
4342
const items = e.dataTransfer.items;
4343
let file;
4344
for (let i=0; i<items.length; i++) {
4345
if (items[i].kind !== 'file') continue;
4346
file = items[i];
4347
break;
4348
}
4349
if (!file) return;
4350
const fileHandle = file.getAsFile();
4351
fileHandle.arrayBuffer().then(data => {
4352
_0x378b5c.loadState(new Uint8Array(data), 0);
4353
})
4354
});
4355
_this.elements.buttons.restart && _0x1093f4.call(_this, _this.elements.buttons.restart, 'click', function(_0x5cfc51) {
4356
_0x378b5c.restartGame();
4357
_0x378b5c.inputsData = {};
4358
if (_0x378b5c.connected && _0x378b5c.connection.isInitiator) {
4359
(async () => {
4360
const state = await _0x378b5c.saveState();
4361
const file = new File([state], '0-game.state', {
4362
'type': '',
4363
'lastModified': new Date()
4364
});
4365
_0x378b5c.connection.shareFile(file);
4366
_0x378b5c.inputsData = {};
4367
_0x378b5c.wait = true;
4368
_0x378b5c.systemPause(1);
4369
_0x27f4c4.Module.pauseMainLoop();
4370
_0x378b5c.disableControl(true);
4371
})();
4372
}
4373
saveSaveFiles();
4374
});
4375
_this.elements.buttons.screenRecord && _0x1093f4.call(_this, _this.elements.buttons.screenRecord, 'click', function(_0x5cfc51) {
4376
if (! _this.recordData) {
4377
_this.recordData = {started:false, data:[], stopped: false};
4378
}
4379
if (! _this.recordData.started) { //start recording
4380
let options;
4381
if (MediaRecorder.isTypeSupported('video/webm; codecs=h264')) {
4382
options = {mimeType: 'video/webm; codecs=h264'};
4383
} else if (MediaRecorder.isTypeSupported('video/webm; codecs=H264')) {
4384
options = {mimeType: 'video/webm; codecs=H264'};
4385
} else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp9')) {
4386
options = {mimeType: 'video/webm; codecs=vp9'};
4387
} else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp8')) {
4388
options = {mimeType: 'video/webm; codecs=vp8'};
4389
} else if (MediaRecorder.isTypeSupported('video/webm; codecs=avc1')) {
4390
options = {mimeType: 'video/webm; codecs=avc1'};
4391
} else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp9.0')) {
4392
options = {mimeType: 'video/webm; codecs=vp9.0'};
4393
} else if (MediaRecorder.isTypeSupported('video/webm; codecs=vp8.0')) {
4394
options = {mimeType: 'video/webm; codecs=vp8.0'};
4395
} else {
4396
options = {};
4397
}
4398
function gotStreams(stream) {
4399
_this.elements.buttons.screenRecord.querySelector('.'.concat(getClass({
4400
'ejs__tooltip': true
4401
}))).innerHTML = _this.localization('Stop Screen Recording');
4402
_this.recordData.stream = stream;
4403
_this.recordData.recorder = new MediaRecorder(_this.recordData.stream, options);
4404
_this.recordData.recorder.ondataavailable = function(e) {
4405
if (e.data.size > 0) {
4406
_this.recordData.data.push(e.data)
4407
}
4408
if (_this.recordData.stopped) {
4409
let a = document.createElement("a")
4410
a.href = window.URL.createObjectURL(new Blob(_this.recordData.data, {type: "video/webm"}))
4411
let aname;
4412
if (typeof _this.gameName == 'string') {
4413
aname = _this.gameName
4414
}
4415
a.download = aname ? '' .concat(aname, '-recording.webm') : 'record.webm';
4416
a.click()
4417
window.URL.revokeObjectURL(a.href)
4418
delete _this.recordData
4419
_this.elements.buttons.screenRecord.querySelector('.'.concat(getClass({
4420
'ejs__tooltip': true
4421
}))).innerHTML = _this.localization('Start Screen Recording');
4422
}
4423
}
4424
_this.recordData.recorder.start()
4425
_this.recordData.started = true
4426
}
4427
if (window.navigator && navigator.mediaDevices && typeof navigator.mediaDevices.getDisplayMedia === 'function') {
4428
_0x27f4c4.Module.pauseMainLoop();
4429
_this.playing = false;
4430
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');
4431
let time = setTimeout(function() {
4432
_this.playing = true;
4433
_0x27f4c4.Module.resumeMainLoop();
4434
}, 20000);
4435
navigator.mediaDevices.getDisplayMedia({
4436
audio: true, //we only need the audio, we dont use the video stream at all
4437
video: {mediaSource: "screen"}
4438
}).then(function(stream) {
4439
let canvasStream = _0x27f4c4.Module.canvas.captureStream(30);
4440
try {
4441
clearTimeout(time);
4442
}catch(e){}
4443
let audio = stream.getAudioTracks();
4444
for (let i=0; i<audio.length; i++) {
4445
canvasStream.addTrack(audio[i]);
4446
}
4447
gotStreams(canvasStream);
4448
_this.playing = true;
4449
_0x27f4c4.Module.resumeMainLoop();
4450
})
4451
} else {
4452
let canvasStream = _0x27f4c4.Module.canvas.captureStream(30);
4453
gotStreams(canvasStream);
4454
}
4455
} else if (_this.recordData.started) { //stop recording
4456
_this.recordData.recorder.stop()
4457
_this.recordData.stopped = true
4458
}
4459
4460
});
4461
_this.elements.buttons.cacheManager && _0x1093f4.call(_this, _this.elements.buttons.cacheManager, 'click', function(_0x5cfc51) {
4462
if (_0x27f4c4.romdb) {
4463
_0x132da7(_this.elements.dialogs.cache, false);
4464
let _0x3360eb = _this.elements.dialogs.cache.querySelector('.' .concat(_0x378b5c.classNames['dialog-content']));
4465
_0x3360eb.innerHTML = '<div>'+_this.localization('Loading')+'</div>';
4466
_0x27f4c4.romdb.getAll(function(_0x43586d) {
4467
if (_0x43586d) {
4468
let _0x275730 = _0x428003('table', {
4469
'style': 'width:100%;padding-left:10px;text-align:left'
4470
}),
4471
_0x1ab9e9 = _0x428003('tbody');
4472
_0x43586d.length > 0 ? (_0x3360eb.innerHTML = '', _0x43586d.forEach(function(_0x32b0b7, _0x2d0e11) {
4473
if (_0x32b0b7.key && !/-part-\d+$/ .test(_0x32b0b7.key)) {
4474
let _0x277c67 = [_0x32b0b7.key];
4475
for (let _0x3360eb = Math.ceil(_0x32b0b7.filesize / 0x6400000), _0x3edb35 = 1; _0x3edb35 < _0x3360eb; _0x3edb35 += 1) _0x277c67.push('' .concat(_0x32b0b7.key, '-part-').concat(_0x3edb35));
4476
let _0x3e31f6 = _0x428003('tr'),
4477
_0x5b75bd = _0x428003('td'),
4478
_0x227405 = _0x428003('td'),
4479
_0xac150b = _0x428003('td');
4480
_0x5b75bd.innerHTML = _0x32b0b7.filename, _0x227405.innerHTML = function(_0x1858c1) {
4481
let _0x2d0e11 = -1;
4482
do {
4483
_0x1858c1 /= 0x400, _0x2d0e11++;
4484
} while (_0x1858c1 > 0x400);
4485
return Math.max(_0x1858c1, 0.1).toFixed(1) + [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'][_0x2d0e11];
4486
}(_0x32b0b7.filesize), _0xac150b.innerHTML = '<a href="#" onclick="return false">Remove</a>', _0x3e31f6.appendChild(_0x5b75bd), _0x3e31f6.appendChild(_0x227405), _0x3e31f6.appendChild(_0xac150b), _0x1ab9e9.appendChild(_0x3e31f6), _0xac150b.querySelector('a').onclick = function(_0x16f22a) {
4487
_0x27f4c4.romdb.removeBatch(_0x277c67);
4488
try {
4489
_0x1ab9e9.removeChild(_0x3e31f6);
4490
} catch (_0x353628) {}
4491
return _0x16f22a.stopPropagation(), false;
4492
};
4493
}
4494
}), _0x275730.appendChild(_0x1ab9e9), _0x3360eb.appendChild(_0x275730)) : _0x3360eb.innerHTML = '<div style="text-align:center">'+_this.localization('Empty')+'</div>';
4495
} else _0x3360eb.innerHTML = '<div style="text-align:center">'+_this.localization('Empty')+'</div>';
4496
}, function() {});
4497
}
4498
return false;
4499
})
4500
_this.elements.buttons.play && Array.from(_this.elements.buttons.play).forEach(function(_0x24495b) {
4501
_0x1093f4.call(_this, _0x24495b, 'click', function(_0x966382) {
4502
if (_this.playing) {
4503
_this.playing = false;
4504
_0x27f4c4.Module.pauseMainLoop();
4505
if (_0x378b5c.connected && _0x378b5c.connection.isInitiator) {
4506
_0x378b5c.connection.send(JSON.stringify({
4507
'act': 'pause'
4508
}))
4509
}
4510
_0xbae705.call(_this, _this.elements.container, 'pause', false, {
4511
'pause': true
4512
})
4513
} else {
4514
_this.playing = true;
4515
_0x27f4c4.Module.resumeMainLoop();
4516
if (_0x378b5c.connected && _0x378b5c.connection.isInitiator) {
4517
_0x378b5c.connection.send(JSON.stringify({
4518
'act': 'resume'
4519
}))
4520
}
4521
_0xbae705.call(_this, _this.elements.container, 'pause', false, {
4522
'pause': false
4523
});
4524
}
4525
});
4526
}), _this.elements.buttons.netplay && _0x1093f4.call(_this, _this.elements.buttons.netplay, 'click', function(_0x2317b9) {
4527
if (window.EJS_TURN_URLS !== null && !window.EJS_TURN_URLS) {
4528
(async function(server) {
4529
try {
4530
let resp = await fetch(server + 'webrtc');
4531
window.EJS_TURN_URLS = JSON.parse(await resp.text());
4532
} catch(e) {
4533
window.EJS_TURN_URLS = null;
4534
console.warn("Could not contact netplay server", e);
4535
}
4536
})(_this.listUrl);
4537
}
4538
_0x378b5c.disableControl(true);
4539
_0x132da7(_this.elements.dialogs.netplay, false);
4540
if (_0x378b5c.players.length > 0) {
4541
_0x378b5c.openRoom(_0xa88a13);
4542
} else {
4543
_0x378b5c.stopLoadRooms();
4544
_0x378b5c.loadRoomsList();
4545
}
4546
if (!_0x378b5c.playerName) {
4547
_0x4d8495.show('modal-9de6c4e9ce2b9361', {
4548
'closeByEsckey': false
4549
});
4550
}
4551
}), _this.elements.buttons.cheat && _0x1093f4.call(_this, _this.elements.buttons.cheat, 'click', function(_0x44b01a) {
4552
_0x132da7(_this.elements.dialogs.cheat, false);
4553
});
4554
_this.game.stateloadField = _0x428003('input');
4555
_this.game.stateloadField.type = 'file';
4556
_this.game.stateloadField.onchange = function _0x17edbf(_0xcd4599) {
4557
let _0xfd246e, _0x3fdd71 = _0xcd4599.target.files;
4558
_0x3fdd71.length > 0 && ((_0xfd246e = new FileReader()).file_name = _0x3fdd71[0].name, _0xfd246e.onload = function() {
4559
EJS_loadState(new Uint8Array(_0xfd246e.result));
4560
}, _0xfd246e.readAsArrayBuffer(_0x3fdd71[0])), _this.game.stateloadField = _0x428003('input'), _this.game.stateloadField.type = 'file', _this.game.stateloadField.onchange = _0x17edbf;
4561
};
4562
_0x1093f4.call(_this, _this.elements.container, 'loadstate', function(_0x13504c) {
4563
if (_0x378b5c.saveLoadDB.call(_this, 'load')) {
4564
return;
4565
}
4566
_0x1e2c68.function(_this.config.onloadstate) ? _this.config.onloadstate.call(null, _this.loadState) : _this.game.stateloadField.click(), _this.elements.container.focus();
4567
});
4568
document.addEventListener('visibilitychange', function() {
4569
'hidden' === document.visibilityState ? console.log('hidden') : console.log('active');
4570
});
4571
},
4572
'bindFunction': function() {
4573
let _this = this,
4574
_0x17edbf = getSystem(_this.system, true);
4575
if (_0x27f4c4.Module && _0x27f4c4.Module._set_volume) {
4576
let _0x2c1832 = _0x27f4c4.Module.cwrap('set_volume', 'null', ['number']);
4577
_0x378b5c.setVolume = function() {
4578
let _0x17edbf = 0;
4579
_this.volume < 1 && (_0x17edbf = 0 === _this.volume ? -0x50 : 0x1e * _this.volume - 0x1e, _0x2c1832(_0x17edbf)), _this.muted && (_0x17edbf = -0x50), _0x2c1832(_0x17edbf);
4580
};
4581
}
4582
if (_0x27f4c4.Module._save_file_path) {
4583
_0x378b5c.getSaveFilePath = _0x27f4c4.Module.cwrap('save_file_path', 'string', []);
4584
} else {
4585
_0x378b5c.getSaveFilePath = () => null;
4586
}
4587
// Returns a Uint8Array of the save file
4588
_0x378b5c.readSaveFile = function() {
4589
return FS.readFile(_0x378b5c.getSaveFilePath());
4590
}
4591
_0x378b5c.setVariable = _0x27f4c4.Module.cwrap('set_variable', 'null', ['string', 'string']);
4592
_0x378b5c.simulateInputFn = _0x27f4c4.Module.cwrap('simulate_input', 'null', ['number', 'number', 'number']);
4593
let _0x2c63cc = {
4594
0: null,
4595
1: null,
4596
2: null,
4597
3: null,
4598
4: null,
4599
5: null,
4600
6: null,
4601
7: null,
4602
8: null,
4603
9: null,
4604
10: null,
4605
11: null,
4606
12: null,
4607
13: null,
4608
14: null,
4609
15: null,
4610
16: null,
4611
17: null,
4612
18: null,
4613
19: null,
4614
20: null,
4615
21: null,
4616
22: null,
4617
23: null,
4618
24: null,
4619
25: null,
4620
26: null,
4621
27: null,
4622
28: null,
4623
29: null,
4624
30: null,
4625
31: null
4626
};
4627
_0x378b5c.simulateInput = function(player, index, value) {
4628
if (_0x378b5c.connected) {
4629
if (_this.playing && !_0x378b5c.disableInput) {
4630
var _0x35b9c1 = _0x378b5c.connection.userid,
4631
_0x4d96ad = _0x378b5c.roomMaster === _0x35b9c1,
4632
_0xf1bb97 = _0x378b5c.players.indexOf(_0x35b9c1),
4633
_0x52e1f4 = _0x378b5c.currentFrameNum();
4634
player >> 0x0 == 0x0 && (_0x2c63cc[index] !== value && (_0x4d96ad ? (_0x378b5c.inputsData[_0x52e1f4] || (_0x378b5c.inputsData[_0x52e1f4] = []), _0x378b5c.inputsData[_0x52e1f4].push({
4635
'index': _0xf1bb97,
4636
'key': index,
4637
'status': value,
4638
'frame': _0x52e1f4
4639
}),_0x378b5c.simulateInputFn(_0xf1bb97, index, value)) : _0x378b5c.connection.send(JSON.stringify({
4640
'act': 'sync-control',
4641
'value': ['' .concat(_0xf1bb97, '|').concat(index, '|').concat(value, '|').concat(_0x52e1f4)]
4642
}), _0x378b5c.roomMaster)), _0x2c63cc[index] = value);
4643
}
4644
} else _0x378b5c.disableInput || _0x378b5c.simulateInputFn(player, index, value);
4645
};
4646
_0x378b5c.syncInput = _0x378b5c.simulateInput;
4647
window.simulateInput = _0x378b5c.simulateInput;
4648
_0x378b5c.toggleShader = _0x27f4c4.Module.cwrap('shader_enable', 'null', ['number']);
4649
if (_this.coreVer !== 2) {
4650
_0x378b5c.getStateInfo = _0x27f4c4.Module.cwrap('get_state_info', 'string', []);
4651
} else {
4652
_0x378b5c.getInfoOfState = _0x27f4c4.Module.cwrap('get_state_info', 'string', []);
4653
_0x378b5c.getStateInfo1 = _0x27f4c4.Module.cwrap('save_state_info', 'null', []);
4654
_0x378b5c.getStateInfo = function() {
4655
_0x378b5c.getStateInfo1();
4656
return new Promise(function(resolve, reject) {
4657
let a = _0x378b5c.getInfoOfState();
4658
if (a) {
4659
resolve(a);
4660
return;
4661
}
4662
let b = setInterval(function() {
4663
a = _0x378b5c.getInfoOfState();
4664
if (a) {
4665
clearInterval(b);
4666
resolve(a);
4667
}
4668
}, 50)
4669
});
4670
}
4671
}
4672
_0x378b5c.saveState = async function() {
4673
let _0xa88a14;
4674
let _0x17edbf;
4675
if (_this.coreVer !== 2) {
4676
_0x17edbf = _0x378b5c.getStateInfo().split('|');
4677
} else {
4678
_0x17edbf = (await _0x378b5c.getStateInfo()).split('|');
4679
}
4680
let _0x2c1832 = _0x17edbf[0] >> 0;
4681
if (_0x2c1832 > 0) {
4682
_0xa88a14 = new Uint8Array(_0x2c1832);
4683
for (let _0x2ef6be = _0x17edbf[1] >> 0, _0x3cc34b = 0; _0x3cc34b < _0x2c1832; _0x3cc34b++) _0xa88a14[_0x3cc34b] = _0x27f4c4.Module.getValue(_0x2ef6be + _0x3cc34b);
4684
}
4685
return _0xa88a14;
4686
};
4687
let _0x25a7a2 = _0x27f4c4.Module.cwrap('load_state', 'number', ['string', 'number']);
4688
_0x378b5c.loadState = function(_0x4389ae, _0x1d4918) {
4689
let _0x91cd69;
4690
_0x91cd69 = _0x4389ae;
4691
try {
4692
_0x27f4c4.FS.unlink('game.state');
4693
} catch(e){}
4694
_0x27f4c4.FS.createDataFile('/', 'game.state', _0x91cd69, true, true);
4695
null === _0x1d4918 && (_0x1d4918 = 0);
4696
if ('arcade' === _0x17edbf) {
4697
setTimeout(function() {
4698
_0x378b5c.getStateInfo();
4699
_0x25a7a2('game.state', _0x1d4918);
4700
_0x27f4c4.FS.unlink('game.state');
4701
}, 0xa)
4702
} else {
4703
_0x25a7a2('game.state', _0x1d4918);
4704
setTimeout(function() {
4705
_0x27f4c4.FS.unlink('game.state');
4706
}, 100)
4707
}
4708
if (_0x378b5c.connected && _0x378b5c.connection.isInitiator) {
4709
(async () => {
4710
const state = await _0x378b5c.saveState();
4711
const file = new File([state], '0-game.state', {
4712
'type': '',
4713
'lastModified': new Date()
4714
});
4715
_0x378b5c.connection.shareFile(file);
4716
_0x378b5c.inputsData = {};
4717
_0x378b5c.wait = true;
4718
_0x378b5c.systemPause(1);
4719
_0x27f4c4.Module.pauseMainLoop();
4720
_0x378b5c.disableControl(true);
4721
})();
4722
}
4723
_this.elements.container.focus();
4724
};
4725
_0x27f4c4.Module._set_cheat && (_0x378b5c.setCheat = _0x27f4c4.Module.cwrap('set_cheat', 'number', ['number', 'number', 'string']));
4726
_0x27f4c4.Module._reset_cheat && (_0x378b5c.resetCheat = _0x27f4c4.Module._reset_cheat);
4727
_0x378b5c.quickSaveState = async function() {
4728
if (_this.started && !_0x378b5c.connected) {
4729
if (_this.statesSupported === false) {
4730
_0x378b5c.doMessageTransition('CANNOT CURRENTLY LOAD STATE');
4731
return;
4732
}
4733
let slot;
4734
if (_0x2593da && typeof _0x2593da.getCoreOptionsValue == 'function') {
4735
slot = _0x2593da.getCoreOptionsValue('save-state-slot');
4736
if (! slot) {
4737
slot = 1;
4738
}
4739
} else {
4740
slot = 1;
4741
}
4742
let name = slot + '-quick.state';
4743
try {
4744
_0x27f4c4.FS.unlink(name);
4745
} catch (_0x4b4d4c) {}
4746
try {
4747
let _0x17edbf = await _0x378b5c.saveState();
4748
_0x27f4c4.FS.createDataFile('/', name, _0x17edbf, true, true);
4749
_0x378b5c.doMessageTransition('STATE SAVED TO SLOT ' + slot);
4750
} catch(e) {
4751
console.warn(e);
4752
_0x378b5c.doMessageTransition('FAILED TO SAVE STATE TO SLOT ' + slot);
4753
}
4754
saveSaveFiles();
4755
}
4756
};
4757
_0x378b5c.saveMsgTransitions = null;
4758
_0x378b5c.doMessageTransition = function(message) {
4759
_this.elements.widgets.stateInfoDiv.innerText = message;
4760
clearTimeout(_0x378b5c.saveMsgTransitions);
4761
_0x378b5c.saveMsgTransitions = setTimeout(function() {
4762
_this.elements.widgets.stateInfoDiv.innerText = '';
4763
}, 1500)
4764
}
4765
_0x378b5c.quickLoadState = function() {
4766
if (_this.started && !_0x378b5c.connected) {
4767
if (_this.statesSupported === false) {
4768
_0x378b5c.doMessageTransition('CANNOT CURRENTLY LOAD STATE');
4769
return;
4770
}
4771
let slot;
4772
if (_0x2593da && typeof _0x2593da.getCoreOptionsValue == 'function') {
4773
slot = _0x2593da.getCoreOptionsValue('save-state-slot');
4774
if (! slot) {
4775
slot = 1;
4776
}
4777
} else {
4778
slot = 1;
4779
}
4780
let name = slot + '-quick.state';
4781
let success = true;
4782
try {
4783
_0x25a7a2(name, 0);
4784
if ('arcade' === _0x17edbf) {
4785
setTimeout(function() {
4786
_0x378b5c.getStateInfo();
4787
_0x25a7a2(name, 0);
4788
}, 0xa);
4789
}
4790
} catch (_0x4ee386) {
4791
success = false;
4792
}
4793
if (! success) {
4794
_0x378b5c.doMessageTransition('FAILED TO LOAD STATE FROM SLOT ' + slot);
4795
} else {
4796
_0x378b5c.doMessageTransition('LOADED STATE FROM SLOT ' + slot);
4797
}
4798
saveSaveFiles();
4799
}
4800
};
4801
_0x378b5c.changeStateSlot = function(e) {
4802
let slot;
4803
if (_0x2593da && typeof _0x2593da.getCoreOptionsValue == 'function') {
4804
slot = _0x2593da.getCoreOptionsValue('save-state-slot');
4805
}
4806
if (!slot) {
4807
slot = 1;
4808
}
4809
let newSlot;
4810
if (typeof e != 'number') {
4811
newSlot = slot + 1;
4812
} else {
4813
newSlot = e;
4814
}
4815
if (newSlot > 9) {
4816
newSlot = 1;
4817
}
4818
_0x7f9f36.updateCoreOptions.call(_this, 'save-state-slot', newSlot);
4819
_0x378b5c.doMessageTransition('SET SAVE STATE SLOT TO ' + newSlot);
4820
};
4821
window.EJS_loadState = function(data) {
4822
_0x378b5c.loadState(data, 0);
4823
setTimeout(() => {
4824
if (_0x378b5c.connected) {
4825
var file = new File([data], '0-game.state', {
4826
'type': '',
4827
'lastModified': new Date()
4828
});
4829
_0x378b5c.connection.shareFile(file);
4830
_0x378b5c.inputsData = {};
4831
_0x378b5c.wait = true;
4832
_0x378b5c.systemPause(1);
4833
_0x27f4c4.Module.pauseMainLoop();
4834
_0x378b5c.disableControl(true);
4835
}
4836
}, 0x1e);
4837
};
4838
window.EJS_saveState = function() {
4839
return _0x378b5c.saveState();
4840
}
4841
let _0x840cf4 = _0x27f4c4.Module.cwrap('cmd_take_screenshot', '', []);
4842
_0x378b5c.getScreenData = function() {
4843
_0x840cf4();
4844
return _0x27f4c4.FS.readFile('screenshot.png');
4845
};
4846
_0x378b5c.restartGame = _0x27f4c4.Module.cwrap('system_restart', '', []);
4847
_0x378b5c.currentFrameNum = _0x27f4c4.Module.cwrap('get_current_frame_count', '', []);
4848
_0x378b5c.saveSavFiles = _0x27f4c4.Module.cwrap('cmd_savefiles', '', []);
4849
_0x27f4c4.Module._get_core_options && (_0x378b5c.getGameCoreOptions = _0x27f4c4.Module.cwrap('get_core_options', 'string', []));
4850
_0x378b5c.systemPause = function(e) {
4851
return false;
4852
};
4853
_0x378b5c.controllers = _0x2593da.storage.get('controllers');
4854
_0x378b5c.controllers || (_0x378b5c.controllers = JSON.parse(JSON.stringify(_0x378b5c.defaultControllers)));
4855
}
4856
}
4857
let _0xdcec2a = _0x378b5c;
4858
4859
function _0x5005e6(_0x7f3270, _0x477158) {
4860
return function(_0x20890f) {
4861
if (Array.isArray(_0x20890f)) return _0x20890f;
4862
}(_0x7f3270) || function(_0x557107, _0x409476) {
4863
let _0x2c1832 = [],
4864
_0x488a47 = true,
4865
_0x34f76e = false,
4866
_0x19606f = undefined;
4867
try {
4868
for (let _0x328f4d, _0x4d9086 = _0x557107[Symbol.iterator](); !(_0x488a47 = (_0x328f4d = _0x4d9086.next()).done) && (_0x2c1832.push(_0x328f4d.value), !_0x409476 || _0x2c1832.length !== _0x409476); _0x488a47 = true);
4869
} catch (_0x13c09a) {
4870
_0x34f76e = true, _0x19606f = _0x13c09a;
4871
} finally {
4872
try {
4873
_0x488a47 || null == _0x4d9086.return || _0x4d9086.return();
4874
} finally {
4875
if (_0x34f76e) throw _0x19606f;
4876
}
4877
}
4878
return _0x2c1832;
4879
}(_0x7f3270, _0x477158) || function() {
4880
throw new TypeError('Invalid attempt to destructure non-iterable instance');
4881
}();
4882
}
4883
const _0x7f9f36 = {
4884
'storage': null,
4885
'coreOptionsValues': {},
4886
'contextMenu': null,
4887
'normalOptions': {
4888
'shader': {
4889
'label': 'Shader',
4890
'options': {
4891
'disabled': 'Disabled',
4892
'2xScaleHQ.glslp': '2xScaleHQ',
4893
'4xScaleHQ.glslp': '4xScaleHQ',
4894
'crt-easymode.glslp': 'CRT easymode',
4895
'crt-aperture.glslp': 'CRT aperture',
4896
'crt-geom.glslp': 'CRT geom',
4897
'crt-mattias.glslp': 'CRT mattias'
4898
},
4899
'default': 'disabled'
4900
},
4901
'virtual-gamepad': {
4902
'label': 'Virtual Gamepad',
4903
'options': {
4904
'disabled': 'Disabled',
4905
'enabled': 'Enabled'
4906
},
4907
'default': 'enabled'
4908
}
4909
},
4910
'defaultCoreOptionsValues': function() {
4911
let _0xa88a13 = {};
4912
if (this.coreVer === 2) {
4913
return {};
4914
}
4915
switch (this.system) {
4916
case 'pce':
4917
_0xa88a13 = {
4918
'pce_nospritelimit': 'enabled'
4919
};
4920
break;
4921
case 'jaguar':
4922
_0xa88a13 = {
4923
'virtualjaguar_doom_res_hack': 'enabled'
4924
};
4925
break;
4926
case 'psx':
4927
_0xa88a13 = {
4928
'pcsx_rearmed_memcard2': 'enabled'
4929
};
4930
break;
4931
case 'nds':
4932
_0xa88a13 = {};
4933
}
4934
return _0xa88a13;
4935
},
4936
'getCoreOptionsValues': function() {
4937
if (_0x7f9f36.coreOptionsValues) {
4938
return JSON.parse(JSON.stringify(_0x7f9f36.coreOptionsValues));
4939
}
4940
let _0xa88a13 = _0x7f9f36.storage.get('core-options');
4941
_0x1e2c68.empty(_0xa88a13) && (_0xa88a13 = {});
4942
return _0xa88a13;
4943
},
4944
'getCoreOptionsValue': function(key) {
4945
if (_0x7f9f36.coreOptionsValues) {
4946
let rv = JSON.parse(JSON.stringify(_0x7f9f36.coreOptionsValues))[key];
4947
if (rv) return rv;
4948
}
4949
let _0xa88a13 = _0x7f9f36.storage.get('core-options');
4950
_0x1e2c68.empty(_0xa88a13) && (_0xa88a13 = {});
4951
return _0xa88a13[key];
4952
},
4953
'getCoreOptions': function() {
4954
let _0xa88a13 = {};
4955
switch (this.system) {
4956
case 'nes':
4957
_0xa88a13.fceumm_palette = {
4958
'label': this.localization('Color Palette'),
4959
'options': {
4960
'default': this.localization('Default'),
4961
'asqrealc': 'asqrealc',
4962
'nintendo-vc': 'nintendo-vc',
4963
'rgb': 'rgb',
4964
'yuv-v3': 'yuv-v3',
4965
'unsaturated-final': 'unsaturated-final',
4966
'sony-cxa2025as-us': 'sony-cxa2025as-us',
4967
'pal': 'pal',
4968
'bmf-final2': 'bmf-final2',
4969
'bmf-final3': 'bmf-final3',
4970
'smooth-fbx': 'smooth-fbx',
4971
'composite-direct-fbx': 'composite-direct-fbx',
4972
'pvm-style-d93-fbx': 'pvm-style-d93-fbx',
4973
'nescap': 'nescap',
4974
'ntsc-hardware-fbx': 'ntsc-hardware-fbx',
4975
'nes-classic-fbx-fs': 'nes-classic-fbx-fs',
4976
'wavebeam': 'wavebeam'
4977
},
4978
'default': 'default'
4979
}, _0xa88a13.fceumm_nospritelimit = {
4980
'label': this.localization('No Sprite Limit'),
4981
'options': {
4982
'enabled': this.localization('Enabled'),
4983
'disabled': this.localization('Disabled')
4984
},
4985
'default': 'disabled'
4986
}, _0xa88a13.fceumm_sndquality = {
4987
'label': this.localization('Sound Quality'),
4988
'options': {
4989
'Low': this.localization('Low'),
4990
'High': this.localization('High'),
4991
'Very High': this.localization('Very High')
4992
},
4993
'default': 'Low'
4994
}, this.lightgun || (_0xa88a13.system_type = {
4995
'label': this.localization('4 Players Support'),
4996
'options': {
4997
'nes': 'NES',
4998
'famicom': 'Famicom'
4999
},
5000
'default': 'nes'
5001
}), _0xa88a13.fceumm_turbo_enable = {
5002
'label': this.localization('Turbo Enable'),
5003
'options': {
5004
'None': this.localization('None'),
5005
'Player 1': this.localization('Player 1'),
5006
'Player 2': this.localization('Player 2'),
5007
'Both': this.localization('Both')
5008
},
5009
'default': 'None'
5010
}, _0xa88a13.fceumm_region = {
5011
'label': this.localization('Region'),
5012
'options': {
5013
'Auto': this.localization('Auto'),
5014
'NTSC': 'NTSC',
5015
'PAL': 'PAL',
5016
'Dendy': 'Dendy'},
5017
'default': 'Auto'
5018
};
5019
break;
5020
case 'snes':
5021
_0xa88a13 = {
5022
'snes9x_next_overclock': {
5023
'label': this.localization('SuperFX Overclock'),
5024
'options': {
5025
'disabled': this.localization('Disabled')+'(10MHz)',
5026
'40MHz': '40MHz',
5027
'60MHz': '60MHz',
5028
'80MHz': '80MHz',
5029
'100MHz': '100MHz'
5030
},
5031
'default': 'disabled'
5032
}
5033
};
5034
break;
5035
case 'snes2002':
5036
case 'snes2005':
5037
case 'snes2010':
5038
_0xa88a13 = {};
5039
break;
5040
case 'gb':
5041
_0xa88a13 = {
5042
'gambatte_gb_colorization': {
5043
'label': this.localization('GB Colorization'),
5044
'options': {
5045
'disabled': this.localization('Disabled'),
5046
'auto': this.localization('auto'),
5047
'internal': this.localization('internal')
5048
},
5049
'default': 'disabled'
5050
},
5051
'gambatte_gb_internal_palette': {
5052
'label': this.localization('Internal Palette'),
5053
'options': {
5054
'GBC - Blue': this.localization('GBC - Blue'),
5055
'GBC - Brown': this.localization('GBC - Brown'),
5056
'GBC - Dark Blue': this.localization('GBC - Dark Blue'),
5057
'GBC - Dark Brown': this.localization('GBC - Dark Brown'),
5058
'GBC - Dark Green': this.localization('GBC - Dark Green'),
5059
'GBC - Grayscale': this.localization('GBC - Grayscale'),
5060
'GBC - Green': this.localization('GBC - Green'),
5061
'GBC - Inverted': this.localization('GBC - Inverted'),
5062
'GBC - Orange': this.localization('GBC - Orange'),
5063
'GBC - Pastel Mix': this.localization('GBC - Pastel Mix'),
5064
'GBC - Red': this.localization('GBC - Red'),
5065
'GBC - Yellow': this.localization('GBC - Yellow')
5066
},
5067
'default': 'GBC - Blue'
5068
}
5069
};
5070
break;
5071
case 'gba':
5072
_0xa88a13 = {
5073
'mgba_solar_sensor_level': {
5074
'label': this.localization('Solar sensor level'),
5075
'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
5076
'default': '0'
5077
},
5078
'mgba_frameskip': {
5079
'label': this.localization('Frameskip'),
5080
'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
5081
'default': '0'
5082
}
5083
};
5084
break;
5085
case 'vbanext':
5086
_0xa88a13 = {
5087
'vbanext_turboenable': {
5088
'label': this.localization('Enable Turbo Buttons'),
5089
'options': {
5090
'disabled': this.localization('disabled'),
5091
'enabled': this.localization('enabled')
5092
},
5093
'default': 'disabled'
5094
},
5095
'vbanext_turbodelay': {
5096
'label': this.localization('Turbo Delay in frames'),
5097
'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15'],
5098
'default': '2'
5099
}
5100
};
5101
break;
5102
case 'n64':
5103
_0xa88a13 = {
5104
'glupen64-aspect': {
5105
'label': this.localization('Aspect Ratio (Need to refresh page)'),
5106
'options': ['4:3', '16:9'],
5107
'default': '4:3'
5108
},
5109
'glupen64-43screensize': {
5110
'label': this.localization('4:3 Resolution'),
5111
'options': ['320x240', '640x480', '960x720', '1280x960'],
5112
'default': '320x240'
5113
},
5114
'glupen64-169screensize': {
5115
'label': this.localization('16:9 Resolution'),
5116
'options': ['640x360', '960x540', '1280x720'],
5117
'default': '640x360'
5118
},
5119
'glupen64-pak1': {
5120
'label': this.localization('Player 1 Pak'),
5121
'options': {
5122
'none': this.localization('none'),
5123
'memory': this.localization('memory'),
5124
'rumble': this.localization('rumble')
5125
},
5126
'default': 'none'
5127
},
5128
'glupen64-pak2': {
5129
'label': this.localization('Player 2 Pak'),
5130
'options': {
5131
'none': this.localization('none'),
5132
'memory': this.localization('memory'),
5133
'rumble': this.localization('rumble')
5134
},
5135
'default': 'none'
5136
},
5137
'glupen64-pak3': {
5138
'label': this.localization('Player 3 Pak'),
5139
'options': {
5140
'none': this.localization('none'),
5141
'memory': this.localization('memory'),
5142
'rumble': this.localization('rumble')
5143
},
5144
'default': 'none'
5145
},
5146
'glupen64-pak4': {
5147
'label': this.localization('Player 4 Pak'),
5148
'options': {
5149
'none': this.localization('none'),
5150
'memory': this.localization('memory'),
5151
'rumble': this.localization('rumble')
5152
},
5153
'default': 'none'
5154
},
5155
};
5156
break;
5157
case 'nds':
5158
_0xa88a13 = {
5159
'desmume_screens_layout': {
5160
'label': this.localization('Screen layout'),
5161
'options': {
5162
'top/bottom': this.localization('top/bottom'),
5163
'bottom/top': this.localization('bottom/top'),
5164
'left/right': this.localization('left/right'),
5165
'right/left': this.localization('right/left'),
5166
'top only': this.localization('top only'),
5167
'bottom only': this.localization('bottom only'),
5168
'quick switch': this.localization('quick switch'),
5169
'hybrid/top': this.localization('hybrid/top'),
5170
'hybrid/bottom': this.localization('hybrid/bottom')
5171
},
5172
'default': 'top/bottom'
5173
},
5174
'screen_rotation': {
5175
'label': this.localization('Screen Rotation'),
5176
'options': {
5177
0: '0°',
5178
90: '90°',
5179
180: '180°',
5180
270: '270°'
5181
},
5182
'default': 0
5183
},
5184
'desmume_frameskip': {
5185
'label': this.localization('Frameskip'),
5186
'options': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
5187
'default': '0'
5188
}
5189
}, _0x2d904a.wasm || delete _0xa88a13.screen_rotation;
5190
break;
5191
case 'vb':
5192
case 'pce':
5193
_0xa88a13 = {};
5194
break;
5195
case 'segaMS':
5196
case 'segaGG':
5197
case 'segaMD':
5198
case 'segaCD':
5199
_0xa88a13 = {
5200
'genesis_plus_gx_no_sprite_limit': {
5201
'label': this.localization('No Sprite Limit'),
5202
'options': {
5203
'disabled': this.localization('disabled'),
5204
'enabled': this.localization('enabled')
5205
},
5206
'default': 'disabled'
5207
},
5208
'genesis_plus_gx_overclock': {
5209
'label': this.localization('CPU speed'),
5210
'options': ['100%', '125%', '150%', '175%', '200%'],
5211
'default': '100%'
5212
},
5213
'genesis_plus_gx_sound_output': {
5214
'label': this.localization('Sound output'),
5215
'options': {
5216
'stereo': this.localization('stereo'),
5217
'mono': this.localization('mono')
5218
},
5219
'default': 'stereo'
5220
}
5221
};
5222
break;
5223
case 'sega32x':
5224
_0xa88a13 = {
5225
'picodrive_sprlim': {
5226
'label': this.localization('No sprite limit'),
5227
'options': {
5228
'disabled': this.localization('disabled'),
5229
'enabled': this.localization('enabled')
5230
},
5231
'default': 'disabled'
5232
}
5233
};
5234
break;
5235
case 'segaSaturn':
5236
_0xa88a13 = {
5237
'yabause_frameskip': {
5238
'label': this.localization('Frameskip'),
5239
'options': {
5240
'disabled': this.localization('disabled'),
5241
'enabled': this.localization('enabled')
5242
},
5243
'default': 'disabled'
5244
}
5245
};
5246
break;
5247
case 'msx':
5248
_0xa88a13 = {
5249
'bluemsx_nospritelimits': {
5250
'label': this.localization('No Sprite Limit'),
5251
'options': {
5252
'OFF': this.localization('OFF'),
5253
'ON': this.localization('ON')
5254
},
5255
'default': 'OFF'
5256
}
5257
};
5258
break;
5259
case 'ws':
5260
case 'ngp':
5261
_0xa88a13 = {};
5262
break;
5263
case 'jaguar':
5264
_0xa88a13 = {
5265
'virtualjaguar_usefastblitter': {
5266
'label': this.localization('Fast Blitter'),
5267
'options': {
5268
'disabled': this.localization('disabled'),
5269
'enabled': this.localization('enabled')
5270
},
5271
'default': 'disabled'
5272
},
5273
'virtualjaguar_bios': {
5274
'label': this.localization('Bios'),
5275
'options': {
5276
'disabled': this.localization('disabled'),
5277
'enabled': this.localization('enabled')
5278
},
5279
'default': 'disabled'
5280
}
5281
};
5282
break;
5283
case 'psx':
5284
_0xa88a13 = {
5285
'pcsx_rearmed_frameskip': {
5286
'label': this.localization('Frameskip'),
5287
'options': [0, 1, 2, 3],
5288
'default': 0
5289
},
5290
'pcsx_rearmed_memcard2': {
5291
'label': this.localization('Enable second memory card'),
5292
'options': {
5293
'disabled': this.localization('disabled'),
5294
'enabled': this.localization('enabled')
5295
},
5296
'default': 'enabled'
5297
},
5298
'pcsx_rearmed_pad1type': {
5299
'label': this.localization('Pad 1 Type'),
5300
'options': {
5301
'default': this.localization('default'),
5302
'none': this.localization('none'),
5303
'standard': this.localization('standard'),
5304
'analog': this.localization('analog'),
5305
'negcon': this.localization('negcon')
5306
},
5307
'default': 'default'
5308
},
5309
'pcsx_rearmed_pad2type': {
5310
'label': this.localization('Pad 2 Type'),
5311
'options': {
5312
'default': this.localization('default'),
5313
'none': this.localization('none'),
5314
'standard': this.localization('standard'),
5315
'analog': this.localization('analog'),
5316
'negcon': this.localization('negcon')
5317
},
5318
'default': 'default'
5319
},
5320
'pcsx_rearmed_pad3type': {
5321
'label': this.localization('Pad 3 Type'),
5322
'options': {
5323
'default': this.localization('default'),
5324
'none': this.localization('none'),
5325
'standard': this.localization('standard'),
5326
'analog': this.localization('analog'),
5327
'negcon': this.localization('negcon')
5328
},
5329
'default': 'default'
5330
},
5331
'pcsx_rearmed_pad4type': {
5332
'label': this.localization('Pad 4 Type'),
5333
'options': {
5334
'default': this.localization('default'),
5335
'none': this.localization('none'),
5336
'standard': this.localization('standard'),
5337
'analog': this.localization('analog'),
5338
'negcon': this.localization('negcon')
5339
},
5340
'default': 'default'
5341
},
5342
'pcsx_rearmed_vibration': {
5343
'label': this.localization('Enable Vibration'),
5344
'options': {
5345
'disabled': this.localization('disabled'),
5346
'enabled': this.localization('enabled')
5347
},
5348
'default': 'enabled'
5349
},
5350
'pcsx_rearmed_neon_interlace_enable': {
5351
'label': this.localization('Enable interlacing mode(s)'),
5352
'options': {
5353
'disabled': this.localization('disabled'),
5354
'enabled': this.localization('enabled')
5355
},
5356
'default': 'disabled'
5357
},
5358
'pcsx_rearmed_neon_enhancement_enable': {
5359
'label': this.localization('Enhanced resolution (slow)'),
5360
'options': {
5361
'disabled': this.localization('disabled'),
5362
'enabled': this.localization('enabled')
5363
},
5364
'default': 'disabled'
5365
},
5366
'pcsx_rearmed_neon_enhancement_no_main': {
5367
'label': this.localization('Enhanced resolution speed hack'),
5368
'options': {
5369
'disabled': this.localization('disabled'),
5370
'enabled': this.localization('enabled')
5371
},
5372
'default': 'disabled'
5373
}
5374
};
5375
break;
5376
case 'arcade':
5377
case 'fba0.2.97.29':
5378
_0xa88a13 = {
5379
'fba-aspect': {
5380
'label': this.localization('Aspect ratio'),
5381
'options': ['DAR', 'PAR'],
5382
'default': 'DAR'
5383
},
5384
'fba-frameskip': {
5385
'label': this.localization('Frameskip'),
5386
'options': ['0', '1', '2', '3', '4', '5'],
5387
'default': '0'
5388
},
5389
'fba-cpu-speed-adjust': {
5390
'label': this.localization('CPU overclock'),
5391
'options': ['100', '110', '120', '130', '140', '150', '160', '170', '180', '190', '200'],
5392
'default': '100'
5393
},
5394
'fba-diagnostic-input': {
5395
'label': this.localization('Diagnostic Input'),
5396
'options': ['None', 'Hold Start', 'Start + A + B', 'Hold Start + A + B', 'Start + L + R', 'Hold Start + L + R', 'Hold Select', 'Select + A + B', 'Hold Select + A + B', 'Select + L + R', 'Hold Select + L + R'],
5397
'default': 'None'
5398
},
5399
'fba-neogeo-mode': {
5400
'label': this.localization('Force Neo Geo mode'),
5401
'options': ['MVS', 'AES', 'UNIBIOS', 'DIPSWITCH'],
5402
'default': 'MVS'
5403
}
5404
};
5405
break;
5406
case 'mame2003':
5407
case 'mame2010':
5408
case 'mame':
5409
_0xa88a13 = {};
5410
break;
5411
case 'dos':
5412
_0xa88a13 = {};
5413
break;
5414
default:
5415
_0xa88a13 = {};
5416
}
5417
const _this = this;
5418
if (this.coreVer === 2) {
5419
_0xa88a13 = {};
5420
_0xa88a13['fps'] = {
5421
'label': this.localization('FPS'),
5422
'options': {
5423
'show': this.localization("show"),
5424
'hide': this.localization("hide")
5425
},
5426
'default': "hide"
5427
}
5428
}
5429
if (_0xdcec2a && (_0xdcec2a.virtualGamepadContainer != 'undefined' || _0xdcec2a.virtualGamepadContainer !== null)) {
5430
_0xa88a13['left-handed-mode'] = {
5431
'label': this.localization('Left Handed Mode'),
5432
'options': {
5433
'on': this.localization('On'),
5434
'off': this.localization('Off')
5435
},
5436
'default': 'off'
5437
}
5438
}
5439
if (this.statesSupported === true) {
5440
_0xa88a13['save-state-slot'] = {
5441
'label': this.localization('Save State Slot'),
5442
'options': [1, 2, 3, 4, 5, 6, 7, 8, 9],
5443
'default': 1
5444
}
5445
}
5446
if (this.statesSupported === true && window.indexedDB && this.getStartName()) {
5447
_0xa88a13['save-state-location'] = {
5448
'label': this.localization('Save State Location'),
5449
'options': {
5450
'download': this.localization('download'),
5451
'keep in browser': this.localization('keep in browser')
5452
},
5453
'default': 'download'
5454
}
5455
}
5456
try {
5457
_0xdcec2a.getGameCoreOptions && _0xdcec2a.getGameCoreOptions().split('\n').forEach(function(_0x2bef5a, _0x49b64b) {
5458
let _0x5995db = _0x2bef5a.split('; '),
5459
_0x16274c = _0x5995db[0];
5460
if (0x0 === _0x16274c.indexOf('fba-dipswitch-') || _this.coreVer === 2) {
5461
let _0x757776 = _0x5995db[1].split('|'),
5462
_0x1f895e = _0x16274c.split("|")[0].replace(/_/g, ' ').replace(/.+\-(.+)/, '$1');
5463
_0x757776.slice(1, -1);
5464
if (_0x757776.length === 1) return;
5465
let options = {};
5466
for (let i=0; i<_0x757776.length; i++) {
5467
options[_0x757776[i]] = _this.localization(_0x757776[i]);
5468
}
5469
_0xa88a13[_0x16274c.split("|")[0]] = {
5470
'label': _this.localization(_0x1f895e),
5471
'options': options,
5472
'default': (_0x16274c.split("|").length > 1) ? _0x16274c.split("|")[1] : _0x757776[0].replace('(Default) ', '')
5473
};
5474
}
5475
});
5476
} catch(e) {};
5477
return _0xa88a13;
5478
},
5479
'supportNetPlay': function() {
5480
if (this.coreVer === 2) return false;
5481
if (!this.listUrl || !this.socketUrl) return false;
5482
if (this.lightgun || this.mouse) return false;
5483
let _0xa88a13 = window.RTCPeerConnection || window.webkitPeerConnection00 || window.webkitRTCPeerConnection || window.mozRTCPeerConnection,
5484
_0x17edbf = window.mozRTCIceCandidate || window.RTCIceCandidate,
5485
_0x2c1832 = window.mozRTCSessionDescription || window.RTCSessionDescription;
5486
return !!(_0xa88a13 && _0x17edbf && _0x2c1832) && !!(_0xa88a13 && 'createDataChannel' in _0xa88a13.prototype);
5487
},
5488
'isNetPlay': function() {},
5489
'findElements': function() {
5490
try {
5491
return this.elements.controls = _0x530042.call(this, this.config.selectors.controls.wrapper), this.elements.buttons = {
5492
'play': _0x23ffa1.call(this, this.config.selectors.buttons.play),
5493
'pause': _0x530042.call(this, this.config.selectors.buttons.pause),
5494
'restart': _0x530042.call(this, this.config.selectors.buttons.restart),
5495
'mute': _0x530042.call(this, this.config.selectors.buttons.mute),
5496
'settings': _0x530042.call(this, this.config.selectors.buttons.settings),
5497
'fullscreen': _0x530042.call(this, this.config.selectors.buttons.fullscreen),
5498
'saveState': _0x530042.call(this, this.config.selectors.buttons.saveState),
5499
'cacheManager': _0x530042.call(this, this.config.selectors.buttons.cacheManager),
5500
'screenRecord': _0x530042.call(this, this.config.selectors.buttons.screenRecord),
5501
'loadState': _0x530042.call(this, this.config.selectors.buttons.loadState),
5502
'gamepad': _0x530042.call(this, this.config.selectors.buttons.gamepad),
5503
'netplay': _0x530042.call(this, this.config.selectors.buttons.netplay),
5504
'cheat': _0x530042.call(this, this.config.selectors.buttons.cheat)
5505
}, this.elements.inputs = {
5506
'volume': _0x530042.call(this, this.config.selectors.inputs.volume)
5507
}, true;
5508
} catch (_0x527381) {
5509
return this.debug.warn('It looks like there is a problem with your custom controls HTML', _0x527381), false;
5510
}
5511
},
5512
'createIcon': function(_0x43d42f, _0x42a597) {
5513
let _0x2c1832 = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
5514
_0x154f99(_0x2c1832, _0x5dc0c0(_0x42a597, {
5515
'role': 'presentation',
5516
'focusable': 'false'
5517
}));
5518
let _0x50b7a7 = document.createElement('div');
5519
_0x50b7a7.innerHTML = '<svg>' .concat(this.icons[_0x43d42f], '</svg>');
5520
for (let _0x373099 = _0x50b7a7.childNodes[0].childNodes, _0x804f4d = 0; _0x804f4d < _0x373099.length; _0x804f4d += 1) _0x2c1832.appendChild(_0x373099[_0x804f4d]);
5521
return _0x2c1832;
5522
},
5523
'createLabel': function(_0x185043) {
5524
let _0x17edbf = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
5525
_0x2c1832 = _0xb9b2ff.get(_0x185043, this.config),
5526
_0x3d681f = {};
5527
_0x3d681f[_0x17edbf.class] = true, _0x3d681f[this.config.classNames.hidden] = true;
5528
let _0x58a1d4 = Object.assign({}, _0x17edbf, {
5529
'class': [_0x17edbf.class, this.config.classNames.tooltip].filter(Boolean).join(' ')
5530
});
5531
return _0x428003('span', _0x58a1d4, _0x2c1832);
5532
},
5533
'createBadge': function(_0x415aef) {
5534
if (_0x1e2c68.empty(_0x415aef)) return null;
5535
let _0x17edbf = _0x428003('span', {
5536
'class': this.config.classNames.menu.value
5537
});
5538
return _0x17edbf.appendChild(_0x428003('span', {
5539
'class': this.config.classNames.menu.badge
5540
}, _0x415aef)), _0x17edbf;
5541
},
5542
'createButton': function(_0x427a85, _0x493eb2) {
5543
let _0x2c1832, _0x325832, _0xcb618b, _0x25c678, _0x58309d = _0x428003('button'),
5544
_0x183584 = Object.assign({}, _0x493eb2),
5545
_0x2345d2 = _0x9fdcea(_0x427a85),
5546
_0x2ca20d = false;
5547
'type' in _0x183584 || (_0x183584.type = 'button');
5548
let _0x34225b = getClass({
5549
'ejs__control': true
5550
});
5551
switch ('class' in _0x183584 ? _0x183584.class.includes(_0x34225b) || (_0x183584.class += ' ' .concat(_0x34225b)) : _0x183584.class = _0x34225b, _0x427a85) {
5552
case 'play':
5553
_0x2ca20d = true, _0x2c1832 = 'play', _0xcb618b = 'pause', _0x325832 = 'play', _0x25c678 = 'pause';
5554
break;
5555
case 'mute':
5556
_0x2ca20d = true, _0x2c1832 = 'mute', _0xcb618b = 'unmute', _0x325832 = 'volume', _0x25c678 = 'muted';
5557
break;
5558
case 'fullscreen':
5559
_0x2ca20d = true, _0x2c1832 = 'enterFullscreen', _0xcb618b = 'exitFullscreen', _0x325832 = 'enter-fullscreen', _0x25c678 = 'exit-fullscreen';
5560
break;
5561
default:
5562
_0x2c1832 = _0x2345d2, _0x325832 = _0x427a85;
5563
}
5564
return _0x2ca20d ? (_0x58309d.appendChild(_0x7f9f36.createIcon.call(this, _0x25c678, {
5565
'class': getClass({
5566
'icon--pressed': true
5567
})
5568
})), _0x58309d.appendChild(_0x7f9f36.createIcon.call(this, _0x325832, {
5569
'class': getClass({
5570
'icon--not-pressed': true
5571
})
5572
})), _0x58309d.appendChild(_0x7f9f36.createLabel.call(this, _0xcb618b, {
5573
'class': getClass({
5574
'icon--pressed': true
5575
})
5576
})), _0x58309d.appendChild(_0x7f9f36.createLabel.call(this, _0x2c1832, {
5577
'class': getClass({
5578
'icon--not-pressed': true
5579
})
5580
}))) : (_0x58309d.appendChild(_0x7f9f36.createIcon.call(this, _0x325832)), _0x58309d.appendChild(_0x7f9f36.createLabel.call(this, _0x2c1832))), _0x5dc0c0(_0x183584, _0xa949a8(this.config.selectors.buttons[_0x2345d2], _0x183584)), _0x154f99(_0x58309d, _0x183584), 'play' === _0x2345d2 ? (_0x1e2c68.array(this.elements.buttons[_0x2345d2]) || (this.elements.buttons[_0x2345d2] = []), this.elements.buttons[_0x2345d2].push(_0x58309d)) : this.elements.buttons[_0x2345d2] = _0x58309d, _0x58309d;
5581
},
5582
'createRange': function(_0x491b4a, _0x5f154a) {
5583
let _0x2c1832 = _0x428003('input', _0x5dc0c0(_0xa949a8(this.config.selectors.inputs[_0x491b4a]), {
5584
'type': 'range',
5585
'min': 0,
5586
'max': 0x64,
5587
'step': 0.1,
5588
'value': 0,
5589
'autocomplete': 'off',
5590
'role': 'slider',
5591
'aria-label': _0xb9b2ff.get(_0x491b4a, this.config),
5592
'aria-valuemin': 0,
5593
'aria-valuemax': 0x64,
5594
'aria-valuenow': 0x0
5595
}, _0x5f154a));
5596
return this.elements.inputs[_0x491b4a] = _0x2c1832, _0x7f9f36.updateRangeFill.call(this, _0x2c1832), _0x2c1832;
5597
},
5598
'bindMenuItemShortcuts': function(_0x1830d1, _0x2770c2) {
5599
let _0x2c1832 = this;
5600
_0x1093f4(_0x1830d1, 'keydown keyup', function(_0x4bb9d6) {
5601
if ([0x20, 0x26, 0x27, 0x28].includes(_0x4bb9d6.which) && (_0x4bb9d6.preventDefault(), _0x4bb9d6.stopPropagation(), 'keydown' !== _0x4bb9d6.type)) {
5602
let _0x20ac7b, _0x51717d = _0x13f491(_0x1830d1, '[role="menuitemradio"]');
5603
if (!_0x51717d && [0x20, 0x27].includes(_0x4bb9d6.which)) _0x7f9f36.showMenuPanel.call(_0x2c1832, _0x2770c2, true);
5604
else 0x20 !== _0x4bb9d6.which && (0x28 === _0x4bb9d6.which || _0x51717d && 0x27 === _0x4bb9d6.which ? (_0x20ac7b = _0x1830d1.nextElementSibling, _0x1e2c68.element(_0x20ac7b) || (_0x20ac7b = _0x1830d1.parentNode.firstElementChild)) : (_0x20ac7b = _0x1830d1.previousElementSibling, _0x1e2c68.element(_0x20ac7b) || (_0x20ac7b = _0x1830d1.parentNode.lastElementChild)), _0x31cc23.call(_0x2c1832, _0x20ac7b, true));
5605
}
5606
}, false), _0x1093f4(_0x1830d1, 'keyup', function(_0x3844f5) {
5607
0xd === _0x3844f5.which && _0x7f9f36.focusFirstMenuItem.call(_0x2c1832, null, true);
5608
});
5609
},
5610
'createMenuItem': function(_0x52a95b) {
5611
let _0x17edbf = this,
5612
_0x2c1832 = _0x52a95b.value,
5613
_0x231912 = _0x52a95b.list,
5614
_0x57313b = _0x52a95b.type,
5615
_0x19be70 = _0x52a95b.title,
5616
_0x4ae558 = _0x52a95b.badge,
5617
_0x34a012 = void 0 === _0x4ae558 ? null : _0x4ae558,
5618
_0x7dbb2e = _0x52a95b.checked,
5619
_0x200580 = void 0 !== _0x7dbb2e && _0x7dbb2e,
5620
_0x4bb1a2 = _0xa949a8(this.config.selectors.inputs[_0x57313b]),
5621
_0xb8fbbd = _0x428003('button', _0x5dc0c0(_0x4bb1a2, {
5622
'type': 'button',
5623
'role': 'menuitemradio',
5624
'class': '' .concat(this.config.classNames.control, ' ').concat(_0x4bb1a2.class ? _0x4bb1a2.class : '').trim(),
5625
'aria-checked': _0x200580,
5626
'value': _0x2c1832
5627
})),
5628
_0x560073 = _0x428003('span');
5629
_0x560073.innerHTML = _0x19be70, _0x1e2c68.element(_0x34a012) && _0x560073.appendChild(_0x34a012), _0xb8fbbd.appendChild(_0x560073), Object.defineProperty(_0xb8fbbd, 'checked', {
5630
'enumerable': true,
5631
'get': function() {
5632
return 'true' === _0xb8fbbd.getAttribute('aria-checked');
5633
},
5634
'set': function(_0x2da7f0) {
5635
_0x2da7f0 && Array.from(_0xb8fbbd.parentNode.children).filter(function(_0x480c16) {
5636
return _0x13f491(_0x480c16, '[role="menuitemradio"]');
5637
}).forEach(function(_0x363b12) {
5638
return _0x363b12.setAttribute('aria-checked', 'false');
5639
}), _0xb8fbbd.setAttribute('aria-checked', _0x2da7f0 ? 'true' : 'false');
5640
}
5641
});
5642
let _0x449ec7 = _0x7f9f36.getCoreOptions.call(this);
5643
this.listeners.bind(_0xb8fbbd, 'click keyup', function(_0x270d0d) {
5644
_0x1e2c68.keyboardEvent(_0x270d0d) && 0x20 !== _0x270d0d.which || (_0x270d0d.preventDefault(), _0x270d0d.stopPropagation(), _0xb8fbbd.checked = true, Object.keys(_0x7f9f36.normalOptions).includes(_0x57313b) && _0x7f9f36.updateNormalOptions.call(_0x17edbf, _0x57313b, _0x2c1832), Object.keys(_0x449ec7).includes(_0x57313b) && (_0x449ec7[_0x57313b].netplay && _0xdcec2a.connected ? _0xdcec2a.connection.isInitiator && (_0x7f9f36.updateCoreOptions.call(_0x17edbf, _0x57313b, _0x2c1832), _0xdcec2a.connection.send(JSON.stringify({
5645
'act': 'update-core-option',
5646
'key': _0x57313b,
5647
'value': _0x2c1832,
5648
'frame': _0xdcec2a.currentFrame
5649
}))) : _0x7f9f36.updateCoreOptions.call(_0x17edbf, _0x57313b, _0x2c1832)), _0x7f9f36.showMenuPanel.call(_0x17edbf, 'home', _0x1e2c68.keyboardEvent(_0x270d0d)));
5650
}, _0x57313b, false), _0x7f9f36.bindMenuItemShortcuts.call(this, _0xb8fbbd, _0x57313b), _0x231912.appendChild(_0xb8fbbd);
5651
},
5652
'updateVolume': function() {
5653
_0x1e2c68.element(this.elements.inputs.volume) && _0x7f9f36.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume), _0x1e2c68.element(this.elements.buttons.mute) && (this.elements.buttons.mute.pressed = this.muted || 0 === this.volume);
5654
},
5655
'setRange': function(_0x1c075b) {
5656
let _0x17edbf = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
5657
_0x1e2c68.element(_0x1c075b) && (_0x1c075b.value = _0x17edbf, _0x7f9f36.updateRangeFill.call(this, _0x1c075b));
5658
},
5659
'updateRangeFill': function(_0x2dbde1) {
5660
let _0x17edbf = _0x1e2c68.event(_0x2dbde1) ? _0x2dbde1.target : _0x2dbde1;
5661
if (_0x1e2c68.element(_0x17edbf) && 'range' === _0x17edbf.getAttribute('type')) {
5662
if (_0x13f491(_0x17edbf, this.config.selectors.inputs.volume)) {
5663
let _0x2c1832 = 0x64 * _0x17edbf.value;
5664
_0x17edbf.setAttribute('aria-valuenow', _0x2c1832), _0x17edbf.setAttribute('aria-valuetext', '' .concat(_0x2c1832.toFixed(1), '%'));
5665
} else _0x17edbf.setAttribute('aria-valuenow', _0x17edbf.value);
5666
_0x59aa33.isWebkit && _0x17edbf.style.setProperty('--value', '' .concat(_0x17edbf.value / _0x17edbf.max * 0x64, '%'));
5667
}
5668
},
5669
'toggleMenuButton': function(_0x249814, _0x2948e9) {
5670
_0x132da7(this.elements.settings.buttons[_0x249814], !_0x2948e9);
5671
},
5672
'updateNormalOptions': function(option, value) {
5673
this.elements.settings.buttons[option].querySelector('.' .concat(this.config.classNames.menu.value)).innerHTML = _0x7f9f36.normalOptions[option].options[value];
5674
let _0x2c1832 = {};
5675
_0x2c1832[option] = value;
5676
_0x7f9f36.storage.set(_0x2c1832);
5677
'shader' === option && _0xdcec2a.setShader(value);
5678
'virtual-gamepad' === option && _0xdcec2a.toggleVirtualGamepad.call(this, 'enabled' === value);
5679
},
5680
'updateCoreOptions': function(_0x41c4ad, _0x15823e) {
5681
if ('nds' === getSystem(this.system, true) && !_0x2d904a.wasm) return true;
5682
_0x7f9f36.coreOptionsValues[_0x41c4ad] = _0x15823e;
5683
if ('psx' === getSystem(this.system, true) && _0x27f4c4.Module.pauseMainLoop(), _0xdcec2a.setVariable(_0x41c4ad, _0x15823e), 'psx' === getSystem(this.system, true) && (setTimeout(function() {
5684
_0x27f4c4.Module.resumeMainLoop();
5685
}, 0x64), setTimeout(function() {
5686
_0x27f4c4.Module.resumeMainLoop();
5687
}, 0xc8)), 'nds' === getSystem(this.system, true) && _0x2d904a.wasm) {
5688
let _0x2c1832 = this.elements.wrapper.querySelector('canvas');
5689
if ('screen_rotation' === _0x41c4ad) switch (_0x2c1832.style.transform = 'rotate(' + _0x15823e + 'deg)', _0x15823e) {
5690
case '0':
5691
_0xdcec2a.setVariable('desmume_input_rotation', '0');
5692
break;
5693
case '90':
5694
_0xdcec2a.setVariable('desmume_input_rotation', '270');
5695
break;
5696
case '180':
5697
_0xdcec2a.setVariable('desmume_input_rotation', '180');
5698
break;
5699
case '270':
5700
_0xdcec2a.setVariable('desmume_input_rotation', '90');
5701
}
5702
}
5703
if ('arcade' === getSystem(this.system, true) || 'fba0.2.97.29' === getSystem(this.system, true)) {
5704
let _0x567ccc = this.elements.wrapper.querySelector('canvas');
5705
_0x567ccc.height = 'fba-aspect' === _0x41c4ad && 'PAR' === _0x15823e ? _0x567ccc.width / 0x10 * 0x9 : _0x567ccc.width / 4 * 3;
5706
}
5707
let _0x31bdec = _0x7f9f36.getCoreOptions.call(this),
5708
_0x3efd0b = _0x7f9f36.storage.get('core-options');
5709
if (_0x1e2c68.empty(_0x3efd0b) && (_0x3efd0b = {}), _0x3efd0b[_0x41c4ad] = _0x15823e, _0x7f9f36.storage.set({
5710
'core-options': _0x3efd0b
5711
}), this.elements.settings.buttons[_0x41c4ad]) {
5712
let _0xe95e6a = this.elements.settings.buttons[_0x41c4ad].querySelector('.' .concat(this.config.classNames.menu.value));
5713
_0x1e2c68.object(_0x31bdec[_0x41c4ad].options) ? _0xe95e6a.innerHTML = _0x31bdec[_0x41c4ad].options[_0x15823e] : _0xe95e6a.innerHTML = _0x15823e;
5714
}
5715
if (_0x41c4ad === 'left-handed-mode') {
5716
_0xdcec2a.toggleVirtualGamepad.call(this, true, true);
5717
}
5718
},
5719
'setOptionMenuItem': function(_0x2f0e6a, _0x85969e) {
5720
let _0x2c1832 = this,
5721
_0x549dac = this.elements.settings.panels.home.querySelector('[role="menu"]'),
5722
_0x43777f = this.elements.settings.popup.children[0];
5723
Object.keys(_0x2f0e6a).forEach(function(_0x4fcbcf) {
5724
let _0x177975 = _0x4fcbcf,
5725
_0x5f3e0f = _0x428003('button', _0x5dc0c0(_0xa949a8(_0x2c1832.config.selectors.buttons.settings), {
5726
'type': 'button',
5727
'class': getClass({
5728
'ejs__control': true,
5729
'ejs__control--forward': true
5730
}),
5731
'role': 'menuitem',
5732
'item': _0x4fcbcf,
5733
'aria-haspopup': true
5734
}));
5735
_0x1093f4(_0x5f3e0f, 'click', function() {
5736
_0x7f9f36.showMenuPanel.call(_0x2c1832, _0x177975, false);
5737
});
5738
let _0x1d5857, _0x1838f9 = _0x428003('span', null, _0x2f0e6a[_0x4fcbcf].label),
5739
_0x455b20 = _0x428003('span', {
5740
'class': _0x2c1832.config.classNames.menu.value
5741
});
5742
_0x1e2c68.object(_0x85969e) && (_0x1d5857 = _0x85969e[_0x177975]), _0x1e2c68.empty(_0x1d5857) && (_0x1d5857 = _0x2f0e6a[_0x177975].default), _0x1e2c68.object(_0x2f0e6a[_0x177975].options) ? _0x455b20.innerHTML = _0x2f0e6a[_0x177975].options[_0x1d5857] : _0x455b20.innerHTML = _0x1d5857, _0x1838f9.appendChild(_0x455b20), _0x5f3e0f.appendChild(_0x1838f9), _0x549dac.appendChild(_0x5f3e0f);
5743
let _0x3f3775 = _0x428003('div', {
5744
'data-pane': escape(_0x177975),
5745
'hidden': ''
5746
}),
5747
_0x288440 = _0x428003('button', {
5748
'type': 'button',
5749
'class': getClass({
5750
'ejs__control': true,
5751
'ejs__control--back': true
5752
})
5753
});
5754
_0x288440.appendChild(_0x428003('span', {
5755
'aria-hidden': true
5756
}, _0x2f0e6a[_0x4fcbcf].label)), _0x288440.appendChild(_0x428003('span', {
5757
'class': getClass({
5758
'ejs__sr-only': true
5759
})
5760
}, _0xb9b2ff.get('menuBack', _0x2c1832.config))), _0x1093f4(_0x3f3775, 'keydown', function(_0x462a4d) {
5761
0x25 === _0x462a4d.which && (_0x462a4d.preventDefault(), _0x462a4d.stopPropagation(), _0x7f9f36.showMenuPanel.call(_0x2c1832, 'home', true));
5762
}, false), _0x1093f4(_0x288440, 'click', function() {
5763
_0x7f9f36.showMenuPanel.call(_0x2c1832, 'home', false);
5764
}), _0x3f3775.appendChild(_0x288440), _0x3f3775.appendChild(_0x428003('div', {
5765
'role': 'menu'
5766
})), _0x43777f.appendChild(_0x3f3775), _0x2c1832.elements.settings.buttons[_0x177975] = _0x5f3e0f, _0x2c1832.elements.settings.panels[_0x177975] = _0x3f3775;
5767
let _0x2c172f = _0x3f3775.querySelector('[role="menu"]');
5768
!function(_0x301c01) {
5769
if (_0x1e2c68.element(_0x301c01))
5770
for (let _0x85969e = _0x301c01.childNodes.length; _0x85969e > 0;) _0x301c01.removeChild(_0x301c01.lastChild), _0x85969e -= 1;
5771
}(_0x2c172f);
5772
_0x1e2c68.object(_0x2f0e6a[_0x4fcbcf].options) ? Object.keys(_0x2f0e6a[_0x4fcbcf].options).forEach(function(_0x281296) {
5773
_0x7f9f36.createMenuItem.call(_0x2c1832, {
5774
'value': _0x281296,
5775
'list': _0x2c172f,
5776
'type': _0x177975,
5777
'title': _0x2f0e6a[_0x4fcbcf].options[_0x281296],
5778
'badge': null,
5779
'checked': Boolean(_0x1d5857 === _0x281296)
5780
});
5781
}) : _0x1e2c68.array(_0x2f0e6a[_0x4fcbcf].options) && _0x2f0e6a[_0x4fcbcf].options.forEach(function(_0x28a341) {
5782
_0x7f9f36.createMenuItem.call(_0x2c1832, {
5783
'value': _0x28a341,
5784
'list': _0x2c172f,
5785
'type': _0x177975,
5786
'title': _0x28a341,
5787
'badge': null,
5788
'checked': Boolean(_0x1d5857 === _0x28a341)
5789
});
5790
});
5791
});
5792
},
5793
'setNormalOptionsMenu': function() {
5794
let _this = this,
5795
_0x2c1832 = {};
5796
if (this.config.defaultMenuOptions && this.config.defaultMenuOptions.length === undefined) {
5797
_0x2c1832 = this.config.defaultMenuOptions;
5798
}
5799
_0x2c1832.orientation = _0x7f9f36.storage.get('orientation');
5800
_0x2c1832.shader = _0x7f9f36.storage.get('shader') || _0x2c1832.shader;
5801
if (_this.touch) {
5802
_0x2c1832['virtual-gamepad'] = _0x7f9f36.storage.get('virtual-gamepad') || _0x2c1832['virtual-gamepad'];
5803
_0x1093f4.call(_this, _this.elements.container, 'start-game', function() {
5804
('enabled' === _0x2c1832['virtual-gamepad'] || _0x1e2c68.empty(_0x2c1832['virtual-gamepad'])) && _0xdcec2a.toggleVirtualGamepad.call(_this, true);
5805
})
5806
} else {
5807
delete _0x7f9f36.normalOptions['virtual-gamepad'];
5808
}
5809
_0x7f9f36.setOptionMenuItem.call(this, _0x7f9f36.normalOptions, _0x2c1832);
5810
_0x1093f4.call(_this, _this.elements.container, 'start-game', function() {
5811
let shader = _0x7f9f36.storage.get('shader');
5812
if (shader !== 'disabled') {
5813
_0xdcec2a.setShader(shader);
5814
}
5815
let _0x42a7b1 = {};
5816
_0xdcec2a.getGameCoreOptions && _0xdcec2a.getGameCoreOptions().split('\n').forEach(function(_0x4a987e, _0x10bd7a) {
5817
let _0x2c1832 = _0x4a987e.split('; '),
5818
_0x1ddc5f = _0x2c1832[0];
5819
if (0 === _0x1ddc5f.indexOf('fba-dipswitch-') || _this.coreVer === 2) {
5820
let _0xbd808 = _0x2c1832[1].split('|'),
5821
_0x3c4b1a = _0x1ddc5f.split("|")[0].replace(/_/g, ' ').replace(/.+\-(.+)/, '$1');
5822
_0xbd808.slice(1, -1);
5823
if (_0xbd808.length === 1) return;
5824
let options = {};
5825
for (let i=0; i<_0xbd808.length; i++) {
5826
options[_0xbd808[i]] = _this.localization(_0xbd808[i]);
5827
}
5828
_0x42a7b1[_0x1ddc5f.split("|")[0]] = {
5829
'label': _this.localization(_0x3c4b1a),
5830
'options': options,
5831
'default': (_0x1ddc5f.split("|").length > 1) ? _0x1ddc5f.split("|")[1] : _0xbd808[0].replace('(Default) ', '')
5832
};
5833
}
5834
});
5835
let _0x27d859 = _0x7f9f36.storage.get('core-options');
5836
_0x27d859 = _0x27d859 || {};
5837
_0x7f9f36.coreOptionsValues = _0x27d859;
5838
_0x7f9f36.setOptionMenuItem.call(_this, _0x42a7b1, _0x7f9f36.coreOptionsValues);
5839
Object.keys(_0x7f9f36.coreOptionsValues).forEach(function(_0x51fc4e, _0x4b3613) {
5840
_0x7f9f36.updateCoreOptions.call(_0x2c1832, _0x51fc4e, _0x7f9f36.coreOptionsValues[_0x51fc4e]);
5841
});
5842
'nds' == getSystem(_this.system, true) && (_0x27f4c4.Module._fast_forward_2 ? _0x27f4c4.Module._fast_forward_2(1) : _0x27f4c4.Module._fast_forward && _0x27f4c4.Module._fast_forward(1));
5843
});
5844
},
5845
'updateCoreOptionMenuItems': function() {
5846
let _0xa88a13 = this.elements.settings.panels.home.querySelector('[role="menu"]'),
5847
_0x17edbf = _0x7f9f36.getCoreOptions.call(this);
5848
_0xdcec2a.connected && !_0xdcec2a.connection.isInitiator ? Object.keys(_0x17edbf).forEach(function(_0x480587) {
5849
_0x17edbf[_0x480587].netplay && _0xa88a13.querySelector('[item="' .concat(_0x480587, '"]')).setAttribute('disabled', '');
5850
}) : Object.keys(_0x17edbf).forEach(function(_0x20e093) {
5851
_0xa88a13.querySelector('[item="' .concat(_0x20e093, '"]')).removeAttribute('disabled');
5852
});
5853
},
5854
'setCoreOptionsMenu': function() {
5855
this.elements.settings.panels.home.querySelector('[role="menu"]'), this.elements.settings.popup.children[0];
5856
let _0xa88a13 = _0x7f9f36.getCoreOptions.call(this),
5857
_0x17edbf = _0x7f9f36.storage.get('core-options');
5858
_0x17edbf = _0x17edbf || {}
5859
if (this.config.defaultMenuOptions && this.config.defaultMenuOptions.length === undefined) {
5860
for (let k in this.config.defaultMenuOptions) {
5861
if (!_0x17edbf[k]) {
5862
_0x17edbf[k] = this.config.defaultMenuOptions[k];
5863
}
5864
}
5865
_0x2c1832 = this.config.defaultMenuOptions;
5866
}
5867
if ('undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX) {
5868
console.log('Available core options: ', _0xa88a13);
5869
}
5870
_0x7f9f36.coreOptionsValues = _0x17edbf, _0x7f9f36.setOptionMenuItem.call(this, _0xa88a13, _0x17edbf);
5871
},
5872
'checkMenu': function() {
5873
let _0xa88a13 = this.elements.settings.buttons;
5874
!_0x1e2c68.empty(_0xa88a13) && Object.values(_0xa88a13).some(function(_0x200331) {
5875
return !_0x200331.hidden;
5876
});
5877
_0x132da7(this.elements.settings.menu, false);
5878
},
5879
'focusFirstMenuItem': function(_0x303d68) {
5880
let _0x17edbf = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
5881
if (!this.elements.settings.popup.hidden) {
5882
let _0x2c1832 = _0x303d68;
5883
_0x1e2c68.element(_0x2c1832) || (_0x2c1832 = Object.values(this.elements.settings.panels).find(function(_0xe94c5e) {
5884
return !_0xe94c5e.hidden;
5885
}));
5886
let _0x2f3a13 = _0x2c1832.querySelector('[role^="menuitem"]');
5887
_0x31cc23.call(this, _0x2f3a13, _0x17edbf);
5888
}
5889
},
5890
'toggleMenu': function(_0x28d6c6) {
5891
let _0x17edbf = this.elements.settings.popup,
5892
_0x2c1832 = this.elements.buttons.settings;
5893
if (_0x1e2c68.element(_0x17edbf) && _0x1e2c68.element(_0x2c1832)) {
5894
let _0x614270 = _0x17edbf.hidden,
5895
_0x14f1b5 = _0x614270;
5896
if (_0x1e2c68.boolean(_0x28d6c6)) _0x14f1b5 = _0x28d6c6;
5897
else if (_0x1e2c68.keyboardEvent(_0x28d6c6) && 0x1b === _0x28d6c6.which) _0x14f1b5 = false;
5898
else if (_0x1e2c68.event(_0x28d6c6)) {
5899
let _0xcf75ac = _0x17edbf.contains(_0x28d6c6.target);
5900
if (_0xcf75ac || !_0xcf75ac && _0x28d6c6.target !== _0x2c1832 && _0x14f1b5) return;
5901
}
5902
_0x2c1832.setAttribute('aria-expanded', _0x14f1b5);
5903
_0x132da7(_0x17edbf, !_0x14f1b5);
5904
_0x3a8e2f(this.elements.container, this.config.classNames.menu.open, _0x14f1b5);
5905
_0x14f1b5 && _0x1e2c68.keyboardEvent(_0x28d6c6) ? _0x7f9f36.focusFirstMenuItem.call(this, null, true) : _0x14f1b5 || _0x614270 || _0x31cc23.call(this, _0x2c1832, _0x1e2c68.keyboardEvent(_0x28d6c6));
5906
}
5907
},
5908
'getMenuSize': function(_0x55fe13) {
5909
let _0x17edbf = _0x55fe13.cloneNode(true);
5910
_0x17edbf.style.position = 'absolute';
5911
_0x17edbf.style.opacity = 0;
5912
_0x17edbf.removeAttribute('hidden');
5913
_0x55fe13.parentNode.appendChild(_0x17edbf);
5914
let _0x2c1832 = _0x17edbf.scrollWidth,
5915
_0x5edd1b = _0x17edbf.scrollHeight;
5916
return _0x12a55d(_0x17edbf), {
5917
'width': _0x2c1832,
5918
'height': _0x5edd1b
5919
};
5920
},
5921
'showLoadStatePanel': function() {},
5922
'showMenuPanel': function() {
5923
let _this = this,
5924
_0x17edbf = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : '',
5925
_0x2c1832 = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],
5926
_0x7f4281 = _0x530042.call(this, '[data-pane="' .concat(escape(_0x17edbf), '"]'));
5927
if (_0x1e2c68.element(_0x7f4281)) {
5928
let _0x3d6729 = _0x7f4281.parentNode,
5929
_0x381f57 = Array.from(_0x3d6729.children).find(function(_0x57c652) {
5930
return !_0x57c652.hidden;
5931
});
5932
if (_0x2d904a.transitions && !_0x2d904a.reducedMotion) {
5933
_0x3d6729.style.width = '' .concat(_0x381f57.scrollWidth, 'px');
5934
_0x3d6729.style.height = '' .concat(_0x381f57.scrollHeight, 'px');
5935
let _0x29dd37 = _0x7f9f36.getMenuSize.call(this, _0x7f4281),
5936
_0x37447f = function _0x17edbf(_0x40854f) {
5937
_0x40854f.target === _0x3d6729 && ['width', 'height'].includes(_0x40854f.propertyName) && (_0x3d6729.style.width = '', _0x3d6729.style.height = '', _0x20109b.call(_this, _0x3d6729, _0x5a2767, _0x17edbf));
5938
};
5939
_0x1093f4.call(this, _0x3d6729, _0x5a2767, _0x37447f), _0x3d6729.style.width = '' .concat(_0x29dd37.width, 'px'), _0x3d6729.style.height = '' .concat(_0x29dd37.height, 'px');
5940
}
5941
_0x132da7(_0x381f57, true);
5942
_0x132da7(_0x7f4281, false);
5943
_0x7f9f36.focusFirstMenuItem.call(this, _0x7f4281, _0x2c1832);
5944
}
5945
},
5946
'setLoadState': function(_0x526828, _0x2ce330) {
5947
_0x526828.appendChild(_0x7f9f36.createButton.call(this, 'load-state', {
5948
'aria-haspopup': true,
5949
'aria-expanded': false
5950
}));
5951
let _0x2c1832 = _0x428003('div', {
5952
'class': getClass({
5953
'ejs__dialog': true,
5954
'ejs__load-state__container': true
5955
}),
5956
'hidden': ''
5957
}),
5958
_0x2e5e96 = _0x428003('div');
5959
_0x2c1832.appendChild(_0x2e5e96);
5960
_0x530042.call(this, '.' .concat(getClass({
5961
'ejs__dialogs': true
5962
}))).appendChild(_0x2c1832);
5963
this.elements.dialogs.loadState = _0x2c1832;
5964
},
5965
'setScreenRecord': function(_0x4c3fdd, _0x289259) {
5966
if (!window.MediaRecorder) {
5967
return;
5968
};
5969
let _0x2c1832 = _0x7f9f36.createButton.call(this, 'screen-record', {
5970
'aria-haspopup': true,
5971
'aria-expanded': false,
5972
'style': 'margin-right:auto;'
5973
});
5974
_0x4c3fdd.appendChild(_0x2c1832);
5975
let _0x13c0e4 = _0x428003('div', {
5976
'class': getClass({
5977
'ejs__dialog': true,
5978
'ejs__screenRecord__container': true
5979
}),
5980
'hidden': ''
5981
}),
5982
_0xe2c02a = _0x428003('div');
5983
_0x13c0e4.appendChild(_0xe2c02a);
5984
_0x530042.call(this, '.' .concat(getClass({
5985
'ejs__dialogs': true
5986
}))).appendChild(_0x13c0e4);
5987
this.elements.dialogs.screenRecord = _0x13c0e4;
5988
},
5989
'setCacheManager': function(_0x4c3fdd, _0x289259) {
5990
let _0x2c1832 = _0x7f9f36.createButton.call(this, 'cache-manager', {
5991
'aria-haspopup': true,
5992
'aria-expanded': false,
5993
'style': 'margin-right:auto;'
5994
});
5995
_0x4c3fdd.appendChild(_0x2c1832);
5996
let _0x13c0e4 = _0x428003('div', {
5997
'class': getClass({
5998
'ejs__dialog': true,
5999
'ejs__cacheManager__container': true
6000
}),
6001
'hidden': ''
6002
}),
6003
_0xe2c02a = _0x428003('div');
6004
_0x13c0e4.appendChild(_0xe2c02a);
6005
_0x530042.call(this, '.' .concat(getClass({
6006
'ejs__dialogs': true
6007
}))).appendChild(_0x13c0e4);
6008
this.elements.dialogs.cacheManager = _0x13c0e4;
6009
},
6010
'setGamepad': function(_0x4c3fdd, _0x289259) {
6011
let _0x2c1832 = _0x7f9f36.createButton.call(this, 'gamepad', {
6012
'aria-haspopup': true,
6013
'aria-expanded': false,
6014
'style': 'margin-right:auto;'
6015
});
6016
_0x4c3fdd.appendChild(_0x2c1832);
6017
let _0x13c0e4 = _0x428003('div', {
6018
'class': getClass({
6019
'ejs__dialog': true,
6020
'ejs__gamepad__container': true
6021
}),
6022
'hidden': ''
6023
}),
6024
_0xe2c02a = _0x428003('div');
6025
_0x13c0e4.appendChild(_0xe2c02a);
6026
_0x530042.call(this, '.' .concat(getClass({
6027
'ejs__dialogs': true
6028
}))).appendChild(_0x13c0e4);
6029
this.elements.dialogs.gamepad = _0x13c0e4;
6030
},
6031
'setMessage': function(_0x4c3fdd, _0x289259) {
6032
let _0x13c0e4 = _0x428003('div', {
6033
'class': getClass({
6034
'ejs__dialog': true
6035
}),
6036
'hidden': ''
6037
}),
6038
_0xe2c02a = _0x428003('div');
6039
_0x13c0e4.appendChild(_0xe2c02a);
6040
_0x530042.call(this, '.' .concat(getClass({
6041
'ejs__dialogs': true
6042
}))).appendChild(_0x13c0e4);
6043
this.elements.dialogs.message = _0x13c0e4;
6044
},
6045
'setCheat': function(_0x328075, _0x21ca37) {
6046
let _0x2c1832 = _0x7f9f36.createButton.call(this, 'cheat', {
6047
'aria-haspopup': true,
6048
'aria-expanded': false,
6049
'style': 'margin-right:auto;'
6050
});
6051
_0x328075.appendChild(_0x2c1832);
6052
let _0x173db3 = _0x428003('div', {
6053
'class': getClass({
6054
'ejs__dialog': true,
6055
'ejs__cheat__container': true
6056
}),
6057
'hidden': ''
6058
}),
6059
_0x460961 = _0x428003('div');
6060
_0x173db3.appendChild(_0x460961);
6061
_0x530042.call(this, '.' .concat(getClass({
6062
'ejs__dialogs': true
6063
}))).appendChild(_0x173db3);
6064
this.elements.dialogs.cheat = _0x173db3;
6065
},
6066
'setStateInfoBarWidget': function() {
6067
let _0xa88a13 = _0x428003('div', {
6068
'class': getClass({
6069
'ejs__widget': true
6070
})
6071
}),
6072
_0x17edbf = _0x428003('div');
6073
_0x17edbf.style = 'color: red;font-size: 17px;padding:10px;text-align:left;text-shadow:1px 1px 1px #000'
6074
_0xa88a13.appendChild(_0x17edbf);
6075
_0x530042.call(this, '.' .concat(getClass({
6076
'ejs__widgets': true
6077
}))).appendChild(_0xa88a13);
6078
this.elements.widgets.stateInfo = _0xa88a13;
6079
this.elements.widgets.stateInfoDiv = _0x17edbf;
6080
},
6081
'setNetplayWidgets': function() {
6082
let _0xa88a13 = _0x428003('div', {
6083
'class': getClass({
6084
'ejs__widget': true,
6085
'ejs__widget_netplay': true
6086
})
6087
}),
6088
_0x17edbf = _0x428003('div');
6089
_0xa88a13.appendChild(_0x17edbf);
6090
_0x530042.call(this, '.' .concat(getClass({
6091
'ejs__widgets': true
6092
}))).appendChild(_0xa88a13);
6093
this.elements.widgets.netplay = _0xa88a13;
6094
},
6095
'setNetplay': function(_0x1859f4, _0x50544d) {
6096
_0x1859f4.appendChild(_0x7f9f36.createButton.call(this, 'netplay', {
6097
'aria-haspopup': true,
6098
'aria-expanded': false
6099
}));
6100
let _0x2c1832 = _0x428003('div', {
6101
'class': getClass({
6102
'ejs__dialog': true,
6103
'ejs__netplay__container': true
6104
}),
6105
'hidden': ''
6106
}),
6107
_0x4f63e0 = _0x428003('div');
6108
_0x2c1832.appendChild(_0x4f63e0);
6109
_0x530042.call(this, '.' .concat(getClass({
6110
'ejs__dialogs': true
6111
}))).appendChild(_0x2c1832);
6112
this.elements.dialogs.netplay = _0x2c1832;
6113
_0x7f9f36.setNetplayWidgets.call(this);
6114
},
6115
'toggleContextMenu': function(_0x24b1f3, _0x4b9d55) {
6116
if (_0x350d73(_0x24b1f3.target, getClass({
6117
'ejs__dialogs': true
6118
}))) {
6119
let _0x2c1832 = _0x7f9f36.contextMenu.timer;
6120
if (this.started) {
6121
let _0x2a1dda = _0x530042.call(this, '.' .concat(getClass({
6122
'ejs__contextmenu': true
6123
}), ' ul'));
6124
if (_0x4b9d55) {
6125
_0x7f9f36.contextMenu.style.display = 'block';
6126
_0x7f9f36.contextMenu.style.left = ''.concat(_0x24b1f3.layerX, 'px');
6127
_0x7f9f36.contextMenu.style.top = ''.concat(_0x24b1f3.layerY, 'px');
6128
let _0x1b48e7 = _0x23ffa1.call(this, '.' .concat(getClass({
6129
'ejs__contextmenu': true
6130
}), ' ul li'));
6131
if (null === _0x2a1dda.getAttribute('menu')) {
6132
let _0x14264d = _0x428003('li', {});
6133
_0x14264d.appendChild(_0x428003('a', {
6134
'target': '_blank',
6135
'href': 'https://github.com/EmulatorJS/EmulatorJS' // Modifying this is against the terms of service
6136
}, 'EmulatorJS v' .concat(this.version)));
6137
_0x2a1dda.appendChild(_0x14264d);
6138
_0x2a1dda.setAttribute('menu', '');
6139
}
6140
_0x2c1832 && clearTimeout(_0x2c1832), _0x2c1832 = setTimeout(function() {}, 0xfa0), _0x7f9f36.contextMenu.timer = _0x2c1832;
6141
} else _0x7f9f36.contextMenu.style.display = 'none';
6142
}
6143
}
6144
},
6145
'create': function(_0x42e40d) {
6146
let _this = this;
6147
_0x7f9f36.storage = new _0x2f61ba(this, 'ejs_' .concat(this.system, '_settings'));
6148
let _0x17edbf = _0x428003('div', _0xa949a8(this.config.selectors.controls.wrapper));
6149
_0x7f9f36.contextMenu = _0x428003('div', {
6150
'class': getClass({
6151
'ejs__contextmenu': true
6152
}),
6153
'style': 'position: absolute; display:none;z-index:9'
6154
})
6155
let contextHtml = ['<ul>', '</ul>']
6156
let contextFunctions = []
6157
function addContextHtml(title, hidden, functi0n) {
6158
if (typeof functi0n == 'function') {
6159
contextFunctions.push(functi0n)
6160
} else {
6161
contextFunctions.push(function(){})
6162
}
6163
let i = contextHtml.length - 1
6164
if (hidden) {
6165
contextHtml.splice(i, 0, '<li hidden><a href="#" onclick="return false">'+title+'</a></li>')
6166
} else {
6167
contextHtml.splice(i, 0, '<li><a href="#" onclick="return false">'+title+'</a></li>')
6168
}
6169
}
6170
addContextHtml(_this.localization('Take Screenshot'), false, function(_0x20faaa) {
6171
let _0x4e898a = _0x378b5c.getScreenData();
6172
let gamep;
6173
if (typeof _this.gameName == 'string') {
6174
gamep = _this.gameName
6175
}
6176
let gamepng = gamep ? '' .concat(gamep, '-screenshot.png') : 'game.png';
6177
let a = document.createElement('a');
6178
a.href = URL.createObjectURL(new Blob([_0x4e898a]));
6179
a.download = gamepng;
6180
a.click();
6181
setTimeout(function() {
6182
URL.revokeObjectURL(a.src);
6183
})
6184
return false;
6185
})
6186
addContextHtml(_this.localization('Quick Save')+' (F2)', false, function(_0x395c73) {
6187
_0x378b5c.quickSaveState();
6188
_0x2593da.contextMenu.style.display = 'none';
6189
})
6190
addContextHtml(_this.localization('Quick Load')+' (F4)', false, function(_0x124f69) {
6191
_0x378b5c.quickLoadState();
6192
_0x2593da.contextMenu.style.display = 'none';
6193
})
6194
6195
6196
_0x7f9f36.contextMenu.innerHTML = contextHtml.join('')
6197
let a = _0x7f9f36.contextMenu.getElementsByTagName('li')
6198
for (let i=0; i<a.length; i++) {
6199
_0x1093f4.call(_this, a[i], 'click', contextFunctions[i])
6200
}
6201
this.elements.container.appendChild(_0x7f9f36.contextMenu);
6202
6203
6204
let _0x2c1832 = _0x428003('div', {
6205
'class': getClass({
6206
'ejs__dialog': true,
6207
'ejs__cache__container': true
6208
}),
6209
'hidden': ''
6210
});
6211
_0x530042.call(this, '.' .concat(getClass({
6212
'ejs__dialogs': true
6213
}))).appendChild(_0x2c1832);
6214
this.elements.dialogs.cache = _0x2c1832;
6215
let _0x3c66db = _0x428003('div', {
6216
'class': getClass({
6217
'ejs__dialog': true,
6218
'ejs__loading__container': true
6219
}),
6220
'hidden': ''
6221
});
6222
_0x530042.call(this, '.' .concat(getClass({
6223
'ejs__dialogs': true
6224
}))).appendChild(_0x3c66db);
6225
this.elements.dialogs.loading = _0x3c66db;
6226
_0x17edbf.appendChild(_0x7f9f36.createButton.call(this, 'restart'));
6227
_0x17edbf.appendChild(_0x7f9f36.createButton.call(this, 'play'));
6228
_0x17edbf.appendChild(_0x7f9f36.createButton.call(this, 'save-state', {
6229
'aria-expanded': false
6230
}));
6231
_0x7f9f36.setLoadState.call(this, _0x17edbf, _0x42e40d);
6232
_0x7f9f36.setScreenRecord.call(this, _0x17edbf, _0x42e40d);
6233
_0x7f9f36.setCacheManager.call(this, _0x17edbf, _0x42e40d);
6234
_0x7f9f36.supportNetPlay.call(this, _0x17edbf) && parseInt(this.config.gameId, 0xa) > 0 && _0x7f9f36.setNetplay.call(this, _0x17edbf, _0x42e40d);
6235
_0x7f9f36.setGamepad.call(this, _0x17edbf, _0x42e40d);
6236
_0x7f9f36.setMessage.call(this, _0x17edbf, _0x42e40d)
6237
_0x7f9f36.setStateInfoBarWidget.call(this, _0x17edbf, _0x42e40d);
6238
_0x7f9f36.setCheat.call(this, _0x17edbf, _0x42e40d);
6239
_0x17edbf.appendChild(_0x428003('span', {
6240
'style': 'flex:1'
6241
}));
6242
let _0xd299b = _0x428003('div', {
6243
'class': getClass({
6244
'ejs__volume': true
6245
})
6246
});
6247
_0xd299b.appendChild(_0x7f9f36.createButton.call(this, 'mute'));
6248
let _0x4bbcd0 = {
6249
'max': 1,
6250
'step': 0.01,
6251
'value': this.config.volume
6252
};
6253
_0xd299b.appendChild(_0x7f9f36.createRange.call(this, 'volume', _0x5dc0c0(_0x4bbcd0, {})));
6254
this.elements.volume = _0xd299b;
6255
_0x17edbf.appendChild(_0xd299b);
6256
let _0x2746ab = _0x428003('div', {
6257
'class': getClass({
6258
'ejs__menu': true
6259
})
6260
});
6261
_0x2746ab.appendChild(_0x7f9f36.createButton.call(this, 'settings', {
6262
'aria-haspopup': true,
6263
'aria-expanded': false
6264
}));
6265
let _0x262fb8 = _0x428003('div', {
6266
'class': getClass({
6267
'ejs__menu__container': true
6268
}),
6269
'hidden': ''
6270
}),
6271
_0x3f3385 = _0x428003('div'),
6272
_0x174c46 = _0x428003('div', {
6273
'data-pane': 'home'
6274
}),
6275
_0x17f3cb = _0x428003('div', {
6276
'role': 'menu'
6277
});
6278
_0x174c46.appendChild(_0x17f3cb);
6279
_0x3f3385.appendChild(_0x174c46);
6280
this.elements.settings.panels.home = _0x174c46;
6281
_0x262fb8.appendChild(_0x3f3385);
6282
_0x2746ab.appendChild(_0x262fb8);
6283
_0x17edbf.appendChild(_0x2746ab);
6284
this.elements.settings.popup = _0x262fb8;
6285
this.elements.settings.menu = _0x2746ab;
6286
_0x17edbf.appendChild(_0x7f9f36.createButton.call(this, 'fullscreen'))
6287
let _0x19edbf = this;
6288
_0x17edbf.addEventListener('mousedown', function() {
6289
_0x19edbf.onButtonDiv = true;
6290
})
6291
this.elements.controls = _0x17edbf;
6292
_0x7f9f36.setNormalOptionsMenu.call(this);
6293
_0x7f9f36.setCoreOptionsMenu.call(this);
6294
return _0x17edbf;
6295
},
6296
'inject': function() {
6297
let _this = this;
6298
this.icons = {
6299
'enter-fullscreen': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M208 281.4c-12.5-12.5-32.76-12.5-45.26-.002l-78.06 78.07l-30.06-30.06c-6.125-6.125-14.31-9.367-22.63-9.367c-4.125 0-8.279 .7891-12.25 2.43c-11.97 4.953-19.75 16.62-19.75 29.56v135.1C.0013 501.3 10.75 512 24 512h136c12.94 0 24.63-7.797 29.56-19.75c4.969-11.97 2.219-25.72-6.938-34.87l-30.06-30.06l78.06-78.07c12.5-12.49 12.5-32.75 .002-45.25L208 281.4zM487.1 0h-136c-12.94 0-24.63 7.797-29.56 19.75c-4.969 11.97-2.219 25.72 6.938 34.87l30.06 30.06l-78.06 78.07c-12.5 12.5-12.5 32.76 0 45.26l22.62 22.62c12.5 12.5 32.76 12.5 45.26 0l78.06-78.07l30.06 30.06c9.156 9.141 22.87 11.84 34.87 6.937C504.2 184.6 512 172.9 512 159.1V23.1C512 10.74 501.3 0 487.1 0z"/></svg>',
6300
'exit-fullscreen': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M215.1 272h-136c-12.94 0-24.63 7.797-29.56 19.75C45.47 303.7 48.22 317.5 57.37 326.6l30.06 30.06l-78.06 78.07c-12.5 12.5-12.5 32.75-.0012 45.25l22.62 22.62c12.5 12.5 32.76 12.5 45.26 .0013l78.06-78.07l30.06 30.06c6.125 6.125 14.31 9.367 22.63 9.367c4.125 0 8.279-.7891 12.25-2.43c11.97-4.953 19.75-16.62 19.75-29.56V296C239.1 282.7 229.3 272 215.1 272zM296 240h136c12.94 0 24.63-7.797 29.56-19.75c4.969-11.97 2.219-25.72-6.938-34.87l-30.06-30.06l78.06-78.07c12.5-12.5 12.5-32.76 .0002-45.26l-22.62-22.62c-12.5-12.5-32.76-12.5-45.26-.0003l-78.06 78.07l-30.06-30.06c-9.156-9.141-22.87-11.84-34.87-6.937c-11.97 4.953-19.75 16.62-19.75 29.56v135.1C272 229.3 282.7 240 296 240z"/></svg>',
6301
'gamepad': '<svg viewBox="0 0 640 512"><path fill="currentColor" d="M480 96H160C71.6 96 0 167.6 0 256s71.6 160 160 160c44.8 0 85.2-18.4 114.2-48h91.5c29 29.6 69.5 48 114.2 48 88.4 0 160-71.6 160-160S568.4 96 480 96zM256 276c0 6.6-5.4 12-12 12h-52v52c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4-12-12v-52H76c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h52v-52c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h52c6.6 0 12 5.4 12 12v40zm184 68c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm80-80c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48z"/></svg>',
6302
'load-state': '<svg viewBox="0 0 576 512"><path fill="currentColor" d="M572.694 292.093L500.27 416.248A63.997 63.997 0 0 1 444.989 448H45.025c-18.523 0-30.064-20.093-20.731-36.093l72.424-124.155A64 64 0 0 1 152 256h399.964c18.523 0 30.064 20.093 20.73 36.093zM152 224h328v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v278.046l69.077-118.418C86.214 242.25 117.989 224 152 224z"/></svg>',
6303
'muted': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M301.2 34.85c-11.5-5.188-25.02-3.122-34.44 5.253L131.8 160H48c-26.51 0-48 21.49-48 47.1v95.1c0 26.51 21.49 47.1 48 47.1h83.84l134.9 119.9c5.984 5.312 13.58 8.094 21.26 8.094c4.438 0 8.972-.9375 13.17-2.844c11.5-5.156 18.82-16.56 18.82-29.16V64C319.1 51.41 312.7 40 301.2 34.85zM513.9 255.1l47.03-47.03c9.375-9.375 9.375-24.56 0-33.94s-24.56-9.375-33.94 0L480 222.1L432.1 175c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l47.03 47.03l-47.03 47.03c-9.375 9.375-9.375 24.56 0 33.94c9.373 9.373 24.56 9.381 33.94 0L480 289.9l47.03 47.03c9.373 9.373 24.56 9.381 33.94 0c9.375-9.375 9.375-24.56 0-33.94L513.9 255.1z"/></svg>',
6304
'netplay': '<svg viewBox="0 0 512 512"><path fill="currentColor" d="M364.215 192h131.43c5.439 20.419 8.354 41.868 8.354 64s-2.915 43.581-8.354 64h-131.43c5.154-43.049 4.939-86.746 0-128zM185.214 352c10.678 53.68 33.173 112.514 70.125 151.992.221.001.44.008.661.008s.44-.008.661-.008c37.012-39.543 59.467-98.414 70.125-151.992H185.214zm174.13-192h125.385C452.802 84.024 384.128 27.305 300.95 12.075c30.238 43.12 48.821 96.332 58.394 147.925zm-27.35 32H180.006c-5.339 41.914-5.345 86.037 0 128h151.989c5.339-41.915 5.345-86.037-.001-128zM152.656 352H27.271c31.926 75.976 100.6 132.695 183.778 147.925-30.246-43.136-48.823-96.35-58.393-147.925zm206.688 0c-9.575 51.605-28.163 104.814-58.394 147.925 83.178-15.23 151.852-71.949 183.778-147.925H359.344zm-32.558-192c-10.678-53.68-33.174-112.514-70.125-151.992-.221 0-.44-.008-.661-.008s-.44.008-.661.008C218.327 47.551 195.872 106.422 185.214 160h141.572zM16.355 192C10.915 212.419 8 233.868 8 256s2.915 43.581 8.355 64h131.43c-4.939-41.254-5.154-84.951 0-128H16.355zm136.301-32c9.575-51.602 28.161-104.81 58.394-147.925C127.872 27.305 59.198 84.024 27.271 160h125.385z"/></svg>',
6305
'pause': '<svg viewBox="0 0 320 512"><path d="M272 63.1l-32 0c-26.51 0-48 21.49-48 47.1v288c0 26.51 21.49 48 48 48L272 448c26.51 0 48-21.49 48-48v-288C320 85.49 298.5 63.1 272 63.1zM80 63.1l-32 0c-26.51 0-48 21.49-48 48v288C0 426.5 21.49 448 48 448l32 0c26.51 0 48-21.49 48-48v-288C128 85.49 106.5 63.1 80 63.1z"/></svg>',
6306
'play': '<svg viewBox="0 0 320 512"><path d="M361 215C375.3 223.8 384 239.3 384 256C384 272.7 375.3 288.2 361 296.1L73.03 472.1C58.21 482 39.66 482.4 24.52 473.9C9.377 465.4 0 449.4 0 432V80C0 62.64 9.377 46.63 24.52 38.13C39.66 29.64 58.21 29.99 73.03 39.04L361 215z"/></svg>',
6307
'restart': '<svg viewBox="0 0 512 512"><path d="M496 48V192c0 17.69-14.31 32-32 32H320c-17.69 0-32-14.31-32-32s14.31-32 32-32h63.39c-29.97-39.7-77.25-63.78-127.6-63.78C167.7 96.22 96 167.9 96 256s71.69 159.8 159.8 159.8c34.88 0 68.03-11.03 95.88-31.94c14.22-10.53 34.22-7.75 44.81 6.375c10.59 14.16 7.75 34.22-6.375 44.81c-39.03 29.28-85.36 44.86-134.2 44.86C132.5 479.9 32 379.4 32 256s100.5-223.9 223.9-223.9c69.15 0 134 32.47 176.1 86.12V48c0-17.69 14.31-32 32-32S496 30.31 496 48z"/></svg>',
6308
'save-state': '<svg viewBox="0 0 448 512"><path fill="currentColor" d="M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z"/></svg>',
6309
'screen-record': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><path fill="currentColor" d="M19.994,0C8.952,0,0,8.952,0,19.995c0,11.043,8.952,19.994,19.994,19.994s19.995-8.952,19.995-19.994,C39.989,8.952,31.037,0,19.994,0z M19.994,27.745c-4.28,0-7.75-3.47-7.75-7.75s3.47-7.75,7.75-7.75s7.75,3.47,7.75,7.75,S24.275,27.745,19.994,27.745z"/></svg>',
6310
'settings': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M495.9 166.6C499.2 175.2 496.4 184.9 489.6 191.2L446.3 230.6C447.4 238.9 448 247.4 448 256C448 264.6 447.4 273.1 446.3 281.4L489.6 320.8C496.4 327.1 499.2 336.8 495.9 345.4C491.5 357.3 486.2 368.8 480.2 379.7L475.5 387.8C468.9 398.8 461.5 409.2 453.4 419.1C447.4 426.2 437.7 428.7 428.9 425.9L373.2 408.1C359.8 418.4 344.1 427 329.2 433.6L316.7 490.7C314.7 499.7 307.7 506.1 298.5 508.5C284.7 510.8 270.5 512 255.1 512C241.5 512 227.3 510.8 213.5 508.5C204.3 506.1 197.3 499.7 195.3 490.7L182.8 433.6C167 427 152.2 418.4 138.8 408.1L83.14 425.9C74.3 428.7 64.55 426.2 58.63 419.1C50.52 409.2 43.12 398.8 36.52 387.8L31.84 379.7C25.77 368.8 20.49 357.3 16.06 345.4C12.82 336.8 15.55 327.1 22.41 320.8L65.67 281.4C64.57 273.1 64 264.6 64 256C64 247.4 64.57 238.9 65.67 230.6L22.41 191.2C15.55 184.9 12.82 175.3 16.06 166.6C20.49 154.7 25.78 143.2 31.84 132.3L36.51 124.2C43.12 113.2 50.52 102.8 58.63 92.95C64.55 85.8 74.3 83.32 83.14 86.14L138.8 103.9C152.2 93.56 167 84.96 182.8 78.43L195.3 21.33C197.3 12.25 204.3 5.04 213.5 3.51C227.3 1.201 241.5 0 256 0C270.5 0 284.7 1.201 298.5 3.51C307.7 5.04 314.7 12.25 316.7 21.33L329.2 78.43C344.1 84.96 359.8 93.56 373.2 103.9L428.9 86.14C437.7 83.32 447.4 85.8 453.4 92.95C461.5 102.8 468.9 113.2 475.5 124.2L480.2 132.3C486.2 143.2 491.5 154.7 495.9 166.6V166.6zM256 336C300.2 336 336 300.2 336 255.1C336 211.8 300.2 175.1 256 175.1C211.8 175.1 176 211.8 176 255.1C176 300.2 211.8 336 256 336z"/></svg>',
6311
'volume': '<svg viewBox="0 0 640 512"><path d="M412.6 182c-10.28-8.334-25.41-6.867-33.75 3.402c-8.406 10.24-6.906 25.35 3.375 33.74C393.5 228.4 400 241.8 400 255.1c0 14.17-6.5 27.59-17.81 36.83c-10.28 8.396-11.78 23.5-3.375 33.74c4.719 5.806 11.62 8.802 18.56 8.802c5.344 0 10.75-1.779 15.19-5.399C435.1 311.5 448 284.6 448 255.1S435.1 200.4 412.6 182zM473.1 108.2c-10.22-8.334-25.34-6.898-33.78 3.34c-8.406 10.24-6.906 25.35 3.344 33.74C476.6 172.1 496 213.3 496 255.1s-19.44 82.1-53.31 110.7c-10.25 8.396-11.75 23.5-3.344 33.74c4.75 5.775 11.62 8.771 18.56 8.771c5.375 0 10.75-1.779 15.22-5.431C518.2 366.9 544 313 544 255.1S518.2 145 473.1 108.2zM534.4 33.4c-10.22-8.334-25.34-6.867-33.78 3.34c-8.406 10.24-6.906 25.35 3.344 33.74C559.9 116.3 592 183.9 592 255.1s-32.09 139.7-88.06 185.5c-10.25 8.396-11.75 23.5-3.344 33.74C505.3 481 512.2 484 519.2 484c5.375 0 10.75-1.779 15.22-5.431C601.5 423.6 640 342.5 640 255.1S601.5 88.34 534.4 33.4zM301.2 34.98c-11.5-5.181-25.01-3.076-34.43 5.29L131.8 160.1H48c-26.51 0-48 21.48-48 47.96v95.92c0 26.48 21.49 47.96 48 47.96h83.84l134.9 119.8C272.7 477 280.3 479.8 288 479.8c4.438 0 8.959-.9314 13.16-2.835C312.7 471.8 320 460.4 320 447.9V64.12C320 51.55 312.7 40.13 301.2 34.98z"/></svg>',
6312
'cheat': '<svg viewBox="0 0 496 512"><path fill="currentColor" d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm-80-216c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm4 72.6c-20.8 25-51.5 39.4-84 39.4s-63.2-14.3-84-39.4c-8.5-10.2-23.7-11.5-33.8-3.1-10.2 8.5-11.5 23.6-3.1 33.8 30 36 74.1 56.6 120.9 56.6s90.9-20.6 120.9-56.6c8.5-10.2 7.1-25.3-3.1-33.8-10.1-8.4-25.3-7.1-33.8 3.1z" class=""></path></svg>',
6313
'cache-manager': '<svg viewBox="0 0 1800 1800"><path d="M896 768q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5T231 896 128 768V598q119 84 325 127t443 43zm0 768q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128v-170q119 84 325 127t443 43zm0-384q237 0 443-43t325-127v170q0 69-103 128t-280 93.5-385 34.5-385-34.5-280-93.5-103-128V982q119 84 325 127t443 43zM896 0q208 0 385 34.5t280 93.5 103 128v128q0 69-103 128t-280 93.5T896 640t-385-34.5T231 512 128 384V256q0-69 103-128t280-93.5T896 0z"/></svg>'
6314
}, this.id = Math.floor(0x2710 * Math.random());
6315
let _0x17edbf = null;
6316
this.elements.controls = null;
6317
let _0x2c1832 = {
6318
'id': this.id
6319
},
6320
_0x270a9e = true;
6321
_0x1e2c68.function(this.config.controls) && (this.config.controls = this.config.controls.call(this.props)), this.config.controls || (this.config.controls = []), _0x1e2c68.element(this.config.controls) || _0x1e2c68.string(this.config.controls) ? _0x17edbf = this.config.controls : (_0x17edbf = _0x7f9f36.create.call(this, {
6322
'id': this.id,
6323
'seektime': this.config.seekTime,
6324
'speed': this.speed,
6325
'quality': this.quality
6326
}), _0x270a9e = false);
6327
let _0x1e6644, _0x3ec218 = function(_0x406126) {
6328
let _0x17edbf = _0x406126;
6329
return Object.entries(_0x2c1832).forEach(function(_0x3e992c) {
6330
let _0x2c1832 = _0x5005e6(_0x3e992c, 2),
6331
_0x47c2ec = _0x2c1832[0],
6332
_0x547588 = _0x2c1832[1];
6333
_0x17edbf = _0x1a0e98(_0x17edbf, '{' .concat(_0x47c2ec, '}'), _0x547588);
6334
}), _0x17edbf;
6335
};
6336
if (_0x270a9e && (_0x1e2c68.string(this.config.controls) ? _0x17edbf = _0x3ec218(_0x17edbf) : _0x1e2c68.element(_0x17edbf) && (_0x17edbf.innerHTML = _0x3ec218(_0x17edbf.innerHTML))), _0x1e2c68.string(this.config.selectors.controls.container) && (_0x1e6644 = document.querySelector(this.config.selectors.controls.container)), _0x1e2c68.element(_0x1e6644) || (_0x1e6644 = this.elements.container), _0x1e6644[_0x1e2c68.element(_0x17edbf) ? 'insertAdjacentElement' : 'insertAdjacentHTML']('afterbegin', _0x17edbf), _0x1e2c68.element(this.elements.controls) || _0x7f9f36.findElements.call(this), !_0x1e2c68.empty(this.elements.buttons)) {
6337
let _0xe8272c = function(_0x176a3e) {
6338
let _0x2c1832 = _this.config.classNames.controlPressed;
6339
Object.defineProperty(_0x176a3e, 'pressed', {
6340
'enumerable': true,
6341
'get': function() {
6342
return _0x350d73(_0x176a3e, _0x2c1832);
6343
},
6344
'set': function() {
6345
let _0xa88a13 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
6346
_0x3a8e2f(_0x176a3e, _0x2c1832, _0xa88a13);
6347
}
6348
});
6349
};
6350
Object.values(this.elements.buttons).filter(Boolean).forEach(function(_0x577b9b) {
6351
_0x1e2c68.array(_0x577b9b) || _0x1e2c68.nodeList(_0x577b9b) ? Array.from(_0x577b9b).filter(Boolean).forEach(_0xe8272c) : _0xe8272c(_0x577b9b);
6352
});
6353
}
6354
window.navigator.userAgent.includes('Edge') && _0x2b30e0(_0x1e6644);
6355
}
6356
},
6357
_0x2593da = _0x7f9f36;
6358
6359
function _0x28bdca(_0x5c50c3, _0x217698) {
6360
for (let _0x2c1832 = 0; _0x2c1832 < _0x217698.length; _0x2c1832++) {
6361
let _0x172cdb = _0x217698[_0x2c1832];
6362
_0x172cdb.enumerable = _0x172cdb.enumerable || false, _0x172cdb.configurable = true, 'value' in _0x172cdb && (_0x172cdb.writable = true), Object.defineProperty(_0x5c50c3, _0x172cdb.key, _0x172cdb);
6363
}
6364
}
6365
6366
function _0x238270() {
6367
if (this.enabled) {
6368
let _0xa88a13 = this.player.elements.buttons.fullscreen;
6369
_0x1e2c68.element(_0xa88a13) && (_0xa88a13.pressed = this.active), _0xbae705.call(this.player, this.target, this.active ? 'enterfullscreen' : 'exitfullscreen', true), _0x59aa33.isIos || _0x5e0c7d.call(this.player, this.target, this.active);
6370
}
6371
}
6372
6373
function _0x3c983f() {
6374
let _0xa88a13 = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
6375
_0xa88a13 ? this.scrollPosition = {
6376
'x': window.scrollX || 0,
6377
'y': window.scrollY || 0x0
6378
} : window.scrollTo(this.scrollPosition.x, this.scrollPosition.y), document.body.style.overflow = _0xa88a13 ? 'hidden' : '', _0x3a8e2f(this.target, this.player.config.classNames.fullscreen.fallback, _0xa88a13), _0x238270.call(this);
6379
}
6380
let _0x335854 = function() {
6381
function _0x1339df(_0x5f19c6) {
6382
let _0x2c1832 = this;
6383
! function(_0x143a8a, _0x32a0a1) {
6384
if (!(_0x143a8a instanceof _0x32a0a1)) throw new TypeError('Cannot call a class as a function');
6385
}(this, _0x1339df), this.player = _0x5f19c6, this.prefix = _0x1339df.prefix, this.property = _0x1339df.property, this.scrollPosition = {
6386
'x': 0,
6387
'y': 0x0
6388
}, _0x1093f4.call(this.player, document, 'ms' === this.prefix ? 'MSFullscreenChange' : '' .concat(this.prefix, 'fullscreenchange'), function() {
6389
_0x238270.call(_0x2c1832);
6390
}), this.update();
6391
}
6392
6393
let _0x17edbf, _0x2c1832, _0x50d347;
6394
6395
_0x17edbf = _0x1339df
6396
6397
_0x50d347 = [{
6398
'key': 'native',
6399
'get': function() {
6400
return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
6401
}
6402
}, {
6403
'key': 'prefix',
6404
'get': function() {
6405
if (_0x1e2c68.function(document.exitFullscreen)) return '';
6406
let _0x1339df = '';
6407
return ['webkit', 'moz', 'ms'].some(function(_0xc1e0c3) {
6408
return !(!_0x1e2c68.function(document['' .concat(_0xc1e0c3, 'ExitFullscreen')]) && !_0x1e2c68.function(document['' .concat(_0xc1e0c3, 'CancelFullScreen')]) || (_0x1339df = _0xc1e0c3, 0));
6409
}), _0x1339df;
6410
}
6411
}, {
6412
'key': 'property',
6413
'get': function() {
6414
return 'moz' === this.prefix ? 'FullScreen' : 'Fullscreen';
6415
}
6416
}]
6417
6418
_0x2c1832 = [{
6419
'key': 'update',
6420
'value': function() {
6421
this.enabled, _0x3a8e2f(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.enabled);
6422
}
6423
}, {
6424
'key': 'enter',
6425
'value': function() {
6426
this.enabled && (_0x1339df.native ? this.prefix ? _0x1e2c68.empty(this.prefix) || this.target['' .concat(this.prefix, 'Request').concat(this.property)]() : this.target.requestFullscreen() : _0x3c983f.call(this, true));
6427
}
6428
}, {
6429
'key': 'exit',
6430
'value': function() {
6431
if (this.enabled)
6432
if (_0x1339df.native)
6433
if (this.prefix) {
6434
if (!_0x1e2c68.empty(this.prefix)) {
6435
let _0x17edbf = 'moz' === this.prefix ? 'Cancel' : 'Exit';
6436
document['' .concat(this.prefix).concat(_0x17edbf).concat(this.property)]();
6437
}
6438
} else(document.cancelFullScreen || document.exitFullscreen).call(document);
6439
else _0x3c983f.call(this, false);
6440
}
6441
}, {
6442
'key': 'toggle',
6443
'value': function() {
6444
this.active ? this.exit() : this.enter();
6445
}
6446
}, {
6447
'key': 'enabled',
6448
'get': function() {
6449
return _0x1339df.native;
6450
}
6451
}, {
6452
'key': 'active',
6453
'get': function() {
6454
return !!this.enabled && (_0x1339df.native ? (this.prefix ? document['' .concat(this.prefix).concat(this.property, 'Element')] : document.fullscreenElement) === this.target : _0x350d73(this.target, this.player.config.classNames.fullscreen.fallback));
6455
}
6456
}, {
6457
'key': 'target',
6458
'get': function() {
6459
return _0x59aa33.isEdge ? this.player.game : this.player.elements.container;
6460
}
6461
}]
6462
6463
_0x28bdca(_0x17edbf.prototype, _0x2c1832)
6464
_0x50d347 && _0x28bdca(_0x17edbf, _0x50d347)
6465
return _0x1339df;
6466
6467
}();
6468
6469
function _0x42b437(_0x458e02, _0x5729e1) {
6470
if (Array.isArray(_0x458e02)) return _0x458e02;
6471
let _0x2c1832 = [],
6472
_0x2e7aa7 = true,
6473
_0x393a5f = false,
6474
_0x3b4eca = undefined;
6475
try {
6476
for (let _0x1aca09, _0x1bb8de = _0x458e02[Symbol.iterator](); !(_0x2e7aa7 = (_0x1aca09 = _0x1bb8de.next()).done) && (_0x2c1832.push(_0x1aca09.value), !_0x5729e1 || _0x2c1832.length !== _0x5729e1); _0x2e7aa7 = true);
6477
} catch (_0x190997) {
6478
_0x393a5f = true, _0x3b4eca = _0x190997;
6479
} finally {
6480
try {
6481
_0x2e7aa7 || null == _0x1bb8de.return || _0x1bb8de.return();
6482
} finally {
6483
if (_0x393a5f) throw _0x3b4eca;
6484
}
6485
}
6486
return _0x2c1832;
6487
}
6488
let _0x37093c = function() {
6489
function _0x31e271(_0x948a97) {
6490
! function(_0x3adedc, _0x5952e9) {
6491
if (!(_0x3adedc instanceof _0x5952e9)) throw new TypeError('Cannot call a class as a function');
6492
}(this, _0x31e271), this.emulator = _0x948a97, this.lastKey = null, this.focusTimer = null, this.lastKeyDown = null, this.toggleMenu = this.toggleMenu.bind(this), this.setTabFocus = this.setTabFocus.bind(this), this.firstTouch = this.firstTouch.bind(this);
6493
}
6494
_0x31e271.prototype = {
6495
toggleMenu: function(_0x3156ad) {
6496
_0x2593da.toggleMenu.call(this.emulator, _0x3156ad);
6497
},
6498
firstTouch: function() {
6499
let _0x31e271 = this.emulator,
6500
_0x17edbf = _0x31e271.elements;
6501
_0x31e271.touch = true, _0x3a8e2f(_0x17edbf.container, _0x31e271.config.classNames.isTouch, true);
6502
},
6503
setTabFocus: function(_0x20bf1f) {
6504
let _0x17edbf = this.emulator,
6505
_0x2c1832 = _0x17edbf.elements,
6506
_0x48d087 = _0x17edbf;
6507
if (clearTimeout(this.focusTimer), 'keydown' !== _0x20bf1f.type || 0x9 === _0x20bf1f.which) {
6508
'keydown' === _0x20bf1f.type && (this.lastKeyDown = _0x20bf1f.timeStamp);
6509
let _0x27d4ad, _0x967a30 = _0x20bf1f.timeStamp - this.lastKeyDown <= 0x14;
6510
('focus' !== _0x20bf1f.type || _0x967a30) && (_0x27d4ad = _0x48d087.config.classNames.tabFocus, _0x3a8e2f(_0x23ffa1.call(_0x48d087, '.' .concat(_0x27d4ad)), _0x27d4ad, false), this.focusTimer = setTimeout(function() {
6511
let _0x20bf1f = document.activeElement;
6512
_0x2c1832.container.contains(_0x20bf1f) && _0x3a8e2f(document.activeElement, _0x48d087.config.classNames.tabFocus, true);
6513
}, 0xa));
6514
}
6515
},
6516
global: function() {
6517
let _0x31e271 = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0],
6518
_0x17edbf = this.emulator,
6519
_0x2c1832 = _0x17edbf;
6520
_0x1ef215.call(_0x2c1832, document.body, 'click', this.toggleMenu, _0x31e271), _0x455c85.call(_0x2c1832, document.body, 'touchstart', this.firstTouch), _0x1ef215.call(_0x2c1832, document.body, 'keydown focus blur', this.setTabFocus, _0x31e271, false, true), _0x1093f4.call(_0x2c1832, document.body, 'keyup', function(_0x4e289a) {
6521
_0x2c1832.started && (0x71 === _0x4e289a.which && (_0x4e289a.shiftKey ? null === _0x2c1832.elements.buttons.saveState.getAttribute('hidden') && _0xbae705.call(_0x2c1832, _0x2c1832.elements.buttons.saveState, 'click') : _0xdcec2a.quickSaveState()), 0x73 === _0x4e289a.which && (_0x4e289a.shiftKey ? null === _0x2c1832.elements.buttons.loadState.getAttribute('hidden') && _0xbae705.call(_0x2c1832, _0x2c1832.elements.buttons.loadState, 'click') : _0xdcec2a.quickLoadState()), 0x78 === _0x4e289a.which && _0xbae705.call(_0x2c1832, _0x2c1832.elements.buttons.mute, 'click'));
6522
});
6523
},
6524
container: function() {
6525
let _0x31e271, _0x17edbf = this.emulator,
6526
_0x2c1832 = _0x17edbf.elements,
6527
_0x45d275 = _0x17edbf,
6528
setFullscreenInterval = null;
6529
_0x1093f4.call(_0x45d275, _0x2c1832.container, 'mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen start-game', function(_0x1ac81c) {
6530
let _0x3953b5 = _0x2c1832.controls;
6531
_0x3953b5 && 'enterfullscreen' === _0x1ac81c.type && (_0x3953b5.pressed = false, _0x3953b5.hover = false);
6532
let _0x2c3de3 = 0;
6533
if (['touchstart', 'touchmove', 'mousemove', 'start-game'].includes(_0x1ac81c.type)) {
6534
if (getSystem(_0x17edbf.system, true) === 'nds' && getSystem(_0x17edbf.system, _0x17edbf.coreVer) !== 'melonds' && _0x1ac81c.type == 'mousemove' && _0x27f4c4 && _0x27f4c4.Module && _0x27f4c4.Module.canvas && (document.pointerLockElement === _0x27f4c4.Module.canvas || document.mozPointerLockElement === _0x27f4c4.Module.canvas)) {
6535
_0x5ab74d.toggleControls.call(_0x45d275, false);
6536
return;
6537
}
6538
if (_0xdcec2a && (_0xdcec2a.virtualGamepadContainer == 'undefined' || _0xdcec2a.virtualGamepadContainer === null)) {
6539
_0x5ab74d.toggleControls.call(_0x45d275, true);
6540
_0x2c3de3 = _0x45d275.touch ? 0xbb8 : 0x7d0;
6541
clearTimeout(_0x31e271);
6542
_0x31e271 = setTimeout(function() {
6543
return _0x5ab74d.toggleControls.call(_0x45d275, false);
6544
}, _0x2c3de3);
6545
_0x2c1832.controls.setAttribute('data-timer', _0x31e271);
6546
}
6547
};
6548
}), _0x1093f4.call(_0x45d275, window, 'resize', function(_0x3e2cc5) {
6549
let _0x17edbf = _0x45d275.elements.container.clientHeight,
6550
_0x2c1832 = _0x23ffa1.call(_0x45d275, '.' .concat(getClass({
6551
'ejs__menu__container': true
6552
}), ' [role="menu"]'));
6553
Array.from(_0x2c1832).forEach(function(_0x43a16d) {
6554
_0x43a16d.style.maxHeight = '' .concat(_0x17edbf - 0x5f, 'px'), _0x43a16d.style.overflow = 'auto';
6555
}), _0x27f4c4.Module && _0x27f4c4.Module.canvas, _0x45d275.elements.container.clientWidth / _0x45d275.elements.container.clientHeight < 1.3 ? _0x3a8e2f(_0x45d275.elements.container, getClass({
6556
'portrait': true
6557
}), true) : _0x3a8e2f(_0x45d275.elements.container, getClass({
6558
'portrait': true
6559
}), false);
6560
}), _0xbae705.call(_0x45d275, window, 'resize'), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'enterfullscreen', function(_0x586586) {
6561
if (_0x27f4c4.isMobileDevice && window.screen && screen.orientation && typeof screen.orientation.lock == 'function') {
6562
try {
6563
screen.orientation.lock("landscape");
6564
}catch(e){}
6565
} else if (_0x27f4c4.isMobileDevice && window.ScreenOrientation && typeof ScreenOrientation.lock == 'function') {
6566
try {
6567
ScreenOrientation.lock("landscape");
6568
}catch(e){}
6569
}
6570
if (_0x45d275.coreVer === 2 && _0x27f4c4.Module) {
6571
let repeat = 50;
6572
clearInterval(setFullscreenInterval);
6573
setFullscreenInterval = setInterval(function() {
6574
_0x27f4c4.Module.setCanvasSize(window.innerWidth, window.innerHeight);
6575
if (repeat < 0) {
6576
clearInterval(setFullscreenInterval);
6577
}
6578
repeat--;
6579
}, 100)
6580
}
6581
setTimeout(function() {
6582
_0xbae705.call(_0x45d275, window, 'resize');
6583
}, 0x12c);
6584
}), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'exitfullscreen', function(_0x4de2f3) {
6585
if (_0x27f4c4.isMobileDevice && window.screen && screen.orientation && typeof screen.orientation.unlock == 'function') {
6586
try {
6587
screen.orientation.unlock();
6588
}catch(e){}
6589
} else if (_0x27f4c4.isMobileDevice && window.ScreenOrientation && typeof ScreenOrientation.unlock == 'function') {
6590
try {
6591
ScreenOrientation.unlock();
6592
}catch(e){}
6593
}
6594
if (_0x45d275.coreVer === 2 && _0x27f4c4.Module) {
6595
clearInterval(setFullscreenInterval);
6596
_0x27f4c4.Module.setCanvasSize(800, 600);
6597
}
6598
setTimeout(function() {
6599
_0xbae705.call(_0x45d275, window, 'resize');
6600
}, 0x12c);
6601
}), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'start-game', function(_0x5b0a00) {
6602
let _0x17edbf = window.document.createEvent('UIEvents');
6603
_0x17edbf.initUIEvent('resize', true, false, window, 0), window.dispatchEvent(_0x17edbf), _0x3a8e2f(_0x45d275.elements.container, getClass({
6604
'game-started': true
6605
}), true);
6606
}), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'blur', function(_0x893c7a) {
6607
let _0x17edbf = _0x893c7a.currentTarget;
6608
setTimeout(function() {
6609
_0x17edbf.contains(document.activeElement) || _0xbae705.call(_0x45d275, _0x45d275.elements, 'blurgame');
6610
}, 0);
6611
}), _0x1093f4.call(_0x45d275, _0x45d275.elements.container, 'focus', function(_0xe0dee3) {
6612
let _0x17edbf = _0xe0dee3.currentTarget;
6613
setTimeout(function() {
6614
_0x17edbf.contains(document.activeElement) && _0xbae705.call(_0x45d275, _0x45d275.elements, 'focusgame');
6615
}, 0);
6616
});
6617
},
6618
media: function() {
6619
let _0x31e271 = this.emulator,
6620
_0x17edbf = _0x31e271.elements,
6621
_0x2c1832 = _0x31e271;
6622
_0x1093f4.call(_0x2c1832, _0x2c1832.game, 'volumechange', function(_0x3099fe) {
6623
return _0x2593da.updateVolume.call(_0x2c1832, _0x3099fe);
6624
}), _0x1093f4.call(_0x2c1832, _0x17edbf.container, 'contextmenu', function(_0x5c22bc) {
6625
_0x2c1832.touch || _0x2c1832.lightgun || _0x2593da.toggleContextMenu.call(_0x2c1832, _0x5c22bc, true);
6626
_0x5c22bc.preventDefault();
6627
}, false), _0x1093f4.call(_0x2c1832, _0x17edbf.container, 'mousewheel', function(_0x49c974) {
6628
_0x49c974.stopPropagation();
6629
}, false), _0x1093f4.call(_0x2c1832, _0x17edbf.container, 'mousedown', function(_0x53ee35) {
6630
if (getSystem(_0x31e271.system, true) === 'nds' && getSystem(_0x31e271.system, _0x31e271.coreVer) !== 'melonds' && _0x27f4c4 && _0x27f4c4.Module && _0x27f4c4.Module.canvas && ! _0x27f4c4.isMobileDevice && !(document.pointerLockElement === _0x27f4c4.Module.canvas || document.mozPointerLockElement === _0x27f4c4.Module.canvas) && _0x31e271.started && !_0x31e271.connected) {
6631
setTimeout(function() {
6632
if (_0x31e271.onButtonDiv !== true) {
6633
_0x27f4c4.Module.canvas.requestPointerLock = _0x27f4c4.Module.canvas.requestPointerLock || _0x27f4c4.Module.canvas.mozRequestPointerLock;
6634
_0x27f4c4.Module.canvas.requestPointerLock()
6635
}
6636
_0x31e271.onButtonDiv = false
6637
}, 100)
6638
}
6639
_0x2c1832.touch || _0x2593da.toggleContextMenu.call(_0x2c1832, _0x53ee35, false);
6640
}, false), _0x1093f4.call(_0x2c1832, _0x2c1832.game, 'volumechange', function() {
6641
_0x2c1832.storage.set({
6642
'volume': _0x2c1832.volume,
6643
'muted': _0x2c1832.muted
6644
}), _0xdcec2a.setVolume && _0xdcec2a.setVolume();
6645
});
6646
let _0x38e17f = _0x2c1832.config.events.concat(['keyup', 'keydown']).join(' ');
6647
_0x1093f4.call(_0x2c1832, _0x2c1832.game, _0x38e17f, function(_0x38e438) {
6648
let _0x2b4804 = _0x38e438.detail,
6649
_0x1bfeb2 = void 0 === _0x2b4804 ? {} : _0x2b4804;
6650
'error' === _0x38e438.type && (_0x1bfeb2 = _0x2c1832.game.error), _0xbae705.call(_0x2c1832, _0x17edbf.container, _0x38e438.type, true, _0x1bfeb2);
6651
});
6652
},
6653
proxy: function(_0x52d0c2, _0x500f90, _0x175ce5) {
6654
let _0x4bb44e = this.emulator,
6655
_0x584a64 = _0x4bb44e.config.listeners[_0x175ce5],
6656
_0x5269fd = true;
6657
_0x1e2c68.function(_0x584a64) && (_0x5269fd = _0x584a64.call(_0x4bb44e, _0x52d0c2)), _0x5269fd && _0x1e2c68.function(_0x500f90) && _0x500f90.call(_0x4bb44e, _0x52d0c2);
6658
},
6659
bind: function(_0x4a8d46, _0x8f91ad, _0x2affda, _0x41dfb1) {
6660
let _0x1363b1 = this,
6661
_0x53b9a1 = !(arguments.length > 4 && void 0 !== arguments[4]) || arguments[4],
6662
_0x5209a5 = this.emulator,
6663
_0x27b738 = _0x5209a5,
6664
_0x5d89ff = _0x27b738.config.listeners[_0x41dfb1],
6665
_0x100c9f = _0x1e2c68.function(_0x5d89ff);
6666
_0x1093f4.call(_0x27b738, _0x4a8d46, _0x8f91ad, function(_0x5a03ac) {
6667
return _0x1363b1.proxy(_0x5a03ac, _0x2affda, _0x41dfb1);
6668
}, _0x53b9a1 && !_0x100c9f);
6669
},
6670
controls: function() {
6671
let _0x31e271 = this,
6672
_0x17edbf = this.emulator,
6673
_0x2c1832 = _0x17edbf.elements,
6674
_0x127f22 = _0x59aa33.isIE ? 'change' : 'input';
6675
if (this.bind(_0x2c1832.buttons.mute, 'click', function() {
6676
_0x17edbf.muted = !_0x17edbf.muted;
6677
}, 'mute'), this.bind(_0x2c1832.buttons.fullscreen, 'click', function() {
6678
_0x17edbf.fullscreen.toggle();
6679
}, 'fullscreen'), this.bind(_0x2c1832.buttons.gamepad, 'click', function() {
6680
_0x5ab74d.toggleControls.call(_0x17edbf, false), _0x132da7(_0x2c1832.dialogs.gamepad, false);
6681
}, 'mute'), this.bind(_0x2c1832.buttons.saveState, 'click', function() {
6682
(async function() {
6683
_0xbae705.call(_0x17edbf, _0x17edbf.elements.container, 'savestate-start', false, {});
6684
let _0x31e271 = await _0xdcec2a.saveState(),
6685
_0x2c1832 = _0xdcec2a.getScreenData();
6686
6687
if (_0x378b5c.saveLoadDB.call(_0x17edbf, 'save')) {
6688
return;
6689
}
6690
if (_0x1e2c68.function(_0x17edbf.config.onsavestate)) _0x17edbf.config.onsavestate.call(null, {
6691
'screenshot': _0x2c1832,
6692
'state': _0x31e271
6693
});
6694
else {
6695
let name = _0x17edbf.getStartName(true).split('/').pop();
6696
let data = new Blob([_0x31e271]);
6697
if (name.includes('.')) {
6698
name = name.substring(0, name.length-name.split('.').pop().length-1);
6699
}
6700
if (typeof _0x17edbf.gameName == 'string') {
6701
name = _0x17edbf.gameName
6702
}
6703
let _0x49f6b6 = name ? '' .concat(name, '.state') : 'game.state';
6704
let a = document.createElement('a');
6705
a.download = _0x49f6b6;
6706
a.href = URL.createObjectURL(data);
6707
a.click();
6708
setTimeout(function() {
6709
URL.revokeObjectURL(a.href);
6710
}, 2000);
6711
}
6712
_0x17edbf.elements.container.focus();
6713
})();
6714
saveSaveFiles();
6715
}, 'mute'), this.bind(_0x2c1832.buttons.loadState, 'click', function() {
6716
_0xbae705.call(_0x17edbf, _0x17edbf.elements.container, 'loadstate', false, {});
6717
}, 'mute'), this.bind(_0x2c1832.buttons.settings, 'click', function(_0x1396ee) {
6718
_0x1396ee.stopPropagation(), _0x2593da.toggleMenu.call(_0x17edbf, _0x1396ee);
6719
}), this.bind(_0x2c1832.buttons.settings, 'keyup', function(_0x454936) {
6720
let _0x2c1832 = _0x454936.which;
6721
[0xd, 0x20].includes(_0x2c1832) && (0xd !== _0x2c1832 ? (_0x454936.preventDefault(), _0x454936.stopPropagation(), _0x2593da.toggleMenu.call(_0x17edbf, _0x454936)) : _0x2593da.focusFirstMenuItem.call(_0x17edbf, null, true));
6722
}, null, false), this.bind(_0x2c1832.settings.menu, 'keydown', function(_0x40072c) {
6723
0x1b === _0x40072c.which && _0x2593da.toggleMenu.call(_0x17edbf, _0x40072c);
6724
}), _0x59aa33.isIos) {
6725
let _0x4bd188 = _0x23ffa1.call(_0x17edbf, 'input[type="range"]');
6726
Array.from(_0x4bd188).forEach(function(_0x345e4c) {
6727
return _0x31e271.bind(_0x345e4c, _0x127f22, function(_0x58e6a9) {
6728
return _0x2b30e0(_0x58e6a9.target);
6729
});
6730
});
6731
}
6732
_0x59aa33.isWebkit && Array.from(_0x23ffa1.call(_0x17edbf, 'input[type="range"]')).forEach(function(_0x45c503) {
6733
_0x31e271.bind(_0x45c503, 'input', function(_0x436691) {
6734
return _0x2593da.updateRangeFill.call(_0x17edbf, _0x436691.target);
6735
});
6736
}), this.bind(_0x2c1832.inputs.volume, _0x127f22, function(_0x42307e) {
6737
_0x17edbf.volume = _0x42307e.target.value;
6738
}, 'volume'), this.bind(_0x2c1832.controls, 'mouseenter mouseleave', function(_0x10170b) {
6739
'mouseleave' === _0x10170b.type && null === _0x10170b.toElement ? _0x2c1832.controls.hover = true : _0x2c1832.controls.hover = !_0x17edbf.touch && 'mouseenter' === _0x10170b.type;
6740
}), this.bind(_0x2c1832.controls, 'mousedown mouseup touchstart touchend touchcancel', function(_0x4bfb22) {
6741
if (['mousedown', 'touchstart'].includes(_0x4bfb22.type)) {
6742
_0x2c1832.controls.pressed = true;
6743
let _0x17edbf = _0x2c1832.controls.getAttribute('data-timer2');
6744
clearTimeout(_0x17edbf);
6745
} else {
6746
let _0x29ba04 = setTimeout(function() {
6747
_0x2c1832.controls.pressed = false;
6748
}, 0xfa0);
6749
_0x2c1832.controls.setAttribute('data-timer2', _0x29ba04);
6750
}
6751
}), this.bind(_0x2c1832.controls, 'focusin focusout', function(_0x54e607) {
6752
let _0x466a37 = _0x17edbf.config,
6753
_0x2ab6f3 = _0x17edbf.elements,
6754
_0x5f0669 = 'focusin' === _0x54e607.type,
6755
_0x11de96 = _0x2ab6f3.controls.getAttribute('data-timer');
6756
if (_0x3a8e2f(_0x2ab6f3.controls, _0x466a37.classNames.noTransition, _0x5f0669), _0x5ab74d.toggleControls.call(_0x17edbf, _0x5f0669), _0x5f0669) {
6757
setTimeout(function() {
6758
_0x3a8e2f(_0x2ab6f3.controls, _0x466a37.classNames.noTransition, false);
6759
}, 0);
6760
let _0x314d11 = _0x31e271.touch ? 0xbb8 : 0xfa0;
6761
clearTimeout(_0x11de96), _0x11de96 = setTimeout(function() {
6762
return _0x5ab74d.toggleControls.call(_0x17edbf, false);
6763
}, _0x314d11), _0x2ab6f3.controls.setAttribute('data-timer', _0x11de96);
6764
}
6765
}), this.bind(_0x2c1832.inputs.volume, 'wheel', function(_0x28b2d2) {
6766
let _0x2c1832 = _0x28b2d2.webkitDirectionInvertedFromDevice,
6767
_0x12883c = _0x42b437([_0x28b2d2.deltaX, -_0x28b2d2.deltaY].map(function(_0x1ce956) {
6768
return _0x2c1832 ? -_0x1ce956 : _0x1ce956;
6769
}), 2),
6770
_0x247794 = _0x12883c[0],
6771
_0x5dcee2 = _0x12883c[1],
6772
_0x5691ae = Math.sign(Math.abs(_0x247794) > Math.abs(_0x5dcee2) ? _0x247794 : _0x5dcee2);
6773
_0x17edbf.increaseVolume(_0x5691ae / 0x32);
6774
let _0x47df17 = _0x17edbf.game.volume;
6775
(0x1 === _0x5691ae && _0x47df17 < 1 || -0x1 === _0x5691ae && _0x47df17 > 0) && _0x28b2d2.preventDefault();
6776
}, 'volume', false), this.bind(_0x2c1832.controls, 'contextmenu', function(_0x1db0c5) {
6777
_0x1db0c5.stopPropagation();
6778
}), this.bind(_0x2c1832.contextMenu, 'contextmenu', function(_0x37851d) {
6779
_0x37851d.stopPropagation();
6780
});
6781
}
6782
6783
}
6784
return _0x31e271;
6785
}();
6786
6787
function _0x1a3a6c(_0x5a5a15, _0x4e2d69) {
6788
for (let _0x2c1832 = 0; _0x2c1832 < _0x4e2d69.length; _0x2c1832++) {
6789
let _0x2e1c57 = _0x4e2d69[_0x2c1832];
6790
_0x2e1c57.enumerable = _0x2e1c57.enumerable || false, _0x2e1c57.configurable = true, 'value' in _0x2e1c57 && (_0x2e1c57.writable = true), Object.defineProperty(_0x5a5a15, _0x2e1c57.key, _0x2e1c57);
6791
}
6792
}
6793
let _0x3dbc76 = function() {
6794
function _0x6954aa(_0x28cce1, _0x2ba0e6) {
6795
return new Promise(async function(resolve, reject) {
6796
let _0x5938bc = this;
6797
let _0x2136bc = function(path, isDirectory) {
6798
let finpath = window.location.pathname.split('/').pop();
6799
let finalpath = window.location.pathname.substring(0, window.location.pathname.length - finpath.length);
6800
let split3 = finalpath.split('/')
6801
let split2 = path.split('/')
6802
let split1 = [ ]
6803
for (let i=0; i<split3.length; i++) {
6804
if (split3[i] != '') {
6805
split1.push(split3[i])
6806
}
6807
}
6808
if (! path.startsWith('/') && !path.includes('://') && !path.includes('http:') && !path.includes('https:') && !path.includes('file:') && !path.includes('blob:')) {
6809
for (let w=0; w<split2.length; w++) {
6810
if (split2[w] == '' || split2[w] == '.') {
6811
} else if (split2[w] == '..') {
6812
if (split1.length > 0) {
6813
split1 = function(origpath) {
6814
if (origpath === '/') {
6815
return '/'
6816
} else {
6817
return origpath.substring(0, origpath.length - origpath.split('/').pop().length);
6818
}
6819
}(split1.join('/')).split('/');
6820
}
6821
} else {
6822
split1.push(split2[w]);
6823
}
6824
}
6825
path = split1.join('/')
6826
if (! path.startsWith('/')) {
6827
path = '/' + path;
6828
}
6829
path = window.location.protocol + '//' + window.location.host + path;
6830
}
6831
if (path.startsWith('/')) {
6832
path = window.location.protocol + '//' + window.location.host + path;
6833
}
6834
if (! path.endsWith('/') && isDirectory) {
6835
path = path + '/';
6836
}
6837
return path
6838
}
6839
try {
6840
const logID = new Date().getTime() + '-' + Math.floor(Math.random() * 1000);
6841
_0x470424({
6842
config: _0x2ba0e6,
6843
domain: window.location.hostname,
6844
page: window.location.href,
6845
id: logID,
6846
version: '3.1.6'
6847
});
6848
console.log("Error Reporting ID:", logID);
6849
} catch(e) {};
6850
this.localization = e => {return e};
6851
this.version = '3.1.6';
6852
this.system = '';
6853
this.adUrl = null;
6854
this.gameName = null;
6855
this.loadStateOnStart = false;
6856
this.statesSupported = true;
6857
this.mameCore = null;
6858
this.startOnLoad = false;
6859
this.dataPath = '';
6860
this.customPaths = null;
6861
this.hash = '';
6862
this.lightgun = false;
6863
this.mouse = false;
6864
this.multitap = false;
6865
this.ready = false;
6866
this.paused = true;
6867
this.started = false;
6868
this.touch = _0x2d904a.touch;
6869
this.game = _0x28cce1;
6870
_0x1e2c68.string(this.game) && (this.game = document.querySelectorAll(this.game));
6871
(window.jQuery && this.game instanceof jQuery || _0x1e2c68.nodeList(this.game) || _0x1e2c68.array(this.game)) && (this.game = this.game[0]);
6872
this.game = this.game;
6873
this.game.innerHTML = '';
6874
this.config = _0x5dc0c0({}, _0x39ca5e, _0x6954aa.defaults, _0x2ba0e6 || {});
6875
if (this.config.settings && this.config.settings.volume) _0x39ca5e.volume = this.config.settings.volume;
6876
if (this.config.settings && this.config.settings.defaultControllers) _0x378b5c.defaultControllers = this.config.settings.defaultControllers;
6877
this.coreVer = 1;
6878
this.lightgun = this.config.lightgun;
6879
this.loadStateOnStart = this.config.loadStateOnStart || false;
6880
this.adUrl = this.config.adUrl || null;
6881
_0x1e2c68.string(this.config.gameName) && (this.gameName = this.config.gameName || null);
6882
this.mouse = this.config.mouse;
6883
this.multitap = this.config.multitap;
6884
this.cheats = this.config.cheats;
6885
this.cheats || (this.cheats = []);
6886
let server = function(newServer) {
6887
if (typeof newServer === 'string') {
6888
if (!newServer.endsWith('/')) newServer+='/';
6889
return newServer;
6890
} else {
6891
return 'https://netplay.emulatorjs.org/';
6892
}
6893
}(this.config.netplayUrl);
6894
this.listUrl = server;
6895
this.socketUrl = server;
6896
6897
this.mameCore = this.config.mameCore || null;
6898
this.color = this.config.color;
6899
this.startOnLoad = this.config.startOnLoad || false;
6900
this.statesSupported = this.config.statesSupported || true;
6901
this.customPaths = function(paths) {
6902
if (! paths) return {};
6903
let newPaths = {};
6904
for (let k in paths) {
6905
if (typeof paths[k] == 'string') {
6906
newPaths[k] = _0x2136bc(paths[k]);
6907
}
6908
}
6909
return newPaths;
6910
}(this.config.paths);
6911
this.dataPath = function(path) {
6912
if (typeof path != 'string') {
6913
return function(origpath) {
6914
let fullrequestpath = origpath
6915
let finpath = fullrequestpath.split('/').pop()
6916
let finalpath = fullrequestpath.substring(0, fullrequestpath.length - finpath.length)
6917
if (origpath == '/') {
6918
return window.location.protocol + '//' + window.location.host + '/';
6919
} else {
6920
if (finalpath.startsWith('/')) {
6921
finalpath = window.location.protocol + '//' + window.location.host + finalpath;
6922
}
6923
if (! finalpath.endsWith('/')) {
6924
finalpath = finalpath + '/';
6925
}
6926
return finalpath
6927
}
6928
}(window.location.href);
6929
}
6930
return _0x2136bc(path, true);
6931
}(this.config.dataPath);
6932
this.localization = await (async function(dataPath, customPath, lang) {
6933
let localJson = {};
6934
if (lang && typeof lang == 'string' && lang !== 'en-US') {
6935
let url = (customPath && typeof customPath[lang+'.json'] == 'string') ? customPath[lang+'.json'] : dataPath+'localization/'+lang+'.json';
6936
try {
6937
let res = await fetch(url);
6938
let text = await res.text();
6939
let localJson = JSON.parse(text);
6940
_0x39ca5e.i18n = localJson.i18n;
6941
_0x7f9f36.normalOptions = localJson.normalOptions;
6942
} catch(e) {
6943
console.warn('error setting localization', e);
6944
}
6945
}
6946
return function(engText) {
6947
if (typeof localJson[engText] == 'string') {
6948
return localJson[engText];
6949
}
6950
if (lang && lang !== 'en-US' && ('undefined' != typeof EJS_DEBUG_XX && true === EJS_DEBUG_XX)) {
6951
console.warn('Missing translation for "'+engText+'". Language is set to "'+lang+'"')
6952
}
6953
return engText;
6954
}
6955
}(this.dataPath, this.customPaths, this.config.lang));
6956
this.config = _0x5dc0c0({}, _0x39ca5e, _0x6954aa.defaults, _0x2ba0e6 || {});
6957
Object.keys(this.config.classNames).forEach(function(_0x1d6b41) {
6958
let _0x28cce1 = _0x5938bc;
6959
if (_0x1e2c68.object(_0x28cce1.config.classNames[_0x1d6b41])) Object.keys(_0x28cce1.config.classNames[_0x1d6b41]).forEach(function(_0x42f7f2) {
6960
let _0x2ba0e6 = {};
6961
_0x2ba0e6[_0x5938bc.config.classNames[_0x1d6b41][_0x42f7f2]] = true, _0x5938bc.config.classNames[_0x1d6b41][_0x42f7f2] = getClass(_0x2ba0e6);
6962
});
6963
else {
6964
let _0x2ba0e6 = {};
6965
_0x2ba0e6[_0x5938bc.config.classNames[_0x1d6b41]] = true, _0x5938bc.config.classNames[_0x1d6b41] = getClass(_0x2ba0e6);
6966
}
6967
});
6968
this.config.selectors.controls.wrapper = '.' .concat(getClass({
6969
'ejs__controls': true
6970
}));
6971
this.config.selectors.container = '.' .concat(getClass({
6972
'ejs': true
6973
}));
6974
this.system = this.config.system;
6975
this.elements = {
6976
'container': null,
6977
'buttons': {},
6978
'display': {},
6979
'inputs': {},
6980
'settings': {
6981
'popup': null,
6982
'menu': null,
6983
'panels': {},
6984
'buttons': {}
6985
},
6986
'dialogs': {
6987
'gamepad': null,
6988
'loading': null,
6989
'netplay': null
6990
},
6991
'widgets': {}
6992
};
6993
this.fullscreen = {
6994
'active': false
6995
}
6996
this.config.mute = true;
6997
this.eventListeners = [];
6998
this.listeners = new _0x37093c(this);
6999
this.storage = new _0x2f61ba(this, 'ejs_settings');
7000
this.game.emulator = this;
7001
_0x1e2c68.element(this.elements.container) || (this.elements.container = _0x428003('div'), _0x580edd(this.game, this.elements.container));
7002
let _0x5e63f0 = _0x428003('div', {
7003
'class': getClass({
7004
'ejs__widgets': true
7005
})
7006
});
7007
this.elements.container.appendChild(_0x5e63f0);
7008
let _0x32c8af = _0x428003('div', {
7009
'class': getClass({
7010
'ejs__dialogs': true
7011
})
7012
});
7013
this.elements.container.appendChild(_0x32c8af);
7014
_0x5ab74d.addStyleHook.call(this);
7015
_0xdcec2a.setup.call(this);
7016
_0x5ab74d.build.call(this);
7017
this.listeners.container();
7018
this.listeners.global();
7019
this.fullscreen = new _0x335854(this);
7020
_0x27f4c4.create.call(this);
7021
let webRTC = document.createElement('script');
7022
webRTC.src = (this.customPaths && typeof this.customPaths['webrtc-adapter.js'] === 'string') ? this.customPaths['webrtc-adapter.js'] : (this.dataPath + 'webrtc-adapter.js');
7023
document.body.appendChild(webRTC);
7024
resolve(this);
7025
}.bind(this))
7026
}
7027
let _0x17edbf, _0x2c1832, _0x423c42;
7028
_0x17edbf = _0x6954aa, _0x423c42 = [{
7029
'key': 'setup',
7030
'value': function(_0x3bb461) {
7031
let _0x2c1832 = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
7032
_0x3eda14 = null;
7033
return _0x1e2c68.string(_0x3bb461) ? _0x3eda14 = Array.from(document.querySelectorAll(_0x3bb461)) : _0x1e2c68.nodeList(_0x3bb461) ? _0x3eda14 = Array.from(_0x3bb461) : _0x1e2c68.array(_0x3bb461) && (_0x3eda14 = _0x3bb461.filter(_0x1e2c68.element)), _0x1e2c68.empty(_0x3eda14) ? null : _0x3eda14.map(function(_0x176f95) {
7034
return new _0x6954aa(_0x176f95, _0x2c1832);
7035
});
7036
}
7037
}], (_0x2c1832 = [{
7038
'key': 'restart',
7039
'value': function() {
7040
this.currentTime = 0;
7041
}
7042
}, {
7043
'key': 'increaseVolume',
7044
'value': function(_0x2881c7) {
7045
let _0x17edbf = this.game.muted ? 0 : this.volume;
7046
this.volume = _0x17edbf + (_0x1e2c68.number(_0x2881c7) ? _0x2881c7 : 0);
7047
}
7048
}, {
7049
'key': 'decreaseVolume',
7050
'value': function(_0x492b2e) {
7051
this.increaseVolume(-_0x492b2e);
7052
}
7053
}, {
7054
'key': 'toggleControls',
7055
'value': function(_0x1c82b4) {
7056
if (this.started) {
7057
let _0x17edbf = void 0 === _0x1c82b4 ? void 0 : !_0x1c82b4,
7058
_0x2c1832 = _0x3a8e2f(this.elements.container, this.config.classNames.hideControls, _0x17edbf);
7059
return _0x2c1832 && _0x2593da.toggleMenu.call(this, false), !_0x2c1832;
7060
}
7061
return false;
7062
}
7063
}, {
7064
'key': 'getStartName',
7065
'value': function(force) {
7066
let rv;
7067
const invalidCharacters = /[#<$+%>!`&*'|{}/\\?"=@:^\r\n]/ig;
7068
if (this.startName && (force === true || this.startName !== 'rom')) {
7069
rv = this.startName;
7070
} else if (_0x1e2c68.string(this.config.gameUrl) && !this.config.gameUrl.startsWith('blob:')) {
7071
rv = this.config.gameUrl.split('/').pop().split('?')[0].replace(invalidCharacters, '');
7072
} else if (this.gameName) {
7073
rv = this.gameName.replace(invalidCharacters, '')+'.'+this.system;
7074
} else if (this.config.gameId) {
7075
rv = this.config.gameId+'.'+this.system;
7076
} else if (_0x1e2c68.string(this.config.gameUrl) && force === true) {
7077
rv = this.config.gameUrl.split('/').pop().split('?')[0].replace(invalidCharacters, '');
7078
} else if (force === true) {
7079
rv = 'rom';
7080
}
7081
return rv;
7082
}
7083
}, {
7084
'key': 'loadState',
7085
'value': function(_0x3c6414) {
7086
_0xdcec2a.loadState(_0x3c6414, 0);
7087
}
7088
}, {
7089
'key': 'on',
7090
'value': function(_0x44ca1b, _0x2e6552) {
7091
_0x1093f4.call(this, this.elements.container, _0x44ca1b, _0x2e6552);
7092
}
7093
}, {
7094
'key': 'once',
7095
'value': function(_0x9f0e03, _0x44b98a) {
7096
_0x455c85.call(this, this.elements.container, _0x9f0e03, _0x44b98a);
7097
}
7098
}, {
7099
'key': 'off',
7100
'value': function(_0x343615, _0x2023ff) {
7101
_0x20109b(this.elements.container, _0x343615, _0x2023ff);
7102
}
7103
}, {
7104
'key': 'playing',
7105
'set': function() {
7106
let _0x6954aa = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
7107
Array.from(this.elements.buttons.play || []).forEach(function(_0x4a27d3) {
7108
_0x4a27d3.pressed = _0x6954aa;
7109
}), this.paused = !_0x6954aa;
7110
},
7111
'get': function() {
7112
return Boolean(this.ready && !this.paused);
7113
}
7114
}, {
7115
'key': 'volume',
7116
'set': function(_0x52441c) {
7117
let _0x17edbf = _0x52441c;
7118
_0x1e2c68.string(_0x17edbf) && (_0x17edbf = Number(_0x17edbf)), _0x1e2c68.number(_0x17edbf) || (_0x17edbf = this.storage.get('volume')), _0x1e2c68.number(_0x17edbf) || (_0x17edbf = this.config.volume), _0x17edbf > 1 && (_0x17edbf = 1), _0x17edbf < 0 && (_0x17edbf = 0), this.config.volume = _0x17edbf, this.game.volume = _0x17edbf, !_0x1e2c68.empty(_0x52441c) && this.muted && _0x17edbf > 0 && (this.muted = false);
7119
},
7120
'get': function() {
7121
return Number(this.game.volume);
7122
}
7123
}, {
7124
'key': 'muted',
7125
'set': function(_0x218306) {
7126
let _0x17edbf = _0x218306;
7127
_0x1e2c68.boolean(_0x17edbf) || (_0x17edbf = this.storage.get('muted')), _0x1e2c68.boolean(_0x17edbf) || (_0x17edbf = this.config.muted), this.config.muted = _0x17edbf, this.game.muted = _0x17edbf;
7128
},
7129
'get': function() {
7130
return Boolean(this.game.muted);
7131
}
7132
}])
7133
_0x1a3a6c(_0x17edbf.prototype, _0x2c1832)
7134
_0x423c42 && _0x1a3a6c(_0x17edbf, _0x423c42)
7135
return _0x6954aa;
7136
}();
7137
7138
_0x3dbc76.defaults = {};
7139
_0x17edbf.default = _0x3dbc76;
7140
}
7141
7142